Browse Source

首页统计

xdd 1 month ago
parent
commit
923789c17d

+ 7 - 16
fs-admin/src/main/java/com/fs/api/controller/IndexStatisticsController.java

@@ -38,17 +38,8 @@ public class IndexStatisticsController {
             type = 0;
         }
 
-        if(0 == type){
-            analysisPreviewDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_TODAY);
-        } else if(1 == type){
-            analysisPreviewDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_YESTODAY);
-        } else if(2 == type) {
-            analysisPreviewDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_THIS_WEEEK);
-        } else if(3 == type) {
-            analysisPreviewDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_THIS_MONTH);
-        } else if(4 == type) {
-            analysisPreviewDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_BEFORE_MONTH);
-        }
+        analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type));
+
         return R.ok().put("data",analysisPreviewDTO);
     }
 
@@ -67,7 +58,7 @@ public class IndexStatisticsController {
      */
     @PostMapping("/watchEndPlayTrend")
     public R watchEndPlayTrend(@RequestBody AnalysisPreviewQueryDTO param){
-        String key = String.format("%s::%d", DATA_OVERVIEW_DEALER_CHARTS, param.getType());
+        String key = String.format("%s:%d", DATA_OVERVIEW_DEALER_CHARTS, param.getType());
         List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(key);
         return R.ok().put("data", deaMemberTopTenDTOS);
     }
@@ -80,7 +71,7 @@ public class IndexStatisticsController {
         Integer type = param.getType();
         Integer statisticalType = param.getStatisticalType();
 
-        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(String.format("%s::%d::%d", CHARTS_MEMBER_TOP_TEN_WATCH, type, statisticalType));
+        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(String.format("%s:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type, statisticalType));
         if(deaMemberTopTenDTOS == null){
             deaMemberTopTenDTOS = new ArrayList<>();
         }
@@ -94,7 +85,7 @@ public class IndexStatisticsController {
     public R rewardMoneyTopTen(@RequestBody AnalysisPreviewQueryDTO param){
         Integer type = param.getType();
         Integer dataType = param.getDataType();
-        List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = redisCache.getCacheObject( String.format("%s::%d::%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType));
+        List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = redisCache.getCacheObject( String.format("%s:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType));
         return R.ok().put("data", rewardMoneyTopTenDTOS);
     }
 
@@ -104,7 +95,7 @@ public class IndexStatisticsController {
     @PostMapping("/rewardMoneyTrend")
     public R rewardMoneyTrend(@RequestBody AnalysisPreviewQueryDTO param){
         Integer type = param.getType();
-        List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = redisCache.getCacheObject( String.format("%s::%d", CHARTS_REWARD_MONEY_TREND, type));
+        List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = redisCache.getCacheObject( String.format("%s:%d", CHARTS_REWARD_MONEY_TREND, type));
         return R.ok().put("data", rewardMoneyTrendDTOS);
     }
 
@@ -116,7 +107,7 @@ public class IndexStatisticsController {
         Integer type = param.getType();
         String sort = param.getSort();
         Integer statisticalType = param.getStatisticalType();
-        List<CourseStatsDTO> courseStatsDTOS = redisCache.getCacheObject(String.format("%s::%d::%d::%s", CHARTS_WATCH_TOP_TEN, type,statisticalType,sort));
+        List<CourseStatsDTO> courseStatsDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%s", CHARTS_WATCH_TOP_TEN, type,statisticalType,sort));
         return R.ok().put("data", courseStatsDTOS);
     }
 

+ 1 - 20
fs-service-system/src/main/java/com/fs/statis/StatisticsRedisConstant.java

@@ -24,26 +24,7 @@ public class StatisticsRedisConstant {
     /**
      * 分析概览-今日
      */
-    public static final String DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_TODAY = "overview:AnalysisPreviewDTO:0";
-    /**
-     * 分析概览-昨日
-     */
-    public static final String DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_YESTODAY = "overview:AnalysisPreviewDTO:1";
-
-    /**
-     * 分析概览-本周
-     */
-    public static final String DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_THIS_WEEEK = "overview:AnalysisPreviewDTO:2";
-
-    /**
-     * 分析概览-本月
-     */
-    public static final String DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_THIS_MONTH = "overview:AnalysisPreviewDTO:3";
-    /**
-     * 分析概览-上月
-     */
-    public static final String DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_BEFORE_MONTH = "overview:AnalysisPreviewDTO:4";
-
+    public static final String DATA_OVERVIEW_DEALER_ANALYSISPREVIEW = "overview:AnalysisPreviewDTO";
 
     /**
      * 会员观看、完播人数趋势图

+ 18 - 16
fs-service-system/src/main/java/com/fs/statis/service/impl/StatisticsServiceImpl.java

@@ -105,18 +105,7 @@ public class StatisticsServiceImpl implements IStatisticsService {
 
         AnalysisPreviewDTO analysisPreviewDTO = this.analysisPreview(param);
 
-        if(0 == type){
-            redisCache.setCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_TODAY, analysisPreviewDTO);
-        } else if(1 == type){
-            redisCache.setCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_YESTODAY, analysisPreviewDTO);
-        } else if(2 == type) {
-            redisCache.setCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_THIS_WEEEK, analysisPreviewDTO);
-        } else if(3 == type) {
-            redisCache.setCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_THIS_MONTH, analysisPreviewDTO);
-        } else if(4 == type) {
-            redisCache.setCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_ANALYSISPREVIEW_BEFORE_MONTH, analysisPreviewDTO);
-        }
-
+        redisCache.setCacheObject(String.format("%s:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type), analysisPreviewDTO);
     }
 
     public void watchEndPlayTrendTask0(){
@@ -239,7 +228,7 @@ public class StatisticsServiceImpl implements IStatisticsService {
         dto.setEndTime(endDate);
 
         List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = deaMemberTopTen(dto);
-        redisCache.setCacheObject(String.format("%s::%d::%d", CHARTS_MEMBER_TOP_TEN_WATCH, type,statisticalType), deaMemberTopTenDTOS);
+        redisCache.setCacheObject(String.format("%s:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type,statisticalType), deaMemberTopTenDTOS);
     }
 
     @Override
@@ -283,7 +272,7 @@ public class StatisticsServiceImpl implements IStatisticsService {
 
         List<CourseStatsDTO> courseStatsDTOS = watchCourseTopTen(dto);
 
-        redisCache.setCacheObject( String.format("%s::%d::%d::%s", CHARTS_WATCH_TOP_TEN, type,statisticalType,sort), courseStatsDTOS);
+        redisCache.setCacheObject( String.format("%s:%d:%d:%s", CHARTS_WATCH_TOP_TEN, type,statisticalType,sort), courseStatsDTOS);
     }
 
     public void watchCourseTopTenTask0(){
@@ -338,6 +327,19 @@ public class StatisticsServiceImpl implements IStatisticsService {
 
         watchCourseTopTenTask(3,3,"DESC");
         watchCourseTopTenTask(3,3,"ASC");
+
+
+        watchCourseTopTenTask(4,0,"DESC");
+        watchCourseTopTenTask(4,0,"ASC");
+
+        watchCourseTopTenTask(4,1,"DESC");
+        watchCourseTopTenTask(4,1,"ASC");
+
+        watchCourseTopTenTask(4,2,"DESC");
+        watchCourseTopTenTask(4,2,"ASC");
+
+        watchCourseTopTenTask(4,3,"DESC");
+        watchCourseTopTenTask(4,3,"ASC");
     }
 
 
@@ -410,7 +412,7 @@ public class StatisticsServiceImpl implements IStatisticsService {
 
         List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = rewardMoneyTopTen(dto);
 
-        redisCache.setCacheObject( String.format("%s::%d::%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType), rewardMoneyTopTenDTOS);
+        redisCache.setCacheObject( String.format("%s:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType), rewardMoneyTopTenDTOS);
 
     }
 
@@ -451,7 +453,7 @@ public class StatisticsServiceImpl implements IStatisticsService {
         dto.setStartTime(startDate);
         dto.setEndTime(endDate);
         List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = rewardMoneyTrendDTO(dto);
-        redisCache.setCacheObject( String.format("%s::%d", CHARTS_REWARD_MONEY_TREND, type), rewardMoneyTrendDTOS);
+        redisCache.setCacheObject( String.format("%s:%d", CHARTS_REWARD_MONEY_TREND, type), rewardMoneyTrendDTOS);
 
     }