!182 修复一个可能出现的获取促销信息的bug

Merge pull request !182 from OceansDeep/feature/pg
This commit is contained in:
OceansDeep 2022-06-07 04:16:37 +00:00 committed by Gitee
commit 7f5675ae3c
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -164,13 +164,16 @@ public class PromotionTools {
}
//移除无效促销活动
return map.entrySet().stream().filter(i -> {
JSONObject promotionsObj = JSONUtil.parseObj(i.getValue());
BasePromotions basePromotions = promotionsObj.toBean(BasePromotions.class);
if (basePromotions.getStartTime() != null && basePromotions.getEndTime() != null) {
return basePromotions.getStartTime().getTime() <= System.currentTimeMillis() && basePromotions.getEndTime().getTime() >= System.currentTimeMillis();
if (i != null) {
JSONObject promotionsObj = JSONUtil.parseObj(i.getValue());
BasePromotions basePromotions = promotionsObj.toBean(BasePromotions.class);
if (basePromotions.getStartTime() != null && basePromotions.getEndTime() != null) {
return basePromotions.getStartTime().getTime() <= System.currentTimeMillis() && basePromotions.getEndTime().getTime() >= System.currentTimeMillis();
}
}
return true;
}).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}).collect(Collectors.toMap(stringObjectEntry -> stringObjectEntry != null ? stringObjectEntry.getKey() : null, stringObjectEntry1 -> stringObjectEntry1 != null ? stringObjectEntry1.getValue() : new BasePromotions()));
}
}