fix 客户支付手续费导致提成组织成本手续费高

master
luoyang 5 years ago
parent d40b65ba6f
commit 3a50fc9dee

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

@ -429,7 +429,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
List<JSONObject> transactionDetail = transactionMapper.listTransactionForCityPartnerCommissionByDate(year, month);
Map<Integer, List<JSONObject>> groupByOrgMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("org_id")));
for (Map.Entry<Integer, List<JSONObject>> 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<JSONObject> items = oneOrg.getValue();
Map<String, List<JSONObject>> groupByChannelMap = items.stream().collect(Collectors.groupingBy(e -> e.getString("channel")));
List<JSONObject> 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<Integer, List<JSONObject>> groupByClientMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("client_id")));
for (Map.Entry<Integer, List<JSONObject>> oneClient : groupByClientMap.entrySet()) {
JSONObject org = orgMapper.findOne(oneClient.getValue().get(0).getInteger("org_id"));
Map<String, List<JSONObject>> groupByChannel = oneClient.getValue().stream().collect(Collectors.groupingBy(e -> e.getString("channel")));
List<JSONObject> 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<JSONObject> orgChannelAmount(JSONObject orgInfo, Map<String, List<JSONObject>> channelMap, JSONObject channelCharge) {
List<JSONObject> amountByChannel = new ArrayList<>();
for (Map.Entry<String, List<JSONObject>> 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<JSONObject> clientChannelAmount(int clientId, JSONObject orgInfo, Map<String, List<JSONObject>> channelMap, JSONObject channelCharge, int year, int month, int type) {
List<JSONObject> amountByChannel = new ArrayList<>();
for (Map.Entry<String, List<JSONObject>> 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"));
//增加货币判断

@ -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 != ''

Loading…
Cancel
Save