Skip to content

Commit

Permalink
fix: 修复批量更新商品配送模版,没有更新sku问题
Browse files Browse the repository at this point in the history
  • Loading branch information
LeiGaoRobot committed Sep 13, 2024
1 parent 7b48575 commit 18e2c89
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,4 +296,13 @@ static String getStockCacheKey(String id) {
* @return 库存数量
*/
Integer getGoodsStock(String goodsId);

/**
* 更新sku运费模版
*
* @param goodsId 商品id
* @param templateId 运费模版id
* @return 操作结果
*/
Boolean freight(List<String> goodsId, String templateId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ public Boolean freight(List<String> goodsIds, String templateId) {
lambdaUpdateWrapper.in(Goods::getId, goodsIds);
List<String> goodsCache = goodsIds.stream().map(item -> CachePrefix.GOODS.getPrefix() + item).collect(Collectors.toList());
cache.multiDel(goodsCache);
goodsSkuService.freight(goodsIds, templateId);
return this.update(lambdaUpdateWrapper);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,17 @@ public Integer getGoodsStock(String goodsId) {

}

@Override
public Boolean freight(List<String> goodsId, String templateId) {
LambdaUpdateWrapper<GoodsSku> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.in(GoodsSku::getGoodsId, goodsId);
updateWrapper.set(GoodsSku::getFreightTemplateId, templateId);
updateWrapper.set(GoodsSku::getUpdateTime, new Date());
List<String> skuIds = this.list(updateWrapper).stream().map(GoodsSku::getId).collect(Collectors.toList());
skuIds.forEach(this::clearCache);
return this.update(updateWrapper);
}

/**
* 渲染商品sku
*
Expand Down

0 comments on commit 18e2c89

Please sign in to comment.