|
|
@ -82,13 +82,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
if(params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1))==0){
|
|
|
|
if(params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1))==0){
|
|
|
|
res = transactionAnalysisMapper.getClientTransaction(params);
|
|
|
|
res = transactionAnalysisMapper.getClientTransaction(params);
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
JSONObject today = new JSONObject();
|
|
|
|
res = customerAndOrdersStatisticsMapper.getCommonCount(params);
|
|
|
|
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")));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
res = customerAndOrdersStatisticsMapper.getCommonCount(params);
|
|
|
|
res = customerAndOrdersStatisticsMapper.getCommonCount(params);
|
|
|
@ -126,17 +120,19 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
res.put("old_customers", transactionAnalysisMapper.countOldCustomers(params));
|
|
|
|
res.put("old_customers", transactionAnalysisMapper.countOldCustomers(params));
|
|
|
|
res.put("traded_partners", clientAnalysisMapper.countTradedPartners(params));
|
|
|
|
res.put("traded_partners", clientAnalysisMapper.countTradedPartners(params));
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
JSONObject today = new JSONObject();
|
|
|
|
res = getYesOrLasMonth(params);
|
|
|
|
today.put("end",params.getDate("end"));
|
|
|
|
|
|
|
|
today.put("begin", DateUtils.addDays(params.getDate("end"), -1));
|
|
|
|
|
|
|
|
res = getSevenOrMonth(params,today);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
|
|
|
|
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("traded_partners", clientCustomersMapper.countTradedClients(params));
|
|
|
|
res.put("total_customers", clientCustomersMapper.countTotalCustomers(params));
|
|
|
|
res.put("total_customers", clientCustomersMapper.countTotalCustomers(params));
|
|
|
|
res.put("old_customers", clientCustomersMapper.countTotalOldCustomers(params));
|
|
|
|
res.put("old_customers", clientCustomersMapper.countTotalOldCustomers(params));
|
|
|
|
}
|
|
|
|
|
|
|
|
stringRedisTemplate.boundValueOps("org_commonAnalysis2"+params.getString("org_id")+params.getString("begin")).set(res.toJSONString(), 5, TimeUnit.MINUTES);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -554,10 +550,7 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
if(params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1))==0){
|
|
|
|
if(params.getDate("begin").compareTo(DateUtils.addDays(params.getDate("end"), -1))==0){
|
|
|
|
resp = getTodayChannelCount(params);
|
|
|
|
resp = getTodayChannelCount(params);
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
JSONObject today = new JSONObject();
|
|
|
|
resp = customerAndOrdersStatisticsMapper.getChannelCommonCount(params);
|
|
|
|
today.put("end",params.getDate("end"));
|
|
|
|
|
|
|
|
today.put("begin", DateUtils.addDays(params.getDate("end"), -1));
|
|
|
|
|
|
|
|
resp = getChannelSevenOrMonth(params,today);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
resp = customerAndOrdersStatisticsMapper.getChannelCommonCount(params);
|
|
|
|
resp = customerAndOrdersStatisticsMapper.getChannelCommonCount(params);
|
|
|
@ -576,19 +569,6 @@ public class DashboardServiceImpl implements DashboardService,DashboardAnalysisT
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return resp;
|
|
|
|
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
|
|
|
|
@Override
|
|
|
|
public JSONObject getOrderAndCustomerPerDay(JSONObject partner, AnalysisBean partnerAnalysisBean) {
|
|
|
|
public JSONObject getOrderAndCustomerPerDay(JSONObject partner, AnalysisBean partnerAnalysisBean) {
|
|
|
|
String timezone = partner.getJSONObject("client").getString("timezone");
|
|
|
|
String timezone = partner.getJSONObject("client").getString("timezone");
|
|
|
|