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 59fd46df7..d74261ca3 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 @@ -494,12 +494,14 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { } for (JSONObject params : oneChannel.getValue()) { + BigDecimal tmpClearingAmount = params.getBigDecimal("clearing_amount").subtract(params.getBigDecimal("surcharge_cashback")); + 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 = tmpClearingAmount.multiply(params.getBigDecimal("surcharge_rate")).setScale(2, RoundingMode.HALF_UP); //增加货币判断 int i = currencyScale(params.getString("clearing_currency")); - - total = total.add(params.getBigDecimal("clearing_amount")); - total_surage = total_surage.add(params.getBigDecimal("total_surcharge")).setScale(i, RoundingMode.HALF_UP); - royalpay_surage = royalpay_surage.add(params.getBigDecimal("clearing_amount").multiply(orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP)); + 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")); } @@ -535,12 +537,15 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { channel = "cb_bankpay"; } for (JSONObject params : oneChannel.getValue()) { + BigDecimal tmpClearingAmount = params.getBigDecimal("clearing_amount").subtract(params.getBigDecimal("surcharge_cashback")); + 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 = tmpClearingAmount.multiply(params.getBigDecimal("surcharge_rate")).setScale(2, RoundingMode.HALF_UP); //增加货币判断 int i = currencyScale(params.getString("clearing_currency")); - BigDecimal parent_surage = params.getBigDecimal("clearing_amount").multiply(parentOrgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP); - BigDecimal roy_surage = (params.getBigDecimal("clearing_amount").multiply(orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP)); - total = total.add(params.getBigDecimal("clearing_amount")); - total_surage = total_surage.add(params.getBigDecimal("total_surcharge")).setScale(i, RoundingMode.HALF_UP); + BigDecimal parent_surage = tmpClearingAmount.multiply(parentOrgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP); + BigDecimal roy_surage = tmpClearingAmount.multiply(channelRate).setScale(i, RoundingMode.HALF_UP); + total = total.add(tmpClearingAmount); + total_surage = total_surage.add(tmpTotalSurcharge).setScale(i, RoundingMode.HALF_UP); royalpay_surage = royalpay_surage.add(roy_surage); //net_surage = net_surage.add(getThirdPartyCharge(params.getString("channel"), params.getBigDecimal("clearing_amount"), channelCharge)); net_surage = net_surage.add(params.getBigDecimal("channel_surcharge")); @@ -569,7 +574,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { List amountByChannel = new ArrayList<>(); for (Map.Entry> oneChannel : channelMap.entrySet()) { - JSONObject rate = merchantInfoProvider.clientCurrentRate(clientId, oneChannel.getValue().get(0).getDate("transaction_time"),oneChannel.getKey()); String recordId = ""; if (type == 1) { recordId = financialPartnerCommissionMapper.getRecordId(orgInfo.getInteger("org_id"), year, month, oneChannel.getKey()); @@ -590,6 +594,9 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { } for (JSONObject params : oneChannel.getValue()) { + BigDecimal tmpClearingAmount = params.getBigDecimal("clearing_amount").subtract(params.getBigDecimal("surcharge_cashback")); + 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 = tmpClearingAmount.multiply(params.getBigDecimal("surcharge_rate")).setScale(2, RoundingMode.HALF_UP); //增加货币判断 int i = currencyScale(params.getString("clearing_currency")); if (total.compareTo(BigDecimal.ZERO)==0 ) { @@ -604,9 +611,9 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService { } } - total = total.add(params.getBigDecimal("clearing_amount")); - total_surage = total_surage.add(params.getBigDecimal("total_surcharge")).setScale(i, RoundingMode.HALF_UP); - royalpay_surage = royalpay_surage.add(params.getBigDecimal("clearing_amount").multiply(orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN)).setScale(i, RoundingMode.HALF_UP)); + 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")); } diff --git a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java index 17d1c3b10..0cf9166d0 100644 --- a/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/merchants/core/impls/ClientManagerImpl.java @@ -4716,7 +4716,6 @@ public class ClientManagerImpl implements ClientManager, ManagerTodoNoticeProvid paymentApi.sendTemplateMessage(msg); } catch (WechatException e) { logger.error("给{}发送微信消息失败,原因:{}", userOpenId, e.getMessage()); - publisher.publishEvent(new WechatExceptionEvent(this, e, "测试商户密码修改完成")); } catch (Exception e) { logger.error("给{}发送密码重置消息失败,原因: {}", userOpenId, e.getMessage()); } 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 6ee34dcd2..cf99392c3 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 @@ -684,13 +684,15 @@ 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, - t.order_id + t.order_id, + t.org_rate, + t.surcharge_cashback from pmt_transactions t 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 AND year(t.transaction_time) = #{year} AND month(t.transaction_time) = #{month} - AND t.channel != 'Settlement' AND t.channel != 'System' + AND t.channel != 'Settlement' AND t.channel != 'System' AND t.system_generate = 0 ORDER BY t.client_id asc ]]>