Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1c058bce
authored
Dec 17, 2021
by
danmo
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
分类bug修改
1 parent
aa0949bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeExceptionController.java
linkwe-admin/src/main/resources/bootstrap.properties
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCategory.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeExceptionController.java
View file @
1c058bc
...
...
@@ -3,8 +3,13 @@ package com.linkwechat.web.controller.wecom;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.ObjectError
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
org.springframework.web.servlet.ModelAndView
;
import
java.util.List
;
/**
* @author danmo
...
...
@@ -20,6 +25,17 @@ public class WeExceptionController {
return
AjaxResult
.
error
(
ex
.
getCode
(),
ex
.
getMessage
());
}
@ExceptionHandler
({
MethodArgumentNotValidException
.
class
})
public
AjaxResult
customException
(
MethodArgumentNotValidException
e
)
{
// 获取参数校验失败信息
List
<
ObjectError
>
list
=
e
.
getBindingResult
().
getAllErrors
();
StringBuilder
errorMsg
=
new
StringBuilder
();
for
(
ObjectError
error
:
list
){
errorMsg
.
append
(
error
.
getDefaultMessage
()).
append
(
"\n"
);
}
return
AjaxResult
.
error
(
errorMsg
.
toString
());
}
@ExceptionHandler
(
Exception
.
class
)
public
AjaxResult
runtimeException
(
Exception
ex
){
log
.
error
(
"接口异常拦截 ex:{}"
,
ex
);
...
...
linkwe-admin/src/main/resources/bootstrap.properties
View file @
1c058bc
linkwechat.nacos.host
=
119.45.28.29
linkwechat.nacos.port
=
10848
linkwechat.nacos.namespace
=
627a666a-76b2-42ad-a1b0-70a12d2c73fd
linkwechat.nacos.username
=
nacos
linkwechat.nacos.password
=
jerryjin666
\ No newline at end of file
linkwechat.nacos.host
=
linkwechat.nacos.port
=
linkwechat.nacos.namespace
=
linkwechat.nacos.username
=
linkwechat.nacos.password
=
\ No newline at end of file
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCategory.java
View file @
1c058bc
...
...
@@ -12,6 +12,7 @@ import lombok.Data;
import
lombok.NoArgsConstructor
;
import
javax.validation.constraints.NotEmpty
;
import
javax.validation.constraints.NotNull
;
@Data
@TableName
(
"we_category"
)
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment