Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vehicle-quality-review
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
王飞
vehicle-quality-review
Commits
917f40a7
Commit
917f40a7
authored
Jan 08, 2024
by
王飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feat
1、业务异常增加返回值。 Reference N/A
parent
4053f6be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
2 deletions
+37
-2
ReviewStandardTest.java
ruoyi-admin/src/test/java/com/ruoyi/ReviewStandardTest.java
+13
-1
ServiceException.java
...ain/java/com/ruoyi/common/exception/ServiceException.java
+21
-0
GlobalExceptionHandler.java
...ruoyi/framework/web/exception/GlobalExceptionHandler.java
+3
-1
No files found.
ruoyi-admin/src/test/java/com/ruoyi/ReviewStandardTest.java
View file @
917f40a7
package
com
.
ruoyi
;
import
cn.hutool.json.JSONUtil
;
import
com.ruoyi.common.utils.SnowflakeUtil
;
import
com.ruoyi.domain.ReviewStandard
;
import
com.ruoyi.service.ReviewStandardService
;
import
org.junit.jupiter.api.Test
;
...
...
@@ -26,10 +27,21 @@ public class ReviewStandardTest {
}
@Test
public
void
findTreeTest
()
{
public
void
findTreeTest
System
()
{
List
<
ReviewStandard
>
tree
=
reviewStandardService
.
findTree
(
1L
,
ReviewStandard
.
TYPE_SYSTEM
);
System
.
out
.
println
(
JSONUtil
.
toJsonPrettyStr
(
tree
));
}
@Test
public
void
findTreeTestCar
()
{
List
<
ReviewStandard
>
tree
=
reviewStandardService
.
findTree
(
1L
,
ReviewStandard
.
TYPE_CAR
);
System
.
out
.
println
(
JSONUtil
.
toJsonPrettyStr
(
tree
));
}
@Test
public
void
generateId
()
{
for
(
int
i
=
0
;
i
<
38
;
i
++)
System
.
out
.
println
(
SnowflakeUtil
.
generate
());
}
}
ruoyi-common/src/main/java/com/ruoyi/common/exception/ServiceException.java
View file @
917f40a7
...
...
@@ -26,6 +26,8 @@ public final class ServiceException extends RuntimeException
*/
private
String
detailMessage
;
private
Object
data
;
/**
* 空构造方法,避免反序列化问题
*/
...
...
@@ -44,6 +46,13 @@ public final class ServiceException extends RuntimeException
this
.
code
=
code
;
}
public
ServiceException
(
String
message
,
Integer
code
,
Object
data
)
{
this
.
message
=
message
;
this
.
code
=
code
;
this
.
data
=
data
;
}
public
String
getDetailMessage
()
{
return
detailMessage
;
...
...
@@ -71,4 +80,16 @@ public final class ServiceException extends RuntimeException
this
.
detailMessage
=
detailMessage
;
return
this
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
Object
getData
()
{
return
data
;
}
public
void
setData
(
Object
data
)
{
this
.
data
=
data
;
}
}
\ No newline at end of file
ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
View file @
917f40a7
...
...
@@ -58,7 +58,9 @@ public class GlobalExceptionHandler
{
log
.
error
(
e
.
getMessage
(),
e
);
Integer
code
=
e
.
getCode
();
return
StringUtils
.
isNotNull
(
code
)
?
AjaxResult
.
error
(
code
,
e
.
getMessage
())
:
AjaxResult
.
error
(
e
.
getMessage
());
Object
data
=
e
.
getData
();
return
StringUtils
.
isNotNull
(
code
)
?
AjaxResult
.
error
(
code
,
e
.
getMessage
())
:
AjaxResult
.
error
(
e
.
getMessage
(),
data
==
null
?
null
:
data
);
}
/**
...
...
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