From 15390be24bf324886bc82eb289268070e5221310 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期一, 08 十二月 2025 17:13:37 +0800
Subject: [PATCH] bug修改

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmBranchServiceImpl.java |   32 ++++++++++++++++++--------------
 1 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmBranchServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmBranchServiceImpl.java
index 342aef2..fd879c7 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmBranchServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmBranchServiceImpl.java
@@ -157,17 +157,19 @@
         }
 
         this.save(dto);
-        // 添加区域
-        for (TCrmBranchArea branchArea : branchAreas) {
-            branchArea.setBranchId(dto.getId());
-            branchArea.setAreaType(2);
-        }
         for (TCrmBranchArea responsibleBranchArea : responsibleBranchAreas) {
             responsibleBranchArea.setBranchId(dto.getId());
             responsibleBranchArea.setAreaType(1);
         }
-        branchAreas.addAll(responsibleBranchAreas);
-        crmBranchAreaService.saveBatch(branchAreas);
+        if(dto.getPersonType() != 1){
+            // 添加区域
+            for (TCrmBranchArea branchArea : branchAreas) {
+                branchArea.setBranchId(dto.getId());
+                branchArea.setAreaType(2);
+            }
+            responsibleBranchAreas.addAll(branchAreas);
+        }
+        crmBranchAreaService.saveBatch(responsibleBranchAreas);
         // 添加职位薪资
         List<TCrmBranchSalary> branchSalaries = dto.getBranchSalaries();
         branchSalaries.forEach(t -> t.setBranchId(dto.getId()));
@@ -235,17 +237,19 @@
         // 删除区域
         crmBranchAreaService.remove(Wrappers.lambdaQuery(TCrmBranchArea.class).eq(TCrmBranchArea::getBranchId, dto.getId()));
         // 添加区域
-        // 添加区域
-        for (TCrmBranchArea branchArea : branchAreas) {
-            branchArea.setBranchId(dto.getId());
-            branchArea.setAreaType(2);
-        }
         for (TCrmBranchArea responsibleBranchArea : responsibleBranchAreas) {
             responsibleBranchArea.setBranchId(dto.getId());
             responsibleBranchArea.setAreaType(1);
         }
-        branchAreas.addAll(responsibleBranchAreas);
-        crmBranchAreaService.saveBatch(branchAreas);
+        if(dto.getPersonType() != 1){
+            // 添加区域
+            for (TCrmBranchArea branchArea : branchAreas) {
+                branchArea.setBranchId(dto.getId());
+                branchArea.setAreaType(2);
+            }
+            responsibleBranchAreas.addAll(branchAreas);
+        }
+        crmBranchAreaService.saveBatch(responsibleBranchAreas);
         // 删除职位薪资
         crmBranchSalaryService.remove(Wrappers.lambdaQuery(TCrmBranchSalary.class).eq(TCrmBranchSalary::getBranchId, dto.getId()));
         // 添加职位薪资

--
Gitblit v1.7.1