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
1e722089
Commit
1e722089
authored
Jan 08, 2024
by
王飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'wangfei' into 'dev'
Feat See merge request
!27
parents
f317893c
917f40a7
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 @
1e722089
package
com
.
ruoyi
;
package
com
.
ruoyi
;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.ruoyi.common.utils.SnowflakeUtil
;
import
com.ruoyi.domain.ReviewStandard
;
import
com.ruoyi.domain.ReviewStandard
;
import
com.ruoyi.service.ReviewStandardService
;
import
com.ruoyi.service.ReviewStandardService
;
import
org.junit.jupiter.api.Test
;
import
org.junit.jupiter.api.Test
;
...
@@ -26,10 +27,21 @@ public class ReviewStandardTest {
...
@@ -26,10 +27,21 @@ public class ReviewStandardTest {
}
}
@Test
@Test
public
void
findTreeTest
()
{
public
void
findTreeTest
System
()
{
List
<
ReviewStandard
>
tree
=
reviewStandardService
.
findTree
(
1L
,
ReviewStandard
.
TYPE_SYSTEM
);
List
<
ReviewStandard
>
tree
=
reviewStandardService
.
findTree
(
1L
,
ReviewStandard
.
TYPE_SYSTEM
);
System
.
out
.
println
(
JSONUtil
.
toJsonPrettyStr
(
tree
));
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 @
1e722089
...
@@ -26,6 +26,8 @@ public final class ServiceException extends RuntimeException
...
@@ -26,6 +26,8 @@ public final class ServiceException extends RuntimeException
*/
*/
private
String
detailMessage
;
private
String
detailMessage
;
private
Object
data
;
/**
/**
* 空构造方法,避免反序列化问题
* 空构造方法,避免反序列化问题
*/
*/
...
@@ -44,6 +46,13 @@ public final class ServiceException extends RuntimeException
...
@@ -44,6 +46,13 @@ public final class ServiceException extends RuntimeException
this
.
code
=
code
;
this
.
code
=
code
;
}
}
public
ServiceException
(
String
message
,
Integer
code
,
Object
data
)
{
this
.
message
=
message
;
this
.
code
=
code
;
this
.
data
=
data
;
}
public
String
getDetailMessage
()
public
String
getDetailMessage
()
{
{
return
detailMessage
;
return
detailMessage
;
...
@@ -71,4 +80,16 @@ public final class ServiceException extends RuntimeException
...
@@ -71,4 +80,16 @@ public final class ServiceException extends RuntimeException
this
.
detailMessage
=
detailMessage
;
this
.
detailMessage
=
detailMessage
;
return
this
;
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 @
1e722089
...
@@ -58,7 +58,9 @@ public class GlobalExceptionHandler
...
@@ -58,7 +58,9 @@ public class GlobalExceptionHandler
{
{
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
Integer
code
=
e
.
getCode
();
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