修改分佣

This commit is contained in:
韩鹏辉 2023-07-21 19:25:55 +08:00
parent bfba38e27b
commit 994eb1a754
5 changed files with 10 additions and 8 deletions

View File

@ -427,5 +427,6 @@ public interface MerchantOrderMapper extends BaseMapper<MerchantOrder> {
@Select("SELECT * FROM tb_pluss_merchant_order WHERE mercOrderNo = #{mercOrderNo} limit 1")
MerchantOrder getByMercOrderNo(String mercOrderNo);
}

View File

@ -17,7 +17,7 @@ public interface MerchantProfitMapper extends BaseMapper<MerchantProfit> {
List<MerchantProfit> selectGroupMercProfit(@Param("userIdList") List<Long> userIdList);
@Select("SELECT SUM(`price`) FROM tb_pluss_merchant_profit WHERE `status` = '1' AND userId = #{userId}")
@Select("SELECT SUM(`price`) FROM tb_pluss_merchant_profit WHERE `status` = '5' AND userId = #{userId}")
BigDecimal selectSumValidProfit(@Param("userId") String userId);
MerchantProfit queryMerchantProfit(MerchantProfit merchantProfit);

View File

@ -554,8 +554,7 @@
<select id="queryMerchantProfitSumPrice" parameterType="java.util.Map" resultType="java.lang.Double">
SELECT sum(price) from tb_pluss_merchant_profit profit
<where>
SELECT sum(price) from tb_pluss_merchant_profit profit where profit.type=5
<if test="id!= null">
and profit.id = #{id}
</if>
@ -646,9 +645,6 @@
<if test="merchantParentPhone!= null">
and profit.merchantParentPhone = #{merchantParentPhone}
</if>
<if test="retype!= null">
and profit.type !=4
</if>
<if test="recordDate != null">
and profit.recordDate = #{recordDate}
</if>
@ -658,7 +654,6 @@
<if test="recordDateEnd != null">
and profit.recordDate &lt;= #{recordDateEnd}
</if>
</where>
</select>

View File

@ -5,6 +5,8 @@ import cn.pluss.platform.app.MainPageService;
import cn.pluss.platform.entity.MerchantOrderStatistics;
import cn.pluss.platform.entity.UserApp;
import cn.pluss.platform.exception.MsgException;
import cn.pluss.platform.mapper.MerchantOrderMapper;
import cn.pluss.platform.merchantOrder.MerchantOrderService;
import cn.pluss.platform.merchantOrder.MerchantOrderStatisticsService;
import cn.pluss.platform.merchantProfit.MerchantProfitService;
import cn.pluss.platform.userApp.UserAppService;
@ -37,6 +39,9 @@ public class PromoterMainPageServiceImpl implements MainPageService {
@Lazy
private MerchantOrderStatisticsService mosService;
@Autowired
private MerchantOrderMapper merchantOrderMapper;
@Override
public Map<String, Object> getSpreadData(String userId) {
Map<String, Object> resultMap = new HashMap<>();

View File

@ -204,6 +204,7 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size());
return;
}
log.info("userId:{},rate:{},amount:{}",nowUserApp.getUserId(),profitRate,order.getConsumeFee());
BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(100)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN);
MerchantProfit profit = new MerchantProfit(nowUserApp, nowUserApp, order, profitAmt, profitRate, "5", "1");
@ -231,7 +232,7 @@ public class MerchantProfitServiceImpl extends ServiceImpl<MerchantProfitMapper,
log.error("订单号:{},分润结束,获取分润数为:{}",order.getOrderNumber(),profits.size());
return;
}
log.info("userId:{},rate:{},amount:{}",nowUserApp.getUserId(),profitRate,order.getConsumeFee());
BigDecimal profitAmt = profitRate.divide(BigDecimal.valueOf(100)).multiply(BigDecimal.valueOf(order.getConsumeFee())).setScale(4, BigDecimal.ROUND_DOWN);
MerchantProfit profit = new MerchantProfit(nowUserApp,nowUserApp , order, profitAmt, profitRate, "5", "1");
profits.add(profit);