拼团活动被异常操作后,商品索引没有更新问题处理
This commit is contained in:
parent
ab0b7f1591
commit
dd1bf2eec0
@ -154,7 +154,7 @@ public enum ResultCode {
|
|||||||
* 购物车
|
* 购物车
|
||||||
*/
|
*/
|
||||||
CART_ERROR(30001, "读取结算页的购物车异常"),
|
CART_ERROR(30001, "读取结算页的购物车异常"),
|
||||||
CART_PINTUAN_NOT_EXIST_ERROR(30002, "拼团活动不存在错误"),
|
CART_PINTUAN_NOT_EXIST_ERROR(30002, "拼团活动已关闭,请稍后重试"),
|
||||||
CART_PINTUAN_LIMIT_ERROR(30003, "购买数量超过拼团活动限制数量"),
|
CART_PINTUAN_LIMIT_ERROR(30003, "购买数量超过拼团活动限制数量"),
|
||||||
SHIPPING_NOT_APPLY(30005, "购物商品不支持当前收货地址配送"),
|
SHIPPING_NOT_APPLY(30005, "购物商品不支持当前收货地址配送"),
|
||||||
|
|
||||||
@ -449,9 +449,7 @@ public enum ResultCode {
|
|||||||
CUSTOM_WORDS_SECRET_KEY_ERROR(90002, "秘钥验证失败!"),
|
CUSTOM_WORDS_SECRET_KEY_ERROR(90002, "秘钥验证失败!"),
|
||||||
CONNECT_NOT_EXIST(90000, "登录方式不存在!"),
|
CONNECT_NOT_EXIST(90000, "登录方式不存在!"),
|
||||||
ELASTICSEARCH_INDEX_INIT_ERROR(90003, "索引初始化失败!"),
|
ELASTICSEARCH_INDEX_INIT_ERROR(90003, "索引初始化失败!"),
|
||||||
PURCHASE_ORDER_DEADLINE_ERROR(90004,"供求单,已超过报名截止时间")
|
PURCHASE_ORDER_DEADLINE_ERROR(90004, "供求单,已超过报名截止时间");
|
||||||
|
|
||||||
;
|
|
||||||
|
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
private final String message;
|
private final String message;
|
||||||
|
@ -143,6 +143,13 @@ public interface GoodsSkuService extends IService<GoodsSku> {
|
|||||||
*/
|
*/
|
||||||
void updateGoodsSkuStatus(Goods goods);
|
void updateGoodsSkuStatus(Goods goods);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送生成ES商品索引
|
||||||
|
*
|
||||||
|
* @param goods 商品信息
|
||||||
|
*/
|
||||||
|
void generateEs(Goods goods);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新SKU库存
|
* 更新SKU库存
|
||||||
*
|
*
|
||||||
|
@ -497,7 +497,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
|||||||
*
|
*
|
||||||
* @param goods 商品信息
|
* @param goods 商品信息
|
||||||
*/
|
*/
|
||||||
private void generateEs(Goods goods) {
|
public void generateEs(Goods goods) {
|
||||||
String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.GENERATOR_GOODS_INDEX.name();
|
String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.GENERATOR_GOODS_INDEX.name();
|
||||||
//发送mq消息
|
//发送mq消息
|
||||||
rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(goods), RocketmqSendCallbackBuilder.commonCallback());
|
rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(goods), RocketmqSendCallbackBuilder.commonCallback());
|
||||||
|
@ -11,6 +11,7 @@ import cn.lili.common.utils.CurrencyUtil;
|
|||||||
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
import cn.lili.modules.goods.entity.dos.GoodsSku;
|
||||||
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
|
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
|
||||||
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
|
||||||
|
import cn.lili.modules.goods.service.GoodsService;
|
||||||
import cn.lili.modules.goods.service.GoodsSkuService;
|
import cn.lili.modules.goods.service.GoodsSkuService;
|
||||||
import cn.lili.modules.member.entity.dos.MemberAddress;
|
import cn.lili.modules.member.entity.dos.MemberAddress;
|
||||||
import cn.lili.modules.order.cart.entity.dto.MemberCouponDTO;
|
import cn.lili.modules.order.cart.entity.dto.MemberCouponDTO;
|
||||||
@ -36,6 +37,7 @@ import cn.lili.modules.promotion.entity.vos.PointsGoodsVO;
|
|||||||
import cn.lili.modules.promotion.entity.vos.kanjia.KanjiaActivitySearchParams;
|
import cn.lili.modules.promotion.entity.vos.kanjia.KanjiaActivitySearchParams;
|
||||||
import cn.lili.modules.promotion.service.*;
|
import cn.lili.modules.promotion.service.*;
|
||||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||||
|
import cn.lili.modules.search.service.EsGoodsIndexService;
|
||||||
import cn.lili.modules.search.service.EsGoodsSearchService;
|
import cn.lili.modules.search.service.EsGoodsSearchService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -92,6 +94,11 @@ public class CartServiceImpl implements CartService {
|
|||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private EsGoodsSearchService esGoodsSearchService;
|
private EsGoodsSearchService esGoodsSearchService;
|
||||||
|
/**
|
||||||
|
* ES商品
|
||||||
|
*/
|
||||||
|
@Autowired
|
||||||
|
private GoodsService goodsService;
|
||||||
/**
|
/**
|
||||||
* 拼团
|
* 拼团
|
||||||
*/
|
*/
|
||||||
@ -689,6 +696,8 @@ public class CartServiceImpl implements CartService {
|
|||||||
cartSkuVO.setUtilPrice(promotionGoods.getPrice());
|
cartSkuVO.setUtilPrice(promotionGoods.getPrice());
|
||||||
cartSkuVO.setPurchasePrice(promotionGoods.getPrice());
|
cartSkuVO.setPurchasePrice(promotionGoods.getPrice());
|
||||||
} else {
|
} else {
|
||||||
|
//如果拼团活动被异常处理,则在这里安排mq重新写入商品索引
|
||||||
|
goodsSkuService.generateEs(goodsService.getById(cartSkuVO.getGoodsSku().getGoodsId()));
|
||||||
throw new ServiceException(ResultCode.CART_PINTUAN_NOT_EXIST_ERROR);
|
throw new ServiceException(ResultCode.CART_PINTUAN_NOT_EXIST_ERROR);
|
||||||
}
|
}
|
||||||
//检测拼团限购数量
|
//检测拼团限购数量
|
||||||
|
Loading…
x
Reference in New Issue
Block a user