diff --git a/bin/clean.bat b/bin/clean.bat index e1440259..af841d8e 100644 --- a/bin/clean.bat +++ b/bin/clean.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 清理生成路径。 +echo [信息] 清理工程target生成路径。 echo. %~d0 diff --git a/bin/run-auth.bat b/bin/run-auth.bat index 6f2f9763..84de0ed6 100644 --- a/bin/run-auth.bat +++ b/bin/run-auth.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 运行auth工程。 +echo [信息] 使用Jar命令运行Auth工程。 echo. cd %~dp0 diff --git a/bin/run-gateway.bat b/bin/run-gateway.bat index 0a9d776a..21bfa24b 100644 --- a/bin/run-gateway.bat +++ b/bin/run-gateway.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 运行gateway工程。 +echo [信息] 使用Jar命令运行Gateway工程。 echo. cd %~dp0 diff --git a/bin/run-modules-file.bat b/bin/run-modules-file.bat index 8ff427ad..e160cdb2 100644 --- a/bin/run-modules-file.bat +++ b/bin/run-modules-file.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 运行modules-file工程。 +echo [信息] 使用Jar命令运行Modules-File工程。 echo. cd %~dp0 diff --git a/bin/run-modules-gen.bat b/bin/run-modules-gen.bat index 7f8e95a2..9a077bd4 100644 --- a/bin/run-modules-gen.bat +++ b/bin/run-modules-gen.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 运行modules-gen工程。 +echo [信息] 使用Jar命令运行Modules-Gen工程。 echo. cd %~dp0 diff --git a/bin/run-modules-job.bat b/bin/run-modules-job.bat index 1f6f7e7f..3a2e333b 100644 --- a/bin/run-modules-job.bat +++ b/bin/run-modules-job.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 运行modules-job工程。 +echo [信息] 使用Jar命令运行Modules-Job工程。 echo. cd %~dp0 diff --git a/bin/run-modules-system.bat b/bin/run-modules-system.bat index d43e08cb..78f8b59e 100644 --- a/bin/run-modules-system.bat +++ b/bin/run-modules-system.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 运行modules-system工程。 +echo [信息] 使用Jar命令运行Modules-System工程。 echo. cd %~dp0 diff --git a/bin/run-monitor.bat b/bin/run-monitor.bat index d90a0c7a..9ee7b99b 100644 --- a/bin/run-monitor.bat +++ b/bin/run-monitor.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 运行monitor工程。 +echo [信息] 使用Jar命令运行Monitor工程。 echo. cd %~dp0 diff --git a/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java b/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java index a57f4a9d..29c79cec 100644 --- a/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java +++ b/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java @@ -7,7 +7,7 @@ import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.constant.UserConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.enums.UserStatus; -import com.ruoyi.common.core.exception.BaseException; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.SecurityUtils; import com.ruoyi.common.core.utils.ServletUtils; import com.ruoyi.common.core.utils.StringUtils; @@ -41,51 +41,51 @@ public class SysLoginService if (StringUtils.isAnyBlank(username, password)) { recordLogininfor(username, Constants.LOGIN_FAIL, "鐢ㄦ埛/瀵嗙爜蹇呴』濉啓"); - throw new BaseException("鐢ㄦ埛/瀵嗙爜蹇呴』濉啓"); + throw new ServiceException("鐢ㄦ埛/瀵嗙爜蹇呴』濉啓"); } // 瀵嗙爜濡傛灉涓嶅湪鎸囧畾鑼冨洿鍐 閿欒 if (password.length() < UserConstants.PASSWORD_MIN_LENGTH || password.length() > UserConstants.PASSWORD_MAX_LENGTH) { recordLogininfor(username, Constants.LOGIN_FAIL, "鐢ㄦ埛瀵嗙爜涓嶅湪鎸囧畾鑼冨洿"); - throw new BaseException("鐢ㄦ埛瀵嗙爜涓嶅湪鎸囧畾鑼冨洿"); + throw new ServiceException("鐢ㄦ埛瀵嗙爜涓嶅湪鎸囧畾鑼冨洿"); } // 鐢ㄦ埛鍚嶄笉鍦ㄦ寚瀹氳寖鍥村唴 閿欒 if (username.length() < UserConstants.USERNAME_MIN_LENGTH || username.length() > UserConstants.USERNAME_MAX_LENGTH) { recordLogininfor(username, Constants.LOGIN_FAIL, "鐢ㄦ埛鍚嶄笉鍦ㄦ寚瀹氳寖鍥"); - throw new BaseException("鐢ㄦ埛鍚嶄笉鍦ㄦ寚瀹氳寖鍥"); + throw new ServiceException("鐢ㄦ埛鍚嶄笉鍦ㄦ寚瀹氳寖鍥"); } // 鏌ヨ鐢ㄦ埛淇℃伅 R userResult = remoteUserService.getUserInfo(username, SecurityConstants.INNER); if (R.FAIL == userResult.getCode()) { - throw new BaseException(userResult.getMsg()); + throw new ServiceException(userResult.getMsg()); } if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) { recordLogininfor(username, Constants.LOGIN_FAIL, "鐧诲綍鐢ㄦ埛涓嶅瓨鍦"); - throw new BaseException("鐧诲綍鐢ㄦ埛锛" + username + " 涓嶅瓨鍦"); + throw new ServiceException("鐧诲綍鐢ㄦ埛锛" + username + " 涓嶅瓨鍦"); } LoginUser userInfo = userResult.getData(); SysUser user = userResult.getData().getSysUser(); if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) { recordLogininfor(username, Constants.LOGIN_FAIL, "瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿宸茶鍒犻櫎"); - throw new BaseException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛" + username + " 宸茶鍒犻櫎"); + throw new ServiceException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛" + username + " 宸茶鍒犻櫎"); } if (UserStatus.DISABLE.getCode().equals(user.getStatus())) { recordLogininfor(username, Constants.LOGIN_FAIL, "鐢ㄦ埛宸插仠鐢紝璇疯仈绯荤鐞嗗憳"); - throw new BaseException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛" + username + " 宸插仠鐢"); + throw new ServiceException("瀵逛笉璧凤紝鎮ㄧ殑璐﹀彿锛" + username + " 宸插仠鐢"); } if (!SecurityUtils.matchesPassword(password, user.getPassword())) { recordLogininfor(username, Constants.LOGIN_FAIL, "鐢ㄦ埛瀵嗙爜閿欒"); - throw new BaseException("鐢ㄦ埛涓嶅瓨鍦/瀵嗙爜閿欒"); + throw new ServiceException("鐢ㄦ埛涓嶅瓨鍦/瀵嗙爜閿欒"); } recordLogininfor(username, Constants.LOGIN_SUCCESS, "鐧诲綍鎴愬姛"); return userInfo; @@ -104,17 +104,17 @@ public class SysLoginService // 鐢ㄦ埛鍚嶆垨瀵嗙爜涓虹┖ 閿欒 if (StringUtils.isAnyBlank(username, password)) { - throw new BaseException("鐢ㄦ埛/瀵嗙爜蹇呴』濉啓"); + throw new ServiceException("鐢ㄦ埛/瀵嗙爜蹇呴』濉啓"); } if (username.length() < UserConstants.USERNAME_MIN_LENGTH || username.length() > UserConstants.USERNAME_MAX_LENGTH) { - throw new BaseException("璐︽埛闀垮害蹇呴』鍦2鍒20涓瓧绗︿箣闂"); + throw new ServiceException("璐︽埛闀垮害蹇呴』鍦2鍒20涓瓧绗︿箣闂"); } if (password.length() < UserConstants.PASSWORD_MIN_LENGTH || password.length() > UserConstants.PASSWORD_MAX_LENGTH) { - throw new BaseException("瀵嗙爜闀垮害蹇呴』鍦5鍒20涓瓧绗︿箣闂"); + throw new ServiceException("瀵嗙爜闀垮害蹇呴』鍦5鍒20涓瓧绗︿箣闂"); } // 娉ㄥ唽鐢ㄦ埛淇℃伅 @@ -126,7 +126,7 @@ public class SysLoginService if (R.FAIL == registerResult.getCode()) { - throw new BaseException(registerResult.getMsg()); + throw new ServiceException(registerResult.getMsg()); } recordLogininfor(username, Constants.REGISTER, "娉ㄥ唽鎴愬姛"); } diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/Constants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/Constants.java index 4a07f404..e33a26a9 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/Constants.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/Constants.java @@ -22,6 +22,11 @@ public class Constants */ public static final String LOOKUP_RMI = "rmi://"; + /** + * LDAP 杩滅▼鏂规硶璋冪敤 + */ + public static final String LOOKUP_LDAP = "ldap://"; + /** * http璇锋眰 */ diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/CustomException.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/CustomException.java deleted file mode 100644 index 38b727be..00000000 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/CustomException.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.ruoyi.common.core.exception; - -/** - * 鑷畾涔夊紓甯 - * - * @author ruoyi - */ -public class CustomException extends RuntimeException -{ - private static final long serialVersionUID = 1L; - - private Integer code; - - private String message; - - public CustomException(String message) - { - this.message = message; - } - - public CustomException(String message, Integer code) - { - this.message = message; - this.code = code; - } - - public CustomException(String message, Throwable e) - { - super(message, e); - this.message = message; - } - - @Override - public String getMessage() - { - return message; - } - - public Integer getCode() - { - return code; - } -} diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/GlobalException.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/GlobalException.java new file mode 100644 index 00000000..9beb54bd --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/GlobalException.java @@ -0,0 +1,58 @@ +package com.ruoyi.common.core.exception; + +/** + * 鍏ㄥ眬寮傚父 + * + * @author ruoyi + */ +public class GlobalException extends RuntimeException +{ + + private static final long serialVersionUID = 1L; + + /** + * 閿欒鎻愮ず + */ + private String message; + + /** + * 閿欒鏄庣粏锛屽唴閮ㄨ皟璇曢敊璇 + * + * 鍜 {@link CommonResult#getDetailMessage()} 涓鑷寸殑璁捐 + */ + private String detailMessage; + + /** + * 绌烘瀯閫犳柟娉曪紝閬垮厤鍙嶅簭鍒楀寲闂 + */ + public GlobalException() + { + } + + public GlobalException(String message) + { + this.message = message; + } + + public String getDetailMessage() + { + return detailMessage; + } + + public GlobalException setDetailMessage(String detailMessage) + { + this.detailMessage = detailMessage; + return this; + } + + public String getMessage() + { + return message; + } + + public GlobalException setMessage(String message) + { + this.message = message; + return this; + } +} \ No newline at end of file diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/ServiceException.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/ServiceException.java new file mode 100644 index 00000000..d2b7763b --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/ServiceException.java @@ -0,0 +1,73 @@ +package com.ruoyi.common.core.exception; + +/** + * 涓氬姟寮傚父 + * + * @author ruoyi + */ +public final class ServiceException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + /** + * 閿欒鐮 + */ + private Integer code; + + /** + * 閿欒鎻愮ず + */ + private String message; + + /** + * 閿欒鏄庣粏锛屽唴閮ㄨ皟璇曢敊璇 + * + * 鍜 {@link CommonResult#getDetailMessage()} 涓鑷寸殑璁捐 + */ + private String detailMessage; + + /** + * 绌烘瀯閫犳柟娉曪紝閬垮厤鍙嶅簭鍒楀寲闂 + */ + public ServiceException() + { + } + + public ServiceException(String message) + { + this.message = message; + } + + public ServiceException(String message, Integer code) + { + this.message = message; + this.code = code; + } + + public String getDetailMessage() + { + return detailMessage; + } + + public String getMessage() + { + return message; + } + + public Integer getCode() + { + return code; + } + + public ServiceException setMessage(String message) + { + this.message = message; + return this; + } + + public ServiceException setDetailMessage(String detailMessage) + { + this.detailMessage = detailMessage; + return this; + } +} \ No newline at end of file diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/BaseException.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/base/BaseException.java similarity index 92% rename from ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/BaseException.java rename to ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/base/BaseException.java index 51145217..3d2fa105 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/BaseException.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/base/BaseException.java @@ -1,79 +1,79 @@ -package com.ruoyi.common.core.exception; - -/** - * 鍩虹寮傚父 - * - * @author ruoyi - */ -public class BaseException extends RuntimeException -{ - private static final long serialVersionUID = 1L; - - /** - * 鎵灞炴ā鍧 - */ - private String module; - - /** - * 閿欒鐮 - */ - private String code; - - /** - * 閿欒鐮佸搴旂殑鍙傛暟 - */ - private Object[] args; - - /** - * 閿欒娑堟伅 - */ - private String defaultMessage; - - public BaseException(String module, String code, Object[] args, String defaultMessage) - { - this.module = module; - this.code = code; - this.args = args; - this.defaultMessage = defaultMessage; - } - - public BaseException(String module, String code, Object[] args) - { - this(module, code, args, null); - } - - public BaseException(String module, String defaultMessage) - { - this(module, null, null, defaultMessage); - } - - public BaseException(String code, Object[] args) - { - this(null, code, args, null); - } - - public BaseException(String defaultMessage) - { - this(null, null, null, defaultMessage); - } - - public String getModule() - { - return module; - } - - public String getCode() - { - return code; - } - - public Object[] getArgs() - { - return args; - } - - public String getDefaultMessage() - { - return defaultMessage; - } -} +package com.ruoyi.common.core.exception.base; + +/** + * 鍩虹寮傚父 + * + * @author ruoyi + */ +public class BaseException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + /** + * 鎵灞炴ā鍧 + */ + private String module; + + /** + * 閿欒鐮 + */ + private String code; + + /** + * 閿欒鐮佸搴旂殑鍙傛暟 + */ + private Object[] args; + + /** + * 閿欒娑堟伅 + */ + private String defaultMessage; + + public BaseException(String module, String code, Object[] args, String defaultMessage) + { + this.module = module; + this.code = code; + this.args = args; + this.defaultMessage = defaultMessage; + } + + public BaseException(String module, String code, Object[] args) + { + this(module, code, args, null); + } + + public BaseException(String module, String defaultMessage) + { + this(module, null, null, defaultMessage); + } + + public BaseException(String code, Object[] args) + { + this(null, code, args, null); + } + + public BaseException(String defaultMessage) + { + this(null, null, null, defaultMessage); + } + + public String getModule() + { + return module; + } + + public String getCode() + { + return code; + } + + public Object[] getArgs() + { + return args; + } + + public String getDefaultMessage() + { + return defaultMessage; + } +} diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/FileException.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/FileException.java index 3ced31db..ae615432 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/FileException.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/file/FileException.java @@ -1,6 +1,6 @@ package com.ruoyi.common.core.exception.file; -import com.ruoyi.common.core.exception.BaseException; +import com.ruoyi.common.core.exception.base.BaseException; /** * 鏂囦欢淇℃伅寮傚父绫 diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/user/UserException.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/user/UserException.java index cf51f490..5493804c 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/user/UserException.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/exception/user/UserException.java @@ -1,6 +1,6 @@ package com.ruoyi.common.core.exception.user; -import com.ruoyi.common.core.exception.BaseException; +import com.ruoyi.common.core.exception.base.BaseException; /** * 鐢ㄦ埛淇℃伅寮傚父绫 diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sql/SqlUtil.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sql/SqlUtil.java index b84f4e76..00a18efe 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sql/SqlUtil.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/sql/SqlUtil.java @@ -1,6 +1,6 @@ package com.ruoyi.common.core.utils.sql; -import com.ruoyi.common.core.exception.BaseException; +import com.ruoyi.common.core.exception.UtilException; import com.ruoyi.common.core.utils.StringUtils; /** @@ -22,7 +22,7 @@ public class SqlUtil { if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) { - throw new BaseException("鍙傛暟涓嶇鍚堣鑼冿紝涓嶈兘杩涜鏌ヨ"); + throw new UtilException("鍙傛暟涓嶇鍚堣鑼冿紝涓嶈兘杩涜鏌ヨ"); } return value; } diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/handler/GlobalExceptionHandler.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/handler/GlobalExceptionHandler.java index 67f6b6fe..3769dbb9 100644 --- a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/handler/GlobalExceptionHandler.java +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/handler/GlobalExceptionHandler.java @@ -1,17 +1,17 @@ package com.ruoyi.common.security.handler; import lombok.extern.slf4j.Slf4j; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import javax.servlet.http.HttpServletRequest; import org.springframework.validation.BindException; +import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; -import com.ruoyi.common.core.exception.BaseException; -import com.ruoyi.common.core.exception.CustomException; +import com.ruoyi.common.core.constant.HttpStatus; import com.ruoyi.common.core.exception.DemoModeException; import com.ruoyi.common.core.exception.InnerAuthException; import com.ruoyi.common.core.exception.PreAuthorizeException; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.web.domain.AjaxResult; @@ -22,30 +22,62 @@ import com.ruoyi.common.core.web.domain.AjaxResult; */ @Slf4j @RestControllerAdvice -public class GlobalExceptionHandler { +public class GlobalExceptionHandler +{ /** - * 鍩虹寮傚父 + * 鏉冮檺寮傚父 */ - @ExceptionHandler(BaseException.class) - public AjaxResult baseException(BaseException e) { - return AjaxResult.error(e.getDefaultMessage()); + @ExceptionHandler(PreAuthorizeException.class) + public AjaxResult handlePreAuthorizeException(PreAuthorizeException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("璇锋眰鍦板潃'{}',鏉冮檺鏍¢獙澶辫触'{}'", requestURI, e.getMessage()); + return AjaxResult.error(HttpStatus.FORBIDDEN, "娌℃湁鏉冮檺锛岃鑱旂郴绠$悊鍛樻巿鏉"); + } + + /** + * 璇锋眰鏂瑰紡涓嶆敮鎸 + */ + @ExceptionHandler(HttpRequestMethodNotSupportedException.class) + public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e, + HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("璇锋眰鍦板潃'{}',涓嶆敮鎸'{}'璇锋眰", requestURI, e.getMethod()); + return AjaxResult.error(e.getMessage()); } /** * 涓氬姟寮傚父 */ - @ExceptionHandler(CustomException.class) - public AjaxResult businessException(CustomException e) { - if (StringUtils.isNull(e.getCode())) { - return AjaxResult.error(e.getMessage()); - } - return AjaxResult.error(e.getCode(), e.getMessage()); + @ExceptionHandler(ServiceException.class) + public AjaxResult handleServiceException(ServiceException e, HttpServletRequest request) + { + log.error(e.getMessage(), e); + Integer code = e.getCode(); + return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage()); + } + + /** + * 鎷︽埅鏈煡鐨勮繍琛屾椂寮傚父 + */ + @ExceptionHandler(RuntimeException.class) + public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("璇锋眰鍦板潃'{}',鍙戠敓鏈煡寮傚父.", requestURI, e); + return AjaxResult.error(e.getMessage()); } + /** + * 绯荤粺寮傚父 + */ @ExceptionHandler(Exception.class) - public AjaxResult handleException(Exception e) { - log.error(e.getMessage(), e); + public AjaxResult handleException(Exception e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("璇锋眰鍦板潃'{}',鍙戠敓绯荤粺寮傚父.", requestURI, e); return AjaxResult.error(e.getMessage()); } @@ -53,7 +85,8 @@ public class GlobalExceptionHandler { * 鑷畾涔夐獙璇佸紓甯 */ @ExceptionHandler(BindException.class) - public AjaxResult validatedBindException(BindException e) { + public AjaxResult handleBindException(BindException e) + { log.error(e.getMessage(), e); String message = e.getAllErrors().get(0).getDefaultMessage(); return AjaxResult.error(message); @@ -63,25 +96,18 @@ public class GlobalExceptionHandler { * 鑷畾涔夐獙璇佸紓甯 */ @ExceptionHandler(MethodArgumentNotValidException.class) - public Object validExceptionHandler(MethodArgumentNotValidException e) { + public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e) + { log.error(e.getMessage(), e); String message = e.getBindingResult().getFieldError().getDefaultMessage(); return AjaxResult.error(message); } - /** - * 鏉冮檺寮傚父 - */ - @ExceptionHandler(PreAuthorizeException.class) - public AjaxResult preAuthorizeException(PreAuthorizeException e) { - return AjaxResult.error("娌℃湁鏉冮檺锛岃鑱旂郴绠$悊鍛樻巿鏉"); - } - /** * 鍐呴儴璁よ瘉寮傚父 */ @ExceptionHandler(InnerAuthException.class) - public AjaxResult InnerAuthException(InnerAuthException e) + public AjaxResult handleInnerAuthException(InnerAuthException e) { return AjaxResult.error(e.getMessage()); } @@ -90,7 +116,8 @@ public class GlobalExceptionHandler { * 婕旂ず妯″紡寮傚父 */ @ExceptionHandler(DemoModeException.class) - public AjaxResult demoModeException(DemoModeException e) { + public AjaxResult handleDemoModeException(DemoModeException e) + { return AjaxResult.error("婕旂ず妯″紡锛屼笉鍏佽鎿嶄綔"); } } diff --git a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java index 041a5a8d..68883bfd 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java +++ b/ruoyi-modules/ruoyi-gen/src/main/java/com/ruoyi/gen/service/GenTableServiceImpl.java @@ -24,7 +24,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.GenConstants; -import com.ruoyi.common.core.exception.CustomException; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.text.CharsetKit; import com.ruoyi.common.core.utils.SecurityUtils; import com.ruoyi.common.core.utils.StringUtils; @@ -180,7 +180,7 @@ public class GenTableServiceImpl implements IGenTableService } catch (Exception e) { - throw new CustomException("瀵煎叆澶辫触锛" + e.getMessage()); + throw new ServiceException("瀵煎叆澶辫触锛" + e.getMessage()); } } @@ -269,7 +269,7 @@ public class GenTableServiceImpl implements IGenTableService } catch (IOException e) { - throw new CustomException("娓叉煋妯℃澘澶辫触锛岃〃鍚嶏細" + table.getTableName()); + throw new ServiceException("娓叉煋妯℃澘澶辫触锛岃〃鍚嶏細" + table.getTableName()); } } } @@ -291,7 +291,7 @@ public class GenTableServiceImpl implements IGenTableService List dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(tableName); if (StringUtils.isEmpty(dbTableColumns)) { - throw new CustomException("鍚屾鏁版嵁澶辫触锛屽師琛ㄧ粨鏋勪笉瀛樺湪"); + throw new ServiceException("鍚屾鏁版嵁澶辫触锛屽師琛ㄧ粨鏋勪笉瀛樺湪"); } List dbTableColumnNames = dbTableColumns.stream().map(GenTableColumn::getColumnName).collect(Collectors.toList()); @@ -383,25 +383,25 @@ public class GenTableServiceImpl implements IGenTableService JSONObject paramsObj = JSONObject.parseObject(options); if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) { - throw new CustomException("鏍戠紪鐮佸瓧娈典笉鑳戒负绌"); + throw new ServiceException("鏍戠紪鐮佸瓧娈典笉鑳戒负绌"); } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) { - throw new CustomException("鏍戠埗缂栫爜瀛楁涓嶈兘涓虹┖"); + throw new ServiceException("鏍戠埗缂栫爜瀛楁涓嶈兘涓虹┖"); } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) { - throw new CustomException("鏍戝悕绉板瓧娈典笉鑳戒负绌"); + throw new ServiceException("鏍戝悕绉板瓧娈典笉鑳戒负绌"); } else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) { if (StringUtils.isEmpty(genTable.getSubTableName())) { - throw new CustomException("鍏宠仈瀛愯〃鐨勮〃鍚嶄笉鑳戒负绌"); + throw new ServiceException("鍏宠仈瀛愯〃鐨勮〃鍚嶄笉鑳戒负绌"); } else if (StringUtils.isEmpty(genTable.getSubTableFkName())) { - throw new CustomException("瀛愯〃鍏宠仈鐨勫閿悕涓嶈兘涓虹┖"); + throw new ServiceException("瀛愯〃鍏宠仈鐨勫閿悕涓嶈兘涓虹┖"); } } } diff --git a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm index 1e35e567..3bf618a1 100644 --- a/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-modules/ruoyi-gen/src/main/resources/vm/vue/index.vue.vm @@ -570,19 +570,18 @@ export default { /** ${subTable.functionName}鍒犻櫎鎸夐挳鎿嶄綔 */ handleDelete${subClassName}() { if (this.checked${subClassName}.length == 0) { - this.$alert("璇峰厛閫夋嫨瑕佸垹闄ょ殑${subTable.functionName}鏁版嵁", "鎻愮ず", { confirmButtonText: "纭畾", }); + this.msgError("璇峰厛閫夋嫨瑕佸垹闄ょ殑${subTable.functionName}鏁版嵁"); } else { - this.${subclassName}List.splice(this.checked${subClassName}[0].index - 1, 1); + const ${subclassName}List = this.${subclassName}List; + const checked${subClassName} = this.checked${subClassName}; + this.${subclassName}List = ${subclassName}List.filter(function(item) { + return checked${subClassName}.indexOf(item.index) == -1 + }); } }, - /** 鍗曢夋閫変腑鏁版嵁 */ + /** 澶嶉夋閫変腑鏁版嵁 */ handle${subClassName}SelectionChange(selection) { - if (selection.length > 1) { - this.$refs.${subclassName}.clearSelection(); - this.$refs.${subclassName}.toggleRowSelection(selection.pop()); - } else { - this.checked${subClassName} = selection; - } + this.checked${subClassName} = selection.map(item => item.index) }, #end /** 瀵煎嚭鎸夐挳鎿嶄綔 */ diff --git a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/controller/SysJobController.java b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/controller/SysJobController.java index 9ce00671..c4d40eb9 100644 --- a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/controller/SysJobController.java +++ b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/controller/SysJobController.java @@ -91,6 +91,10 @@ public class SysJobController extends BaseController { return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁'rmi://'璋冪敤"); } + else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_LDAP)) + { + return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁'ldap://'璋冪敤"); + } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) { return error("鏂板浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁'http(s)//'璋冪敤"); @@ -115,6 +119,10 @@ public class SysJobController extends BaseController { return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁'rmi://'璋冪敤"); } + else if (StringUtils.containsIgnoreCase(job.getInvokeTarget(), Constants.LOOKUP_LDAP)) + { + return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁'ldap://'璋冪敤"); + } else if (StringUtils.containsAnyIgnoreCase(job.getInvokeTarget(), new String[] { Constants.HTTP, Constants.HTTPS })) { return error("淇敼浠诲姟'" + job.getJobName() + "'澶辫触锛岀洰鏍囧瓧绗︿覆涓嶅厑璁'http(s)//'璋冪敤"); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java index e6c0b066..b1c1f730 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java @@ -7,7 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.core.constant.Constants; import com.ruoyi.common.core.constant.UserConstants; -import com.ruoyi.common.core.exception.CustomException; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.redis.service.RedisService; @@ -137,7 +137,7 @@ public class SysConfigServiceImpl implements ISysConfigService SysConfig config = selectConfigById(configId); if (StringUtils.equals(UserConstants.YES, config.getConfigType())) { - throw new CustomException(String.format("鍐呯疆鍙傛暟銆%1$s銆戜笉鑳藉垹闄 ", config.getConfigKey())); + throw new ServiceException(String.format("鍐呯疆鍙傛暟銆%1$s銆戜笉鑳藉垹闄 ", config.getConfigKey())); } configMapper.deleteConfigById(configId); redisService.deleteObject(getCacheKey(config.getConfigKey())); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index 8931b22c..6d89724a 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -7,7 +7,7 @@ import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.core.constant.UserConstants; -import com.ruoyi.common.core.exception.CustomException; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.datascope.annotation.DataScope; @@ -184,7 +184,7 @@ public class SysDeptServiceImpl implements ISysDeptService // 濡傛灉鐖惰妭鐐逛笉涓烘甯哥姸鎬,鍒欎笉鍏佽鏂板瀛愯妭鐐 if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) { - throw new CustomException("閮ㄩ棬鍋滅敤锛屼笉鍏佽鏂板"); + throw new ServiceException("閮ㄩ棬鍋滅敤锛屼笉鍏佽鏂板"); } dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); return deptMapper.insertDept(dept); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java index 58a14f3a..78fb8a42 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDictTypeServiceImpl.java @@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.core.constant.UserConstants; -import com.ruoyi.common.core.exception.CustomException; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.security.utils.DictUtils; import com.ruoyi.system.api.domain.SysDictData; @@ -122,7 +122,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService SysDictType dictType = selectDictTypeById(dictId); if (dictDataMapper.countDictDataByType(dictType.getDictType()) > 0) { - throw new CustomException(String.format("%1$s宸插垎閰,涓嶈兘鍒犻櫎", dictType.getDictName())); + throw new ServiceException(String.format("%1$s宸插垎閰,涓嶈兘鍒犻櫎", dictType.getDictName())); } dictTypeMapper.deleteDictTypeById(dictId); DictUtils.removeDictCache(dictType.getDictType()); @@ -132,6 +132,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService /** * 鍔犺浇瀛楀吀缂撳瓨鏁版嵁 */ + @Override public void loadingDictCache() { List dictTypeList = dictTypeMapper.selectDictTypeAll(); @@ -145,6 +146,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService /** * 娓呯┖瀛楀吀缂撳瓨鏁版嵁 */ + @Override public void clearDictCache() { DictUtils.clearDictCache(); @@ -153,6 +155,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService /** * 閲嶇疆瀛楀吀缂撳瓨鏁版嵁 */ + @Override public void resetDictCache() { clearDictCache(); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java index 191003a8..fcd7a670 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysPostServiceImpl.java @@ -6,7 +6,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.core.constant.UserConstants; -import com.ruoyi.common.core.exception.CustomException; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.mapper.SysPostMapper; @@ -149,7 +149,7 @@ public class SysPostServiceImpl implements ISysPostService SysPost post = selectPostById(postId); if (countUserPostById(postId) > 0) { - throw new CustomException(String.format("%1$s宸插垎閰,涓嶈兘鍒犻櫎", post.getPostName())); + throw new ServiceException(String.format("%1$s宸插垎閰,涓嶈兘鍒犻櫎", post.getPostName())); } } return postMapper.deletePostByIds(postIds); diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java index 92a4ebbe..16fcb085 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysRoleServiceImpl.java @@ -9,7 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.core.constant.UserConstants; -import com.ruoyi.common.core.exception.CustomException; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.SpringUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.datascope.annotation.DataScope; @@ -183,7 +183,7 @@ public class SysRoleServiceImpl implements ISysRoleService { if (StringUtils.isNotNull(role.getRoleId()) && role.isAdmin()) { - throw new CustomException("涓嶅厑璁告搷浣滆秴绾х鐞嗗憳瑙掕壊"); + throw new ServiceException("涓嶅厑璁告搷浣滆秴绾х鐞嗗憳瑙掕壊"); } } @@ -342,7 +342,7 @@ public class SysRoleServiceImpl implements ISysRoleService SysRole role = selectRoleById(roleId); if (countUserRoleByRoleId(roleId) > 0) { - throw new CustomException(String.format("%1$s宸插垎閰,涓嶈兘鍒犻櫎", role.getRoleName())); + throw new ServiceException(String.format("%1$s宸插垎閰,涓嶈兘鍒犻櫎", role.getRoleName())); } } // 鍒犻櫎瑙掕壊涓庤彍鍗曞叧鑱 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java index 906d96c4..06860e0b 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java @@ -8,7 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.ruoyi.common.core.constant.UserConstants; -import com.ruoyi.common.core.exception.CustomException; +import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.SecurityUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.datascope.annotation.DataScope; @@ -223,7 +223,7 @@ public class SysUserServiceImpl implements ISysUserService { if (StringUtils.isNotNull(user.getUserId()) && user.isAdmin()) { - throw new CustomException("涓嶅厑璁告搷浣滆秴绾х鐞嗗憳鐢ㄦ埛"); + throw new ServiceException("涓嶅厑璁告搷浣滆秴绾х鐞嗗憳鐢ㄦ埛"); } } @@ -252,6 +252,7 @@ public class SysUserServiceImpl implements ISysUserService * @param user 鐢ㄦ埛淇℃伅 * @return 缁撴灉 */ + @Override public boolean registerUser(SysUser user) { return userMapper.insertUser(user) > 0; @@ -484,7 +485,7 @@ public class SysUserServiceImpl implements ISysUserService { if (StringUtils.isNull(userList) || userList.size() == 0) { - throw new CustomException("瀵煎叆鐢ㄦ埛鏁版嵁涓嶈兘涓虹┖锛"); + throw new ServiceException("瀵煎叆鐢ㄦ埛鏁版嵁涓嶈兘涓虹┖锛"); } int successNum = 0; int failureNum = 0; @@ -529,7 +530,7 @@ public class SysUserServiceImpl implements ISysUserService if (failureNum > 0) { failureMsg.insert(0, "寰堟姳姝夛紝瀵煎叆澶辫触锛佸叡 " + failureNum + " 鏉℃暟鎹牸寮忎笉姝g‘锛岄敊璇涓嬶細"); - throw new CustomException(failureMsg.toString()); + throw new ServiceException(failureMsg.toString()); } else { diff --git a/ruoyi-ui/bin/run-web.bat b/ruoyi-ui/bin/run-web.bat index a6962809..921902c4 100644 --- a/ruoyi-ui/bin/run-web.bat +++ b/ruoyi-ui/bin/run-web.bat @@ -1,6 +1,6 @@ @echo off echo. -echo [信息] 使用 Vue 运行 Web 工程。 +echo [信息] 使用 Vue CLI 命令运行 Web 工程。 echo. %~d0 diff --git a/ruoyi-ui/src/components/Breadcrumb/index.vue b/ruoyi-ui/src/components/Breadcrumb/index.vue index 9955ad2a..dfeca60f 100644 --- a/ruoyi-ui/src/components/Breadcrumb/index.vue +++ b/ruoyi-ui/src/components/Breadcrumb/index.vue @@ -45,7 +45,7 @@ export default { if (!name) { return false } - return name.trim() === '棣栭〉' + return name.trim() === 'Index' }, handleLink(item) { const { redirect, path } = item diff --git a/ruoyi-ui/src/layout/index.vue b/ruoyi-ui/src/layout/index.vue index c6e9b3bc..64cec431 100644 --- a/ruoyi-ui/src/layout/index.vue +++ b/ruoyi-ui/src/layout/index.vue @@ -8,7 +8,7 @@ - + @@ -39,7 +39,6 @@ export default { sideTheme: state => state.settings.sideTheme, sidebar: state => state.app.sidebar, device: state => state.app.device, - showSettings: state => state.settings.showSettings, needTagsView: state => state.settings.tagsView, fixedHeader: state => state.settings.fixedHeader }), diff --git a/ruoyi-ui/src/router/index.js b/ruoyi-ui/src/router/index.js index b593898e..95824b3f 100644 --- a/ruoyi-ui/src/router/index.js +++ b/ruoyi-ui/src/router/index.js @@ -66,8 +66,8 @@ export const constantRoutes = [ { path: 'index', component: (resolve) => require(['@/views/index'], resolve), - name: '棣栭〉', - meta: { title: '棣栭〉', icon: 'dashboard', noCache: true, affix: true } + name: 'Index', + meta: { title: '棣栭〉', icon: 'dashboard', affix: true } } ] }, diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index 8e8cd1ac..bff35c39 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -51,7 +51,7 @@ service.interceptors.response.use(res => { location.href = '/index'; }) }).catch(() => {}); - return Promise.reject() + return Promise.reject('浠ょ墝楠岃瘉澶辫触') } else if (code === 500) { Message({ message: msg, diff --git a/ruoyi-ui/src/utils/ruoyi.js b/ruoyi-ui/src/utils/ruoyi.js index ee01f9b3..67a31183 100644 --- a/ruoyi-ui/src/utils/ruoyi.js +++ b/ruoyi-ui/src/utils/ruoyi.js @@ -58,7 +58,7 @@ export function addDateRange(params, dateRange, propName) { var search = params; search.params = {}; if (null != dateRange && '' != dateRange) { - if (typeof(propName) === "undefined") { + if (typeof (propName) === "undefined") { search.params["beginTime"] = dateRange[0]; search.params["endTime"] = dateRange[1]; } else { @@ -87,8 +87,8 @@ export function selectDictLabels(datas, value, separator) { var currentSeparator = undefined === separator ? "," : separator; var temp = value.split(currentSeparator); Object.keys(value.split(currentSeparator)).some((val) => { - Object.keys(datas).some((key) => { - if (datas[key].dictValue == ('' + temp[val])) { + Object.keys(datas).some((key) => { + if (datas[key].dictValue == ('' + temp[val])) { actions.push(datas[key].dictLabel + currentSeparator); } }) @@ -179,21 +179,23 @@ export function handleTree(data, id, parentId, children) { * @param {*} params 鍙傛暟 */ export function tansParams(params) { - let result = '' - for (const propName of Object.keys(params)) { - const value = params[propName]; - var part = encodeURIComponent(propName) + "="; - if (value !== null && typeof(value) !== "undefined") { - if (typeof value === 'object') { - for (const key of Object.keys(value)) { - let params = propName + '[' + key + ']'; - var subPart = encodeURIComponent(params) + "="; - result += subPart + encodeURIComponent(value[key]) + "&"; - } - } else { - result += part + encodeURIComponent(value) + "&"; - } - } - } - return result + let result = '' + for (const propName of Object.keys(params)) { + const value = params[propName]; + var part = encodeURIComponent(propName) + "="; + if (value !== null && typeof (value) !== "undefined") { + if (typeof value === 'object') { + for (const key of Object.keys(value)) { + if (value[key] !== null && typeof (value[key]) !== 'undefined') { + let params = propName + '[' + key + ']'; + var subPart = encodeURIComponent(params) + "="; + result += subPart + encodeURIComponent(value[key]) + "&"; + } + } + } else { + result += part + encodeURIComponent(value) + "&"; + } + } + } + return result } diff --git a/ruoyi-ui/src/views/index.vue b/ruoyi-ui/src/views/index.vue index df9a5a0f..37e95fda 100644 --- a/ruoyi-ui/src/views/index.vue +++ b/ruoyi-ui/src/views/index.vue @@ -556,7 +556,7 @@