|
|
@@ -196,6 +196,8 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
BaseSemester baseSemester = baseSemesterMapper.selectById(dto.getBaseSemesterId());
|
|
|
|
|
|
Long loginId = StpUtil.getLoginIdAsLong();
|
|
|
+
|
|
|
+ dto.setStudentUserId(loginId);
|
|
|
// 获取当前学生的信息
|
|
|
MPJLambdaWrapper<BaseStudentSchoolRoll> baseStudentSchoolRollMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
baseStudentSchoolRollMPJLambdaWrapper
|
|
|
@@ -793,7 +795,7 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
Date nowDate = new Date();
|
|
|
Long loginUserId = StpUtil.getLoginIdAsLong();
|
|
|
for (TeacherConfirmDto dto : dtos){
|
|
|
- if (ObjectUtils.isNotEmpty(dto.getTextbookStudentClaimId())) {
|
|
|
+ if (ObjectUtils.isNotEmpty(dto.getTextbookStudentClaimId()) && dto.getTextbookStudentClaimId() != 0) {
|
|
|
updateTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
updateTextbookStudentClaim.setId(dto.getTextbookStudentClaimId());
|
|
|
updateTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
@@ -854,13 +856,21 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
throw new MyException("学生信息有误,请重新登录");
|
|
|
}
|
|
|
|
|
|
+ List<Long> textbookIds = dto.getStudentConfirmDetail().stream()
|
|
|
+ .map(StudentConfirmDetailDto::getTextbookId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(textbookIds)){
|
|
|
+ throw new MyException("请选择需要确认的教材");
|
|
|
+ }
|
|
|
+
|
|
|
// 根据学期,班级,学生,教材信息获取记录
|
|
|
LambdaQueryWrapper<TextbookStudentClaim> textbookStudentClaimLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
textbookStudentClaimLambdaQueryWrapper
|
|
|
.eq(TextbookStudentClaim::getBaseSemesterId, dto.getBaseSemesterId())
|
|
|
.eq(TextbookStudentClaim::getClassId, baseStudentSchoolRoll.getClassId())
|
|
|
.eq(TextbookStudentClaim::getStudentUserId, baseStudentSchoolRoll.getUserId())
|
|
|
- .in(TextbookStudentClaim::getTextbookId, dto.getTextbookIds())
|
|
|
+ .in(TextbookStudentClaim::getTextbookId, textbookIds)
|
|
|
;
|
|
|
List<TextbookStudentClaim> textbookStudentClaimList = textbookStudentClaimMapper.selectList(textbookStudentClaimLambdaQueryWrapper);
|
|
|
|
|
|
@@ -874,25 +884,34 @@ public class TextbookStudentClaimServiceImpl extends MPJBaseServiceImpl<Textbook
|
|
|
TextbookStudentClaim updateTextbookStudentClaim;
|
|
|
Date nowDate = new Date();
|
|
|
Long loginUserId = StpUtil.getLoginIdAsLong();
|
|
|
- for (Long textbookId : dto.getTextbookIds()){
|
|
|
- oldTextbookStudentClaim = byUserIdAndTextbookId.get("" + baseStudentSchoolRoll.getUserId() + textbookId);
|
|
|
- if(ObjectUtils.isNotEmpty(oldTextbookStudentClaim)){
|
|
|
+ for (StudentConfirmDetailDto studentConfirmDetailDto : dto.getStudentConfirmDetail()){
|
|
|
+ if (ObjectUtils.isNotEmpty(studentConfirmDetailDto.getTextbookStudentClaimId()) && studentConfirmDetailDto.getTextbookStudentClaimId() != 0 ) {
|
|
|
updateTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
- updateTextbookStudentClaim.setId(oldTextbookStudentClaim.getId());
|
|
|
+ updateTextbookStudentClaim.setId(studentConfirmDetailDto.getTextbookStudentClaimId());
|
|
|
updateTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
- updateTextbookStudentClaim.setModifyDate(nowDate);
|
|
|
updateTextbookStudentClaim.setModifyUserId(loginUserId);
|
|
|
+ updateTextbookStudentClaim.setModifyDate(nowDate);
|
|
|
updateList.add(updateTextbookStudentClaim);
|
|
|
- }else {
|
|
|
- insertTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
- insertTextbookStudentClaim.setBaseSemesterId(dto.getBaseSemesterId());
|
|
|
- insertTextbookStudentClaim.setClassId(baseStudentSchoolRoll.getClassId());
|
|
|
- insertTextbookStudentClaim.setStudentUserId(baseStudentSchoolRoll.getUserId());
|
|
|
- insertTextbookStudentClaim.setTextbookId(textbookId);
|
|
|
- insertTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
- insertTextbookStudentClaim.setCreateDate(nowDate);
|
|
|
- insertTextbookStudentClaim.setCreateUserId(loginUserId);
|
|
|
- insertList.add(insertTextbookStudentClaim);
|
|
|
+ } else {
|
|
|
+ oldTextbookStudentClaim = byUserIdAndTextbookId.get("" + baseStudentSchoolRoll.getUserId() + studentConfirmDetailDto.getTextbookId());
|
|
|
+ if(ObjectUtils.isNotEmpty(oldTextbookStudentClaim)){
|
|
|
+ updateTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
+ updateTextbookStudentClaim.setId(oldTextbookStudentClaim.getId());
|
|
|
+ updateTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
+ updateTextbookStudentClaim.setModifyDate(nowDate);
|
|
|
+ updateTextbookStudentClaim.setModifyUserId(loginUserId);
|
|
|
+ updateList.add(updateTextbookStudentClaim);
|
|
|
+ }else {
|
|
|
+ insertTextbookStudentClaim = new TextbookStudentClaim();
|
|
|
+ insertTextbookStudentClaim.setBaseSemesterId(dto.getBaseSemesterId());
|
|
|
+ insertTextbookStudentClaim.setClassId(baseStudentSchoolRoll.getClassId());
|
|
|
+ insertTextbookStudentClaim.setStudentUserId(baseStudentSchoolRoll.getUserId());
|
|
|
+ insertTextbookStudentClaim.setTextbookId(studentConfirmDetailDto.getTextbookId());
|
|
|
+ insertTextbookStudentClaim.setIsClaim(dto.getIsClaim());
|
|
|
+ insertTextbookStudentClaim.setCreateDate(nowDate);
|
|
|
+ insertTextbookStudentClaim.setCreateUserId(loginUserId);
|
|
|
+ insertList.add(insertTextbookStudentClaim);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|