已处理调整

This commit is contained in:
jing's 2023-12-27 17:51:41 +08:00
parent a65025da79
commit 81a1bd6112
1 changed files with 73 additions and 26 deletions

View File

@ -245,6 +245,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
child.setCurrentVersion(parentEntity.getCurrentVersion()); child.setCurrentVersion(parentEntity.getCurrentVersion());
child.setStatus(parentEntity.getStatus()); child.setStatus(parentEntity.getStatus());
child.setDeviseName(parentEntity.getDeviseName()); child.setDeviseName(parentEntity.getDeviseName());
child.setDeviseUserCode(parentEntity.getDeviseUserCode()); child.setDeviseUserCode(parentEntity.getDeviseUserCode());
@ -256,7 +257,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
child.setSourceRowId(parentEntity.getSourceRowId()); child.setSourceRowId(parentEntity.getSourceRowId());
child.setBomExist(parentEntity.getBomExist()); child.setBomExist(parentEntity.getBomExist());
child.setShouldBomExist(parentEntity.getShouldBomExist()); child.setShouldBomExist(parentEntity.getShouldBomExist());
child.setStatus(parentEntity.getStatus());
if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) { if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
child.setStatus(OriginalStatusEnum.BORROWED_PARTS.getValue()); child.setStatus(OriginalStatusEnum.BORROWED_PARTS.getValue());
@ -268,6 +269,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
child.setDeviseUserCode(parent.getDeviseUserCode()); child.setDeviseUserCode(parent.getDeviseUserCode());
child.setDeviseName(parent.getDeviseName()); child.setDeviseName(parent.getDeviseName());
child.setDeptName(parent.getDeptName()); child.setDeptName(parent.getDeptName());
if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) { if (MaterialshouldBomExistUtil.checkShouldBomExist(child)) {
child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION); child.setCurrentVersion(OriginalConstant.NO_BOM_VERSION);
child.setStatus(parent.getStatus()); child.setStatus(parent.getStatus());
@ -788,21 +790,44 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
} }
//重新创建保存list 避免污染
List<BomNewEbomParentEntity> updateList = new ArrayList<>(); if(CollectionUtil.isNotEmpty(revertList)) {
for (Long rowId : revertList) { UpdateWrapper<BomNewEbomParentEntity> updateWrapper = new UpdateWrapper<>();
BomNewEbomParentEntity entity = new BomNewEbomParentEntity(); updateWrapper.lambda()
entity.setRowId(rowId); .set(BomNewEbomParentEntity::getAuditTime, LocalDateTime.now())
entity.setStatus(EBomStatusEnum.RETURNED.getValue()); .set(BomNewEbomParentEntity::getAuditUserName, SessionUtil.getUserName())
entity.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue()); .set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.RETURNED.getValue())
entity.setRevertTime(LocalDateTime.now()); .set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue())
entity.setRevertUserName(dto.getRevertUserName()); .in(BomNewEbomParentEntity::getRowId, revertList);
updateList.add(entity);
UpdateWrapper<BomNewEbomChildEntity > childWrapper = new UpdateWrapper<>();
childWrapper.lambda()
.set(BomNewEbomChildEntity::getModifyTime, LocalDateTime.now())
.set(BomNewEbomChildEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue())
.in(BomNewEbomChildEntity ::getParentRowId, revertList);
if (!this.update(updateWrapper)) {
throw new NflgBusinessException(STATE.Error, "退回设计失败");
}
ebomChildService.update(childWrapper);
} }
if (!this.updateBatchById(updateList)) { //重新创建保存list 避免污染
throw new NflgBusinessException(STATE.Error, "退回设计失败"); // List<BomNewEbomParentEntity> updateList = new ArrayList<>();
} // for (Long rowId : revertList) {
// BomNewEbomParentEntity entity = new BomNewEbomParentEntity();
// entity.setRowId(rowId);
// entity.setStatus(EBomStatusEnum.RETURNED.getValue());
// entity.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
// entity.setRevertTime(LocalDateTime.now());
// entity.setRevertUserName(dto.getRevertUserName());
// updateList.add(entity);
// }
//
// if (!this.updateBatchById(updateList)) {
// throw new NflgBusinessException(STATE.Error, "退回设计失败");
// }
} }
@ -864,20 +889,42 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
//改变复核状态 //改变复核状态
List<BomNewEbomParentEntity> updateReviewList = new ArrayList<>(); if(CollectionUtil.isNotEmpty(updateReviewIdList)){
for (Long id : updateReviewIdList) { UpdateWrapper<BomNewEbomParentEntity> updateWrapper=new UpdateWrapper<>();
BomNewEbomParentEntity entity = new BomNewEbomParentEntity(); updateWrapper.lambda()
entity.setRowId(id); .set(BomNewEbomParentEntity::getAuditTime,LocalDateTime.now())
entity.setAuditTime(LocalDateTime.now()); .set(BomNewEbomParentEntity::getAuditUserName,SessionUtil.getUserName())
entity.setAuditUserName(dto.getRevertUserName()); .set(BomNewEbomParentEntity::getStatus,EBomStatusEnum.CHECKED.getValue())
entity.setStatus(EBomStatusEnum.CHECKED.getValue()); .set(BomNewEbomParentEntity::getEditStatus,EbomEditStatusEnum.HANDLER_FINISHED.getValue())
entity.setEditStatus(EbomEditStatusEnum.HANDLER_FINISHED.getValue()); .in(BomNewEbomParentEntity::getRowId,updateReviewIdList);
updateReviewList.add(entity);
} UpdateWrapper<BomNewEbomChildEntity > childWrapper = new UpdateWrapper<>();
childWrapper.lambda()
.set(BomNewEbomChildEntity::getModifyTime, LocalDateTime.now())
.set(BomNewEbomChildEntity::getEditStatus, EbomEditStatusEnum.HANDLER_FINISHED.getValue())
.in(BomNewEbomChildEntity ::getParentRowId, updateReviewIdList);
if (! this.update(updateWrapper)) {
throw new NflgBusinessException(STATE.Error, "复核失败");
}
ebomChildService.update(childWrapper);
if (!this.updateBatchById(updateReviewList)) {
throw new NflgBusinessException(STATE.Error, "复核失败");
} }
// List<BomNewEbomParentEntity> updateReviewList = new ArrayList<>();
// for (Long id : updateReviewIdList) {
// BomNewEbomParentEntity entity = new BomNewEbomParentEntity();
// entity.setRowId(id);
// entity.setAuditTime(LocalDateTime.now());
// entity.setAuditUserName(dto.getRevertUserName());
// entity.setStatus(EBomStatusEnum.CHECKED.getValue());
// entity.setEditStatus(EbomEditStatusEnum.HANDLER_FINISHED.getValue());
// updateReviewList.add(entity);
// }
//
// if (!this.updateBatchById(updateReviewList)) {
// throw new NflgBusinessException(STATE.Error, "复核失败");
// }
return true; return true;
} }