Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
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
liyang
sts网站
Commits
4d5c204b
Commit
4d5c204b
authored
Jul 06, 2023
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化代码
parent
8ee740ef
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
DateUtils.java
...ommon/src/main/java/com/ruoyi/common/utils/DateUtils.java
+1
-1
GlobalExceptionHandler.java
...ruoyi/framework/web/exception/GlobalExceptionHandler.java
+24
-0
vue.config.js
ruoyi-ui/vue.config.js
+1
-1
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtils.java
View file @
4d5c204b
...
@@ -147,7 +147,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
...
@@ -147,7 +147,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
/**
/**
* 计算时间差
* 计算时间差
*
*
* @param end
Tim
e 最后时间
* @param end
Dat
e 最后时间
* @param startTime 开始时间
* @param startTime 开始时间
* @return 时间差(天/小时/分钟)
* @return 时间差(天/小时/分钟)
*/
*/
...
...
ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java
View file @
4d5c204b
...
@@ -7,8 +7,10 @@ import org.springframework.security.access.AccessDeniedException;
...
@@ -7,8 +7,10 @@ import org.springframework.security.access.AccessDeniedException;
import
org.springframework.validation.BindException
;
import
org.springframework.validation.BindException
;
import
org.springframework.web.HttpRequestMethodNotSupportedException
;
import
org.springframework.web.HttpRequestMethodNotSupportedException
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.MissingPathVariableException
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
import
org.springframework.web.method.annotation.MethodArgumentTypeMismatchException
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.constant.HttpStatus
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.core.domain.AjaxResult
;
import
com.ruoyi.common.exception.DemoModeException
;
import
com.ruoyi.common.exception.DemoModeException
;
...
@@ -59,6 +61,28 @@ public class GlobalExceptionHandler
...
@@ -59,6 +61,28 @@ public class GlobalExceptionHandler
return
StringUtils
.
isNotNull
(
code
)
?
AjaxResult
.
error
(
code
,
e
.
getMessage
())
:
AjaxResult
.
error
(
e
.
getMessage
());
return
StringUtils
.
isNotNull
(
code
)
?
AjaxResult
.
error
(
code
,
e
.
getMessage
())
:
AjaxResult
.
error
(
e
.
getMessage
());
}
}
/**
* 请求路径中缺少必需的路径变量
*/
@ExceptionHandler
(
MissingPathVariableException
.
class
)
public
AjaxResult
handleMissingPathVariableException
(
MissingPathVariableException
e
,
HttpServletRequest
request
)
{
String
requestURI
=
request
.
getRequestURI
();
log
.
error
(
"请求路径中缺少必需的路径变量'{}',发生系统异常."
,
requestURI
,
e
);
return
AjaxResult
.
error
(
String
.
format
(
"请求路径中缺少必需的路径变量[%s]"
,
e
.
getVariableName
()));
}
/**
* 请求参数类型不匹配
*/
@ExceptionHandler
(
MethodArgumentTypeMismatchException
.
class
)
public
AjaxResult
handleMethodArgumentTypeMismatchException
(
MethodArgumentTypeMismatchException
e
,
HttpServletRequest
request
)
{
String
requestURI
=
request
.
getRequestURI
();
log
.
error
(
"请求参数类型不匹配'{}',发生系统异常."
,
requestURI
,
e
);
return
AjaxResult
.
error
(
String
.
format
(
"请求参数类型不匹配,参数[%s]要求类型为:'%s',但输入值为:'%s'"
,
e
.
getName
(),
e
.
getRequiredType
().
getName
(),
e
.
getValue
()));
}
/**
/**
* 拦截未知的运行时异常
* 拦截未知的运行时异常
*/
*/
...
...
ruoyi-ui/vue.config.js
View file @
4d5c204b
...
@@ -112,7 +112,7 @@ module.exports = {
...
@@ -112,7 +112,7 @@ module.exports = {
elementUI
:
{
elementUI
:
{
name
:
'chunk-elementUI'
,
// split elementUI into a single package
name
:
'chunk-elementUI'
,
// split elementUI into a single package
test
:
/
[\\/]
node_modules
[\\/]
_
?
element-ui
(
.*
)
/
,
// in order to adapt to cnpm
test
:
/
[\\/]
node_modules
[\\/]
_
?
element-ui
(
.*
)
/
,
// in order to adapt to cnpm
priority
:
20
,
// the weight needs to be larger than libs and app or it will be packaged into libs or app
priority
:
20
// the weight needs to be larger than libs and app or it will be packaged into libs or app
},
},
commons
:
{
commons
:
{
name
:
'chunk-commons'
,
name
:
'chunk-commons'
,
...
...
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