|
|
|
@@ -66,6 +66,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
// 2. coupon 补贴 rate |
|
|
|
WxCouponMerchant couponMerchant = null; |
|
|
|
WxCouponMerchant couponMerchantQ = new WxCouponMerchant(); |
|
|
|
couponMerchantQ.setTenantId(record.getTenantId()); |
|
|
|
couponMerchantQ.setProductId(cardInfo.getCouponId()); |
|
|
|
couponMerchantQ.setMerchantId(record.getMerchantId()); |
|
|
|
couponMerchantQ.setStatus(EnumCouponMerchantStatus.COUPON_MERCHANT_STATUS_VALID.getCode()); |
|
|
|
@@ -141,6 +142,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
Integer realSubsidyFee = subsidyFee - dSubChargeFee.intValue(); |
|
|
|
WxMerchantSubsidy merchantSubsidy = new WxMerchantSubsidy(); |
|
|
|
merchantSubsidy.setId(idWorker.nextId()); |
|
|
|
merchantSubsidy.setTenantId(record.getTenantId()); |
|
|
|
merchantSubsidy.setOrderId(order.getId()); |
|
|
|
merchantSubsidy.setOrderType(EnumOrderType.PREPAIDCARD.getCode()); |
|
|
|
merchantSubsidy.setMerchantId(record.getMerchantId()); |
|
|
|
@@ -161,7 +163,11 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
return new ResultData(ErrorCode.DB_FAIL.getCode(), "merchantSubsidy info 插入出错!"); |
|
|
|
} |
|
|
|
// 9. 分账 |
|
|
|
|
|
|
|
try { |
|
|
|
shareForCardPay(record.getTenantId(), record.getCardId(), record.getOrderId(), record.getId()); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("分账失败"); |
|
|
|
} |
|
|
|
|
|
|
|
return new ResultData(record); |
|
|
|
} |
|
|
|
@@ -203,6 +209,7 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
int psNum = 0; |
|
|
|
try { |
|
|
|
WxCardSpend cardSpendQ = new WxCardSpend(); |
|
|
|
cardSpendQ.setTenantId(tenantId); |
|
|
|
cardSpendQ.setCardId(cardId); |
|
|
|
psNum = wxCardSpendMapper.selectCount(cardSpendQ); |
|
|
|
if (psNum >= 20) { |
|
|
|
@@ -238,6 +245,11 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
shareOrder.setTransactionId(cardInfo.getTransactionId()); |
|
|
|
shareOrder.setShareAmount(cardSpend.getRealPayment()); |
|
|
|
profitSharingOrderService.createSharingOrder(shareOrder); |
|
|
|
if(cardSpend.getCardRemainRealAmount() == 0) { |
|
|
|
shareOrder.setPayAmount(cardInfo.getSaleAmount()); |
|
|
|
shareOrder.setType(EnumProfitSharingOrderType.PROFIT_SHARING_FINISH.getCode()); |
|
|
|
profitSharingOrderService.finishSharingOrder(shareOrder); |
|
|
|
} |
|
|
|
} else { |
|
|
|
logger.error("微信分账: 未找到payorder or merchant at orderid-" + orderId); |
|
|
|
} |
|
|
|
|