| | |
| | | package com.qianwen.smartman.modules.cps.service.impl; |
| | | |
| | | import com.alibaba.excel.write.merge.AbstractMergeStrategy; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | 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.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.ExcelConstant; |
| | | import com.qianwen.smartman.common.enums.StatusType; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.common.utils.ValidatorUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.excel.util.ExcelUtil; |
| | | import com.qianwen.core.log.exception.ServiceException; |
| | | import com.qianwen.core.mp.service.impl.BladeServiceImpl; |
| | |
| | | import com.qianwen.core.mp.support.Query; |
| | | import com.qianwen.core.oss.model.BladeFile; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.ExcelConstant; |
| | | import com.qianwen.smartman.common.enums.StatusType; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.common.utils.ValidatorUtils; |
| | | import com.qianwen.smartman.modules.cps.convert.ProcessConvert; |
| | | import com.qianwen.smartman.modules.cps.entity.Process; |
| | | import com.qianwen.smartman.modules.cps.entity.ProcessAssociation; |
| | | import com.qianwen.smartman.modules.cps.enums.WorkTypeEnum; |
| | | import com.qianwen.smartman.modules.cps.excel.ProcessExcel; |
| | | import com.qianwen.smartman.modules.cps.excel.ProcessImport; |
| | |
| | | import com.qianwen.smartman.modules.system.service.ICodeGeneratorService; |
| | | import com.qianwen.smartman.modules.system.service.IDictService; |
| | | import com.qianwen.smartman.modules.tpm.enums.MetaTypeEnum; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/ProcessServiceImpl.class */ |
| | | public class ProcessServiceImpl extends BladeServiceImpl<ProcessMapper, Process> implements IProcessService { |
| | | private static final Logger log = LoggerFactory.getLogger(ProcessServiceImpl.class); |
| | | private final IProcessAssociationService processAssociationService; |
| | |
| | | private final IDictService dictService; |
| | | private final ICodeGeneratorService codeGeneratorService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -1601031533: |
| | | if (implMethodName.equals("getDictKey")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case -1104365260: |
| | | if (implMethodName.equals("getProcessId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -982980443: |
| | | if (implMethodName.equals("getDictValue")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -75622813: |
| | | if (implMethodName.equals("getCode")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 803533544: |
| | | if (implMethodName.equals("getStatus")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 1567138533: |
| | | if (implMethodName.equals("getIsImport")) { |
| | | z = true; |
| | | 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getDictKey(); |
| | | }; |
| | | } |
| | | 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/ProcessAssociation") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getProcessId(); |
| | | }; |
| | | } |
| | | 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 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/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getStatus(); |
| | | }; |
| | | } |
| | | 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/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getStatus(); |
| | | }; |
| | | } |
| | | 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getDictValue(); |
| | | }; |
| | | } |
| | | 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/system/entity/Dict") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getCode(); |
| | | }; |
| | | } |
| | | 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/Process") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getCode(); |
| | | }; |
| | | } |
| | | 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/Process") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getCode(); |
| | | }; |
| | | } |
| | | 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/Process") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getIsImport(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | public ProcessServiceImpl(final IProcessAssociationService processAssociationService, final OssBuilder ossBuilder, final ProcessMapper processMapper, final IDictService dictService, final ICodeGeneratorService codeGeneratorService) { |
| | | this.processAssociationService = processAssociationService; |
| | |
| | | if (StatusType.REMOVE.getType().equals(type)) { |
| | | int count = this.baseMapper.existCraftProcess(processIds); |
| | | ThrowFun.isTrue(count > 0).throwMessage(MessageUtils.message("cps.process.binding.craft", new Object[0])); |
| | | |
| | | this.processAssociationService.remove(Wrappers.<ProcessAssociation>query().lambda().in(Func.isNotEmpty(processIds), ProcessAssociation::getProcessId, processIds)); |
| | | /* |
| | | this.processAssociationService.remove(Wrappers.query().lambda().in(Func.isNotEmpty(processIds), (v0) -> { |
| | | return v0.getProcessId(); |
| | | }, processIds)); |
| | | remove(Wrappers.query().lambda().in(Func.isNotEmpty(processIds), (v0) -> { |
| | | return v0.getId(); |
| | | }, processIds)); |
| | | */ |
| | | remove(Wrappers.<Process>query().lambda().in(Func.isNotEmpty(processIds), Process::getId, processIds)); |
| | | return true; |
| | | } |
| | | return Boolean.valueOf(changeStatus(processIds, CommonConstant.DEACTIVATE)); |
| | |
| | | } |
| | | }); |
| | | } |
| | | Set<String> codeDisableSet = (Set) processList.stream().filter(c -> { |
| | | Set<String> codeDisableSet = processList.stream().filter(c -> { |
| | | return CommonConstant.DEACTIVATE.equals(c.getStatus()); |
| | | }).map((v0) -> { |
| | | return v0.getCode(); |
| | | }).collect(Collectors.toSet()); |
| | | |
| | | Map<String, String> dictMap = new HashMap<>(16); |
| | | List<Dict> dictList = this.dictService.list(Wrappers.<Dict>lambdaQuery().select(Dict::getDictKey, Dict::getDictValue).eq(Dict::getCode, "work_type")); |
| | | /* |
| | | List<Dict> dictList = this.dictService.list((Wrapper) Wrappers.lambdaQuery().select(new SFunction[]{(v0) -> { |
| | | return v0.getDictKey(); |
| | | }, (v0) -> { |
| | | return v0.getDictValue(); |
| | | }}).eq((v0) -> { |
| | | return v0.getCode(); |
| | | }, "work_type")); |
| | | }, "work_type"));*/ |
| | | if (Func.isNotEmpty(dictList)) { |
| | | dictMap = (Map) dictList.stream().collect(Collectors.toMap((v0) -> { |
| | | dictMap = dictList.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getDictValue(); |
| | | }, (v0) -> { |
| | | return v0.getDictKey(); |
| | |
| | | } |
| | | } |
| | | if (!flag) { |
| | | MultipartFile multipartFile = ExcelUtil.exportFillTemplateToMultipartFile(ExcelConstant.DIRECTORY + "processFailTemplate" + ExcelConstant.SUFFIX, MessageUtils.message("excel.import.failed.report.name", new Object[0]) + ExcelConstant.SUFFIX, "工序信息表", (List) data.stream().filter(x2 -> { |
| | | MultipartFile multipartFile = ExcelUtil.exportFillTemplateToMultipartFile(ExcelConstant.DIRECTORY + "processFailTemplate" + ExcelConstant.SUFFIX, MessageUtils.message("excel.import.failed.report.name", new Object[0]) + ExcelConstant.SUFFIX, "工序信息表", data.stream().filter(x2 -> { |
| | | return Func.isNotEmpty(x2.getFailReason()); |
| | | }).collect(Collectors.toList()), (Object) null, (AbstractMergeStrategy) null); |
| | | }).collect(Collectors.toList()), null, null); |
| | | return this.ossBuilder.tempTemplate().putFile(multipartFile.getOriginalFilename(), multipartFile); |
| | | } |
| | | data.forEach(x3 -> { |
| | |
| | | } |
| | | |
| | | private void checkProcess(ProcessSaveVO processSaveVO) { |
| | | long count = count(Wrappers.<Process>lambdaQuery() |
| | | .ne(Func.isNotEmpty(processSaveVO.getId()), Process::getId, processSaveVO.getId()) |
| | | .eq(Process::getCode, processSaveVO.getCode()) |
| | | .eq(Process::getStatus, CommonConstant.ENABLE)); |
| | | |
| | | /* |
| | | long count = count((Wrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().ne(Func.isNotEmpty(processSaveVO.getId()), (v0) -> { |
| | | return v0.getId(); |
| | | }, processSaveVO.getId()).eq((v0) -> { |
| | |
| | | }, processSaveVO.getCode())).eq((v0) -> { |
| | | return v0.getStatus(); |
| | | }, CommonConstant.ENABLE)); |
| | | */ |
| | | if (count > 0) { |
| | | throw new ServiceException(MessageUtils.message("cps.process.code.already.exists", new Object[0])); |
| | | } |
| | | long countDisable = count(Wrappers.<Process>lambdaQuery() |
| | | .ne(Func.isNotEmpty(processSaveVO.getId()), Process::getId, processSaveVO.getId()) |
| | | .eq(Process::getCode, processSaveVO.getCode()) |
| | | .eq(Process::getStatus, CommonConstant.ENABLE)); |
| | | /* |
| | | long countDisable = count((Wrapper) ((LambdaQueryWrapper) Wrappers.lambdaQuery().ne(Func.isNotEmpty(processSaveVO.getId()), (v0) -> { |
| | | return v0.getId(); |
| | | }, processSaveVO.getId()).eq((v0) -> { |
| | | return v0.getCode(); |
| | | }, processSaveVO.getCode())).eq((v0) -> { |
| | | return v0.getStatus(); |
| | | }, CommonConstant.ENABLE)); |
| | | }, CommonConstant.ENABLE));*/ |
| | | if (countDisable > 0) { |
| | | throw new ServiceException(MessageUtils.message("cps.process.code.disable.already.exists", new Object[0])); |
| | | } |
| | |
| | | } |
| | | |
| | | private void checkImport(List<Long> ids) { |
| | | Long count = Long.valueOf(count((Wrapper) Wrappers.query().lambda().in(Func.isNotEmpty(ids), (v0) -> { |
| | | return v0.getId(); |
| | | }, ids).eq((v0) -> { |
| | | return v0.getIsImport(); |
| | | }, 1))); |
| | | Long count = Long.valueOf(count(Wrappers.<Process>query().lambda().in(Func.isNotEmpty(ids), Process::getId, ids).eq(Process::getIsImport, 1))); |
| | | |
| | | if (count.longValue() > 0) { |
| | | throw new ServiceException(MessageUtils.message("cps.process.delete.failed", new Object[0])); |
| | | } |