From 81a1bd61125f9a3ea6caa8bbb79dc9ecf45bb139 Mon Sep 17 00:00:00 2001 From: jing's Date: Wed, 27 Dec 2023 17:51:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E5=A4=84=E7=90=86=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BomNewEbomParentService.java | 99 ++++++++++++++----- 1 file changed, 73 insertions(+), 26 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index 15892415..dfa936ae 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -245,6 +245,7 @@ public class BomNewEbomParentService extends ServiceImpl 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(CollectionUtil.isNotEmpty(revertList)) { + UpdateWrapper updateWrapper = new UpdateWrapper<>(); + updateWrapper.lambda() + .set(BomNewEbomParentEntity::getAuditTime, LocalDateTime.now()) + .set(BomNewEbomParentEntity::getAuditUserName, SessionUtil.getUserName()) + .set(BomNewEbomParentEntity::getStatus, EBomStatusEnum.RETURNED.getValue()) + .set(BomNewEbomParentEntity::getEditStatus, EbomEditStatusEnum.HANDLER_CREATED.getValue()) + .in(BomNewEbomParentEntity::getRowId, revertList); + + UpdateWrapper 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)) { - throw new NflgBusinessException(STATE.Error, "退回设计失败"); - } + //重新创建保存list 避免污染 +// List 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 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(CollectionUtil.isNotEmpty(updateReviewIdList)){ + UpdateWrapper updateWrapper=new UpdateWrapper<>(); + updateWrapper.lambda() + .set(BomNewEbomParentEntity::getAuditTime,LocalDateTime.now()) + .set(BomNewEbomParentEntity::getAuditUserName,SessionUtil.getUserName()) + .set(BomNewEbomParentEntity::getStatus,EBomStatusEnum.CHECKED.getValue()) + .set(BomNewEbomParentEntity::getEditStatus,EbomEditStatusEnum.HANDLER_FINISHED.getValue()) + .in(BomNewEbomParentEntity::getRowId,updateReviewIdList); + + UpdateWrapper 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 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; }