| | |
| | | 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; |
| | |
| | | |
| | | 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); |
| | |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | |
| | |
| | | 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++) { |
| | |
| | | } |
| | | 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; |
| | | } |
| | |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | 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])); |
| | | } |
| | |
| | | } |
| | | |
| | | 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])); |
| | | } |