|
|
@@ -12,6 +12,7 @@ import com.cyksj.common.exception.BusinessRuntimeException;
|
|
|
import com.cyksj.common.util.StringUtil;
|
|
|
import com.cyksj.dto.Result;
|
|
|
import com.cyksj.enums.GatewayResponse;
|
|
|
+import com.cyksj.mapper.GoodsDonSkuMapper;
|
|
|
import com.cyksj.mapper.UserMapper;
|
|
|
import com.cyksj.mapper.manage.cms.CmsUserMapper;
|
|
|
import com.cyksj.mapper.shop.YhShopMapper;
|
|
|
@@ -21,8 +22,10 @@ import com.cyksj.model.request.GoodsDonShopRateReq;
|
|
|
import com.cyksj.model.request.YhShopUserPlatDistributeRateReq;
|
|
|
import com.cyksj.model.request.YhShopVerifyReq;
|
|
|
import com.cyksj.model.views.*;
|
|
|
+import com.cyksj.service.mange.CmsGoodsDonSkuService;
|
|
|
import com.cyksj.service.mange.CmsYhShopCommonService;
|
|
|
import com.cyksj.service.mange.CmsYhShopGoodsRateService;
|
|
|
+import com.cyksj.service.mange.RefreshCacheService;
|
|
|
import com.cyksj.service.mange.business.UserBusinessRateService;
|
|
|
import com.cyksj.service.mange.statistics.StatisticsDataService;
|
|
|
import com.ejlchina.searcher.BeanSearcher;
|
|
|
@@ -74,6 +77,12 @@ public class CmsYhShopGoodsController {
|
|
|
|
|
|
private final StatisticsDataService statisticsDataService;
|
|
|
|
|
|
+ private final GoodsDonSkuMapper skuMapper;
|
|
|
+
|
|
|
+ private final CmsGoodsDonSkuService goodsDonSkuService;
|
|
|
+
|
|
|
+ private final RefreshCacheService refreshCacheService;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取店铺平台价格
|
|
|
@@ -110,7 +119,12 @@ public class CmsYhShopGoodsController {
|
|
|
one.setRate(e.getRate());
|
|
|
}
|
|
|
yhShopGoodsRateService.saveOrUpdate(one);
|
|
|
+
|
|
|
+ GoodsDonSku sku = skuMapper.selectById(one.getSkuId());
|
|
|
+ //下架店铺低于这个规格价格的品
|
|
|
+ goodsDonSkuService.setBelowPriceShopSkuDown(e.getSkuId(), sku.getPrice());
|
|
|
});
|
|
|
+ refreshCacheService.refreshYhHomePageCache();
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
|
|
|
|
@@ -118,6 +132,7 @@ public class CmsYhShopGoodsController {
|
|
|
* 一键设置 店铺平台通用浮动比例
|
|
|
*/
|
|
|
@PutMapping("/oneKey/set/goods/rate")
|
|
|
+ @Transactional(rollbackFor = Throwable.class)
|
|
|
public Result<Void> setShopGoodsGeneralRate(@RequestBody GoodsDonShopRateReq req) {
|
|
|
Integer rate = Optional.ofNullable(req.getRate()).orElse(0);
|
|
|
if (rate < 0 && rate > 100) {
|
|
|
@@ -130,7 +145,15 @@ public class CmsYhShopGoodsController {
|
|
|
data.setRate(rate);
|
|
|
});
|
|
|
yhShopGoodsRateService.saveOrUpdateBatch(yhShopGoodsRates);
|
|
|
+
|
|
|
+ List<GoodsDonSku> goodsDonSkus = goodsDonSkuService.list(Wrappers.lambdaQuery(GoodsDonSku.class)
|
|
|
+ .eq(GoodsDonSku::getGoodsId, goodsId));
|
|
|
+ goodsDonSkus.forEach(sku -> {
|
|
|
+ //下架店铺低于这个规格价格的品
|
|
|
+ goodsDonSkuService.setBelowPriceShopSkuDown(sku.getId(), sku.getPrice());
|
|
|
+ });
|
|
|
});
|
|
|
+ refreshCacheService.refreshYhHomePageCache();
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
|
|