|
|
|
@@ -138,29 +138,32 @@ public class WxCardSpendServiceImpl implements WxCardSpendService { |
|
|
|
|
|
|
|
// 8. 补贴 |
|
|
|
Integer subsidyFee = (record.getDeductionAmount() - payment)* subsidyRate / 10000; |
|
|
|
Double dSubChargeFee = Math.ceil(subsidyFee * 1.0D * payAccount.getRate() / 10000); |
|
|
|
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()); |
|
|
|
merchantSubsidy.setCouponOrderId(cardInfo.getId()); |
|
|
|
merchantSubsidy.setCouponType(EnumCouponType.CARD_MULTIMCH.getCode()); |
|
|
|
merchantSubsidy.setOrderPayment(record.getDeductionAmount()); |
|
|
|
merchantSubsidy.setReceiverPayment(payment); |
|
|
|
merchantSubsidy.setRealPayment(real_payment); |
|
|
|
merchantSubsidy.setSubsidy(subsidyFee); |
|
|
|
merchantSubsidy.setRealSubsidy(realSubsidyFee); |
|
|
|
merchantSubsidy.setStatus(EnumMerchantSubsidyStatus.NOT_SUBSIDY.getCode()); |
|
|
|
merchantSubsidy.setCreateDate(curDate); |
|
|
|
merchantSubsidy.setUpdateDate(curDate); |
|
|
|
try { |
|
|
|
wxMerchantSubsidyMapper.insertSelective(merchantSubsidy); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("merchantSubsidy info insert error"); |
|
|
|
return new ResultData(ErrorCode.DB_FAIL.getCode(), "merchantSubsidy info 插入出错!"); |
|
|
|
if(subsidyFee > 0) { |
|
|
|
// 有补贴时入库 |
|
|
|
Double dSubChargeFee = Math.ceil(subsidyFee * 1.0D * payAccount.getRate() / 10000); |
|
|
|
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()); |
|
|
|
merchantSubsidy.setCouponOrderId(cardInfo.getId()); |
|
|
|
merchantSubsidy.setCouponType(EnumCouponType.CARD_MULTIMCH.getCode()); |
|
|
|
merchantSubsidy.setOrderPayment(record.getDeductionAmount()); |
|
|
|
merchantSubsidy.setReceiverPayment(payment); |
|
|
|
merchantSubsidy.setRealPayment(real_payment); |
|
|
|
merchantSubsidy.setSubsidy(subsidyFee); |
|
|
|
merchantSubsidy.setRealSubsidy(realSubsidyFee); |
|
|
|
merchantSubsidy.setStatus(EnumMerchantSubsidyStatus.NOT_SUBSIDY.getCode()); |
|
|
|
merchantSubsidy.setCreateDate(curDate); |
|
|
|
merchantSubsidy.setUpdateDate(curDate); |
|
|
|
try { |
|
|
|
wxMerchantSubsidyMapper.insertSelective(merchantSubsidy); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("merchantSubsidy info insert error"); |
|
|
|
return new ResultData(ErrorCode.DB_FAIL.getCode(), "merchantSubsidy info 插入出错!"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 9. 分账 |
|
|
|
try { |
|
|
|
|