修复一个可能出现的获取促销信息的bug
This commit is contained in:
parent
9ece357e39
commit
5f6bae6fa9
@ -167,17 +167,14 @@ public class PromotionTools {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
//移除无效促销活动
|
//移除无效促销活动
|
||||||
return map.entrySet().stream().filter(i -> {
|
return map.entrySet().stream().filter(Objects::nonNull).filter(i -> {
|
||||||
if (i != null) {
|
JSONObject promotionsObj = JSONUtil.parseObj(i.getValue());
|
||||||
JSONObject promotionsObj = JSONUtil.parseObj(i.getValue());
|
BasePromotions basePromotions = promotionsObj.toBean(BasePromotions.class);
|
||||||
BasePromotions basePromotions = promotionsObj.toBean(BasePromotions.class);
|
if (basePromotions != null && basePromotions.getStartTime() != null && basePromotions.getEndTime() != null) {
|
||||||
if (basePromotions.getStartTime() != null && basePromotions.getEndTime() != null) {
|
return basePromotions.getStartTime().getTime() <= System.currentTimeMillis() && basePromotions.getEndTime().getTime() >= System.currentTimeMillis();
|
||||||
return basePromotions.getStartTime().getTime() <= System.currentTimeMillis() && basePromotions.getEndTime().getTime() >= System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return i.getValue() != null;
|
||||||
return true;
|
}).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> newValue));
|
||||||
}).collect(Collectors.toMap(stringObjectEntry -> stringObjectEntry != null ? stringObjectEntry.getKey() : null, stringObjectEntry1 -> stringObjectEntry1 != null ? stringObjectEntry1.getValue() : new BasePromotions(), (oldValue, newValue) -> newValue));
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("过滤无效促销活动出现异常。异常促销信息:{},异常信息:{} ", map, e);
|
log.error("过滤无效促销活动出现异常。异常促销信息:{},异常信息:{} ", map, e);
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user