From acd9401c66728259cedfab97ece5d4d0cf4101d0 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期五, 05 十二月 2025 15:04:51 +0800
Subject: [PATCH] 新增审核判断

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java |   40 ++++++++++++++++++++--------------------
 1 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java
index 023c7f2..89a7375 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java
@@ -615,13 +615,13 @@
         ArrayList<BranchAdminListVO> branchAdminListVOs = new ArrayList<>();
         if (roleType == 2) {
             TCrmBranch branch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class)
-                    .eq(TCrmBranch::getUserId, user.getUserId())
+                    .eq(TCrmBranch::getUserId, user.getUserId()).eq(TCrmBranch::getAuditStatus,2)
                     .last("LIMIT 1"));
             if (branch != null) {
                 // 如果是区
                 if (branch.getPersonType() != null && branch.getPersonType() == 2) {
                     // 区查下面所有城市的公司
-                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3));
+                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3).eq(TCrmBranch::getAuditStatus,2));
 
                     if (!crmBranches.isEmpty()) {
                         for (TCrmBranch crmBranch : crmBranches) {
@@ -636,7 +636,7 @@
                 // 省
                 if (branch.getPersonType() != null && branch.getPersonType() == 1) {
                     // 所有的区 公司
-                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2));
+                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2).eq(TCrmBranch::getAuditStatus,2));
                     if (!crmBranches.isEmpty()) {
                         Set<Long> userIds = crmBranches.stream().map(TCrmBranch::getUserId).collect(Collectors.toSet());
 
@@ -647,7 +647,7 @@
                             branchAdminListVOs.add(branchAdminListVO);
                         }
                         // 城市公司
-                        List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3));
+                        List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3).eq(TCrmBranch::getAuditStatus,2));
                         if (!crmBranchesThree.isEmpty()) {
                             for (TCrmBranch crmBranch : crmBranchesThree) {
                                 BranchAdminListVO branchAdminListVO = new BranchAdminListVO();
@@ -677,7 +677,7 @@
             TCrmBranch branch =null;
             if(branchId==null || branchId.isEmpty()){
                 branch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class)
-                        .eq(TCrmBranch::getUserId, user.getUserId())
+                        .eq(TCrmBranch::getUserId, user.getUserId()).eq(TCrmBranch::getAuditStatus,2)
                         .last("LIMIT 1"));
             }else {
                 branch = crmBranchService.getById(branchId);
@@ -687,7 +687,7 @@
                 // 如果是区
                 if (branch.getPersonType() != null && branch.getPersonType() == 2) {
                     // 区查下面所有城市的公司
-                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3));
+                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3).eq(TCrmBranch::getAuditStatus,2));
 
                     if (!crmBranches.isEmpty()) {
                         for (TCrmBranch crmBranch : crmBranches) {
@@ -702,7 +702,7 @@
                 // 省
                 if (branch.getPersonType() != null && branch.getPersonType() == 1) {
                     // 所有的区 公司
-                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2));
+                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2).eq(TCrmBranch::getAuditStatus,2));
                     if (!crmBranches.isEmpty()) {
                         Set<Long> userIds = crmBranches.stream().map(TCrmBranch::getUserId).collect(Collectors.toSet());
 
@@ -713,7 +713,7 @@
                             branchAdminListVOs.add(branchAdminListVO);
                         }
                         // 城市公司
-                        List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3));
+                        List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3).eq(TCrmBranch::getAuditStatus,2));
                         if (!crmBranchesThree.isEmpty()) {
                             for (TCrmBranch crmBranch : crmBranchesThree) {
                                 BranchAdminListVO branchAdminListVO = new BranchAdminListVO();
@@ -762,7 +762,7 @@
         Integer roleType = user.getRoleType();
         if (roleType == 2) {
             TCrmBranch branch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class)
-                    .eq(TCrmBranch::getUserId, user.getUserId())
+                    .eq(TCrmBranch::getUserId, user.getUserId()).eq(TCrmBranch::getAuditStatus,2)
                     .last("LIMIT 1"));
             if (branch != null) {
                 // 先查自己本身的
@@ -770,7 +770,7 @@
                 // 如果是区
                 if (branch.getPersonType() != null && branch.getPersonType() == 2) {
                     // 区查下面所有城市的公司
-                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3));
+                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3).eq(TCrmBranch::getAuditStatus,2));
                     if (!crmBranches.isEmpty()) {
                         List<String> branchIds = crmBranches.stream().map(TCrmBranch::getId).collect(Collectors.toList());
                         list.addAll(crmClinicService.list(Wrappers.lambdaQuery(TCrmClinic.class).in(TCrmClinic::getBranchId, branchIds).in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5))));
