Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xzxt-shiro
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
常超
xzxt-shiro
Commits
917cc01d
Commit
917cc01d
authored
Aug 22, 2018
by
liuyongshuai
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
2b8f2d8a
159c5e8c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
19 deletions
+24
-19
pom.xml
+5
-1
src/main/java/com/xzxtshiro/util/RedisUtil.java
+16
-15
src/main/java/com/xzxtshiro/util/ZtreeDataUtil.java
+3
-3
No files found.
pom.xml
View file @
917cc01d
...
...
@@ -257,7 +257,11 @@
<artifactId>
shiro-spring
</artifactId>
<version>
1.2.3
</version>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.39
</version>
</dependency>
<!--springfox-swagger需要的最小依赖 start -->
<dependency>
...
...
src/main/java/com/xzxtshiro/util/RedisUtil.java
View file @
917cc01d
package
com
.
xzxtshiro
.
util
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xzxtshiro.pojo.SysDictitem
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.web.bind.annotation.RequestParam
;
...
...
@@ -10,37 +12,36 @@ import java.util.Map;
public
class
RedisUtil
{
//读取redis服务
/**
*
*
hkey:省份 山西:14
*
key: :14_CODE_UNIT_141181991700
*
@return
*
redis存储服务
*
key:查询条件 (15_CODE_AJDLB_05000300_诈骗案_05000000)
*
15_CODE_AJDLB_0500*
*
15_CODE_AJDLB_0500*_诈*
*/
public
static
XzxtRestResult
ReadRedisRest
(
String
hkey
,
String
key
)
{
public
static
XzxtRestResult
ReadRedisRest
(
String
key
)
{
//查询参数
Map
<
String
,
String
>
param
=
new
HashMap
<>();
XzxtRestResult
xzxtRestResult
=
new
XzxtRestResult
();
param
.
put
(
"hkey"
,
hkey
);
param
.
put
(
"key"
,
key
);
//调用redisrest的服务
String
json
=
HttpClientUtil
.
doPost
(
"http://127.0.0.1:9043/xzxt-rest/ReadRedisRest"
,
param
);
if
(!
StringUtils
.
isBlank
(
json
))
{
xzxtRestResult
=
XzxtRestResult
.
format
(
json
);
xzxtRestResult
=
JSONObject
.
parseObject
(
json
,
XzxtRestResult
.
class
);
if
(!
StringUtils
.
isBlank
(
xzxtRestResult
.
getData
().
toString
()))
{
xzxtRestResult
=
xzxtRestResult
.
format
(
xzxtRestResult
.
getData
().
toString
());
}
return
xzxtRestResult
;
}
//更新edis服务
/**
*
* hkey:省份 山西:14
* tpye:CODE_UNIT
* @return
* redis存储服务
* ssdw:省份 山西:14
* type::CODE_UNIT 传入空,就是更新所有字典
*/
public
static
XzxtRestResult
UpdateRedisRest
(
String
hkey
,
String
tpy
e
)
{
public
static
XzxtRestResult
UpdateRedisRest
(
String
ssdw
,
String
typ
e
)
{
//查询参数
Map
<
String
,
String
>
param
=
new
HashMap
<>();
XzxtRestResult
xzxtRestResult
=
new
XzxtRestResult
();
param
.
put
(
"
hkey"
,
hkey
);
param
.
put
(
"type"
,
t
py
e
);
param
.
put
(
"
ssdw"
,
ssdw
);
param
.
put
(
"type"
,
t
yp
e
);
//调用redisrest的服务
String
json
=
HttpClientUtil
.
doPost
(
"http://127.0.0.1:9043/xzxt-rest/UpdateRedisRest"
,
param
);
if
(!
StringUtils
.
isBlank
(
json
))
{
...
...
src/main/java/com/xzxtshiro/util/ZtreeDataUtil.java
View file @
917cc01d
...
...
@@ -49,12 +49,12 @@ public class ZtreeDataUtil {
String
unitStr
=
user
.
getUnitcode
();
String
usergrade
=
user
.
getGrade
();
SysDictitem
dictitem
=
new
SysDictitem
();
dictitem
.
setGroupid
(
"
CODE_UNIT_ALL
"
);
dictitem
.
setGroupid
(
"
SHIRO_UNIT
"
);
dictitem
.
setCodeStr
(
unitStr
.
substring
(
0
,
2
)+
"%"
);
XzxtRestResult
xzxtRestResult
=
new
XzxtRestResult
();
//从缓存中取内容
try
{
xzxtRestResult
=
RedisUtil
.
ReadRedisRest
(
unitStr
.
substring
(
0
,
2
)
,
dictitem
.
getGroupid
());
xzxtRestResult
=
RedisUtil
.
ReadRedisRest
(
unitStr
.
substring
(
0
,
2
)
+
"_"
+
dictitem
.
getGroupid
());
String
result
=
""
;
if
(
xzxtRestResult
.
getStatus
()==
202
)
{
result
=
(
String
)
xzxtRestResult
.
getData
();
...
...
@@ -66,7 +66,7 @@ public class ZtreeDataUtil {
//先存储
RedisUtil
.
UpdateRedisRest
(
unitStr
.
substring
(
0
,
2
),
dictitem
.
getGroupid
());
//读取
xzxtRestResult
=
RedisUtil
.
ReadRedisRest
(
unitStr
.
substring
(
0
,
2
)
,
dictitem
.
getGroupid
());
xzxtRestResult
=
RedisUtil
.
ReadRedisRest
(
unitStr
.
substring
(
0
,
2
)
+
"_"
+
dictitem
.
getGroupid
());
result
=
(
String
)
xzxtRestResult
.
getData
();
model
.
addAttribute
(
"unit"
,
result
);
}
catch
(
Exception
e
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment