提交 | 用户 | 时间
|
9788d4
|
1 |
package com.iailab.module.shasteel.job.task; |
D |
2 |
|
|
3 |
import com.iailab.module.model.api.mdk.MdkApi; |
|
4 |
import com.iailab.module.model.api.mdk.dto.MdkScheduleReqDTO; |
|
5 |
import com.iailab.module.model.api.mdk.dto.MdkScheduleRespDTO; |
|
6 |
import org.slf4j.Logger; |
|
7 |
import org.slf4j.LoggerFactory; |
|
8 |
import org.springframework.beans.factory.annotation.Autowired; |
|
9 |
import org.springframework.stereotype.Component; |
|
10 |
|
|
11 |
import java.util.Calendar; |
|
12 |
|
|
13 |
/** |
|
14 |
* 执行调度方案定时任务 |
|
15 |
* |
|
16 |
*/ |
|
17 |
@Component("runScheduleModuleTask") |
|
18 |
public class RunScheduleModuleTask implements ITask { |
|
19 |
private Logger logger = LoggerFactory.getLogger(getClass()); |
|
20 |
|
|
21 |
@Autowired |
|
22 |
private MdkApi mdkApi; |
|
23 |
|
|
24 |
|
|
25 |
@Override |
|
26 |
public void run(String params) { |
|
27 |
logger.info("runScheduleModuleTask定时任务正在执行,参数为:{}",params ); |
|
28 |
try { |
|
29 |
Calendar calendar = Calendar.getInstance(); |
|
30 |
calendar.set(Calendar.SECOND,0); |
|
31 |
calendar.set(Calendar.MILLISECOND,0); |
|
32 |
|
|
33 |
MdkScheduleReqDTO dto = new MdkScheduleReqDTO(); |
|
34 |
dto.setScheduleTime(calendar.getTime()); |
|
35 |
dto.setScheduleCode(params); |
|
36 |
MdkScheduleRespDTO mdkScheduleRespDTO = mdkApi.doSchedule(dto); |
|
37 |
logger.info(params + "调度方案执行完成," + mdkScheduleRespDTO); |
|
38 |
|
|
39 |
} catch (Exception ex) { |
|
40 |
logger.error("runScheduleModuleTask运行异常"); |
|
41 |
ex.printStackTrace(); |
|
42 |
} |
|
43 |
logger.info("runScheduleModuleTask运行完成"); |
|
44 |
} |
|
45 |
} |