|
|
@@ -73,15 +73,15 @@ public class IndexStatisticsController {
|
|
|
userType = 0;
|
|
|
}
|
|
|
if(medicalMallConfig.isStatics()|| (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
|
|
|
- analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType));
|
|
|
+ analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType), AnalysisPreviewDTO.class);
|
|
|
}else if(param.getCompanyId() != null){
|
|
|
- analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,param.getCompanyId()));
|
|
|
+ analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,param.getCompanyId()), AnalysisPreviewDTO.class);
|
|
|
}else{
|
|
|
Company company = new Company();
|
|
|
company.setDeptId(param.getDeptId());
|
|
|
Long[] companyIds = companyService.selectCompanyList(company).stream().map(Company::getCompanyId).toArray(Long[]::new);
|
|
|
for(Long companyId : companyIds){
|
|
|
- AnalysisPreviewDTO clildDTO = redisCache.getCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,companyId));
|
|
|
+ AnalysisPreviewDTO clildDTO = redisCache.getCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,companyId), AnalysisPreviewDTO.class);
|
|
|
if (clildDTO != null) {
|
|
|
//将除了completedRate、correctRate和watchRate之外的数据相加,并计算completedRate、correctRate和watchRate
|
|
|
analysisPreviewDTO.setWatchUserCount(
|
|
|
@@ -147,15 +147,18 @@ public class IndexStatisticsController {
|
|
|
public R rechargeComsumption(StatisticsDeptCompanyParam param){
|
|
|
ConsumptionBalanceDataDTO consumptionBalanceDataDTO = new ConsumptionBalanceDataDTO();
|
|
|
if(medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)) {
|
|
|
- consumptionBalanceDataDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_BALANCE);
|
|
|
+ consumptionBalanceDataDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_BALANCE, ConsumptionBalanceDataDTO.class);
|
|
|
}else if(param.getCompanyId() != null){
|
|
|
- consumptionBalanceDataDTO = redisCache.getCacheObject(String.format("%s:%d",DATA_OVERVIEW_DEALER_BALANCE,param.getCompanyId()));
|
|
|
+ consumptionBalanceDataDTO = redisCache.getCacheObject(String.format("%s:%d",DATA_OVERVIEW_DEALER_BALANCE,param.getCompanyId()), ConsumptionBalanceDataDTO.class);
|
|
|
}else{
|
|
|
Company company = new Company();
|
|
|
company.setDeptId(param.getDeptId());
|
|
|
Long[] companyIds = companyService.selectCompanyList(company).stream().map(Company::getCompanyId).toArray(Long[]::new);
|
|
|
for(Long companyId : companyIds){
|
|
|
- ConsumptionBalanceDataDTO clildDTO = redisCache.getCacheObject(String.format("%s:%d",DATA_OVERVIEW_DEALER_BALANCE,companyId));
|
|
|
+ ConsumptionBalanceDataDTO clildDTO = redisCache.getCacheObject(String.format("%s:%d",DATA_OVERVIEW_DEALER_BALANCE,companyId), ConsumptionBalanceDataDTO.class);
|
|
|
+ if (clildDTO == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
consumptionBalanceDataDTO.setBalance(
|
|
|
(consumptionBalanceDataDTO.getBalance() == null ? BigDecimal.ZERO : consumptionBalanceDataDTO.getBalance())
|
|
|
.add(clildDTO.getBalance() == null ? BigDecimal.ZERO : clildDTO.getBalance())
|
|
|
@@ -170,7 +173,7 @@ public class IndexStatisticsController {
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
- BigDecimal redPacketCompanyMoney = redisCache.getCacheObject("redpacket_money");
|
|
|
+ BigDecimal redPacketCompanyMoney = redisCache.getCacheObject("redpacket_money", BigDecimal.class);
|
|
|
if(ObjectUtils.isNull(redPacketCompanyMoney)){
|
|
|
redPacketCompanyMoney = BigDecimal.ZERO;
|
|
|
}
|
|
|
@@ -189,7 +192,7 @@ public class IndexStatisticsController {
|
|
|
public R getTrafficLog(StatisticsDeptCompanyParam param){
|
|
|
TrafficLogDTO result = new TrafficLogDTO();
|
|
|
if(!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)) {
|
|
|
- result = redisCache.getCacheObject(DATA_OVERVIEW_TRAFFIC_LOG);
|
|
|
+ result = redisCache.getCacheObject(DATA_OVERVIEW_TRAFFIC_LOG, TrafficLogDTO.class);
|
|
|
if (!medicalMallConfig.isStatics()) {
|
|
|
SysConfig sysConfig = sysConfigService.selectConfigByConfigKey("redPacket.Traffic.config");
|
|
|
if(result == null || sysConfig == null) {
|
|
|
@@ -621,9 +624,15 @@ public class IndexStatisticsController {
|
|
|
public R dealerAggregated(StatisticsDeptCompanyParam param){
|
|
|
DealerAggregatedDTO result = new DealerAggregatedDTO();
|
|
|
if (!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)) {
|
|
|
- result = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_AGGREGATED);
|
|
|
+ result = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_AGGREGATED, DealerAggregatedDTO.class);
|
|
|
+ if (result == null) {
|
|
|
+ result = new DealerAggregatedDTO();
|
|
|
+ }
|
|
|
}else if (param.getCompanyId() != null) {
|
|
|
- result = redisCache.getCacheObject(String.format("%s:%d", DATA_OVERVIEW_DEALER_AGGREGATED, param.getCompanyId()));
|
|
|
+ result = redisCache.getCacheObject(String.format("%s:%d", DATA_OVERVIEW_DEALER_AGGREGATED, param.getCompanyId()), DealerAggregatedDTO.class);
|
|
|
+ if (result == null) {
|
|
|
+ result = new DealerAggregatedDTO();
|
|
|
+ }
|
|
|
//没选中销售公司,部门不为总公司
|
|
|
}else{
|
|
|
//Long padMaxNum = deptLimiteService.selectById(param.getDeptId()).getMaxPadNum();
|
|
|
@@ -631,7 +640,7 @@ public class IndexStatisticsController {
|
|
|
company.setDeptId(param.getDeptId());
|
|
|
Long[] companyIds = companyService.selectCompanyList(company).stream().map(Company::getCompanyId).toArray(Long[]::new);
|
|
|
for(Long companyId : companyIds) {
|
|
|
- DealerAggregatedDTO dealerAggregatedDTO = redisCache.getCacheObject(String.format("%s:%d", DATA_OVERVIEW_DEALER_AGGREGATED, companyId));
|
|
|
+ DealerAggregatedDTO dealerAggregatedDTO = redisCache.getCacheObject(String.format("%s:%d", DATA_OVERVIEW_DEALER_AGGREGATED, companyId), DealerAggregatedDTO.class);
|
|
|
// 添加空值检查
|
|
|
if (dealerAggregatedDTO != null) {
|
|
|
result.setDealderCount((result.getDealderCount() == null ? 0 : result.getDealderCount())
|
|
|
@@ -738,9 +747,11 @@ public class IndexStatisticsController {
|
|
|
@GetMapping("/thisMonthOrderCount")
|
|
|
public R thisMonthOrderCount(StatisticsDeptCompanyParam param){
|
|
|
if (!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
|
|
|
- return redisCache.getCacheObject(StatisticsRedisConstant.THIS_MONTH_ORDER_COUNT);
|
|
|
+ R cached = redisCache.getCacheObject(StatisticsRedisConstant.THIS_MONTH_ORDER_COUNT, R.class);
|
|
|
+ return cached != null ? cached : R.ok();
|
|
|
}else if(param.getCompanyId() != null){
|
|
|
- return redisCache.getCacheObject(String.format("%s:%d", THIS_MONTH_ORDER_COUNT, param.getCompanyId()));
|
|
|
+ R cached = redisCache.getCacheObject(String.format("%s:%d", THIS_MONTH_ORDER_COUNT, param.getCompanyId()), R.class);
|
|
|
+ return cached != null ? cached : R.ok();
|
|
|
}else{
|
|
|
Company company = new Company();
|
|
|
company.setDeptId(param.getDeptId());
|
|
|
@@ -749,7 +760,10 @@ public class IndexStatisticsController {
|
|
|
List<Integer> orderCountList = new ArrayList<>();
|
|
|
List<Integer> payPriceList = new ArrayList<>();
|
|
|
for(Long companyId : companyIds) {
|
|
|
- R result = redisCache.getCacheObject(String.format("%s:%d", THIS_MONTH_ORDER_COUNT, companyId));
|
|
|
+ R result = redisCache.getCacheObject(String.format("%s:%d", THIS_MONTH_ORDER_COUNT, companyId), R.class);
|
|
|
+ if (result == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
Object datas = result.get("datas");
|
|
|
Object orderCount = result.get("orderCount");
|
|
|
Object payPrice = result.get("payPrice");
|
|
|
@@ -769,9 +783,11 @@ public class IndexStatisticsController {
|
|
|
@GetMapping("/thisMonthRecvCount")
|
|
|
public R thisMonthRecvCount(StatisticsDeptCompanyParam param){
|
|
|
if (!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
|
|
|
- return redisCache.getCacheObject(StatisticsRedisConstant.THIS_MONTH_RECV_COUNT);
|
|
|
+ R cached = redisCache.getCacheObject(StatisticsRedisConstant.THIS_MONTH_RECV_COUNT, R.class);
|
|
|
+ return cached != null ? cached : R.ok();
|
|
|
}else if(param.getCompanyId() != null){
|
|
|
- return redisCache.getCacheObject(String.format("%s:%d", THIS_MONTH_RECV_COUNT, param.getCompanyId()));
|
|
|
+ R cached = redisCache.getCacheObject(String.format("%s:%d", THIS_MONTH_RECV_COUNT, param.getCompanyId()), R.class);
|
|
|
+ return cached != null ? cached : R.ok();
|
|
|
}else{
|
|
|
Company company = new Company();
|
|
|
company.setDeptId(param.getDeptId());
|
|
|
@@ -780,7 +796,10 @@ public class IndexStatisticsController {
|
|
|
List<Integer> orderCountList = new ArrayList<>();
|
|
|
List<Float> payMoneyList = new ArrayList<>();
|
|
|
for(Long companyId : companyIds) {
|
|
|
- R result = redisCache.getCacheObject(String.format("%s:%d", THIS_MONTH_RECV_COUNT, companyId));
|
|
|
+ R result = redisCache.getCacheObject(String.format("%s:%d", THIS_MONTH_RECV_COUNT, companyId), R.class);
|
|
|
+ if (result == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
Object datas = result.get("datas");
|
|
|
Object orderCount = result.get("orderCount");
|
|
|
Object payMoney = result.get("payMoney");
|