| | |
| | | .eq(TCrmSupplier::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | // *** |
| | | if(Objects.isNull(crmSupplier)){ |
| | | if (Objects.isNull(crmSupplier)) { |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmSupplier = crmSupplierService.getById(sysUser.getObjectId()); |
| | | } |
| | |
| | | .eq(TCrmSupplier::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | // *** |
| | | if(Objects.isNull(crmSupplier)){ |
| | | if (Objects.isNull(crmSupplier)) { |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmSupplier = crmSupplierService.getById(sysUser.getObjectId()); |
| | | } |
| | |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(crmClinic)){ |
| | | if (Objects.isNull(crmClinic)) { |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmClinic = crmClinicService.getById(sysUser.getObjectId()); |
| | | } |
| | | if(Objects.isNull(crmClinic)){ |
| | | if (Objects.isNull(crmClinic)) { |
| | | return R.fail("未找到该账号诊所信息"); |
| | | } |
| | | supplierAndClinicId = crmClinic.getId(); |
| | |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(crmClinic)){ |
| | | if (Objects.isNull(crmClinic)) { |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmClinic = crmClinicService.getById(sysUser.getObjectId()); |
| | | } |
| | | if(Objects.isNull(crmClinic)){ |
| | | if (Objects.isNull(crmClinic)) { |
| | | return R.fail("未找到该账号诊所信息"); |
| | | } |
| | | |
| | |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(crmClinic)){ |
| | | if (Objects.isNull(crmClinic)) { |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmClinic = crmClinicService.getById(sysUser.getObjectId()); |
| | | } |
| | | if(Objects.isNull(crmClinic)){ |
| | | if (Objects.isNull(crmClinic)) { |
| | | return R.fail("未找到该账号诊所信息"); |
| | | } |
| | | List<TCrmClinicPoints> crmClinicPoints = crmClinicPointsService.clinicPointsStatistics(crmClinic.getId(), LocalDate.now() + " 23:59:59"); |
| | |
| | | .eq(TCrmSupplier::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | // *** |
| | | if(Objects.isNull(crmSupplier)){ |
| | | if (Objects.isNull(crmSupplier)) { |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmSupplier = crmSupplierService.getById(sysUser.getObjectId()); |
| | | } |
| | |
| | | .eq(TCrmSupplier::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | // *** |
| | | if(Objects.isNull(crmSupplier)){ |
| | | if (Objects.isNull(crmSupplier)) { |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmSupplier = crmSupplierService.getById(sysUser.getObjectId()); |
| | | } |
| | |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(crmClinic)){ |
| | | if (Objects.isNull(crmClinic)) { |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmClinic = crmClinicService.getById(sysUser.getObjectId()); |
| | | } |
| | | if(Objects.isNull(crmClinic)){ |
| | | if (Objects.isNull(crmClinic)) { |
| | | return R.fail("未找到该账号诊所信息"); |
| | | } |
| | | // 查询药品总类和总数 |
| | |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | | .eq(TCrmClinic::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | if(Objects.isNull(crmClinic)){ |
| | | if (Objects.isNull(crmClinic)) { |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmClinic = crmClinicService.getById(sysUser.getObjectId()); |
| | | } |
| | | if(Objects.isNull(crmClinic)){ |
| | | if (Objects.isNull(crmClinic)) { |
| | | return R.fail("未找到该账号诊所信息"); |
| | | } |
| | | ClinicSalesStatisticsVO clinicSalesStatisticsVO = new ClinicSalesStatisticsVO(); |
| | |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "分公司管理员-首页统计(获取所有分公司信息)") |
| | | @PostMapping(value = "/branchAdminList") |
| | | public R<List<BranchAdminListVO>> branchAdminList() { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | ArrayList<BranchAdminListVO> branchAdminListVOs = new ArrayList<>(); |
| | | if (roleType == 2) { |
| | | TCrmBranch branch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class) |
| | | .eq(TCrmBranch::getUserId, user.getUserId()) |
| | | .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)); |
| | | |
| | | if (!crmBranches.isEmpty()) { |
| | | for (TCrmBranch crmBranch : crmBranches) { |
| | | BranchAdminListVO branchAdminListVO = new BranchAdminListVO(); |
| | | branchAdminListVO.setId(crmBranch.getId()); |
| | | branchAdminListVO.setName(crmBranch.getBranchName()); |
| | | branchAdminListVOs.add(branchAdminListVO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 省 |
| | | if (branch.getPersonType() != null && branch.getPersonType() == 1) { |
| | | // 所有的区 公司 |
| | | List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2)); |
| | | if (!crmBranches.isEmpty()) { |
| | | Set<Long> userIds = crmBranches.stream().map(TCrmBranch::getUserId).collect(Collectors.toSet()); |
| | | |
| | | for (TCrmBranch crmBranch : crmBranches) { |
| | | BranchAdminListVO branchAdminListVO = new BranchAdminListVO(); |
| | | branchAdminListVO.setId(crmBranch.getId()); |
| | | branchAdminListVO.setName(crmBranch.getBranchName()); |
| | | branchAdminListVOs.add(branchAdminListVO); |
| | | } |
| | | // 城市公司 |
| | | List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3)); |
| | | if (!crmBranchesThree.isEmpty()) { |
| | | for (TCrmBranch crmBranch : crmBranchesThree) { |
| | | BranchAdminListVO branchAdminListVO = new BranchAdminListVO(); |
| | | branchAdminListVO.setId(crmBranch.getId()); |
| | | branchAdminListVO.setName(crmBranch.getBranchName()); |
| | | branchAdminListVOs.add(branchAdminListVO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | BranchAdminListVO branchAdminListVO = new BranchAdminListVO(); |
| | | branchAdminListVO.setId(branch.getId()); |
| | | branchAdminListVO.setName(branch.getBranchName()); |
| | | branchAdminListVOs.add(branchAdminListVO); |
| | | } |
| | | return R.ok(branchAdminListVOs); |
| | | } |
| | | @ApiOperation(value = "分公司管理员-首页统计(获取所有业务员信息)") |
| | | @PostMapping(value = "/branchAdminSaleList") |
| | | public R<List<BranchAdminListVO>> branchAdminSaleList() { |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | ArrayList<BranchAdminListVO> branchAdminListVOs = new ArrayList<>(); |
| | | if (roleType == 2) { |
| | | TCrmBranch branch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class) |
| | | .eq(TCrmBranch::getUserId, user.getUserId()) |
| | | .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)); |
| | | |
| | | if (!crmBranches.isEmpty()) { |
| | | for (TCrmBranch crmBranch : crmBranches) { |
| | | BranchAdminListVO branchAdminListVO = new BranchAdminListVO(); |
| | | branchAdminListVO.setId(crmBranch.getId()); |
| | | branchAdminListVO.setName(crmBranch.getBranchName()); |
| | | branchAdminListVOs.add(branchAdminListVO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 省 |
| | | if (branch.getPersonType() != null && branch.getPersonType() == 1) { |
| | | // 所有的区 公司 |
| | | List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 2)); |
| | | if (!crmBranches.isEmpty()) { |
| | | Set<Long> userIds = crmBranches.stream().map(TCrmBranch::getUserId).collect(Collectors.toSet()); |
| | | |
| | | for (TCrmBranch crmBranch : crmBranches) { |
| | | BranchAdminListVO branchAdminListVO = new BranchAdminListVO(); |
| | | branchAdminListVO.setId(crmBranch.getId()); |
| | | branchAdminListVO.setName(crmBranch.getBranchName()); |
| | | branchAdminListVOs.add(branchAdminListVO); |
| | | } |
| | | // 城市公司 |
| | | List<TCrmBranch> crmBranchesThree = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().in(TCrmBranch::getCorrelationPersonId, userIds).eq(TCrmBranch::getPersonType, 3)); |
| | | if (!crmBranchesThree.isEmpty()) { |
| | | for (TCrmBranch crmBranch : crmBranchesThree) { |
| | | BranchAdminListVO branchAdminListVO = new BranchAdminListVO(); |
| | | branchAdminListVO.setId(crmBranch.getId()); |
| | | branchAdminListVO.setName(crmBranch.getBranchName()); |
| | | branchAdminListVOs.add(branchAdminListVO); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | BranchAdminListVO branchAdminListVO = new BranchAdminListVO(); |
| | | branchAdminListVO.setId(branch.getId()); |
| | | branchAdminListVO.setName(branch.getBranchName()); |
| | | branchAdminListVOs.add(branchAdminListVO); |
| | | |
| | | } |
| | | |
| | | ArrayList<BranchAdminListVO> list = new ArrayList<>(); |
| | | if(!branchAdminListVOs.isEmpty()){ |
| | | Set<String> branchIds = branchAdminListVOs.stream().map(BranchAdminListVO::getId).collect(Collectors.toSet()); |
| | | List<TCrmSalesperson> tCrmSalespersonList = crmSalespersonService.list(new LambdaQueryWrapper<TCrmSalesperson>().in(TCrmSalesperson::getBranchId, branchIds)); |
| | | if(!tCrmSalespersonList.isEmpty()){ |
| | | for (TCrmSalesperson tCrmSalesperson : tCrmSalespersonList) { |
| | | BranchAdminListVO branchAdminListVO = new BranchAdminListVO(); |
| | | branchAdminListVO.setId(tCrmSalesperson.getId()); |
| | | branchAdminListVO.setName(tCrmSalesperson.getSalespersonName()); |
| | | list.add(branchAdminListVO); |
| | | } |
| | | } |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 分公司管理员-首页统计(第一部分) |
| | | */ |
| | |
| | | BranchAdminStatisticsOneVo branchAdminStatisticsOneVo = new BranchAdminStatisticsOneVo(); |
| | | // 找出分公司下的所有员工 -》 所有诊所-》订单(状态 3=待发货 4=已发货 5=已入库) |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | |
| | | Integer roleType = user.getRoleType(); |
| | | if (roleType == 2) { |
| | | TCrmBranch branch = crmBranchService.getOne(Wrappers.lambdaQuery(TCrmBranch.class) |
| | | .eq(TCrmBranch::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | if (branch != null) { |
| | | List<TCrmClinic> list = new ArrayList<>(); |
| | | if(query.getBranchId()!=null && !"".equals(query.getBranchId())){ |
| | | list = crmClinicService.list(Wrappers.lambdaQuery(TCrmClinic.class).eq(TCrmClinic::getBranchId, branch.getId()).in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5))); |
| | | }else { |
| | | |
| | | // 省查下面所有的区 和 城市公司 |
| | | // 区查下面所有城市公司 |
| | | // 城市查当前 原来逻辑 |
| | | // 先查自己本身的 |
| | | List<TCrmClinic> list = crmClinicService.list(Wrappers.lambdaQuery(TCrmClinic.class).eq(TCrmClinic::getBranchId, branch.getId()).in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5))); |
| | | // 如果是区 |
| | | if (branch.getPersonType() != null && branch.getPersonType() == 2) { |
| | | // 区查下面所有城市的公司 |
| | | List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3)); |
| | | 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 (!list.isEmpty()) { |
| | | |
| | | if (branch.getPersonType() != null && branch.getPersonType() == 3) { |
| | | List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 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)))); |
| | | |
| | | 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)); |
| | | 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)))); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if (!list.isEmpty()) { |
| | | List<String> crmClinicIds = list.stream().map(TCrmClinic::getId).collect(Collectors.toList()); |
| | | |
| | | // 获取最近一年的时间 |
| | |
| | | .eq(TCrmBranch::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | if (branch != null) { |
| | | LambdaQueryWrapper<TCrmClinic> eq = Wrappers.lambdaQuery(TCrmClinic.class); |
| | | if (query.getSalespersonId() != null && !query.getSalespersonId().isEmpty()) { |
| | | eq.eq(TCrmClinic::getSalespersonId, query.getSalespersonId()); |
| | | } else { |
| | | eq.eq(TCrmClinic::getBranchId, branch.getId()); |
| | | // 先查自己本身的 |
| | | List<TCrmClinic> list = crmClinicService.list(Wrappers.lambdaQuery(TCrmClinic.class).eq(TCrmClinic::getBranchId, branch.getId()).in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5))); |
| | | // 如果是区 |
| | | if (branch.getPersonType() != null && branch.getPersonType() == 2) { |
| | | // 区查下面所有城市的公司 |
| | | List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3)); |
| | | 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)))); |
| | | } |
| | | } |
| | | eq.in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5)); |
| | | |
| | | List<TCrmClinic> list = crmClinicService.list(eq); |
| | | if (branch.getPersonType() != null && branch.getPersonType() == 3) { |
| | | List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 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)))); |
| | | |
| | | 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)); |
| | | 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)))); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (query.getSalespersonId() != null && !query.getSalespersonId().isEmpty()) { |
| | | list = list.stream().filter(e -> e.getSalespersonId().equals(query.getSalespersonId())).collect(Collectors.toList()); |
| | | } |
| | | |
| | | branchAdminStatisticsTwoVo.setClinicNum(list.size()); |
| | | |
| | | // 金额 |
| | |
| | | .eq(TCrmBranch::getUserId, user.getUserId()) |
| | | .last("LIMIT 1")); |
| | | if (branch != null) { |
| | | LambdaQueryWrapper<TCrmClinic> eq = Wrappers.lambdaQuery(TCrmClinic.class); |
| | | eq.eq(TCrmClinic::getBranchId, branch.getId()); |
| | | eq.eq(TCrmClinic::getStatus, Arrays.asList(3, 4, 5)); |
| | | List<TCrmClinic> list = crmClinicService.list(eq); |
| | | // 先查自己本身的 |
| | | List<TCrmClinic> list = crmClinicService.list(Wrappers.lambdaQuery(TCrmClinic.class).eq(TCrmClinic::getBranchId, branch.getId()).in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5))); |
| | | // 如果是区 |
| | | if (branch.getPersonType() != null && branch.getPersonType() == 2) { |
| | | // 区查下面所有城市的公司 |
| | | List<TCrmBranch> crmBranches = crmBranchService.list(new LambdaQueryWrapper<TCrmBranch>().eq(TCrmBranch::getCorrelationPersonId, branch.getUserId()).eq(TCrmBranch::getPersonType, 3)); |
| | | 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)); |
| | | 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)))); |
| | | |
| | | 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)); |
| | | 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)))); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | List<String> clinicIds = list.stream().map(TCrmClinic::getId).collect(Collectors.toList()); |
| | | if (clinicIds.isEmpty()) { |
| | |
| | | if (roleType == 3) { |
| | | TCrmSalesperson one = crmSalespersonService.getOne(new LambdaQueryWrapper<TCrmSalesperson>().eq(TCrmSalesperson::getUserId, user.getUserId())); |
| | | LambdaQueryWrapper<TCrmClinic> eq = Wrappers.lambdaQuery(TCrmClinic.class); |
| | | eq.eq(TCrmClinic::getSalespersonId,one.getId()); |
| | | eq.eq(TCrmClinic::getSalespersonId, one.getId()); |
| | | eq.in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5)); |
| | | List<TCrmClinic> list = crmClinicService.list(eq); |
| | | |