|  | @@ -24,9 +24,9 @@ import java.time.format.DateTimeFormatter;
 | 
	
		
			
				|  |  |  import java.time.temporal.TemporalAdjusters;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import static com.fs.statis.StatisticsRedisConstant.DATA_OVERVIEW_DEALER_CHARTS;
 | 
	
		
			
				|  |  | +import static com.fs.statis.StatisticsRedisConstant.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -@Service
 | 
	
		
			
				|  |  | +@Service("statisticsService")
 | 
	
		
			
				|  |  |  public class StatisticsServiceImpl implements IStatisticsService {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ConsumptionBalanceMapper consumptionBalanceMapper;
 | 
	
	
		
			
				|  | @@ -185,13 +185,286 @@ public class StatisticsServiceImpl implements IStatisticsService {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Scheduled(cron = "0 0/15 * * * *")
 | 
	
		
			
				|  |  | +    public void companyWatchCourseTopTenTask0(){
 | 
	
		
			
				|  |  | +        companyWatchCourseTopTenTask(0,0);
 | 
	
		
			
				|  |  | +        companyWatchCourseTopTenTask(0,1);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Scheduled(cron = "0 0 1 * * *")
 | 
	
		
			
				|  |  | +    public void companyWatchCourseTopTenTask1(){
 | 
	
		
			
				|  |  | +        companyWatchCourseTopTenTask(1,0);
 | 
	
		
			
				|  |  | +        companyWatchCourseTopTenTask(1,1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        companyWatchCourseTopTenTask(2,0);
 | 
	
		
			
				|  |  | +        companyWatchCourseTopTenTask(2,1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        companyWatchCourseTopTenTask(3,0);
 | 
	
		
			
				|  |  | +        companyWatchCourseTopTenTask(3,1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        companyWatchCourseTopTenTask(4,0);
 | 
	
		
			
				|  |  | +        companyWatchCourseTopTenTask(4,1);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void companyWatchCourseTopTenTask(Integer type,Integer statisticalType) {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
 | 
	
		
			
				|  |  | +        dto.setType(type);
 | 
	
		
			
				|  |  | +        dto.setStatisticalType(statisticalType);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        String startDate = "";
 | 
	
		
			
				|  |  | +        String endDate = "";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        LocalDateTime now = LocalDateTime.now();
 | 
	
		
			
				|  |  | +        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if(0 == type){
 | 
	
		
			
				|  |  | +            startDate = now.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(1 == type){
 | 
	
		
			
				|  |  | +            LocalDateTime yesterday = now.minusDays(1);
 | 
	
		
			
				|  |  | +            startDate = yesterday.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = yesterday.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(2 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
 | 
	
		
			
				|  |  | +            startDate = startOfWeek.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(3 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime startOfMonth = now.withDayOfMonth(1);
 | 
	
		
			
				|  |  | +            startDate = startOfMonth.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(4 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime firstDayOfPreviousMonth = now.minusMonths(1).withDayOfMonth(1);
 | 
	
		
			
				|  |  | +            LocalDateTime lastDayOfPreviousMonth = now.withDayOfMonth(1).minusDays(1);
 | 
	
		
			
				|  |  | +            startDate = firstDayOfPreviousMonth.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = lastDayOfPreviousMonth.format(formatter);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        dto.setStartTime(startDate);
 | 
	
		
			
				|  |  | +        dto.setEndTime(endDate);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<DeaMemberTopTenDTO> deaMemberTopTenDTOS = deaMemberTopTen(dto);
 | 
	
		
			
				|  |  | +        redisCache.setCacheObject(String.format("%s::%d::%d", CHARTS_MEMBER_TOP_TEN_WATCH, type,statisticalType), deaMemberTopTenDTOS);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public void watchCourseTopTenTask(Integer type,Integer statisticalType,String sort) {
 | 
	
		
			
				|  |  | +        AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
 | 
	
		
			
				|  |  | +        dto.setType(type);
 | 
	
		
			
				|  |  | +        dto.setStatisticalType(statisticalType);
 | 
	
		
			
				|  |  | +        dto.setSort(sort);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        String startDate = "";
 | 
	
		
			
				|  |  | +        String endDate = "";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        LocalDateTime now = LocalDateTime.now();
 | 
	
		
			
				|  |  | +        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if(0 == type){
 | 
	
		
			
				|  |  | +            startDate = now.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(1 == type){
 | 
	
		
			
				|  |  | +            LocalDateTime yesterday = now.minusDays(1);
 | 
	
		
			
				|  |  | +            startDate = yesterday.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = yesterday.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(2 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
 | 
	
		
			
				|  |  | +            startDate = startOfWeek.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(3 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime startOfMonth = now.withDayOfMonth(1);
 | 
	
		
			
				|  |  | +            startDate = startOfMonth.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(4 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime firstDayOfPreviousMonth = now.minusMonths(1).withDayOfMonth(1);
 | 
	
		
			
				|  |  | +            LocalDateTime lastDayOfPreviousMonth = now.withDayOfMonth(1).minusDays(1);
 | 
	
		
			
				|  |  | +            startDate = firstDayOfPreviousMonth.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = lastDayOfPreviousMonth.format(formatter);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        dto.setStartTime(startDate);
 | 
	
		
			
				|  |  | +        dto.setEndTime(endDate);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<CourseStatsDTO> courseStatsDTOS = watchCourseTopTen(dto);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        redisCache.setCacheObject( String.format("%s::%d::%d::%s", CHARTS_WATCH_TOP_TEN, type,statisticalType,sort), courseStatsDTOS);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Scheduled(cron = "0 0/15 * * * *")
 | 
	
		
			
				|  |  | +    public void watchCourseTopTenTask0(){
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(0,0,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(0,0,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(0,1,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(0,1,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(0,2,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(0,2,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(0,3,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(0,3,"ASC");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Scheduled(cron = "0 0 1 * * *")
 | 
	
		
			
				|  |  | +    public void watchCourseTopTenTask1(){
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(1,0,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(1,0,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(1,1,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(1,1,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(1,2,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(1,2,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(1,3,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(1,3,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(2,0,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(2,0,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(2,1,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(2,1,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(2,2,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(2,2,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(2,3,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(2,3,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(3,0,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(3,0,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(3,1,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(3,1,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(3,2,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(3,2,"ASC");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(3,3,"DESC");
 | 
	
		
			
				|  |  | +        watchCourseTopTenTask(3,3,"ASC");
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Scheduled(cron = "0 0/15 * * * *")
 | 
	
		
			
				|  |  | +    public void rewardMoneyTask15Minutes(){
 | 
	
		
			
				|  |  | +        rewardMoneyTopTenTask(0,0);
 | 
	
		
			
				|  |  | +        rewardMoneyTopTenTask(0,1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        rewardMoneyTradeTask(0);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Scheduled(cron = "0 0 1 * * *")
 | 
	
		
			
				|  |  | +    public void rewardMoneyTaskEveryday(){
 | 
	
		
			
				|  |  | +        rewardMoneyTopTenTask(1,0);
 | 
	
		
			
				|  |  | +        rewardMoneyTopTenTask(1,1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        rewardMoneyTopTenTask(2,0);
 | 
	
		
			
				|  |  | +        rewardMoneyTopTenTask(2,1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        rewardMoneyTopTenTask(3,0);
 | 
	
		
			
				|  |  | +        rewardMoneyTopTenTask(3,1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        rewardMoneyTopTenTask(4,0);
 | 
	
		
			
				|  |  | +        rewardMoneyTopTenTask(4,1);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        rewardMoneyTradeTask(1);
 | 
	
		
			
				|  |  | +        rewardMoneyTradeTask(2);
 | 
	
		
			
				|  |  | +        rewardMoneyTradeTask(3);
 | 
	
		
			
				|  |  | +        rewardMoneyTradeTask(4);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public void watchCourseTopTenTask() {
 | 
	
		
			
				|  |  | +    public void rewardMoneyTopTenTask(Integer type,Integer dataType) {
 | 
	
		
			
				|  |  | +        AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
 | 
	
		
			
				|  |  | +        dto.setType(type);
 | 
	
		
			
				|  |  | +        dto.setDataType(dataType);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        String startDate = "";
 | 
	
		
			
				|  |  | +        String endDate = "";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        LocalDateTime now = LocalDateTime.now();
 | 
	
		
			
				|  |  | +        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if(0 == type){
 | 
	
		
			
				|  |  | +            startDate = now.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(1 == type){
 | 
	
		
			
				|  |  | +            LocalDateTime yesterday = now.minusDays(1);
 | 
	
		
			
				|  |  | +            startDate = yesterday.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = yesterday.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(2 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
 | 
	
		
			
				|  |  | +            startDate = startOfWeek.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(3 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime startOfMonth = now.withDayOfMonth(1);
 | 
	
		
			
				|  |  | +            startDate = startOfMonth.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(4 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime firstDayOfPreviousMonth = now.minusMonths(1).withDayOfMonth(1);
 | 
	
		
			
				|  |  | +            LocalDateTime lastDayOfPreviousMonth = now.withDayOfMonth(1).minusDays(1);
 | 
	
		
			
				|  |  | +            startDate = firstDayOfPreviousMonth.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = lastDayOfPreviousMonth.format(formatter);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        dto.setStartTime(startDate);
 | 
	
		
			
				|  |  | +        dto.setEndTime(endDate);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        List<RewardMoneyTopTenDTO> rewardMoneyTopTenDTOS = rewardMoneyTopTen(dto);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        redisCache.setCacheObject( String.format("%s::%d::%d", CHARTS_REWARD_MONEY_TOP_TEN, type,dataType), rewardMoneyTopTenDTOS);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  | -    public void rewardMoneyTopTenTask() {
 | 
	
		
			
				|  |  | +    public void rewardMoneyTradeTask(Integer type) {
 | 
	
		
			
				|  |  | +        AnalysisPreviewQueryDTO dto = new AnalysisPreviewQueryDTO();
 | 
	
		
			
				|  |  | +        dto.setType(type);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        String startDate = "";
 | 
	
		
			
				|  |  | +        String endDate = "";
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        LocalDateTime now = LocalDateTime.now();
 | 
	
		
			
				|  |  | +        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if(0 == type){
 | 
	
		
			
				|  |  | +            startDate = now.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(1 == type){
 | 
	
		
			
				|  |  | +            LocalDateTime yesterday = now.minusDays(1);
 | 
	
		
			
				|  |  | +            startDate = yesterday.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = yesterday.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(2 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
 | 
	
		
			
				|  |  | +            startDate = startOfWeek.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(3 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime startOfMonth = now.withDayOfMonth(1);
 | 
	
		
			
				|  |  | +            startDate = startOfMonth.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = now.format(formatter);
 | 
	
		
			
				|  |  | +        } else if(4 == type) {
 | 
	
		
			
				|  |  | +            LocalDateTime firstDayOfPreviousMonth = now.minusMonths(1).withDayOfMonth(1);
 | 
	
		
			
				|  |  | +            LocalDateTime lastDayOfPreviousMonth = now.withDayOfMonth(1).minusDays(1);
 | 
	
		
			
				|  |  | +            startDate = firstDayOfPreviousMonth.format(formatter);
 | 
	
		
			
				|  |  | +            endDate = lastDayOfPreviousMonth.format(formatter);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        dto.setStartTime(startDate);
 | 
	
		
			
				|  |  | +        dto.setEndTime(endDate);
 | 
	
		
			
				|  |  | +        List<RewardMoneyTrendDTO> rewardMoneyTrendDTOS = rewardMoneyTrendDTO(dto);
 | 
	
		
			
				|  |  | +        redisCache.setCacheObject( String.format("%s::%d", CHARTS_REWARD_MONEY_TREND, type), rewardMoneyTrendDTOS);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 |