|
@@ -641,7 +641,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
Long tradeOrderId = order.getId();
|
|
|
String OrderNum = order.getNo();
|
|
|
Long payIntegral = order.getPayIntegral();
|
|
|
- integralService.updateUserIntegral(userId, CaclEnum.ORDER_PAY_INTEGRAL, payIntegral * (-1), 0L, tradeOrderId, OrderNum);
|
|
|
+ integralService.updateUserIntegral(userId,userId, CaclEnum.ORDER_PAY_INTEGRAL, payIntegral * (-1), 0L, tradeOrderId, OrderNum);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -713,20 +713,25 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
return virtualOrder;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
|
|
|
- * 把商品的推广费总额,转换为直推人获得的冻结积分
|
|
|
+ * 把商品的推广费总额,转换为消费者本人(直推人)、或消费者的推荐人 获得的冻结积分
|
|
|
*
|
|
|
* @param promotionExpenses 商品的推广费总额
|
|
|
+ * @param grossProfitPerc 推荐人/消费者本人额度 百分比
|
|
|
* @return 输入推广费,对应的直推人获得的冻结积分
|
|
|
*/
|
|
|
public static Long promotionExpenses2GrossProfitAncestorQuota(
|
|
|
+
|
|
|
+ 商品的推广费总额
|
|
|
+ */
|
|
|
Integer promotionExpenses,
|
|
|
|
|
|
* 毛利 = 成本 * 0.38... (推广费用)
|
|
|
*/
|
|
|
String grossProfitPerc,
|
|
|
|
|
|
- * 推广-推荐人额度 百分比
|
|
|
+ * 推广-推荐人/消费者本人额度 百分比
|
|
|
*/
|
|
|
String grossProfitAncestorQuotaPerc
|
|
|
) {
|
|
@@ -873,6 +878,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
|
|
|
QueryWrapper<OrderPercentageDO> queryWrapper = new QueryWrapper<>();
|
|
|
OrderPercentageDO orderPercentageDO = orderPercentageMapper.selectOne(queryWrapper);
|
|
|
+
|
|
|
|
|
|
* 毛利 = 成本 * 0.38... (推广费用)
|
|
|
*/
|
|
@@ -886,9 +892,19 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
*/
|
|
|
String grossProfitUserQuotaPerc = orderPercentageDO.getGrossProfitUserQuotaPerc();
|
|
|
|
|
|
+
|
|
|
+ * 推荐人(上一级) 百分比
|
|
|
+ */
|
|
|
+ String grossProfitAncestorQuotaPerc = orderPercentageDO.getGrossProfitAncestorQuotaPerc();
|
|
|
+
|
|
|
|
|
|
List<TradeOrderDO> TradeOrderDOList = tradeOrderMapper.selectList("pay_order_id", payOrderId);
|
|
|
|
|
|
+
|
|
|
+ Long memberUserIdOfTradeOrder = TradeOrderDOList.get(0).getUserId();
|
|
|
+
|
|
|
+ Long ancesterUserId = tradeOrderMapper.selectAncesterByMemberUserId(memberUserIdOfTradeOrder);
|
|
|
+
|
|
|
for (TradeOrderDO tradeOrderDO : TradeOrderDOList) {
|
|
|
|
|
|
Long tradeOrderId = tradeOrderDO.getId();
|
|
@@ -943,6 +959,9 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
}
|
|
|
|
|
|
Long totalFreezeAmount = 0L;
|
|
|
+
|
|
|
+ Long totalAncestorFreezeAmount = 0L;
|
|
|
+
|
|
|
for (TradeOrderItemDO tradeOrderItemDO : TradeOrderItemList) {
|
|
|
ProductSkuDO productSkuDO = skuDOMap.get(tradeOrderItemDO.getSkuId());
|
|
|
|
|
@@ -956,12 +975,22 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
grossProfitUserQuotaPerc
|
|
|
);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ Long ancestorItemFreezeAmount =
|
|
|
+ promotionExpenses2GrossProfitAncestorQuota(promotionExpenses,
|
|
|
+ grossProfitPerc,
|
|
|
+ grossProfitAncestorQuotaPerc
|
|
|
+ );
|
|
|
+
|
|
|
totalFreezeAmount += itemFreezeAmount;
|
|
|
+ totalAncestorFreezeAmount += ancestorItemFreezeAmount;
|
|
|
|
|
|
|
|
|
TradeOrderItemDO toid = new TradeOrderItemDO();
|
|
|
toid.setId(tradeOrderItemDO.getId());
|
|
|
toid.setIncreaseIntegral(itemFreezeAmount);
|
|
|
+ toid.setAncestorIncreaseIntegral(ancestorItemFreezeAmount);
|
|
|
tradeOrderItemMapper.updateById(toid);
|
|
|
}
|
|
|
|
|
@@ -969,7 +998,13 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
|
|
|
|
|
|
String OrderNum = order.getNo();
|
|
|
- integralService.updateUserIntegral(tradeOrderDO.getUserId(), CaclEnum.ORDER_PAY_INTEGRAL, 0L, totalFreezeAmount, tradeOrderId, OrderNum);
|
|
|
+
|
|
|
+ integralService.updateUserIntegral(tradeOrderDO.getUserId(),tradeOrderDO.getUserId(),CaclEnum.ORDER_PAY_INTEGRAL, 0L, totalFreezeAmount, tradeOrderId, OrderNum);
|
|
|
+
|
|
|
+
|
|
|
+ integralService.updateUserIntegral(tradeOrderDO.getUserId(),ancesterUserId, CaclEnum.ORDER_PAY_INTEGRAL_ANCESTER, 0L, totalAncestorFreezeAmount, tradeOrderId, OrderNum);
|
|
|
+ log.warn("[TradeOrderUpdateServiceImpl.updateOrderPaid]$$$:[tradeOrderId({}),ancesterUserId({}),totalAncestorFreezeAmount({})]" + new Date(),
|
|
|
+ tradeOrderId,ancesterUserId, totalAncestorFreezeAmount);
|
|
|
|
|
|
allTradeOrderTotalFreezeAmount += totalFreezeAmount;
|
|
|
|
|
@@ -1268,7 +1303,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
String orderNum = order.getNo();
|
|
|
|
|
|
if (payIntegral > 0) {
|
|
|
- integralService.updateUserIntegral(userId, CaclEnum.ORDER_CANCEL_BY_USER_REFUND_INTEGRAL, payIntegral, 0L, tradeOrderId, orderNum);
|
|
|
+ integralService.updateUserIntegral(userId,userId, CaclEnum.ORDER_CANCEL_BY_USER_REFUND_INTEGRAL, payIntegral, 0L, tradeOrderId, orderNum);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1300,7 +1335,7 @@ public class TradeOrderUpdateServiceImpl implements TradeOrderUpdateService {
|
|
|
Long userId = order.getUserId();
|
|
|
|
|
|
if (payIntegral > 0) {
|
|
|
- integralService.updateUserIntegral(userId, CaclEnum.ORDER_CANCEL_BY_SYSTEM_REFUND_INTEGRAL, payIntegral, 0L, tradeOrderId, orderNum);
|
|
|
+ integralService.updateUserIntegral(userId, userId,CaclEnum.ORDER_CANCEL_BY_SYSTEM_REFUND_INTEGRAL, payIntegral, 0L, tradeOrderId, orderNum);
|
|
|
}
|
|
|
|
|
|
count++;
|