Royal Pay 缓存修改

master
liuxinxin 5 years ago
parent 4cf7f18a9f
commit 56f2a5d326

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

Loading…
Cancel
Save