From 2fb6c67b2c0c72195eef6fe5f7904d739b46e2c0 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 25 六月 2025 11:57:28 +0800
Subject: [PATCH] Merge branch 'mdc_hyjs_master'

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java |  272 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 154 insertions(+), 118 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 0921b54..59e70c2 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,38 +1,37 @@
 package org.jeecg.modules.dnc.service.impl;
 
-import com.alibaba.fastjson.JSONObject;
+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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.collections4.ListUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
-
+import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum;
+import org.jeecg.modules.dnc.entity.*;
 import org.jeecg.modules.dnc.exception.ExceptionCast;
 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;
 import org.jeecg.modules.dnc.response.UcenterCode;
-
 import org.jeecg.modules.dnc.service.*;
-import org.jeecg.modules.dnc.ucenter.Department;
 import org.jeecg.modules.dnc.utils.ValidateUtil;
-
-import org.jeecg.modules.dnc.entity.*;
+import org.jeecg.modules.system.entity.MdcProduction;
 import org.jeecg.modules.system.entity.SysUser;
-import org.apache.commons.collections4.ListUtils;
-
 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.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class PartsInfoServiceImpl extends ServiceImpl<PartsInfoMapper, PartsInfo> implements IPartsInfoService {
@@ -43,16 +42,24 @@
     @Autowired
     private IPartsPermissionService partsPermissionService;
     @Autowired
-    private IPermissionStreamService permissionStreamService;
+    private IPermissionStreamNewService permissionStreamNewService;
     @Autowired
     private IPartsDepartmentService partsDepartmentService;
     @Autowired
-    @Lazy
+    private IProcessSpecVersionService processSpecVersionService;
+    @Autowired
     private IProcessStreamService processStreamService;
     @Autowired
-    private IDocInfoService docInfoService;
+    private IWorkStepService workStepService;
     @Autowired
-    private INcLogInfoService iNcLogInfoService;
+    private IDocRelativeService iDocRelativeService;
+    @Autowired
+    private IProductPermissionService productPermissionService;
+    @Autowired
+    private IProductMixService productMixService;
+    @Autowired
+    @Lazy
+    private IDocInfoService docInfoService;
     @Override
     @Transactional(rollbackFor = {Exception.class})
     public boolean addPartsInfo(PartsInfo partsInfo) {
@@ -80,30 +87,20 @@
         if(componentInfo == null)
             ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE);
         partsInfo.setPartsStatus(1);
-        //娣诲姞鏃ュ織
-        NcLogInfo ncLogInfo = new NcLogInfo();
-        //妯″潡
-        ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�");
-        //绫诲瀷
-        ncLogInfo.setOperateType(2);
-        //鏃ュ織鍐呭
-        ncLogInfo.setLogContent("闆朵欢鍚嶇О锛�"+partsInfo.getPartsName()+"锛岄浂浠朵唬鍙凤細"+partsInfo.getPartsCode());
-        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
         boolean b = super.save(partsInfo);
-        List<PermissionStream> oldDepartPermList = permissionStreamService.getByComponentId(componentInfo.getProductId(), componentInfo.getComponentId());
+        List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1");
         if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) {
             List<PartsDepartment> partsDepartmentList = new ArrayList<>();
-            List<PermissionStream> permissionStreamList = new ArrayList<>();
+            List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
             oldDepartPermList.forEach(item -> {
                 PartsDepartment pd = new PartsDepartment();
                 pd.setDepartId(item.getDepartId());
                 pd.setPartsId(partsInfo.getPartsId());
                 partsDepartmentList.add(pd);
-                PermissionStream perm = new PermissionStream();
+                PermissionStreamNew perm = new PermissionStreamNew();
                 perm.setDepartId(item.getDepartId());
-                perm.setProductId(partsInfo.getProductId());
-                perm.setComponentId(partsInfo.getComponentId());
-                perm.setPartsId(partsInfo.getPartsId());
+                perm.setBusinessId(partsInfo.getPartsId());
+                perm.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString());
                 permissionStreamList.add(perm);
             });
             if(!partsDepartmentList.isEmpty()) {
@@ -112,37 +109,27 @@
                     ExceptionCast.cast(CommonCode.FAIL);
             }
             if(!permissionStreamList.isEmpty()) {
-                b = permissionStreamService.saveBatch(permissionStreamList);
+                b = permissionStreamNewService.saveBatch(permissionStreamList);
                 if(!b)
                     ExceptionCast.cast(CommonCode.FAIL);
             }
         }
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        PartsPermission permission = new PartsPermission();
-        permission.setPartsId(partsInfo.getPartsId());
-        permission.setUserId(userId);
-        b = partsPermissionService.save(permission);
-        if(!b)
-            ExceptionCast.cast(CommonCode.FAIL);
-//        if(!b)
-//            ExceptionCast.cast(CommonCode.FAIL);
+        b = productPermissionService.add(partsInfo.getPartsId(), userId,DocAttributionTypeEnum.PARTS.getCode().toString());
+        if (!b) {
+            ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
+        }
+        //娣诲姞缁撴瀯鏍�
+        ProductMix productMix = new ProductMix(Long.parseLong(partsInfo.getPartsId()),Long.parseLong(partsInfo.getComponentId())
+                ,partsInfo.getPartsName(),partsInfo.getPartsCode(),DocAttributionTypeEnum.PARTS.getCode(),new Date());
+        productMixService.save(productMix);
         //娣诲姞鐢ㄦ埛鏉冮檺
