Merge branch 'master' of gitee.com:beijing_hongye_huicheng/lilishop into feature/pg
This commit is contained in:
@@ -18,13 +18,12 @@ public enum PromotionTypeEnum {
|
||||
FULL_DISCOUNT("满减"),
|
||||
POINTS_GOODS("积分商品"),
|
||||
KANJIA("砍价"),
|
||||
COUPON_ACTIVITY("优惠券活动")
|
||||
;
|
||||
COUPON_ACTIVITY("优惠券活动");
|
||||
|
||||
/**
|
||||
* 拼团秒杀拥有独立库存,如果其他促销也有独立库存涉及库存扣减的,请添加在下方
|
||||
* 有促销库存的活动类型
|
||||
*/
|
||||
static PromotionTypeEnum[] haveStockPromotion = new PromotionTypeEnum[]{PINTUAN, SECKILL, KANJIA};
|
||||
static PromotionTypeEnum[] haveStockPromotion = new PromotionTypeEnum[]{PINTUAN, SECKILL, KANJIA, POINTS_GOODS};
|
||||
|
||||
private final String description;
|
||||
|
||||
|
||||
@@ -241,7 +241,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
//商品审核消息
|
||||
String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.GOODS_AUDIT.name();
|
||||
//发送mq消息
|
||||
rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(goods.getStoreId()), RocketmqSendCallbackBuilder.commonCallback());
|
||||
rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(goods), RocketmqSendCallbackBuilder.commonCallback());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package cn.lili.modules.order.cart.render;
|
||||
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.CartTypeEnum;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
@@ -125,6 +126,8 @@ public class TradeBuilder {
|
||||
if (render.step().equals(step)) {
|
||||
render.render(tradeDTO);
|
||||
}
|
||||
} catch (ServiceException e) {
|
||||
throw e;
|
||||
} catch (Exception e) {
|
||||
log.error("购物车{}渲染异常:", render.getClass(), e);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ public class CartPriceRender implements CartRenderStep {
|
||||
List<CartVO> cartVOS = tradeDTO.getCartList();
|
||||
|
||||
cartVOS.forEach(cartVO -> {
|
||||
|
||||
List<PriceDetailDTO> skuPrices = cartVO.getSkuList().stream().filter(CartSkuVO::getChecked)
|
||||
.map(CartSkuVO::getPriceDetailDTO).collect(Collectors.toList());
|
||||
cartVO.getPriceDetailDTO().accumulationPriceDTO(
|
||||
cartVO.getSkuList().stream().filter(CartSkuVO::getChecked)
|
||||
.map(CartSkuVO::getPriceDetailDTO).collect(Collectors.toList())
|
||||
|
||||
@@ -85,6 +85,13 @@ public class CheckDataRender implements CartRenderStep {
|
||||
private void checkData(TradeDTO tradeDTO) {
|
||||
//循环购物车中的商品
|
||||
for (CartSkuVO cartSkuVO : tradeDTO.getSkuList()) {
|
||||
|
||||
//如果失效,确认sku为未选中状态
|
||||
if (cartSkuVO.getInvalid()) {
|
||||
//设置购物车未选中
|
||||
cartSkuVO.setChecked(false);
|
||||
}
|
||||
|
||||
//缓存中的商品信息
|
||||
GoodsSku dataSku = goodsSkuService.getGoodsSkuByIdFromCache(cartSkuVO.getGoodsSku().getId());
|
||||
//商品有效性判定
|
||||
|
||||
@@ -248,7 +248,7 @@ public class CouponRender implements CartRenderStep {
|
||||
|
||||
// 打折金额=商品金额*折扣/10
|
||||
Double discountCouponPrice = CurrencyUtil.mul(priceDetailDTO.getGoodsPrice(),
|
||||
CurrencyUtil.div(coupon.getDiscount(), 10, 3));
|
||||
CurrencyUtil.sub(1, CurrencyUtil.div(coupon.getDiscount(), 10, 3)));
|
||||
|
||||
//平台券则写入店铺承担优惠券比例
|
||||
if (coupon.getIsPlatform()) {
|
||||
|
||||
@@ -86,7 +86,7 @@ public class SkuPromotionRender implements CartRenderStep {
|
||||
for (CartVO cartVO : tradeDTO.getCartList()) {
|
||||
for (CartSkuVO cartSkuVO : cartVO.getSkuList()) {
|
||||
cartSkuVO.getPriceDetailDTO().setPayPoint(cartSkuVO.getPoint());
|
||||
PromotionSkuVO promotionSkuVO = new PromotionSkuVO(PromotionTypeEnum.PINTUAN.name(), cartSkuVO.getPointsId());
|
||||
PromotionSkuVO promotionSkuVO = new PromotionSkuVO(PromotionTypeEnum.POINTS_GOODS.name(), cartSkuVO.getPointsId());
|
||||
cartSkuVO.getPriceDetailDTO().getJoinPromotion().add(promotionSkuVO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,9 @@ public class MemberCouponServiceImpl extends ServiceImpl<MemberCouponMapper, Mem
|
||||
public List<MemberCoupon> getMemberCoupons() {
|
||||
QueryWrapper<MemberCoupon> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("member_id", UserContext.getCurrentUser().getId());
|
||||
queryWrapper.ge("member_coupon_status", MemberCouponStatusEnum.NEW.name());
|
||||
queryWrapper.ge("start_time", System.currentTimeMillis());
|
||||
queryWrapper.le("end_time", System.currentTimeMillis());
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -206,7 +206,6 @@ public class PintuanServiceImpl extends ServiceImpl<PintuanMapper, Pintuan> impl
|
||||
@Override
|
||||
public boolean addPintuan(PintuanVO pintuan) {
|
||||
PromotionTools.checkPromotionTime(pintuan.getStartTime().getTime(), pintuan.getEndTime().getTime());
|
||||
this.checkSamePromotion(pintuan.getStartTime(), pintuan.getEndTime(), pintuan.getStoreId(), null);
|
||||
pintuan.setPromotionStatus(PromotionStatusEnum.NEW.name());
|
||||
//保存到MYSQL中
|
||||
boolean result = this.save(pintuan);
|
||||
@@ -224,8 +223,6 @@ public class PintuanServiceImpl extends ServiceImpl<PintuanMapper, Pintuan> impl
|
||||
}
|
||||
//检查促销时间
|
||||
PromotionTools.checkPromotionTime(pintuan.getStartTime().getTime(), pintuan.getEndTime().getTime());
|
||||
//检查同一时间,同一店铺,同一类型的促销活动
|
||||
this.checkSamePromotion(pintuan.getStartTime(), pintuan.getEndTime(), pintuan.getStoreId(), pintuan.getId());
|
||||
boolean result = this.updateById(pintuan);
|
||||
if (pintuan.getPromotionGoodsList() != null) {
|
||||
this.updatePintuanPromotionGoods(pintuan);
|
||||
@@ -393,14 +390,10 @@ public class PintuanServiceImpl extends ServiceImpl<PintuanMapper, Pintuan> impl
|
||||
}
|
||||
}
|
||||
|
||||
private void checkSamePromotion(Date startTime, Date endTime, String storeId, String pintuanId) {
|
||||
QueryWrapper<Pintuan> queryWrapper = PromotionTools.checkActiveTime(startTime, endTime, PromotionTypeEnum.PINTUAN, storeId, pintuanId);
|
||||
List<Pintuan> list = this.list(queryWrapper);
|
||||
if (!list.isEmpty()) {
|
||||
throw new ServiceException(ResultCode.PROMOTION_SAME_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加拼团定时任务
|
||||
* @param pintuan
|
||||
*/
|
||||
private void addPintuanStartTask(PintuanVO pintuan) {
|
||||
PromotionMessage promotionMessage = new PromotionMessage(pintuan.getId(), PromotionTypeEnum.PINTUAN.name(), PromotionStatusEnum.START.name(), pintuan.getStartTime(), pintuan.getEndTime());
|
||||
TimeTriggerMsg timeTriggerMsg = new TimeTriggerMsg(TimeExecuteConstant.PROMOTION_EXECUTOR,
|
||||
|
||||
@@ -2,6 +2,8 @@ package cn.lili.modules.promotion.serviceimpl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.trigger.util.DelayQueueTools;
|
||||
import cn.lili.trigger.enums.DelayTypeEnums;
|
||||
import cn.lili.trigger.message.PromotionMessage;
|
||||
@@ -226,6 +228,9 @@ public class PointsGoodsServiceImpl extends ServiceImpl<PointsGoodsMapper, Point
|
||||
@Override
|
||||
public IPage<PointsGoodsVO> getPointsGoodsByPage(PointsGoodsSearchParams searchParams, PageVO page) {
|
||||
IPage<PointsGoodsVO> pointsGoodsPage = new Page<>();
|
||||
if (UserContext.getCurrentUser().getRole().equals(UserEnums.MEMBER)) {
|
||||
searchParams.setPromotionStatus(PromotionStatusEnum.START.name());
|
||||
}
|
||||
Query query = searchParams.mongoQuery();
|
||||
if (page != null) {
|
||||
PromotionTools.mongoQueryPageParam(query, page);
|
||||
|
||||
Reference in New Issue
Block a user