From bb696e8e702854b62b144b22e20e36981301e6cf Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期四, 17 四月 2025 09:46:24 +0800
Subject: [PATCH] 新增筛选电子样板接口、新增强制终止流程方法,

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
index 59fcce6..33580e8 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.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;
@@ -12,6 +14,8 @@
 import org.jeecg.modules.dnc.mapper.ComponentInfoMapper;
 import org.jeecg.modules.dnc.mapper.PartsInfoMapper;
 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.PartsInfoCode;
 import org.jeecg.modules.dnc.response.ProductInfoCode;
@@ -21,10 +25,12 @@
 import org.jeecg.modules.system.entity.MdcProduction;
 import org.jeecg.modules.system.entity.SysUser;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class PartsInfoServiceImpl extends ServiceImpl<PartsInfoMapper, PartsInfo> implements IPartsInfoService {
@@ -46,6 +52,9 @@
     private IProductPermissionService productPermissionService;
     @Autowired
     private IProductMixService productMixService;
+    @Autowired
+    @Lazy
+    private IDocInfoService docInfoService;
     @Override
     @Transactional(rollbackFor = {Exception.class})
     public boolean addPartsInfo(PartsInfo partsInfo) {
@@ -435,4 +444,45 @@
         return null;
     }
 
+    /**
+     * 閫氳繃闆朵欢鍙枫�佹潗璐ㄧ瓑鏌ヨ瀵瑰簲鐢靛瓙鏍锋澘
+     * @param treeInfoRequest
+     * @return
+     */
+    @Override
+    public List<DocInfo> getByPartsInfo(TreeInfoRequest treeInfoRequest){
+        LambdaQueryWrapper<PartsInfo> queryWrapper = new LambdaQueryWrapper<>();
+        if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) {
+            queryWrapper.in(PartsInfo::getProductId, treeInfoRequest.getProductIds());
+        }
+        if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) {
+            queryWrapper.in(PartsInfo::getComponentId, treeInfoRequest.getComponentIds());
+        }
+        if (treeInfoRequest.getAttributionType()==3){
+            queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),PartsInfo::getPartsId,treeInfoRequest.getAttributionId());
+        }
+        queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),PartsInfo::getPartsCode, treeInfoRequest.getTreeCode());
+        queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),PartsInfo::getPartsName, treeInfoRequest.getTreeName());
+        queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getStructureType()),PartsInfo::getStructureType, treeInfoRequest.getStructureType());
+        queryWrapper.orderByDesc(PartsInfo::getCreateTime);
+        List<PartsInfo> list = super.list(queryWrapper);
+        List<DocInfo> docInfos = new ArrayList<>();
+        if (list != null && !list.isEmpty()) {
+            String ids=list.stream().map(PartsInfo::getPartsId).collect(Collectors.joining(","));
+            DocInfoQueryRequest docQuery = new DocInfoQueryRequest();
+            BeanUtil.copyProperties(treeInfoRequest,docQuery);
+            docQuery.setAttributionIds(ids);
+            docQuery.setDocClassCode("OTHER");
+            docQuery.setAttributionType(3);
+            docInfos=docInfoService.findListByDocQuery(docQuery);
+        }
+        if (treeInfoRequest.getAttributionType()==3){
+            List<String> id =new ArrayList<>();
+            id.add(treeInfoRequest.getAttributionIds());
+            treeInfoRequest.setPartsIds(id);
+            List<DocInfo> processSpecVersions = processSpecVersionService.getByProcessSpecVersion(treeInfoRequest);
+            docInfos.addAll(processSpecVersions);
+        }
+        return docInfos;
+    }
 }

--
Gitblit v1.9.3