Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
huluobin
gogirl-miniapp-backend
Commits
df54851c
Commit
df54851c
authored
Apr 08, 2020
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
异常日志修改
parent
ccf0d23a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
26 deletions
+15
-26
RRExceptionHandler.java
...l/infrastructure/common/exception/RRExceptionHandler.java
+6
-22
LogAspect.java
...java/com/gogirl/infrastructure/interceptor/LogAspect.java
+5
-1
Schedule.java
...ain/java/com/gogirl/infrastructure/schedule/Schedule.java
+3
-3
application-pre.yml
src/main/resources/application-pre.yml
+1
-0
No files found.
src/main/java/com/gogirl/infrastructure/common/exception/RRExceptionHandler.java
View file @
df54851c
...
...
@@ -2,9 +2,7 @@ package com.gogirl.infrastructure.common.exception;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.common.exception.RRException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
...
...
@@ -34,14 +32,14 @@ public class RRExceptionHandler {
result
.
setCode
(
e
.
getCode
());
result
.
setMessage
(
e
.
getMessage
());
if
(
e
.
getCode
()
!=
2000
&&
e
.
getCode
()
!=
1001
&&
e
.
getCode
()
!=
2005
&&
e
.
getCode
()
!=
2006
)
{
log
.
error
(
"Params : {}"
,
getParamString
(
request
.
getParameterMap
())
+
"\n"
);
log
.
error
(
"URI : {}"
,
request
.
getRequestURI
()
+
"\n"
);
if
(
e
.
getCode
()
==
500
&&
e
.
getMessage
().
equals
(
"业务异常"
)
)
{
//
//
log.error("Params : {}", getParamString(request.getParameterMap()) + "\n");
//
log.error("URI : {}", request.getRequestURI() + "\n");
log
.
error
(
e
.
getMessage
(),
e
);
}
else
{
log
.
error
(
"Params : {}"
,
getParamString
(
request
.
getParameterMap
())
+
"\n"
);
log
.
error
(
"URI : {}"
,
request
.
getRequestURI
()
+
"\n"
);
//
log.error("Params : {}", getParamString(request.getParameterMap()) + "\n");
//
log.error("URI : {}", request.getRequestURI() + "\n");
log
.
error
(
e
.
getMessage
());
}
return
result
;
...
...
@@ -63,20 +61,6 @@ public class RRExceptionHandler {
return
result
;
}
@ExceptionHandler
(
MethodArgumentNotValidException
.
class
)
public
JsonResult
<
String
>
MethodArgumentNotValidException
(
HttpServletRequest
request
,
MethodArgumentNotValidException
ex
)
{
JsonResult
<
String
>
result
=
new
JsonResult
<>();
result
.
setSuccess
(
false
);
result
.
setCode
(
500
);
result
.
setMessage
(
"参数错误。"
);
log
.
error
(
"Params : {}"
,
getParamString
(
request
.
getParameterMap
())
+
"\n"
);
log
.
error
(
"URI : {}"
,
request
.
getRequestURI
()
+
"\n"
);
log
.
error
(
ex
.
getMessage
(),
ex
);
return
result
;
}
private
String
getParamString
(
Map
<
String
,
String
[]>
map
)
{
StringBuilder
sb
=
new
StringBuilder
();
for
(
Map
.
Entry
<
String
,
String
[]>
e
:
map
.
entrySet
())
{
...
...
src/main/java/com/gogirl/infrastructure/interceptor/LogAspect.java
View file @
df54851c
package
com
.
gogirl
.
infrastructure
.
interceptor
;
import
com.gogirl.infrastructure.common.base.JsonResult
;
import
com.gogirl.infrastructure.common.util.JsonUtilByFsJson
;
import
com.gogirl.infrastructure.common.util.JsonUtilByJackson
;
import
org.apache.commons.lang3.StringUtils
;
import
org.aspectj.lang.JoinPoint
;
import
org.aspectj.lang.ProceedingJoinPoint
;
...
...
@@ -74,7 +76,9 @@ public class LogAspect {
HttpServletRequest
request
=
attributes
.
getRequest
();
// 会打印出一个对象,想打印出具体内容需要在定义模型处加上toString()
//logger.info( "result:{}", object.toString() );
// logger.info("result:{}", JsonUtilByFsJson.beanToJson(object));
JsonResult
jsonResult
=
JsonUtilByJackson
.
readValue
(
JsonUtilByJackson
.
writeValueAsString
(
object
),
JsonResult
.
class
);
jsonResult
.
setData
(
"hidden data"
);
logger
.
info
(
"result:{}"
,
JsonUtilByJackson
.
writeValueAsString
(
jsonResult
));
;
}
...
...
src/main/java/com/gogirl/infrastructure/schedule/Schedule.java
View file @
df54851c
...
...
@@ -57,7 +57,6 @@ import org.springframework.scheduling.annotation.Scheduled;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.client.RestTemplate
;
import
javax.annotation.Resource
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
...
...
@@ -107,8 +106,11 @@ public class Schedule {
private
final
CareerMapper
careerMapper
;
private
final
StoreManageMapper
storeManageMapper
;
private
final
StoreDataMapper
storeDataMapper
;
private
final
RestTemplate
restTemplate
;
/**
* 每天定时任务,判断优惠券是否过期
*/
...
...
@@ -337,8 +339,6 @@ public class Schedule {
log
.
debug
(
"同步闲时折扣周 结束"
);
}
@Resource
RestTemplate
restTemplate
;
/**
* 定时同步美甲师成长历程
...
...
src/main/resources/application-pre.yml
View file @
df54851c
...
...
@@ -83,6 +83,7 @@ gogirl:
test-paper-time
:
1
#后台后端接口访问地址
admin-backend-url
:
http://test.admin.begogirls.com:7712/api/ReportTable/GetTechnicianPage
wx
:
pay
:
appId
:
wx058b46db3cd0e979
...
...
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