xuhy
2025-12-05 38e9f48ea0cfe89230d957718eaf18feddebc8e7
Merge remote-tracking branch 'origin/master'
1个文件已修改
40 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/DataStatisticsController.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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))));