Bläddra i källkod

恒春来
-主页新增指定日期查询条件

lk 6 dagar sedan
förälder
incheckning
838ee0aac0

+ 22 - 0
fs-admin/src/main/java/com/fs/api/controller/IndexStatisticsController.java

@@ -13,6 +13,7 @@ import com.fs.statis.StatisticsRedisConstant;
 import com.fs.statis.dto.*;
 import com.fs.statis.param.StatisticsDeptCompanyParam;
 import com.fs.statis.service.IStatisticsService;
+import com.fs.statis.service.impl.StatisticsCompanyServiceImpl;
 import com.fs.system.domain.SysConfig;
 import com.fs.system.service.ISysConfigService;
 import com.fs.system.service.ISysDeptService;
@@ -56,6 +57,9 @@ public class IndexStatisticsController {
 
     @Autowired
     private IStatisticsService statisticsService;
+    @Autowired
+    private StatisticsCompanyServiceImpl statisticsCompanyService;
+
     /**
      * 分析概览
      */
@@ -72,6 +76,9 @@ public class IndexStatisticsController {
         if(userType == null) {
             userType = 0;
         }
+        if(param.getType().equals(5)){
+            return R.ok().put("data",statisticsService.analysisPreview(param));
+        }
         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));
         }else if(param.getCompanyId() != null){
@@ -255,6 +262,9 @@ public class IndexStatisticsController {
             userType = 0;
         }
         List<WatchEndPlayTrendDTO> watchEndPlayTrendDTOS;
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsCompanyService.watchEndPlayTrend(param));
+        }
         // 参考watchCourseTopTen方法的处理逻辑
         if (!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
             String key = String.format("%s:%d:%d", DATA_OVERVIEW_DEALER_CHARTS, type,userType);
@@ -339,6 +349,9 @@ public class IndexStatisticsController {
             userType = 0;
         }
         List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = new ArrayList<>();
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsService.deaMemberTopTen(param));
+        }
         // 参考deaMemberTopTen方法处理逻辑
         if (!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
             String key = String.format("%s:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type, statisticalType,userType);
@@ -396,6 +409,9 @@ public class IndexStatisticsController {
         Integer dataType = param.getDataType();
         Integer userType = param.getUserType();
         List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = new ArrayList<>();
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsService.rewardMoneyTopTen(param));
+        }
         // 参考rewardMoneyTopTen方法处理逻辑
         if(!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
             String key = String.format("%s:%d:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType,userType);
@@ -450,6 +466,9 @@ public class IndexStatisticsController {
         Integer type = param.getType();
         Integer userType = param.getUserType();
         List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = new ArrayList<>();
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsService.rewardMoneyTrendDTO(param));
+        }
         // 参考rewardMoneyTrend方法处理逻辑
         if(!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
             String key = String.format("%s:%d:%d", CHARTS_REWARD_MONEY_TREND, type,userType);
@@ -503,6 +522,9 @@ public class IndexStatisticsController {
         Integer statisticalType = param.getStatisticalType();
         Integer userType = param.getUserType();
         List<CourseStatsDTO> courseStatsDTOS;
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsCompanyService.watchCourseTopTen(param));
+        }
         if (!medicalMallConfig.isStatics() || (param.getCompanyId() == null && param.getDeptId() == null) || (param.getCompanyId() == null && param.getDeptId() == 1)){
             courseStatsDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%s", CHARTS_WATCH_TOP_TEN, type,statisticalType,userType,sort));
         }else if(param.getCompanyId() != null){

+ 24 - 5
fs-company/src/main/java/com/fs/company/controller/company/IndexStatisticsController.java

@@ -11,6 +11,7 @@ import com.fs.framework.service.TokenService;
 import com.fs.statis.StatisticsRedisConstant;
 import com.fs.statis.dto.*;
 import com.fs.statis.service.IStatisticsService;
+import com.fs.statis.service.impl.StatisticsCompanyServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -42,6 +43,9 @@ public class IndexStatisticsController {
 
     @Autowired
     CloudHostProper cloudHostProper;
+    @Autowired
+    private StatisticsCompanyServiceImpl statisticsCompanyService;
+
     /**
      * 分析概览
      */
@@ -60,7 +64,11 @@ public class IndexStatisticsController {
         }
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         param.setCompanyId(loginUser.getCompany().getCompanyId());
-        analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,param.getCompanyId()));
+        if (param.getType().equals(5)){// 指定日期直接查,不走缓存
+            return R.ok().put("data",statisticsCompanyService.analysisPreview(param));
+        }else {
+            analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType,param.getCompanyId()));
+        }
 
         return R.ok().put("data",analysisPreviewDTO);
     }
