| | |
| | | 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; |
| | |
| | | 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 -> { |
| | |
| | | } |
| | | } |
| | | |
| | | @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(); |
| | |
| | | return list.stream().findFirst().orElse(null); |
| | | } |
| | | |
| | | @Override // org.springblade.modules.cps.service.IProductService |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public BladeFile importProduct(MultipartFile file) { |
| | | try { |
| | |
| | | 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; |
| | |
| | | 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(Wrappers.<Product>lambdaQuery().in(Product::getParentId, ids)); |
| | | |
| | |
| | | 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); |
| | | } |