-        PermissionStream stream = new PermissionStream();
-        stream.setProductId(partsInfo.getProductId());
-        stream.setComponentId(partsInfo.getComponentId());
-        stream.setPartsId(partsInfo.getPartsId());
+        PermissionStreamNew stream = new PermissionStreamNew();
+        stream.setBusinessId(partsInfo.getPartsId());
+        stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString());
         stream.setUserId(userId);
-//        //娣诲姞鏃ュ織
-//        NcLogInfo ncLogInfogx = new NcLogInfo();
-//        //妯″潡
-//        ncLogInfogx.setModuleInfo("浜у搧缁撴瀯鏍�");
-//        //绫诲瀷
-//        ncLogInfogx.setOperateType(2);
-//        //鏃ュ織鍐呭
-//        ncLogInfogx.setLogContent("闆朵欢鍚嶇О锛�"+partsInfo.getPartsName()+"鐢熸垚榛樿宸ュ簭锛屽伐搴忓彿锛�"+processStream.getProcessCode());
-//        iNcLogInfoService.saveLogNcInfos(ncLogInfogx);
-        return permissionStreamService.save(stream);
+        return permissionStreamNewService.addPermissionStreamNew(stream);
     }
 
     @Override
@@ -161,18 +148,12 @@
         partsInfo.setPartsStatus(null);
         partsInfo.setProductId(null);
         partsInfo.setComponentId(null);
-        //娣诲姞鏃ュ織
-        NcLogInfo ncLogInfo = new NcLogInfo();
-        //妯″潡
-        ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�");
-        //绫诲瀷
-        ncLogInfo.setOperateType(3);
-        //淇敼淇濆瓨澶囨敞
-        ncLogInfo.setRemark(JSONObject.toJSONString(en));
-        //鏃ュ織鍐呭
-        ncLogInfo.setLogContent("淇敼閮ㄤ欢鍚嶇О锛�"+productInfoMapper.selectById(en.getProductId()).getProductName()+"瀛愰泦闆朵欢");
-        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
         boolean b = super.updateById(partsInfo);
+        //鍚屾淇敼缁撴瀯鏍�
+        ProductMix productMix = productMixService.getById(Long.parseLong(id));
+        productMix.setTreeName(partsInfo.getPartsName());
+        productMix.setTreeCode(partsInfo.getPartsCode());
+        productMixService.updateById(productMix);
         if(!b)
             return false;
         PartsPermission permission = partsPermissionService.getByPartsIdAndUserId(id, userId);
@@ -184,14 +165,13 @@
             if(!b)
                 return false;
         }
-        PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(en.getProductId(), en.getComponentId(), id, userId);
+        PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId( id, userId,DocAttributionTypeEnum.PARTS.getCode().toString());
         if(stream == null) {
-            stream = new PermissionStream();
-            stream.setProductId(en.getProductId());
-            stream.setComponentId(en.getComponentId());
-            stream.setPartsId(id);
+            stream = new PermissionStreamNew();
+            stream.setBusinessId(id);
+            stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString());
             stream.setUserId(userId);
-            return permissionStreamService.save(stream);
+            return permissionStreamNewService.save(stream);
         }
         return b;
     }
@@ -247,10 +227,10 @@
             b = partsDepartmentService.deleteByPartsId(item.getPartsId());
             if(!b)
                 ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR);
-            b = permissionStreamService.deleteUserPermsByPartsId(item.getProductId(), item.getComponentId(), item.getPartsId());
+            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),DocAttributionTypeEnum.PARTS.getCode().toString(),"0");
             if(!b)
                 ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR);
-            b = permissionStreamService.deleteDepartPermsByPartsId(item.getProductId(), item.getComponentId(), item.getPartsId());
+            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),DocAttributionTypeEnum.PARTS.getCode().toString(),"1");
             if(!b)
                 ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR);
             b = super.removeById(item.getPartsId());
