From 3a50fc9dee4d08d20e17054c30f18cf93b6212d4 Mon Sep 17 00:00:00 2001 From: luoyang Date: Mon, 11 Nov 2019 15:20:08 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=AE=A2=E6=88=B7=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=89=8B=E7=BB=AD=E8=B4=B9=E5=AF=BC=E8=87=B4=E6=8F=90=E6=88=90?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E6=88=90=E6=9C=AC=E6=89=8B=E7=BB=AD=E8=B4=B9?= =?UTF-8?q?=E9=AB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../impls/CityPartnerPrizeServiceImpl.java | 18 +++--------------- .../mappers/payment/TransactionMapper.xml | 10 ++++++++-- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/pom.xml b/pom.xml index 3f9f1080c..108bb5286 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 manage - 1.2.80 + 1.2.81 UTF-8 1.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 f645150be..349aa4013 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,7 +429,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { List transactionDetail = transactionMapper.listTransactionForCityPartnerCommissionByDate(year, month); Map> groupByOrgMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("org_id"))); for (Map.Entry> oneOrg : groupByOrgMap.entrySet()) { - int orgId = oneOrg.getKey(); JSONObject org = orgMapper.findOne(orgId); if (org == null) { @@ -440,8 +439,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { generateold(monthStr); return; } - - List items = oneOrg.getValue(); Map> groupByChannelMap = items.stream().collect(Collectors.groupingBy(e -> e.getString("channel"))); List channelAmount = orgChannelAmount(org, groupByChannelMap, channelCharge); @@ -450,23 +447,18 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { channel.put("month", month); channel.put("year", year); channel.put("org_id", orgId); - financialPartnerCommissionMapper.save(channel); } } Map> groupByClientMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("client_id"))); for (Map.Entry> oneClient : groupByClientMap.entrySet()) { - JSONObject org = orgMapper.findOne(oneClient.getValue().get(0).getInteger("org_id")); 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); } - } - Runnable task = () -> { generateAgent(monthStr, channelCharge); generateReferrer(monthStr); @@ -479,7 +471,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { public List orgChannelAmount(JSONObject orgInfo, Map> channelMap, JSONObject channelCharge) { List amountByChannel = new ArrayList<>(); - for (Map.Entry> oneChannel : channelMap.entrySet()) { BigDecimal total = BigDecimal.ZERO; BigDecimal total_surage = BigDecimal.ZERO; @@ -487,7 +478,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { BigDecimal royalpay_surage = BigDecimal.ZERO; JSONObject json = new JSONObject(); String channel = oneChannel.getKey(); - if ("hf".equals(oneChannel.getKey().toLowerCase()) || "yeepay".equals(oneChannel.getKey().toLowerCase()) || "lakalapay".equals(oneChannel.getKey().toLowerCase())) { channel = "cb_bankpay"; if (orgInfo.get("cb_bankpay_rate_value") == null) { @@ -498,9 +488,8 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { throw new ServerErrorException(orgInfo.getString("name") + "组织下" + oneChannel.getKey() + "成本手续费未设置"); } } - for (JSONObject params : oneChannel.getValue()) { - BigDecimal tmpClearingAmount = params.getBigDecimal("clearing_amount"); + 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")); //增加货币判断 @@ -543,7 +532,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { channel = "cb_bankpay"; } for (JSONObject params : oneChannel.getValue()) { - BigDecimal tmpClearingAmount = params.getBigDecimal("clearing_amount"); + 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")); //增加货币判断 @@ -578,7 +567,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { //type 1:一级代理 2:二级代理 public List clientChannelAmount(int clientId, JSONObject orgInfo, Map> channelMap, JSONObject channelCharge, int year, int month, int type) { List amountByChannel = new ArrayList<>(); - for (Map.Entry> oneChannel : channelMap.entrySet()) { String recordId = ""; if (type == 1) { @@ -607,7 +595,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { } catch (Exception e) { } for (JSONObject params : oneChannel.getValue()) { - BigDecimal tmpClearingAmount = params.getBigDecimal("clearing_amount"); + 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")); //增加货币判断 diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml index 645f42769..99175a97a 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/payment/TransactionMapper.xml @@ -742,10 +742,13 @@ if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount) clearing_amount, if(t.transaction_type = 'Credit', t.total_surcharge, -t.total_surcharge) total_surcharge, if(t.transaction_type = 'Credit', t.channel_surcharge, -t.channel_surcharge) channel_surcharge, + if(t.transaction_type = 'Credit', t.settle_amount, -t.settle_amount) settle_amount, t.order_id, t.org_rate, - t.surcharge_cashback + t.surcharge_cashback, + o.customer_surcharge from pmt_transactions t + LEFT JOIN pmt_orders o on o.order_id = t.order_id INNER JOIN sys_org so ON t.org_id = so.org_id AND so.is_valid = 1 AND so.type = 0 AND so.citypartner = 1 AND so.commission = 1 @@ -766,10 +769,13 @@ if(t.transaction_type = 'Credit', t.clearing_amount, -t.clearing_amount) clearing_amount, if(t.transaction_type = 'Credit', t.total_surcharge, -t.total_surcharge) total_surcharge, if(t.transaction_type = 'Credit', t.channel_surcharge, -t.channel_surcharge) channel_surcharge, + if(t.transaction_type = 'Credit', t.settle_amount, -t.settle_amount) settle_amount, t.order_id, t.org_rate, - t.surcharge_cashback + t.surcharge_cashback, + o.customer_surcharge from pmt_transactions t + LEFT JOIN pmt_orders o on o.order_id = t.order_id INNER JOIN sys_org so ON t.org_id = so.org_id AND so.is_valid = 1 AND so.type = 0 AND so.parent_org_id != ''