|
|
@ -429,26 +429,28 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
String channel = oneChannel.getKey();
|
|
|
|
String channel = oneChannel.getKey();
|
|
|
|
if (orgInfo.get(channel.toLowerCase() + "_rate_value") == null) {
|
|
|
|
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()) {
|
|
|
|
for (JSONObject params : oneChannel.getValue()) {
|
|
|
|
BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : params.getBigDecimal("clearing_amount");
|
|
|
|
if(StringUtils.equals("rpaypmt_card",channel.toLowerCase())){
|
|
|
|
BigDecimal channelRate = params.get("org_rate") != null ? params.getBigDecimal("org_rate") : (orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value").divide(CommonConsts.HUNDRED, 4, RoundingMode.DOWN));
|
|
|
|
channel="rpaypmt_domestic_card";
|
|
|
|
//增加transaction_fee为null异常
|
|
|
|
covertOrgChangeAmount(params,orgInfo,channel,total,total_surage,royalpay_surage,net_surage,transaction_fee);
|
|
|
|
if (!params.containsKey("transaction_fee") || StringUtils.isEmpty(params.getString("transaction_fee"))) {
|
|
|
|
channel="rpaypmt_overseas_card";
|
|
|
|
params.put("transaction_fee", BigDecimal.ZERO);
|
|
|
|
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);
|
|
|
|
BigDecimal org_charge = total_surage.subtract(royalpay_surage);
|
|
|
|
json.put("channel", oneChannel.getKey());
|
|
|
|
json.put("channel", oneChannel.getKey());
|
|
|
@ -467,6 +469,31 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
return amountByChannel;
|
|
|
|
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) {
|
|
|
|
public List<JSONObject> parentOrgChannelAmount(JSONObject orgInfo, JSONObject parentOrgInfo, Map<String, List<JSONObject>> channelMap, JSONObject channelCharge) {
|
|
|
|
List<JSONObject> amountByChannel = new ArrayList<>();
|
|
|
|
List<JSONObject> amountByChannel = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|