@@ -268,34 +248,30 @@
         PartsInfo partsInfo = super.getById(partsId);
         if(partsInfo == null)
             ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST);
-        List<ProcessStream> processStreams = processStreamService.findByPartsId(partsId);
-        if(processStreams != null && !processStreams.isEmpty())
+        List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.getByPartsId(partsId);
+        if(processSpecVersions != null && !processSpecVersions.isEmpty())
             ExceptionCast.cast(PartsInfoCode.PARTS_PROCESS_EXIST);
         boolean b = partsPermissionService.deleteByPartsId(partsInfo.getPartsId());
+        //楠岃瘉鏄惁瀛樺湪鏂囨。
+        List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type",DocAttributionTypeEnum.PARTS.getCode().toString()).eq("attribution_id",partsId));
+        if (!docRelativeList.isEmpty()){
+            ExceptionCast.cast(PartsInfoCode.PARTS_DOC_EXIST);
+        }
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
         b = partsDepartmentService.deleteByPartsId(partsInfo.getPartsId());
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        b = permissionStreamService.deleteUserPermsByPartsId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId());
+        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,DocAttributionTypeEnum.PARTS.getCode().toString(),"0");
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        b = permissionStreamService.deleteDepartPermsByPartsId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId());
+        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,DocAttributionTypeEnum.PARTS.getCode().toString(),"1");
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        b = docInfoService.deleteByPartsId(partsInfo.getPartsId());
-        if(!b)
+        b = productMixService.removeById(partsId);
+        if (!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        //娣诲姞鏃ュ織
-        NcLogInfo ncLogInfo = new NcLogInfo();
-        //妯″潡
-        ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�");
-        //绫诲瀷
-        ncLogInfo.setOperateType(4);
-        //鏃ュ織鍐呭
-        ncLogInfo.setLogContent("闆朵欢鍚嶇О锛�"+partsInfo.getPartsName());
-        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
-        return super.removeById(partsInfo.getPartsId());
+        return super.removeById(partsId);
     }
 
     @Override
@@ -304,7 +280,7 @@
         if(partsInfo == null || userList == null || userList.isEmpty())
             ExceptionCast.cast(CommonCode.INVALID_PARAM);
         List<PartsPermission> permissionList = new ArrayList<>();
-        List<PermissionStream> permissionStreamList = new ArrayList<>();
+        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
         userList.forEach(item -> {
             PartsPermission en = partsPermissionService.getByPartsIdAndUserId(partsInfo.getPartsId(), item.getId());
             if(en == null) {
@@ -313,13 +289,12 @@
                 en.setPartsId(partsInfo.getPartsId());
                 permissionList.add(en);
             }
-            PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getId());
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString());
             if(stream == null) {
-                stream = new PermissionStream();
+                stream = new PermissionStreamNew();
                 stream.setUserId(item.getId());
-                stream.setProductId(partsInfo.getProductId());
-                stream.setComponentId(partsInfo.getComponentId());
-                stream.setPartsId(partsInfo.getPartsId());
+                stream.setBusinessId(partsInfo.getPartsId());
+                stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString());
                 permissionStreamList.add(stream);
             }
         });
@@ -330,7 +305,7 @@
             }
         }
         if(!permissionStreamList.isEmpty()) {
-            boolean b = permissionStreamService.saveBatch(permissionStreamList);
+            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
             if(!b) {
                 ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
             }
@@ -344,21 +319,18 @@
         if(partsInfo == null || userList == null || userList.isEmpty())
             ExceptionCast.cast(CommonCode.INVALID_PARAM);
         List<PartsPermission> permissionList = new ArrayList<>();
-        List<PermissionStream> permissionStreamList = new ArrayList<>();
+        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
         userList.forEach(item -> {
             PartsPermission en = partsPermissionService.getByPartsIdAndUserId(partsInfo.getPartsId(), item.getId());
             if(en != null) {
                 permissionList.add(en);
             }
-            PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getId());
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString());
             if(stream != null) {
                 permissionStreamList.add(stream);
             }
         });
         //娓呯┖鐢ㄦ埛鏉冮檺鏍¢獙
