|
@@ -63,6 +63,8 @@ public class CmsYhShopCommonServiceImpl implements CmsYhShopCommonService {
|
|
|
|
|
|
|
|
private final BeanSearcher beanSearcher;
|
|
private final BeanSearcher beanSearcher;
|
|
|
|
|
|
|
|
|
|
+ private final YhShopUserBusinessDefaultRateConfigMapper defaultRateConfigMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void setGeneralGoodsRate(List<YhShopGeneralGoodsRate> rates) {
|
|
public void setGeneralGoodsRate(List<YhShopGeneralGoodsRate> rates) {
|
|
|
List<YhShopGeneralGoodsRate> saveShopGoodsRate = new ArrayList<>(rates.size());
|
|
List<YhShopGeneralGoodsRate> saveShopGoodsRate = new ArrayList<>(rates.size());
|
|
@@ -126,7 +128,7 @@ public class CmsYhShopCommonServiceImpl implements CmsYhShopCommonService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
|
- public void setYhShopGoodsRate(List<YhShopUserPlatDistributeRate> yhShopUserPlatDistributeRates, Long userId) {
|
|
|
|
|
|
|
+ public void setYhShopGoodsRate(List<YhShopUserPlatDistributeRate> yhShopUserPlatDistributeRates, Long businessId, Long userId) {
|
|
|
yhShopUserPlatDistributeRates.forEach(data -> {
|
|
yhShopUserPlatDistributeRates.forEach(data -> {
|
|
|
data.setUserId(userId);
|
|
data.setUserId(userId);
|
|
|
Long goodsId = data.getGoodsId();
|
|
Long goodsId = data.getGoodsId();
|
|
@@ -140,6 +142,10 @@ public class CmsYhShopCommonServiceImpl implements CmsYhShopCommonService {
|
|
|
if (secondRate != null && (secondRate < 0 || secondRate > 100)) {
|
|
if (secondRate != null && (secondRate < 0 || secondRate > 100)) {
|
|
|
throw BusinessRuntimeException.getInstance("请输入正确的分销比例");
|
|
throw BusinessRuntimeException.getInstance("请输入正确的分销比例");
|
|
|
}
|
|
}
|
|
|
|
|
+ //店铺分销虚物分销比例且配置商务
|
|
|
|
|
+ if (businessId != null && goodsDon.getType() == 1) {
|
|
|
|
|
+ checkDistributorAndBusinessRate(data.getRate(), goodsDon.getId(), goodsDon.getTitle());
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
yhShopUserPlatDistributeRateService.saveOrUpdateBatch(yhShopUserPlatDistributeRates);
|
|
yhShopUserPlatDistributeRateService.saveOrUpdateBatch(yhShopUserPlatDistributeRates);
|
|
|
}
|
|
}
|
|
@@ -260,4 +266,15 @@ public class CmsYhShopCommonServiceImpl implements CmsYhShopCommonService {
|
|
|
}
|
|
}
|
|
|
yhShopDistributeMoneyApplyMapper.updateById(distributeMoneyApply);
|
|
yhShopDistributeMoneyApplyMapper.updateById(distributeMoneyApply);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public void checkDistributorAndBusinessRate(Integer distributeGoodsRate, Long goodsId, String goodsName) {
|
|
|
|
|
+ YhShopUserBusinessDefaultRateConfig defaultGoodsRateConfig = defaultRateConfigMapper.selectOne(Wrappers.lambdaQuery(YhShopUserBusinessDefaultRateConfig.class)
|
|
|
|
|
+ .eq(YhShopUserBusinessDefaultRateConfig::getGoodsId, goodsId)
|
|
|
|
|
+ .last("limit 1"));
|
|
|
|
|
+ Optional.ofNullable(defaultGoodsRateConfig).ifPresent(config -> {
|
|
|
|
|
+ if (distributeGoodsRate > config.getMaxRate()) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance(String.format("该%s平台最高可配置分销比例为%s", goodsName, config.getMaxRate()));
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|