|
|
|
@ -31,12 +31,7 @@ import java.math.RoundingMode;
|
|
|
|
|
import java.text.DateFormat;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.TimeZone;
|
|
|
|
|
import java.util.TreeMap;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -158,7 +153,14 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> getTradeInTypes(JSONObject params) {
|
|
|
|
|
return transactionAnalysisMapper.getTradeAmountInTypes(params);
|
|
|
|
|
String jsonStr = stringRedisTemplate.boundValueOps("tradeInTypes"+params.getString("org_id")+ params.getString("begin")).get();
|
|
|
|
|
List<JSONObject> tradeInTypes = JSONObject.parseArray(jsonStr,JSONObject.class);
|
|
|
|
|
if(tradeInTypes != null){
|
|
|
|
|
return tradeInTypes;
|
|
|
|
|
}
|
|
|
|
|
List<JSONObject> res = transactionAnalysisMapper.getTradeAmountInTypes(params);
|
|
|
|
|
stringRedisTemplate.boundValueOps("tradeInTypes"+params.getString("org_id")+ params.getString("begin")).set(res.toString(), 5, TimeUnit.MINUTES);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -171,8 +173,15 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> getTopTradePartnersNew(JSONObject params) {
|
|
|
|
|
String jsonStr = stringRedisTemplate.boundValueOps("topTradePartnersNew"+params.getString("org_id")+ params.getString("begin")).get();
|
|
|
|
|
List<JSONObject> topTradePartnersNew = JSONObject.parseArray(jsonStr,JSONObject.class);
|
|
|
|
|
if(topTradePartnersNew != null){
|
|
|
|
|
return topTradePartnersNew;
|
|
|
|
|
}
|
|
|
|
|
params.putIfAbsent("rankType", "aud_fee");
|
|
|
|
|
return clientAnalysisMapper.listPartnersTradeAmountNew(params);
|
|
|
|
|
List<JSONObject> res = clientAnalysisMapper.listPartnersTradeAmountNew(params);
|
|
|
|
|
stringRedisTemplate.boundValueOps("topTradePartnersNew"+params.getString("org_id")+ params.getString("begin")).set(res.toString(), 5, TimeUnit.MINUTES);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -282,10 +291,17 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<JSONObject> getTradeAnalysisInDays(JSONObject params) {
|
|
|
|
|
String jsonStr = stringRedisTemplate.boundValueOps("tradeAnalysisInDays"+params.getString("org_id")+ params.getString("begin")).get();
|
|
|
|
|
List<JSONObject> tradeAnalysisInDays = JSONObject.parseArray(jsonStr,JSONObject.class);
|
|
|
|
|
if(tradeAnalysisInDays != null){
|
|
|
|
|
return tradeAnalysisInDays;
|
|
|
|
|
}
|
|
|
|
|
if (!params.containsKey("client_ids") && !params.containsKey("org_id")) {
|
|
|
|
|
params.put("client_id", 0);
|
|
|
|
|
}
|
|
|
|
|
return customerAndOrdersStatisticsMapper.getSumCustomersAnalysis(params);
|
|
|
|
|
List<JSONObject> res = customerAndOrdersStatisticsMapper.getSumCustomersAnalysis(params);
|
|
|
|
|
stringRedisTemplate.boundValueOps("tradeAnalysisInDays"+params.getString("org_id")+ params.getString("begin")).set(res.toString(), 5, TimeUnit.MINUTES);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -440,7 +456,11 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getNewRecord() {
|
|
|
|
|
|
|
|
|
|
String jsonStr = stringRedisTemplate.boundValueOps("newRecord").get();
|
|
|
|
|
JSONObject newRecord = JSONObject.parseObject(jsonStr);
|
|
|
|
|
if(newRecord != null){
|
|
|
|
|
return newRecord;
|
|
|
|
|
}
|
|
|
|
|
JSONObject max_amount = customerAndOrdersStatisticsMapper.getMaxAmount(0);
|
|
|
|
|
JSONObject max_orders = customerAndOrdersStatisticsMapper.getMaxOrders(0);
|
|
|
|
|
JSONObject maxTransactionPartners = customerAndOrdersStatisticsMapper.getMaxTransactionPartners();
|
|
|
|
@ -448,6 +468,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
|
res.put("max_amount",max_amount);
|
|
|
|
|
res.put("max_orders",max_orders);
|
|
|
|
|
res.put("max_transaction_partners",maxTransactionPartners);
|
|
|
|
|
stringRedisTemplate.boundValueOps("newRecord").set(res.toJSONString(), 5, TimeUnit.MINUTES);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|