|
|
@@ -101,6 +101,7 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
IPage<DistributePageVo> page = this.selectJoinListPage(ConventPage.getPage(dto), DistributePageVo.class, wfTextbookClaimMPJLambdaWrapper);
|
|
|
|
|
|
List<DistributePageVo> distributePageVos = page.getRecords();
|
|
|
+
|
|
|
// 处理申领总数量和已经发放总数量
|
|
|
if(ObjectUtils.isNotEmpty(distributePageVos)){
|
|
|
List<Long> textbookClaimIds = distributePageVos.stream()
|
|
|
@@ -282,10 +283,21 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
issueTotalNum += wfTextbookClaimItem.getIssueNumber();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// 获取所有入库记录
|
|
|
+ List<Long> textbookWarehouseRecordIds = new ArrayList<>();
|
|
|
+ for(ConfirmDistributeDto.TextbookClaimItem textbookClaimItem : dto.getTextbookClaimItemList()){
|
|
|
+ for(ConfirmDistributeDto.TextbookWarehouseRecords textbookWarehouseRecords: textbookClaimItem.getTextbookWarehouseRecords()){
|
|
|
+ textbookWarehouseRecordIds.add(textbookWarehouseRecords.getTextbookWarehouseRecordId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if(ObjectUtils.isEmpty(textbookWarehouseRecordIds)){
|
|
|
+ throw new MyException("当前发放项来源入库单号无效");
|
|
|
+ }
|
|
|
+
|
|
|
List<TextbookWarehouseRecord> textbookWarehouseRecordList = textbookWarehouseRecordMapper.selectList(
|
|
|
Wrappers.lambdaQuery(TextbookWarehouseRecord.class)
|
|
|
+ .in(TextbookWarehouseRecord::getId, textbookWarehouseRecordIds)
|
|
|
.eq(TextbookWarehouseRecord::getDeleteMark, DeleteMark.NODELETE.getCode())
|
|
|
);
|
|
|
|
|
|
@@ -313,8 +325,8 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
int oldOrderInteger = 0;
|
|
|
int oldOrderLastInteger = 0;
|
|
|
|
|
|
-
|
|
|
//操作每一个申领项
|
|
|
+ WfTextbookClaimItem updateWfTextbookClaimItem;
|
|
|
for (ConfirmDistributeDto.TextbookClaimItem textbookClaimItem : dto.getTextbookClaimItemList()) {
|
|
|
// WfTextbookClaimItem wfTextbookClaimItem = wfTextbookClaimWfTextbookClaimItemMapper.selectById(textbookClaimItem.getTextbookClaimItemId());
|
|
|
WfTextbookClaimItem wfTextbookClaimItem = wfTextbookClaimItemMap.get(textbookClaimItem.getTextbookClaimItemId());
|
|
|
@@ -370,6 +382,7 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
.last("limit 1")
|
|
|
;
|
|
|
TextbookIssueRecord maxOrderNumber = textbookIssueRecordMapper.selectOne(maxOrderNumberLambdaQueryWrapper);
|
|
|
+
|
|
|
if(ObjectUtils.isNotEmpty(maxOrderNumber)
|
|
|
&& ObjectUtils.isNotEmpty(maxOrderNumber.getOrderNumber())
|
|
|
){
|
|
|
@@ -405,34 +418,48 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
if(ObjectUtils.isNotEmpty(dto.getReceiveUserId())){
|
|
|
textbookIssueRecord.setReceiveUserId(dto.getReceiveUserId());
|
|
|
}else {
|
|
|
- textbookIssueRecord.setReceiveUserId(StpUtil.getLoginIdAsLong());
|
|
|
+ textbookIssueRecord.setReceiveUserId(wfTextbookClaim.getApplicantUserId());
|
|
|
}
|
|
|
textbookIssueRecord.setIssueUserId(StpUtil.getLoginIdAsLong());
|
|
|
textbookIssueRecord.setCreateDate(nowDate);;
|
|
|
textbookIssueRecord.setRemark(dto.getRemark());
|
|
|
textbookIssueRecord.setIssueTimes(issueTimes);
|
|
|
|
|
|
- int sortCode = SortCodeUtil.getMaxSortCode(textbookIssueRecordMapper, TextbookIssueRecord.class, "sort_code");
|
|
|
- textbookIssueRecord.setSortCode(sortCode + 1);
|
|
|
-
|
|
|
textbookIssueRecordMapper.insert(textbookIssueRecord);
|
|
|
}
|
|
|
+
|
|
|
+ // 修改征订项发放数量
|
|
|
+ updateWfTextbookClaimItem = new WfTextbookClaimItem();
|
|
|
+ updateWfTextbookClaimItem.setId(wfTextbookClaimItem.getId());
|
|
|
+ updateWfTextbookClaimItem.setIssueNumber(
|
|
|
+ ObjectUtils.isEmpty(wfTextbookClaimItem.getIssueNumber()) ? 0 : wfTextbookClaimItem.getIssueNumber()
|
|
|
+ + textbookClaimItem.getConfirmTotalNumber()
|
|
|
+ );
|
|
|
+ wfTextbookClaimWfTextbookClaimItemMapper.updateById(updateWfTextbookClaimItem);
|
|
|
}
|
|
|
|
|
|
+ // 查询当前申领所有子项是否已经完成, 发放数量大于申领数量
|
|
|
+ MPJLambdaWrapper<WfTextbookClaimItem> wfTextbookClaimItemMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ wfTextbookClaimItemMPJLambdaWrapper
|
|
|
+ .select(WfTextbookClaimItem::getId)
|
|
|
+ .innerJoin(WfTextbookClaim.class, WfTextbookClaim::getId, WfTextbookClaimItem::getWfTextbookClaimId)
|
|
|
+ .lt(WfTextbookClaimItem::getIssueNumber, WfTextbookClaimItem::getApplicantNumber)
|
|
|
+ .eq(WfTextbookClaimItem::getWfTextbookClaimId, wfTextbookClaim.getId())
|
|
|
+ ;
|
|
|
+ long count = wfTextbookClaimWfTextbookClaimItemMapper.selectCount(wfTextbookClaimItemMPJLambdaWrapper);
|
|
|
+
|
|
|
WfTextbookClaim updateWfTextbookClaim = new WfTextbookClaim();
|
|
|
- updateWfTextbookClaim.setModifyUserId(StpUtil.getLoginIdAsLong());
|
|
|
- updateWfTextbookClaim.setModifyDate(nowDate);
|
|
|
updateWfTextbookClaim.setId(wfTextbookClaim.getId());
|
|
|
- if(claimTotalNum > issueTotalNum){
|
|
|
+ if(count > 0){
|
|
|
updateWfTextbookClaim.setStatus(2);
|
|
|
- }
|
|
|
- if(claimTotalNum > issueTotalNum){
|
|
|
+ }else {
|
|
|
updateWfTextbookClaim.setStatus(3);
|
|
|
}
|
|
|
updateWfTextbookClaim.setIssueTimes(issueTimes);
|
|
|
+ updateWfTextbookClaim.setModifyUserId(StpUtil.getLoginIdAsLong());
|
|
|
+ updateWfTextbookClaim.setModifyDate(nowDate);
|
|
|
//更新申领项中的已经发放数量
|
|
|
wfTextbookClaimWfTextbookClaimMapper.updateById(updateWfTextbookClaim);
|
|
|
-
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
@@ -472,6 +499,8 @@ public class WfTextbookClaimServiceImpl extends MPJBaseServiceImpl<WfTextbookCla
|
|
|
|
|
|
//申领类型是班级申领,学生代表可领取
|
|
|
if (ClaimTypeEnum.ClaimClass.getCode().equals(wfTextbookClaim.getClaimType())
|
|
|
+ && ObjectUtils.isNotEmpty(wfTextbookClaim.getApplicantUserId())
|
|
|
+ && ObjectUtils.isNotEmpty(wfTextbookClaim.getStudentUserId())
|
|
|
&& !Objects.equals(wfTextbookClaim.getApplicantUserId(), wfTextbookClaim.getStudentUserId())
|
|
|
) {
|
|
|
textbookClaimUserList.add(new TextbookClaimUser() {{
|