1、获取子级逻辑调整
This commit is contained in:
parent
a76f872d15
commit
9ef37d9c1d
|
|
@ -24,10 +24,7 @@ import com.nflg.product.base.core.exception.NflgBusinessException;
|
|||
import com.nflg.product.bomnew.constant.*;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewEbomParentMapper;
|
||||
import com.nflg.product.bomnew.pojo.dto.*;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomMaterialUseEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
||||
import com.nflg.product.bomnew.pojo.entity.*;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
|
|
@ -54,6 +51,8 @@ import java.util.*;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.ForkJoinTask;
|
||||
import java.util.function.BinaryOperator;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
|
@ -200,6 +199,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (selfIs && CollUtil.isNotEmpty(relSkuNo)) {
|
||||
relSkuNo = getSelfMaterialNo(relSkuNo);
|
||||
}
|
||||
//排除自己-防止死循环
|
||||
relSkuNo.remove(materialNo);
|
||||
while (CollUtil.isNotEmpty(relSkuNo)) {
|
||||
result.addAll(relSkuNo);
|
||||
List<BomNewEbomMaterialUseEntity> relSkuList = bomNewEbomMaterialUseService.lambdaQuery().in(BomNewEbomMaterialUseEntity::getMaterialNo, relSkuNo).list();
|
||||
|
|
@ -300,9 +301,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
List<String> materialNos = parentChild.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos)
|
||||
.eq(BomNewEbomParentEntity::getLastVersionIs, 1)
|
||||
.eq(!EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()) ,BomNewEbomParentEntity::getLastVersionIs, 1)
|
||||
.eq(EBomStatusEnum.PUBLISHED.equalsValue(parent.getStatus()), BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
||||
Map<String, BomNewEbomParentEntity> bomListMap = ListCommonUtil.listToMap(list, BomNewEbomParentEntity::getMaterialNo);
|
||||
|
||||
Map<String, BomNewEbomParentEntity> bomListMap= list.parallelStream()
|
||||
.collect(Collectors.toMap(
|
||||
BomNewEbomParentEntity::getMaterialNo, // key: DrawingNo
|
||||
Function.identity(),
|
||||
BinaryOperator.maxBy(Comparator.comparing(BomNewEbomParentEntity::getCurrentVersion))
|
||||
));
|
||||
// Map<String, BomNewEbomParentEntity> bomListMap = ListCommonUtil.listToMap(list, BomNewEbomParentEntity::getMaterialNo);
|
||||
for (BomNewEbomParentVO child : parentChild) {
|
||||
if (bomListMap.containsKey(child.getMaterialNo())) {
|
||||
BomNewEbomParentEntity parentEntity = bomListMap.get(child.getMaterialNo());
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.ForkJoinTask;
|
||||
import java.util.function.BinaryOperator;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
|
@ -253,9 +255,14 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
List<BomNewOriginalParentEntity> list = this.lambdaQuery().in(BomNewOriginalParentEntity::getDrawingNo, drawingNos)
|
||||
.eq(OriginalStatusEnum.UN_CONVERT.equalsValue(parent.getStatus()),BomNewOriginalParentEntity::getLastVersionIs, 1)
|
||||
.eq(OriginalStatusEnum.OVER_CONVERT.equalsValue(parent.getStatus()) , BomNewOriginalParentEntity::getStatus, parent.getStatus())
|
||||
.last("order by current_version desc limit 1")
|
||||
.list();
|
||||
Map<String, BomNewOriginalParentEntity> bomListMap = ListCommonUtil.listToMap(list, BomNewOriginalParentEntity::getDrawingNo);
|
||||
Map<String, BomNewOriginalParentEntity> bomListMap= list.parallelStream()
|
||||
.collect(Collectors.toMap(
|
||||
BomNewOriginalParentEntity::getDrawingNo, // key: DrawingNo
|
||||
Function.identity(),
|
||||
BinaryOperator.maxBy(Comparator.comparing(BomNewOriginalParentEntity::getCurrentVersion))
|
||||
));
|
||||
// Map<String, BomNewOriginalParentEntity> bomListMap = ListCommonUtil.listToMap(list, BomNewOriginalParentEntity::getDrawingNo);
|
||||
for (BomOriginalListVO child : parentChild) {
|
||||
if (bomListMap.containsKey(child.getDrawingNo())) {
|
||||
BomNewOriginalParentEntity parentEntity = bomListMap.get(child.getDrawingNo());
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ import java.util.concurrent.ExecutionException;
|
|||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.ForkJoinTask;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.BinaryOperator;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
|
@ -249,8 +251,18 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
materialMainService.intiMaterialInfo(parentChild, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
List<String> materialNos = parentChild.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
List<BomNewPbomParentEntity> list = this.lambdaQuery().in(BomNewPbomParentEntity::getMaterialNo, materialNos).eq(BomNewPbomParentEntity::getLastVersionIs, 1).list();
|
||||
Map<String, BomNewPbomParentEntity> bomListMap = ListCommonUtil.listToMap(list, BomNewPbomParentEntity::getMaterialNo);
|
||||
List<BomNewPbomParentEntity> list = this.lambdaQuery().in(BomNewPbomParentEntity::getMaterialNo, materialNos)
|
||||
.eq(!PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus()), BomNewPbomParentEntity::getLastVersionIs, 1)
|
||||
.eq(PBomStatusEnum.PUBLISH.equalsValue(parent.getStatus()),BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
|
||||
.list();
|
||||
|
||||
Map<String, BomNewPbomParentEntity> bomListMap= list.parallelStream()
|
||||
.collect(Collectors.toMap(
|
||||
BomNewPbomParentEntity::getMaterialNo, // key: DrawingNo
|
||||
Function.identity(),
|
||||
BinaryOperator.maxBy(Comparator.comparing(BomNewPbomParentEntity::getCurrentVersion))
|
||||
));
|
||||
//Map<String, BomNewPbomParentEntity> bomListMap = ListCommonUtil.listToMap(list, BomNewPbomParentEntity::getMaterialNo);
|
||||
for (BomNewPbomParentVO child : parentChild) {
|
||||
if (bomListMap.containsKey(child.getMaterialNo())) {
|
||||
BomNewPbomParentEntity parentEntity = bomListMap.get(child.getMaterialNo());
|
||||
|
|
|
|||
Loading…
Reference in New Issue