|
|
@@ -275,6 +275,14 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
WfTextbookClaim wfTextbookClaim = this.getByIdDeep(dto.getTextbookClaimId());
|
|
|
List<WfTextbookClaimItem> wfTextbookClaimItemList = wfTextbookClaim.getWfTextbookClaimItemList();
|
|
|
|
|
|
+ int claimTotalNum = 0;
|
|
|
+ int issueTotalNum = 0;
|
|
|
+ for (WfTextbookClaimItem wfTextbookClaimItem : wfTextbookClaimItemList){
|
|
|
+ claimTotalNum += wfTextbookClaimItem.getApplicantNumber();
|
|
|
+ issueTotalNum += wfTextbookClaimItem.getIssueNumber();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 获取所有入库记录
|
|
|
List<TextbookWarehouseRecord> textbookWarehouseRecordList = textbookWarehouseRecordMapper.selectList(
|
|
|
Wrappers.lambdaQuery(TextbookWarehouseRecord.class)
|
|
|
@@ -319,6 +327,7 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
int issueNumber = ObjectUtils.isEmpty(wfTextbookClaimItem.getIssueNumber()) ? 0 : wfTextbookClaimItem.getIssueNumber();//已发放
|
|
|
int applicantNumber = ObjectUtils.isEmpty(wfTextbookClaimItem.getApplicantNumber()) ? 0 : wfTextbookClaimItem.getApplicantNumber();//申领总数量
|
|
|
int confirmNumber = ObjectUtils.isEmpty(textbookClaimItem.getConfirmTotalNumber()) ? 0 : textbookClaimItem.getConfirmTotalNumber();//本次发放
|
|
|
+ issueTotalNum += confirmNumber;
|
|
|
if (issueNumber + confirmNumber > applicantNumber) {
|
|
|
throw new MyException(textbookClaimItem.getTextbookIdCn() + "发放总数量超出申领数量");
|
|
|
}
|
|
|
@@ -404,44 +413,21 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
|
|
|
textbookIssueRecordMapper.insert(textbookIssueRecord);
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- //更新申领项中的已经发放数量
|
|
|
- wfTextbookClaimWfTextbookClaimItemMapper.updateById(new WfTextbookClaimItem() {{
|
|
|
- setModifyUserId(StpUtil.getLoginIdAsLong());
|
|
|
- setModifyDate(new Date());
|
|
|
- setId(wfTextbookClaimItem.getId());
|
|
|
- setIssueNumber(issueNumber + confirmNumber);
|
|
|
- }});
|
|
|
-
|
|
|
- // 当申领类型为学生的时候,为班级每个学生生成领取(确认信息)认领记录
|
|
|
-// 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("申领班级有误,请核实");
|
|
|
-// }
|
|
|
-// //验证当前领取教材是否已经生成领取记录
|
|
|
-// LambdaQueryWrapper<TextbookStudentClaim> queryWrapperRecord = new LambdaQueryWrapper<>();
|
|
|
-// queryWrapperRecord
|
|
|
-// .eq(TextbookStudentClaim::getTextbookId, wfTextbookClaimItem.getTextbookId())
|
|
|
-// .eq(TextbookStudentClaim::getClassId, wfTextbookClaim.getClassId());
|
|
|
-// Long count = textbookStudentClaimMapper.selectCount(queryWrapperRecord);
|
|
|
-// //为0的时候表示该班级该书没有生成领取记录
|
|
|
-// if(count <= 0){
|
|
|
-// for (Long userId : userIdList) {
|
|
|
-// textbookStudentClaimMapper.insert(new TextbookStudentClaim() {{
|
|
|
-// setCreateUserId(StpUtil.getLoginIdAsLong());
|
|
|
-// setCreateDate(new Date());
|
|
|
-// setStudentUserId(userId);
|
|
|
-// setBaseSemesterId(wfTextbookClaim.getBaseSemesterId());
|
|
|
-// setClassId(wfTextbookClaim.getClassId());
|
|
|
-// setTextbookId(wfTextbookClaimItem.getTextbookId());
|
|
|
-// }});
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
+ WfTextbookClaim updateWfTextbookClaim = new WfTextbookClaim();
|
|
|
+ updateWfTextbookClaim.setModifyUserId(StpUtil.getLoginIdAsLong());
|
|
|
+ updateWfTextbookClaim.setModifyDate(new Date());
|
|
|
+ updateWfTextbookClaim.setId(wfTextbookClaim.getId());
|
|
|
+ if(claimTotalNum > issueTotalNum){
|
|
|
+ updateWfTextbookClaim.setStatus(2);
|
|
|
}
|
|
|
+ if(claimTotalNum > issueTotalNum){
|
|
|
+ updateWfTextbookClaim.setStatus(3);
|
|
|
+ }
|
|
|
+
|
|
|
+ //更新申领项中的已经发放数量
|
|
|
+ wfTextbookClaimWfTextbookClaimMapper.updateById(updateWfTextbookClaim);
|
|
|
return true;
|
|
|
}
|
|
|
|