houzhongjian
2024-07-23 a6de490948278991e47952e90671ddba4555e9a2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.iailab.module.job.task;
 
import com.iailab.common.utils.DateUtils;
import com.iailab.module.any.service.AnyProcReportDetService;
import com.iailab.module.any.service.AnyProcReportService;
import com.iailab.module.device.service.DeviceHealthReportDataService;
import com.iailab.module.device.service.DeviceHealthReportService;
import com.iailab.module.mcs.service.StModelResultService;
import com.iailab.module.mcs.service.StModelRunlogService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
 
import java.util.Date;
import java.util.Map;
 
/**
 * 迁移表数据
 *
 */
@Component("migrationTableDataTask")
public class MigrationTableDataTask implements ITask {
    private Logger logger = LoggerFactory.getLogger(getClass());
 
 
    @Resource
    private DeviceHealthReportDataService deviceHealthReportDataService;
 
    @Resource
    private DeviceHealthReportService deviceHealthReportService;
 
    @Resource
    private StModelResultService stModelCommonResultService;
 
    @Resource
    private StModelRunlogService stModelRunlogService;
 
    @Resource
    private AnyProcReportDetService anyProcReportDetService;
 
    @Resource
    private AnyProcReportService anyProcReportService;
 
    @Override
    public void run(String params) {
        logger.info("migrationTableDataTask定时任务正在执行,参数为:{}",params );
        try {
            int days = -90;
            if (StringUtils.isNotBlank(params)) {
                days = Math.abs(Integer.parseInt(params)) * -1;
            }
            Map<String, Date> tMap = DateUtils.getIntervalDate(days);
            deviceHealthReportDataService.migrationDeviceHealthReportData(tMap);
            deviceHealthReportService.migrationDeviceHealthReport(tMap);
            stModelCommonResultService.migrationModelResult(tMap);
            stModelRunlogService.migrationModelRunlog(tMap);
            anyProcReportService.migrationProcReport(tMap);
            anyProcReportDetService.migrationProcReportDet(tMap);
        } catch (Exception ex) {
            logger.error("migrationTableDataTask运行异常");
            ex.printStackTrace();
        }
        logger.info("migrationTableDataTask运行完成");
    }
}