From 37cc358f8a50c287d99b6fde1af2b1a4ba427d4d Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Sun, 5 Mar 2023 21:00:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E8=AE=A2=E9=98=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../utils/FirePointSubscribeManager.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) 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; } - }