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;
|
|
/**
|
* 旋流浓缩控制诊断
|
* 10 0 0/2 * * ?
|
*
|
* @author PanZhibao
|
* @Description
|
* @createTime 2024年06月26日
|
*/
|
@Component("anyProc6Task")
|
public class AnyProc6Task implements ITask {
|
|
private Logger logger = LoggerFactory.getLogger(getClass());
|
|
private final String MODEL_CODE = "thickener_xl_analyis";
|
|
private final String CARD_CODE = "C06";
|
|
private final String REPORT_NAME = "旋流浓缩控制诊断";
|
|
@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("qs_str") + ";");
|
sb.append(modelCommonResult.get("yl_str") + ";");
|
sb.append(modelCommonResult.get("dl_str") + ";");
|
|
// 更新状态
|
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);
|
}
|
}
|