|
|
@@ -45,6 +45,7 @@ import com.xjrsoft.module.textbook.vo.*;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -491,13 +492,14 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
List<TextbookStudentClaim> textbookStudentClaimList = textbookStudentClaimMapper.selectList(textbookStudentClaimLambdaQueryWrapper);
|
|
|
|
|
|
Map<String, TextbookStudentClaim> byClassIdAndUserIdAndBook = textbookStudentClaimList.stream()
|
|
|
- .collect(Collectors.toMap(t -> "" + t.getStudentUserId() + t.getTextbookId(), t -> t, (t1, t2) -> t1));
|
|
|
+ .collect(Collectors.toMap(t ->t.getStudentUserId() + "-" + t.getTextbookId(), t -> t, (t1, t2) -> t1));
|
|
|
|
|
|
Map<Long, List<TextbookStudentClaim>> groupByUserId = textbookStudentClaimList.stream()
|
|
|
.collect(Collectors.groupingBy(TextbookStudentClaim::getStudentUserId));
|
|
|
|
|
|
// 已经全部发完的用户
|
|
|
List<Long> allClaimUserIds = new ArrayList<>();
|
|
|
+ // 部分发了的用户
|
|
|
List<Long> partClaimUserIds = new ArrayList<>();
|
|
|
for (Map.Entry<Long, List<TextbookStudentClaim>> entry : groupByUserId.entrySet()) {
|
|
|
Long key = entry.getKey();
|
|
|
@@ -566,21 +568,31 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
IPage<TeacherCheckByStuVo> teacherCheckByStuVoList = baseStudentSchoolRollMapper.selectJoinPage(ConventPage.getPage(dto), TeacherCheckByStuVo.class, baseStudentSchoolRollMPJLambdaWrapper);
|
|
|
|
|
|
TextbookStudentClaim oldTextbookStudentClaim;
|
|
|
+ List<TextbookClaimVO> stuTextbooks;
|
|
|
+ List<TextbookClaimVO> eachStustuTextbooks;
|
|
|
+ TextbookClaimVO eachStuTextbookClaimVO;
|
|
|
for (TeacherCheckByStuVo vo : teacherCheckByStuVoList.getRecords()) {
|
|
|
- List<TextbookClaimVO> stuTextbooks = textbookByClassIdMap.get(vo.getClassId());
|
|
|
+ stuTextbooks = textbookByClassIdMap.get(vo.getClassId());
|
|
|
+ eachStustuTextbooks = new ArrayList<>();
|
|
|
+ if(ObjectUtils.isEmpty(stuTextbooks)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
for (TextbookClaimVO textbookClaimVO : stuTextbooks) {
|
|
|
- textbookClaimVO.setTextbookStudentClaimId(null);
|
|
|
- textbookClaimVO.setStudentUserId(vo.getStudentUserId());
|
|
|
- String key = "" + vo.getStudentUserId() + textbookClaimVO.getTextbookId();
|
|
|
+ eachStuTextbookClaimVO = new TextbookClaimVO();
|
|
|
+ BeanUtils.copyProperties(textbookClaimVO, eachStuTextbookClaimVO);
|
|
|
+ eachStuTextbookClaimVO.setTextbookStudentClaimId(null);
|
|
|
+ eachStuTextbookClaimVO.setStudentUserId(vo.getStudentUserId());
|
|
|
+ String key = vo.getStudentUserId() + "-" + eachStuTextbookClaimVO.getTextbookId();
|
|
|
oldTextbookStudentClaim = byClassIdAndUserIdAndBook.get(key);
|
|
|
if (ObjectUtils.isNotEmpty(oldTextbookStudentClaim)) {
|
|
|
- textbookClaimVO.setTextbookStudentClaimId(oldTextbookStudentClaim.getId());
|
|
|
- textbookClaimVO.setIsClaim(oldTextbookStudentClaim.getIsClaim());
|
|
|
+ eachStuTextbookClaimVO.setTextbookStudentClaimId(oldTextbookStudentClaim.getId());
|
|
|
+ eachStuTextbookClaimVO.setIsClaim(oldTextbookStudentClaim.getIsClaim());
|
|
|
} else {
|
|
|
- textbookClaimVO.setIsClaim(0);
|
|
|
+ eachStuTextbookClaimVO.setIsClaim(0);
|
|
|
}
|
|
|
+ eachStustuTextbooks.add(eachStuTextbookClaimVO);
|
|
|
}
|
|
|
- vo.setTextbookClaimVOList(stuTextbooks);
|
|
|
+ vo.setTextbookClaimVOList(eachStustuTextbooks);
|
|
|
}
|
|
|
|
|
|
// //将班上所有学生进行分组,查询出list集合
|
|
|
@@ -653,6 +665,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
MPJLambdaWrapper<TextbookStudentClaim> textbookStudentClaimMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
textbookStudentClaimMPJLambdaWrapper
|
|
|
.disableSubLogicDel()
|
|
|
+ .select(TextbookStudentClaim::getId)
|
|
|
.selectAs(TextbookStudentClaim::getId, TeacherCheckStuClaimVo::getTextbookStudentClaimId)
|
|
|
.selectAs(TextbookStudentClaim::getTextbookId, TeacherCheckStuClaimVo::getTextbookId)
|
|
|
.selectAs(Textbook::getBookName, TeacherCheckStuClaimVo::getBookName)
|