优化 更新订阅

This commit is contained in:
liuchengqian 2023-03-05 21:00:32 +08:00
parent ea335163b6
commit 37cc358f8a

View File

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