package com.qianwen.smartman.modules.cps.service.impl; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.google.common.collect.Lists; import java.lang.invoke.SerializedLambda; import java.math.BigDecimal; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.qianwen.smartman.common.cache.RegionCache; import com.qianwen.smartman.common.constant.CraftConstant; import com.qianwen.smartman.common.utils.MessageUtils; import com.qianwen.core.mp.service.impl.BladeServiceImpl; import com.qianwen.core.tool.support.Kv; import com.qianwen.core.tool.utils.Func; import com.qianwen.core.tool.utils.RandomType; import com.qianwen.core.tool.utils.StringUtil; import com.qianwen.smartman.modules.cps.convert.CraftRoutingConvert; import com.qianwen.smartman.modules.cps.convert.ProductConvert; import com.qianwen.smartman.modules.cps.convert.ProductionCraftProcessConvert; import com.qianwen.smartman.modules.cps.dto.CraftVersionDTO; import com.qianwen.smartman.modules.cps.entity.CraftRouting; import com.qianwen.smartman.modules.cps.entity.CraftVersionLine; import com.qianwen.smartman.modules.cps.entity.Product; import com.qianwen.smartman.modules.cps.entity.ProductionCraftProcess; import com.qianwen.smartman.modules.cps.entity.ProductionCraftProcessFile; import com.qianwen.smartman.modules.cps.entity.ProductionCraftProcessRelatedFixture; import com.qianwen.smartman.modules.cps.entity.ProductionCraftProcessRelatedTool; import com.qianwen.smartman.modules.cps.entity.ProductionCraftVersion; import com.qianwen.smartman.modules.cps.mapper.CraftRoutingMapper; import com.qianwen.smartman.modules.cps.service.ICraftRoutingService; import com.qianwen.smartman.modules.cps.service.ICraftVersionLineService; import com.qianwen.smartman.modules.cps.service.IProductService; import com.qianwen.smartman.modules.cps.service.IProductionCraftProcessFileService; import com.qianwen.smartman.modules.cps.service.IProductionCraftProcessRelatedFixtureService; import com.qianwen.smartman.modules.cps.service.IProductionCraftProcessRelatedToolService; import com.qianwen.smartman.modules.cps.service.IProductionCraftProcessService; import com.qianwen.smartman.modules.cps.service.IProductionCraftVersionService; import com.qianwen.smartman.modules.cps.utils.ThrowFun; import com.qianwen.smartman.modules.cps.vo.CraftRoutingAddVO; import com.qianwen.smartman.modules.cps.vo.CraftRoutingDetailVO; import com.qianwen.smartman.modules.cps.vo.CraftRoutingUpdateVO; import com.qianwen.smartman.modules.cps.vo.CraftRoutingVO; import com.qianwen.smartman.modules.cps.vo.CraftVersionAddVO; import com.qianwen.smartman.modules.cps.vo.ParallelProVO; import com.qianwen.smartman.modules.cps.vo.ProcessParallelSaveVO; import com.qianwen.smartman.modules.cps.vo.ProductVO; import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessFileVO; import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessRelatedFixtureVO; import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessRelatedToolVO; import com.qianwen.smartman.modules.cps.vo.ProductionCraftProcessVO; import com.qianwen.smartman.modules.cps.vo.ProductionCraftVersionCopyVO; import com.qianwen.smartman.modules.cps.vo.ProductionCraftVersionVO; import com.qianwen.smartman.modules.cps.vo.SearchVO; import com.qianwen.smartman.modules.cps.vo.VersionProcessAddVO; import com.qianwen.smartman.modules.system.service.IBasCoderuleService; import com.qianwen.smartman.modules.tpm.enums.MetaTypeEnum; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/CraftRoutingServiceImpl.class */ public class CraftRoutingServiceImpl extends BladeServiceImpl implements ICraftRoutingService { private static final Logger log = LoggerFactory.getLogger(CraftRoutingServiceImpl.class); private final IProductionCraftVersionService craftVersionService; private final ICraftVersionLineService versionLineService; private final IProductService productService; private final IProductionCraftProcessService craftProcessService; private final IProductionCraftProcessRelatedFixtureService relatedFixtureService; private final IProductionCraftProcessRelatedToolService relatedToolService; private final IProductionCraftProcessFileService processFileService; private final IBasCoderuleService basCodeRuleService; private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { String implMethodName = lambda.getImplMethodName(); boolean z = true; switch (implMethodName.hashCode()) { case -1416707747: if (implMethodName.equals("getVersionId")) { z = true; break; } break; case -1291082392: if (implMethodName.equals("getVersionProcessId")) { z = true; break; } break; case -1061435468: if (implMethodName.equals("getProductId")) { z = true; break; } break; case -75308287: if (implMethodName.equals("getName")) { z = true; break; } break; case 98245393: if (implMethodName.equals("getId")) { z = true; break; } break; case 1330288580: if (implMethodName.equals("getGroupId")) { z = true; break; } break; case 2061868837: if (implMethodName.equals("getCraftId")) { z = false; break; } break; } switch (z) { case false: if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ProductionCraftVersion") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getCraftId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CraftVersionLine") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getCraftId(); }; } break; case true: if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getVersionId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ProductionCraftProcess") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getVersionId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CraftVersionLine") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getVersionId(); }; } break; case true: if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ProductionCraftProcessRelatedFixture") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getVersionProcessId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ProductionCraftProcessRelatedTool") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getVersionProcessId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/ProductionCraftProcessFile") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getVersionProcessId(); }; } break; case true: if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { return (v0) -> { return v0.getName(); }; } break; case true: if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/core/mp/base/BaseEntity") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getId(); }; } break; case RegionCache.VILLAGE_LEVEL /* 5 */: if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CraftVersionLine") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getGroupId(); }; } break; case true: if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getProductId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getProductId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getProductId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getProductId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getProductId(); }; } if (lambda.getImplMethodKind() == 5 && lambda.getFunctionalInterfaceClass().equals("com/baomidou/mybatisplus/core/toolkit/support/SFunction") && lambda.getFunctionalInterfaceMethodName().equals("apply") && lambda.getFunctionalInterfaceMethodSignature().equals("(Ljava/lang/Object;)Ljava/lang/Object;") && lambda.getImplClass().equals("org/springblade/modules/cps/entity/CraftRouting") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { return (v0) -> { return v0.getProductId(); }; } break; } throw new IllegalArgumentException("Invalid lambda deserialization"); } public CraftRoutingServiceImpl(final IProductionCraftVersionService craftVersionService, final ICraftVersionLineService versionLineService, final IProductService productService, final IProductionCraftProcessService craftProcessService, final IProductionCraftProcessRelatedFixtureService relatedFixtureService, final IProductionCraftProcessRelatedToolService relatedToolService, final IProductionCraftProcessFileService processFileService, final IBasCoderuleService basCodeRuleService) { this.craftVersionService = craftVersionService; this.versionLineService = versionLineService; this.productService = productService; this.craftProcessService = craftProcessService; this.relatedFixtureService = relatedFixtureService; this.relatedToolService = relatedToolService; this.processFileService = processFileService; this.basCodeRuleService = basCodeRuleService; } @Override // org.springblade.modules.cps.service.ICraftRoutingService public CraftRoutingVO saveRouting(CraftRoutingAddVO vo) { CraftRouting craftRouting = saveCraftRouting(vo); return CraftRoutingConvert.INSTANCE.convert(craftRouting); } @Override // org.springblade.modules.cps.service.ICraftRoutingService public List listCraftRouting(SearchVO vo) { Wrapper wrapper = getWrapper(vo); return this.baseMapper.listCraftRouting(Func.isBlank(wrapper.getSqlSegment()) ? null : wrapper); } @Override // org.springblade.modules.cps.service.ICraftRoutingService public CraftRoutingDetailVO detailCraft(Long id) { CraftRoutingDetailVO vo = new CraftRoutingDetailVO(); setProduce(vo, id); setCraftVersion(vo, id); return vo; } @Override // org.springblade.modules.cps.service.ICraftRoutingService @Transactional(rollbackFor = {Exception.class}) public Boolean deleteCraft(Long id) { boolean flag = removeById(id); List versionIds = this.craftVersionService.listObjs((Wrapper) Wrappers.lambdaQuery(ProductionCraftVersion.class).select(new SFunction[]{(v0) -> { return v0.getId(); }}).eq((v0) -> { return v0.getCraftId(); }, id), c -> { return Long.valueOf(c instanceof BigDecimal ? ((BigDecimal) c).longValue() : ((Long) c).longValue()); }); if (Func.isNotEmpty(versionIds)) { flag = flag && this.craftVersionService.removeVersion(versionIds).booleanValue(); } return Boolean.valueOf(flag && this.versionLineService.remove((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { return v0.getCraftId(); }, id))); } @Override // org.springblade.modules.cps.service.ICraftRoutingService public Boolean updateCraft(CraftRoutingUpdateVO vo) { validNameExist(vo.getId(), vo.getName()); CraftRouting routing = CraftRoutingConvert.INSTANCE.convert(vo); return Boolean.valueOf(updateById(routing)); } @Override // org.springblade.modules.cps.service.ICraftRoutingService @Transactional(rollbackFor = {Exception.class}) public Boolean copyCraftVersion(ProductionCraftVersionCopyVO vo) { Integer type = vo.getType(); if (CraftConstant.COPY_TYPE_PRODUCT.equals(type)) { CraftRouting routing = (CraftRouting) getOne((Wrapper) Wrappers.lambdaQuery(CraftRouting.class).eq((v0) -> { return v0.getProductId(); }, vo.getProductId())); if (Func.isNull(routing)) { return Boolean.valueOf(copyProductNewCraft(vo)); } return Boolean.valueOf(copyCraftNewVersion(vo, routing.getId())); } return Boolean.valueOf(copyCraftNewVersion(vo, vo.getCraftId())); } @Override // org.springblade.modules.cps.service.ICraftRoutingService public List listFixedVersionByProduction(Long productionId) { CraftRouting craft = (CraftRouting) getOne((Wrapper) Wrappers.lambdaQuery(CraftRouting.class).eq((v0) -> { return v0.getProductId(); }, productionId)); if (Func.isNull(craft)) { return Lists.newArrayList(); } return this.craftVersionService.listFixed(craft.getId()); } @Override // org.springblade.modules.cps.service.ICraftRoutingService public CraftRoutingDetailVO getCraftByProduction(Long production) { CraftRouting craft = (CraftRouting) getOne((Wrapper) Wrappers.lambdaQuery(CraftRouting.class).eq((v0) -> { return v0.getProductId(); }, production)); if (Func.isNull(craft)) { return null; } return detailCraft(craft.getId()); } @Override // org.springblade.modules.cps.service.ICraftRoutingService public List listNotBandCraft() { return CraftRoutingConvert.INSTANCE.convert(list((Wrapper) Wrappers.lambdaQuery(CraftRouting.class).isNull((v0) -> { return v0.getProductId(); }))); } @Override // org.springblade.modules.cps.service.ICraftRoutingService public Boolean craftBindProduction(Long productionId, Long craftId) { return Boolean.valueOf(update((Wrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate(CraftRouting.class).set((v0) -> { return v0.getProductId(); }, productionId)).eq((v0) -> { return v0.getId(); }, craftId))); } @Override // org.springblade.modules.cps.service.ICraftRoutingService public Boolean craftUnbindProduction(Long craftId) { return Boolean.valueOf(update((Wrapper) ((LambdaUpdateWrapper) Wrappers.lambdaUpdate(CraftRouting.class).set((v0) -> { return v0.getProductId(); }, (Object) null)).eq((v0) -> { return v0.getId(); }, craftId))); } @Override // org.springblade.modules.cps.service.ICraftRoutingService public List notBandProduct(Long craftId) { List products = this.productService.notBandProduct(craftId); return ProductConvert.INSTANCE.convert(products); } private boolean copyCraftNewVersion(ProductionCraftVersionCopyVO vo, Long craftId) { Long versionId = vo.getVersionId(); ProductionCraftVersion version = (ProductionCraftVersion) this.craftVersionService.getById(versionId); CraftVersionAddVO newVersion = new CraftVersionAddVO(); boolean existCodeRule = this.basCodeRuleService.isExistCodeRule(MetaTypeEnum.PRODUCTION_CRAFT_VERSION.getCode()); if (!existCodeRule) { newVersion.setName(version.getName() + Func.random(4, RandomType.STRING)); } newVersion.setDescription(version.getDescription()); newVersion.setGroupIds(getGroupIds(versionId)); ProductionCraftVersionVO craftVersion = this.craftVersionService.saveCraftVersion(craftId, newVersion); List processList = this.craftProcessService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcess.class).eq((v0) -> { return v0.getVersionId(); }, version.getId())); ProcessParallelSaveVO saveVO = copyProductNewCraftProcess(craftVersion.getId(), processList); List vos = this.craftProcessService.parallelSave(saveVO); return Func.isNotEmpty(vos); } private boolean copyProductNewCraft(ProductionCraftVersionCopyVO vo) { CraftRoutingAddVO newCraft = new CraftRoutingAddVO(); String newCraftName = vo.getCraftName() + Func.random(4, RandomType.STRING); newCraft.setName(newCraftName); newCraft.setProductId(vo.getProductId()); CraftRouting craftRouting = saveCraftRouting(newCraft); Long versionId = vo.getVersionId(); ProductionCraftVersion version = (ProductionCraftVersion) this.craftVersionService.getById(versionId); CraftVersionAddVO newVersion = new CraftVersionAddVO(); newVersion.setName(version.getName()); newVersion.setDescription(version.getDescription()); newVersion.setGroupIds(getGroupIds(versionId)); ProductionCraftVersionVO craftVersion = this.craftVersionService.saveCraftVersion(craftRouting.getId(), newVersion); List processList = this.craftProcessService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcess.class).eq((v0) -> { return v0.getVersionId(); }, version.getId())); ProcessParallelSaveVO saveVO = copyProductNewCraftProcess(craftVersion.getId(), processList); List vos = this.craftProcessService.parallelSave(saveVO); return Func.isNotEmpty(vos); } private ProcessParallelSaveVO copyProductNewCraftProcess(Long versionId, List processList) { ProcessParallelSaveVO vo = new ProcessParallelSaveVO(); if (Func.isNotEmpty(processList)) { List processIds = (List) processList.stream().map((v0) -> { return v0.getId(); }).collect(Collectors.toList()); Map> processFixtureMap = (Map) this.relatedFixtureService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcessRelatedFixture.class).in((v0) -> { return v0.getVersionProcessId(); }, processIds)).stream().collect(Collectors.groupingBy((v0) -> { return v0.getVersionProcessId(); })); Map> processToolMap = (Map) this.relatedToolService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcessRelatedTool.class).in((v0) -> { return v0.getVersionProcessId(); }, processIds)).stream().collect(Collectors.groupingBy((v0) -> { return v0.getVersionProcessId(); })); Map> processFileMap = (Map) this.processFileService.list((Wrapper) Wrappers.lambdaQuery(ProductionCraftProcessFile.class).in((v0) -> { return v0.getVersionProcessId(); }, processIds)).stream().collect(Collectors.groupingBy((v0) -> { return v0.getVersionProcessId(); })); List collect = (List) processList.stream().filter(c -> { return Func.isNull(c.getMainSequenceId()) && Func.notNull(c.getProcessId()); }).map(process -> { return getVersionProcessAddVO(processFixtureMap, processToolMap, processFileMap, process); }).collect(Collectors.toList()); List list = (List) processList.stream().filter(c2 -> { return Func.notNull(c2.getMainSequenceId()) || Func.isNull(c2.getProcessId()); }).collect(Collectors.toList()); List parallelProcessList = Lists.newArrayList(); list.stream().filter(l1 -> { return Func.isNull(l1.getProcessId()); }).forEach(l12 -> { ParallelProVO proVO = new ParallelProVO(); proVO.setProcessCode(l12.getProcessCode()); proVO.setProcessName(l12.getProcessName()); proVO.setSort(l12.getSort()); proVO.setSourceId(l12.getSourceId()); proVO.setTargetId(l12.getTargetId()); proVO.setXCoordinate(l12.getXCoordinate()); proVO.setYCoordinate(l12.getYCoordinate()); proVO.setHeight(l12.getHeight()); List vos = (List) list.stream().filter(l2 -> { return l12.getId().equals(l2.getMainSequenceId()); }).map(process2 -> { return getVersionProcessAddVO(processFixtureMap, processToolMap, processFileMap, process2); }).collect(Collectors.toList()); proVO.setChildProcessList(vos); parallelProcessList.add(proVO); }); vo.setNormalProcessList(collect); vo.setParallelProcessList(parallelProcessList); } vo.setVersionId(versionId); return vo; } /* JADX INFO: Access modifiers changed from: private */ public static VersionProcessAddVO getVersionProcessAddVO(Map> processFixtureMap, Map> processToolMap, Map> processFileMap, ProductionCraftProcess process) { VersionProcessAddVO processAddVO = ProductionCraftProcessConvert.INSTANCE.convertAdd(process); List fixtures = processFixtureMap.get(process.getId()); if (Func.isNotEmpty(fixtures)) { List fixtureAddList = (List) fixtures.stream().map(c -> { return new ProductionCraftProcessRelatedFixtureVO().setFixtureId(c.getFixtureId()).setVersionProcessId(c.getVersionProcessId()).setFixtureCode(c.getFixtureCode()).setFixtureName(c.getFixtureName()).setFixtureGroupName(c.getFixtureGroupName()); }).collect(Collectors.toList()); processAddVO.setFixtures(fixtureAddList); } List files = processFileMap.get(process.getId()); if (Func.isNotEmpty(files)) { List fileAddList = (List) files.stream().map(c2 -> { return new ProductionCraftProcessFileVO().setFileName(c2.getFileName()).setObjectKey(c2.getObjectKey()).setContentType(c2.getContentType()).setLink(c2.getLink()).setFileSize(c2.getFileSize()).setUploadTime(c2.getUploadTime()).setVersionProcessId(c2.getVersionProcessId()); }).collect(Collectors.toList()); processAddVO.setFiles(fileAddList); } List tools = processToolMap.get(process.getId()); if (Func.isNotEmpty(tools)) { List toolAddList = (List) tools.stream().map(c3 -> { return new ProductionCraftProcessRelatedToolVO().setToolId(c3.getToolId()).setVersionProcessId(c3.getVersionProcessId()).setToolCode(c3.getToolCode()).setToolCategoryName(c3.getToolCategoryName()).setToolModelName(c3.getToolModelName()); }).collect(Collectors.toList()); processAddVO.setTools(toolAddList); } return processAddVO; } private List getGroupIds(Long versionId) { return this.versionLineService.listObjs((Wrapper) Wrappers.lambdaQuery(CraftVersionLine.class).select(new SFunction[]{(v0) -> { return v0.getGroupId(); }}).eq((v0) -> { return v0.getVersionId(); }, versionId), c -> { if (c instanceof BigDecimal) { return Long.valueOf(((BigDecimal) c).longValue()); } return (Long) c; }); } private void setProduce(CraftRoutingDetailVO vo, Long id) { CraftRouting craft = (CraftRouting) getById(id); ThrowFun.isTrue(Func.isNull(craft)).throwMessage(MessageUtils.message("cps.craft.not.exist", new Object[0])); vo.setId(id); vo.setName(craft.getName()); vo.setDescription(craft.getDescription()); vo.setStatus(craft.getStatus()); vo.setProductId(craft.getProductId()); Long productId = craft.getProductId(); if (!Func.isNull(productId)) { Product product = (Product) this.productService.getById(productId); if (!Func.isNull(product)) { vo.setProductCode(product.getCode()); vo.setProductName(product.getName()); } } } private void setCraftVersion(CraftRoutingDetailVO vo, Long id) { List craftVersionList = this.craftVersionService.listVersion(id); vo.setDtos(craftVersionList); } private QueryWrapper getWrapper(SearchVO vo) { List param = vo.getParams(); Map params = (Map) param.stream().collect(Collectors.toMap((v0) -> { return v0.getKey(); }, (v0) -> { return v0.getValue(); })); Kv exclude = Kv.create().set("Blade-Auth", "Blade-Auth").set("current", "current").set("size", "size").set("ascs", "ascs").set("descs", "descs"); exclude.forEach(k, v -> { String str = (String) params.remove(k); }); QueryWrapper wrapper = new QueryWrapper<>(); if (Func.isNotEmpty(params)) { params.forEach(k2, v2 -> { if (k2.endsWith(CraftConstant.LIKE)) { wrapper.likeRight("bcr." + getColumn(k2, CraftConstant.LIKE), v2); } else if (k2.endsWith(CraftConstant.ASC)) { wrapper.orderByAsc("bcr." + getColumn(k2, CraftConstant.ASC)); } else if (k2.endsWith(CraftConstant.DESC)) { wrapper.orderByDesc("bcr." + getColumn(k2, CraftConstant.DESC)); } }); } return wrapper; } private String getColumn(String column, String keyword) { return StringUtil.humpToUnderline(StringUtil.removeSuffix(column, keyword)); } private CraftRouting saveCraftRouting(CraftRoutingAddVO vo) { String name = vo.getName(); validNameExist(null, name); CraftRouting craftRouting = new CraftRouting().setName(name).setDescription(vo.getDescription()).setProductId(vo.getProductId()); save(craftRouting); return craftRouting; } private void validNameExist(Long id, String name) { long count = count((Wrapper) Wrappers.lambdaQuery(CraftRouting.class).ne(Func.isNotEmpty(id), (v0) -> { return v0.getId(); }, id).eq((v0) -> { return v0.getName(); }, name)); ThrowFun.isTrue(count > 0).throwMessage(MessageUtils.message("cps.craft.name.exist", new Object[0])); } }