From acc2e770fd8f0bc503a82a3c0bff10e04c2fff3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Fri, 14 Jun 2024 13:34:13 +0800 Subject: [PATCH] =?UTF-8?q?feat(ebom):=20=E5=B7=A5=E4=BD=9C=E8=A1=A8?= =?UTF-8?q?=E5=80=9F=E7=94=A8=E4=BB=B6=E6=94=AF=E6=8C=81=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nflg/product/bomnew/api/user/EbomApi.java | 12 ++++++--- .../service/BomNewEbomParentService.java | 25 +++++++++++-------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java index dca286ac..30b69529 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java @@ -110,11 +110,17 @@ public class EbomApi extends BaseApi { return ResultVO.success(true); } - + /** + * 获取子级 + * @param bomRowId bom行id + * @param type 类型:0-工作表数据;1-正式表数据 + * @return + */ @GetMapping("getChild") @ApiOperation("获取子级") - public ResultVO> getChild(@RequestParam("bomRowId") Long bomRowId) { - return ResultVO.success(bomNewEbomParentService.getChild(bomRowId)); + public ResultVO> getChild(@Valid @RequestParam("bomRowId") @NotNull Long bomRowId + , @Valid @RequestParam("type") @NotNull Integer type) { + return ResultVO.success(bomNewEbomParentService.getChild(bomRowId, type)); } @PostMapping("projectTypeInit") 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 103eba98..d9522ac2 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 @@ -337,7 +337,7 @@ public class BomNewEbomParentService extends ServiceImpl getChild(Long rowId) { + public List getChild(Long rowId, Integer type) { BomNewEbomParentEntity parent = this.getBaseMapper().selectById(rowId); List parentChild = this.getBaseMapper().getParentChild(rowId); @@ -387,10 +387,10 @@ public class BomNewEbomParentService extends ServiceImpl getChildBatch(List rowIds) { List result = new ArrayList<>(); for (Long bomRowId : rowIds) { - result.addAll(getChild(bomRowId)); + result.addAll(getChild(bomRowId, 1)); } return result; } @@ -749,7 +752,7 @@ public class BomNewEbomParentService extends ServiceImpl list = getChild(root.getRowId()); + List list = getChild(root.getRowId(), 0); List deliveryList = list.stream().filter(u -> VirtualPackageTypeEnum.DELIVERY_PACKAGE.equalsValue(u.getVirtualPartType())).collect(Collectors.toList()); if (CollUtil.isNotEmpty(deliveryList)) { Integer virtualPartTypeEnum = VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue() | VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue(); @@ -765,7 +768,7 @@ public class BomNewEbomParentService extends ServiceImpl list = getChild(root.getRowId()); + List list = getChild(root.getRowId(), 0); List makeList = list.stream().filter(u -> VirtualPackageTypeEnum.MAKING_PACKAGE.equalsValue(u.getVirtualPartType())).collect(Collectors.toList()); if (CollUtil.isNotEmpty(makeList)) { Integer virtualPartTypeEnum = VirtualPackageTypeEnum.MAKING_PACKAGE.getValue() | VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue(); @@ -1114,7 +1117,7 @@ public class BomNewEbomParentService extends ServiceImpl result = param.getList(); if (CollUtil.isEmpty(param.getList())) { - result = getChild(param.getBomRowId()); + result = getChild(param.getBomRowId(), 1); } final ListSheet listSheet = new ListSheet(Convert.toList(EbomExcelEditVO.class, result)); EecExcelUtil.eecExcel("bom列表", listSheet, response); @@ -1609,14 +1612,14 @@ public class BomNewEbomParentService extends ServiceImpl childList = getChild(bomRowId); + List childList = getChild(bomRowId, 0); if (hideVirtualPackage == 1) { List virtualPackageList = childList.stream() .filter(c -> c.getVirtualPackageIs() == 1 && c.getBomRowId() > 0) .collect(Collectors.toList()); virtualPackageList.forEach(v -> { childList.remove(v); - childList.addAll(getChild(v.getBomRowId())); + childList.addAll(getChild(v.getBomRowId(), 0)); }); } vo.setDatas(childList); @@ -2295,7 +2298,8 @@ public class BomNewEbomParentService extends ServiceImpl children = this.getBaseMapper().getChildren(vo.getBomRowId(), 0); //children.removeIf(c -> c.getLastVersionIs() != 1); vo.setChildNodes(children); @@ -2315,7 +2319,6 @@ public class BomNewEbomParentService extends ServiceImpl cc = this.getBaseMapper().getChildren(c.getBomRowId(), 0); - //cc.removeIf(ci -> ci.getLastVersionIs() != 1); c.setChildNodes(cc); cc.forEach(this::buildChildren); }