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/ComponentInfoSeServiceImpl.java |   39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 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 96d8f04..511a5c5 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
@@ -11,6 +11,7 @@
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum;
 import org.jeecg.modules.dnc.dto.ComponentExt;
 import org.jeecg.modules.dnc.entity.*;
 import org.jeecg.modules.dnc.exception.ExceptionCast;
@@ -89,10 +90,10 @@
             if(en == null) {
                 ExceptionCast.cast(ComponentInfoCode.COMPONENT_PARENT_NOT_EXIST);
             }
-            oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(en.getComponentId(),"2","1");
+            oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(en.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1");
             componentInfo.setRankLevel(en.getRankLevel() + 1);
         } else {
-            oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(productInfo.getProductId(),"1","1");
+            oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(productInfo.getProductId(),DocAttributionTypeEnum.PRODUCT.getCode().toString(),"1");
             componentInfo.setParentId(null);
             componentInfo.setRankLevel(1);
         }
@@ -113,7 +114,7 @@
                 PermissionStreamNew permissionStream = new PermissionStreamNew();
                 permissionStream.setBusinessId(componentInfo.getComponentId());
                 permissionStream.setDepartId(item.getDepartId());
-                permissionStream.setBusinessType("2");
+                permissionStream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
                 componentDepartPermList.add(permissionStream);
             });
         }
@@ -127,7 +128,7 @@
             if(!b)
                 ExceptionCast.cast(CommonCode.FAIL);
         }
-        b = productPermissionService.add(componentInfo.getComponentId(), userId,"2");
+        b = productPermissionService.add(componentInfo.getComponentId(), userId,DocAttributionTypeEnum.COMPONENT.getCode().toString());
         if (!b) {
             ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR);
         }
@@ -145,7 +146,7 @@
         if (StrUtil.isNotEmpty(componentInfo.getBorrowId())){
             //鍊熺敤閮ㄤ欢,鍚屾娣诲姞鏂囦欢
             List<DocRelative> docRelativeList=docRelativeService.
-                    list(new QueryWrapper<DocRelative>().eq("attribution_type","2").eq("attribution_id",componentInfo.getBorrowId()));
+                    list(new QueryWrapper<DocRelative>().eq("attribution_type",DocAttributionTypeEnum.COMPONENT.getCode().toString()).eq("attribution_id",componentInfo.getBorrowId()));
             if (!docRelativeList.isEmpty()){
                 docRelativeList.forEach(item -> {
                     DocRelative docRelative = new DocRelative();
@@ -160,7 +161,7 @@
         PermissionStreamNew stream = new PermissionStreamNew();
         stream.setUserId(userId);
         stream.setBusinessId(componentInfo.getComponentId());
-        stream.setBusinessType("2");
+        stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
         return permissionStreamNewService.addPermissionStreamNew(stream);
     }
 
@@ -200,12 +201,12 @@
             if(!b)
                 return false;
         }
-        PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,"2");
+        PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,DocAttributionTypeEnum.COMPONENT.getCode().toString());
         if(stream == null) {
             stream = new PermissionStreamNew();
             stream.setUserId(userId);
             stream.setBusinessId(id);
-            stream.setBusinessType("2");
+            stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
             return permissionStreamNewService.save(stream);
         }
         List<ComponentInfo> list = super.lambdaQuery().eq(ComponentInfo::getBorrowId,id).list();
@@ -265,10 +266,10 @@
             b = componentDepartmentService.deleteByComponentId(item.getComponentId());
             if(!b)
                 ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE);
-            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),"2","0");
+            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"0");
             if(!b)
                 ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE);
-            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),"2","1");
+            b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1");
             if(!b)
                 ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE);
             b = super.removeById(item.getComponentId());
@@ -307,7 +308,7 @@
         }
         boolean b;
         //楠岃瘉鏄惁瀛樺湪鏂囨。
-        List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type","2").eq("attribution_id",id));
+        List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type",DocAttributionTypeEnum.COMPONENT.getCode().toString()).eq("attribution_id",id));
         if (!docRelativeList.isEmpty()){
             ExceptionCast.cast(ComponentInfoCode.COMPONENT_DOC_EXIST);
         }
@@ -317,10 +318,10 @@
         b = componentDepartmentService.deleteByComponentId(id);
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","0");
+        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"0");
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1");
+        b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1");
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
         b = productMixService.removeById(id);
@@ -361,7 +362,7 @@
                 stream = new PermissionStreamNew();
                 stream.setUserId(item.getId());
                 stream.setBusinessId(componentInfo.getComponentId());
-                stream.setBusinessType("2");
+                stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
                 permissionStreamList.add(stream);
             }
         });
@@ -431,12 +432,12 @@
                 en.setComponentId(componentInfo.getComponentId());
                 componentDepartments.add(en);
             }
-            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),"2");
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),DocAttributionTypeEnum.COMPONENT.getCode().toString());
             if(stream == null) {
                 stream = new PermissionStreamNew();
                 stream.setDepartId(item.getId());
                 stream.setBusinessId(componentInfo.getComponentId());
-                stream.setBusinessType("2");
+                stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString());
                 permissionStreamList.add(stream);
             }
         });
@@ -467,7 +468,7 @@
             if(en != null) {
                 componentDepartments.add(en);
             }
-            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),"2");
+            PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),DocAttributionTypeEnum.COMPONENT.getCode().toString());
             if(stream != null) {
                 permissionStreamList.add(stream);
             }
@@ -613,7 +614,7 @@
         if (productIds != null && !productIds.isEmpty()) {
             List<String> productIdList = Arrays.asList(productIds.split(","));
             List<ProductMix> productMixList = permissionStreamNewService.
-                    loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),"2");
+                    loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString());
             List<Long> ids = productMixList.stream().map(ProductMix::getId).collect(Collectors.toList());
             //鑾峰彇宸茬粡鑷韩琚�熺敤鐨勯儴浠�
             LambdaQueryWrapper<ComponentInfo> borrowQueryWrapper = new LambdaQueryWrapper<>();
@@ -651,7 +652,7 @@
         List<String> productIdList = Arrays.asList(loginUser.getProductionIds().split(","));
         //鑾峰彇鍙互鍊熺敤鐨勯儴浠�
         List<ProductMix> productMixList = permissionStreamNewService.
-                loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),"2");
+                loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString());
         Set<Long> allowedIds = productMixList.stream()
                 .map(ProductMix::getId)
                 .collect(Collectors.toCollection(HashSet::new));

--
Gitblit v1.9.3