Skip to content

Commit dfad8cc

Browse files
committed
test
1 parent 9e9b42d commit dfad8cc

69 files changed

Lines changed: 1351 additions & 951 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ dependencies {
5555
compile 'com.fasterxml.jackson.datatype:jackson-datatype-json-org:2.4.0'
5656
compile 'com.google.guava:guava:15.0'
5757
compile "org.springframework:spring-context:${SpringVersion}"
58+
compile "org.springframework:spring-context-support:${SpringVersion}"
5859
// compile "org.springframework:spring-jdbc:${SpringVersion}"
5960
compile "org.eclipse.jetty:jetty-webapp:${JettyVersion}"
6061
compile 'mysql:mysql-connector-java:5.1.28'
@@ -93,6 +94,8 @@ dependencies {
9394
compile "org.apache.shiro:shiro-quartz:${ShiroVersion}"
9495
compile "org.apache.shiro:shiro-spring:${ShiroVersion}"
9596
compile 'org.sitemesh:sitemesh:3.0.1'
97+
//compile 'net.sf.ehcache:ehcache:2.10.1'
98+
9699

97100

98101

src/main/java/com/rui/pro1/modules/sys/annotations/MenuAnnot.java renamed to src/main/java/com/rui/pro1/common/annotatiions/MenuAnnot.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.rui.pro1.modules.sys.annotations;
1+
package com.rui.pro1.common.annotatiions;
22
import java.lang.annotation.Documented;
33
import java.lang.annotation.ElementType;
44
import java.lang.annotation.Retention;
@@ -26,8 +26,8 @@
2626

2727
public String imgPath() default "";
2828

29-
public String uri() default "";
29+
public String href() default "";
3030

31-
public long orderNo() default -1;
31+
public int sortNo() default -1;
3232

3333
}

src/main/java/com/rui/pro1/modules/sys/annotations/PermissionAnnot.java renamed to src/main/java/com/rui/pro1/common/annotatiions/PermissionAnnot.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.rui.pro1.modules.sys.annotations;
1+
package com.rui.pro1.common.annotatiions;
22

33
import java.lang.annotation.Documented;
44
import java.lang.annotation.ElementType;
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
package com.rui.pro1.common.cache;
2+
3+
import net.sf.ehcache.Ehcache;
4+
import org.apache.shiro.cache.Cache;
5+
import org.apache.shiro.cache.CacheException;
6+
import org.apache.shiro.cache.CacheManager;
7+
import org.apache.shiro.util.CollectionUtils;
8+
import org.springframework.cache.support.SimpleValueWrapper;
9+
10+
import java.util.*;
11+
12+
public class SpringCacheManagerWrapper implements CacheManager {
13+
14+
private org.springframework.cache.CacheManager cacheManager;
15+
16+
public void setCacheManager(
17+
org.springframework.cache.CacheManager cacheManager) {
18+
this.cacheManager = cacheManager;
19+
}
20+
21+
public <K, V> Cache<K, V> getCache(String name) throws CacheException {
22+
org.springframework.cache.Cache springCache = cacheManager
23+
.getCache(name);
24+
return new SpringCacheWrapper(springCache);
25+
}
26+
27+
static class SpringCacheWrapper implements Cache {
28+
private org.springframework.cache.Cache springCache;
29+
30+
SpringCacheWrapper(org.springframework.cache.Cache springCache) {
31+
this.springCache = springCache;
32+
}
33+
34+
public Object get(Object key) throws CacheException {
35+
Object value = springCache.get(key);
36+
if (value instanceof SimpleValueWrapper) {
37+
return ((SimpleValueWrapper) value).get();
38+
}
39+
return value;
40+
}
41+
42+
public Object put(Object key, Object value) throws CacheException {
43+
springCache.put(key, value);
44+
return value;
45+
}
46+
47+
public Object remove(Object key) throws CacheException {
48+
springCache.evict(key);
49+
return null;
50+
}
51+
52+
public void clear() throws CacheException {
53+
springCache.clear();
54+
}
55+
56+
public int size() {
57+
if (springCache.getNativeCache() instanceof Ehcache) {
58+
Ehcache ehcache = (Ehcache) springCache.getNativeCache();
59+
return ehcache.getSize();
60+
}
61+
throw new UnsupportedOperationException(
62+
"invoke spring cache abstract size method not supported");
63+
}
64+
65+
public Set keys() {
66+
if (springCache.getNativeCache() instanceof Ehcache) {
67+
Ehcache ehcache = (Ehcache) springCache.getNativeCache();
68+
return new HashSet(ehcache.getKeys());
69+
}
70+
throw new UnsupportedOperationException(
71+
"invoke spring cache abstract keys method not supported");
72+
}
73+
74+
public Collection values() {
75+
if (springCache.getNativeCache() instanceof Ehcache) {
76+
Ehcache ehcache = (Ehcache) springCache.getNativeCache();
77+
List keys = ehcache.getKeys();
78+
if (!CollectionUtils.isEmpty(keys)) {
79+
List values = new ArrayList(keys.size());
80+
for (Object key : keys) {
81+
Object value = get(key);
82+
if (value != null) {
83+
values.add(value);
84+
}
85+
}
86+
return Collections.unmodifiableList(values);
87+
} else {
88+
return Collections.emptyList();
89+
}
90+
}
91+
throw new UnsupportedOperationException(
92+
"invoke spring cache abstract values method not supported");
93+
}
94+
}
95+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.rui.pro1.common.constants;
2+
3+
/**
4+
* 些常量用于模块常量,定义菜单 url请求的开头,为避免有重复请求的url,所有系统请求都要安从里定义开头
5+
*
6+
* @author ruiliang
7+
*
8+
*/
9+
public class Modules {
10+
public static final String SYS = "sys";// 系统模块
11+
public static final String merchant = "merchant";// 商家模块
12+
public static final String gov = "gov";
13+
14+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.rui.pro1.common.constants.menu;
2+
3+
public class MenuGov {
4+
5+
}

0 commit comments

Comments
 (0)