法规预警--6个月和12个月数据颜色区分

This commit is contained in:
zhn
2022-08-17 17:00:11 +08:00
parent c7350ea509
commit 6e84880174
@@ -144,10 +144,10 @@ public class LawsWarnService {
String beforeTimeTwelve = beforeTime(12,new Date()); String beforeTimeTwelve = beforeTime(12,new Date());
Date parseSix = sdf.parse(beforeTimeSix); Date parseSix = sdf.parse(beforeTimeSix);
Date parseTwelve = sdf.parse(beforeTimeTwelve); Date parseTwelve = sdf.parse(beforeTimeTwelve);
if(newCarTimeDate.after(new Date()) && newCarTimeDate.before(parseSix)){ if((newCarTimeDate.after(new Date()) && newCarTimeDate.before(parseSix)) || newCarTime.equals(beforeTimeSix)){
record.put("new_colour","red"); record.put("new_colour","red");
} }
if(newCarTimeDate.after(parseSix) && newCarTimeDate.before(parseTwelve)){ if((newCarTimeDate.after(parseSix) && newCarTimeDate.before(parseTwelve)) || newCarTime.equals(beforeTimeTwelve)){
record.put("new_colour","yellow"); record.put("new_colour","yellow");
} }
} }
@@ -158,16 +158,16 @@ public class LawsWarnService {
if(StringUtils.isNotBlank(implementTime) && !"null".equals(implementTime)){ if(StringUtils.isNotBlank(implementTime) && !"null".equals(implementTime)){
try { try {
if(Integer.parseInt(String.valueOf(parameter.get("flag"))) == 1){ if(Integer.parseInt(String.valueOf(parameter.get("flag"))) == 1){
Date newCarTimeDate = sdf.parse(implementTime); Date implementTimeDate = sdf.parse(implementTime);
//当前时间的前6个月 //当前时间的前6个月
String beforeTimeSix = beforeTime(6,new Date()); String beforeTimeSix = beforeTime(6,new Date());
String beforeTimeTwelve = beforeTime(12,new Date()); String beforeTimeTwelve = beforeTime(12,new Date());
Date parseSix = sdf.parse(beforeTimeSix); Date parseSix = sdf.parse(beforeTimeSix);
Date parseTwelve = sdf.parse(beforeTimeTwelve); Date parseTwelve = sdf.parse(beforeTimeTwelve);
if(newCarTimeDate.after(new Date()) && newCarTimeDate.before(parseSix)){ if((implementTimeDate.after(new Date()) && implementTimeDate.before(parseSix)) || implementTime.equals(beforeTimeSix)){
record.put("implement_colour","red"); record.put("implement_colour","red");
} }
if(newCarTimeDate.after(parseSix) && newCarTimeDate.before(parseTwelve)){ if((implementTimeDate.after(parseSix) && implementTimeDate.before(parseTwelve)) || implementTime.equals(beforeTimeTwelve)){
record.put("implement_colour","yellow"); record.put("implement_colour","yellow");
} }
} }