|
@@ -24,9 +24,10 @@ import java.time.format.DateTimeFormatter;
|
|
import java.time.temporal.TemporalAdjusters;
|
|
import java.time.temporal.TemporalAdjusters;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import static com.fs.statis.StatisticsRedisConstant.CHARTS_MEMBER_TOP_TEN_WATCH;
|
|
import static com.fs.statis.StatisticsRedisConstant.DATA_OVERVIEW_DEALER_CHARTS;
|
|
import static com.fs.statis.StatisticsRedisConstant.DATA_OVERVIEW_DEALER_CHARTS;
|
|
|
|
|
|
-@Service
|
|
|
|
|
|
+@Service("statisticsService")
|
|
public class StatisticsServiceImpl implements IStatisticsService {
|
|
public class StatisticsServiceImpl implements IStatisticsService {
|
|
@Autowired
|
|
@Autowired
|
|
private ConsumptionBalanceMapper consumptionBalanceMapper;
|
|
private ConsumptionBalanceMapper consumptionBalanceMapper;
|
|
@@ -185,6 +186,73 @@ public class StatisticsServiceImpl implements IStatisticsService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @Scheduled(cron = "0 0/15 * * * *")
|
|
|
|
+ public void companyWatchCourseTopTenTask0(){
|
|
|
|
+ companyWatchCourseTopTenTask(0,0);
|
|
|
|
+ companyWatchCourseTopTenTask(0,1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// @Scheduled(cron = "0 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
|
|
@Override
|
|
public void watchCourseTopTenTask() {
|
|
public void watchCourseTopTenTask() {
|
|
|
|
|