Commit f983f414 authored by suhuiguang's avatar suhuiguang

1.增加时间-tzs

2.自动任务表达式放到配置文件-tzs
parent 1a87b195
......@@ -19,7 +19,7 @@ public class CylinderSchedulerJob {
/**
* 每天9点-日报生成
*/
@Scheduled(cron = "0 0 9 * * ?")
@Scheduled(cron = "${cylinder-early-warning-cron:0 0 9 * * ?}")
public void dayReport() {
cylinderInfoService.calEarlyWarningLevel();
}
......
......@@ -27,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Consumer;
......@@ -627,6 +628,12 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
private void touchRuleToCalLevel(CylinderInfo r) {
Date now = new Date();
String dateStr;
try {
dateStr = DateUtils.dateFormat(now,DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
throw new RuntimeException("日期个时候失败");
}
//1.气瓶详情
CylinderInfoDto cylinderInfoDto = this.getDetail(r.getSequenceCode());
try {
......@@ -641,13 +648,14 @@ public class CylinderInfoServiceImpl extends BaseService<CylinderInfoDto, Cylind
cylWarningMsgDto.setCompanyName(cylinderInfoDto.getUnitName());
cylWarningMsgDto.setPhone(cylinderInfoDto.getPersonMobilePhone());
cylWarningMsgDto.setPeople(cylinderInfoDto.getUnitPerson());
cylWarningMsgDto.setCurrentTime(dateStr);
// 2.循环调用规则 触发计算等级及发送消息
if (log.isInfoEnabled()) {
log.info("调用规则对象!+:{}", JSON.toJSONString(cylWarningMsgDto));
}
ruleTrigger.publish(cylWarningMsgDto, packageId, null);
} catch (Exception e) {
log.error("调用规则失败!:{}", JSON.toJSONString(cylinderInfoDto));
log.error("调用规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto),e);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment