| 
					
				 | 
			
			
				@@ -0,0 +1,197 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+package com.fs.api.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.core.redis.RedisCache; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.statis.StatisticsRedisConstant; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.statis.dto.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.fs.common.core.domain.R; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.ArrayList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import static com.fs.statis.StatisticsRedisConstant.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ * 首页-统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@RequestMapping("/index/statistics") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+public class IndexStatisticsController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private RedisCache redisCache; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 分析概览 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/analysisPreview") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R analysisPreview(@RequestBody AnalysisPreviewQueryDTO param){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AnalysisPreviewDTO analysisPreviewDTO = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer type = param.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer userType = param.getUserType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(type == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(userType == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userType = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        analysisPreviewDTO = redisCache.getCacheObject(String.format("%s:%d:%d",DATA_OVERVIEW_DEALER_ANALYSISPREVIEW,type,userType)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data",analysisPreviewDTO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 消费余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/rechargeComsumption") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R rechargeComsumption(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ConsumptionBalanceDataDTO consumptionBalanceDataDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_BALANCE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data", consumptionBalanceDataDTO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 获取统计流量 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/trafficLog") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R getTrafficLog(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        TrafficLogDTO trafficLogDTO = redisCache.getCacheObject(DATA_OVERVIEW_TRAFFIC_LOG); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data",trafficLogDTO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 观看趋势 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/watchEndPlayTrend") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R watchEndPlayTrend(@RequestBody AnalysisPreviewQueryDTO param){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer type = param.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer userType = param.getUserType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(type == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(userType == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userType = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String key = String.format("%s:%d:%d", DATA_OVERVIEW_DEALER_CHARTS, type,userType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(key); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data", deaMemberTopTenDTOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 经销商会员观看 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/deaMemberTopTen") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R deaMemberTopTen(@RequestBody AnalysisPreviewQueryDTO param){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer type = param.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer statisticalType = param.getStatisticalType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer userType = param.getUserType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(type == null) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            type = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(userType == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            userType = 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d", CHARTS_MEMBER_TOP_TEN_WATCH, type, statisticalType,userType)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(deaMemberTopTenDTOS == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            deaMemberTopTenDTOS = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data", deaMemberTopTenDTOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 奖励金额top10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/rewardMoneyTopTen") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R rewardMoneyTopTen(@RequestBody AnalysisPreviewQueryDTO param){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer type = param.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer dataType = param.getDataType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer userType = param.getUserType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = redisCache.getCacheObject( String.format("%s:%d:%d:%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType,userType)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data", rewardMoneyTopTenDTOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 答题红包金额趋势图 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/rewardMoneyTrend") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R rewardMoneyTrend(@RequestBody AnalysisPreviewQueryDTO param){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer type = param.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer userType = param.getUserType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = redisCache.getCacheObject( String.format("%s:%d:%d", CHARTS_REWARD_MONEY_TREND, type,userType)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data", rewardMoneyTrendDTOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 课程观看top10 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @PostMapping("/watchCourseTopTen") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R watchCourseTopTen(@RequestBody AnalysisPreviewQueryDTO param){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer type = param.getType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String sort = param.getSort(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer statisticalType = param.getStatisticalType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Integer userType = param.getUserType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<CourseStatsDTO> courseStatsDTOS = redisCache.getCacheObject(String.format("%s:%d:%d:%d:%s", CHARTS_WATCH_TOP_TEN, type,statisticalType,userType,sort)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data", courseStatsDTOS); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 数据概览 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/dealerAggregated") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R dealerAggregated(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        DealerAggregatedDTO dealerAggregatedDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_AGGREGATED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data",dealerAggregatedDTO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 短信余额 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/smsBalance") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R smsBalance(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long smsBalance = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_SMS_BALANCE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data", smsBalance); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 授权信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/authorizationInfo") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R authorizationInfo(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AuthorizationInfoDTO authorizationInfoDTO = redisCache.getCacheObject(StatisticsRedisConstant.DATA_OVERVIEW_DEALER_AUTHORIZATION_INFO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok().put("data", authorizationInfoDTO); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 当月订单数统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/thisMonthOrderCount") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R thisMonthOrderCount(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        R result = redisCache.getCacheObject(StatisticsRedisConstant.THIS_MONTH_ORDER_COUNT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 当月收益统计 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/thisMonthRecvCount") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R thisMonthRecvCount(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        R result = redisCache.getCacheObject(StatisticsRedisConstant.THIS_MONTH_RECV_COUNT); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 |