@@ -179,7 +187,9 @@ public class IndexStatisticsController {
         }else{
             Long companyId = loginUser.getCompany().getCompanyId();
             param.setCompanyId(companyId);
-
+            if (param.getType().equals(5)){
+                return R.ok().put("data", statisticsCompanyService.watchEndPlayTrend(param));
+            }
             String key = String.format("%s:%d:%d:%d", DATA_OVERVIEW_DEALER_CHARTS, type,userType,param.getCompanyId());
             List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(key);
             return R.ok().put("data", deaMemberTopTenDTOS);
@@ -204,7 +214,9 @@ public class IndexStatisticsController {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         Long companyId = loginUser.getCompany().getCompanyId();
         param.setCompanyId(companyId);
-
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsService.deaMemberTopTen(param));
+        }
         List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type, statisticalType,userType,param.getCompanyId()));
         if(deaMemberTopTenDTOS == null){
             deaMemberTopTenDTOS = new ArrayList<>();
@@ -223,7 +235,9 @@ public class IndexStatisticsController {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         Long companyId = loginUser.getCompany().getCompanyId();
         param.setCompanyId(companyId);
-
+        if (param.getType().equals(5)){
+            R.ok().put("data", statisticsCompanyService.rewardMoneyTopTen(param));
+        }
         List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = redisCache.getCacheObject( String.format("%s:%d:%d:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType,userType,param.getCompanyId()));
         return R.ok().put("data", rewardMoneyTopTenDTOS);
     }
@@ -238,7 +252,9 @@ public class IndexStatisticsController {
         LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
         Long companyId = loginUser.getCompany().getCompanyId();
         param.setCompanyId(companyId);
-
+        if (param.getType().equals(5)){
+            return R.ok().put("data", statisticsCompanyService.rewardMoneyTrendDTO(param));
+        }
         List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = redisCache.getCacheObject( String.format("%s:%d:%d:%d", CHARTS_REWARD_MONEY_TREND, type,userType,param.getCompanyId()));
         return R.ok().put("data", rewardMoneyTrendDTOS);
     }
@@ -256,6 +272,9 @@ public class IndexStatisticsController {
         Long companyId = loginUser.getCompany().getCompanyId();
         param.setCompanyId(companyId);
 
+        if (param.getType().equals(5)){
+            return R.ok().put("data",statisticsService.watchCourseTopTen(param));
+        }
         List<CourseStatsDTO> courseStatsDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%s:%d", CHARTS_WATCH_TOP_TEN, type,statisticalType,userType,sort,param.getCompanyId()));
         return R.ok().put("data", courseStatsDTOS);
     }

+ 1 - 1
fs-service/src/main/java/com/fs/statis/dto/AnalysisPreviewQueryDTO.java

@@ -10,7 +10,7 @@ import java.io.Serializable;
 public class AnalysisPreviewQueryDTO implements Serializable {
 
     /**
-     * 0 今日,1昨日,2本周,3本月,4上月
+     * 0 今日,1昨日,2本周,3本月,4上月,5指定日期(不走缓存,直接查)
      */
     private Integer type;
 

+ 7 - 0
fs-service/src/main/java/com/fs/statis/service/impl/StatisticsServiceImpl.java

@@ -1,5 +1,6 @@
 package com.fs.statis.service.impl;
 
+import cn.hutool.core.map.MapUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.fs.common.constant.FsConstants;
 import com.fs.common.core.domain.R;
@@ -1107,6 +1108,12 @@ public class StatisticsServiceImpl implements IStatisticsService {
     @Override
     public List<WatchCourseStatisticsResultDTO> getWatchCourseStatisticsData(AnalysisPreviewQueryDTO param) {
 
+        if (param.getType().equals(5)){
+            HashMap<String, Object> map = MapUtil.newHashMap();
+            map.put("startTime", param.getStartTime());
+            map.put("endTime", param.getEndTime());
+            return fsCourseWatchLogMapper.watchCourseStatisticsGroupByCompany(map);
+        }
         String redisData = redisCache.getCacheObject(FsConstants.WATCH_COURSE_STATISTICS_GROUP_COMPANY + param.getType());
         List<WatchCourseStatisticsResultDTO> watchCourseStatisticsDTOS = new ArrayList<>();
         if (StringUtils.isNotBlank(redisData)) {

+ 3 - 3
fs-service/src/main/resources/mapper/statis/ConsumptionBalanceMapper.xml

@@ -174,7 +174,7 @@
                 DATE_FORMAT(create_time, '%H') AS start_date,
             </when>
             <!-- 按天分组 -->
-            <when test="type == 2 or type == 3 or type == 4">
+            <when test="type == 2 or type == 3 or type == 4 or type == 5">
                 DATE_FORMAT(create_time, '%Y-%m-%d') AS start_date,
             </when>
         </choose>
@@ -196,7 +196,7 @@
         GROUP BY
         <choose>
             <when test="type == 0 or type == 1">DATE_FORMAT(create_time, '%H')</when>
-            <when test="type == 2 or type == 3 or type == 4">DATE_FORMAT(create_time, '%Y-%m-%d')</when>
+            <when test="type == 2 or type == 3 or type == 4 or type == 5">DATE_FORMAT(create_time, '%Y-%m-%d')</when>
         </choose>
         ORDER BY
         start_date
@@ -447,7 +447,7 @@
             DATE_FORMAT(rpl.create_time, '%H') AS start_date,
         </if>
         --                 本周/本月/上月 天
-        <if test="type == 2 or type == 3 or type == 4">
+        <if test="type == 2 or type == 3 or type == 4 or type == 5">
             DATE_FORMAT(rpl.create_time, '%Y-%m-%d') AS start_date,
         </if>
             SUM(rpl.amount) as rewardMoney