diff --git a/src/main/java/com/xkrs/straw/utils/FirePointSubscribeManager.java b/src/main/java/com/xkrs/straw/utils/FirePointSubscribeManager.java index 986ec0e..166eb17 100644 --- a/src/main/java/com/xkrs/straw/utils/FirePointSubscribeManager.java +++ b/src/main/java/com/xkrs/straw/utils/FirePointSubscribeManager.java @@ -83,11 +83,24 @@ public class FirePointSubscribeManager { return timeRangeList; } + /** + * 判断targetTime是否属于timeRangeList范围内 + * 实际应用:也就是当前时间是否属于防火季 + */ private boolean checkIfIn(List timeRangeList, LocalDateTime targetTime) { - + for (LocalDateTimeRange timeRange : timeRangeList) { + LocalDateTime startTime = timeRange.getStartTime(); + LocalDateTime endTime = timeRange.getEndTime(); + if (startTime.isBefore(targetTime) && endTime.isAfter(targetTime)) { + return true; + } + } return false; } + /** + * 获取全部VIP用户的区划编码 + */ private List obtainCountyCodeList(List sysUserEntityList) { List countyCodeList = new ArrayList<>(); for (SysUserEntity sysUserEntity : sysUserEntityList) { @@ -101,6 +114,7 @@ public class FirePointSubscribeManager { /** * 合并区划编码 + * 将获取的全部VIP用户的区划编码,进行合并,去除冗余 */ private List mergeCountyCodeList(List countyCodeList) { List mergedCountyCodeList = new ArrayList<>(); @@ -121,7 +135,7 @@ public class FirePointSubscribeManager { } /** - * 检查是否被合并过了 + * 在mergedCountyCodeList中检查传入的countyCode是否被合并过了 * DataWrapper4 * Boolean 是否被合并了 * Boolean 如果1==true则2失效,如果1==false则2表示这个未被合并的数据是否需要替换,如果2==true则将3替换成4,如果2==false则只添加4,忽略3 @@ -133,10 +147,7 @@ public class FirePointSubscribeManager { try { String cutMergedCountyCode = FirePointCodeUtils.getFormatCutCode(mergedCountyCode); String cutCountyCode = FirePointCodeUtils.getFormatCutCode(countyCode); - if (cutCountyCode.equals(cutMergedCountyCode)) { - continue; - } - if (cutCountyCode.startsWith(cutMergedCountyCode)) { + if (cutCountyCode.equals(cutMergedCountyCode) || cutCountyCode.startsWith(cutMergedCountyCode)) { return new DataWrapper4<>(Boolean.TRUE, null, null, null); } if (cutMergedCountyCode.startsWith(cutCountyCode)) { @@ -168,5 +179,4 @@ public class FirePointSubscribeManager { return redundantMergedCountyCodeList; } - }