| | |
| | | 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) { |
| | |
| | | // 省 |
| | | 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()); |
| | | |
| | |
| | | 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(); |
| | |
| | | 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); |
| | |
| | | // 如果是区 |
| | | 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) { |
| | |
| | | // 省 |
| | | 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()); |
| | | |
| | |
| | | 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(); |
| | |
| | | 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) { |
| | | // 先查自己本身的 |
| | |
| | | // 如果是区 |
| | | 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)))); |
| | |
| | | } |
| | | |
| | | 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()); |
| | |
| | | |
| | | 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)))); |
| | |
| | | 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) { |
| | | // 先查自己本身的 |
| | |
| | | // 如果是区 |
| | | 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)))); |
| | |
| | | } |
| | | |
| | | 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()); |
| | |
| | | |
| | | 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)))); |
| | |
| | | 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) { |
| | | // 先查自己本身的 |
| | |
| | | // 如果是区 |
| | | 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)))); |
| | |
| | | } |
| | | |
| | | 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()); |
| | |
| | | |
| | | 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)))); |