package com.iailab.module.shasteel.job.task;
|
|
import com.iailab.module.model.api.mdk.MdkApi;
|
import com.iailab.module.model.api.mdk.dto.MdkScheduleReqDTO;
|
import com.iailab.module.model.api.mdk.dto.MdkScheduleRespDTO;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import java.util.Calendar;
|
|
/**
|
* 执行调度方案定时任务
|
*
|
*/
|
@Component("runScheduleModuleTask")
|
public class RunScheduleModuleTask implements ITask {
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
@Autowired
|
private MdkApi mdkApi;
|
|
|
@Override
|
public void run(String params) {
|
logger.info("runScheduleModuleTask定时任务正在执行,参数为:{}",params );
|
try {
|
Calendar calendar = Calendar.getInstance();
|
calendar.set(Calendar.SECOND,0);
|
calendar.set(Calendar.MILLISECOND,0);
|
|
MdkScheduleReqDTO dto = new MdkScheduleReqDTO();
|
dto.setScheduleTime(calendar.getTime());
|
dto.setScheduleCode(params);
|
MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(dto);
|
logger.info(params + "调度方案执行完成," + mdkScheduleRespDTO);
|
|
} catch (Exception ex) {
|
logger.error("runScheduleModuleTask运行异常");
|
ex.printStackTrace();
|
}
|
logger.info("runScheduleModuleTask运行完成");
|
}
|
}
|