Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 6bb7f395
authored
Aug 04, 2023
by
chamberone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add logs
1 parent
1622ed65
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
3 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/UserController.java
project-order/src/main/java/com/dituhui/pea/order/controller/UserController.java
View file @
6bb7f39
package
com
.
dituhui
.
pea
.
order
.
controller
;
import
javax.servlet.http.HttpServletRequest
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dto.UserLoginDTO
;
import
com.dituhui.pea.order.service.UserService
;
...
...
@@ -7,9 +17,9 @@ import com.dituhui.pea.pojo.UserInfo;
import
com.dituhui.pea.pojo.WebResult
;
import
com.dituhui.pea.user.IUser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
@RestController
@RequestMapping
(
"/pea-order"
)
public
class
UserController
{
...
...
@@ -20,18 +30,23 @@ public class UserController {
@Autowired
private
IUser
user
;
@Autowired
private
HttpServletRequest
request
;
@PostMapping
(
"/user/login"
)
public
Result
<?>
userLogin
(
@RequestBody
UserLoginDTO
user
)
{
return
userService
.
userLogin
(
user
.
getAccount
(),
user
.
getAccount
());
}
@GetMapping
(
"/user/userInfo"
)
public
Result
<?>
getUserInfo
(
@RequestHeader
(
name
=
"Authorization"
,
required
=
true
)
String
authorization
)
{
public
Result
<?>
getUserInfo
(
@RequestHeader
(
name
=
"Authorization"
,
required
=
true
)
String
authorization
)
{
return
userService
.
getUserInfo
(
authorization
,
true
);
}
@GetMapping
(
"/user/test"
)
public
Result
<?>
getUserRole
(
@RequestHeader
(
name
=
"userId"
,
required
=
true
)
String
userId
)
{
log
.
info
(
"{} {} {}"
,
"HttpServletRequest"
,
request
.
getHeader
(
"userId"
),
request
.
getHeader
(
"Authorization"
));
WebResult
<
UserInfo
>
result
=
user
.
queryUserById
(
userId
);
return
Result
.
success
(
result
.
getResult
());
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment