|
|
@ -349,8 +349,8 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
throw new ServerErrorException("请不要重复生成合伙人记录");
|
|
|
|
throw new ServerErrorException("请不要重复生成合伙人记录");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
financialPartnerCommissionDetailMapper.clearData(year, month, 1);
|
|
|
|
// financialPartnerCommissionDetailMapper.clearData(year, month, 1);
|
|
|
|
financialPartnerCommissionMapper.clearData(year, month, 1);
|
|
|
|
// financialPartnerCommissionMapper.clearData(year, month, 1);
|
|
|
|
|
|
|
|
|
|
|
|
JSONObject sysConfig = sysConfigManager.getSysConfig();
|
|
|
|
JSONObject sysConfig = sysConfigManager.getSysConfig();
|
|
|
|
BigDecimal alipayChargeRate = new BigDecimal("0.6");
|
|
|
|
BigDecimal alipayChargeRate = new BigDecimal("0.6");
|
|
|
@ -396,7 +396,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
channel.put("month", month);
|
|
|
|
channel.put("month", month);
|
|
|
|
channel.put("year", year);
|
|
|
|
channel.put("year", year);
|
|
|
|
channel.put("org_id", orgId);
|
|
|
|
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")));
|
|
|
|
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")));
|
|
|
|
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);
|
|
|
|
List<JSONObject> clientChannelAmount = clientChannelAmount(oneClient.getKey(), org, groupByChannel, channelCharge, year, month, 1);
|
|
|
|
for (JSONObject channel : clientChannelAmount) {
|
|
|
|
for (JSONObject channel : clientChannelAmount) {
|
|
|
|
financialPartnerCommissionDetailMapper.save(channel);
|
|
|
|
// financialPartnerCommissionDetailMapper.save(channel);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Runnable task = () -> {
|
|
|
|
Runnable task = () -> {
|
|
|
@ -443,10 +443,8 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (JSONObject params : oneChannel.getValue()) {
|
|
|
|
for (JSONObject params : oneChannel.getValue()) {
|
|
|
|
if(StringUtils.equals("rpaypmt_card",channel.toLowerCase())){
|
|
|
|
if(StringUtils.equals("rpaypmt_card",channel.toLowerCase())){
|
|
|
|
channel="rpaypmt_domestic_card";
|
|
|
|
covertOrgChangeAmount(params,orgInfo,"rpaypmt_domestic_card",total,total_surage,royalpay_surage,net_surage,transaction_fee);
|
|
|
|
covertOrgChangeAmount(params,orgInfo,channel,total,total_surage,royalpay_surage,net_surage,transaction_fee);
|
|
|
|
covertOrgChangeAmount(params,orgInfo,"rpaypmt_overseas_card",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);
|
|
|
|
|
|
|
|
}else{
|
|
|
|
}else{
|
|
|
|
covertOrgChangeAmount(params,orgInfo,channel,total,total_surage,royalpay_surage,net_surage,transaction_fee);
|
|
|
|
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()) {
|
|
|
|
for (JSONObject params : oneChannel.getValue()) {
|
|
|
|
BigDecimal tmpClearingAmount = params.getBooleanValue("customer_surcharge") ? params.getBigDecimal("settle_amount") : 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));
|
|
|
|
if(orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value") == null){
|
|
|
|
BigDecimal tmpTotalSurcharge = params.getBigDecimal("total_surcharge").subtract(params.getBigDecimal("surcharge_cashback"));
|
|
|
|
System.out.println("Rate_value======================="+orgInfo.getBigDecimal(channel.toLowerCase() + "_rate_value"));
|
|
|
|
//增加货币判断
|
|
|
|
|
|
|
|
//增加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(StringUtils.equals(channel.toLowerCase() + "_rate_value","rpaypmt_card_rate_value")){
|
|
|
|
if (total.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
|
convertChildOrgChannelAmount(params,orgInfo,"rpaypmt_domestic_card",total,total_surage,royalpay_surage,net_surage,transaction_fee,datefrom,dateto,tmpClearingAmount);
|
|
|
|
datefrom = params.getDate("transaction_time");
|
|
|
|
convertChildOrgChannelAmount(params,orgInfo,"rpaypmt_overseas_card",total,total_surage,royalpay_surage,net_surage,transaction_fee,datefrom,dateto,tmpClearingAmount);
|
|
|
|
dateto = params.getDate("transaction_time");
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
convertChildOrgChannelAmount(params,orgInfo,channel,total,total_surage,royalpay_surage,net_surage,transaction_fee,datefrom,dateto,tmpClearingAmount);
|
|
|
|
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);
|
|
|
|
BigDecimal org_charge = total_surage.subtract(royalpay_surage);
|
|
|
|
if (channel.toLowerCase().equals("alipay_direct")) {
|
|
|
|
if (channel.toLowerCase().equals("alipay_direct")) {
|
|
|
@ -640,6 +622,42 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
return amountByChannel;
|
|
|
|
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) {
|
|
|
|
private int currencyScale(String currency) {
|
|
|
|
int i = 0;
|
|
|
|
int i = 0;
|
|
|
|
switch (currency) {
|
|
|
|
switch (currency) {
|
|
|
|