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运行完成");
|
}
|
}
|