Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
guns-vip
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenjunxiong
guns-vip
Commits
3ae2f16e
Commit
3ae2f16e
authored
Apr 06, 2017
by
fsn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
为所有增删改业务添加日志记录
parent
09298dd2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
32 additions
and
12 deletions
+32
-12
src/main/java/com/stylefeng/guns/core/aop/LogAop.java
+1
-1
src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
+3
-3
src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java
+7
-0
src/main/java/com/stylefeng/guns/modular/system/controller/UserMgrController.java
+10
-0
src/main/java/com/stylefeng/guns/modular/system/warpper/LogWarpper.java
+2
-2
src/main/java/com/stylefeng/guns/persistence/model/User.java
+8
-2
src/main/webapp/static/js/common/Feng.js
+1
-4
No files found.
src/main/java/com/stylefeng/guns/core/aop/LogAop.java
View file @
3ae2f16e
...
@@ -76,7 +76,7 @@ public class LogAop {
...
@@ -76,7 +76,7 @@ public class LogAop {
//如果涉及到修改,比对变化
//如果涉及到修改,比对变化
String
msg
=
null
;
String
msg
=
null
;
if
(
bussinessName
.
indexOf
(
"修改"
)
!=
-
1
)
{
if
(
bussinessName
.
indexOf
(
"修改"
)
!=
-
1
||
bussinessName
.
indexOf
(
"编辑"
)
!=
-
1
)
{
Object
obj1
=
LogObjectHolder
.
me
().
get
();
Object
obj1
=
LogObjectHolder
.
me
().
get
();
Map
<
String
,
String
>
obj2
=
HttpKit
.
getRequestParameters
();
Map
<
String
,
String
>
obj2
=
HttpKit
.
getRequestParameters
();
msg
=
Contrast
.
contrastObj
(
key
,
obj1
,
obj2
);
msg
=
Contrast
.
contrastObj
(
key
,
obj1
,
obj2
);
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/MenuController.java
View file @
3ae2f16e
...
@@ -70,10 +70,8 @@ public class MenuController extends BaseController {
...
@@ -70,10 +70,8 @@ public class MenuController extends BaseController {
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
throw
new
BussinessException
(
BizExceptionEnum
.
REQUEST_NULL
);
}
}
Menu
menu
=
this
.
menuMapper
.
selectById
(
menuId
);
Menu
menu
=
this
.
menuMapper
.
selectById
(
menuId
);
LogObjectHolder
.
me
().
set
(
menu
);
model
.
addAttribute
(
menu
);
model
.
addAttribute
(
menu
);
LogObjectHolder
.
me
().
set
(
menu
);
return
PREFIX
+
"menu_edit.html"
;
return
PREFIX
+
"menu_edit.html"
;
}
}
...
@@ -120,6 +118,7 @@ public class MenuController extends BaseController {
...
@@ -120,6 +118,7 @@ public class MenuController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/add"
)
@RequestMapping
(
value
=
"/add"
)
@BussinessLog
(
"菜单新增"
)
@ResponseBody
@ResponseBody
public
Tip
add
(
@Valid
Menu
menu
,
BindingResult
result
)
{
public
Tip
add
(
@Valid
Menu
menu
,
BindingResult
result
)
{
if
(
result
.
hasErrors
())
{
if
(
result
.
hasErrors
())
{
...
@@ -135,6 +134,7 @@ public class MenuController extends BaseController {
...
@@ -135,6 +134,7 @@ public class MenuController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/remove/{menuId}"
)
@RequestMapping
(
value
=
"/remove/{menuId}"
)
@BussinessLog
(
value
=
"删除菜单"
,
key
=
"menuId"
)
@ResponseBody
@ResponseBody
public
Tip
remove
(
@PathVariable
Integer
menuId
)
{
public
Tip
remove
(
@PathVariable
Integer
menuId
)
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
if
(
ToolUtil
.
isEmpty
(
menuId
))
{
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/RoleController.java
View file @
3ae2f16e
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
com.stylefeng.guns.common.annotion.Permission
;
import
com.stylefeng.guns.common.annotion.Permission
;
import
com.stylefeng.guns.common.annotion.log.BussinessLog
;
import
com.stylefeng.guns.common.constant.Const
;
import
com.stylefeng.guns.common.constant.Const
;
import
com.stylefeng.guns.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.common.constant.tips.Tip
;
import
com.stylefeng.guns.common.constant.tips.Tip
;
...
@@ -8,6 +9,7 @@ import com.stylefeng.guns.common.controller.BaseController;
...
@@ -8,6 +9,7 @@ import com.stylefeng.guns.common.controller.BaseController;
import
com.stylefeng.guns.common.exception.BizExceptionEnum
;
import
com.stylefeng.guns.common.exception.BizExceptionEnum
;
import
com.stylefeng.guns.common.exception.BussinessException
;
import
com.stylefeng.guns.common.exception.BussinessException
;
import
com.stylefeng.guns.common.node.ZTreeNode
;
import
com.stylefeng.guns.common.node.ZTreeNode
;
import
com.stylefeng.guns.core.log.LogObjectHolder
;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.core.util.Convert
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.modular.system.dao.RoleDao
;
import
com.stylefeng.guns.modular.system.dao.RoleDao
;
...
@@ -82,6 +84,7 @@ public class RoleController extends BaseController {
...
@@ -82,6 +84,7 @@ public class RoleController extends BaseController {
model
.
addAttribute
(
role
);
model
.
addAttribute
(
role
);
model
.
addAttribute
(
"pName"
,
ConstantFactory
.
getSingleRoleName
(
role
.
getPid
()));
model
.
addAttribute
(
"pName"
,
ConstantFactory
.
getSingleRoleName
(
role
.
getPid
()));
model
.
addAttribute
(
"deptName"
,
ConstantFactory
.
getDeptName
(
role
.
getDeptid
()));
model
.
addAttribute
(
"deptName"
,
ConstantFactory
.
getDeptName
(
role
.
getDeptid
()));
LogObjectHolder
.
me
().
set
(
role
);
return
PREFIX
+
"/role_edit.html"
;
return
PREFIX
+
"/role_edit.html"
;
}
}
...
@@ -113,6 +116,7 @@ public class RoleController extends BaseController {
...
@@ -113,6 +116,7 @@ public class RoleController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/add"
)
@RequestMapping
(
value
=
"/add"
)
@BussinessLog
(
"添加角色"
)
@ResponseBody
@ResponseBody
public
Tip
add
(
@Valid
Role
role
,
BindingResult
result
)
{
public
Tip
add
(
@Valid
Role
role
,
BindingResult
result
)
{
if
(
result
.
hasErrors
())
{
if
(
result
.
hasErrors
())
{
...
@@ -128,6 +132,7 @@ public class RoleController extends BaseController {
...
@@ -128,6 +132,7 @@ public class RoleController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/edit"
)
@RequestMapping
(
value
=
"/edit"
)
@BussinessLog
(
"修改角色"
)
@ResponseBody
@ResponseBody
public
Tip
edit
(
@Valid
Role
role
,
BindingResult
result
)
{
public
Tip
edit
(
@Valid
Role
role
,
BindingResult
result
)
{
if
(
result
.
hasErrors
())
{
if
(
result
.
hasErrors
())
{
...
@@ -142,6 +147,7 @@ public class RoleController extends BaseController {
...
@@ -142,6 +147,7 @@ public class RoleController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
value
=
"/remove/{roleId}"
)
@RequestMapping
(
value
=
"/remove/{roleId}"
)
@BussinessLog
(
value
=
"删除角色"
,
key
=
"roleId"
)
@ResponseBody
@ResponseBody
public
Tip
remove
(
@PathVariable
Integer
roleId
)
{
public
Tip
remove
(
@PathVariable
Integer
roleId
)
{
if
(
ToolUtil
.
isEmpty
(
roleId
))
{
if
(
ToolUtil
.
isEmpty
(
roleId
))
{
...
@@ -172,6 +178,7 @@ public class RoleController extends BaseController {
...
@@ -172,6 +178,7 @@ public class RoleController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
"/setAuthority"
)
@RequestMapping
(
"/setAuthority"
)
@BussinessLog
(
value
=
"配置权限"
,
key
=
"roleId"
)
@ResponseBody
@ResponseBody
public
Tip
setAuthority
(
@RequestParam
(
"roleId"
)
Integer
roleId
,
@RequestParam
(
"ids"
)
String
ids
)
{
public
Tip
setAuthority
(
@RequestParam
(
"roleId"
)
Integer
roleId
,
@RequestParam
(
"ids"
)
String
ids
)
{
if
(
ToolUtil
.
isOneEmpty
(
roleId
))
{
if
(
ToolUtil
.
isOneEmpty
(
roleId
))
{
...
...
src/main/java/com/stylefeng/guns/modular/system/controller/UserMgrController.java
View file @
3ae2f16e
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
package
com
.
stylefeng
.
guns
.
modular
.
system
.
controller
;
import
com.stylefeng.guns.common.annotion.Permission
;
import
com.stylefeng.guns.common.annotion.Permission
;
import
com.stylefeng.guns.common.annotion.log.BussinessLog
;
import
com.stylefeng.guns.common.constant.Const
;
import
com.stylefeng.guns.common.constant.Const
;
import
com.stylefeng.guns.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.common.constant.factory.ConstantFactory
;
import
com.stylefeng.guns.common.constant.state.ManagerStatus
;
import
com.stylefeng.guns.common.constant.state.ManagerStatus
;
...
@@ -9,6 +10,7 @@ import com.stylefeng.guns.common.controller.BaseController;
...
@@ -9,6 +10,7 @@ import com.stylefeng.guns.common.controller.BaseController;
import
com.stylefeng.guns.common.exception.BizExceptionEnum
;
import
com.stylefeng.guns.common.exception.BizExceptionEnum
;
import
com.stylefeng.guns.common.exception.BussinessException
;
import
com.stylefeng.guns.common.exception.BussinessException
;
import
com.stylefeng.guns.core.db.Db
;
import
com.stylefeng.guns.core.db.Db
;
import
com.stylefeng.guns.core.log.LogObjectHolder
;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.core.shiro.ShiroKit
;
import
com.stylefeng.guns.core.shiro.ShiroUser
;
import
com.stylefeng.guns.core.shiro.ShiroUser
;
import
com.stylefeng.guns.core.util.ToolUtil
;
import
com.stylefeng.guns.core.util.ToolUtil
;
...
@@ -92,6 +94,7 @@ public class UserMgrController extends BaseController {
...
@@ -92,6 +94,7 @@ public class UserMgrController extends BaseController {
model
.
addAttribute
(
user
);
model
.
addAttribute
(
user
);
model
.
addAttribute
(
"roleName"
,
ConstantFactory
.
getRoleName
(
user
.
getRoleid
()));
model
.
addAttribute
(
"roleName"
,
ConstantFactory
.
getRoleName
(
user
.
getRoleid
()));
model
.
addAttribute
(
"deptName"
,
ConstantFactory
.
getDeptName
(
user
.
getDeptid
()));
model
.
addAttribute
(
"deptName"
,
ConstantFactory
.
getDeptName
(
user
.
getDeptid
()));
LogObjectHolder
.
me
().
set
(
user
);
return
PREFIX
+
"user_edit.html"
;
return
PREFIX
+
"user_edit.html"
;
}
}
...
@@ -125,6 +128,7 @@ public class UserMgrController extends BaseController {
...
@@ -125,6 +128,7 @@ public class UserMgrController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
"/add"
)
@RequestMapping
(
"/add"
)
@BussinessLog
(
"添加管理员"
)
@ResponseBody
@ResponseBody
public
Tip
add
(
@Valid
User
user
,
BindingResult
result
)
{
public
Tip
add
(
@Valid
User
user
,
BindingResult
result
)
{
if
(
result
.
hasErrors
())
{
if
(
result
.
hasErrors
())
{
...
@@ -152,6 +156,7 @@ public class UserMgrController extends BaseController {
...
@@ -152,6 +156,7 @@ public class UserMgrController extends BaseController {
* @throws NoPermissionException
* @throws NoPermissionException
*/
*/
@RequestMapping
(
"/edit"
)
@RequestMapping
(
"/edit"
)
@BussinessLog
(
"修改管理员"
)
@ResponseBody
@ResponseBody
public
Tip
edit
(
@Valid
User
user
,
BindingResult
result
)
throws
NoPermissionException
{
public
Tip
edit
(
@Valid
User
user
,
BindingResult
result
)
throws
NoPermissionException
{
if
(
result
.
hasErrors
())
{
if
(
result
.
hasErrors
())
{
...
@@ -176,6 +181,7 @@ public class UserMgrController extends BaseController {
...
@@ -176,6 +181,7 @@ public class UserMgrController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
"/delete/{userId}"
)
@RequestMapping
(
"/delete/{userId}"
)
@BussinessLog
(
value
=
"删除管理员"
,
key
=
"userId"
)
@ResponseBody
@ResponseBody
public
Tip
delete
(
@PathVariable
Integer
userId
)
{
public
Tip
delete
(
@PathVariable
Integer
userId
)
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
...
@@ -202,6 +208,7 @@ public class UserMgrController extends BaseController {
...
@@ -202,6 +208,7 @@ public class UserMgrController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
"/reset/{userId}"
)
@RequestMapping
(
"/reset/{userId}"
)
@BussinessLog
(
value
=
"重置管理员密码"
,
key
=
"userId"
)
@ResponseBody
@ResponseBody
public
Tip
reset
(
@PathVariable
Integer
userId
)
{
public
Tip
reset
(
@PathVariable
Integer
userId
)
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
...
@@ -219,6 +226,7 @@ public class UserMgrController extends BaseController {
...
@@ -219,6 +226,7 @@ public class UserMgrController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
"/freeze/{userId}"
)
@RequestMapping
(
"/freeze/{userId}"
)
@BussinessLog
(
value
=
"冻结用户"
,
key
=
"userId"
)
@ResponseBody
@ResponseBody
public
Tip
freeze
(
@PathVariable
Integer
userId
)
{
public
Tip
freeze
(
@PathVariable
Integer
userId
)
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
...
@@ -233,6 +241,7 @@ public class UserMgrController extends BaseController {
...
@@ -233,6 +241,7 @@ public class UserMgrController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
"/unfreeze/{userId}"
)
@RequestMapping
(
"/unfreeze/{userId}"
)
@BussinessLog
(
value
=
"解除冻结用户"
,
key
=
"userId"
)
@ResponseBody
@ResponseBody
public
Tip
unfreeze
(
@PathVariable
Integer
userId
)
{
public
Tip
unfreeze
(
@PathVariable
Integer
userId
)
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
if
(
ToolUtil
.
isEmpty
(
userId
))
{
...
@@ -247,6 +256,7 @@ public class UserMgrController extends BaseController {
...
@@ -247,6 +256,7 @@ public class UserMgrController extends BaseController {
*/
*/
@Permission
(
Const
.
ADMIN_NAME
)
@Permission
(
Const
.
ADMIN_NAME
)
@RequestMapping
(
"/setRole"
)
@RequestMapping
(
"/setRole"
)
@BussinessLog
(
value
=
"分配角色"
,
key
=
"userId"
)
@ResponseBody
@ResponseBody
public
Tip
setRole
(
@RequestParam
(
"userId"
)
Integer
userId
,
@RequestParam
(
"roleIds"
)
String
roleIds
)
{
public
Tip
setRole
(
@RequestParam
(
"userId"
)
Integer
userId
,
@RequestParam
(
"roleIds"
)
String
roleIds
)
{
if
(
ToolUtil
.
isOneEmpty
(
userId
,
roleIds
))
{
if
(
ToolUtil
.
isOneEmpty
(
userId
,
roleIds
))
{
...
...
src/main/java/com/stylefeng/guns/modular/system/warpper/LogWarpper.java
View file @
3ae2f16e
...
@@ -23,10 +23,10 @@ public class LogWarpper extends BaseControllerWarpper {
...
@@ -23,10 +23,10 @@ public class LogWarpper extends BaseControllerWarpper {
String
message
=
(
String
)
map
.
get
(
"message"
);
String
message
=
(
String
)
map
.
get
(
"message"
);
if
(
ToolUtil
.
isNotEmpty
(
message
)
&&
message
.
length
()
>=
100
)
{
if
(
ToolUtil
.
isNotEmpty
(
message
)
&&
message
.
length
()
>=
100
)
{
message
=
message
.
substring
(
0
,
100
)
+
"..."
;
message
=
message
.
substring
(
0
,
100
)
+
"..."
;
map
.
put
(
"message"
,
message
);
}
else
{
}
else
{
message
=
null
;
return
;
}
}
map
.
put
(
"message"
,
message
);
}
}
}
}
src/main/java/com/stylefeng/guns/persistence/model/User.java
View file @
3ae2f16e
package
com
.
stylefeng
.
guns
.
persistence
.
model
;
package
com
.
stylefeng
.
guns
.
persistence
.
model
;
import
com.baomidou.mybatisplus.activerecord.Model
;
import
com.baomidou.mybatisplus.activerecord.Model
;
import
java.util.Date
;
import
com.baomidou.mybatisplus.annotations.TableId
;
import
com.baomidou.mybatisplus.annotations.TableName
;
import
com.baomidou.mybatisplus.annotations.TableName
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
com.baomidou.mybatisplus.annotations.TableId
;
import
java.util.Date
;
/**
/**
...
@@ -26,6 +28,8 @@ public class User extends Model<User> {
...
@@ -26,6 +28,8 @@ public class User extends Model<User> {
private
String
password
;
private
String
password
;
private
String
salt
;
private
String
salt
;
private
String
name
;
private
String
name
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
birthday
;
private
Date
birthday
;
private
Integer
sex
;
private
Integer
sex
;
private
String
email
;
private
String
email
;
...
@@ -33,6 +37,8 @@ public class User extends Model<User> {
...
@@ -33,6 +37,8 @@ public class User extends Model<User> {
private
String
roleid
;
private
String
roleid
;
private
Integer
deptid
;
private
Integer
deptid
;
private
Integer
status
;
private
Integer
status
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
createtime
;
private
Date
createtime
;
private
Integer
version
;
private
Integer
version
;
...
...
src/main/webapp/static/js/common/Feng.js
View file @
3ae2f16e
...
@@ -28,10 +28,7 @@ var Feng = {
...
@@ -28,10 +28,7 @@ var Feng = {
type
:
1
,
type
:
1
,
skin
:
'layui-layer-rim'
,
//加上边框
skin
:
'layui-layer-rim'
,
//加上边框
area
:
[
'950px'
,
'600px'
],
//宽高
area
:
[
'950px'
,
'600px'
],
//宽高
content
:
info
content
:
'<div style="padding: 20px;">'
+
info
+
'</div>'
});
layer
.
style
(
index
,
{
padding
:
"20px"
});
});
},
},
writeObj
:
function
(
obj
)
{
writeObj
:
function
(
obj
)
{
...
...
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