Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
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
项目统一框架
amos-boot-biz
Commits
f1b442dc
Commit
f1b442dc
authored
May 07, 2024
by
刘林
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(JG):气瓶导入功能开发,重新GlobalExceptionHandler
parent
5869c5e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
2 deletions
+40
-2
GlobalExceptionHandler.java
...g/api/common/exception/handle/GlobalExceptionHandler.java
+37
-0
AmosJGApplication.java
...biz/src/main/java/com/yeejoin/amos/AmosJGApplication.java
+3
-2
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/common/exception/handle/GlobalExceptionHandler.java
0 → 100644
View file @
f1b442dc
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
common
.
exception
.
handle
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.servlet.http.HttpServletRequest
;
@RestControllerAdvice
public
class
GlobalExceptionHandler
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
GlobalExceptionHandler
.
class
);
public
GlobalExceptionHandler
()
{
log
.
info
(
"GlobalExceptionHandler initialized."
);
}
@ExceptionHandler
(
Exception
.
class
)
public
ResponseModel
<
Object
>
handleException
(
Exception
exception
,
HttpServletRequest
request
)
{
log
.
error
(
"Exception occurred:"
,
exception
);
ResponseModel
<
Object
>
response
=
new
ResponseModel
<>();
response
.
setStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
.
value
());
response
.
setDevMessage
(
"FAILED"
);
response
.
setMessage
(
exception
.
getMessage
());
response
.
setTraceId
(
RequestContext
.
getTraceId
());
response
.
setPath
(
request
!=
null
?
request
.
getServletPath
()
:
null
);
if
(
exception
.
getMessage
()
!=
null
&&
(
exception
.
getMessage
().
contains
(
"账号已经在其他设备登录"
)
||
exception
.
getMessage
().
contains
(
"请重新登录"
)))
{
response
.
setStatus
(
HttpStatus
.
FORBIDDEN
.
value
());
}
return
response
;
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/AmosJGApplication.java
View file @
f1b442dc
...
...
@@ -14,11 +14,11 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.context.ConfigurableApplicationContext
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.context.annotation.FilterType
;
import
org.springframework.core.env.Environment
;
import
org.springframework.scheduling.annotation.EnableAsync
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc
;
import
java.net.InetAddress
;
import
java.net.UnknownHostException
;
...
...
@@ -42,7 +42,8 @@ import java.net.UnknownHostException;
@MapperScan
({
"org.typroject.tyboot.demo.face.orm.dao*"
,
"org.typroject.tyboot.face.*.orm.dao*"
,
"org.typroject.tyboot.core.auth.face.orm.dao*"
,
"org.typroject.tyboot.component.*.face.orm.dao*"
,
"com.yeejoin.amos.boot.module.**.api.mapper"
,
"com.yeejoin.amos.boot.biz.common.dao.mapper"
})
@ComponentScan
(
basePackages
=
{
"org.typroject"
,
"com.yeejoin.amos"
})
@ComponentScan
(
basePackages
=
{
"org.typroject"
,
"com.yeejoin.amos"
},
excludeFilters
=
{
@ComponentScan
.
Filter
(
type
=
FilterType
.
ASSIGNABLE_TYPE
,
classes
=
{
org
.
typroject
.
tyboot
.
core
.
restful
.
exception
.
GlobalExceptionHandler
.
class
})})
public
class
AmosJGApplication
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AmosJGApplication
.
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