Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
chnmuseum-party
Project
Project
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
liqin
chnmuseum-party
Commits
a2441f43
Commit
a2441f43
authored
Apr 14, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
192d64ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
39 deletions
+13
-39
SystemOperationLogService.java
...chnmuseum/party/common/log/SystemOperationLogService.java
+10
-36
GlobalExceptionAdvisor.java
...gy/chnmuseum/party/common/mvc/GlobalExceptionAdvisor.java
+3
-3
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/common/log/SystemOperationLogService.java
View file @
a2441f43
package
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
log
;
import
cn.wisenergy.chnmuseum.party.auth.util.JwtTokenUtil
;
import
cn.wisenergy.chnmuseum.party.common.enums.*
;
import
cn.wisenergy.chnmuseum.party.common.util.DateUtil80
;
import
cn.wisenergy.chnmuseum.party.common.vo.AuditStatusParam
;
import
cn.wisenergy.chnmuseum.party.common.vo.GenericPageParam
;
import
cn.wisenergy.chnmuseum.party.core.annotations.OperationLog
;
import
cn.wisenergy.chnmuseum.party.mapper.SysLogMapper
;
import
cn.wisenergy.chnmuseum.party.model.*
;
import
cn.wisenergy.chnmuseum.party.service.CopyrightOwnerService
;
import
cn.wisenergy.chnmuseum.party.service.TOperationLogService
;
import
cn.wisenergy.chnmuseum.party.service.impl.AuditServiceImpl
;
import
cn.wisenergy.chnmuseum.party.service.impl.CopyrightOwnerServiceImpl
;
import
cn.wisenergy.chnmuseum.party.service.impl.TUserServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
javassist.util.HotSwapper
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.shiro.authc.AuthenticationException
;
import
org.aspectj.lang.JoinPoint
;
...
...
@@ -39,11 +34,10 @@ import java.lang.reflect.Method;
import
java.net.InetAddress
;
import
java.time.LocalDateTime
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
static
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
enums
.
CopyrightOwnerTypeEnum
.*;
import
static
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
enums
.
CopyrightOwnerTypeEnum
.
VIDEO_CONTENT
;
@Service
@Aspect
...
...
@@ -66,7 +60,6 @@ class SystemOperationLogService extends ServiceImpl<SysLogMapper, SysLog> {
private
TOperationLogService
operationLogService
;
public
SystemOperationLogService
()
{
System
.
out
.
println
(
"Aop"
);
}
public
TUser
getCurAdmin
(
HttpServletRequest
request
)
{
...
...
@@ -75,8 +68,7 @@ class SystemOperationLogService extends ServiceImpl<SysLogMapper, SysLog> {
throw
new
AuthenticationException
(
"token失效,请重新登录"
);
}
String
username
=
JwtTokenUtil
.
getUsername
(
header
);
TUser
user
=
userService
.
selectByUsername
(
username
);
return
user
;
return
userService
.
selectByUsername
(
username
);
}
/**
...
...
@@ -86,7 +78,6 @@ class SystemOperationLogService extends ServiceImpl<SysLogMapper, SysLog> {
public
void
methodCachePointcut
()
{
}
/**
* 切面
*
...
...
@@ -96,12 +87,10 @@ class SystemOperationLogService extends ServiceImpl<SysLogMapper, SysLog> {
*/
@Around
(
"methodCachePointcut()"
)
public
Object
around
(
ProceedingJoinPoint
point
)
throws
Throwable
{
HttpServletRequest
request
=
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
();
HttpServletRequest
request
=
((
ServletRequestAttributes
)
Objects
.
requireNonNull
(
RequestContextHolder
.
getRequestAttributes
())).
getRequest
();
MethodLog
methodLog
=
getAnnotationLog
(
point
);
String
ip
=
getIp
(
request
);
TUser
user
=
null
;
TUser
user
;
try
{
user
=
getCurAdmin
(
request
);
}
catch
(
Exception
e
)
{
...
...
@@ -118,22 +107,9 @@ class SystemOperationLogService extends ServiceImpl<SysLogMapper, SysLog> {
return
getFailResult
();
}
}
String
operatingcontent
=
""
;
Object
[]
method_param
=
null
;
Object
object
=
null
;
try
{
method_param
=
point
.
getArgs
();
//获取方法参数
// String param=(String) point.proceed(point.getArgs());
object
=
point
.
proceed
();
}
catch
(
Exception
e
)
{
// 异常处理记录日志..
e
.
printStackTrace
();
return
getFailResult
();
}
// getMethodLog(user,methodLog,method_param);
Object
[]
method_param
;
Object
object
=
point
.
proceed
();
method_param
=
point
.
getArgs
();
//获取方法参数
if
(
OperModule
.
STBOPERATION
.
getMsg
().
equals
(
methodLog
.
operModule
().
getMsg
()))
{
TOperationLog
operationLog
=
new
TOperationLog
();
operationLog
.
setCreateTime
(
LocalDateTime
.
now
());
...
...
@@ -151,13 +127,11 @@ class SystemOperationLogService extends ServiceImpl<SysLogMapper, SysLog> {
}
sysLog
.
setOperator
(
user
.
getUserName
());
sysLog
.
setOperationIp
(
ip
);
// sysLog.setOperationContent(methodName);
sysLog
.
setOperationTime
(
DateUtil80
.
getDateTimeOfTimestamp
(
System
.
currentTimeMillis
()));
// 处理设置注解上的参数
getControllerMethodDescription
(
user
,
methodLog
,
sysLog
,
method_param
);
int
insert
=
sysLogMapper
.
insert
(
sysLog
);
sysLogMapper
.
insert
(
sysLog
);
return
object
;
}
...
...
@@ -258,7 +232,7 @@ class SystemOperationLogService extends ServiceImpl<SysLogMapper, SysLog> {
sysLog
.
setOperationType
(
OperType
.
LOWER
.
getMsg
());
}
}
else
if
(
methodLog
.
operModule
().
getCode
()
==
OperModule
.
VIDEOCOPYRIGHT
.
getCode
())
{
}
else
if
(
methodLog
.
operModule
().
getCode
()
==
OperModule
.
VIDEOCOPYRIGHT
.
getCode
())
{
GenericPageParam
g
=
(
GenericPageParam
)
method_param
[
0
];
if
(
VIDEO_CONTENT
.
name
().
equals
(
g
.
getOwnerType
()))
{
sysLog
.
setOperationObject
(
OperModule
.
VIDEOCOPYRIGHT
.
getMsg
());
...
...
src/main/java/cn/wisenergy/chnmuseum/party/common/mvc/GlobalExceptionAdvisor.java
View file @
a2441f43
...
...
@@ -138,11 +138,11 @@ public class GlobalExceptionAdvisor {
String
message
=
Splitter
.
on
(
System
.
lineSeparator
()).
trimResults
().
splitToList
(
localizedMessage
).
get
(
1
);
String
substring
=
message
.
substring
(
message
.
indexOf
(
"Exception:"
));
if
(
substring
.
toUpperCase
().
contains
(
"NAME"
))
{
return
new
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
(
"400"
,
"名称已存在"
);
return
new
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
(
"400"
,
"名称已存在"
,
""
);
}
else
if
(
substring
.
toUpperCase
().
contains
(
"CODE"
))
{
return
new
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
(
"400"
,
"编码已存在"
);
return
new
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
(
"400"
,
"编码已存在"
,
""
);
}
return
new
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
(
"400"
,
message
);
return
new
cn
.
wisenergy
.
chnmuseum
.
party
.
common
.
validator
.
HttpResult
(
"400"
,
message
,
""
);
}
@ExceptionHandler
(
SQLIntegrityConstraintViolationException
.
class
)
...
...
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