|
|
|
@ -23,10 +23,10 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
|
|
|
|
|
private final Date month;
|
|
|
|
|
private ClientBDMapper clientBDMapper;
|
|
|
|
|
private DefaultClientWithBDAwayDeterminor clientsWithBDAwayDeterminor;
|
|
|
|
|
private Map<Integer, Map<String, JSONObject>> results = new HashMap<>();
|
|
|
|
|
private Map<Integer, JSONObject> bdMap = new HashMap<>();
|
|
|
|
|
private Map<String, Map<String, JSONObject>> results = new HashMap<>();
|
|
|
|
|
private Map<String, JSONObject> bdMap = new HashMap<>();
|
|
|
|
|
private Map<Integer, Map<Integer, List<JSONObject>>> rateConfigMap = new HashMap<>();
|
|
|
|
|
private Map<Integer, BigDecimal> bdTotalMap = new HashMap<>();
|
|
|
|
|
private Map<String, BigDecimal> bdTotalMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
public BDPrizeCalculatorDefaultImpl(List<JSONObject> tradeLogs, Date month) {
|
|
|
|
|
this.tradeLogs = tradeLogs;
|
|
|
|
@ -75,7 +75,7 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> getReport() {
|
|
|
|
|
List<JSONObject> report = new ArrayList<>();
|
|
|
|
|
for (Map.Entry<Integer, Map<String, JSONObject>> resultItem : results.entrySet()) {
|
|
|
|
|
for (Map.Entry<String, Map<String, JSONObject>> resultItem : results.entrySet()) {
|
|
|
|
|
JSONObject log = new JSONObject();
|
|
|
|
|
log.put("manager_id", resultItem.getKey());
|
|
|
|
|
JSONObject bd = bdMap.get(resultItem.getKey());
|
|
|
|
@ -123,7 +123,7 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
|
|
|
|
|
Date tradeDate = trade.getDate("trade_date");
|
|
|
|
|
List<JSONObject> bdUsers = clientBDMapper.listClientBDAvailable(clientId, tradeDate);
|
|
|
|
|
for (JSONObject bd : bdUsers) {
|
|
|
|
|
int bdId = bd.getIntValue("bd_id");
|
|
|
|
|
String bdId = bd.getString("bd_id");
|
|
|
|
|
int bdLevel = bd.getIntValue("bd_level");
|
|
|
|
|
boolean getPrize = bd.getBooleanValue("get_prize");
|
|
|
|
|
if (!getPrize) {
|
|
|
|
@ -173,7 +173,7 @@ public class BDPrizeCalculatorDefaultImpl implements BDPrizeCalculator {
|
|
|
|
|
return monthDiff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private JSONObject initDetail(int clientId, int bdId, int months, int clientSource, BigDecimal rateValue, BigDecimal coefficient, Date tradeDate) {
|
|
|
|
|
private JSONObject initDetail(int clientId, String bdId, int months, int clientSource, BigDecimal rateValue, BigDecimal coefficient, Date tradeDate) {
|
|
|
|
|
JSONObject detail;
|
|
|
|
|
detail = new JSONObject();
|
|
|
|
|
detail.put("client_id", clientId);
|
|
|
|
|