优化代码,修复编辑秒杀活动时执行顺序问题

This commit is contained in:
paulGao 2022-03-07 14:43:17 +08:00
parent f4d7c07f57
commit 348f362b30
5 changed files with 5 additions and 7 deletions

View File

@ -74,7 +74,7 @@ public class SkuPromotionRender implements CartRenderStep {
renderBasePrice(tradeDTO);
//渲染单品促销
renderSkuPromotion(tradeDTO);
//检查促销库存
checkPromotionQuantity(tradeDTO);

View File

@ -185,7 +185,6 @@ public class CartServiceImpl implements CartService {
//购物车中不存在此商品则新建立一个
CartSkuVO cartSkuVO = new CartSkuVO(dataSku, promotionMap);
this.checkSetGoodsQuantity(cartSkuVO, skuId, num);
cartSkuVO.setCartType(cartTypeEnum);
//检测购物车数据
checkCart(cartTypeEnum, cartSkuVO, skuId, num);

View File

@ -232,8 +232,6 @@ public class PromotionGoodsServiceImpl extends ServiceImpl<PromotionGoodsMapper,
this.update(updateWrapper);
stringRedisTemplate.opsForValue().set(promotionStockKey, promotionGoods.getQuantity().toString());
}
}
/**

View File

@ -150,7 +150,6 @@ public class PromotionServiceImpl implements PromotionService {
searchParams.setSkuId(promotionGoods.getSkuId());
List<SeckillApply> seckillApplyList = seckillApplyService.getSeckillApplyList(searchParams);
if (seckillApplyList != null && !seckillApplyList.isEmpty()) {
SeckillApply seckillApply = seckillApplyList.get(0);
String[] split = seckill.getHours().split(",");
int[] hoursSored = Arrays.stream(split).mapToInt(Integer::parseInt).toArray();
Arrays.sort(hoursSored);
@ -158,7 +157,6 @@ public class PromotionServiceImpl implements PromotionService {
seckill.setEndTime(promotionGoods.getEndTime());
promotionMap.put(esPromotionKey, seckill);
}
}
}

View File

@ -146,8 +146,11 @@ public class SeckillServiceImpl extends AbstractPromotionsServiceImpl<SeckillMap
@Override
@Transactional(rollbackFor = Exception.class)
public boolean updatePromotions(Seckill promotions) {
this.checkStatus(promotions);
this.checkPromotions(promotions);
boolean result = this.updateById(promotions);
seckillApplyService.updateSeckillApplyTime(promotions);
return this.saveOrUpdate(promotions);
return result;
}
/**