|
|
@ -1,5 +1,27 @@
|
|
|
|
package au.com.royalpay.payment.manage.citypartner.core.impls;
|
|
|
|
package au.com.royalpay.payment.manage.citypartner.core.impls;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
|
|
import au.com.royalpay.payment.manage.citypartner.beans.AgentCommissionAnalysis;
|
|
|
|
import au.com.royalpay.payment.manage.citypartner.beans.AgentCommissionAnalysis;
|
|
|
|
import au.com.royalpay.payment.manage.citypartner.beans.CityPartnerCommissionAnalysis;
|
|
|
|
import au.com.royalpay.payment.manage.citypartner.beans.CityPartnerCommissionAnalysis;
|
|
|
|
import au.com.royalpay.payment.manage.citypartner.beans.ReferrerCommissionAnalysis;
|
|
|
|
import au.com.royalpay.payment.manage.citypartner.beans.ReferrerCommissionAnalysis;
|
|
|
@ -16,26 +38,6 @@ import au.com.royalpay.payment.tools.env.SysConfigManager;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
|
|
|
import au.com.royalpay.payment.tools.exceptions.ServerErrorException;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Created by yixian on 2017-03-08.
|
|
|
|
* Created by yixian on 2017-03-08.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -269,11 +271,15 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
channelMap.put("Bestpay", "Bestpay");
|
|
|
|
channelMap.put("Bestpay", "Bestpay");
|
|
|
|
channelMap.put("jd", "jd");
|
|
|
|
channelMap.put("jd", "jd");
|
|
|
|
channelMap.put("AlipayOnline", "AlipayOnline");
|
|
|
|
channelMap.put("AlipayOnline", "AlipayOnline");
|
|
|
|
|
|
|
|
Set<Integer> orgIds = new HashSet<>();
|
|
|
|
List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForCityPartnerCommission(year, month);
|
|
|
|
List<JSONObject> transactionAnalysis = transactionMapper.listTransactionsForCityPartnerCommission(year, month);
|
|
|
|
Map<String, CityPartnerCommissionAnalysis> results = new HashMap<>();
|
|
|
|
Map<String, CityPartnerCommissionAnalysis> results = new HashMap<>();
|
|
|
|
for (JSONObject analysisDay : transactionAnalysis) {
|
|
|
|
for (JSONObject analysisDay : transactionAnalysis) {
|
|
|
|
int orgId = analysisDay.getIntValue("org_id");
|
|
|
|
int orgId = analysisDay.getIntValue("org_id");
|
|
|
|
JSONObject org = orgMapper.findOne(orgId);
|
|
|
|
JSONObject org = orgMapper.findOne(orgId);
|
|
|
|
|
|
|
|
if(org.getIntValue("parent_org_id")>0){
|
|
|
|
|
|
|
|
orgIds.add(orgId);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (org == null) {
|
|
|
|
if (org == null) {
|
|
|
|
// shall never happen
|
|
|
|
// shall never happen
|
|
|
|
throw new ServerErrorException("Organization Id not exists:" + orgId);
|
|
|
|
throw new ServerErrorException("Organization Id not exists:" + orgId);
|
|
|
@ -287,8 +293,6 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
if (!channelMap.containsKey(key)) {
|
|
|
|
if (!channelMap.containsKey(key)) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
channel = channel.toLowerCase();
|
|
|
|
channel = channel.toLowerCase();
|
|
|
|
CityPartnerCommissionAnalysis orgAnalysis = results.get(orgId + channel);
|
|
|
|
CityPartnerCommissionAnalysis orgAnalysis = results.get(orgId + channel);
|
|
|
|
if (orgAnalysis == null) {
|
|
|
|
if (orgAnalysis == null) {
|
|
|
@ -308,7 +312,12 @@ public class CityPartnerPrizeServiceImpl implements CityPartnerPrizeService {
|
|
|
|
financialPartnerCommissionDetailMapper.save(detail);
|
|
|
|
financialPartnerCommissionDetailMapper.save(detail);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Runnable task = ()->{
|
|
|
|
|
|
|
|
orgIds.forEach((p)->{
|
|
|
|
|
|
|
|
generateAgent(monthStr,p);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
new Thread(task).start();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|