Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
manager
Project
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
reyun
manager
Commits
1335feb0
Commit
1335feb0
authored
Jan 03, 2018
by
manxiaoqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test pom
parent
95a69464
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
14 deletions
+35
-14
workspace.xml
.idea/workspace.xml
+0
-0
UserController.java
src/main/java/common/controller/UserController.java
+35
-14
No files found.
.idea/workspace.xml
View file @
1335feb0
This diff is collapsed.
Click to expand it.
src/main/java/common/controller/UserController.java
View file @
1335feb0
...
@@ -8,13 +8,16 @@ import common.repository.RoleTypeRepository;
...
@@ -8,13 +8,16 @@ import common.repository.RoleTypeRepository;
import
common.repository.UserRepository
;
import
common.repository.UserRepository
;
import
common.service.MenuService
;
import
common.service.MenuService
;
import
common.service.UserService
;
import
common.service.UserService
;
import
dic.OperateObjectTypeEnum
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
security.annotation.CurrentAccount
;
import
security.annotation.CurrentAccount
;
import
util.CipherUtil
;
import
util.CipherUtil
;
import
util.ResultModel
;
import
util.ResultModel
;
import
util.UserLogThread
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.List
;
...
@@ -47,9 +50,11 @@ public class UserController {
...
@@ -47,9 +50,11 @@ public class UserController {
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
@ResponseBody
public
ResultModel
create
(
@CurrentAccount
User
loginAccount
,
@RequestBody
User
resource
)
{
public
ResultModel
create
(
@CurrentAccount
User
loginAccount
,
@RequestBody
User
resource
,
HttpServletRequest
request
)
{
if
(
userService
.
validEmail
(
resource
.
getEmail
())){
if
(
userService
.
validEmail
(
resource
.
getEmail
())){
userService
.
create
(
loginAccount
,
resource
);
userService
.
create
(
loginAccount
,
resource
);
UserLogThread
userlog
=
new
UserLogThread
(
loginAccount
.
getEmail
(),
loginAccount
.
getName
(),
OperateObjectTypeEnum
.
INNERUSER
.
getKey
(),
resource
.
getEmail
(),
"创建系统账号"
,
request
);
userlog
.
start
();
return
ResultModel
.
OK
(
true
);
return
ResultModel
.
OK
(
true
);
}
else
{
}
else
{
return
ResultModel
.
OK
(
false
);
return
ResultModel
.
OK
(
false
);
...
@@ -58,7 +63,9 @@ public class UserController {
...
@@ -58,7 +63,9 @@ public class UserController {
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
PUT
)
@ResponseBody
@ResponseBody
public
ResultModel
update
(
@CurrentAccount
User
loginAccount
,
@RequestBody
User
resource
)
{
public
ResultModel
update
(
@CurrentAccount
User
loginAccount
,
@RequestBody
User
resource
,
HttpServletRequest
request
)
{
UserLogThread
userlog
=
new
UserLogThread
(
loginAccount
.
getEmail
(),
loginAccount
.
getName
(),
OperateObjectTypeEnum
.
INNERUSER
.
getKey
(),
resource
.
getEmail
(),
"修改系统账号"
,
request
);
userlog
.
start
();
return
ResultModel
.
OK
(
userService
.
update
(
loginAccount
,
resource
));
return
ResultModel
.
OK
(
userService
.
update
(
loginAccount
,
resource
));
}
}
...
@@ -88,28 +95,39 @@ public class UserController {
...
@@ -88,28 +95,39 @@ public class UserController {
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
DELETE
)
@RequestMapping
(
value
=
"/delete/{id}"
,
method
=
RequestMethod
.
DELETE
)
@ResponseBody
@ResponseBody
public
ResultModel
delete
(
@CurrentAccount
User
loginAccount
,
@PathVariable
Long
id
)
{
public
ResultModel
delete
(
@CurrentAccount
User
loginAccount
,
@PathVariable
Long
id
,
HttpServletRequest
request
)
{
return
ResultModel
.
OK
(
userService
.
delete
(
loginAccount
,
id
));
User
user
=
userService
.
delete
(
loginAccount
,
id
);
UserLogThread
userlog
=
new
UserLogThread
(
loginAccount
.
getEmail
(),
loginAccount
.
getName
(),
OperateObjectTypeEnum
.
INNERUSER
.
getKey
(),
user
.
getEmail
(),
"删除系统账号"
,
request
);
userlog
.
start
();
return
ResultModel
.
OK
(
user
);
}
}
@RequestMapping
(
value
=
"/enable/{id}"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/enable/{id}"
,
method
=
RequestMethod
.
PUT
)
@ResponseBody
@ResponseBody
public
ResultModel
enable
(
@CurrentAccount
User
loginAccount
,
@PathVariable
Long
id
)
{
public
ResultModel
enable
(
@CurrentAccount
User
loginAccount
,
@PathVariable
Long
id
,
HttpServletRequest
request
)
{
return
ResultModel
.
OK
(
userService
.
enable
(
loginAccount
,
id
));
User
user
=
userService
.
enable
(
loginAccount
,
id
);
UserLogThread
userlog
=
new
UserLogThread
(
loginAccount
.
getEmail
(),
loginAccount
.
getName
(),
OperateObjectTypeEnum
.
INNERUSER
.
getKey
(),
user
.
getEmail
(),
"启用系统账号"
,
request
);
userlog
.
start
();
return
ResultModel
.
OK
(
user
);
}
}
@RequestMapping
(
value
=
"/forbiden/{id}"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/forbiden/{id}"
,
method
=
RequestMethod
.
PUT
)
@ResponseBody
@ResponseBody
public
ResultModel
forbiden
(
@CurrentAccount
User
loginAccount
,
@PathVariable
Long
id
)
{
public
ResultModel
forbiden
(
@CurrentAccount
User
loginAccount
,
@PathVariable
Long
id
,
HttpServletRequest
request
)
{
return
ResultModel
.
OK
(
userService
.
forbiden
(
loginAccount
,
id
));
User
user
=
userService
.
forbiden
(
loginAccount
,
id
);
UserLogThread
userlog
=
new
UserLogThread
(
loginAccount
.
getEmail
(),
loginAccount
.
getName
(),
OperateObjectTypeEnum
.
INNERUSER
.
getKey
(),
user
.
getEmail
(),
"停用系统账号"
,
request
);
userlog
.
start
();
return
ResultModel
.
OK
(
user
);
}
}
@RequestMapping
(
value
=
"/update/name"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/update/name"
,
method
=
RequestMethod
.
PUT
)
@ResponseBody
@ResponseBody
public
ResultModel
updateName
(
@CurrentAccount
User
loginAccount
,
@RequestParam
String
name
)
{
public
ResultModel
updateName
(
@CurrentAccount
User
loginAccount
,
@RequestParam
String
name
,
HttpServletRequest
request
)
{
User
login
=
userRepository
.
login
(
name
);
User
login
=
userRepository
.
login
(
name
);
if
(
null
==
login
){
if
(
null
==
login
){
userService
.
updateName
(
loginAccount
,
name
);
User
user
=
userService
.
updateName
(
loginAccount
,
name
);
UserLogThread
userlog
=
new
UserLogThread
(
loginAccount
.
getEmail
(),
loginAccount
.
getName
(),
OperateObjectTypeEnum
.
INNERUSER
.
getKey
(),
user
.
getEmail
(),
"修改系统账号名字"
,
request
);
userlog
.
start
();
return
ResultModel
.
OK
(
true
);
return
ResultModel
.
OK
(
true
);
}
else
{
}
else
{
return
ResultModel
.
OK
(
false
);
return
ResultModel
.
OK
(
false
);
...
@@ -119,10 +137,12 @@ public class UserController {
...
@@ -119,10 +137,12 @@ public class UserController {
@RequestMapping
(
value
=
"/update/password"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/update/password"
,
method
=
RequestMethod
.
PUT
)
@ResponseBody
@ResponseBody
public
ResultModel
updatePwd
(
@CurrentAccount
User
loginAccount
,
@RequestParam
String
pwd
,
@RequestParam
String
oldpwd
)
{
public
ResultModel
updatePwd
(
@CurrentAccount
User
loginAccount
,
@RequestParam
String
pwd
,
@RequestParam
String
oldpwd
,
HttpServletRequest
request
)
{
User
login
=
userRepository
.
login
(
loginAccount
.
getEmail
(),
CipherUtil
.
generatePassword
(
oldpwd
));
User
login
=
userRepository
.
login
(
loginAccount
.
getEmail
(),
CipherUtil
.
generatePassword
(
oldpwd
));
if
(
null
!=
login
){
if
(
null
!=
login
){
userService
.
updatePwd
(
loginAccount
,
pwd
);
User
user
=
userService
.
updatePwd
(
loginAccount
,
pwd
);
UserLogThread
userlog
=
new
UserLogThread
(
loginAccount
.
getEmail
(),
loginAccount
.
getName
(),
OperateObjectTypeEnum
.
INNERUSER
.
getKey
(),
user
.
getEmail
(),
"修改系统账号密码"
,
request
);
userlog
.
start
();
return
ResultModel
.
OK
(
true
);
return
ResultModel
.
OK
(
true
);
}
else
{
}
else
{
return
ResultModel
.
OK
(
false
);
return
ResultModel
.
OK
(
false
);
...
@@ -132,8 +152,9 @@ public class UserController {
...
@@ -132,8 +152,9 @@ public class UserController {
//忘记密码时,修改密码
//忘记密码时,修改密码
@RequestMapping
(
value
=
"/update/pwd"
,
method
=
RequestMethod
.
PUT
)
@RequestMapping
(
value
=
"/update/pwd"
,
method
=
RequestMethod
.
PUT
)
@ResponseBody
@ResponseBody
public
ResultModel
updatePwd
(
@RequestParam
String
email
,
@RequestParam
String
pwd
)
{
public
ResultModel
updatePwd
(
@RequestParam
String
email
,
@RequestParam
String
pwd
,
HttpServletRequest
request
)
{
UserLogThread
userlog
=
new
UserLogThread
(
email
,
email
,
OperateObjectTypeEnum
.
INNERUSER
.
getKey
(),
email
,
"修改系统账号密码"
,
request
);
userlog
.
start
();
return
ResultModel
.
OK
(
userService
.
updatePwd
(
email
,
pwd
));
return
ResultModel
.
OK
(
userService
.
updatePwd
(
email
,
pwd
));
}
}
...
...
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