Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
c8d6c5b0
Commit
c8d6c5b0
authored
Jul 13, 2019
by
周健威
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into base-modify
parents
dc092f8f
702ff965
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
15 deletions
+53
-15
CommonLogService.java
.../github/wxiaoqi/security/common/log/CommonLogService.java
+8
-1
CommonLogServiceImpl.java
...xiaoqi/security/common/log/Impl/CommonLogServiceImpl.java
+7
-2
XxLogInterceptor.java
.../github/wxiaoqi/security/common/log/XxLogInterceptor.java
+18
-4
CertificationService.java
...xxfc/platform/universal/service/CertificationService.java
+20
-8
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/log/CommonLogService.java
View file @
c8d6c5b0
...
@@ -35,7 +35,14 @@ public interface CommonLogService {
...
@@ -35,7 +35,14 @@ public interface CommonLogService {
* @param xxLogEntity
* @param xxLogEntity
* @param result
* @param result
*/
*/
void
initCommonLogLastPart
(
XxLogEntity
xxLogEntity
,
BaseResponse
result
);
void
initCommonLogLastPart
(
XxLogEntity
xxLogEntity
,
Object
result
);
/**
* 初始化日志后半部分(String)
* @param xxLogEntity
* @param result
*/
void
initCommonLogLastPart
(
XxLogEntity
xxLogEntity
,
String
result
);
/**
/**
...
...
ace-common/src/main/java/com/github/wxiaoqi/security/common/log/Impl/CommonLogServiceImpl.java
View file @
c8d6c5b0
...
@@ -103,10 +103,15 @@ public class CommonLogServiceImpl implements CommonLogService {
...
@@ -103,10 +103,15 @@ public class CommonLogServiceImpl implements CommonLogService {
}
}
@Override
@Override
public
void
initCommonLogLastPart
(
XxLogEntity
xxLogEntity
,
BaseResponse
result
)
{
public
void
initCommonLogLastPart
(
XxLogEntity
xxLogEntity
,
Object
result
)
{
initCommonLogLastPart
(
xxLogEntity
,
JSON
.
toJSONString
(
result
));
}
@Override
public
void
initCommonLogLastPart
(
XxLogEntity
xxLogEntity
,
String
result
)
{
LocalDateTime
endTime
=
LocalDateTime
.
now
();
//结束时间
LocalDateTime
endTime
=
LocalDateTime
.
now
();
//结束时间
xxLogEntity
.
setEndDate
(
endTime
.
toString
());
xxLogEntity
.
setEndDate
(
endTime
.
toString
());
xxLogEntity
.
setResponseData
(
JSON
.
toJSONString
(
result
)
);
xxLogEntity
.
setResponseData
(
result
);
}
}
@Override
@Override
...
...
ace-common/src/main/java/com/github/wxiaoqi/security/common/log/XxLogInterceptor.java
View file @
c8d6c5b0
package
com
.
github
.
wxiaoqi
.
security
.
common
.
log
;
package
com
.
github
.
wxiaoqi
.
security
.
common
.
log
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.log.CommonLogService
;
import
com.github.wxiaoqi.security.common.log.CommonLogService
;
import
com.github.wxiaoqi.security.common.log.entity.XxLogEntity
;
import
com.github.wxiaoqi.security.common.log.entity.XxLogEntity
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Around
;
import
org.aspectj.lang.annotation.Aspect
;
import
org.aspectj.lang.annotation.Aspect
;
...
@@ -26,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
...
@@ -26,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
*/
*/
@Aspect
@Aspect
@Component
@Component
@Slf4j
public
class
XxLogInterceptor
{
public
class
XxLogInterceptor
{
@Autowired
@Autowired
...
@@ -46,22 +50,32 @@ public class XxLogInterceptor{
...
@@ -46,22 +50,32 @@ public class XxLogInterceptor{
Object
[]
params
=
pjp
.
getArgs
();
//获取请求参数
Object
[]
params
=
pjp
.
getArgs
();
//获取请求参数
MethodSignature
signature
=
(
MethodSignature
)
pjp
.
getSignature
();
MethodSignature
signature
=
(
MethodSignature
)
pjp
.
getSignature
();
if
(
params
!=
null
&&
params
.
length
>
0
)
{
if
(
params
!=
null
&&
params
.
length
>
0
)
{
xxLogEntity
.
setRequestData
(
JSON
.
toJSONString
(
params
[
0
]));
try
{
xxLogEntity
.
setRequestData
(
JSON
.
toJSONString
(
params
[
0
]));
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
Object
result
=
new
Object
();
Object
result
=
new
Object
();
try
{
try
{
//###################上面代码为方法执行前#####################
//###################上面代码为方法执行前#####################
result
=
pjp
.
proceed
();
//执行方法,获取返回参数
result
=
pjp
.
proceed
();
//执行方法,获取返回参数
//###################下面代码为方法执行后#####################
//###################下面代码为方法执行后#####################
commonLogService
.
initCommonLogLastPart
(
xxLogEntity
,
(
BaseResponse
)
result
);
if
(
result
instanceof
JSONObject
)
{
commonLogService
.
initCommonLogLastPart
(
xxLogEntity
,
((
JSONObject
)
result
).
toJSONString
());
}
else
{
commonLogService
.
initCommonLogLastPart
(
xxLogEntity
,
result
);
}
}
catch
(
BaseException
e
){
commonLogService
.
initCommonLogLastPart
(
xxLogEntity
,
ObjectRestResponse
.
createFailedResult
(
e
.
getStatus
(),
e
.
getMessage
()));
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
commonLogService
.
initCommonLogLastPart
(
xxLogEntity
,
(
BaseResponse
)
result
);
commonLogService
.
initCommonLogLastPart
(
xxLogEntity
,
ObjectRestResponse
.
createFailedResult
(
500
,
e
.
getMessage
()));
xxLogEntity
.
setResponseData
(
JSON
.
toJSONString
(
ObjectRestResponse
.
createDefaultFail
()));
throw
e
;
throw
e
;
}
finally
{
}
finally
{
commonLogService
.
commonLog
(
xxLogEntity
);
commonLogService
.
commonLog
(
xxLogEntity
);
}
}
return
result
;
return
result
;
}
}
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/CertificationService.java
View file @
c8d6c5b0
...
@@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
...
@@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -347,18 +348,29 @@ public class CertificationService {
...
@@ -347,18 +348,29 @@ public class CertificationService {
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
Date
expirationDate
=
new
Date
();
formatter
.
setLenient
(
false
);
if
(!
Validation
.
isDate
(
endDate
))
{
Date
expirationDate
=
null
;
Date
date
=
new
Date
();
try
{
Calendar
c
=
Calendar
.
getInstance
();
expirationDate
=
formatter
.
parse
(
endDate
);
c
.
setTime
(
date
);
}
catch
(
ParseException
e
)
{
c
.
add
(
Calendar
.
YEAR
,
100
);
expirationDate
=
c
.
getTime
();
e
.
printStackTrace
();
}
else
{
return
ObjectRestResponse
.
createDefaultFail
();
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
"yyyyMMdd"
);
formatter
.
setLenient
(
false
);
try
{
expirationDate
=
formatter
.
parse
(
endDate
);
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
return
ObjectRestResponse
.
createDefaultFail
();
}
}
}
idInformation
.
setExpirationDate
(
expirationDate
);
idInformation
.
setExpirationDate
(
expirationDate
);
Boolean
aBoolean
=
addIdInformation
(
idInformation
);
Boolean
aBoolean
=
addIdInformation
(
idInformation
);
...
...
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