From 1930b4e59d60c015ffa7bfee92e4bc227b90dcb3 Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期三, 28 五月 2025 15:41:41 +0800
Subject: [PATCH] 1.Dnc产品结构树检索nc文件 2.新增批次功能 3.新增审签查询流程 4.修改刀具系统查询

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java |   45 +++++++++++++++++++++++----------------------
 1 files changed, 23 insertions(+), 22 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 33580e8..db7ebac 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
@@ -9,6 +9,7 @@
 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;
@@ -83,7 +84,7 @@
             ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE);
         partsInfo.setPartsStatus(1);
         boolean b = super.save(partsInfo);
-        List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1");
+        List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1");
         if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) {
             List<PartsDepartment> partsDepartmentList = new ArrayList<>();
             List<PermissionStreamNew> permissionStreamList = new ArrayList<>();
@@ -95,7 +96,7 @@
                 PermissionStreamNew perm = new PermissionStreamNew();
                 perm.setDepartId(item.getDepartId());
                 perm.setBusinessId(partsInfo.getPartsId());
-                perm.setBusinessType("3");
+                perm.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString());
                 permissionStreamList.add(perm);
             });
             if(!partsDepartmentList.isEmpty()) {
@@ -111,18 +112,18 @@
         }
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        b = productPermissionService.add(partsInfo.getPartsId(), userId,"3");
+        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(),3,new Date());
+                ,partsInfo.getPartsName(),partsInfo.getPartsCode(),DocAttributionTypeEnum.PARTS.getCode(),new Date());
         productMixService.save(productMix);
         //娣诲姞鐢ㄦ埛鏉冮檺
         PermissionStreamNew stream = new PermissionStreamNew();
         stream.setBusinessId(partsInfo.getPartsId());
-        stream.setBusinessType("3");
+        stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString());
         stream.setUserId(userId);
         return permissionStreamNewService.addPermissionStreamNew(stream);
     }
@@ -160,11 +161,11 @@
             if(!b)
                 return false;
         }
-        PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId( id, userId,"3");
+        PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId( id, userId,DocAttributionTypeEnum.PARTS.getCode().toString());
         if(stream == null) {
             stream = new PermissionStreamNew();
             stream.setBusinessId(id);
-            stream.setBusinessType("3");
+            stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString());
             stream.setUserId(userId);
             return permissionStreamNewService.save(stream);
         }
@@ -222,10 +223,10 @@
             b = partsDepartmentService.deleteByPartsId(item.getPartsId());
             if(!b)
                 ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR);
-            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),"3","0");
+            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),DocAttributionTypeEnum.PARTS.getCode().toString(),"0");
             if(!b)
                 ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR);
-            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),"3","1");
+            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),DocAttributionTypeEnum.PARTS.getCode().toString(),"1");
             if(!b)
                 ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR);
             b = super.removeById(item.getPartsId());
@@ -248,7 +249,7 @@
             ExceptionCast.cast(PartsInfoCode.PARTS_PROCESS_EXIST);
         boolean b = partsPermissionService.deleteByPartsId(partsInfo.getPartsId());
         //楠岃瘉鏄惁瀛樺湪鏂囨。
-        List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type","3").eq("attribution_id",partsId));
+        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);
         }
@@ -257,10 +258,10 @@
         b = partsDepartmentService.deleteByPartsId(partsInfo.getPartsId());
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,"3","0");
+        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,DocAttributionTypeEnum.PARTS.getCode().toString(),"0");
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,"3","1");
+        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,DocAttributionTypeEnum.PARTS.getCode().toString(),"1");
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
         b = productMixService.removeById(partsId);
@@ -284,12 +285,12 @@
                 en.setPartsId(partsInfo.getPartsId());
                 permissionList.add(en);
             }
-            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),"3");
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString());
             if(stream == null) {
                 stream = new PermissionStreamNew();
                 stream.setUserId(item.getId());
                 stream.setBusinessId(partsInfo.getPartsId());
-                stream.setBusinessType("3");
+                stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString());
                 permissionStreamList.add(stream);
             }
         });
@@ -320,7 +321,7 @@
             if(en != null) {
                 permissionList.add(en);
             }
-            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),"3");
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString());
             if(stream != null) {
                 permissionStreamList.add(stream);
             }
@@ -356,12 +357,12 @@
                 en.setPartsId(partsInfo.getPartsId());
                 partsDepartments.add(en);
             }
-            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),"3");
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString());
             if(stream == null) {
                 stream = new PermissionStreamNew();
                 stream.setDepartId(item.getId());
                 stream.setBusinessId(partsInfo.getPartsId());
-                stream.setBusinessType("3");
+                stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString());
                 permissionStreamList.add(stream);
             }
         });
@@ -392,7 +393,7 @@
             if(en != null) {
                 partsDepartments.add(en);
             }
-            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),"3");
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString());
             if(stream != null) {
                 permissionStreamList.add(stream);
             }
@@ -458,7 +459,7 @@
         if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) {
             queryWrapper.in(PartsInfo::getComponentId, treeInfoRequest.getComponentIds());
         }
-        if (treeInfoRequest.getAttributionType()==3){
+        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());
@@ -473,12 +474,12 @@
             BeanUtil.copyProperties(treeInfoRequest,docQuery);
             docQuery.setAttributionIds(ids);
             docQuery.setDocClassCode("OTHER");
-            docQuery.setAttributionType(3);
+            docQuery.setAttributionType(DocAttributionTypeEnum.PARTS.getCode());
             docInfos=docInfoService.findListByDocQuery(docQuery);
         }
-        if (treeInfoRequest.getAttributionType()==3){
+        if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PARTS.getCode())){
             List<String> id =new ArrayList<>();
-            id.add(treeInfoRequest.getAttributionIds());
+            id.add(treeInfoRequest.getAttributionId());
             treeInfoRequest.setPartsIds(id);
             List<DocInfo> processSpecVersions = processSpecVersionService.getByProcessSpecVersion(treeInfoRequest);
             docInfos.addAll(processSpecVersions);

--
Gitblit v1.9.3