秒杀注释增加,秒杀设置天数变为常量设置
This commit is contained in:
parent
eb19b8f218
commit
c12dd02f8a
@ -9,6 +9,7 @@ import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartVO;
|
||||
import cn.lili.modules.order.cart.render.CartRenderStep;
|
||||
import cn.lili.modules.order.order.entity.dto.PriceDetailDTO;
|
||||
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
|
||||
import cn.lili.modules.promotion.entity.enums.KanJiaStatusEnum;
|
||||
import cn.lili.modules.promotion.entity.vos.PromotionSkuVO;
|
||||
import cn.lili.modules.promotion.entity.vos.kanjia.KanjiaActivitySearchParams;
|
||||
@ -122,9 +123,22 @@ public class SkuPromotionRender implements CartRenderStep {
|
||||
case CART:
|
||||
case BUY_NOW:
|
||||
case VIRTUAL:
|
||||
//循环购物车
|
||||
for (CartVO cartVO : tradeDTO.getCartList()) {
|
||||
//循环sku
|
||||
for (CartSkuVO cartSkuVO : cartVO.getSkuList()) {
|
||||
//更新商品促销
|
||||
promotionGoodsService.updatePromotion(cartSkuVO);
|
||||
//赋予商品促销信息
|
||||
for (PromotionGoods promotionGoods : cartSkuVO.getPromotions()) {
|
||||
|
||||
PromotionSkuVO promotionSkuVO = new PromotionSkuVO(promotionGoods.getPromotionType(), promotionGoods.getPromotionId());
|
||||
cartSkuVO.setPurchasePrice(promotionGoods.getPrice());
|
||||
cartSkuVO.setSubTotal(CurrencyUtil.mul(promotionGoods.getPrice(), cartSkuVO.getNum()));
|
||||
cartSkuVO.getPriceDetailDTO().setGoodsPrice(cartSkuVO.getSubTotal());
|
||||
|
||||
cartSkuVO.getPriceDetailDTO().getJoinPromotion().add(promotionSkuVO);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -60,6 +60,10 @@ import java.util.stream.Collectors;
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class SeckillServiceImpl extends ServiceImpl<SeckillMapper, Seckill> implements SeckillService {
|
||||
|
||||
/**
|
||||
* 预创建活动数量
|
||||
*/
|
||||
private final Integer preCreation = 30;
|
||||
/**
|
||||
* 延时任务
|
||||
*/
|
||||
@ -139,7 +143,7 @@ public class SeckillServiceImpl extends ServiceImpl<SeckillMapper, Seckill> impl
|
||||
|
||||
Setting setting = settingService.get(SettingEnum.SECKILL_SETTING.name());
|
||||
SeckillSetting seckillSetting = new Gson().fromJson(setting.getSettingValue(), SeckillSetting.class);
|
||||
for (int i = 1; i <= 30; i++) {
|
||||
for (int i = 1; i <= preCreation; i++) {
|
||||
Seckill seckill = new Seckill(i, seckillSetting.getHours(), seckillSetting.getSeckillRule());
|
||||
this.saveSeckill(seckill);
|
||||
}
|
||||
@ -290,7 +294,7 @@ public class SeckillServiceImpl extends ServiceImpl<SeckillMapper, Seckill> impl
|
||||
*
|
||||
* @param seckill 秒杀活动
|
||||
*/
|
||||
private void addSeckillStartTask(SeckillVO seckill) {
|
||||
public void addSeckillStartTask(SeckillVO seckill) {
|
||||
PromotionMessage promotionMessage = new PromotionMessage(seckill.getId(), PromotionTypeEnum.SECKILL.name(), PromotionStatusEnum.START.name(), seckill.getStartTime(), seckill.getEndTime());
|
||||
TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.PROMOTION_EXECUTOR,
|
||||
seckill.getStartTime().getTime(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user