优化代码

This commit is contained in:
paulGao 2022-02-24 09:33:36 +08:00
parent 63b84ee69d
commit 627a1d7d5a
3 changed files with 4 additions and 2 deletions

View File

@ -307,6 +307,8 @@ lili:
notice-group: lili_notice_group notice-group: lili_notice_group
notice-send-topic: lili_send_notice_topic notice-send-topic: lili_send_notice_topic
notice-send-group: lili_send_notice_group notice-send-group: lili_send_notice_group
after-sale-topic: lili_after_sale_topic
after-sale-group: lili_after_sale_group
rocketmq: rocketmq:
name-server: 192.168.0.116:9876 name-server: 192.168.0.116:9876
isVIPChannel: false isVIPChannel: false

View File

@ -75,7 +75,7 @@ public class PromotionEverydayExecute implements EveryDayExecute {
LambdaQueryWrapper<Seckill> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Seckill> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(Seckill::getStartTime, seckill.getStartTime()); lambdaQueryWrapper.eq(Seckill::getStartTime, seckill.getStartTime());
//如果已经存在促销则不再次保存 //如果已经存在促销则不再次保存
if (seckillService.list(lambdaQueryWrapper).size() == 0) { if (seckillService.list(lambdaQueryWrapper).isEmpty()) {
boolean result = seckillService.savePromotions(seckill); boolean result = seckillService.savePromotions(seckill);
log.info("生成秒杀活动参数:{},结果:{}", seckill, result); log.info("生成秒杀活动参数:{},结果:{}", seckill, result);
} }

View File

@ -535,7 +535,7 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
if (promotionMap != null && !promotionMap.isEmpty()) { if (promotionMap != null && !promotionMap.isEmpty()) {
//促销不为空则进行清洗 //促销不为空则进行清洗
promotionMap.entrySet().removeIf(i -> { promotionMap.entrySet().removeIf(i -> {
JSONObject promotionJson = (JSONObject) i.getValue(); JSONObject promotionJson = JSONUtil.parseObj(i.getValue());
BasePromotions promotion = promotionJson.toBean(BasePromotions.class); BasePromotions promotion = promotionJson.toBean(BasePromotions.class);
return promotion.getEndTime() != null && promotion.getEndTime().getTime() < DateUtil.date().getTime(); return promotion.getEndTime() != null && promotion.getEndTime().getTime() < DateUtil.date().getTime();
}); });