From c9cc74fad46adaa4bc448cba673e830baf705fce Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期二, 24 六月 2025 17:40:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataImportService.java |  199 +++++++------------------------------------------
 1 files changed, 29 insertions(+), 170 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataImportService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataImportService.java
index b8649bd..c91c587 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataImportService.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DataImportService.java
@@ -1,14 +1,10 @@
 package org.jeecg.modules.dnc.service.impl;
 
-import cn.hutool.core.util.StrUtil;
 import com.jeecg.weibo.exception.BusinessException;
 import org.jeecg.modules.dnc.dto.ComponentHierarchy;
 import org.jeecg.modules.dnc.dto.TransferPackage;
 import org.jeecg.modules.dnc.entity.*;
 import org.jeecg.modules.dnc.mapper.*;
-import org.jeecg.modules.dnc.service.*;
-import org.jeecg.modules.system.service.IMdcProductionService;
-import org.jeecg.modules.system.service.ISysUserService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -68,48 +64,6 @@
     @Autowired
     private GuideCardBatchMapper guideCardBatchMapper;
 
-    @Autowired
-    private ISysUserService sysUserService;
-
-    @Autowired
-    private IMdcProductionService mdcProductionService;
-
-    @Autowired
-    private IProductPermissionService productPermissionService;
-
-    @Autowired
-    private IProductDepartmentService productDepartmentService;
-
-    @Autowired
-    private IComponentPermissionService componentPermissionService;
-
-    @Autowired
-    private IComponentDepartmentService componentDepartmentService;
-
-    @Autowired
-    private IPartsPermissionService partsPermissionService;
-
-    @Autowired
-    private IPartsDepartmentService partsDepartmentService;
-
-    @Autowired
-    private IProcessSpecVersionPermissionService processSpecVersionPermissionService;
-
-    @Autowired
-    private IProcessSpecVersionDepartmentService processSpecVersionDepartmentService;
-
-    @Autowired
-    private IProcessStreamPermissionService processStreamPermissionService;
-
-    @Autowired
-    private IProcessionDepartmentService processionDepartmentService;
-
-    @Autowired
-    private IWorkStepPermissionService workStepPermissionService;
-
-    @Autowired
-    private IWorkStepDepartmentService workStepDepartmentService;
-
     @Transactional(rollbackFor = Exception.class)
     public void importTransferPackage(TransferPackage transferPackage) {
         try {
@@ -155,12 +109,6 @@
             if (transferPackage.getTraceChain() != null&&
                     transferPackage.getTraceChain().getTreePath() != null) {
                 saveTreePath(transferPackage.getTraceChain().getTreePath());
-            }
-
-            //淇濆瓨鏉冮檺
-            if (transferPackage.getTraceChain() != null&&
-                    transferPackage.getTraceChain().getPermissionStreamNewList() != null) {
-                savePermissionStreamNewList(transferPackage.getTraceChain().getPermissionStreamNewList());
             }
 
             // 淇濆瓨璁惧绫�
@@ -222,7 +170,8 @@
             productMapper.insert(product);
             logger.debug("浜у搧宸蹭繚瀛�: {}", product.getProductId());
         } else {
-            logger.debug("浜у搧宸插瓨鍦�: {}", product.getProductId());
+            productMapper.updateById(product);
+            logger.debug("浜у搧宸叉洿鏂�: {}", product.getProductId());
         }
     }
 
@@ -232,7 +181,8 @@
                 componentMapper.insert(component);
                 logger.debug("閮ㄤ欢宸蹭繚瀛�: {}", component.getComponentId());
             } else {
-                logger.debug("閮ㄤ欢宸插瓨鍦�: {}", component.getComponentId());
+                componentMapper.updateById(component);
+                logger.debug("閮ㄤ欢宸叉洿鏂�: {}", component.getComponentId());
             }
         }
     }
@@ -242,7 +192,8 @@
             partsMapper.insert(parts);
             logger.debug("闆朵欢宸蹭繚瀛�: {}", parts.getPartsId());
         } else {
-            logger.debug("闆朵欢宸插瓨鍦�: {}", parts.getPartsId());
+            partsMapper.updateById(parts);
+            logger.debug("闆朵欢宸叉洿鏂�: {}", parts.getPartsId());
         }
     }
 
@@ -251,7 +202,8 @@
             psvMapper.insert(processSpec);
             logger.debug("宸ヨ壓瑙勭▼宸蹭繚瀛�: {}", processSpec.getId());
         } else {
-            logger.debug("宸ヨ壓瑙勭▼宸插瓨鍦�: {}", processSpec.getId());
+            psvMapper.updateById(processSpec);
+            logger.debug("宸ヨ壓瑙勭▼宸叉洿鏂�: {}", processSpec.getId());
         }
     }
 
@@ -260,7 +212,8 @@
             processMapper.insert(process);
             logger.debug("宸ュ簭宸蹭繚瀛�: {}", process.getProcessId());
         } else {
-            logger.debug("宸ュ簭宸插瓨鍦�: {}", process.getProcessId());
+            processMapper.updateById(process);
+            logger.debug("宸ュ簭宸叉洿鏂�: {}", process.getProcessId());
         }
     }
 
