代理商生成数据异常修改

master
dulingling 4 years ago
parent e9ed2cfe28
commit 553a6409ea

@ -9,7 +9,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>2.3.52</version>
<version>2.3.53</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jib-maven-plugin.version>2.4.0</jib-maven-plugin.version>

@ -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<JSONObject> parentOrgChannelAmount(JSONObject orgInfo, JSONObject parentOrgInfo, Map<String, List<JSONObject>> channelMap, JSONObject channelCharge) {
List<JSONObject> 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) {

Loading…
Cancel
Save