From 7110b8a38371da44e3a67d0c13b664459c97bc0c Mon Sep 17 00:00:00 2001 From: Stormeye Wu Date: Tue, 18 Dec 2018 13:20:06 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=82=A8=E5=80=BC=E5=8D=A1][=E4=BF=AE?= =?UTF-8?q?=E6=94=B9]:=E5=95=86=E5=9C=BA=E8=90=A5=E9=94=80=E8=A1=A5?= =?UTF-8?q?=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxCardSpendServiceImpl.java | 49 ++++++++++--------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java index 5cc847256..84da4ffbf 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCardSpendServiceImpl.java @@ -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 {