package com.iailab.module.job.task;
|
|
import com.iailab.module.any.dto.AnyProcCardDTO;
|
import com.iailab.module.any.service.AnyProcCardService;
|
import com.iailab.module.any.service.AnyProcReportService;
|
import com.iailab.module.model.handler.ModelHandler;
|
import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory;
|
import javax.annotation.Resource;
|
import org.springframework.stereotype.Component;
|
|
import java.util.Calendar;
|
import java.util.Date;
|
import java.util.Map;
|
|
/**
|
* 浅槽分选307控制诊断
|
* 10 0 0/2 * * ?
|
*
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年06月25日
|
*/
|
@Component("anyProc1Task")
|
public class AnyProc1Task implements ITask {
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
private final String MODEL_CODE = "shallow_separation_diagnosis_307";
|
|
private final String CARD_CODE = "C01";
|
|
private final String REPORT_NAME = "浅槽分选307控制诊断";
|
|
@Resource
|
private ModelHandler modelHandler;
|
|
@Resource
|
private AnyProcCardService anyProcCardService;
|
|
@Resource
|
private AnyProcReportService anyProcReportService;
|
|
|
@Override
|
public void run(String params) {
|
Calendar calendar = Calendar.getInstance();
|
calendar.set(Calendar.MILLISECOND, 0);
|
calendar.set(Calendar.SECOND, 0);
|
try {
|
Map<String, Object> modelCommonResult = modelHandler.run(MODEL_CODE, calendar.getTime());
|
|
StringBuilder sb = new StringBuilder();
|
sb.append(modelCommonResult.get("hj_str_307") + ";");
|
sb.append(modelCommonResult.get("xj_str_307") + ";");
|
sb.append(modelCommonResult.get("mn_str_307") + ";");
|
sb.append(modelCommonResult.get("cxw_str_307") + ";");
|
sb.append(modelCommonResult.get("hj_md_str_307") + ";");
|
sb.append(modelCommonResult.get("hf_str_307") + ";");
|
|
// 更新状态
|
this.updateCard(sb.toString(), calendar.getTime());
|
|
// 生成报告
|
anyProcReportService.saveReport(CARD_CODE, REPORT_NAME, sb.toString(), calendar.getTime());
|
} catch (Exception ex) {
|
logger.error("AnyProc1Task运行异常");
|
ex.printStackTrace();
|
}
|
logger.info("AnyProc1Task运行完成");
|
|
}
|
|
private void updateCard(String content, Date runTime) {
|
AnyProcCardDTO dto = new AnyProcCardDTO();
|
dto.setCode(CARD_CODE);
|
dto.setAlarmInfo(content);
|
dto.setAnyTime(runTime);
|
anyProcCardService.updateByCode(dto);
|
}
|
}
|