Commit 1eb9d476 authored by zhangyingbin's avatar zhangyingbin

气瓶预警消息规则调用接口修改

parent 7fcae706
...@@ -25,6 +25,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -25,6 +25,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -149,13 +150,21 @@ public class ScheduleService { ...@@ -149,13 +150,21 @@ public class ScheduleService {
CylinderInfoDto cylinderInfoDto = this.getCylDetail(r.getSequenceCode()); CylinderInfoDto cylinderInfoDto = this.getCylDetail(r.getSequenceCode());
try { try {
WarningMsgDto warningMsgDto = new WarningMsgDto(); WarningMsgDto warningMsgDto = new WarningMsgDto();
//没有下次检验日期的气瓶默认正常
if(!ValidationUtil.isEmpty(cylinderInfoDto.getNextInspectionDate())){
System.out.println("气瓶编号为:"+cylinderInfoDto.getSequenceCode()+"的气瓶,没有下次检验日期数据");
return;
}
int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1; int interval = DateUtils.dateBetweenIncludeToday(now, cylinderInfoDto.getNextInspectionDate()) - 1;
if(interval<30 && interval>=0){ if(interval<30 && interval>=0){
warningMsgDto.setOverType("即将超期"); warningMsgDto.setOverType("即将超期");
}else if(interval<0){ }else if(interval<0){
warningMsgDto.setOverType("已超期"); warningMsgDto.setOverType("已超期");
}else{ }else{
//正常的气瓶不需要发消息
warningMsgDto.setOverType("正常"); warningMsgDto.setOverType("正常");
return;
} }
warningMsgDto.setNextInspectDate(new SimpleDateFormat("yyyy-MM-dd").format(cylinderInfoDto.getNextInspectionDate())); warningMsgDto.setNextInspectDate(new SimpleDateFormat("yyyy-MM-dd").format(cylinderInfoDto.getNextInspectionDate()));
warningMsgDto.setType("气瓶"); warningMsgDto.setType("气瓶");
......
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