From 5107e23dc3cac811a2395323b54a7897ad81f9e9 Mon Sep 17 00:00:00 2001 From: dulingling Date: Wed, 5 Aug 2020 23:06:14 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=95=86=E7=94=9F?= =?UTF-8?q?=E6=88=90=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 9cd5a1ab9..7d20c57a1 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<>(); From ef372eb4251178ec5bf3237d962581e51e2ae73d Mon Sep 17 00:00:00 2001 From: "taylor.dang" Date: Thu, 6 Aug 2020 09:50:39 +0800 Subject: [PATCH 2/7] fix --- .../royalpay/payment/manage/task/SecurePaySettleFileTask.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/task/SecurePaySettleFileTask.java b/src/main/java/au/com/royalpay/payment/manage/task/SecurePaySettleFileTask.java index 70f58b530..09d43d79d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/task/SecurePaySettleFileTask.java +++ b/src/main/java/au/com/royalpay/payment/manage/task/SecurePaySettleFileTask.java @@ -3,6 +3,7 @@ package au.com.royalpay.payment.manage.task; import au.com.royalpay.payment.manage.system.core.TradeSecureService; import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler; import org.apache.commons.lang3.time.DateFormatUtils; +import org.apache.commons.lang3.time.DateUtils; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -22,7 +23,7 @@ public class SecurePaySettleFileTask { @Scheduled(cron = "0 0 3 * * *") public void sendSecurePaySettleFile() { synchronizedScheduler.executeProcess("task:securepay_settle_file_sending", 60_000, () -> - tradeSecureService.sendSecurePaySettleFile(DateFormatUtils.format(new Date(), "yyyyMMdd")) + tradeSecureService.sendSecurePaySettleFile(DateFormatUtils.format(DateUtils.addDays(new Date(), -1), "yyyyMMdd")) ); } } From e9dc12b4939ac77e58afbd2df8ae00415bdd4f30 Mon Sep 17 00:00:00 2001 From: dulingling Date: Thu, 6 Aug 2020 09:52:52 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=95=86=E7=94=9F?= =?UTF-8?q?=E6=88=90=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 | 80 ++++++++++++------- 2 files changed, 50 insertions(+), 32 deletions(-) diff --git a/pom.xml b/pom.xml index 7d20c57a1..e5ede74f7 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.51 + 2.3.52 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 29c3dfc6a..a7c79acb9 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 @@ -349,8 +349,8 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { throw new ServerErrorException("请不要重复生成合伙人记录"); } - financialPartnerCommissionDetailMapper.clearData(year, month, 1); - financialPartnerCommissionMapper.clearData(year, month, 1); +// financialPartnerCommissionDetailMapper.clearData(year, month, 1); +// financialPartnerCommissionMapper.clearData(year, month, 1); JSONObject sysConfig = sysConfigManager.getSysConfig(); BigDecimal alipayChargeRate = new BigDecimal("0.6"); @@ -396,7 +396,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { channel.put("month", month); channel.put("year", year); channel.put("org_id", orgId); - financialPartnerCommissionMapper.save(channel); +// financialPartnerCommissionMapper.save(channel); } } Map> groupByClientMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("client_id"))); @@ -405,7 +405,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { Map> groupByChannel = oneClient.getValue().stream().collect(Collectors.groupingBy(e -> e.getString("channel"))); List clientChannelAmount = clientChannelAmount(oneClient.getKey(), org, groupByChannel, channelCharge, year, month, 1); for (JSONObject channel : clientChannelAmount) { - financialPartnerCommissionDetailMapper.save(channel); +// financialPartnerCommissionDetailMapper.save(channel); } } Runnable task = () -> { @@ -443,10 +443,8 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { } for (JSONObject params : oneChannel.getValue()) { 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); + covertOrgChangeAmount(params,orgInfo,"rpaypmt_domestic_card",total,total_surage,royalpay_surage,net_surage,transaction_fee); + covertOrgChangeAmount(params,orgInfo,"rpaypmt_overseas_card",total,total_surage,royalpay_surage,net_surage,transaction_fee); }else{ covertOrgChangeAmount(params,orgInfo,channel,total,total_surage,royalpay_surage,net_surage,transaction_fee); @@ -576,32 +574,16 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { } 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)); - BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); - //增加货币判断 - //增加transaction_fee为null异常 - if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { - params.put("transaction_fee", BigDecimal.ZERO); + if(orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value") == null){ + System.out.println("Rate_value======================="+orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value")); } - int i = currencyScale(params.getString("clearing_currency")); - if (total.compareTo(BigDecimal.ZERO) == 0) { - datefrom = params.getDate("transaction_time"); - dateto = params.getDate("transaction_time"); - } else { - if (params.getDate("transaction_time").before(datefrom)) { - datefrom = params.getDate("transaction_time"); - } - if (params.getDate("transaction_time").after(dateto)) { - dateto = params.getDate("transaction_time"); - } + if(StringUtils.equals(channel.toLowerCase() + "_rate_value","rpaypmt_card_rate_value")){ + convertChildOrgChannelAmount(params,orgInfo,"rpaypmt_domestic_card",total,total_surage,royalpay_surage,net_surage,transaction_fee,datefrom,dateto,tmpClearingAmount); + convertChildOrgChannelAmount(params,orgInfo,"rpaypmt_overseas_card",total,total_surage,royalpay_surage,net_surage,transaction_fee,datefrom,dateto,tmpClearingAmount); + }else{ + convertChildOrgChannelAmount(params,orgInfo,channel,total,total_surage,royalpay_surage,net_surage,transaction_fee,datefrom,dateto,tmpClearingAmount); } - 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); if (channel.toLowerCase().equals("alipay_direct")) { @@ -640,6 +622,42 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { return amountByChannel; } + private void convertChildOrgChannelAmount(JSONObject params ,JSONObject orgInfo,String channel, + BigDecimal total, + BigDecimal total_surage, + BigDecimal royalpay_surage, + BigDecimal net_surage, + BigDecimal transaction_fee, + Date datefrom, Date dateto, + BigDecimal tmpClearingAmount ){ + BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); + BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); + //增加货币判断 + //增加transaction_fee为null异常 + if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { + params.put("transaction_fee", BigDecimal.ZERO); + } + int i = currencyScale(params.getString("clearing_currency")); + if (total.compareTo(BigDecimal.ZERO) == 0) { + datefrom = params.getDate("transaction_time"); + dateto = params.getDate("transaction_time"); + } else { + if (params.getDate("transaction_time").before(datefrom)) { + datefrom = params.getDate("transaction_time"); + } + if (params.getDate("transaction_time").after(dateto)) { + dateto = params.getDate("transaction_time"); + } + } + + 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")); + } + private int currencyScale(String currency) { int i = 0; switch (currency) { From e9ed2cfe289e6c9997fdd2d1c71c2b1ab8e53d3b Mon Sep 17 00:00:00 2001 From: dulingling Date: Thu, 6 Aug 2020 09:55:28 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=95=86=E7=94=9F?= =?UTF-8?q?=E6=88=90=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 --- .../core/impls/CityPartnerPrizeServiceImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 a7c79acb9..30f0f04ca 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 @@ -349,8 +349,8 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { throw new ServerErrorException("请不要重复生成合伙人记录"); } -// financialPartnerCommissionDetailMapper.clearData(year, month, 1); -// financialPartnerCommissionMapper.clearData(year, month, 1); + financialPartnerCommissionDetailMapper.clearData(year, month, 1); + financialPartnerCommissionMapper.clearData(year, month, 1); JSONObject sysConfig = sysConfigManager.getSysConfig(); BigDecimal alipayChargeRate = new BigDecimal("0.6"); @@ -396,7 +396,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { channel.put("month", month); channel.put("year", year); channel.put("org_id", orgId); -// financialPartnerCommissionMapper.save(channel); + financialPartnerCommissionMapper.save(channel); } } Map> groupByClientMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("client_id"))); @@ -405,7 +405,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { Map> groupByChannel = oneClient.getValue().stream().collect(Collectors.groupingBy(e -> e.getString("channel"))); List clientChannelAmount = clientChannelAmount(oneClient.getKey(), org, groupByChannel, channelCharge, year, month, 1); for (JSONObject channel : clientChannelAmount) { -// financialPartnerCommissionDetailMapper.save(channel); + financialPartnerCommissionDetailMapper.save(channel); } } Runnable task = () -> { From 553a6409ea89681c86bcca981343aba60cf8e28b Mon Sep 17 00:00:00 2001 From: dulingling Date: Thu, 6 Aug 2020 10:19:20 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=95=86=E7=94=9F?= =?UTF-8?q?=E6=88=90=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 | 195 +++++++++++------- 2 files changed, 125 insertions(+), 72 deletions(-) diff --git a/pom.xml b/pom.xml index e5ede74f7..b0fcde975 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.52 + 2.3.53 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 30f0f04ca..13701eb1f 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 @@ -443,10 +443,57 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { } for (JSONObject params : oneChannel.getValue()) { if(StringUtils.equals("rpaypmt_card",channel.toLowerCase())){ - covertOrgChangeAmount(params,orgInfo,"rpaypmt_domestic_card",total,total_surage,royalpay_surage,net_surage,transaction_fee); - covertOrgChangeAmount(params,orgInfo,"rpaypmt_overseas_card",total,total_surage,royalpay_surage,net_surage,transaction_fee); + //rpaypmt_domestic_card + 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("rpaypmt_domestic_card" + "_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(params.getBigDecimal("channel_surcharge")); + transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); + + //rpaypmt_overseas_card + channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal("rpaypmt_overseas_card" + "_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); + } + tmpTotalSurcharge = params.getBigDecimal("total_surcharge") + .subtract(params.getBigDecimal("surcharge_cashback")) + .subtract(params.getBigDecimal("transaction_fee")); + //增加货币判断 + 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(params.getBigDecimal("channel_surcharge")); + transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); }else{ - covertOrgChangeAmount(params,orgInfo,channel,total,total_surage,royalpay_surage,net_surage,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")); } } @@ -467,31 +514,6 @@ 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<>(); @@ -574,15 +596,82 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { } for (JSONObject params : oneChannel.getValue()) { BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount"); - if(orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value") == null){ - System.out.println("Rate_value======================="+orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value")); - } if(StringUtils.equals(channel.toLowerCase() + "_rate_value","rpaypmt_card_rate_value")){ - convertChildOrgChannelAmount(params,orgInfo,"rpaypmt_domestic_card",total,total_surage,royalpay_surage,net_surage,transaction_fee,datefrom,dateto,tmpClearingAmount); - convertChildOrgChannelAmount(params,orgInfo,"rpaypmt_overseas_card",total,total_surage,royalpay_surage,net_surage,transaction_fee,datefrom,dateto,tmpClearingAmount); + //rpaypmt_domestic_card + BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal("rpaypmt_domestic_card_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); + BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); + if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { + params.put("transaction_fee", BigDecimal.ZERO); + } + int i = currencyScale(params.getString("clearing_currency")); + if (total.compareTo(BigDecimal.ZERO) == 0) { + datefrom = params.getDate("transaction_time"); + dateto = params.getDate("transaction_time"); + } else { + if (params.getDate("transaction_time").before(datefrom)) { + datefrom = params.getDate("transaction_time"); + } + if (params.getDate("transaction_time").after(dateto)) { + dateto = params.getDate("transaction_time"); + } + } + + 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(params.getBigDecimal("channel_surcharge")); + transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); + + //rpaypmt_overseas_card + channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal( "rpaypmt_overseas_card_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); + tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); + if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { + params.put("transaction_fee", BigDecimal.ZERO); + } + if (total.compareTo(BigDecimal.ZERO) == 0) { + datefrom = params.getDate("transaction_time"); + dateto = params.getDate("transaction_time"); + } else { + if (params.getDate("transaction_time").before(datefrom)) { + datefrom = params.getDate("transaction_time"); + } + if (params.getDate("transaction_time").after(dateto)) { + dateto = params.getDate("transaction_time"); + } + } + + 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(params.getBigDecimal("channel_surcharge")); + transaction_fee = transaction_fee.add(params.getBigDecimal("transaction_fee")); }else{ - convertChildOrgChannelAmount(params,orgInfo,channel,total,total_surage,royalpay_surage,net_surage,transaction_fee,datefrom,dateto,tmpClearingAmount); - } + BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); + BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); + //增加货币判断 + //增加transaction_fee为null异常 + if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { + params.put("transaction_fee", BigDecimal.ZERO); + } + int i = currencyScale(params.getString("clearing_currency")); + if (total.compareTo(BigDecimal.ZERO) == 0) { + datefrom = params.getDate("transaction_time"); + dateto = params.getDate("transaction_time"); + } else { + if (params.getDate("transaction_time").before(datefrom)) { + datefrom = params.getDate("transaction_time"); + } + if (params.getDate("transaction_time").after(dateto)) { + dateto = params.getDate("transaction_time"); + } + } + + 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); @@ -622,42 +711,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { return amountByChannel; } - private void convertChildOrgChannelAmount(JSONObject params ,JSONObject orgInfo,String channel, - BigDecimal total, - BigDecimal total_surage, - BigDecimal royalpay_surage, - BigDecimal net_surage, - BigDecimal transaction_fee, - Date datefrom, Date dateto, - BigDecimal tmpClearingAmount ){ - BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)); - BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback")); - //增加货币判断 - //增加transaction_fee为null异常 - if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) { - params.put("transaction_fee", BigDecimal.ZERO); - } - int i = currencyScale(params.getString("clearing_currency")); - if (total.compareTo(BigDecimal.ZERO) == 0) { - datefrom = params.getDate("transaction_time"); - dateto = params.getDate("transaction_time"); - } else { - if (params.getDate("transaction_time").before(datefrom)) { - datefrom = params.getDate("transaction_time"); - } - if (params.getDate("transaction_time").after(dateto)) { - dateto = params.getDate("transaction_time"); - } - } - - 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")); - } - private int currencyScale(String currency) { int i = 0; switch (currency) { From a8db30337942c1767bc7a2c666197eceaead8f0b Mon Sep 17 00:00:00 2001 From: dulingling Date: Thu, 6 Aug 2020 10:29:43 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=95=86=E7=94=9F?= =?UTF-8?q?=E6=88=90=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 +- .../core/impls/CityPartnerPrizeServiceImpl.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index b0fcde975..2c39a9411 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.53 + 2.3.54 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 13701eb1f..fe4fb0b6f 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 @@ -344,10 +344,10 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { int year = monthCal.get(Calendar.YEAR); int month = monthCal.get(Calendar.MONTH) + 1; - List list = financialPartnerCommissionMapper.list(year, month); - if (list != null && !list.isEmpty()) { - throw new ServerErrorException("请不要重复生成合伙人记录"); - } +// List list = financialPartnerCommissionMapper.list(year, month); +// if (list != null && !list.isEmpty()) { +// throw new ServerErrorException("请不要重复生成合伙人记录"); +// } financialPartnerCommissionDetailMapper.clearData(year, month, 1); financialPartnerCommissionMapper.clearData(year, month, 1); From bb840f3117c9b5b2b41e208b353adf407e7acc5c Mon Sep 17 00:00:00 2001 From: dulingling Date: Thu, 6 Aug 2020 11:00:52 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BB=A3=E7=90=86=E5=95=86=E7=94=9F?= =?UTF-8?q?=E6=88=90=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 +- .../citypartner/core/impls/CityPartnerPrizeServiceImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 2c39a9411..822e1873a 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 2.3.54 + 2.3.55 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 fe4fb0b6f..581cce80b 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 @@ -505,7 +505,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { json.put("net_charge", net_surage); json.put("org_rate", orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value")); json.put("royalpay_charge", royalpay_surage); - json.put("org_charge", org_charge); + json.put("org_charge", org_charge.signum()<0?new BigDecimal(0):org_charge); json.put("commission_type", "1"); json.put("create_time", new Date()); amountByChannel.add(json); @@ -697,7 +697,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { if (type == 2) { json.put("org_net_charge", net_surage); } - json.put("org_charge", org_charge); + json.put("org_charge", org_charge.signum()<0?new BigDecimal(0):org_charge); json.put("transaction_fee", transaction_fee); json.put("commission_type", "1"); json.put("create_time", new Date());