Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
brandkbs2
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
shenjunjie
brandkbs2
Commits
172d28b8
Commit
172d28b8
authored
Jan 04, 2023
by
shenjunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上线登录优化流程
parent
ca7f7752
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
4 deletions
+56
-4
src/main/java/com/zhiwei/brandkbs2/controller/LoginController.java
+49
-4
src/main/java/com/zhiwei/brandkbs2/controller/app/AppArticleController.java
+7
-0
No files found.
src/main/java/com/zhiwei/brandkbs2/controller/LoginController.java
View file @
172d28b8
...
@@ -10,11 +10,13 @@ import io.swagger.annotations.Api;
...
@@ -10,11 +10,13 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -34,6 +36,15 @@ public class LoginController extends BaseController {
...
@@ -34,6 +36,15 @@ public class LoginController extends BaseController {
@Value
(
"${jwt.hour}"
)
@Value
(
"${jwt.hour}"
)
private
int
jwtHour
;
private
int
jwtHour
;
@Value
(
"${qbjc.userCenter.url}"
)
private
String
yuqingInterface
;
@Value
(
"${qbjc.userCenter.token}"
)
private
String
token
;
@Autowired
private
RestTemplate
restTemplate
;
@Resource
(
name
=
"userServiceImpl"
)
@Resource
(
name
=
"userServiceImpl"
)
private
UserService
UserService
;
private
UserService
UserService
;
...
@@ -91,6 +102,40 @@ public class LoginController extends BaseController {
...
@@ -91,6 +102,40 @@ public class LoginController extends BaseController {
return
ResponseResult
.
success
(
ProjectService
.
getLoginUserAllProjects
());
return
ResponseResult
.
success
(
ProjectService
.
getLoginUserAllProjects
());
}
}
@ApiOperation
(
"第三方接入-验证External-Token"
)
@GetMapping
(
"/user/login/verify/token"
)
public
ResponseResult
verifyToken
()
{
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
httpHeaders
.
set
(
"External-Origin"
,
"BRANDKBS"
);
httpHeaders
.
set
(
"External-Service"
,
"BRANDKBS"
);
httpHeaders
.
set
(
"External-Token"
,
token
);
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
httpHeaders
);
HttpEntity
<
JSONObject
>
entity
=
restTemplate
.
exchange
(
yuqingInterface
+
"/thirdPart/external/verify/token"
,
HttpMethod
.
GET
,
requestEntity
,
JSONObject
.
class
);
if
(
null
!=
entity
.
getBody
()
||
!
entity
.
getBody
().
getBoolean
(
"status"
))
{
String
ticket
=
entity
.
getBody
().
getJSONObject
(
"data"
).
getString
(
"ticket"
);
return
ResponseResult
.
success
(
ticket
);
}
return
ResponseResult
.
failure
(
"ticket获取失败"
);
}
@ApiOperation
(
"第三方接入-验证External-Ticket"
)
@GetMapping
(
"/user/login/verify/ticket"
)
public
ResponseResult
verifyTicket
(
@RequestParam
String
ticket
)
{
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
httpHeaders
.
set
(
"External-Origin"
,
"BRANDKBS"
);
httpHeaders
.
set
(
"External-Token"
,
token
);
httpHeaders
.
set
(
"External-Ticket"
,
ticket
);
HttpEntity
<
String
>
requestEntity
=
new
HttpEntity
<>(
httpHeaders
);
HttpEntity
<
JSONObject
>
entity
=
restTemplate
.
exchange
(
yuqingInterface
+
"/thirdPart/external/verify/ticket"
,
HttpMethod
.
GET
,
requestEntity
,
JSONObject
.
class
);
if
(
null
!=
entity
.
getBody
())
{
JSONObject
userInfo
=
entity
.
getBody
().
getJSONObject
(
"data"
);
return
ResponseResult
.
success
(
userInfo
);
}
return
ResponseResult
.
failure
(
"用户信息获取失败"
);
}
@ApiOperation
(
"测试接口"
)
@ApiOperation
(
"测试接口"
)
@GetMapping
(
"/test"
)
@GetMapping
(
"/test"
)
public
ResponseResult
test
()
{
public
ResponseResult
test
()
{
...
...
src/main/java/com/zhiwei/brandkbs2/controller/app/AppArticleController.java
View file @
172d28b8
...
@@ -182,5 +182,12 @@ public class AppArticleController extends BaseController {
...
@@ -182,5 +182,12 @@ public class AppArticleController extends BaseController {
return
ResponseResult
.
success
(
reportService
.
getPcReportAnalyze
(
id
,
true
));
return
ResponseResult
.
success
(
reportService
.
getPcReportAnalyze
(
id
,
true
));
}
}
@ApiOperation
(
"舆情简报-更新报告结果"
)
@ApiImplicitParam
(
name
=
"id"
,
value
=
"报告ID"
,
required
=
true
,
paramType
=
"path"
,
dataType
=
"String"
)
@PutMapping
(
"/update/{id}"
)
public
ResponseResult
updateReportAnalyze
(
@PathVariable
String
id
)
{
reportService
.
getPcReportAnalyze
(
id
,
false
);
return
ResponseResult
.
success
();
}
}
}
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