From c9e03f50097efcc341e65487b7eaf82da66685e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Thu, 11 Apr 2024 10:22:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=AD=90=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E4=B8=BA=E7=A9=BA=E5=88=A4=E6=96=AD=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E4=B8=BA=E7=A9=BA=E5=88=99=E4=B8=8D=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BomNewPbomParentService.java | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java index 95d71802..2c911632 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewPbomParentService.java @@ -243,13 +243,13 @@ public class BomNewPbomParentService extends ServiceImpl(result)).writeTo(response.getOutputStream()); } - public List getChild(Long rowId) { - - List parentChild = this.getBaseMapper().getParentChild(rowId); - BomNewPbomParentEntity parent = this.getById(rowId); + public List getChild(BomNewPbomParentEntity parent) { + //List parentChild = this.getBaseMapper().getParentChild(rowId); + //BomNewPbomParentEntity parent = this.getById(rowId); + List parentChild = this.getBaseMapper().getParentChild(parent.getRowId()); if (CollUtil.isNotEmpty(parentChild)) { materialMainService.intiMaterialInfo(parentChild, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); - List materialNos = parentChild.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); + List materialNos = parentChild.stream().map(BaseMaterialVO::getMaterialNo).collect(Collectors.toList()); if (CollUtil.isNotEmpty(materialNos)) { List list = this.lambdaQuery().in(BomNewPbomParentEntity::getMaterialNo, materialNos) .eq(!PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus()), BomNewPbomParentEntity::getLastVersionIs, 1) @@ -325,15 +325,18 @@ public class BomNewPbomParentService extends ServiceImpl childList = Convert.toList(BomNewPbomChildEntity.class, paramDTO.getChildList()); - childList.forEach(u -> { - u.setParentRowId(paramDTO.getBomRowId()); - }); - pbomChildService.saveOrUpdateBatch(childList); parent.setEditStatus(editStatus.getValue()); + parent.setModifyTime(LocalDateTime.now()); this.updateById(parent); + + if (CollUtil.isNotEmpty(paramDTO.getChildList())) { + List childList = Convert.toList(BomNewPbomChildEntity.class, paramDTO.getChildList()); + childList.forEach(u -> u.setParentRowId(paramDTO.getBomRowId())); + pbomChildService.saveOrUpdateBatch(childList); + } + if (editStatus == PBomEditStatusEnum.HANDLER_TEMP) { - return getChild(paramDTO.getBomRowId()); + return getChild(parent); } else { return null; } @@ -431,7 +434,8 @@ public class BomNewPbomParentService extends ServiceImpl child = this.getChild(bomRowId); + BomNewPbomParentEntity parent = this.getById(bomRowId); + List child = this.getChild(parent); List result = Convert.toList(BomNewPbomEditExcelVO.class, child); new Workbook().addSheet(new ListSheet<>(result)).writeTo(response.getOutputStream()); @@ -440,7 +444,8 @@ public class BomNewPbomParentService extends ServiceImpl child = this.getChild(param.getBomRowId()); + BomNewPbomParentEntity parent = this.getById(param.getBomRowId()); + List child = this.getChild(parent); if (CollUtil.isNotEmpty(param.getRowIds())) { child = child.stream().filter(u -> param.getRowIds().contains(u.getRowId())).collect(Collectors.toList()); }