fix: 商品评价更新后,清除sku缓存不全问题。获取有图评价过滤条件缺少状态问题

This commit is contained in:
misworga831 2023-11-06 17:50:24 +08:00
parent 66c6bfa0fb
commit 24cdf5cf00
4 changed files with 5 additions and 5 deletions

View File

@ -255,9 +255,8 @@ public interface GoodsSkuService extends IService<GoodsSku> {
* 更新商品sku评分
*
* @param goodsId goodsId
* @param skuId skuId
* @param grade 评分
* @param commentNum 评论数量
*/
void updateGoodsSkuGrade(String goodsId, String skuId, double grade,int commentNum);
void updateGoodsSkuGrade(String goodsId, double grade,int commentNum);
}

View File

@ -474,7 +474,7 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
// 修改商品sku评价数量
this.goodsSkuService.updateGoodsSkuGrade(goodsId, skuId, grade, goods.getCommentNum());
this.goodsSkuService.updateGoodsSkuGrade(goodsId, grade, goods.getCommentNum());
Map<String, Object> updateIndexFieldsMap = EsIndexUtil.getUpdateIndexFieldsMap(MapUtil.builder(new HashMap<String, Object>()).put("goodsId", goodsId).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)));

View File

@ -659,13 +659,13 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
}
@Override
public void updateGoodsSkuGrade(String goodsId, String skuId, double grade, int commentNum) {
public void updateGoodsSkuGrade(String goodsId, double grade, int commentNum) {
LambdaUpdateWrapper<GoodsSku> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(GoodsSku::getGoodsId, goodsId);
updateWrapper.set(GoodsSku::getGrade, grade);
updateWrapper.set(GoodsSku::getCommentNum, commentNum);
this.update(updateWrapper);
clearCache(skuId);
this.getSkuIdsByGoodsId(goodsId).forEach(this::clearCache);
}
/**

View File

@ -194,6 +194,7 @@ public class MemberEvaluationServiceImpl extends ServiceImpl<MemberEvaluationMap
evaluationNumberVO.setWorse(worse);
evaluationNumberVO.setHaveImage(this.count(new QueryWrapper<MemberEvaluation>()
.eq("have_image", 1)
.eq("status", SwitchEnum.OPEN.name())
.eq("goods_id", goodsId)));
return evaluationNumberVO;