commit
						cdf8ab3a3c
					
				| @ -72,6 +72,7 @@ public class PromotionEverydayExecute implements EveryDayExecute { | ||||
|         log.info("生成秒杀活动设置:{}", seckillSetting); | ||||
|         for (int i = 1; i <= SeckillService.PRE_CREATION; i++) { | ||||
|             Seckill seckill = new Seckill(i, seckillSetting.getHours(), seckillSetting.getSeckillRule()); | ||||
|             seckill.setApplyEndTime(null); | ||||
| 
 | ||||
|             //如果已经存在促销,则不再次保存 | ||||
|             if (seckillService.list( | ||||
|  | ||||
| @ -161,8 +161,9 @@ public interface GoodsService extends IService<Goods> { | ||||
|      * 更新商品评价数量 | ||||
|      * | ||||
|      * @param goodsId 商品ID | ||||
|      * @param skuId skuID | ||||
|      */ | ||||
|     void updateGoodsCommentNum(String goodsId); | ||||
|     void updateGoodsCommentNum(String goodsId, String skuId); | ||||
| 
 | ||||
|     /** | ||||
|      * 更新商品的购买数量 | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| package cn.lili.modules.goods.serviceimpl; | ||||
| 
 | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.map.MapUtil; | ||||
| import cn.hutool.core.text.CharSequenceUtil; | ||||
| import cn.hutool.core.util.NumberUtil; | ||||
| import cn.hutool.json.JSONUtil; | ||||
| @ -29,6 +30,7 @@ import cn.lili.modules.goods.service.*; | ||||
| import cn.lili.modules.member.entity.dto.EvaluationQueryParams; | ||||
| import cn.lili.modules.member.entity.enums.EvaluationGradeEnum; | ||||
| import cn.lili.modules.member.service.MemberEvaluationService; | ||||
| import cn.lili.modules.search.utils.EsIndexUtil; | ||||
| import cn.lili.modules.store.entity.dos.FreightTemplate; | ||||
| import cn.lili.modules.store.entity.dos.Store; | ||||
| import cn.lili.modules.store.entity.vos.StoreVO; | ||||
| @ -442,7 +444,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void updateGoodsCommentNum(String goodsId) { | ||||
|     public void updateGoodsCommentNum(String goodsId, String skuId) { | ||||
| 
 | ||||
|         //获取商品信息 | ||||
|         Goods goods = this.getById(goodsId); | ||||
| @ -459,6 +461,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements | ||||
|         this.updateById(goods); | ||||
| 
 | ||||
|         cache.remove(CachePrefix.GOODS.getPrefix() + goodsId); | ||||
| 
 | ||||
|         Map<String, Object> updateIndexFieldsMap = EsIndexUtil.getUpdateIndexFieldsMap(MapUtil.builder(new HashMap<String, Object>()).put("id", skuId).build(), MapUtil.builder(new HashMap<String, Object>()).put("commentNum", goods.getCommentNum()).put("highPraiseNum", highPraiseNum).put("grade", grade).build()); | ||||
|         applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("更新商品索引信息", rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.UPDATE_GOODS_INDEX_FIELD.name(), JSONUtil.toJsonStr(updateIndexFieldsMap))); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  | ||||
| @ -1,6 +1,5 @@ | ||||
| package cn.lili.modules.goods.serviceimpl; | ||||
| 
 | ||||
| import cn.hutool.core.map.MapUtil; | ||||
| import cn.hutool.core.text.CharSequenceUtil; | ||||
| import cn.hutool.core.util.NumberUtil; | ||||
| import cn.hutool.json.JSONObject; | ||||
| @ -49,7 +48,6 @@ import cn.lili.modules.promotion.service.MemberCouponService; | ||||
| import cn.lili.modules.promotion.service.PromotionGoodsService; | ||||
| import cn.lili.modules.search.entity.dos.EsGoodsIndex; | ||||
| import cn.lili.modules.search.service.EsGoodsIndexService; | ||||
| import cn.lili.modules.search.utils.EsIndexUtil; | ||||
| import cn.lili.mybatis.BaseEntity; | ||||
| import cn.lili.mybatis.util.PageUtil; | ||||
| import cn.lili.rocketmq.RocketmqSendCallbackBuilder; | ||||
| @ -625,19 +623,8 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i | ||||
|         //修改规格 | ||||
|         this.updateGoodsSkuGrade(skuId, grade, goodsSku.getCommentNum()); | ||||
| 
 | ||||
| 
 | ||||
|         //修改规格索引,发送mq消息 | ||||
|         Map<String, Object> updateIndexFieldsMap = | ||||
|                 EsIndexUtil.getUpdateIndexFieldsMap(MapUtil.builder(new HashMap<String, Object>()).put("id", | ||||
|                         goodsSku.getId()).build(), MapUtil.builder(new HashMap<String, Object>()).put("commentNum", | ||||
|                         goodsSku.getCommentNum()).put("highPraiseNum", highPraiseNum).put("grade", grade).build()); | ||||
|         String destination = | ||||
|                 rocketmqCustomProperties.getGoodsTopic() + ":" + GoodsTagsEnum.UPDATE_GOODS_INDEX_FIELD.name(); | ||||
|         rocketMQTemplate.asyncSend(destination, JSONUtil.toJsonStr(updateIndexFieldsMap), | ||||
|                 RocketmqSendCallbackBuilder.commonCallback()); | ||||
| 
 | ||||
|         //修改商品的评价数量 | ||||
|         goodsService.updateGoodsCommentNum(goodsSku.getGoodsId()); | ||||
|         goodsService.updateGoodsCommentNum(goodsSku.getGoodsId(), skuId); | ||||
|         clearCache(skuId); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 OceansDeep
						OceansDeep