优化编辑商品时的生成索引和操作促销活动时更新索引促销信息,增加事务监听在事务提交后发送mq信息
This commit is contained in:
parent
e961711dcb
commit
ab1e9f806f
@ -33,7 +33,6 @@ public class SnowFlake {
|
||||
*/
|
||||
public static void initialize(long workerId, long datacenterId) {
|
||||
snowflake = IdUtil.getSnowflake(workerId, datacenterId);
|
||||
log.error(workerId+""+datacenterId);
|
||||
}
|
||||
|
||||
public static long getId() {
|
||||
|
@ -383,6 +383,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateStock(String goodsId, Integer quantity) {
|
||||
LambdaUpdateWrapper<Goods> lambdaUpdateWrapper = Wrappers.lambdaUpdate();
|
||||
lambdaUpdateWrapper.set(Goods::getQuantity, quantity);
|
||||
|
@ -131,6 +131,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(List<Map<String, Object>> skuList, Goods goods, Boolean regeneratorSkuFlag) {
|
||||
// 是否存在规格
|
||||
if (skuList == null || skuList.isEmpty()) {
|
||||
@ -577,7 +578,8 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
|
||||
* @param skuList sku列表
|
||||
* @param goods 商品信息
|
||||
*/
|
||||
private List<GoodsSku> addGoodsSku(List<Map<String, Object>> skuList, Goods goods) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
List<GoodsSku> addGoodsSku(List<Map<String, Object>> skuList, Goods goods) {
|
||||
List<GoodsSku> skus = new ArrayList<>();
|
||||
for (Map<String, Object> skuVO : skuList) {
|
||||
Map<String, Object> resultMap = this.add(skuVO, goods);
|
||||
|
@ -29,7 +29,7 @@ public class UpdateEsGoodsIndexPromotionsListener {
|
||||
private RocketmqCustomProperties rocketmqCustomProperties;
|
||||
|
||||
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT)
|
||||
@TransactionalEventListener(phase = TransactionPhase.AFTER_COMMIT, fallbackExecution = true)
|
||||
public void updateEsGoodsIndexPromotions(UpdateEsGoodsIndexPromotionsEvent event) {
|
||||
//更新商品促销消息
|
||||
String destination = rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.UPDATE_GOODS_INDEX_PROMOTIONS.name();
|
||||
|
@ -249,7 +249,6 @@ public class CouponServiceImpl extends AbstractPromotionsServiceImpl<CouponMappe
|
||||
* @param promotions 优惠券信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void updateEsGoodsIndex(Coupon promotions) {
|
||||
Coupon coupon = JSONUtil.parse(promotions).toBean(Coupon.class);
|
||||
super.updateEsGoodsIndex(coupon);
|
||||
|
Loading…
x
Reference in New Issue
Block a user