|
@@ -35,6 +35,7 @@ public class OderHandleServiceImpl implements OrderHandleService {
|
|
|
private final PlatformProfitRatioService platformProfitRatioService;
|
|
|
private final AssetService assetService;
|
|
|
private final BalanceDetailService balanceDetailService;
|
|
|
+ private final CurrencyRecordService currencyRecordService;
|
|
|
|
|
|
@Override
|
|
|
public void orderPay(Long orderId) {
|
|
@@ -76,6 +77,7 @@ public class OderHandleServiceImpl implements OrderHandleService {
|
|
|
if (i != 1) {
|
|
|
throw new ResourceUnavailableException("处理失败");
|
|
|
}
|
|
|
+ Long orderId = omsOrder.getId();
|
|
|
//分佣逻辑=====================================
|
|
|
//实际支付金额
|
|
|
BigDecimal payAmount = omsOrder.getPayAmount();
|
|
@@ -110,9 +112,30 @@ public class OderHandleServiceImpl implements OrderHandleService {
|
|
|
}
|
|
|
//商家应得金额
|
|
|
BigDecimal operateAmount = payAmount.subtract(platformAmount);
|
|
|
+ //记录商家余额明细
|
|
|
BigDecimal surplusAmount = assetService.updateAsset(0, operateAmount, merchantId, 2);
|
|
|
balanceDetailService.recordFlow(omsOrder.getId(), 2, merchantId, operateAmount, surplusAmount, 0, 1, userId);
|
|
|
- BigDecimal platformSurplusAmount = assetService.updateAsset(1, operateAmount, 1L, 0);
|
|
|
+ //记录流水--------------------------
|
|
|
+ //商家流水
|
|
|
+ BigDecimal MerchantDeduct = BigDecimal.ZERO; //扣税
|
|
|
+ currencyRecordService.recordFlow(merchantId, 2, 0, orderId, userId, 0, operateAmount, MerchantDeduct, operateAmount);
|
|
|
+ //邀请用户---分得佣金
|
|
|
+ if (userAmount.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ platformAmount = platformAmount.subtract(userAmount);
|
|
|
+ BigDecimal deduct = BigDecimal.ZERO; //扣税
|
|
|
+ currencyRecordService.recordFlow(inviteUserId, 1, 0, orderId, userId, 1, userAmount, deduct, userAmount);
|
|
|
+ }
|
|
|
+ //邀请商家---分得佣金
|
|
|
+ if (merchantAmount.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ platformAmount = platformAmount.subtract(merchantAmount);
|
|
|
+ BigDecimal deduct = BigDecimal.ZERO; //扣税
|
|
|
+ currencyRecordService.recordFlow(inviteMerchantId, 1, 0, orderId, userId, 2, merchantAmount, deduct, merchantAmount);
|
|
|
+ }
|
|
|
+ //平台流水
|
|
|
+ BigDecimal deduct = BigDecimal.ZERO; //扣税
|
|
|
+ currencyRecordService.recordFlow(1L, 0, 0, orderId, userId, 3, platformAmount, deduct, platformAmount);
|
|
|
+
|
|
|
+ /*BigDecimal platformSurplusAmount = assetService.updateAsset(1, operateAmount, 1L, 0);
|
|
|
balanceDetailService.recordFlow(omsOrder.getId(), 0, 1L, operateAmount, platformSurplusAmount, 1, 1,
|
|
|
merchantId);
|
|
|
//邀请用户---分得佣金
|
|
@@ -132,7 +155,7 @@ public class OderHandleServiceImpl implements OrderHandleService {
|
|
|
BigDecimal platformSurplusAmount2 = assetService.updateAsset(1, merchantAmount, 1L, 0);
|
|
|
balanceDetailService.recordFlow(omsOrder.getId(), 0, 1L, merchantAmount, platformSurplusAmount2, 1, 1,
|
|
|
inviteMerchantId);
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
@Override
|