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 9d4da5ca
authored
Aug 08, 2023
by
丁伟峰
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-user'
2 parents
225517f3
ce9530f3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
87 deletions
project-order/src/main/java/com/dituhui/pea/order/controller/UserController.java
project-order/src/main/java/com/dituhui/pea/order/dao/OrgWarehouseInfoDao.java
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessOrgWarehousesDTO.java
project-order/src/main/java/com/dituhui/pea/order/service/UserService.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBaseServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/service/impl/UserServiceImpl.java
project-order/src/main/java/com/dituhui/pea/order/controller/UserController.java
View file @
9d4da5c
...
@@ -2,6 +2,7 @@ package com.dituhui.pea.order.controller;
...
@@ -2,6 +2,7 @@ package com.dituhui.pea.order.controller;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
com.dituhui.pea.pojo.UserLoginParam
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -12,7 +13,6 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -12,7 +13,6 @@ import org.springframework.web.bind.annotation.RestController;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.dto.UserLoginDTO
;
import
com.dituhui.pea.order.dto.UserLoginDTO
;
import
com.dituhui.pea.order.service.UserService
;
import
com.dituhui.pea.pojo.UserInfo
;
import
com.dituhui.pea.pojo.UserInfo
;
import
com.dituhui.pea.pojo.WebResult
;
import
com.dituhui.pea.pojo.WebResult
;
import
com.dituhui.pea.user.IUser
;
import
com.dituhui.pea.user.IUser
;
...
@@ -24,31 +24,32 @@ import lombok.extern.slf4j.Slf4j;
...
@@ -24,31 +24,32 @@ import lombok.extern.slf4j.Slf4j;
@RequestMapping
(
"/pea-order"
)
@RequestMapping
(
"/pea-order"
)
public
class
UserController
{
public
class
UserController
{
@Autowired
@Autowired
private
UserService
userService
;
private
IUser
user
;
@Autowired
@Autowired
private
IUser
user
;
private
HttpServletRequest
request
;
@Autowired
@PostMapping
(
"/user/login"
)
private
HttpServletRequest
request
;
public
Result
<?>
userLogin
(
@RequestBody
UserLoginDTO
userLoginDTO
)
{
UserLoginParam
userLoginParam
=
new
UserLoginParam
();
@PostMapping
(
"/user/login"
)
userLoginParam
.
setAccount
(
userLoginDTO
.
getAccount
());
public
Result
<?>
userLogin
(
@RequestBody
UserLoginDTO
user
)
{
userLoginParam
.
setPassword
(
userLoginDTO
.
getPassword
());
return
userService
.
userLogin
(
user
.
getAccount
(),
user
.
getAccount
());
return
user
.
userLogin
(
userLoginParam
);
}
}
@GetMapping
(
"/user/userInfo"
)
@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
);
String
userId
=
request
.
getHeader
(
"userId"
);
}
return
user
.
getUserInfo
(
userId
);
}
@GetMapping
(
"/user/test"
)
public
Result
<?>
getUserRole
(
@RequestHeader
(
name
=
"userId"
,
required
=
true
)
String
userId
)
{
@GetMapping
(
"/user/test"
)
log
.
info
(
"{} {} {}"
,
"HttpServletRequest"
,
request
.
getHeader
(
"userId"
),
request
.
getHeader
(
"Authorization"
));
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
());
WebResult
<
UserInfo
>
result
=
user
.
queryUserById
(
userId
);
}
return
Result
.
success
(
result
.
getResult
());
}
}
}
project-order/src/main/java/com/dituhui/pea/order/dao/OrgWarehouseInfoDao.java
View file @
9d4da5c
...
@@ -29,9 +29,7 @@ public interface OrgWarehouseInfoDao extends JpaRepository<OrgWarehouseInfoEntit
...
@@ -29,9 +29,7 @@ public interface OrgWarehouseInfoDao extends JpaRepository<OrgWarehouseInfoEntit
@Query
(
"select a from OrgWarehouseInfoEntity a join OrgBranchEntity o on a.branchId=o.branchId where o.clusterId=:clusterId"
)
@Query
(
"select a from OrgWarehouseInfoEntity a join OrgBranchEntity o on a.branchId=o.branchId where o.clusterId=:clusterId"
)
Page
<
OrgWarehouseInfoEntity
>
findByClusterId
(
String
clusterId
,
Pageable
pageable
);
List
<
OrgWarehouseInfoEntity
>
findByClusterId
(
String
clusterId
);
Page
<
OrgWarehouseInfoEntity
>
findByBranchId
(
String
branchId
,
Pageable
pageable
);
List
<
OrgWarehouseInfoEntity
>
findByGroupId
(
String
groupId
);
Page
<
OrgWarehouseInfoEntity
>
findByGroupId
(
String
groupId
,
Pageable
pageable
);
}
}
project-order/src/main/java/com/dituhui/pea/order/dto/BusinessOrgWarehousesDTO.java
View file @
9d4da5c
...
@@ -12,17 +12,11 @@ public class BusinessOrgWarehousesDTO {
...
@@ -12,17 +12,11 @@ public class BusinessOrgWarehousesDTO {
public
static
class
Request
{
public
static
class
Request
{
private
String
levelType
;
private
String
levelType
;
private
String
levelValue
;
private
String
levelValue
;
private
Integer
size
=
DEFAULT_PAGE_SIZE
;
private
Integer
page
=
1
;
}
}
@lombok
.
Data
@lombok
.
Data
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
public
static
class
Result
{
public
static
class
Result
{
private
long
pageCurrent
;
private
long
pages
;
private
long
pageSize
;
private
long
total
;
private
List
<
Content
>
content
;
private
List
<
Content
>
content
;
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/UserService.java
deleted
100644 → 0
View file @
225517f
package
com
.
dituhui
.
pea
.
order
.
service
;
import
com.dituhui.pea.common.Result
;
public
interface
UserService
{
Result
<?>
userLogin
(
String
account
,
String
password
);
Result
<?>
getUserInfo
(
String
token
,
boolean
needTeamInfo
);
}
project-order/src/main/java/com/dituhui/pea/order/service/impl/BusinessBaseServiceImpl.java
View file @
9d4da5c
...
@@ -67,17 +67,16 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
...
@@ -67,17 +67,16 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
@Override
@Override
public
Result
<?>
getOrgWarehouses
(
BusinessOrgWarehousesDTO
.
Request
req
)
{
public
Result
<?>
getOrgWarehouses
(
BusinessOrgWarehousesDTO
.
Request
req
)
{
Pageable
pageable
=
PageRequest
.
of
(
req
.
getPage
()
-
1
,
req
.
getSize
());
List
<
OrgWarehouseInfoEntity
>
entities
=
null
;
Page
<
OrgWarehouseInfoEntity
>
page
=
null
;
if
(
req
.
getLevelType
().
equals
(
"cluster"
))
{
if
(
req
.
getLevelType
().
equals
(
"cluster"
))
{
page
=
orgWarehouseInfoDao
.
findByClusterId
(
req
.
getLevelValue
(),
pageable
);
entities
=
orgWarehouseInfoDao
.
findByClusterId
(
req
.
getLevelValue
()
);
}
else
if
(
req
.
getLevelType
().
equals
(
"branch"
))
{
}
else
if
(
req
.
getLevelType
().
equals
(
"branch"
))
{
page
=
orgWarehouseInfoDao
.
findByBranchId
(
req
.
getLevelValue
(),
pageable
);
entities
=
orgWarehouseInfoDao
.
findByBranchId
(
req
.
getLevelValue
()
);
}
else
{
}
else
{
page
=
orgWarehouseInfoDao
.
findByGroupId
(
req
.
getLevelValue
(),
pageable
);
entities
=
orgWarehouseInfoDao
.
findByGroupId
(
req
.
getLevelValue
()
);
}
}
List
<
BusinessOrgWarehousesDTO
.
Content
>
contents
=
page
.
getContent
()
.
stream
().
map
(
e
->
{
List
<
BusinessOrgWarehousesDTO
.
Content
>
contents
=
entities
.
stream
().
map
(
e
->
{
BusinessOrgWarehousesDTO
.
Content
content
=
new
BusinessOrgWarehousesDTO
.
Content
();
BusinessOrgWarehousesDTO
.
Content
content
=
new
BusinessOrgWarehousesDTO
.
Content
();
content
.
setWarehouseId
(
e
.
getWarehouseId
());
content
.
setWarehouseId
(
e
.
getWarehouseId
());
content
.
setWarehouseName
(
e
.
getWarehouseName
());
content
.
setWarehouseName
(
e
.
getWarehouseName
());
...
@@ -95,10 +94,6 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
...
@@ -95,10 +94,6 @@ public class BusinessBaseServiceImpl implements BusinessBaseService {
return
content
;
return
content
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
BusinessOrgWarehousesDTO
.
Result
rs
=
new
BusinessOrgWarehousesDTO
.
Result
();
BusinessOrgWarehousesDTO
.
Result
rs
=
new
BusinessOrgWarehousesDTO
.
Result
();
rs
.
setTotal
(
page
.
getTotalElements
())
.
setPages
(
page
.
getTotalPages
())
.
setPageSize
(
page
.
getSize
())
.
setPageCurrent
(
page
.
getNumber
());
rs
.
setContent
(
contents
);
rs
.
setContent
(
contents
);
return
Result
.
success
(
rs
);
return
Result
.
success
(
rs
);
}
}
...
...
project-order/src/main/java/com/dituhui/pea/order/service/impl/UserServiceImpl.java
deleted
100644 → 0
View file @
225517f
package
com
.
dituhui
.
pea
.
order
.
service
.
impl
;
import
com.dituhui.pea.common.Result
;
import
com.dituhui.pea.order.service.UserService
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
@Service
public
class
UserServiceImpl
implements
UserService
{
@Override
public
Result
<?>
userLogin
(
String
account
,
String
password
)
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"token"
,
"88d89f379a634867b1c7274a8b86bba6"
);
//TODO
return
Result
.
success
(
map
);
}
@Override
public
Result
<?>
getUserInfo
(
String
token
,
boolean
needTeamInfo
)
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"account"
,
"ID9192"
);
map
.
put
(
"nickname"
,
"测试用户"
);
map
.
put
(
"clusterId"
,
"csuzhou"
);
map
.
put
(
"branchId"
,
"bsuzhou"
);
map
.
put
(
"groupId"
,
"gsuzhou"
);
map
.
put
(
"levelType"
,
"branch"
);
map
.
put
(
"levelValue"
,
"bsuzhou"
);
return
Result
.
success
(
map
);
}
}
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