fix: 外标实施日期发消息重复发送问题
This commit is contained in:
+14
-3
@@ -147,15 +147,26 @@ public class ReplaceImplementationDateMsgJob implements Job {
|
|||||||
}
|
}
|
||||||
Map<String, LawsDomesticStandard> standardMap =
|
Map<String, LawsDomesticStandard> standardMap =
|
||||||
standardList.stream().collect(Collectors.toMap(LawsDomesticStandard::getId, es -> es));
|
standardList.stream().collect(Collectors.toMap(LawsDomesticStandard::getId, es -> es));
|
||||||
|
// 获取今天0点
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
cal.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
cal.set(Calendar.MINUTE, 0);
|
||||||
|
cal.set(Calendar.SECOND, 0);
|
||||||
|
cal.set(Calendar.MILLISECOND, 0);
|
||||||
|
Date todayMidnight = cal.getTime();
|
||||||
|
|
||||||
|
// 获取明天0点
|
||||||
|
cal.add(Calendar.DAY_OF_YEAR, 1);
|
||||||
|
Date tomorrowMidnight = cal.getTime();
|
||||||
|
|
||||||
// 根据新认证车实施日期筛选出已经到期的标准
|
// 根据新认证车实施日期筛选出已经到期的标准
|
||||||
for (LawsDomesticStandard es : standardList) {
|
for (LawsDomesticStandard es : standardList) {
|
||||||
Date implementationDate = es.getImplementationDate();
|
Date implementationDate = es.getImplementationDate();
|
||||||
if (implementationDate == null) {
|
if (implementationDate == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 判断当前时间是否大于实施日期且实施日期没到后一天
|
// 判断实施日期大于今天0点小于明天0点
|
||||||
if (implementationDate.getTime() <= System.currentTimeMillis() &&
|
if (implementationDate.equals(todayMidnight) && implementationDate.before(tomorrowMidnight)) {
|
||||||
implementationDate.before(new Date(implementationDate.getTime() + 24 * 60 * 60 * 1000))) {
|
|
||||||
allExpireStandardNumberList.add(es.getStandardNumber());
|
allExpireStandardNumberList.add(es.getStandardNumber());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user