From 42e68faca0756d44b7c880c9876810ee47d6e92b Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期一, 17 二月 2025 17:57:25 +0800
Subject: [PATCH] 1.DNC模块,设备结构树权限分配优化与修改bug 2.MDC模块,设备编辑车间同步平移设备send目录 3.优化原有指派设备代码

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

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
index 39fc70b..66a807d 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -25,6 +25,7 @@
 import org.jeecg.modules.mdc.model.MdcEquipmentTree;
 import org.jeecg.modules.mdc.service.*;
 import org.jeecg.modules.mdc.util.DateUtils;
+import org.jeecg.modules.mdc.util.DncCopyEquipment;
 import org.jeecg.modules.mdc.util.FindsEquipmentDepartUtil;
 import org.jeecg.modules.mdc.util.FindsEquipmentProductionUtil;
 import org.jeecg.modules.mdc.vo.*;
@@ -34,14 +35,19 @@
 import org.jeecg.modules.system.mapper.MdcProductionEquipmentMapper;
 import org.jeecg.modules.system.service.*;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.io.File;
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
 import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -99,6 +105,9 @@
 
     @Resource
     private DncDevicePermissionMapper dncDevicePermissionMapper;
+
+    @Value("${fileNCPath}")
+    private String fileNCPath;
 
 
     @Override
@@ -194,6 +203,14 @@
                     break;
             }
         }
+        //骞崇Щ璁惧鐩綍涓嬬幇鏈夌粨鏋勪笌鏂囦欢
+        //鑾峰彇鍘熸湁缁撴瀯
+        String OldPath="";
+        String NewPath="";
+        List<String> OldStrings=mdcProductionService.findListParentTreeAll(mdcEquipment.getId());
+        if (OldStrings != null && !OldStrings.isEmpty()) {
+            OldPath = fileNCPath+"/"+StringUtils.join(OldStrings.toArray(), "/")+"/"+mdcEquipment.getEquipmentId();
+        }
         //step.1 淇敼璁惧鍩虹淇℃伅
         this.updateById(mdcEquipment);
         //step.2 淇敼閮ㄩ棬
@@ -226,6 +243,13 @@
                 mdcProductionEquipmentMapper.insert(productionEquipment);
             }
         }
+        List<String> NewStrings = mdcProductionService.findListParentTreeAll(mdcEquipment.getId());
+        if (NewStrings != null && !NewStrings.isEmpty()) {
+            NewPath = fileNCPath+"/"+StringUtils.join(NewStrings.toArray(), "/")+"/"+mdcEquipment.getEquipmentId();
+        }
+        // 骞崇ЩOldPath涓嬬殑鏂囦欢鍒癗ewPath涓�
+        DncCopyEquipment.CopyEquipmentPath(OldPath,NewPath);
+        //淇濆瓨璁惧瀵瑰簲鐨勪骇绾挎潈闄�
         addDevicePermission(mdcEquipment);
         //step.4 淇敼璁惧鏉冮檺
         LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();

--
Gitblit v1.9.3