| | |
| | | TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | // *** |
| | | if(Objects.isNull(crmSupplier)){ |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmSupplier = crmSupplierService.getById(sysUser.getObjectId()); |
| | | } |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | |
| | |
| | | TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | // *** |
| | | if(Objects.isNull(crmSupplier)){ |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmSupplier = crmSupplierService.getById(sysUser.getObjectId()); |
| | | } |
| | | supplierAndClinicId = crmSupplier.getId(); |
| | | } else { |
| | | TCrmClinic crmClinic = crmClinicService.getOne(Wrappers.lambdaQuery(TCrmClinic.class) |
| | |
| | | TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | // *** |
| | | if(Objects.isNull(crmSupplier)){ |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmSupplier = crmSupplierService.getById(sysUser.getObjectId()); |
| | | } |
| | | // 查询药品总类和总数 |
| | | Integer typeTotalCount = erpProcurementService.supplierSalesStatisticsTypeCount(crmSupplier.getId()); |
| | | Integer totalCount = erpProcurementService.supplierSalesStatisticsCount(crmSupplier.getId()); |
| | |
| | | TCrmSupplier crmSupplier = crmSupplierService.getOne(Wrappers.lambdaQuery(TCrmSupplier.class) |
| | | .eq(TCrmSupplier::getUserId, userId) |
| | | .last("LIMIT 1")); |
| | | // *** |
| | | if(Objects.isNull(crmSupplier)){ |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | crmSupplier = crmSupplierService.getById(sysUser.getObjectId()); |
| | | } |
| | | SupplierSalesStatisticsVO supplierSalesStatisticsVO = new SupplierSalesStatisticsVO(); |
| | | // 销售金额 |
| | | BigDecimal totalMoney = erpProcurementService.supplierSalesStatisticsMoney(crmSupplier.getId(), startTime, endTime); |
| | |
| | | List<ClinicSalesStatisticsGoodsTypeVO> thirtyMoneyProcurementStatisticsVOS = collect2.entrySet().stream().map(entry -> { |
| | | ClinicSalesStatisticsGoodsTypeVO clinicSalesStatisticsGoodsTypeVO = new ClinicSalesStatisticsGoodsTypeVO(); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsCount(entry.getValue().stream().mapToInt(TErpProcurementGoods::getPurchaseCount).sum()); |
| | | clinicSalesStatisticsGoodsTypeVO.setTypeName(entry.getValue().get(0).getGoodsName()); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsName(entry.getValue().get(0).getGoodsName()); |
| | | return clinicSalesStatisticsGoodsTypeVO; |
| | | }).sorted(Comparator.comparing(ClinicSalesStatisticsGoodsTypeVO::getGoodsCount).reversed()).limit(9).collect(Collectors.toList()); |
| | | // 总数 |
| | |
| | | if (sum - sum1 > 0) { |
| | | ClinicSalesStatisticsGoodsTypeVO clinicSalesStatisticsGoodsTypeVO = new ClinicSalesStatisticsGoodsTypeVO(); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsCount(sum - sum1); |
| | | clinicSalesStatisticsGoodsTypeVO.setTypeName("其他"); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsName("其他"); |
| | | thirtyMoneyProcurementStatisticsVOS.add(clinicSalesStatisticsGoodsTypeVO); |
| | | } |
| | | vo.setThirtyMoneyProcurementStatisticsVOS(thirtyMoneyProcurementStatisticsVOS); |
| | |
| | | List<ClinicSalesStatisticsGoodsTypeVO> thirtyMoneyProcurementStatisticsVOS = collect2.entrySet().stream().map(entry -> { |
| | | ClinicSalesStatisticsGoodsTypeVO clinicSalesStatisticsGoodsTypeVO = new ClinicSalesStatisticsGoodsTypeVO(); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsCount(entry.getValue().stream().mapToInt(TErpProcurementGoods::getPurchaseCount).sum()); |
| | | clinicSalesStatisticsGoodsTypeVO.setTypeName(entry.getValue().get(0).getGoodsName()); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsName(entry.getValue().get(0).getGoodsName()); |
| | | return clinicSalesStatisticsGoodsTypeVO; |
| | | }).sorted(Comparator.comparing(ClinicSalesStatisticsGoodsTypeVO::getGoodsCount).reversed()).limit(9).collect(Collectors.toList()); |
| | | // 总数 |
| | |
| | | if (sum - sum1 > 0) { |
| | | ClinicSalesStatisticsGoodsTypeVO clinicSalesStatisticsGoodsTypeVO = new ClinicSalesStatisticsGoodsTypeVO(); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsCount(sum - sum1); |
| | | clinicSalesStatisticsGoodsTypeVO.setTypeName("其他"); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsName("其他"); |
| | | thirtyMoneyProcurementStatisticsVOS.add(clinicSalesStatisticsGoodsTypeVO); |
| | | } |
| | | vo.setThirtyMoneyProcurementStatisticsVOS(thirtyMoneyProcurementStatisticsVOS); |
| | |
| | | SysUser user = tokenService.getLoginUser().getUser(); |
| | | Integer roleType = user.getRoleType(); |
| | | 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, user.getUserId()); |
| | | eq.eq(TCrmClinic::getSalespersonId, one.getId()); |
| | | eq.in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5)); |
| | | |
| | | List<TCrmClinic> list = crmClinicService.list(eq); |
| | |
| | | SimpleDateFormat formatMonth = new SimpleDateFormat("yyyy-MM"); |
| | | Integer roleType = user.getRoleType(); |
| | | 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, user.getUserId()); |
| | | eq.eq(TCrmClinic::getSalespersonId,one.getId()); |
| | | eq.in(TCrmClinic::getStatus, Arrays.asList(3, 4, 5)); |
| | | List<TCrmClinic> list = crmClinicService.list(eq); |
| | | |
| | |
| | | List<ClinicSalesStatisticsGoodsTypeVO> thirtyMoneyProcurementStatisticsVOS = collect2.entrySet().stream().map(entry -> { |
| | | ClinicSalesStatisticsGoodsTypeVO clinicSalesStatisticsGoodsTypeVO = new ClinicSalesStatisticsGoodsTypeVO(); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsCount(entry.getValue().stream().mapToInt(TErpProcurementGoods::getPurchaseCount).sum()); |
| | | clinicSalesStatisticsGoodsTypeVO.setTypeName(entry.getValue().get(0).getGoodsName()); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsName(entry.getValue().get(0).getGoodsName()); |
| | | return clinicSalesStatisticsGoodsTypeVO; |
| | | }).sorted(Comparator.comparing(ClinicSalesStatisticsGoodsTypeVO::getGoodsCount).reversed()).limit(9).collect(Collectors.toList()); |
| | | // 总数 |
| | |
| | | if (sum - sum1 > 0) { |
| | | ClinicSalesStatisticsGoodsTypeVO clinicSalesStatisticsGoodsTypeVO = new ClinicSalesStatisticsGoodsTypeVO(); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsCount(sum - sum1); |
| | | clinicSalesStatisticsGoodsTypeVO.setTypeName("其他"); |
| | | clinicSalesStatisticsGoodsTypeVO.setGoodsName("其他"); |
| | | thirtyMoneyProcurementStatisticsVOS.add(clinicSalesStatisticsGoodsTypeVO); |
| | | } |
| | | vo.setThirtyMoneyProcurementStatisticsVOS(thirtyMoneyProcurementStatisticsVOS); |