代理商生成数据异常修改

master
dulingling 4 years ago
parent a35bea1d8a
commit b63c5088d6

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

@ -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<Integer, List<JSONObject>> groupByClientMap = transactionDetail.stream().collect(Collectors.groupingBy(e -> e.getInteger("client_id")));
@ -405,7 +405,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
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);
// 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);
}
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(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);
}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) {

Loading…
Cancel
Save