From a35bea1d8a3156648c5e81f7050661f15ec340a3 Mon Sep 17 00:00:00 2001 From: dulingling Date: Wed, 5 Aug 2020 23:06:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=95=86=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BC=82=E5=B8=B8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../impls/CityPartnerPrizeServiceImpl.java | 61 +++++++++++++------ 2 files changed, 45 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index ba61f542c..33ae087fa 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.50 + 2.3.51 UTF-8 2.4.0 diff --git a/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java index 062fdb8aa..29c3dfc6a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/citypartner/core/impls/CityPartnerPrizeServiceImpl.java @@ -429,26 +429,28 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { JSONObject json = new JSONObject(); String channel = oneChannel.getKey(); if (orgInfo.get(channel.toLowerCase() + "_rate_value") == null) { - throw new ServerErrorException(orgInfo.getString("name") + "组织下" + oneChannel.getKey() + "成本手续费未设置"); + if(StringUtils.equals(channel.toLowerCase() + "_rate_value","rpaypmt_card_rate_value")){ + if(orgInfo.get("rpaypmt_domestic_card_rate_value")==null){ + throw new ServerErrorException(orgInfo.getString("name") + "组织下domestic_card成本手续费未设置"); + } + if(orgInfo.get("rpaypmt_overseas_card_rate_value")==null){ + throw new ServerErrorException(orgInfo.getString("name") + "组织下overseas_card成本手续费未设置"); + } + }else{ + throw new ServerErrorException(orgInfo.getString("name") + "组织下" + oneChannel.getKey() + "成本手续费未设置"); + + } } for (JSONObject params : oneChannel.getValue()) { - BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount"); - BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); - //增加transaction_fee为null异常 - if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { - params.put("transaction_fee", BigDecimal.ZERO); + if(StringUtils.equals("rpaypmt_card",channel.toLowerCase())){ + channel="rpaypmt_domestic_card"; + covertOrgChangeAmount(params,orgInfo,channel,total,total_surage,royalpay_surage,net_surage,transaction_fee); + channel="rpaypmt_overseas_card"; + covertOrgChangeAmount(params,orgInfo,channel,total,total_surage,royalpay_surage,net_surage,transaction_fee); + }else{ + covertOrgChangeAmount(params,orgInfo,channel,total,total_surage,royalpay_surage,net_surage,transaction_fee); + } - BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge") - .subtract(params.getBigDecimal("surcharge_cashback")) - .subtract(params.getBigDecimal("transaction_fee")); - //增加货币判断 - int i = currencyScale(params.getString("clearing_currency")); - total = total.add(tmpClearingAmount); - total_surage = total_surage.add(tmpTotalSurcharge).setScale(i, RoundingMode.HALF_UP); - royalpay_surage = royalpay_surage.add(tmpClearingAmount.multiply(channelRate).setScale(i, RoundingMode.HALF_UP)); - // net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); - net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); - transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); } BigDecimal org_charge = total_surage.subtract(royalpay_surage); json.put("channel", oneChannel.getKey()); @@ -467,6 +469,31 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { return amountByChannel; } + private void covertOrgChangeAmount(JSONObject params ,JSONObject orgInfo,String channel, + BigDecimal total, + BigDecimal total_surage, + BigDecimal royalpay_surage, + BigDecimal net_surage, + BigDecimal transaction_fee){ + BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount"); + BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); + //增加transaction_fee为null异常 + if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { + params.put("transaction_fee", BigDecimal.ZERO); + } + BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge") + .subtract(params.getBigDecimal("surcharge_cashback")) + .subtract(params.getBigDecimal("transaction_fee")); + //增加货币判断 + int i = currencyScale(params.getString("clearing_currency")); + total = total.add(tmpClearingAmount); + total_surage = total_surage.add(tmpTotalSurcharge).setScale(i, RoundingMode.HALF_UP); + royalpay_surage = royalpay_surage.add(tmpClearingAmount.multiply(channelRate).setScale(i, RoundingMode.HALF_UP)); + // net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); + net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); + transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); + } + public List parentOrgChannelAmount(JSONObject orgInfo, JSONObject parentOrgInfo, Map> channelMap, JSONObject channelCharge) { List amountByChannel = new ArrayList<>();