@@ -269,7 +222,8 @@
             workStepMapper.insert(workStep);
             logger.debug("宸ユ宸蹭繚瀛�: {}", workStep.getId());
         } else {
-            logger.debug("宸ユ宸插瓨鍦�: {}", workStep.getId());
+            workStepMapper.updateById(workStep);
+            logger.debug("宸ユ宸叉洿鏂�: {}", workStep.getId());
         }
     }
 
@@ -279,113 +233,10 @@
                 productMixMapper.insert(productMix);
                 logger.debug("浜у搧缁勫悎宸蹭繚瀛�: {}", productMix.getId());
             } else {
-                logger.debug("浜у搧缁勫悎宸插瓨鍦�: {}", productMix.getId());
+                productMixMapper.updateById(productMix);
+                logger.debug("浜у搧缁勫悎宸叉洿鏂�: {}", productMix.getId());
             }
         }
-    }
-
-    private void savePermissionStreamNewList(List<PermissionStreamNew> permissionStreamNewList) {
-        for (PermissionStreamNew permissionStreamNew : permissionStreamNewList) {
-            if (permissionStreamNew.getUserId() != null) {
-                String id=sysUserService.getUserByName(permissionStreamNew.getUserId()).getId();
-                if (id!=null){
-                    permissionStreamNew.setUserId(id);
-                }
-            }
-            if (permissionStreamNew.getDepartId() != null) {
-                String id=mdcProductionService.findByOrgCode(permissionStreamNew.getDepartId()).getId();
-                if (id!=null){
-                permissionStreamNew.setDepartId(id);
-                }
-            }
-            permissionStreamNewMapper.insert(permissionStreamNew);
-            logger.debug("鏉冮檺宸蹭繚瀛�: {}", permissionStreamNew.getId());
-        }
-        //鍒嗘壒娣诲姞浜у搧銆侀儴浠躲�侀浂浠躲�佸伐鑹鸿绋嬨�佸伐搴忋�佸伐姝ユ潈闄�
-        permissionStreamNewList.forEach(item -> {
-            switch (item.getBusinessType()){
-                case "1":
-                    if (StrUtil.isNotEmpty(item.getUserId())){
-                        ProductPermission productPermission = new ProductPermission();
-                        productPermission.setProductId(item.getBusinessId());
-                        productPermission.setUserId(item.getUserId());
-                        productPermissionService.save(productPermission);
-                    }else {
-                        ProductDepartment productDepartment = new ProductDepartment();
-                        productDepartment.setProductId(item.getBusinessId());
-                        productDepartment.setDepartId(item.getDepartId());
-                        productDepartmentService.save(productDepartment);
-                    }
-                    break;
-                case "2":
-
-                    if (StrUtil.isNotEmpty(item.getUserId())){
-                        ComponentPermission componentPermission = new ComponentPermission();
-                        componentPermission.setComponentId(item.getBusinessId());
-                        componentPermission.setUserId(item.getUserId());
-                        componentPermissionService.save(componentPermission);
-                    }else {
-                        ComponentDepartment componentDepartment = new ComponentDepartment();
-                        componentDepartment.setComponentId(item.getBusinessId());
-                        componentDepartment.setDepartId(item.getDepartId());
-                        componentDepartmentService.save(componentDepartment);
-                    }
-                    break;
-                case "3":
-                    if (StrUtil.isNotEmpty(item.getUserId())){
-                        PartsPermission partsPermission = new PartsPermission();
-                        partsPermission.setPartsId(item.getBusinessId());
-                        partsPermission.setUserId(item.getUserId());
-                        partsPermissionService.save(partsPermission);
-                    }else {
-                        PartsDepartment partsDepartment = new PartsDepartment();
-                        partsDepartment.setPartsId(item.getBusinessId());
-                        partsDepartment.setDepartId(item.getDepartId());
-                        partsDepartmentService.save(partsDepartment);
-                    }
-                    break;
-                case "4":
-                    if (StrUtil.isNotEmpty(item.getUserId())){
-                        ProcessSpecVersionPermission processSpecVersionPermission = new ProcessSpecVersionPermission();
-                        processSpecVersionPermission.setPsvId(item.getBusinessId());
-                        processSpecVersionPermission.setUserId(item.getUserId());
-                        processSpecVersionPermissionService.save(processSpecVersionPermission);
-                    }else {
-                        ProcessSpecVersionDepartment processSpecVersionDepartment = new ProcessSpecVersionDepartment();
-                        processSpecVersionDepartment.setPsvId(item.getBusinessId());
-                        processSpecVersionDepartment.setDepartId(item.getDepartId());
-                        processSpecVersionDepartmentService.save(processSpecVersionDepartment);
-                    }
-                    break;
-                case "5":
-                    if (StrUtil.isNotEmpty(item.getUserId())){
-                        ProcessionPermission processionPermission = new ProcessionPermission();
-                        processionPermission.setProcessId(item.getBusinessId());
-                        processionPermission.setUserId(item.getUserId());
-                        processStreamPermissionService.save(processionPermission);
-                    }else {
-                        ProcessionDepartment processionDepartment = new ProcessionDepartment();
-                        processionDepartment.setProcessId(item.getBusinessId());
-                        processionDepartment.setDepartId(item.getDepartId());
-                        processionDepartmentService.save(processionDepartment);
-                    }
-                    break;
-                case  "6":
-                    if (StrUtil.isNotEmpty(item.getUserId())){
-                        WorkStepPermission workStepPermission = new WorkStepPermission();
-                        workStepPermission.setStepId(item.getBusinessId());
-                        workStepPermission.setUserId(item.getUserId());
-                        workStepPermissionService.save(workStepPermission);
-                    }else {
-                        WorkStepDepartment workStepDepartment = new WorkStepDepartment();
-                        workStepDepartment.setStepId(item.getBusinessId());
-                        workStepDepartment.setDepartId(item.getDepartId());
-                        workStepDepartmentService.save(workStepDepartment);
-                    }
-                    break;
-                    default:
-            }
-        });
     }
 
     private void saveDeviceManagement(DeviceManagement deviceManagement) {
@@ -393,7 +244,8 @@
             deviceManagementMapper.insert(deviceManagement);
             logger.debug("璁惧绫讳俊鎭凡淇濆瓨: {}", deviceManagement.getId());
         } else {
-            logger.debug("璁惧绫讳俊鎭凡瀛樺湪: {}", deviceManagement.getId());
+            deviceManagementMapper.updateById(deviceManagement);
+            logger.debug("璁惧绫讳俊鎭凡鏇存柊: {}", deviceManagement.getId());
         }
     }
 
