| | |
| | | import cn.hutool.core.lang.tree.Tree; |
| | | import cn.hutool.core.lang.tree.TreeNode; |
| | | import cn.hutool.core.lang.tree.TreeUtil; |
| | | import cn.hutool.core.util.ArrayUtil; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.by4cloud.platformx.admin.api.entity.SysDept; |
| | | import com.by4cloud.platformx.business.dto.ProductAddDTO; |
| | | import com.by4cloud.platformx.business.dto.ProductQueryDTO; |
| | | import com.by4cloud.platformx.business.entity.Product; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.BindingResult; |
| | | |
| | | |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.IntStream; |
| | | |
| | | ; |
| | | |
| | | /** |
| | | * 产品信息 |
| | |
| | | |
| | | @Override |
| | | public R saveErpProduct(List<ProductAddDTO> addDTOS) { |
| | | if (ArrayUtil.isNotEmpty(addDTOS.toArray())){ |
| | | if (CollUtil.isNotEmpty(addDTOS)){ |
| | | for (ProductAddDTO addDTO:addDTOS |
| | | ) { |
| | | List<Product> classPro = baseMapper.selectListByScope(Wrappers.<Product>lambdaQuery() |
| | | .eq(StrUtil.isNotEmpty(addDTO.getErpTypeCode()),Product::getErpCode,addDTO.getErpTypeCode()) |
| | | .eq(StrUtil.isNotEmpty(addDTO.getErpTypeName()),Product::getProductName,addDTO.getErpTypeName()) |
| | | , DataScope.of("comp_id")); |
| | | if (ArrayUtil.isEmpty(classPro.toArray())){ |
| | | if (CollUtil.isEmpty(classPro)){ |
| | | Product product = new Product(); |
| | | product.setProductName(addDTO.getErpTypeName()); |
| | | product.setProductType(addDTO.getSpecification()); |
| | |
| | | @Override |
| | | public R importProduct(List<ProductExcelVO> excelVOList, BindingResult bindingResult) { |
| | | List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget(); |
| | | if (ArrayUtil.isNotEmpty(excelVOList.toArray())) { |
| | | if (CollUtil.isNotEmpty(excelVOList)) { |
| | | List<List<ProductExcelVO>> groups = splitList(excelVOList, 5000); |
| | | groups.stream().forEach(group->{ |
| | | for (ProductExcelVO addDTO:group |
| | |
| | | errorMsg.add("产品分类信息没有"); |
| | | } |
| | | List<Product> one = this.listByScope(Wrappers.<Product>lambdaQuery().eq(Product::getErpCode, addDTO.getErpCode())); |
| | | if (ArrayUtil.isNotEmpty(one.toArray())){ |
| | | if (CollUtil.isNotEmpty(one)){ |
| | | errorMsg.add("产品erp编码已存在"); |
| | | } |
| | | if (CollUtil.isEmpty(errorMsg)){ |
| | |
| | | .eq(StrUtil.isNotEmpty(addDTO.getErpTypeCode()),Product::getErpCode,addDTO.getErpTypeCode()) |
| | | .eq(StrUtil.isNotEmpty(addDTO.getErpTypeName()),Product::getProductName,addDTO.getErpTypeName()) |
| | | , DataScope.of("comp_id")); |
| | | if (ArrayUtil.isEmpty(classPro.toArray())){ |
| | | if (CollUtil.isEmpty(classPro)){ |
| | | Product product = new Product(); |
| | | product.setProductName(addDTO.getErpTypeName()); |
| | | product.setProductType(addDTO.getSpecification()); |