diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/BomNewEbomProjectTypeDTO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/BomNewEbomProjectTypeDTO.java index 06a4ae5d..aac8df65 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/BomNewEbomProjectTypeDTO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/dto/BomNewEbomProjectTypeDTO.java @@ -1,11 +1,9 @@ package com.nflg.product.bomnew.pojo.dto; -import com.nflg.product.bomnew.constant.EBomSourceEnum; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.io.Serializable; import java.util.List; @Data @@ -13,10 +11,16 @@ import java.util.List; public class BomNewEbomProjectTypeDTO { @ApiModelProperty("行rowId") - private List rowIdList; + private List rowIdList; @ApiModelProperty("项目类型") private String projectType; - + @Data + public static class BomNewEbomChangeProjectType{ + @ApiModelProperty("行rowId") + private Long rowId; + @ApiModelProperty("bomRowId") + private Long bomRowId; + } } 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 23bf23c9..bd15852a 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 @@ -14,6 +14,8 @@ import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.extra.spring.SpringUtil; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -116,16 +118,16 @@ public class BomNewEbomParentService extends ServiceImpl parents = this.getBaseMapper().getParentForMaterialNoSeach(parentMaterialByMaterialNo); List childs = this.getBaseMapper().getChildForMaterialNoSeach(parentMaterialByMaterialNo, materialNo); - List data=new ArrayList<>(); + List data = new ArrayList<>(); data.addAll(parents); data.addAll(childs); - materialMainService.intiMaterialInfo(data , "material","materialTexture","projectType"); + materialMainService.intiMaterialInfo(data, "material", "materialTexture", "projectType"); returnResult = handSeachToTree(parents, childs); } } } else { Page result = this.getBaseMapper().getEBomListPage(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode()); - materialMainService.intiMaterialInfo(result.getRecords() , "material","materialTexture","projectType"); + materialMainService.intiMaterialInfo(result.getRecords(), "material", "materialTexture", "projectType"); returnResult = result; } return returnResult; @@ -230,7 +232,7 @@ public class BomNewEbomParentService extends ServiceImpl parentChild = this.getBaseMapper().getParentChild(rowId); //排除项目类别的赋值 - materialMainService.intiMaterialInfo(parentChild , "material","materialTexture","projectType"); + materialMainService.intiMaterialInfo(parentChild, "material", "materialTexture", "projectType"); if (CollUtil.isNotEmpty(parentChild)) { List materialNos = parentChild.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList()); if (CollUtil.isNotEmpty(materialNos)) { @@ -251,7 +253,7 @@ public class BomNewEbomParentService extends ServiceImpl getChildBatch(List rowIds) { List result = new ArrayList<>(); for (Long bomRowId : rowIds) { @@ -296,12 +293,6 @@ public class BomNewEbomParentService extends ServiceImpl result = EecExcelUtil.getExcelContext(inputStream, BomNewEBomImportExcelDTO.class); @@ -637,7 +628,6 @@ public class BomNewEbomParentService extends ServiceImpl0 && (dto.getParent().getSource().equals(EBomSourceEnum.FROM_MDM.getValue()) - || dto.getParent().getSource().equals(EBomSourceEnum.FROM_EXCE.getValue()))){ + if (dto.getParent().getBomRowId() > 0 && (dto.getParent().getSource().equals(EBomSourceEnum.FROM_MDM.getValue()) + || dto.getParent().getSource().equals(EBomSourceEnum.FROM_EXCE.getValue()))) { deleteBom(dto.getParent().getBomRowId()); @@ -662,7 +652,7 @@ public class BomNewEbomParentService extends ServiceImpl computeLevelNumAndRootState()); + ThreadUtil.execAsync(() -> computeLevelNumAndRootState()); } @@ -852,7 +842,7 @@ public class BomNewEbomParentService extends ServiceImpl childEntity = new ArrayList<>(); - dto.getRowIdList().forEach(rowid -> { - BomNewEbomChildEntity entity = new BomNewEbomChildEntity(); - entity.setRowId(rowid); - entity.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue()); - entity.setProjectType(dto.getProjectType()); - entity.setModifyTime(LocalDateTime.now()); - }); + List rowIdList = dto.getRowIdList().stream().map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getRowId).collect(Collectors.toList()); + List bomRowIdList = dto.getRowIdList().stream().filter(u -> u.getBomRowId() > 0).map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getBomRowId).collect(Collectors.toList()); + + if (CollectionUtil.isNotEmpty(bomRowIdList)) { + UpdateWrapper parentUpdate = new UpdateWrapper<>(); + parentUpdate.lambda() + .set(BomNewEbomParentEntity::getProjectType, dto.getProjectType()) + .set(BomNewEbomParentEntity::getModifyTime, LocalDateTime.now()) + .set(BomNewEbomParentEntity::getProjectTypeInputType, ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue()) + .in(BomNewEbomParentEntity::getRowId, bomRowIdList); + this.update(parentUpdate); + } + + + if (CollectionUtil.isNotEmpty(rowIdList)) { + UpdateWrapper childUpdate = new UpdateWrapper<>(); + childUpdate.lambda() + .set(BomNewEbomChildEntity::getProjectType, dto.getProjectType()) + .set(BomNewEbomChildEntity::getModifyTime, LocalDateTime.now()) + .set(BomNewEbomChildEntity::getProjectTypeInputType, ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue()) + .in(BomNewEbomChildEntity::getRowId, rowIdList); + SpringUtil.getBean(BomNewEbomChildService.class).update(childUpdate); + } + - SpringUtil.getBean(BomNewEbomChildService.class).updateBatchById(childEntity); return true; - } public BomNewEbomEditDetailVO editDetail(Long bomRowId) { @@ -910,7 +914,7 @@ public class BomNewEbomParentService extends ServiceImpl parentList = new ArrayList<>(); @@ -987,24 +991,22 @@ public class BomNewEbomParentService extends ServiceImpl rowIds = eBomDel.getRevertOBom().stream().map(BomNewEbomParentVO::getSourceRowId).collect(Collectors.toList()); - SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds); - - + SpringUtil.getBean(BomNewOriginalParentService.class).revertBom(rowIds); } if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) { - ThreadUtil.execAsync(() -> computeLevelNumAndRootState()); + ThreadUtil.execAsync(() -> computeLevelNumAndRootState()); } @@ -1037,7 +1039,7 @@ public class BomNewEbomParentService extends ServiceImpl computeLevelNumAndRootState()); + ThreadUtil.execAsync(() -> computeLevelNumAndRootState()); return true; @@ -1051,7 +1053,7 @@ public class BomNewEbomParentService extends ServiceImpl checkStatus = CollectionUtil.toList(new Integer[]{ @@ -1107,7 +1109,7 @@ public class BomNewEbomParentService extends ServiceImpl delList) { - if(CollectionUtil.isEmpty(delList)){ + if (CollectionUtil.isEmpty(delList)) { return; } List delTagList = new ArrayList<>(); @@ -1131,7 +1133,6 @@ public class BomNewEbomParentService extends ServiceImpl changeMaterial(BomNewEBomChangeDTO dto){ + public List changeMaterial(BomNewEBomChangeDTO dto) { - List parentChild=dto.getDatas(); + List parentChild = dto.getDatas(); - materialMainService.intiMaterialInfo(parentChild ); + materialMainService.intiMaterialInfo(parentChild); - List checkBom=new ArrayList<>(); + List checkBom = new ArrayList<>(); checkBom.add(dto.getParent()); checkBom.addAll(dto.getDatas()); - CheckEBomException checkEBomException=new CheckEBomException(checkBom); + CheckEBomException checkEBomException = new CheckEBomException(checkBom); checkEBomException.checkException(); return dto.getDatas(); } - - - } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomDetailTask.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomDetailTask.java index 333e0166..a7bc8a34 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomDetailTask.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/EBomDetailTask.java @@ -60,6 +60,7 @@ public class EBomDetailTask extends RecursiveTask> { BomNewEbomParentEntity ebomParentEntity = stringBomNewOriginalParentEntityMap.get(detailVO.getMaterialNo()); detailVO.setChildBomRowId(ebomParentEntity.getRowId()); detailVO.setBomRowId(ebomParentEntity.getRowId()); + detailVO.setSourceRowId(ebomParentEntity.getSourceRowId()); detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion()); } }