| | |
| | | package com.qianwen.smartman.modules.cps.service.impl; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.map.MapUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.core.toolkit.support.SFunction; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.ByteArrayOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.lang.invoke.SerializedLambda; |
| | | import java.lang.reflect.Field; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | |
| | | import java.util.Set; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.CommonGroupConstant; |
| | | import com.qianwen.smartman.common.constant.ExcelConstant; |
| | | import com.qianwen.smartman.common.utils.ExcelUtils; |
| | | 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.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.mp.support.Condition; |
| | |
| | | import com.qianwen.core.tool.constant.BladeConstant; |
| | | import com.qianwen.core.tool.utils.Func; |
| | | import com.qianwen.core.tool.utils.StringUtil; |
| | | import com.qianwen.smartman.common.constant.CommonConstant; |
| | | import com.qianwen.smartman.common.constant.CommonGroupConstant; |
| | | import com.qianwen.smartman.common.constant.ExcelConstant; |
| | | import com.qianwen.smartman.common.utils.ExcelUtils; |
| | | import com.qianwen.smartman.common.utils.MessageUtils; |
| | | import com.qianwen.smartman.common.utils.ValidatorUtils; |
| | | import com.qianwen.smartman.modules.coproduction.dto.CheckParamDTO; |
| | | import com.qianwen.smartman.modules.coproduction.dto.CheckResultDTO; |
| | | import com.qianwen.smartman.modules.cps.convert.ProductConvert; |
| | |
| | | import com.qianwen.smartman.modules.system.service.ICustomTemplateService; |
| | | import com.qianwen.smartman.modules.system.vo.CustomTemplateFieldColumnVO; |
| | | 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; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import cn.hutool.core.map.MapUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | | |
| | | @Service |
| | | /* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/cps/service/impl/ProductServiceImpl.class */ |
| | | public class ProductServiceImpl extends BaseServiceImpl<ProductMapper, Product> implements IProductService { |
| | | private static final Logger log = LoggerFactory.getLogger(ProductServiceImpl.class); |
| | | private final IProductTypeService productTypeService; |
| | |
| | | private final ICustomTemplateFieldService customTemplateFieldService; |
| | | private final CustomTemplateFieldRelationMapper customTemplateFieldRelationMapper; |
| | | |
| | | private static /* synthetic */ Object $deserializeLambda$(SerializedLambda lambda) { |
| | | String implMethodName = lambda.getImplMethodName(); |
| | | boolean z = true; |
| | | switch (implMethodName.hashCode()) { |
| | | case -1041904421: |
| | | if (implMethodName.equals("getParentId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -75622813: |
| | | if (implMethodName.equals("getCode")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case -75308287: |
| | | if (implMethodName.equals("getName")) { |
| | | z = false; |
| | | break; |
| | | } |
| | | break; |
| | | case 98245393: |
| | | if (implMethodName.equals("getId")) { |
| | | z = true; |
| | | break; |
| | | } |
| | | break; |
| | | case 953775504: |
| | | if (implMethodName.equals("getBusinessType")) { |
| | | 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/ProductType") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getName(); |
| | | }; |
| | | } |
| | | 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/Product") && lambda.getImplMethodSignature().equals("()Ljava/lang/String;")) { |
| | | return (v0) -> { |
| | | return v0.getName(); |
| | | }; |
| | | } |
| | | 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/Product") && 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/modules/system/entity/CustomTemplate") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getBusinessType(); |
| | | }; |
| | | } |
| | | 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/CustomTemplate") && lambda.getImplMethodSignature().equals("()Ljava/lang/Integer;")) { |
| | | return (v0) -> { |
| | | return v0.getBusinessType(); |
| | | }; |
| | | } |
| | | 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/Product") && 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/Product") && 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/Product") && 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/Product") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getParentId(); |
| | | }; |
| | | } |
| | | 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/Product") && lambda.getImplMethodSignature().equals("()Ljava/lang/Long;")) { |
| | | return (v0) -> { |
| | | return v0.getParentId(); |
| | | }; |
| | | } |
| | | break; |
| | | } |
| | | throw new IllegalArgumentException("Invalid lambda deserialization"); |
| | | } |
| | | |
| | | public ProductServiceImpl(final IProductTypeService productTypeService, final OssBuilder ossBuilder, final ProductMapper productMapper, final ICodeGeneratorService codeGeneratorService, final HandlerFieldSqlParse handlerFieldSqlParse, final ICustomTemplateService customTemplateService, final ICustomTemplateFieldService customTemplateFieldService, final CustomTemplateFieldRelationMapper customTemplateFieldRelationMapper) { |
| | | this.productTypeService = productTypeService; |
| | |
| | | this.customTemplateFieldRelationMapper = customTemplateFieldRelationMapper; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | public IPage<ProductVO> selectPage(IPage<ProductVO> page, ProductSelectVO productSelectVO) { |
| | | List<ProductVO> productVOS = selectProductVOList(page, productSelectVO, true); |
| | | long total = page.getTotal(); |
| | |
| | | productSelectVO.setOrderBy(orderBy); |
| | | List<Long> ids2 = new ArrayList<>(); |
| | | if (Func.isNotEmpty(productSelectVO.getIds())) { |
| | | List<Product> products = ((ProductMapper) this.baseMapper).selectIdById(productSelectVO); |
| | | ids2 = (List) products.stream().map((v0) -> { |
| | | List<Product> products = this.baseMapper.selectIdById(productSelectVO); |
| | | ids2 = products.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).distinct().collect(Collectors.toList()); |
| | | } |
| | |
| | | if (isPage) { |
| | | page.setTotal(total); |
| | | if (total == 0) { |
| | | return new ArrayList(); |
| | | return new ArrayList<>(); |
| | | } |
| | | long current = page.getCurrent(); |
| | | long size = page.getSize(); |
| | |
| | | } |
| | | List<ProductVO> productVOS = new ArrayList<>(); |
| | | if (Func.isNotEmpty(pageIds)) { |
| | | productVOS = ((ProductMapper) this.baseMapper).selectListByIds(pageIds, orderBy); |
| | | productVOS = this.baseMapper.selectListByIds(pageIds, orderBy); |
| | | } |
| | | if (Func.isNotEmpty(productVOS)) { |
| | | Optional<ProductVO> productOP = productVOS.stream().filter(item -> { |
| | |
| | | |
| | | public void selectChildrenId(List<Long> all, List<Long> parentIds, ProductSelectVO productSelectVO) { |
| | | productSelectVO.setPids(parentIds); |
| | | List<Product> products = ((ProductMapper) this.baseMapper).selectList((Wrapper) Wrappers.lambdaQuery().select(new SFunction[]{(v0) -> { |
| | | return v0.getId(); |
| | | }}).in((v0) -> { |
| | | return v0.getParentId(); |
| | | }, parentIds)); |
| | | List<Long> ids = (List) products.stream().map((v0) -> { |
| | | return v0.getId(); |
| | | }).collect(Collectors.toList()); |
| | | List<Product> products = this.baseMapper.selectList(Wrappers.<Product>lambdaQuery().select(Product::getId).in(Product::getParentId, parentIds)); |
| | | List<Long> ids = products.stream().map(Product::getId).collect(Collectors.toList()); |
| | | if (Func.isNotEmpty(ids)) { |
| | | all.addAll(ids); |
| | | selectChildrenId(all, ids, productSelectVO); |
| | | } |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | public Product insert(ProductAddVO productAddVO) { |
| | | this.handlerFieldSqlParse.handlerFieldSaveOrUpdateCheck(productAddVO.getExtendField(), BusinessTypeEnums.PRODUCT.getCode()); |
| | | if (Func.isEmpty(productAddVO.getParentId())) { |
| | |
| | | log.info("产品编码规则生成的code:{}", code + " ," + code.length()); |
| | | productAddVO.setCode(code); |
| | | } |
| | | ProductType productType = (ProductType) this.productTypeService.getById(productAddVO.getTypeId()); |
| | | ProductType productType = this.productTypeService.getById(productAddVO.getTypeId()); |
| | | if (Func.isEmpty(productType)) { |
| | | throw new ServiceException(MessageUtils.message("cps.product.type.not.exists", new Object[0])); |
| | | } |
| | |
| | | return product2; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | public Product update(ProductUpdateVO productUpdateVO) { |
| | | this.handlerFieldSqlParse.handlerFieldSaveOrUpdateCheck(productUpdateVO.getExtendField(), BusinessTypeEnums.PRODUCT.getCode()); |
| | | Long id = productUpdateVO.getId(); |
| | |
| | | } |
| | | |
| | | private CustomTemplate getProductTemplate() { |
| | | List<CustomTemplate> list = this.customTemplateService.list(Wrappers.<CustomTemplate>lambdaQuery().eq(CustomTemplate::getBusinessType, BusinessTypeEnums.PRODUCT.getCode())); |
| | | /* |
| | | List<CustomTemplate> list = this.customTemplateService.list((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getBusinessType(); |
| | | }, BusinessTypeEnums.PRODUCT.getCode())); |
| | | }, BusinessTypeEnums.PRODUCT.getCode()));*/ |
| | | return list.stream().findFirst().orElse(null); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public BladeFile importProduct(MultipartFile file) { |
| | | try { |
| | |
| | | sysData.forEach(item -> { |
| | | ProductImport prodectImport = new ProductImport(); |
| | | importVOS.add(prodectImport); |
| | | item.forEach(k, v -> { |
| | | item.forEach((k, v) -> { |
| | | Field[] declaredFields = ProductImport.class.getDeclaredFields(); |
| | | for (Field field : declaredFields) { |
| | | try { |
| | |
| | | return dto -> { |
| | | map.addAll(dto); |
| | | List<CheckParamDTO> checkParamDTOS = new ArrayList<>(); |
| | | List<CustomTemplate> templates = this.customTemplateService.list((Wrapper) Wrappers.lambdaQuery().eq((v0) -> { |
| | | return v0.getBusinessType(); |
| | | }, BusinessTypeEnums.PRODUCT.getCode())); |
| | | List<CustomTemplate> templates = this.customTemplateService.list(Wrappers.<CustomTemplate>lambdaQuery().eq(CustomTemplate::getBusinessType, BusinessTypeEnums.PRODUCT.getCode())); |
| | | |
| | | Optional<CustomTemplate> customTemplateOptional = templates.stream().findFirst(); |
| | | CustomTemplate customTemplate = null; |
| | | if (customTemplateOptional.isPresent()) { |
| | |
| | | if (Func.isNotEmpty(customTemplate)) { |
| | | checkParamDTO.setCustomTemplate(customTemplate); |
| | | if (Func.isNotEmpty(customTemplateFieldRelationDTOS)) { |
| | | Map<String, CustomTemplateFieldRelationDTO> relationDTOMap = (Map) customTemplateFieldRelationDTOS.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, CustomTemplateFieldRelationDTO> relationDTOMap = customTemplateFieldRelationDTOS.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getFieldCode(); |
| | | }, item -> { |
| | | return item; |
| | |
| | | if (passNum == planImportVOS.size()) { |
| | | return pts; |
| | | } |
| | | List<ProductType> productTypes = this.productTypeService.list((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getName(); |
| | | }, typeNames)); |
| | | Map<String, ProductType> productTypeMap = (Map) productTypes.stream().collect(Collectors.toMap((v0) -> { |
| | | List<ProductType> productTypes = this.productTypeService.list(Wrappers.<ProductType>lambdaQuery().in(ProductType::getName, typeNames)); |
| | | Map<String, ProductType> productTypeMap = productTypes.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getName(); |
| | | }, item -> { |
| | | return item; |
| | | })); |
| | | List<Product> products = list((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getCode(); |
| | | }, parentCodes)); |
| | | Map<String, Product> productMap = (Map) products.stream().collect(Collectors.toMap((v0) -> { |
| | | List<Product> products = list(Wrappers.<Product>lambdaQuery().in(Product::getCode, parentCodes)); |
| | | Map<String, Product> productMap = products.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getCode(); |
| | | }, item2 -> { |
| | | return item2; |
| | | })); |
| | | List<Product> codeList = list((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | List<Product> codeList = list(Wrappers.<Product>lambdaQuery().in((v0) -> { |
| | | return v0.getCode(); |
| | | }, codes)); |
| | | Set<String> codeSet = (Set) codeList.stream().map((v0) -> { |
| | | Set<String> codeSet = codeList.stream().map((v0) -> { |
| | | return v0.getCode(); |
| | | }).collect(Collectors.toSet()); |
| | | List<Product> nameList = list((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | List<Product> nameList = list(Wrappers.<Product>lambdaQuery().in((v0) -> { |
| | | return v0.getName(); |
| | | }, names)); |
| | | Set<String> nameSet = (Set) nameList.stream().map((v0) -> { |
| | | Set<String> nameSet = nameList.stream().map((v0) -> { |
| | | return v0.getName(); |
| | | }).collect(Collectors.toSet()); |
| | | for (int i2 = 0; i2 < planImportVOS.size(); i2++) { |
| | |
| | | return pts; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | public BladeFile exportProduct(String id, ProductSearchVO vo) { |
| | | Wrapper<ProductSearchVO> wrapper = (QueryWrapper) Wrappers.query().eq(Func.isNotEmpty(id), "bp1.id", id).nested(Func.isNotEmpty(vo), n -> { |
| | | n.eq(Func.isNotEmpty(vo.getTypeId()), "bp1.type_id", vo.getTypeId()).eq(Func.isNotEmpty(vo.getStandardModel()), "bp1.standard_model", vo.getStandardModel()).eq(Func.isNotEmpty(vo.getStatus()), "bp1.status", vo.getStatus()).and(Func.isNotEmpty(vo.getKeyWord()), i -> { |
| | |
| | | } |
| | | CustomTemplate productTemplate = getProductTemplate(); |
| | | List<CustomTemplateFieldColumnVO> columns = this.customTemplateFieldService.getColumns(productTemplate.getId(), ConfigTypeEnum.VIEW_PAGE.getCode()); |
| | | Map<String, CustomTemplateFieldColumnVO> fieldCodeMap = (Map) columns.stream().collect(Collectors.toMap((v0) -> { |
| | | Map<String, CustomTemplateFieldColumnVO> fieldCodeMap = columns.stream().collect(Collectors.toMap((v0) -> { |
| | | return v0.getFieldCode(); |
| | | }, item -> { |
| | | return item; |
| | |
| | | } |
| | | excelExportDTO.addTableHead(item2.getFieldName(), Func.equals(item2.getMustField(), CommonConstant.ENABLE)); |
| | | }); |
| | | List<ProductExcelExport> excelExports = (List) productExcels.stream().map(item3 -> { |
| | | List<ProductExcelExport> excelExports = productExcels.stream().map(item3 -> { |
| | | ProductExcelExport productExcelExport = new ProductExcelExport(); |
| | | productExcelExport.setParentId(item3.getParentCode()); |
| | | productExcelExport.setCode(item3.getCode()); |
| | |
| | | } |
| | | String extendField = export.getExtendField(); |
| | | JSONObject jsonObject = JSONUtil.parseObj(extendField); |
| | | jsonObject.forEach(key, value -> { |
| | | jsonObject.forEach((key, value) -> { |
| | | if (!fieldCodeMap.containsKey(key)) { |
| | | return; |
| | | } |
| | |
| | | return this.ossBuilder.systemTemplate().putFile("产品数据.xlsx", is); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | public BladeFile exportTemplateProduct() { |
| | | CustomTemplate customTemplate = getProductTemplate(); |
| | | if (Func.isEmpty(customTemplate)) { |
| | |
| | | return this.customTemplateService.getTemplate(BusinessTypeEnums.PRODUCT.getCode()); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | public boolean delete(List<Long> ids) { |
| | | List<Product> list = list((Wrapper) Wrappers.lambdaQuery().in((v0) -> { |
| | | return v0.getParentId(); |
| | | }, ids)); |
| | | List<Product> list = list(Wrappers.<Product>lambdaQuery().in(Product::getParentId, ids)); |
| | | |
| | | if (Func.isNotEmpty(list)) { |
| | | throw new ServiceException(MessageUtils.message("cps.product.cannot.delete", new Object[0])); |
| | | } |
| | |
| | | return removeByIds(ids); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | public ProductVO detail(Long id) { |
| | | Product product = (Product) getById(id); |
| | | ProductVO convert = ProductConvert.INSTANCE.convert(product); |
| | |
| | | return convert; |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | public void changeStatusCheck(ProductChangeStatusVO changeStatusVO) { |
| | | changeStatusVO.setStatus(0); |
| | | Integer count = this.productMapper.getParentStatusCount(changeStatusVO.getIds()); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | public List<ProductVO> selectList(ProductSelectVO productSelectVO) { |
| | | String typeId = productSelectVO.getTypeId(); |
| | | if (Func.isNotEmpty(typeId)) { |
| | |
| | | } |
| | | |
| | | /* JADX WARN: Multi-variable type inference failed */ |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | public IPage<ProductEasyVO> lazyTree(Query query, String id, ProductSearchVO vo) { |
| | | Wrapper<Product> wrapper = (QueryWrapper) Wrappers.query().eq(Func.isNotEmpty(id), "bp1.parent_id", Long.valueOf(Func.toLong(id))).in(Func.isNotEmpty(vo.getTypeId()), "bp1.type_id", vo.getTypeId()).likeRight(Func.isNotEmpty(vo.getStandardModel()), "bp1.standard_model", vo.getStandardModel()).eq(Func.isNotEmpty(vo.getStatus()), "bp1.status", vo.getStatus()).and(Func.isNotEmpty(vo.getKeyWord()), i -> { |
| | | QueryWrapper queryWrapper = (QueryWrapper) ((QueryWrapper) ((QueryWrapper) i.likeRight("bp1.name", vo.getKeyWord())).or()).likeRight("bp1.code", vo.getKeyWord()); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | public List<Product> notBandProduct(Long craftId) { |
| | | return ((ProductMapper) this.baseMapper).notBandProduct(craftId); |
| | | } |
| | | |
| | | private void checkProductCodeAndName(Long id, Long typeId, String code, String name) { |
| | | Long count = Long.valueOf(count(Wrappers.<Product>lambdaQuery().ne(Func.isNotEmpty(id), Product::getId, id).eq(Product::getCode, code))); |
| | | /* |
| | | Long count = Long.valueOf(count((Wrapper) Wrappers.lambdaQuery().ne(Func.isNotEmpty(id), (v0) -> { |
| | | return v0.getId(); |
| | | }, id).eq((v0) -> { |
| | | return v0.getCode(); |
| | | }, code))); |
| | | }, code)));*/ |
| | | if (count.longValue() > 0) { |
| | | throw new ServiceException(MessageUtils.message("cps.product.code.already.exists", new Object[0])); |
| | | } |
| | | Long countName = Long.valueOf(count(Wrappers.<Product>lambdaQuery().ne(Func.isNotEmpty(id), Product::getId, id).eq(Product::getName, name))); |
| | | /* |
| | | Long countName = Long.valueOf(count((Wrapper) Wrappers.lambdaQuery().ne(Func.isNotEmpty(id), (v0) -> { |
| | | return v0.getId(); |
| | | }, id).eq((v0) -> { |
| | | return v0.getName(); |
| | | }, name))); |
| | | }, name)));*/ |
| | | if (countName.longValue() > 0) { |
| | | throw new ServiceException(MessageUtils.message("cps.product.name.already.exists", new Object[0])); |
| | | } |