package com.moral.api.task; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.moral.api.service.HistoryDailyService; import com.moral.api.service.HistoryFiveMinutelyService; import com.moral.api.service.HistoryWeeklyService; import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.context.XxlJobHelper; import com.xxl.job.core.handler.annotation.XxlJob; @Component public class HistoryTableInsertTask { @Autowired private HistoryFiveMinutelyService historyFiveMinutelyService; @Autowired private HistoryDailyService historyDailyService; @Autowired private HistoryWeeklyService historyWeeklyService; //5分钟数据统计 @XxlJob("insertHistoryFiveMinutely") public ReturnT insertHistoryFiveMinutely() { try { historyFiveMinutelyService.insertHistoryFiveMinutely(); } catch (Exception e) { XxlJobHelper.log(e.getMessage()); return ReturnT.FAIL; } return ReturnT.SUCCESS; } //天数据统计 @XxlJob("insertHistoryDaily") public ReturnT insertHistoryDaily() { try { historyDailyService.insertHistoryDaily(); } catch (Exception e) { XxlJobHelper.log(e.getMessage()); return ReturnT.FAIL; } return ReturnT.SUCCESS; } //周数据统计 @XxlJob("insertHistoryWeekly") public ReturnT insertHistoryWeekly() { try { historyWeeklyService.insertHistoryWeekly(); } catch (Exception e) { XxlJobHelper.log(e.getMessage()); return ReturnT.FAIL; } return ReturnT.SUCCESS; } }