@@ -402,7 +254,8 @@
             deviceTypeMapper.insert(deviceType);
             logger.debug("璁惧绫诲凡淇濆瓨: {}", deviceType.getId());
         } else {
-            logger.debug("璁惧绫诲凡瀛樺湪: {}", deviceType.getId());
+            deviceTypeMapper.updateById(deviceType);
+            logger.debug("璁惧绫诲凡鏇存柊: {}", deviceType.getId());
         }
     }
 
@@ -411,7 +264,9 @@
             docInfoMapper.insert(docInfo);
             logger.debug("鏂囨。宸蹭繚瀛�: {}", docInfo.getDocId());
         } else {
-            logger.debug("鏂囨。宸插瓨鍦�: {}", docInfo.getDocId());
+            docInfo.setDocDispatchStatus(5);
+            docInfoMapper.updateById(docInfo);
+            logger.debug("鏂囨。宸叉洿鏂�: {}", docInfo.getDocId());
         }
     }
 
@@ -420,7 +275,8 @@
             docFileMapper.insert(docFile);
             logger.debug("鏂囨。鏂囦欢宸蹭繚瀛�: {}", docFile.getFileId());
         } else {
-            logger.debug("鏂囨。鏂囦欢宸插瓨鍦�: {}", docFile.getFileId());
+            docFileMapper.updateById(docFile);
+            logger.debug("鏂囨。鏂囦欢宸叉洿鏂�: {}", docFile.getFileId());
         }
     }
 
@@ -429,7 +285,8 @@
             docRelativeMapper.insert(docRelative);
             logger.debug("鏂囨。瀵瑰簲鍏崇郴宸蹭繚瀛�: {}", docRelative.getId());
         } else {
-            logger.debug("鏂囨。瀵瑰簲鍏崇郴宸插瓨鍦�: {}", docRelative.getId());
+            docRelativeMapper.updateById(docRelative);
+            logger.debug("鏂囨。瀵瑰簲鍏崇郴宸叉洿鏂�: {}", docRelative.getId());
         }
     }
 
@@ -440,6 +297,7 @@
                 logger.debug("鍒�鍏峰凡淇濆瓨: {}", cutter.getId());
             } else {
                 cutterMapper.updateById(cutter);
+                logger.debug("鍒�鍏峰凡鏇存柊: {}", cutter.getId());
             }
         }
     }
@@ -447,9 +305,10 @@
     private void saveGuideCardBatch(GuideCardBatch guideCardBatch) {
         if (guideCardBatchMapper.selectById(guideCardBatch.getId()) == null) {
             guideCardBatchMapper.insert(guideCardBatch);
-            logger.debug("鍒�鐗囨壒娆″凡淇濆瓨: {}", guideCardBatch.getId());
+            logger.debug("绋嬪簭鍔犲伐纭琛ㄥ凡淇濆瓨: {}", guideCardBatch.getId());
         } else {
-            logger.debug("鍒�鐗囨壒娆″凡瀛樺湪: {}", guideCardBatch.getId());
+            guideCardBatchMapper.updateById(guideCardBatch);
+            logger.debug("绋嬪簭鍔犲伐纭琛ㄥ凡鏇存柊: {}", guideCardBatch.getId());
         }
     }
 }

--
Gitblit v1.9.3