-        /*List<PartsPermission> exitsList = partsPermissionService.getByPartsId(partsInfo.getPartsId());
-        if(exitsList.size() <= permissionList.size())
-            ExceptionCast.cast(PartsInfoCode.PARTS_USER_NONE);*/
         if(!permissionList.isEmpty()) {
             boolean b = partsPermissionService.removeByCollection(permissionList);
             if(!b) {
@@ -366,7 +338,7 @@
             }
         }
         if(!permissionStreamList.isEmpty()) {
-            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
+            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
             if(!b) {
                 ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
             }
@@ -376,26 +348,25 @@
 
     @Override
     @Transactional(rollbackFor = {Exception.class})
-    public boolean assignAddDepart(PartsInfo partsInfo, Collection<Department> departmentList) {
+    public boolean assignAddDepart(PartsInfo partsInfo, Collection<MdcProduction> departmentList) {
         if(partsInfo == null || departmentList == null || departmentList.isEmpty())
             ExceptionCast.cast(CommonCode.INVALID_PARAM);
         List<PartsDepartment> partsDepartments = new ArrayList<>();
-        List<PermissionStream> permissionStreamList = new ArrayList<>();
+        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
         departmentList.forEach(item -> {
-            PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getDepartId());
+            PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getId());
             if(en == null) {
                 en = new PartsDepartment();
-                en.setDepartId(item.getDepartId());
+                en.setDepartId(item.getId());
                 en.setPartsId(partsInfo.getPartsId());
                 partsDepartments.add(en);
             }
-            PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getDepartId());
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString());
             if(stream == null) {
-                stream = new PermissionStream();
-                stream.setDepartId(item.getDepartId());
-                stream.setProductId(partsInfo.getProductId());
-                stream.setComponentId(partsInfo.getComponentId());
-                stream.setPartsId(partsInfo.getPartsId());
+                stream = new PermissionStreamNew();
+                stream.setDepartId(item.getId());
+                stream.setBusinessId(partsInfo.getPartsId());
+                stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString());
                 permissionStreamList.add(stream);
             }
         });
@@ -406,7 +377,7 @@
             }
         }
         if(!permissionStreamList.isEmpty()) {
-            boolean b = permissionStreamService.saveBatch(permissionStreamList);
+            boolean b = permissionStreamNewService.saveBatch(permissionStreamList);
             if(!b) {
                 ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
             }
@@ -416,17 +387,17 @@
 
     @Override
     @Transactional(rollbackFor = {Exception.class})
-    public boolean assignRemoveDepart(PartsInfo partsInfo, Collection<Department> departmentList) {
+    public boolean assignRemoveDepart(PartsInfo partsInfo, Collection<MdcProduction> departmentList) {
         if(partsInfo == null || departmentList == null || departmentList.isEmpty())
             ExceptionCast.cast(CommonCode.INVALID_PARAM);
         List<PartsDepartment> partsDepartments = new ArrayList<>();
-        List<PermissionStream> permissionStreamList = new ArrayList<>();
+        List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
         departmentList.forEach(item -> {
-            PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getDepartId());
+            PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getId());
             if(en != null) {
                 partsDepartments.add(en);
             }
-            PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getDepartId());
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString());
             if(stream != null) {
                 permissionStreamList.add(stream);
             }
@@ -438,7 +409,7 @@
             }
         }
         if(!permissionStreamList.isEmpty()) {
-            boolean b = permissionStreamService.removeByCollection(permissionStreamList);
+            boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList);
             if(!b) {
                 ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR);
             }
@@ -478,4 +449,69 @@
         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 (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PARTS.getCode())){
+            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(DocAttributionTypeEnum.PARTS.getCode());
+            docInfos=docInfoService.findListByDocQuery(docQuery);
+        }
+        if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PARTS.getCode())){
+            List<String> id =new ArrayList<>();
+            id.add(treeInfoRequest.getAttributionId());
+            treeInfoRequest.setPartsIds(id);
+            //宸ヨ壓瑙勭▼鐗堟湰
+            List<DocInfo> processSpecVersions = processSpecVersionService.getByProcessSpecVersion(treeInfoRequest);
+            docInfos.addAll(processSpecVersions);
+            //宸ュ簭
+            List<DocInfo> processStreams = processStreamService.getByProcessStreamOtherFile(treeInfoRequest);
+            docInfos.addAll(processStreams);
+            //宸ユ
+            List<DocInfo> workSteps = workStepService.getByWorkStepOtherFile(treeInfoRequest);
+            docInfos.addAll(workSteps);
+        }
+        return docInfos;
+    }
+
+    @Override
+    public boolean assignPermission(Object entity, Collection<SysUser> userList, boolean isAdd){
+        if (isAdd) {
+            return assignAddUser((PartsInfo) entity, userList);
+        } else {
+            return assignRemoveUser((PartsInfo) entity, userList);
+        }
+    }
+    @Override
+    public boolean assignDepartPermission(Object entity, Collection<MdcProduction> departments, boolean isAdd) {
+        if (isAdd) {
+            return assignAddDepart((PartsInfo) entity, departments);
+        } else {
+            return assignRemoveDepart((PartsInfo) entity, departments);
+        }
+    }
 }

--
Gitblit v1.9.3