From c6eb2d4ecd99bee148892abfbdca3e42f3dd6084 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期三, 07 五月 2025 18:08:07 +0800
Subject: [PATCH] 工具管理-仓库管理功能
---
lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java | 71 +++++++++++++++++++++++++++++++----
1 files changed, 63 insertions(+), 8 deletions(-)
diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
index c8a6245..9b22567 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java
@@ -1,5 +1,7 @@
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;
@@ -11,6 +13,8 @@
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;
@@ -24,10 +28,8 @@
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
@Service
public class ComponentInfoSeServiceImpl extends ServiceImpl<ComponentInfoMapper, ComponentInfo> implements IComponentInfoService {
@@ -43,6 +45,8 @@
@Lazy
private IPartsInfoService partsInfoService;
@Autowired
+ private IProcessSpecVersionService processSpecVersionService;
+ @Autowired
private IProcessStreamService processStreamService;
@Autowired
private IProductMixService productMixService;
@@ -50,7 +54,9 @@
private IDocRelativeService iDocRelativeService;
@Autowired
private IProductPermissionService productPermissionService;
-
+ @Autowired
+ @Lazy
+ private IDocInfoService docInfoService;
@Override
@Transactional(rollbackFor = {Exception.class})
public boolean addComponentInfo(ComponentInfo componentInfo) {
@@ -121,15 +127,22 @@
ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
}
//娣诲姞缁撴瀯鏍�
- ProductMix productMix = new ProductMix(Long.parseLong(componentInfo.getComponentId()),Long.parseLong(productInfo.getProductId())
- ,componentInfo.getComponentName(),componentInfo.getComponentCode(),2);
+ ProductMix productMix=null;
+ if (componentInfo.getParentId() != null) {
+ //瀛愰儴浠�
+ productMix = new ProductMix(Long.parseLong(componentInfo.getComponentId()),Long.parseLong(componentInfo.getParentId())
+ ,componentInfo.getComponentName(),componentInfo.getComponentCode(),2,new Date());
+ }else {
+ productMix = new ProductMix(Long.parseLong(componentInfo.getComponentId()),Long.parseLong(productInfo.getProductId())
+ ,componentInfo.getComponentName(),componentInfo.getComponentCode(),2,new Date());
+ }
productMixService.save(productMix);
//娣诲姞鏉冮檺
PermissionStreamNew stream = new PermissionStreamNew();
stream.setUserId(userId);
stream.setBusinessId(componentInfo.getComponentId());
stream.setBusinessType("2");
- return permissionStreamNewService.save(stream);
+ return permissionStreamNewService.addPermissionStreamNew(stream);
}
@Override
@@ -511,4 +524,46 @@
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;
+ }
}
--
Gitblit v1.9.3