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
953c0caa
Commit
953c0caa
authored
Aug 15, 2019
by
data爬虫-冯 军凯
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持checkModel
parent
f90680ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
CheckController.java
...cn/quantgroup/qgblservice/controller/CheckController.java
+69
-0
No files found.
src/main/java/cn/quantgroup/qgblservice/controller/CheckController.java
0 → 100644
View file @
953c0caa
package
cn
.
quantgroup
.
qgblservice
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.ImmutableMap
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* @Author fengjunkai
* @Date 2019-08-15 15:00
*/
@Slf4j
@RestController
@RequestMapping
(
"/"
)
public
class
CheckController
{
private
static
Map
<
String
,
String
>
map
=
new
ConcurrentHashMap
<>();
@ResponseBody
@RequestMapping
(
value
=
"check"
)
public
ResponseEntity
<
String
>
check
()
{
if
(
map
!=
null
&&
map
.
size
()
>
0
)
{
return
new
ResponseEntity
<
String
>(
HttpStatus
.
NOT_FOUND
);
}
else
{
return
new
ResponseEntity
<
String
>(
HttpStatus
.
OK
);
}
}
@ResponseBody
@RequestMapping
(
value
=
"/online"
)
public
Map
<
String
,
String
>
online
()
{
log
.
info
(
"应用上线,流量开始切入...."
);
map
.
clear
();
return
responseOk
();
}
@ResponseBody
@RequestMapping
(
value
=
"/offline"
)
public
Map
<
String
,
String
>
offline
()
{
log
.
info
(
"应用下线,流量不再切入...."
);
map
.
put
(
"status"
,
"offline"
);
return
responseOk
();
}
@ResponseBody
@RequestMapping
(
value
=
"/test"
)
public
Map
<
String
,
String
>
test
()
{
log
.
info
(
"CheckController测试!map = {}"
,
map
);
return
ImmutableMap
.
of
(
"code"
,
"0"
,
"msg"
,
JSON
.
toJSONString
(
map
));
}
public
static
Map
<
String
,
String
>
responseOk
()
{
return
ImmutableMap
.
of
(
"code"
,
"0"
,
"msg"
,
"ok"
);
}
@RequestMapping
(
"/getuuid"
)
public
String
getUuid
(
String
param
)
{
return
UUID
.
nameUUIDFromBytes
(
param
.
getBytes
()).
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