@@ -778,7 +778,7 @@
                 }
 
                 if (branch.getPersonType() != null && branch.getPersonType() == 3) {
-                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2));
+                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2).eq(TCrmBranch::getAuditStatus,2));
                     if (!crmBranches.isEmpty()) {
                         // 区公司
                         List<String> branchIds = crmBranches.stream().map(TCrmBranch::getId).collect(Collectors.toList());
@@ -786,7 +786,7 @@
 
                         Set<Long> userIds = crmBranches.stream().map(TCrmBranch::getUserId).collect(Collectors.toSet());
                         // 城市公司
-                        List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3));
+                        List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3).eq(TCrmBranch::getAuditStatus,2));
                         if (!crmBranchesThree.isEmpty()) {
                             List<String> branchIdsThree = crmBranchesThree.stream().map(TCrmBranch::getId).collect(Collectors.toList());
                             list.addAll(crmClinicService.list(Wrappers.lambdaQuery(TCrmClinic.class).in(TCrmClinic::getBranchId, branchIdsThree).in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5))));
@@ -910,7 +910,7 @@
         Integer roleType = user.getRoleType();
         if (roleType == 2) {
             TCrmBranch branch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class)
-                    .eq(TCrmBranch::getUserId, user.getUserId())
+                    .eq(TCrmBranch::getUserId, user.getUserId()).eq(TCrmBranch::getAuditStatus,2)
                     .last("LIMIT 1"));
             if (branch != null) {
                 // 先查自己本身的
@@ -918,7 +918,7 @@
                 // 如果是区
                 if (branch.getPersonType() != null && branch.getPersonType() == 2) {
                     // 区查下面所有城市的公司
-                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3));
+                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3).eq(TCrmBranch::getAuditStatus,2));
                     if (!crmBranches.isEmpty()) {
                         List<String> branchIds = crmBranches.stream().map(TCrmBranch::getId).collect(Collectors.toList());
                         list.addAll(crmClinicService.list(Wrappers.lambdaQuery(TCrmClinic.class).in(TCrmClinic::getBranchId, branchIds).in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5))));
@@ -926,7 +926,7 @@
                 }
 
                 if (branch.getPersonType() != null && branch.getPersonType() == 3) {
-                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2));
+                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2).eq(TCrmBranch::getAuditStatus,2));
                     if (!crmBranches.isEmpty()) {
                         // 区公司
                         List<String> branchIds = crmBranches.stream().map(TCrmBranch::getId).collect(Collectors.toList());
@@ -934,7 +934,7 @@
 
                         Set<Long> userIds = crmBranches.stream().map(TCrmBranch::getUserId).collect(Collectors.toSet());
                         // 城市公司
-                        List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3));
+                        List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3).eq(TCrmBranch::getAuditStatus,2));
                         if (!crmBranchesThree.isEmpty()) {
                             List<String> branchIdsThree = crmBranchesThree.stream().map(TCrmBranch::getId).collect(Collectors.toList());
                             list.addAll(crmClinicService.list(Wrappers.lambdaQuery(TCrmClinic.class).in(TCrmClinic::getBranchId, branchIdsThree).in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5))));
@@ -1025,7 +1025,7 @@
         Integer roleType = user.getRoleType();
         if (roleType == 2) {
             TCrmBranch branch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class)
-                    .eq(TCrmBranch::getUserId, user.getUserId())
+                    .eq(TCrmBranch::getUserId, user.getUserId()).eq(TCrmBranch::getAuditStatus,2)
                     .last("LIMIT 1"));
             if (branch != null) {
                 // 先查自己本身的
@@ -1033,7 +1033,7 @@
                 // 如果是区
                 if (branch.getPersonType() != null && branch.getPersonType() == 2) {
                     // 区查下面所有城市的公司
-                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3));
+                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3).eq(TCrmBranch::getAuditStatus,2));
                     if (!crmBranches.isEmpty()) {
                         List<String> branchIds = crmBranches.stream().map(TCrmBranch::getId).collect(Collectors.toList());
                         list.addAll(crmClinicService.list(Wrappers.lambdaQuery(TCrmClinic.class).in(TCrmClinic::getBranchId, branchIds).in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5))));
@@ -1041,7 +1041,7 @@
                 }
 
                 if (branch.getPersonType() != null && branch.getPersonType() == 3) {
-                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2));
+                    List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2).eq(TCrmBranch::getAuditStatus,2));
                     if (!crmBranches.isEmpty()) {
                         // 区公司
                         List<String> branchIds = crmBranches.stream().map(TCrmBranch::getId).collect(Collectors.toList());
@@ -1049,7 +1049,7 @@
 
                         Set<Long> userIds = crmBranches.stream().map(TCrmBranch::getUserId).collect(Collectors.toSet());
                         // 城市公司
-                        List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3));
+                        List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3).eq(TCrmBranch::getAuditStatus,2));
                         if (!crmBranchesThree.isEmpty()) {
                             List<String> branchIdsThree = crmBranchesThree.stream().map(TCrmBranch::getId).collect(Collectors.toList());
                             list.addAll(crmClinicService.list(Wrappers.lambdaQuery(TCrmClinic.class).in(TCrmClinic::getBranchId, branchIdsThree).in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5))));

--
Gitblit v1.7.1