提交 | 用户 | 时间
|
94c44e
|
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.MdkPredictReqDTO; |
|
5 |
import org.slf4j.Logger; |
|
6 |
import org.slf4j.LoggerFactory; |
|
7 |
import org.springframework.beans.factory.annotation.Autowired; |
|
8 |
import org.springframework.stereotype.Component; |
|
9 |
|
|
10 |
import java.util.Calendar; |
|
11 |
|
|
12 |
/** |
|
13 |
* 执行模块预测定时任务 |
|
14 |
* |
|
15 |
*/ |
|
16 |
@Component("runPredictModuleTask") |
|
17 |
public class RunPredictModuleTask implements ITask { |
|
18 |
private Logger logger = LoggerFactory.getLogger(getClass()); |
|
19 |
|
|
20 |
@Autowired |
|
21 |
MdkApi mdkApi; |
|
22 |
|
|
23 |
|
|
24 |
@Override |
|
25 |
public void run(String params) { |
|
26 |
logger.info("runPredictModuleTask定时任务正在执行,参数为:{}",params ); |
|
27 |
try { |
|
28 |
Calendar calendar = Calendar.getInstance(); |
|
29 |
calendar.set(Calendar.SECOND,0); |
|
30 |
calendar.set(Calendar.MILLISECOND,0); |
|
31 |
|
|
32 |
MdkPredictReqDTO dto = new MdkPredictReqDTO(); |
|
33 |
dto.setPredictTime(calendar.getTime()); |
|
34 |
dto.setModuleType(params); |
|
35 |
mdkApi.predictModule(dto); |
|
36 |
logger.info(params + "模块预测完成"); |
|
37 |
|
|
38 |
|
|
39 |
} catch (Exception ex) { |
|
40 |
logger.error("runPredictModuleTask运行异常"); |
|
41 |
ex.printStackTrace(); |
|
42 |
} |
|
43 |
logger.info("runPredictModuleTask运行完成"); |
|
44 |
} |
|
45 |
} |