|
|
@@ -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() + "发放总数量超出申领数量");
|
|
|
}
|
|
|
@@ -405,13 +414,19 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
textbookIssueRecordMapper.insert(textbookIssueRecord);
|
|
|
}
|
|
|
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
//更新申领项中的已经发放数量
|
|
|
- wfTextbookClaimWfTextbookClaimItemMapper.updateById(new WfTextbookClaimItem() {{
|
|
|
- setModifyUserId(StpUtil.getLoginIdAsLong());
|
|
|
- setModifyDate(new Date());
|
|
|
- setId(wfTextbookClaimItem.getId());
|
|
|
- setIssueNumber(issueNumber + confirmNumber);
|
|
|
- }});
|
|
|
+ wfTextbookClaimWfTextbookClaimMapper.updateById(updateWfTextbookClaim);
|
|
|
|
|
|
// 当申领类型为学生的时候,为班级每个学生生成领取(确认信息)认领记录
|
|
|
// if (ObjectUtil.isNotNull(wfTextbookClaim.getClaimType()) && wfTextbookClaim.getClaimType().equals(ClaimTypeEnum.ClaimStudent.getCode())) {
|
|
|
@@ -442,6 +457,13 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
// }
|
|
|
// }
|
|
|
}
|
|
|
+ //更新申领的发放状态为已经发放
|
|
|
+ wfTextbookClaimWfTextbookClaimItemMapper.updateById(new WfTextbookClaimItem() {{
|
|
|
+ setModifyUserId(StpUtil.getLoginIdAsLong());
|
|
|
+ setModifyDate(new Date());
|
|
|
+ setId(wfTextbookClaimItem.getId());
|
|
|
+ setIssueNumber(issueNumber + confirmNumber);
|
|
|
+ }});
|
|
|
return true;
|
|
|
}
|
|
|
|