|
|
@@ -56,12 +56,18 @@ public class YhShopGoodsController {
|
|
|
*/
|
|
|
@PutMapping("/put")
|
|
|
public Result<Void> updShopGoodsRate(@RequestBody List<YhShopGoodsSku> goodsSkus){
|
|
|
+ long userId = StpYhShopManageUser.getLoginIdAsLong();
|
|
|
goodsSkus.forEach(sku -> {
|
|
|
YhShopGoodsRateView.YhShopGoodsSkuRateView yhShopGoodsSkuRateView = beanSearcher.searchFirst(YhShopGoodsRateView.YhShopGoodsSkuRateView.class, MapUtils.builder().field(YhShopGoodsRateView.YhShopGoodsSkuRateView::getSkuId,sku.getSkuId()).build());
|
|
|
if (sku.getPrice().compareTo(yhShopGoodsSkuRateView.getMaxPrice()) > 0 || sku.getPrice().compareTo(yhShopGoodsSkuRateView.getMinPrice()) < 0){
|
|
|
throw BusinessRuntimeException.getInstance("价格不能超出区间范围");
|
|
|
}
|
|
|
+ sku.setUserId(userId);
|
|
|
});
|
|
|
+ YhShop yhShop = yhShopMapper.selectOne(Wrappers.lambdaQuery(YhShop.class)
|
|
|
+ .eq(YhShop::getUserId, userId).last("limit 1"));
|
|
|
+ String yhShopCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "yhShop:" + yhShop.getId();
|
|
|
+ redisService.del(yhShopCacheKey);
|
|
|
yhShopGoodsSkuService.saveOrUpdateBatch(goodsSkus);
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|