|
|
|
@ -265,8 +265,8 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
|
channelMap.put("Alipay", "Alipay");
|
|
|
|
|
channelMap.put("Wechat", "Wechat");
|
|
|
|
|
channelMap.put("Bestpay", "Bestpay");
|
|
|
|
|
channelMap.put("jd","jd");
|
|
|
|
|
channelMap.put("AlipayOnline","AlipayOnline");
|
|
|
|
|
channelMap.put("jd", "jd");
|
|
|
|
|
channelMap.put("AlipayOnline", "AlipayOnline");
|
|
|
|
|
List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForCityPartnerCommission(year, month);
|
|
|
|
|
Map<String, CityPartnerCommissionAnalysis> results = new HashMap<>();
|
|
|
|
|
for (JSONObject analysisDay : transactionAnalysis) {
|
|
|
|
@ -286,7 +286,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
|
CityPartnerCommissionAnalysis orgAnalysis = results.get(orgId + channel);
|
|
|
|
|
if (orgAnalysis == null) {
|
|
|
|
|
orgAnalysis = new CityPartnerCommissionAnalysis(orgId, year, month, org.getBigDecimal(channel + "_rate_value"), key, alipayChargeRate,
|
|
|
|
|
wechatChargeRate,jdChargeRate,alipayonlineChargeRate);
|
|
|
|
|
wechatChargeRate, jdChargeRate, alipayonlineChargeRate);
|
|
|
|
|
results.put(orgId + channel, orgAnalysis);
|
|
|
|
|
}
|
|
|
|
|
orgAnalysis.attachAnalysis(analysisDay, channel);
|
|
|
|
@ -340,7 +340,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@Transactional
|
|
|
|
|
public void generateAgent(String monthStr,int orgId) {
|
|
|
|
|
public void generateAgent(String monthStr, int orgId) {
|
|
|
|
|
JSONObject org = orgMapper.findOne(orgId);
|
|
|
|
|
if (org == null) {
|
|
|
|
|
// shall never happen
|
|
|
|
@ -364,9 +364,9 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
|
channelMap.put("Alipay", "Alipay");
|
|
|
|
|
channelMap.put("Wechat", "Wechat");
|
|
|
|
|
channelMap.put("Bestpay", "Bestpay");
|
|
|
|
|
channelMap.put("jd","jd");
|
|
|
|
|
channelMap.put("AlipayOnline","AlipayOnline");
|
|
|
|
|
List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForAgentCommission(year, month,org.getIntValue("parent_org_id"));
|
|
|
|
|
channelMap.put("jd", "jd");
|
|
|
|
|
channelMap.put("AlipayOnline", "AlipayOnline");
|
|
|
|
|
List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForAgentCommission(year, month, org.getIntValue("parent_org_id"));
|
|
|
|
|
Map<String, AgentCommissionAnalysis> results = new HashMap<>();
|
|
|
|
|
for (JSONObject analysisDay : transactionAnalysis) {
|
|
|
|
|
String key = analysisDay.getString("channel");
|
|
|
|
@ -377,7 +377,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
|
channel = channel.toLowerCase();
|
|
|
|
|
AgentCommissionAnalysis agentCommissionAnalysis = results.get(orgId + channel);
|
|
|
|
|
if (agentCommissionAnalysis == null) {
|
|
|
|
|
agentCommissionAnalysis = new AgentCommissionAnalysis(orgId, year, month, org.getBigDecimal(channel + "_rate_value"), key,org,parnetOrg);
|
|
|
|
|
agentCommissionAnalysis = new AgentCommissionAnalysis(orgId, year, month, org.getBigDecimal(channel + "_rate_value"), key, org, parnetOrg);
|
|
|
|
|
results.put(orgId + channel, agentCommissionAnalysis);
|
|
|
|
|
}
|
|
|
|
|
agentCommissionAnalysis.attachAnalysis(analysisDay, channel);
|
|
|
|
@ -561,13 +561,12 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
|
if (CollectionUtils.isEmpty(total)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BigDecimal royalpay_charge = BigDecimal.ZERO;
|
|
|
|
|
List<JSONObject> partnerPrizeList = getCityPartnerPrizeInfoList(monthStr);
|
|
|
|
|
Map<Integer, JSONObject> countPartnerPrizeMap = new HashMap<>();
|
|
|
|
|
List<JSONObject> partnerPrizeList = financialPartnerCommissionDetailMapper.listDetailByMonth(year,month);
|
|
|
|
|
Map<String, JSONObject> countPartnerPrizeMap = new HashMap<>();
|
|
|
|
|
for (JSONObject p : partnerPrizeList) {
|
|
|
|
|
royalpay_charge = royalpay_charge.add(p.getBigDecimal("royalpay_charge"));
|
|
|
|
|
Integer key = p.getInteger("client_id");
|
|
|
|
|
String key = p.getString("client_id")+p.getString("channel").toLowerCase();
|
|
|
|
|
JSONObject partnerTmp = countPartnerPrizeMap.get(key);
|
|
|
|
|
if (partnerTmp == null) {
|
|
|
|
|
JSONObject partner = new JSONObject();
|
|
|
|
@ -578,11 +577,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String tableColumn[] = { "gross_amount", "total_charge", "org_charge", "org_net_charge" };
|
|
|
|
|
|
|
|
|
|
List<String> recordIds = new ArrayList<>();
|
|
|
|
@ -607,6 +601,12 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
|
detail.put("date_from", format.format(detail.get("date_from")));
|
|
|
|
|
detail.put("date_to", format.format(detail.get("date_to")));
|
|
|
|
|
String key = detail.getString("client_id");
|
|
|
|
|
detail.put("royalpay_charge",BigDecimal.ZERO);
|
|
|
|
|
if(countPartnerPrizeMap.get(key+detail.getString("channel").toLowerCase())!=null){
|
|
|
|
|
detail.put("royalpay_charge",countPartnerPrizeMap.get(key+detail.getString("channel")).getBigDecimal("royalpay_charge"));
|
|
|
|
|
}else {
|
|
|
|
|
detail.put("royalpay_charge",BigDecimal.ZERO);
|
|
|
|
|
}
|
|
|
|
|
if (detailMap.containsKey(key)) {
|
|
|
|
|
detailMap.get(key).add(detail);
|
|
|
|
|
} else {
|
|
|
|
@ -633,7 +633,7 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
|
for (JSONObject jsonObject : entry.getValue()) {
|
|
|
|
|
grossAmount = grossAmount.add(jsonObject.getBigDecimal("gross_amount"));
|
|
|
|
|
totalCharge = totalCharge.add(jsonObject.getBigDecimal("total_charge"));
|
|
|
|
|
// royalpayCharge = royalpayCharge.add(jsonObject.getBigDecimal("royalpay_charge"));
|
|
|
|
|
royalpayCharge = royalpayCharge.add(jsonObject.getBigDecimal("royalpay_charge"));
|
|
|
|
|
orgCharge = orgCharge.add(jsonObject.getBigDecimal("org_charge"));
|
|
|
|
|
if (jsonObject.getBigDecimal("net_charge") != null) {
|
|
|
|
|
netCharge = netCharge.add(jsonObject.getBigDecimal("org_net_charge"));
|
|
|
|
|