From c06fab29ca7826a6dc9736c1ba8ce1e26a11c829 Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期四, 06 三月 2025 15:57:08 +0800
Subject: [PATCH] 新增层级结构工艺规程版本、结构树表、新权限表 修改原有权限验证 删除原有代码

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java |   48 ++++++++++--------------------------------------
 1 files changed, 10 insertions(+), 38 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java
index bb59e16..4f6f295 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java
@@ -20,6 +20,7 @@
 import org.jeecg.modules.mdc.service.IMdcProductionEquipmentService;
 import org.jeecg.modules.system.entity.MdcProduction;
 import org.jeecg.modules.system.entity.MdcProductionEquipment;
+import org.jeecg.modules.system.entity.MdcUserProduction;
 import org.jeecg.modules.system.entity.SysUser;
 import org.jeecg.modules.system.service.IMdcProductionService;
 import org.jeecg.modules.system.service.IMdcUserProductionService;
@@ -62,8 +63,6 @@
     @Lazy
     private IProductInfoService productInfoService;
     @Autowired
-    private INcLogInfoService iNcLogInfoService;
-    @Autowired
     private IMdcProductionService mdcProductionService;
     @Autowired
     private IMdcEquipmentService mdcEquipmentService;
@@ -99,15 +98,6 @@
         if(group == null) {
             ExceptionCast.cast(DeviceCode.DEVICE_GROUP_NONE);
         }
-        //娣诲姞鏃ュ織
-        NcLogInfo ncLogInfo = new NcLogInfo();
-        //妯″潡
-        ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�");
-        //绫诲瀷
-        ncLogInfo.setOperateType(2);
-        //鏃ュ織鍐呭
-        ncLogInfo.setLogContent("璁惧鍚嶇О锛�"+deviceInfo.getDeviceName()+"锛岃澶囩紪鍙凤細"+deviceInfo.getDeviceNo());
-        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
         boolean b = super.save(deviceInfo);
         if(!b) {
             ExceptionCast.cast(DeviceCode.DEVICE_SAVE_ERROR);
@@ -150,17 +140,6 @@
             ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST);
         deviceInfo.setDeviceId(id);
         deviceInfo.setGroupId(null);
-        //娣诲姞鏃ュ織
-        NcLogInfo ncLogInfo = new NcLogInfo();
-        //妯″潡
-        ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�");
-        //绫诲瀷
-        ncLogInfo.setOperateType(3);
-        //鏃ュ織鍐呭
-        ncLogInfo.setLogContent("璁惧鍚嶇О锛�"+deviceInfo.getDeviceName());
-        //淇敼淇濆瓨澶囨敞
-        ncLogInfo.setRemark(JSONObject.toJSONString(en));
-        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
         return super.updateById(deviceInfo);
     }
 
@@ -184,15 +163,6 @@
         b = devicePermissionStreamService.deleteDepartByDeviceId(en.getGroupId(), en.getDeviceId());
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        //娣诲姞鏃ュ織
-        NcLogInfo ncLogInfo = new NcLogInfo();
-        //妯″潡
-        ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�");
-        //绫诲瀷
-        ncLogInfo.setOperateType(4);
-        //鏃ュ織鍐呭
-        ncLogInfo.setLogContent("璁惧鍚嶇О锛�"+en.getDeviceName());
-        iNcLogInfoService.saveLogNcInfos(ncLogInfo);
         return super.removeById(en.getDeviceId());
     }
 
@@ -227,8 +197,8 @@
             if(mdcProduction == null) {
                 ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST);
             }
-            DeviceGroupPermission permission = deviceGroupPermissionService.getByUserIdAndGroupId(userId, mdcProduction.getId());
-            if(permission == null)
+            MdcUserProduction mdcUserProduction=mdcUserProductionService.getByUserIdAndGroupId(userId,mdcProduction.getId());
+            if(mdcUserProduction == null)
                 return false;
             return true;
         }else if(nodeType == 2) {
@@ -298,14 +268,14 @@
                 ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
             }
             //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁�
-            List<MdcProduction> childrenList = mdcProductionService.queryProdByPid(mdcProduction.getId());
+            List<MdcProduction> childrenList = mdcProductionService.recursionChildrenByPid(mdcProduction.getId());
             List<String> childrenIds = new ArrayList<>();
             if(childrenList != null && !childrenList.isEmpty()) {
                 childrenList.forEach(item -> {
                     childrenIds.add(item.getId());
                     boolean b = checkDevicePerm(1, item.getId());
                     if(b) {
-                        b = deviceGroupPermissionService.assignAddUser(mdcProduction, userList);
+                        b = deviceGroupPermissionService.assignAddUser(item, userList);
                         if(!b) {
                             ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
                         }
@@ -368,6 +338,8 @@
     @Override
     @Transactional(rollbackFor = {Exception.class})
     public boolean assignAddUser(MdcEquipment mdcEquipment, Collection<SysUser> userList) {
+
+
         if(mdcEquipment == null || userList == null || userList.isEmpty())
             ExceptionCast.cast(CommonCode.INVALID_PARAM);
         MdcProductionEquipment mdcProductionEquipment=mdcProductionEquipmentService
@@ -386,7 +358,7 @@
             if(stream == null) {
                 stream = new DevicePermissionStream();
                 stream.setUserId(item.getId());
-                stream.setGroupId(mdcProductionEquipment.getId());
+                stream.setGroupId(mdcProductionEquipment.getProductionId());
                 stream.setDeviceId(mdcEquipment.getId());
                 permissionStreamList.add(stream);
             }
@@ -488,14 +460,14 @@
                 ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
             }
             //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁�
-            List<MdcProduction> childrenList = mdcProductionService.queryProdByPid(mdcProduction.getId());
+            List<MdcProduction> childrenList = mdcProductionService.recursionChildrenByPid(mdcProduction.getId());
             List<String> childrenIds = new ArrayList<>();
             if(childrenList != null && !childrenList.isEmpty()) {
                 childrenList.forEach(item -> {
                     childrenIds.add(item.getId());
                     boolean b = checkDevicePerm(1, item.getId());
                     if(b) {
-                        b = deviceGroupPermissionService.assignRemoveUser(mdcProduction, userList);
+                        b = deviceGroupPermissionService.assignRemoveUser(item, userList);
                         if(!b) {
                             ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR);
                         }

--
Gitblit v1.9.3