From b57768985581377cb120cd5ede4a81c2843c7c08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Fri, 7 Jun 2024 15:30:08 +0800 Subject: [PATCH] =?UTF-8?q?fix(ebom):=20=E8=BD=AC=E6=AD=A3=E5=BC=8F?= =?UTF-8?q?=E8=A1=A8=E6=97=B6=E8=AE=BE=E7=BD=AE=E8=BD=AC=E6=8D=A2=E4=BA=BA?= =?UTF-8?q?=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/master/BomNewEbomParentMapper.java | 2 +- .../service/BomNewEbomParentService.java | 44 +++++++------------ 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewEbomParentMapper.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewEbomParentMapper.java index 857a8f02..5eb5d82c 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewEbomParentMapper.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewEbomParentMapper.java @@ -62,7 +62,7 @@ public interface BomNewEbomParentMapper extends BaseMapper rowIds); - void updateStateBatchByRowIds(@Param("status") Integer status, @Param("list") List list ); + void updateStateBatchByRowIds(@Param("status") Integer status, String userName, @Param("list") List list); Integer checkIsRoot(@Param("materialNo") String materialNo); 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 e1d21e00..6339216f 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 @@ -342,16 +342,16 @@ public class BomNewEbomParentService extends ServiceImpl parentChild = this.getBaseMapper().getParentChild(rowId); //排除项目类别的赋值 - List materialVOS = materialMainService.intiMaterialInfoInPattern(parentChild, "^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2); + materialMainService.intiMaterialInfoInPattern(parentChild, "^21 | ^31", EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2); if (CollUtil.isNotEmpty(parentChild)) { List materialNos = parentChild.stream().map(BaseMaterialVO::getMaterialNo).filter(StrUtil::isNotBlank).collect(Collectors.toList()); if (CollUtil.isNotEmpty(materialNos)) { List list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos) .eq(!EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()), BomNewEbomParentEntity::getLastVersionIs, 1) .eq(EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()), BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list(); - if (EBomStatusEnum.CHECKED.equalsValue(parent.getStatus())) { - list = list.stream().filter(u -> EBomStatusEnum.CHECKED.equalsValue(u.getStatus())).collect(Collectors.toList()); - } + // if (EBomStatusEnum.CHECKED.equalsValue(parent.getStatus())) { + // list = list.stream().filter(u -> EBomStatusEnum.CHECKED.equalsValue(u.getStatus())).collect(Collectors.toList()); + // } Map bomListMap = list.parallelStream() .collect(Collectors.toMap( BomNewEbomParentEntity::getMaterialNo, // key: DrawingNo @@ -391,6 +391,7 @@ public class BomNewEbomParentService extends ServiceImpl bomRowIds = bomTree.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList()); if (CollUtil.isNotEmpty(bomRowIds)) { - this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds); + this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), SessionUtil.getRealName(), bomRowIds); //将历史已发布版-转移到正式历史表 eBomToFormal(bomRowIds, bomTree.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList()) ); } @@ -2574,21 +2575,22 @@ public class BomNewEbomParentService extends ServiceImpl deleteParents = parents.stream() - .filter(p -> (StrUtil.equals(p.getCreatedBy(), SessionUtil.getUserCode()) - && (Objects.equals(p.getSource(), EBomSourceEnum.FROM_BOM.getValue()) || Objects.equals(p.getSource(), EBomSourceEnum.FROM_EXCE.getValue()))) - || Objects.equals(p.getVirtualPackageIs(), 1)) + .filter(p -> StrUtil.equals(p.getCreatedBy(), SessionUtil.getUserCode()) || Objects.equals(p.getVirtualPackageIs(), 1)) .collect(Collectors.toList()); - //将自己手动创建的bom提为用户顶层 - List updateParents = parents.stream() - .filter(p -> StrUtil.equals(p.getCreatedBy(), SessionUtil.getUserCode())) - .collect(Collectors.toList()); - updateParents.removeAll(deleteParents); - if (CollUtil.isNotEmpty(updateParents)) { - this.lambdaUpdate() - .set(BomNewEbomParentEntity::getUserRootIs, 1) - .set(BomNewEbomParentEntity::getModifyTime, LocalDateTime.now()) - .in(BomNewEbomParentEntity::getRowId, updateParents.stream().map(BomNewEbomParentEntity::getRowId).collect(Collectors.toList())); - } - deleteParents.forEach(this::delete); }