Commit cbbb39cf by carrieyzzhang

cache

parent d5a02eac
......@@ -46,6 +46,8 @@
<redis.key.validtime>120</redis.key.validtime>
<redis.ip.requesttimes>5</redis.ip.requesttimes>
<redis.ip.unknown.requesttimes>5</redis.ip.unknown.requesttimes>
<cache.livetime>300</cache.livetime>
<iscache>0</iscache>
<redis.surl.host>192.168.2.57</redis.surl.host>
<redis.surl.port>6379</redis.surl.port>
......@@ -158,6 +160,8 @@
<redis.surl.host>io-split-wenqiang.dgfxhr.0001.cnn1.cache.amazonaws.com.cn</redis.surl.host>
<redis.surl.port>6379</redis.surl.port>
<cache.livetime>300</cache.livetime>
<iscache>0</iscache>
<redis.event.host>io-split-wenqiang.dgfxhr.0001.cnn1.cache.amazonaws.com.cn</redis.event.host>
<redis.event.port>6379</redis.event.port>
......@@ -218,6 +222,8 @@
<redis.surl.host>trackingioweb.nr7fi4.ng.0001.cnn1.cache.amazonaws.com.cn</redis.surl.host>
<redis.surl.port>6379</redis.surl.port>
<redis.surl.database>1</redis.surl.database>
<cache.livetime>300</cache.livetime>
<iscache>0</iscache>
<redis.event.host>trackingio-web.nr7fi4.0001.cnn1.cache.amazonaws.com.cn</redis.event.host>
<redis.event.port>6379</redis.event.port>
......
......@@ -4,6 +4,7 @@ import com.reyun.model.Account;
import com.reyun.security.annotation.CurrentAccount;
import com.reyun.service.ComplicateEventsService;
import com.reyun.service.EventStatsService;
import com.reyun.util.Constant;
import com.reyun.util.ResultModel;
import com.reyun.util.ResultStatus;
import com.reyun.util.StringUtil;
......@@ -42,7 +43,7 @@ public class EventStatsController {
if (!StringUtil.isEmpty(eventCondition) && !StringUtil.isEmpty(startDate) && !StringUtil.isEmpty(endDate)) {
return ResultModel.OK(complicateEventsService.queryComplicatedEvent(appId, account.getId(), startDate, endDate,
eventCondition, viewFlag));
eventCondition, viewFlag, 1));
} else {
return ResultModel.ERROR(ResultStatus.PARAM_INVALID);
......@@ -63,7 +64,7 @@ public class EventStatsController {
if (!StringUtil.isEmpty(eventCondition) && !StringUtil.isEmpty(startDate) && !StringUtil.isEmpty(endDate)) {
return ResultModel.OK(complicateEventsService.queryDistinctTotalData(appId, account.getId(), startDate, endDate,
eventCondition, viewFlag));
eventCondition, viewFlag, Constant.iacache));
} else {
return ResultModel.ERROR(ResultStatus.PARAM_INVALID);
......
......@@ -5,6 +5,7 @@ import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.reyun.util.Constant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -57,7 +58,7 @@ public class FunnelController {
isProfile=true;
}
boolean isDevice = StringUtil.isEmpty(isDeviceStr)?false:"true".equals(isDeviceStr)?true:false;
Map<String, List> result = funnelService.funnelReport(funnel, startDate, endDate, usergroupStr, isList, dimentionStr, loginAccount, isDevice,isProfile);
Map<String, List> result = funnelService.funnelReport(funnel, startDate, endDate, usergroupStr, isList, dimentionStr, loginAccount, isDevice,isProfile, Constant.iacache);
if (result.isEmpty()) {
return ResultModel.ERROR(ResultStatus.NETWORK_ERROR);
......
......@@ -4,6 +4,7 @@ import com.reyun.model.Account;
import com.reyun.model.IntelligentPath;
import com.reyun.security.annotation.CurrentAccount;
import com.reyun.service.IntelligentPathService;
import com.reyun.util.Constant;
import com.reyun.util.ResultModel;
import com.reyun.util.ResultStatus;
import com.reyun.util.StringUtil;
......@@ -74,6 +75,6 @@ public class IntelligentPathController {
intelligentPath.setUserGroup(Long.parseLong(userGroup));
}
return ResultModel.OK(intelligentPathService.queryIntelligentPath(loginAccount, intelligentPath));
return ResultModel.OK(intelligentPathService.queryIntelligentPath(loginAccount, intelligentPath, Constant.iacache));
}
}
......@@ -86,10 +86,16 @@ public class RetentionController {
String endDate = this.getEndDateByReportView(end, reportView);
Map<String, List> result = retentionService.retentionDetailReport(loginAccount, startDate, endDate, isList, eventInfo, app,
userGroupStr, dimensionStr, reportView, interval, isDevice, retentiontype,isProfile);
userGroupStr, dimensionStr, reportView, interval, isDevice, retentiontype,isProfile, Constant.iacache);
if (retentiontype.equals("define")) {
userLogService.insertLog(loginAccount, LogEnumType.FIND.getCode(), LogEnumType.FIND.getName() + "留存明细报表",
"{\"eventinfo\":" + eventInfo + "}", app, OperateObjectEnumType.REPORT.getCode());
} else {
userLogService.insertLog(loginAccount, LogEnumType.FIND.getCode(), LogEnumType.FIND.getName() + "留存明细报表",
"{\"eventinfo\":\"" + eventInfo + "\"}", app, OperateObjectEnumType.REPORT.getCode());
}
if (result.isEmpty()) {
return ResultModel.ERROR(ResultStatus.NETWORK_ERROR);
......@@ -140,7 +146,7 @@ public class RetentionController {
Map<String, List> result = retentionService.retentionReport(startDate, endDate, isList, eventInfo, app, userGroupStr,
dimensionStr, reportView, interval, isDevice, loginAccount.getId(), retentiontype,isProfile);
dimensionStr, reportView, interval, isDevice, loginAccount.getId(), retentiontype,isProfile,Constant.iacache);
if (retentiontype.equals("define")) {
userLogService.insertLog(loginAccount, LogEnumType.FIND.getCode(), LogEnumType.FIND.getName() + "留存报表",
......
......@@ -23,9 +23,9 @@ public interface ComplicateEventsService {
List<EventStats> findAllEventStats(Long accountId, Long appId);
Map<String, List> queryComplicatedEvent(Long appId, Long accountId, String startDate, String endDate, String eventCondition, String viewType);
Map<String, List> queryComplicatedEvent(Long appId, Long accountId, String startDate, String endDate, String eventCondition, String viewType, int isCache);
List<JSONObject> queryDistinctTotalData(Long appId, Long accountId, String startDate, String endDate, String eventCondition, String viewType);
List<JSONObject> queryDistinctTotalData(Long appId, Long accountId, String startDate, String endDate, String eventCondition, String viewType, int isCache);
boolean importOldEventData(Account account);
......
......@@ -21,7 +21,7 @@ public interface FunnelService {
Funnel validName(String name, Long app);
Map<String, List> funnelReport(Long funnel, String startDate, String endDate, String usergroup, boolean isList, String dimention, Account account, boolean isDevice, boolean isProfile);
Map<String, List> funnelReport(Long funnel, String startDate, String endDate, String usergroup, boolean isList, String dimention, Account account, boolean isDevice, boolean isProfile, int isCache);
Map<String, List> funnelDataQuery(String startDate, String endDate, String eventInfo, String events, int window,
Long appId, boolean isDevice);
......
......@@ -20,7 +20,7 @@ public interface IntelligentPathService {
boolean deleteIntelligentPath(Account loginAccount, Long intelligentPathId);
JSONObject queryIntelligentPath(Account loginAccount, IntelligentPath intelligentPath);
JSONObject queryIntelligentPath(Account loginAccount, IntelligentPath intelligentPath, int isCache);
boolean checkIntelligentPathName(Long accountId, Long id, Long appId, String name);
......
......@@ -21,8 +21,8 @@ public interface RetentionService {
Retention validName(String name, Long app);
Map<String, List> retentionReport(String startDate, String endDate, boolean isList, String eventInfo, Long app, String usergroup, String dimention, String reportView, int interval, boolean isDevice, Long account,String retentiontype,boolean isProfile);
Map<String, List> retentionReport(String startDate, String endDate, boolean isList, String eventInfo, Long app, String usergroup, String dimention, String reportView, int interval, boolean isDevice, Long account,String retentiontype,boolean isProfile, int isCache);
Map<String, List> retentionDetailReport(Account account, String startDate, String endDate, boolean isList, String eventInfo, Long app, String usergroup, String dimention, String reportView, int interval, boolean isDevice, String retentiontype, boolean isProfile);
Map<String, List> retentionDetailReport(Account account, String startDate, String endDate, boolean isList, String eventInfo, Long app, String usergroup, String dimention, String reportView, int interval, boolean isDevice, String retentiontype, boolean isProfile, int isCache);
}
......@@ -17,6 +17,7 @@ import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
......@@ -188,7 +189,8 @@ public class ComplicatedEventsServiceImpl implements ComplicateEventsService{
* 复杂事件查询
*/
@Override
public Map<String, List> queryComplicatedEvent(Long appId, Long accountId, String startDate, String endDate, String eventCondition, String viewType) {
@Cacheable(value = "reportCache", key = "'eventstats'+#appId+#accountId+#startDate+#endDate+#eventCondition+#viewType+#isCache", condition = "#isCache == 1")
public Map<String, List> queryComplicatedEvent(Long appId, Long accountId, String startDate, String endDate, String eventCondition, String viewType, int isCache) {
Map<String, List> result = new HashMap<>();
......@@ -249,7 +251,8 @@ public class ComplicatedEventsServiceImpl implements ComplicateEventsService{
* 合计查询
*/
@Override
public List<JSONObject> queryDistinctTotalData(Long appId, Long accountId, String startDate, String endDate, String eventCondition, String viewType) {
@Cacheable(value = "reportCache", key = "'eventstatstotal'+#appId+#accountId+#startDate+#endDate+#eventCondition+#viewType+#isCache", condition = "#isCache == 1")
public List<JSONObject> queryDistinctTotalData(Long appId, Long accountId, String startDate, String endDate, String eventCondition, String viewType, int isCache) {
List<JSONObject> result = new ArrayList<>();
......
......@@ -928,7 +928,7 @@ public class CustomMenuServiceImpl implements CustomMenuService {
if (null != eventStats) {
resultData = complicateEventsService.queryComplicatedEvent(appId, accountId, startDate, endDate,
eventStats.getEventCondition(), viewFlag);
eventStats.getEventCondition(), viewFlag, 1);
}
break;
......@@ -955,7 +955,7 @@ public class CustomMenuServiceImpl implements CustomMenuService {
if (null != retention) {
resultData = retentionService.retentionReport(startDate, endDate, false, retention.getEventInfo(),
appId, null, "-all", viewFlag, 7, false, accountId,null,false);
appId, null, "-all", viewFlag, 7, false, accountId,null,false, 1);
}
break;
}
......
......@@ -15,6 +15,7 @@ import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
......@@ -64,8 +65,9 @@ public class FunnelServiceImpl implements FunnelService {
private final static String TEMPLATE_TYPE_FUNNEL = "funnel";
@Override
@Cacheable(value = "reportCache", key = "'funnel'+#funnel+#startDate+#endDate+#usergroup+#isList+#dimention+#account+#isDevice+#isProfile+#isCache", condition = "#isCache == 1")
public Map<String, List> funnelReport(Long funnel, String startDate, String endDate, String usergroup, boolean isList,
String dimention, Account account, boolean isDevice, boolean isProfile) {
String dimention, Account account, boolean isDevice, boolean isProfile, int isCache) {
Funnel funnelObject = funnelRepository.findOne(funnel);
App app = appRepository.findOne(funnelObject.getApp());
......
......@@ -21,6 +21,7 @@ import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
......@@ -131,7 +132,8 @@ public class IntelligentPathServiceImpl implements IntelligentPathService {
* 智能路径查询数据
*/
@Override
public JSONObject queryIntelligentPath(Account loginAccount, IntelligentPath intelligentPath) {
@Cacheable(value = "reportCache", key = "'eventstatstotal'+#loginAccount+#intelligentPath+#isCache", condition = "#isCache == 1")
public JSONObject queryIntelligentPath(Account loginAccount, IntelligentPath intelligentPath, int isCache) {
JSONObject resultObject = new JSONObject();
......
......@@ -14,6 +14,7 @@ import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -203,9 +204,10 @@ public class RetentionServiceImpl implements RetentionService {
}
@Override
@Cacheable(value = "reportCache", key = "'retention'+#startDate+#endDate+#isList+#eventInfo+#app+#usergroup+#dimention+#reportView+#interval+#isDevice+#account+#retentiontype+#isProfile+#isCache", condition = "#isCache == 1")
public Map<String, List> retentionReport(String startDate, String endDate, boolean isList,
String eventInfo, Long app, String usergroup, String dimention,
String reportView, int interval, boolean isDevice, Long account, String retentiontype, boolean isProfile) {
String reportView, int interval, boolean isDevice, Long account, String retentiontype, boolean isProfile, int isCache) {
int retentions = 30;
if (reportView.equals("week")) {
......@@ -550,8 +552,9 @@ public class RetentionServiceImpl implements RetentionService {
}
@Override
@Cacheable(value = "reportCache", key = "'retentiondetail'+#loginAccount+#startDate+#endDate+#isList+#eventInfo+#app+#usergroup+#dimention+#reportView+#interval+#isDevice+#account+#retentiontype+#isProfile+#isCache", condition = "#isCache == 1")
public Map<String, List> retentionDetailReport(Account loginAccount, String startDate, String endDate, boolean isList, String eventInfo, Long app,
String usergroup, String dimention, String reportView, int interval, boolean isDevice, String retentiontype, boolean isProfile) {
String usergroup, String dimention, String reportView, int interval, boolean isDevice, String retentiontype, boolean isProfile, int isCache) {
int retentions = 30;
......@@ -824,7 +827,7 @@ public class RetentionServiceImpl implements RetentionService {
result.put("val", val);
result.put("columnkey", columnkey);
result.put("name", name);
result.put("key", name.subList(1, name.size()));
result.put("key", new ArrayList(name.subList(1, name.size())));
return result;
}
......
......@@ -80,7 +80,7 @@ public class EventReportCallable implements Callable<Map<String, List>> {
}else{
//查询合计
List<JSONObject> totalValue = eventStatsService.queryDistinctTotalData(app.getId(), accountid, startDate, endDate, eventCondition, viewType);
List<JSONObject> totalValue = eventStatsService.queryDistinctTotalData(app.getId(), accountid, startDate, endDate, eventCondition, viewType, 1);
result = new HashMap<>();
result.put("totalval",totalValue);
}
......
......@@ -157,6 +157,8 @@ public class ReportCallable implements Callable<Map<String, List>> {
Map<String, List> responseJson = new HashMap<>();
System.out.println(url);
if (url == null) {
try {
String responseStr = HttpClientUtil.doHttpPostRequest(url.toString(), "trackingio", conditions);
......@@ -172,7 +174,7 @@ public class ReportCallable implements Callable<Map<String, List>> {
}
System.out.println(responseJson.get("columnkey"));
//结果处理
switch (reportType) {
......
......@@ -116,7 +116,6 @@ public class UserLogThread extends Thread
try
{
if (this.content != null) {
System.out.println(this.content);
this.operaContent = JSONObject.fromObject(this.content).toString();
} else if (this.contentList != null) {
System.out.println(this.contentList);
......
......@@ -55,4 +55,6 @@ public class Constant {
public static ResourceBundle redis = ResourceBundle.getBundle("redis");
public static String REDIS_IP_REQUEST_TIMES = redis.getString("redis.ip.requesttimes");
public static long cacheLiveTime = Long.parseLong(redis.getString("cache.livetime"));
public static Integer iacache = Integer.parseInt(redis.getString("iscache"));
}
package com.reyun.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.Cache;
import org.springframework.cache.support.SimpleValueWrapper;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.io.*;
import java.util.concurrent.Callable;
@Service
public class RedisCache implements Cache {
private static Logger logger = LoggerFactory.getLogger(RedisCache.class);
@Autowired
private RedisTemplate<String, Object> redisTemplate;
private String name;
public RedisTemplate<String, Object> getRedisTemplate() {
return redisTemplate;
}
public void setRedisTemplate(RedisTemplate<String, Object> redisTemplate) {
this.redisTemplate = redisTemplate;
}
public void setName(String name) {
this.name = name;
}
@Override
public String getName() {
// TODO Auto-generated method stub
return this.name;
}
@Override
public Object getNativeCache() {
// TODO Auto-generated method stub
return this.redisTemplate;
}
@Override
public ValueWrapper get(Object key) {
// TODO Auto-generated method stub
// logger.debug("get key:"+ key);
final String keyf = key.toString();
Object object = null;
object = redisTemplate.execute(new RedisCallback<Object>() {
public Object doInRedis(RedisConnection connection)
throws DataAccessException {
byte[] key = keyf.getBytes();
byte[] value = connection.get(key);
if (value == null) {
return null;
}
return toObject(value);
}
});
return (object != null ? new SimpleValueWrapper(object) : null);
}
@Override
public <T> T get(Object o, Class<T> aClass)
{
return null;
}
@Override
public <T> T get(Object o, Callable<T> callable)
{
return null;
}
@Override
public void put(Object key, Object value) {
// logger.debug("put key:" + key + ", value:" + value);
final String keyf = key.toString();
final Object valuef = value;
final long liveTime = Constant.cacheLiveTime;
redisTemplate.execute(new RedisCallback<Long>() {
public Long doInRedis(RedisConnection connection)
throws DataAccessException {
byte[] keyb = keyf.getBytes();
byte[] valueb = toByteArray(valuef);
connection.set(keyb, valueb);
if (liveTime > 0) {
connection.expire(keyb, liveTime);
}
return 1L;
}
});
}
@Override
public ValueWrapper putIfAbsent(Object o, Object o1)
{
return null;
}
private byte[] toByteArray(Object obj) {
byte[] bytes = null;
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(obj);
oos.flush();
bytes = bos.toByteArray();
oos.close();
bos.close();
} catch (IOException ex) {
ex.printStackTrace();
}
return bytes;
}
private Object toObject(byte[] bytes) {
Object obj = null;
try {
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
ObjectInputStream ois = new ObjectInputStream(bis);
obj = ois.readObject();
ois.close();
bis.close();
} catch (IOException ex) {
ex.printStackTrace();
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
}
return obj;
}
@Override
public void evict(Object key) {
logger.debug("delete key:" + key);
final String keyf = key.toString();
redisTemplate.execute(new RedisCallback<Long>() {
public Long doInRedis(RedisConnection connection)
throws DataAccessException {
return connection.del(keyf.getBytes());
}
});
}
@Override
public void clear() {
logger.debug("clear all data." );
redisTemplate.execute(new RedisCallback<String>() {
public String doInRedis(RedisConnection connection)
throws DataAccessException {
connection.flushDb();
return "ok";
}
});
}
}
......@@ -414,7 +414,7 @@ public class SqlUtil
nameList.add(dimension);
}
List<Object> valSumList = valArray.subList(valArray.size() - eventList.size(), valArray.size());
List<Object> valSumList = new ArrayList<>(valArray.subList(valArray.size() - eventList.size(), valArray.size()));
List<Long> users = new ArrayList<>();
for (Object o : valSumList) {
users.add(Long.valueOf(o.toString()));
......@@ -429,7 +429,7 @@ public class SqlUtil
JSONArray valArray = JSONArray.fromObject(val.get("_col0"));
if (valArray.size() > 0) {
List<Object> usersObject = valArray.subList(valArray.size() - eventList.size(), valArray.size());
List<Object> usersObject = new ArrayList<>(valArray.subList(valArray.size() - eventList.size(), valArray.size()));
Map<String, Object> innerMap = new HashMap<>();
innerMap.put(dimension, "整体");
......@@ -640,8 +640,8 @@ public class SqlUtil
if (users.size() > 0) {
int retentionInterval = getRetentions(reportView);
List<Long> firstEventUsers = users.subList(users.size() - interval, users.size());
List<Long> secondEventUsers = users.subList(0, users.size() - interval);
List<Long> firstEventUsers = new ArrayList<>(users.subList(users.size() - interval, users.size()));
List<Long> secondEventUsers = new ArrayList<>(users.subList(0, users.size() - interval));
for (int i = 0; i < interval; i++) {
......@@ -751,8 +751,8 @@ public class SqlUtil
if (users.size() > 0) {
List<Long> firstEventUsers = users.subList(users.size() - interval, users.size());
List<Long> secondEventUsers = users.subList(0, users.size() - interval);
List<Long> firstEventUsers = new ArrayList<>(users.subList(users.size() - interval, users.size()));
List<Long> secondEventUsers = new ArrayList<>(users.subList(0, users.size() - interval));
if (!StringUtil.isEmpty(dimension)) {
columnKeyList.add(dimension);
......@@ -794,7 +794,7 @@ public class SqlUtil
result.put("val", valueResult);
result.put("columnkey", columnKeyList);
result.put("name", nameList);
result.put("key", nameList.isEmpty() ? new ArrayList<String>() : nameList.subList(1, nameList.size()));
result.put("key", nameList.isEmpty() ? new ArrayList<String>() : new ArrayList(nameList.subList(1, nameList.size())));
}
return result;
......@@ -846,7 +846,7 @@ public class SqlUtil
result.put("columnkey", columnKey);
result.put("name", name);
result.put("key", name.subList(1, name.size()));
result.put("key", new ArrayList(name.subList(1, name.size())));
result.put("isempty", new ArrayList<>(1));
result.put("val", val);
......@@ -1083,7 +1083,7 @@ public class SqlUtil
result.put("columnkey", reportListResult.getColumnkey());
result.put("name", nameList);
result.put("key", nameList.subList(1, nameList.size()));
result.put("key", new ArrayList(nameList.subList(1, nameList.size())));
result.put("val", reportListResult.getVal());
for (Map<String, Object> v : val) {
......@@ -1177,7 +1177,7 @@ public class SqlUtil
List<String> name = result.get("name");
name.remove("日期");
name.add(0, "usergroup");
result.put("key", name.subList(1, name.size()));
result.put("key", new ArrayList(name.subList(1, name.size())));
}
else if (!StringUtil.isEmpty(userGroup)) {
......@@ -1188,7 +1188,7 @@ public class SqlUtil
List<String> name = result.get("name");
name.remove("日期");
name.add(0, "usergroup");
result.put("key", name.subList(1, name.size()));
result.put("key", new ArrayList(name.subList(1, name.size())));
}
else {
valueResultMap.put("ds", "整体");
......@@ -1208,7 +1208,7 @@ public class SqlUtil
List<String> name = result.get("name");
name.remove("日期");
name.add(0, "usergroup");
result.put("key", name.subList(1, name.size()));
result.put("key", new ArrayList(name.subList(1, name.size())));
}
else {
newVal.add(getEmptyRetentionValue("ds", null, "日期", reportView));
......
......@@ -5,6 +5,7 @@
xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:task="http://www.springframework.org/schema/task" xmlns:p="http://www.springframework.org/schema/p"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
......@@ -12,7 +13,8 @@
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"
default-lazy-init="true">
<description>Spring公共配置</description>
......@@ -39,6 +41,9 @@
<bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">
<property name="connectionFactory" ref="connectionFactory" />
</bean>
<bean id="redisTemplate4Cache" class="org.springframework.data.redis.core.RedisTemplate">
<property name="connectionFactory" ref="JedisConnectionFactory" />
</bean>
<!--//Redis配置 -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" destroy-method="close">
......@@ -121,4 +126,28 @@
<!-- 指定所上传文件的总大小不能超过2000KB。注意maxUploadSize属性的限制不是针对单个文件,而是所有文件的容量之和 -->
<property name="maxUploadSize" value="2000000"/>
</bean>
<cache:annotation-driven cache-manager="cacheManager"/>
<!-- redis 相关配置 -->
<bean id="JedisConnectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"
p:host-name="${redis.surl.host}" p:port="${redis.surl.port}" p:pool-config-ref="poolConfig"/>
<bean id="cacheManager" class="org.springframework.cache.support.SimpleCacheManager">
<property name="caches">
<set>
<!-- 这里可以配置多个redis -->
<!-- <bean class="com.cn.util.RedisCache">
<property name="redisTemplate" ref="redisTemplate" />
<property name="name" value="default"/>
</bean> -->
<bean class="com.reyun.util.RedisCache">
<property name="redisTemplate" ref="redisTemplate4Cache" />
<property name="name" value="reportCache"/>
<!-- common名称要在类或方法的注解中使用 -->
</bean>
</set>
</property>
</bean>
</beans>
......@@ -10,3 +10,7 @@ redis.surl.database=${redis.surl.database}
redis.event.host=${redis.event.host}
redis.event.port=${redis.event.port}
redis.event.database=${redis.event.database}
cache.livetime=${cache.livetime}
iscache=${iscache}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment