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
2045887c
Commit
2045887c
authored
Nov 25, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
f8f00d50
76f82596
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
38 additions
and
28 deletions
+38
-28
GlobalExceptionHandler.java
...iaoqi/security/common/handler/GlobalExceptionHandler.java
+15
-15
PlatformExceptionHandler.java
...oqi/security/common/handler/PlatformExceptionHandler.java
+16
-7
XxLogInterceptor.java
.../github/wxiaoqi/security/common/log/XxLogInterceptor.java
+2
-4
AdminBootstrap.java
...ava/com/github/wxiaoqi/security/admin/AdminBootstrap.java
+4
-1
VehicleBookRecordMapper.xml
...ver/src/main/resources/mapper/VehicleBookRecordMapper.xml
+1
-1
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/handler/GlobalExceptionHandler.java
View file @
2045887c
...
...
@@ -40,6 +40,15 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
private
Logger
logger
=
LoggerFactory
.
getLogger
(
GlobalExceptionHandler
.
class
);
@Value
(
"${spring.application.name}"
)
private
String
applicationName
;
@Value
(
"${email.log.account}"
)
private
String
emailLogAccount
;
@Value
(
"${email.log.title}"
)
private
String
emailLogTitle
;
@Value
(
"${email.log.host}"
)
private
String
emailLogHost
;
/**
* 在controller里面内容执行之前,校验一些参数不匹配啊,Get post方法不对啊之类的
*/
...
...
@@ -77,15 +86,6 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
if
(
0
==
ex
.
getStatus
())
{
response
.
setStatus
(
500
);
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"toUser"
,
"jiaoruizhen@126.com"
);
map
.
put
(
"subject"
,
"服务器异常"
);
map
.
put
(
"content"
,
ex
.
toString
()
+
":"
+
ex
.
getMessage
());
try
{
HttpUtils
.
doPost
(
"http://10.5.52.3:8765"
,
"/api/universal/mail/app/unauth/send"
,
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
return
new
BaseResponse
(
ex
.
getStatus
(),
ex
.
getMessage
());
}
...
...
@@ -99,22 +99,22 @@ public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
cause
.
printStackTrace
(
new
PrintWriter
(
stringWriter
));
logger
.
error
(
cause
.
getMessage
(),
ex
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"toUser"
,
"jiaoruizhen@126.com"
);
map
.
put
(
"subject"
,
"服务器异常"
);
map
.
put
(
"toUser"
,
emailLogAccount
);
map
.
put
(
"subject"
,
emailLogTitle
);
map
.
put
(
"content"
,
initCommonLogPrePart
()+
":"
+
stringWriter
.
toString
());
try
{
HttpUtils
.
doPost
(
"http://10.5.52.3:8765"
,
"/api/universal/mail/app/unauth/send"
,
map
);
HttpUtils
.
doPost
(
emailLogHost
,
"/api/universal/mail/app/unauth/send"
,
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
return
new
BaseResponse
(
5000
,
"Server exception: "
+
ex
.
getMessage
());
}
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"toUser"
,
"jiaoruizhen@126.com"
);
map
.
put
(
"subject"
,
"服务器异常"
);
map
.
put
(
"toUser"
,
emailLogAccount
);
map
.
put
(
"subject"
,
emailLogTitle
);
map
.
put
(
"content"
,
initCommonLogPrePart
()+
":"
+
ex
.
toString
()
+
":"
+
ex
.
getMessage
());
try
{
HttpUtils
.
doPost
(
"http://10.5.52.3:8765"
,
"/api/universal/mail/app/unauth/send"
,
map
);
HttpUtils
.
doPost
(
emailLogHost
,
"/api/universal/mail/app/unauth/send"
,
map
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
());
}
...
...
ace-common/src/main/java/com/github/wxiaoqi/security/common/handler/PlatformExceptionHandler.java
View file @
2045887c
...
...
@@ -26,6 +26,15 @@ public class PlatformExceptionHandler {
@Value
(
"${spring.application.name}"
)
private
String
applicationName
;
@Value
(
"${email.log.account}"
)
private
String
emailLogAccount
;
@Value
(
"${email.log.title}"
)
private
String
emailLogTitle
;
@Value
(
"${email.log.host}"
)
private
String
emailLogHost
;
@ExceptionHandler
(
value
=
{
BaseException
.
class
})
public
BaseResponse
baseExceptionHandler
(
Exception
e
)
{
if
(
e
instanceof
BaseException
){
...
...
@@ -45,11 +54,11 @@ public class PlatformExceptionHandler {
cause
.
printStackTrace
(
new
PrintWriter
(
stringWriter
));
log
.
error
(
cause
.
getMessage
(),
e
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"toUser"
,
"jiaoruizhen@126.com"
);
map
.
put
(
"subject"
,
"服务器异常"
);
map
.
put
(
"toUser"
,
emailLogAccount
);
map
.
put
(
"subject"
,
emailLogTitle
);
map
.
put
(
"content"
,
initCommonLogPrePart
()+
":"
+
stringWriter
.
toString
());
try
{
HttpUtils
.
doPost
(
"http://10.5.52.3:8765"
,
"/api/universal/mail/app/unauth/send"
,
map
);
HttpUtils
.
doPost
(
emailLogHost
,
"/api/universal/mail/app/unauth/send"
,
map
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
());
}
...
...
@@ -57,11 +66,11 @@ public class PlatformExceptionHandler {
}
log
.
error
(
"Server exception: "
,
e
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"toUser"
,
"jiaoruizhen@126.com"
);
map
.
put
(
"subject"
,
"服务器异常"
);
map
.
put
(
"toUser"
,
emailLogAccount
);
map
.
put
(
"subject"
,
emailLogTitle
);
map
.
put
(
"content"
,
initCommonLogPrePart
()+
":"
+
e
.
toString
()
+
":"
+
e
.
getMessage
());
try
{
HttpUtils
.
doPost
(
"http://10.5.52.3:8765"
,
"/api/universal/mail/app/unauth/send"
,
map
);
HttpUtils
.
doPost
(
emailLogHost
,
"/api/universal/mail/app/unauth/send"
,
map
);
}
catch
(
Exception
ex
)
{
log
.
error
(
ex
.
getMessage
());
}
...
...
@@ -83,7 +92,6 @@ public class PlatformExceptionHandler {
HttpServletRequest
request
=
servletRequestAttributes
.
getRequest
();
//获取request
StringBuilder
stringBuilder
=
new
StringBuilder
();
//request 获得头部
stringBuilder
.
append
(
request
.
getHeader
(
"app"
));
LocalDateTime
startTime
=
LocalDateTime
.
now
();
//开始时间
stringBuilder
.
append
(
"》》"
+
startTime
.
toString
());
stringBuilder
.
append
(
"》》"
+
request
.
getServletPath
());
...
...
@@ -91,4 +99,5 @@ public class PlatformExceptionHandler {
return
stringBuilder
.
toString
();
}
}
ace-common/src/main/java/com/github/wxiaoqi/security/common/log/XxLogInterceptor.java
View file @
2045887c
...
...
@@ -3,9 +3,7 @@ package com.github.wxiaoqi.security.common.log;
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.entity.XxLogEntity
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
lombok.extern.slf4j.Slf4j
;
import
org.aspectj.lang.ProceedingJoinPoint
;
...
...
@@ -16,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.servlet.handler.HandlerInterceptorAdapter
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -36,7 +33,7 @@ public class XxLogInterceptor{
CommonLogService
commonLogService
;
//触发条件为:com.xxfc.platform包下面所有controller
@Around
(
"within(com.xxfc.platform.*.rest..* || com.xxfc.platform.*.controller..*)"
)
@Around
(
"within(com.xxfc.platform.*.rest..* || com.xxfc.platform.*.controller..*
|| com.github.wxiaoqi.security.admin.rest..* || com.github.wxiaoqi.security.admin.rest..*
)"
)
public
Object
doAroundXxControllerLog
(
ProceedingJoinPoint
pjp
)
throws
Throwable
{
ServletRequestAttributes
servletRequestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
servletRequestAttributes
.
getRequest
();
//获取request
...
...
@@ -60,6 +57,7 @@ public class XxLogInterceptor{
try
{
//###################上面代码为方法执行前#####################
result
=
pjp
.
proceed
();
//执行方法,获取返回参数
log
.
info
(
"接口调用返回:{}"
,
xxLogEntity
.
toString
());
//###################下面代码为方法执行后#####################
if
(
result
instanceof
JSONObject
)
{
commonLogService
.
initCommonLogLastPart
(
xxLogEntity
,
((
JSONObject
)
result
).
toJSONString
());
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/AdminBootstrap.java
View file @
2045887c
...
...
@@ -23,7 +23,10 @@ import tk.mybatis.spring.annotation.MapperScan;
*/
@EnableDiscoveryClient
@EnableCircuitBreaker
@SpringBootApplication
@SpringBootApplication
(
scanBasePackages
=
{
"com.github.wxiaoqi.security.common.log"
,
"com.github.wxiaoqi.security.admin"
})
@EnableFeignClients
(
value
=
{
"com.github.wxiaoqi.security"
,
"com.xxfc.platform"
},
defaultConfiguration
=
HeaderConfig
.
class
)
@EnableScheduling
@EnableAceAuthClient
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleBookRecordMapper.xml
View file @
2045887c
...
...
@@ -534,7 +534,7 @@
and book_end_date
>
= now()
</if>
<!--增加时间限制,已审核的未出车小于当前时间的不显示, 已出车的结束时间延后两天小于当前时间的不显示-->
<if
test=
"flag == true and
status == 2
"
>
<if
test=
"flag == true and
(status == 3 or status == 5 or status == 2)
"
>
and ( (v4.id IS NOT NULL and DATE_ADD(v1.book_end_date,INTERVAL '2' DAY) >= now()) OR (v4.id IS NULL AND v1.book_end_date
>
= now()))
</if>
<if
test=
"flag == true"
>
...
...
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