From d88a0a8d9d8cd11cea0f7c7df17fcaa01da85510 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期二, 09 十二月 2025 18:35:20 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/haizhentong
---
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TCrmBranchServiceImpl.java | 68 +++++++++++++++++++++++++---------
1 files changed, 50 insertions(+), 18 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..48bb8df 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
@@ -81,6 +81,22 @@
List<String> branchIds = crmBranchAreas.stream().map(TCrmBranchArea::getBranchId).collect(Collectors.toList());
query.setBranchIds(branchIds);
}
+
+ if(query.getRoleType() == 2){
+ // 查询分公司账号
+ TCrmBranch crmBranch = this.getOne(Wrappers.lambdaQuery(TCrmBranch.class)
+ .eq(TCrmBranch::getUserId, query.getUserId())
+ .eq(TCrmBranch::getStatus, 1)
+ .last("LIMIT 1"));
+ List<TCrmBranch> crmBranches = this.list(Wrappers.lambdaQuery(TCrmBranch.class)
+ .eq(TCrmBranch::getProvinceBranchId, crmBranch.getId()));
+ if(CollectionUtils.isEmpty(crmBranches)){
+ return pageInfo;
+ }
+ List<String> branchIds = crmBranches.stream().map(TCrmBranch::getId).collect(Collectors.toList());
+ query.setBranchIdList(branchIds);
+ }
+
List<TCrmBranchVO> list = this.baseMapper.pageList(query,pageInfo);
if(CollectionUtils.isEmpty(list)){
return pageInfo;
@@ -130,6 +146,7 @@
if(!CollectionUtils.isEmpty(branchAreaCityCodes)){
long count = crmBranchAreaService.count(Wrappers.lambdaQuery(TCrmBranchArea.class)
.in(TCrmBranchArea::getCityCode, branchAreaCityCodes)
+ .eq(TCrmBranchArea::getPersonType,dto.getPersonType())
.eq(TCrmBranchArea::getAreaType,1));
if(count > 0){
return R.fail("负责区域已存在");
@@ -157,17 +174,24 @@
}
this.save(dto);
- // 添加区域
- for (TCrmBranchArea branchArea : branchAreas) {
- branchArea.setBranchId(dto.getId());
- branchArea.setAreaType(2);
+ List<TCrmBranchArea> allAreas = new ArrayList<>();
+ if(dto.getPersonType() != 3){
+ for (TCrmBranchArea responsibleBranchArea : responsibleBranchAreas) {
+ responsibleBranchArea.setBranchId(dto.getId());
+ responsibleBranchArea.setAreaType(1);
+ responsibleBranchArea.setPersonType(dto.getPersonType());
+ }
+ allAreas.addAll(responsibleBranchAreas);
}
- for (TCrmBranchArea responsibleBranchArea : responsibleBranchAreas) {
- responsibleBranchArea.setBranchId(dto.getId());
- responsibleBranchArea.setAreaType(1);
+ if(dto.getPersonType() != 1){
+ // 添加区域
+ for (TCrmBranchArea branchArea : branchAreas) {
+ branchArea.setBranchId(dto.getId());
+ branchArea.setAreaType(2);
+ }
+ allAreas.addAll(branchAreas);
}
- branchAreas.addAll(responsibleBranchAreas);
- crmBranchAreaService.saveBatch(branchAreas);
+ crmBranchAreaService.saveBatch(allAreas);
// 添加职位薪资
List<TCrmBranchSalary> branchSalaries = dto.getBranchSalaries();
branchSalaries.forEach(t -> t.setBranchId(dto.getId()));
@@ -225,6 +249,7 @@
long count = crmBranchAreaService.count(Wrappers.lambdaQuery(TCrmBranchArea.class)
.in(TCrmBranchArea::getCityCode, branchAreaCityCodes)
.eq(TCrmBranchArea::getAreaType,1)
+ .eq(TCrmBranchArea::getPersonType,dto.getPersonType())
.ne(TCrmBranchArea::getBranchId, dto.getId()));
if(count > 0){
return R.fail("负责区域已存在");
@@ -235,17 +260,24 @@
// 删除区域
crmBranchAreaService.remove(Wrappers.lambdaQuery(TCrmBranchArea.class).eq(TCrmBranchArea::getBranchId, dto.getId()));
// 添加区域
- // 添加区域
- for (TCrmBranchArea branchArea : branchAreas) {
- branchArea.setBranchId(dto.getId());
- branchArea.setAreaType(2);
+ List<TCrmBranchArea> allAreas = new ArrayList<>();
+ if(dto.getPersonType() != 3){
+ for (TCrmBranchArea responsibleBranchArea : responsibleBranchAreas) {
+ responsibleBranchArea.setBranchId(dto.getId());
+ responsibleBranchArea.setAreaType(1);
+ responsibleBranchArea.setPersonType(dto.getPersonType());
+ }
+ allAreas.addAll(responsibleBranchAreas);
}
- for (TCrmBranchArea responsibleBranchArea : responsibleBranchAreas) {
- responsibleBranchArea.setBranchId(dto.getId());
- responsibleBranchArea.setAreaType(1);
+ if(dto.getPersonType() != 1){
+ // 添加区域
+ for (TCrmBranchArea branchArea : branchAreas) {
+ branchArea.setBranchId(dto.getId());
+ branchArea.setAreaType(2);
+ }
+ allAreas.addAll(branchAreas);
}
- branchAreas.addAll(responsibleBranchAreas);
- crmBranchAreaService.saveBatch(branchAreas);
+ crmBranchAreaService.saveBatch(allAreas);
// 删除职位薪资
crmBranchSalaryService.remove(Wrappers.lambdaQuery(TCrmBranchSalary.class).eq(TCrmBranchSalary::getBranchId, dto.getId()));
// 添加职位薪资
--
Gitblit v1.7.1