|
@@ -2,10 +2,7 @@ package com.cyksj.service.shop.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.cyksj.mapper.shop.YhShopDistributeWaitingSendPointsMapper;
|
|
|
|
|
-import com.cyksj.mapper.shop.YhShopMapper;
|
|
|
|
|
-import com.cyksj.mapper.shop.YhShopUserDistributeSharedMapper;
|
|
|
|
|
-import com.cyksj.mapper.shop.YhShopUserPlatDistributeRateMapper;
|
|
|
|
|
|
|
+import com.cyksj.mapper.shop.*;
|
|
|
import com.cyksj.model.entity.*;
|
|
import com.cyksj.model.entity.*;
|
|
|
import com.cyksj.service.distribute.UserBusinessFrontService;
|
|
import com.cyksj.service.distribute.UserBusinessFrontService;
|
|
|
import com.cyksj.service.shop.YhShopDistributeService;
|
|
import com.cyksj.service.shop.YhShopDistributeService;
|
|
@@ -38,6 +35,8 @@ public class YhShopDistributeServiceImpl implements YhShopDistributeService {
|
|
|
private final UserBusinessFrontService userBusinessFrontService;
|
|
private final UserBusinessFrontService userBusinessFrontService;
|
|
|
|
|
|
|
|
private final UserBenefitsService userBenefitsService;
|
|
private final UserBenefitsService userBenefitsService;
|
|
|
|
|
+
|
|
|
|
|
+ private final YhShopGeneralGoodsRateMapper yhShopGeneralGoodsRateMapper;
|
|
|
@Override
|
|
@Override
|
|
|
public void distributeWaitingSendPointsRecord(OrderDon order) {
|
|
public void distributeWaitingSendPointsRecord(OrderDon order) {
|
|
|
BigDecimal orderMoney = order.getMoney();
|
|
BigDecimal orderMoney = order.getMoney();
|
|
@@ -65,11 +64,21 @@ public class YhShopDistributeServiceImpl implements YhShopDistributeService {
|
|
|
YhShopUserPlatDistributeRate yhShopUserPlatDistributeRate = yhShopUserPlatDistributeRateMapper.selectOne(Wrappers.lambdaQuery(YhShopUserPlatDistributeRate.class)
|
|
YhShopUserPlatDistributeRate yhShopUserPlatDistributeRate = yhShopUserPlatDistributeRateMapper.selectOne(Wrappers.lambdaQuery(YhShopUserPlatDistributeRate.class)
|
|
|
.eq(YhShopUserPlatDistributeRate::getUserId, shopUserId)
|
|
.eq(YhShopUserPlatDistributeRate::getUserId, shopUserId)
|
|
|
.eq(YhShopUserPlatDistributeRate::getGoodsId, order.getGoodsId()).last("limit 1"));
|
|
.eq(YhShopUserPlatDistributeRate::getGoodsId, order.getGoodsId()).last("limit 1"));
|
|
|
|
|
+ Integer rate = 0;
|
|
|
if (yhShopUserPlatDistributeRate == null) {
|
|
if (yhShopUserPlatDistributeRate == null) {
|
|
|
- log.info("未配置店铺主userId:{}对应平台goodsId:{}的比例", shopUserId, order.getGoodsId());
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ log.info("未配置店铺主userId:{}对应平台goodsId:{}的比例,走通用比例", shopUserId, order.getGoodsId());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ rate = yhShopUserPlatDistributeRate.getRate();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (rate <= 0) {
|
|
|
|
|
+ //获取平台配置的通用比例
|
|
|
|
|
+ YhShopGeneralGoodsRate yhShopGeneralGoodsRate = yhShopGeneralGoodsRateMapper.selectOne(Wrappers.lambdaQuery(YhShopGeneralGoodsRate.class)
|
|
|
|
|
+ .eq(YhShopGeneralGoodsRate::getGoodsId, order.getGoodsId()).last("limit 1"));
|
|
|
|
|
+ if (yhShopGeneralGoodsRate != null) {
|
|
|
|
|
+ log.info("店铺通用比例为:{}", yhShopGeneralGoodsRate.getRate());
|
|
|
|
|
+ rate = yhShopGeneralGoodsRate.getRate();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- Integer rate = yhShopUserPlatDistributeRate.getRate();
|
|
|
|
|
if (rate <= 0) {
|
|
if (rate <= 0) {
|
|
|
log.info("配置店铺主userId:{}对应平台goodsId:{}的比例为0", shopUserId, order.getGoodsId());
|
|
log.info("配置店铺主userId:{}对应平台goodsId:{}的比例为0", shopUserId, order.getGoodsId());
|
|
|
return;
|
|
return;
|