Skip to content

Commit

Permalink
fix: 商品评价更新后,清除sku缓存不全问题。获取有图评价过滤条件缺少状态问题
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiGaoRobot committed Nov 6, 2023
1 parent 66c6bfa commit 24cdf5c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,8 @@ static String getStockCacheKey(String id) {
* 更新商品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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public void updateGoodsCommentNum(String goodsId, String skuId) {


// 修改商品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)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,13 +659,13 @@ public void updateGoodsSkuBuyCount(String skuId, int buyCount) {
}

@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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public EvaluationNumberVO getEvaluationNumber(String goodsId) {
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;
Expand Down

0 comments on commit 24cdf5c

Please sign in to comment.