Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qg-bl-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data-spider
qg-bl-service
Commits
0cdf75c5
Commit
0cdf75c5
authored
Apr 13, 2020
by
郝彦辉
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方法update_huiTohei_type1
parent
5d9bf11c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
1 deletion
+70
-1
BlackListToolsManagerController.java
...blservice/controller/BlackListToolsManagerController.java
+70
-1
No files found.
src/main/java/cn/quantgroup/qgblservice/controller/BlackListToolsManagerController.java
View file @
0cdf75c5
...
@@ -2,11 +2,20 @@ package cn.quantgroup.qgblservice.controller;
...
@@ -2,11 +2,20 @@ package cn.quantgroup.qgblservice.controller;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
import
cn.quantgroup.qgblservice.response.GlobalResponse
;
import
cn.quantgroup.qgblservice.service.IBlackListToolsManagerService
;
import
cn.quantgroup.qgblservice.service.IBlackListToolsManagerService
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.ImmutableMap
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.management.StringValueExp
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
/**
/**
* -----------------------------------------------------------------------------<br>
* -----------------------------------------------------------------------------<br>
* 描述: 黑名单表操作工具类<br>
* 描述: 黑名单表操作工具类<br>
...
@@ -16,7 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -16,7 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
* 公司: 北京众信利民信息技术有限公司 <br>
* 公司: 北京众信利民信息技术有限公司 <br>
* -----------------------------------------------------------------------------
* -----------------------------------------------------------------------------
*/
*/
@Slf4j
@RestController
@RestController
@RequestMapping
(
"/tools"
)
@RequestMapping
(
"/tools"
)
public
class
BlackListToolsManagerController
{
public
class
BlackListToolsManagerController
{
...
@@ -64,4 +73,64 @@ public class BlackListToolsManagerController {
...
@@ -64,4 +73,64 @@ public class BlackListToolsManagerController {
}
}
}
}
@Autowired
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
@RequestMapping
(
"/deleteRedisKey"
)
public
Map
<
String
,
Object
>
deleteRedisKey
(
String
key1
,
String
key2
,
String
key3
){
try
{
String
full_rediskey
=
""
;
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotEmpty
(
key1
))
{
full_rediskey
+=
key1
;
}
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotEmpty
(
key2
))
{
full_rediskey
+=
key2
;
}
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isNotEmpty
(
key3
))
{
full_rediskey
+=
key3
;
}
redisTemplate
.
delete
(
full_rediskey
);
log
.
info
(
"删除RedisKey成功, key1: {} , key2: {} , key3: {} , full_rediskey: {} "
,
key1
,
key2
,
key3
,
full_rediskey
);
return
ImmutableMap
.
of
(
"code"
,
0
,
"msg"
,
"手动删除redisKey成功"
);
}
catch
(
Exception
e
){
return
ImmutableMap
.
of
(
"code"
,
1
,
"msg"
,
"手动设置redisKey异常"
);
}
}
@RequestMapping
(
"/getRedisVal"
)
public
String
getRedisVal
(
String
key
){
try
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"key"
,
key
);
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isBlank
(
key
)){
return
JSONObject
.
toJSONString
(
map
);
}
try
{
String
value
=
redisTemplate
.
opsForValue
().
get
(
key
);
Long
expire
=
redisTemplate
.
getExpire
(
key
);
map
.
put
(
"value"
,
value
);
map
.
put
(
"expire"
,
expire
);
}
catch
(
Exception
e
){
log
.
error
(
"获取redis里值异常, key: {} "
,
key
,
e
);
}
return
map
.
toString
();
}
catch
(
Exception
e
){
return
"获取redis值异常"
;
}
}
@RequestMapping
(
"/setRedisVal"
)
public
String
setRedisVal
(
String
key
,
String
value
,
String
tmie
){
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isAnyBlank
(
key
,
value
,
tmie
)){
return
ImmutableMap
.
of
(
"code"
,
1
,
"msg"
,
"手动设置redisKey参数不能为空"
).
toString
();
}
try
{
redisTemplate
.
opsForValue
().
set
(
key
,
value
,
Long
.
parseLong
(
tmie
),
TimeUnit
.
MINUTES
);
return
ImmutableMap
.
of
(
"code"
,
0
,
"msg"
,
"手动设置redisKey成功"
).
toString
();
}
catch
(
Exception
e
){
log
.
error
(
"获取redis里值异常, key: {} "
,
key
,
e
);
return
ImmutableMap
.
of
(
"code"
,
1
,
"msg"
,
"手动设置redisKey异常"
).
toString
();
}
}
}
}
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