|
|
|
@ -82,13 +82,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
|
if(params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1))==0){
|
|
|
|
|
res = transactionAnalysisMapper.getClientTransaction(params);
|
|
|
|
|
}else {
|
|
|
|
|
JSONObject today = new JSONObject();
|
|
|
|
|
today.put("end",params.getDate("end"));
|
|
|
|
|
today.put("begin", DateUtils.addDays(params.getDate("end"), -1));
|
|
|
|
|
JSONObject isToday = transactionAnalysisMapper.getClientTransaction(params);
|
|
|
|
|
JSONObject isNotToday = customerAndOrdersStatisticsMapper.getCommonCount(today);
|
|
|
|
|
res.put("trade_count",isToday.getIntValue("trade_count") + isNotToday.getIntValue("trade_count"));
|
|
|
|
|
res.put("trade_amount",isToday.getBigDecimal("trade_amount").add(isNotToday.getBigDecimal("trade_amount")));
|
|
|
|
|
res = customerAndOrdersStatisticsMapper.getCommonCount(params);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
res = customerAndOrdersStatisticsMapper.getCommonCount(params);
|
|
|
|
@ -126,19 +120,21 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
|
res.put("old_customers", transactionAnalysisMapper.countOldCustomers(params));
|
|
|
|
|
res.put("traded_partners", clientAnalysisMapper.countTradedPartners(params));
|
|
|
|
|
}else {
|
|
|
|
|
JSONObject today = new JSONObject();
|
|
|
|
|
today.put("end",params.getDate("end"));
|
|
|
|
|
today.put("begin", DateUtils.addDays(params.getDate("end"), -1));
|
|
|
|
|
res = getSevenOrMonth(params,today);
|
|
|
|
|
res = getYesOrLasMonth(params);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
res.put("traded_partners", clientCustomersMapper.countTradedClients(params));
|
|
|
|
|
res.put("total_customers", clientCustomersMapper.countTotalCustomers(params));
|
|
|
|
|
res.put("old_customers", clientCustomersMapper.countTotalOldCustomers(params));
|
|
|
|
|
res = getYesOrLasMonth(params);
|
|
|
|
|
}
|
|
|
|
|
stringRedisTemplate.boundValueOps("org_commonAnalysis2"+params.getString("org_id")+params.getString("begin")).set(res.toJSONString(), 5, TimeUnit.MINUTES);
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
private JSONObject getYesOrLasMonth(JSONObject params){
|
|
|
|
|
JSONObject res = new JSONObject();
|
|
|
|
|
res.put("traded_partners", clientCustomersMapper.countTradedClients(params));
|
|
|
|
|
res.put("total_customers", clientCustomersMapper.countTotalCustomers(params));
|
|
|
|
|
res.put("old_customers", clientCustomersMapper.countTotalOldCustomers(params));
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getCommonAnalysis4(JSONObject params) {
|
|
|
|
@ -554,10 +550,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
|
if(params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1))==0){
|
|
|
|
|
resp = getTodayChannelCount(params);
|
|
|
|
|
}else {
|
|
|
|
|
JSONObject today = new JSONObject();
|
|
|
|
|
today.put("end",params.getDate("end"));
|
|
|
|
|
today.put("begin", DateUtils.addDays(params.getDate("end"), -1));
|
|
|
|
|
resp = getChannelSevenOrMonth(params,today);
|
|
|
|
|
resp = customerAndOrdersStatisticsMapper.getChannelCommonCount(params);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
resp = customerAndOrdersStatisticsMapper.getChannelCommonCount(params);
|
|
|
|
@ -576,19 +569,6 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
|
}
|
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
private JSONObject getChannelSevenOrMonth(JSONObject params,JSONObject today){
|
|
|
|
|
JSONObject channelCount = customerAndOrdersStatisticsMapper.getChannelCommonCount(params);
|
|
|
|
|
String[] channels = new String[]{"Bestpay","Wechat","Alipay","jd","AlipayOnline"};
|
|
|
|
|
JSONObject resp = new JSONObject();
|
|
|
|
|
for(String channel:channels) {
|
|
|
|
|
today.put("channel", channel);
|
|
|
|
|
JSONObject channelAna = transactionAnalysisMapper.getPlatformAmount(today);
|
|
|
|
|
resp.put(channel.toLowerCase()+"amount", channelAna.getBigDecimal("amount").add(channelCount.getBigDecimal(channel.toLowerCase()+"amount")));
|
|
|
|
|
resp.put(channel.toLowerCase()+"_order_count", channelAna.getIntValue("order_count") + channelCount.getIntValue(channel.toLowerCase()+"_order_count"));
|
|
|
|
|
}
|
|
|
|
|
return resp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONObject getOrderAndCustomerPerDay(JSONObject partner, AnalysisBean partnerAnalysisBean) {
|
|
|
|
|
String timezone = partner.getJSONObject("client").getString("timezone");
|
|
|
|
|