|
|
@@ -258,21 +258,29 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
|
|
|
|
|
|
//当申领类型为学生的时候,为班级每个学生生成领取(确认信息)认领记录
|
|
|
- //查出班上的所有学生id
|
|
|
if (ObjectUtil.isNotNull(wfTextbookClaim.getClaimType()) && wfTextbookClaim.getClaimType().equals(ClaimTypeEnum.ClaimStudent.getCode())) {
|
|
|
+ //查出班上的所有学生id
|
|
|
List<Long> userIdList = xjrUserMapper.getUserIdByClassId(wfTextbookClaim.getClassId());
|
|
|
|
|
|
if (ObjectUtil.isNull(userIdList) && userIdList.size() == 0) {
|
|
|
throw new MyException("申领班级有误,请核实");
|
|
|
}
|
|
|
|
|
|
- for (Long userId : userIdList) {
|
|
|
- textbookStudentClaimService.save(new TextbookStudentClaim() {{
|
|
|
- setStudentUserId(userId);
|
|
|
- setBaseSemesterId(wfTextbookClaim.getBaseSemesterId());
|
|
|
- setClassId(wfTextbookClaim.getClassId());
|
|
|
- setTextbookId(wfTextbookClaimItem.getTextbookId());
|
|
|
- }});
|
|
|
+ LambdaQueryWrapper<TextbookStudentClaim> queryWrapperRecord = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapperRecord
|
|
|
+ .eq(TextbookStudentClaim::getTextbookId, wfTextbookClaimItem.getTextbookId())
|
|
|
+ .eq(TextbookStudentClaim::getStudentUserId, wfTextbookClaim.getClassId());
|
|
|
+ Long count = textbookStudentClaimService.count(queryWrapperRecord);
|
|
|
+ //为0的时候表示该班级该书没有生成领取记录
|
|
|
+ if(count <= 0){
|
|
|
+ for (Long userId : userIdList) {
|
|
|
+ textbookStudentClaimService.save(new TextbookStudentClaim() {{
|
|
|
+ setStudentUserId(userId);
|
|
|
+ setBaseSemesterId(wfTextbookClaim.getBaseSemesterId());
|
|
|
+ setClassId(wfTextbookClaim.getClassId());
|
|
|
+ setTextbookId(wfTextbookClaimItem.getTextbookId());
|
|
|
+ }});
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|