diff --git a/pom.xml b/pom.xml index 33ae087fa..6af77ab94 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) {