lizijie
2022-01-05 d866a0c52c419156941801ea0008643d1c7f0e04
screen-job/src/main/java/com/moral/api/task/CreateTableTask.java
@@ -1,5 +1,6 @@
package com.moral.api.task;
import com.moral.api.service.AlarmInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -23,6 +24,9 @@
    @Autowired
    private HistoryHourlyService historyHourlyService;
    @Autowired
    private AlarmInfoService alarmInfoService;
    //分钟表创建任务
@@ -82,4 +86,17 @@
        }
        return ReturnT.SUCCESS;
    }
    //小时表创建任务
    @XxlJob("createAlarmInfoTable")
    public ReturnT createAlarmInfoTable() {
        String timeUnits = DateUtils.getDateStringOfMon(1, DateUtils.yyyyMM_EN);
        try {
            alarmInfoService.createTable(timeUnits);
        } catch (Exception e) {
            XxlJobHelper.log(e.getMessage());
            return new ReturnT(ReturnT.FAIL_CODE, e.getMessage());
        }
        return ReturnT.SUCCESS;
    }
}