Skip to content

Commit

Permalink
修复consumer每日任务更新会员评价异常问题;优化生成每日秒杀活动
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiGaoRobot committed Aug 25, 2022
1 parent cc95fa9 commit 558eea9
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cn.lili.event.impl;


import cn.hutool.core.text.CharSequenceUtil;
import cn.lili.common.utils.CurrencyUtil;
import cn.lili.common.utils.StringUtils;
import cn.lili.event.AfterSaleStatusChangeEvent;
import cn.lili.event.GoodsCommentCompleteEvent;
import cn.lili.event.MemberRegisterEvent;
Expand Down Expand Up @@ -104,7 +104,7 @@ public void orderChange(OrderMessage orderMessage) {
case COMPLETED: {
Order order = orderService.getBySn(orderMessage.getOrderSn());
//如果是积分订单 则直接返回
if (StringUtils.isNotEmpty(order.getOrderPromotionType())
if (CharSequenceUtil.isNotEmpty(order.getOrderPromotionType())
&& order.getOrderPromotionType().equals(OrderPromotionTypeEnum.POINTS.name())) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package cn.lili.timetask.handler.impl.promotion;

import cn.lili.common.enums.PromotionTypeEnum;
import cn.lili.modules.promotion.entity.dos.Seckill;
import cn.lili.modules.promotion.service.SeckillService;
import cn.lili.modules.promotion.tools.PromotionTools;
import cn.lili.modules.search.service.EsGoodsIndexService;
import cn.lili.modules.system.entity.dos.Setting;
import cn.lili.modules.system.entity.dto.SeckillSetting;
import cn.lili.modules.system.entity.enums.SettingEnum;
import cn.lili.modules.system.service.SettingService;
import cn.lili.timetask.handler.EveryDayExecute;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.gson.Gson;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -72,10 +73,9 @@ private void addSeckill() {
for (int i = 1; i <= SeckillService.PRE_CREATION; i++) {
Seckill seckill = new Seckill(i, seckillSetting.getHours(), seckillSetting.getSeckillRule());

LambdaQueryWrapper<Seckill> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(Seckill::getStartTime, seckill.getStartTime());
//如果已经存在促销,则不再次保存
if (seckillService.list(lambdaQueryWrapper).isEmpty()) {
if (seckillService.list(
PromotionTools.checkActiveTime(seckill.getStartTime(), seckill.getEndTime(), PromotionTypeEnum.SECKILL, null, seckill.getId())).isEmpty()) {
boolean result = seckillService.savePromotions(seckill);
log.info("生成秒杀活动参数:{},结果:{}", seckill, result);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public void checkMemberEvaluation(OrderItem orderItem, Order order) {
}

//判断是否是当前会员的订单
if (!order.getMemberId().equals(UserContext.getCurrentUser().getId())) {
if (UserContext.getCurrentUser() != null && !order.getMemberId().equals(UserContext.getCurrentUser().getId())) {
throw new ServiceException(ResultCode.ORDER_NOT_USER);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,8 @@ public static <T extends BasePromotions> QueryWrapper<T> checkActiveTime(Date st
} else {
queryWrapper.ge(START_TIME_COLUMN, DateUtil.beginOfDay(startTime)).le(END_TIME_COLUMN, DateUtil.endOfDay(endTime));
}
if (storeId != null) {
queryWrapper.eq("store_id", storeId);
}
if (activityId != null) {
queryWrapper.ne("id", activityId);
}
queryWrapper.eq(CharSequenceUtil.isNotEmpty(storeId), "store_id", storeId);
queryWrapper.ne(CharSequenceUtil.isNotEmpty(activityId), "id", activityId);
queryWrapper.and(i -> i.or(queryPromotionStatus(PromotionsStatusEnum.NEW)).or(queryPromotionStatus(PromotionsStatusEnum.START)));
queryWrapper.eq("delete_flag", false);
return queryWrapper;
Expand Down

0 comments on commit 558eea9

Please sign in to comment.