| | |
| | | package com.qianwen.smartman.modules.cps.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.util.List; |
| | | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.qianwen.core.log.exception.ServiceException; |
| | | import com.qianwen.core.mp.base.BaseServiceImpl; |
| | | import com.qianwen.core.secure.utils.AuthUtil; |
| | | import com.qianwen.core.tool.utils.CollectionUtil; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.modules.cps.convert.BomVersionConvert; |
| | | import com.qianwen.smartman.modules.cps.entity.BomVersion; |
| | | import com.qianwen.smartman.modules.cps.enums.BomVersionStatusEnum; |
| | |
| | | import com.qianwen.smartman.modules.system.service.IBasCoderuleService; |
| | | import com.qianwen.smartman.modules.system.service.ICodeGeneratorService; |
| | | 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/BomVersionServiceImpl.class */ |
| | | public class BomVersionServiceImpl extends BaseServiceImpl<BomVersionMapper, BomVersion> implements IBomVersionService { |
| | | private static final Logger log = LoggerFactory.getLogger(BomVersionServiceImpl.class); |
| | | private final IBasCoderuleService basCoderuleService; |
| | | private final ICodeGeneratorService codeGeneratorService; |
| | | private final IBomMaterialService bomMaterialService; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -1061435468: |
| | | if (implMethodName.equals("getProductId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -343633100: |
| | | if (implMethodName.equals("getVersionStatus")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 771206363: |
| | | if (implMethodName.equals("getTenantId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 1388468386: |
| | | if (implMethodName.equals("getVersion")) { |
| | | 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/cps/entity/BomVersion") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getVersionStatus(); |
| | | }; |
| | | } |
| | | 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/BomVersion") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getVersionStatus(); |
| | | }; |
| | | } |
| | | 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/BomVersion") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getVersion(); |
| | | }; |
| | | } |
| | | 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(); |
| | | }; |
| | | } |
| | | 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/BomVersion") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getTenantId(); |
| | | }; |
| | | } |
| | | 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/BomVersion") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getProductId(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | public BomVersionServiceImpl(final IBasCoderuleService basCoderuleService, final ICodeGeneratorService codeGeneratorService, final IBomMaterialService bomMaterialService) { |
| | | public BomVersionServiceImpl(IBasCoderuleService basCoderuleService, ICodeGeneratorService codeGeneratorService, IBomMaterialService bomMaterialService) { |
| | | this.basCoderuleService = basCoderuleService; |
| | | this.codeGeneratorService = codeGeneratorService; |
| | | this.bomMaterialService = bomMaterialService; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IBomVersionService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public BomVersion insert(BomVersionVO bomVersionVO) { |
| | | BomVersion bomVersion = BomVersionConvert.INSTANCE.convert(bomVersionVO); |
| | |
| | | return bomVersion; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IBomVersionService |
| | | @Override |
| | | public BomVersionVO update(BomVersionUpdateVO bomVersionUpdateVO) { |
| | | BomVersion bomVersion = (BomVersion) getById(bomVersionUpdateVO.getId()); |
| | | if (BomVersionStatusEnum.FINALIZED.getStatus().equals(bomVersion.getVersionStatus())) { |
| | |
| | | return BomVersionConvert.INSTANCE.convert(bomVersion); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IBomVersionService |
| | | @Override |
| | | public BomVersionDetailVO getVersionById(Long id) { |
| | | return ((BomVersionMapper) this.baseMapper).getVersionById(id); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IBomVersionService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Boolean remove(Long id) { |
| | | BomVersion bomVersion = (BomVersion) getById(id); |
| | |
| | | return true; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IBomVersionService |
| | | @Override |
| | | public Boolean fixVersion(Long id) { |
| | | List<BomMaterialVO> bomMaterialVOList = this.bomMaterialService.getBomMaterialVOListByBomId(id); |
| | | if (CollectionUtil.isEmpty(bomMaterialVOList)) { |
| | | throw new ServiceException(MessageUtils.message("cps.production.bom.version.have.no.bom.material.can.not.fixed", new Object[0])); |
| | | } |
| | | return Boolean.valueOf(update((Wrapper) ((LambdaUpdateWrapper) Wrappers.update().lambda().set((v0) -> { |
| | | return v0.getVersionStatus(); |
| | | }, BomVersionStatusEnum.FINALIZED.getStatus())).eq((v0) -> { |
| | | return v0.getId(); |
| | | }, id))); |
| | | |
| | | return Boolean.valueOf(update(Wrappers.<BomVersion>update().lambda().set(BomVersion::getVersionStatus, BomVersionStatusEnum.FINALIZED.getStatus()).eq(BomVersion::getId, id))); |
| | | |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IBomVersionService |
| | | @Override |
| | | public Boolean cancelFixVersion(Long id) { |
| | | return Boolean.valueOf(update((Wrapper) ((LambdaUpdateWrapper) Wrappers.update().lambda().set((v0) -> { |
| | | return v0.getVersionStatus(); |
| | | }, BomVersionStatusEnum.DEFAULT.getStatus())).eq((v0) -> { |
| | | return v0.getId(); |
| | | }, id))); |
| | | return Boolean.valueOf(update(Wrappers.<BomVersion>update().lambda().set(BomVersion::getVersionStatus, BomVersionStatusEnum.DEFAULT.getStatus()).eq(BomVersion::getId, id))); |
| | | |
| | | } |
| | | |
| | | private boolean checkNameIsExist(String version, Long id, Long productId) { |
| | | List<BomVersion> bomVersionList = (this.baseMapper.selectList(Wrappers.<BomVersion>query().lambda() |
| | | .eq(Func.isNotEmpty(AuthUtil.getTenantId()), BomVersion::getTenantId, AuthUtil.getTenantId()) |
| | | .eq(Func.isNotBlank(version), BomVersion::getVersion, version) |
| | | .eq(Func.isNotEmpty(productId), BomVersion::getProductId, productId) |
| | | .notIn(Func.isNotEmpty(id), BomVersion::getId, id))); |
| | | /* |
| | | List<BomVersion> bomVersionList = ((BomVersionMapper) this.baseMapper).selectList(Wrappers.query().lambda().eq(Func.isNotEmpty(AuthUtil.getTenantId()), (v0) -> { |
| | | return v0.getTenantId(); |
| | | }, AuthUtil.getTenantId()).eq(Func.isNotBlank(version), (v0) -> { |
| | |
| | | return v0.getProductId(); |
| | | }, productId).notIn(Func.isNotEmpty(id), (v0) -> { |
| | | return v0.getId(); |
| | | }, new Object[]{id})); |
| | | }, new Object[]{id}))*/ |
| | | return bomVersionList != null && bomVersionList.size() > 0; |
| | | } |
| | | } |