| | |
| | | package org.jeecg.modules.dnc.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | |
| | | import org.jeecg.modules.dnc.exception.ExceptionCast; |
| | | import org.jeecg.modules.dnc.mapper.ComponentInfoMapper; |
| | | import org.jeecg.modules.dnc.mapper.ProductInfoMapper; |
| | | import org.jeecg.modules.dnc.request.DocInfoQueryRequest; |
| | | import org.jeecg.modules.dnc.request.TreeInfoRequest; |
| | | import org.jeecg.modules.dnc.response.CommonCode; |
| | | import org.jeecg.modules.dnc.response.ComponentInfoCode; |
| | | import org.jeecg.modules.dnc.response.ProductInfoCode; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | public class ComponentInfoSeServiceImpl extends ServiceImpl<ComponentInfoMapper, ComponentInfo> implements IComponentInfoService { |
| | |
| | | @Lazy |
| | | private IPartsInfoService partsInfoService; |
| | | @Autowired |
| | | private IProcessSpecVersionService processSpecVersionService; |
| | | @Autowired |
| | | private IProcessStreamService processStreamService; |
| | | @Autowired |
| | | private IProductMixService productMixService; |
| | |
| | | private IDocRelativeService iDocRelativeService; |
| | | @Autowired |
| | | private IProductPermissionService productPermissionService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IDocInfoService docInfoService; |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean addComponentInfo(ComponentInfo componentInfo) { |
| | |
| | | queryWrapper.orderByAsc(ComponentInfo::getCreateTime); |
| | | return super.list(queryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * 通过零件号、材质等查询对应电子样板 |
| | | * @param treeInfoRequest |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<DocInfo> getByComponentInfo(TreeInfoRequest treeInfoRequest){ |
| | | LambdaQueryWrapper<ComponentInfo> queryWrapper = new LambdaQueryWrapper<>(); |
| | | if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) { |
| | | queryWrapper.in(ComponentInfo::getProductId, treeInfoRequest.getProductIds()); |
| | | } |
| | | if (treeInfoRequest.getAttributionType()==2){ |
| | | queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),ComponentInfo::getComponentId,treeInfoRequest.getAttributionId()); |
| | | } |
| | | |
| | | queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ComponentInfo::getComponentCode, treeInfoRequest.getTreeCode()); |
| | | queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ComponentInfo::getComponentName, treeInfoRequest.getTreeName()); |
| | | queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getStructureType()),ComponentInfo::getStructureType, treeInfoRequest.getStructureType()); |
| | | queryWrapper.orderByDesc(ComponentInfo::getCreateTime); |
| | | List<ComponentInfo> list = super.list(queryWrapper); |
| | | List<DocInfo> docInfos = new ArrayList<>(); |
| | | if (list != null && !list.isEmpty()) { |
| | | String ids=list.stream().map(ComponentInfo::getComponentId).collect(Collectors.joining(",")); |
| | | DocInfoQueryRequest docQuery = new DocInfoQueryRequest(); |
| | | BeanUtil.copyProperties(treeInfoRequest,docQuery); |
| | | docQuery.setAttributionIds(ids); |
| | | docQuery.setDocClassCode("OTHER"); |
| | | docQuery.setAttributionType(2); |
| | | docInfos=docInfoService.findListByDocQuery(docQuery); |
| | | } |
| | | if (treeInfoRequest.getAttributionType()==2){ |
| | | List<String> id =new ArrayList<>(); |
| | | id.add(treeInfoRequest.getAttributionId()); |
| | | treeInfoRequest.setComponentIds(id); |
| | | List<DocInfo> partsInfos = partsInfoService.getByPartsInfo(treeInfoRequest); |
| | | docInfos.addAll(partsInfos); |
| | | List<DocInfo> processSpecVersions = processSpecVersionService.getByProcessSpecVersion(treeInfoRequest); |
| | | docInfos.addAll(processSpecVersions); |
| | | } |
| | | return docInfos; |
| | | } |
| | | } |