Ver Fonte

优化业务异常类

wanggaokun há 1 ano atrás
pai
commit
67ee63fd1b
25 ficheiros alterados com 104 adições e 104 exclusões
  1. 2 2
      eco-common/common-core/src/main/java/org/eco/common/core/config/AsyncConfig.java
  2. 9 9
      eco-common/common-core/src/main/java/org/eco/common/core/exception/BusinessException.java
  3. 4 4
      eco-common/common-core/src/main/java/org/eco/common/core/utils/ip/RegionUtils.java
  4. 2 2
      eco-common/common-encrypt/src/main/java/org/eco/common/encrypt/filter/CryptoFilter.java
  5. 3 3
      eco-common/common-excel/src/main/java/org/eco/common/excel/core/DropDownOptions.java
  6. 2 2
      eco-common/common-excel/src/main/java/org/eco/common/excel/core/ExcelDownHandler.java
  7. 2 2
      eco-common/common-orm/src/main/java/org/eco/common/orm/listener/EntityInsertListener.java
  8. 2 2
      eco-common/common-orm/src/main/java/org/eco/common/orm/listener/EntityUpdateListener.java
  9. 5 5
      eco-common/common-ratelimiter/src/main/java/org/eco/common/ratelimiter/aspectj/RateLimiterAspect.java
  10. 3 3
      eco-common/common-security/src/main/java/org/eco/common/security/handler/GlobalExceptionHandler.java
  11. 3 3
      eco-common/common-web/src/main/java/org/eco/common/web/aspectj/RepeatSubmitAspect.java
  12. 11 11
      eco-modules/generator/src/main/java/org/eco/generator/service/GenTableServiceImpl.java
  13. 2 2
      eco-modules/generator/src/main/resources/vm/java/listener.java.vm
  14. 2 2
      eco-modules/system/src/main/java/org/eco/system/listener/SysUserImportListener.java
  15. 2 2
      eco-modules/system/src/main/java/org/eco/system/service/impl/SysConfigServiceImpl.java
  16. 3 3
      eco-modules/system/src/main/java/org/eco/system/service/impl/SysDeptServiceImpl.java
  17. 4 4
      eco-modules/system/src/main/java/org/eco/system/service/impl/SysDictTypeServiceImpl.java
  18. 3 3
      eco-modules/system/src/main/java/org/eco/system/service/impl/SysOssConfigServiceImpl.java
  19. 5 5
      eco-modules/system/src/main/java/org/eco/system/service/impl/SysOssServiceImpl.java
  20. 2 2
      eco-modules/system/src/main/java/org/eco/system/service/impl/SysPostServiceImpl.java
  21. 8 8
      eco-modules/system/src/main/java/org/eco/system/service/impl/SysRoleServiceImpl.java
  22. 2 2
      eco-modules/system/src/main/java/org/eco/system/service/impl/SysTenantPackageServiceImpl.java
  23. 16 16
      eco-modules/system/src/main/java/org/eco/system/service/impl/SysTenantServiceImpl.java
  24. 5 5
      eco-modules/system/src/main/java/org/eco/system/service/impl/SysUserServiceImpl.java
  25. 2 2
      eco-start/src/main/java/org/eco/web/service/IAuthStrategy.java

+ 2 - 2
eco-common/common-core/src/main/java/org/eco/common/core/config/AsyncConfig.java

@@ -1,7 +1,7 @@
 package org.eco.common.core.config;
 
 import cn.hutool.core.util.ArrayUtil;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.utils.SpringUtils;
 import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
 import org.springframework.boot.autoconfigure.AutoConfiguration;
@@ -41,7 +41,7 @@ public class AsyncConfig implements AsyncConfigurer {
             if (ArrayUtil.isNotEmpty(objects)) {
                 sb.append(", Parameter value - ").append(Arrays.toString(objects));
             }
-            throw new ServiceException(sb.toString());
+            throw new BusinessException(sb.toString());
         };
     }
 

+ 9 - 9
eco-common/common-core/src/main/java/org/eco/common/core/exception/ServiceException.java → eco-common/common-core/src/main/java/org/eco/common/core/exception/BusinessException.java

@@ -11,7 +11,7 @@ import java.text.MessageFormat;
  *
  * @author wgk
  */
-public final class ServiceException extends RuntimeException {
+public final class BusinessException extends RuntimeException {
     @Serial
     private static final long serialVersionUID = 1L;
 
@@ -34,39 +34,39 @@ public final class ServiceException extends RuntimeException {
     /**
      * 空构造方法,避免反序列化问题
      */
-    public ServiceException() {
+    public BusinessException() {
     }
 
-    public ServiceException(String message) {
+    public BusinessException(String message) {
         this.message = message;
     }
-    public ServiceException(String message, Integer code) {
+    public BusinessException(String message, Integer code) {
         this.message = message;
         this.code = code;
     }
 
-    public ServiceException(Integer code, String msg, Object... msgParams) {
+    public BusinessException(Integer code, String msg, Object... msgParams) {
         this.message = msg;
         this.code = code;
         this.msgParams = msgParams;
     }
 
-    public ServiceException(String msg, Object... msgParams) {
+    public BusinessException(String msg, Object... msgParams) {
         this.message = msg;
         this.msgParams = msgParams;
     }
 
     @Override
     public String getMessage() {
-        if(StrUtil.isNotBlank(getMessage())){
+        if(StrUtil.isNotBlank(message)){
             if(msgParams!=null && msgParams.length>0){
                 return MessageFormat.format(message, msgParams);
             }
         }
-        return super.getMessage(); // 如果不传参数,直接调用父类方法
+        return message; // 如果不传参数,直接返回
     }
 
-    public ServiceException setMessage(String message) {
+    public BusinessException setMessage(String message) {
         this.message = message;
         return this;
     }

+ 4 - 4
eco-common/common-core/src/main/java/org/eco/common/core/utils/ip/RegionUtils.java

@@ -3,7 +3,7 @@ package org.eco.common.core.utils.ip;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.resource.ClassPathResource;
 import cn.hutool.core.util.ObjectUtil;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.utils.file.FileUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.lionsoul.ip2region.xdb.Searcher;
@@ -27,7 +27,7 @@ public class RegionUtils {
         if (!FileUtils.exist(existFile)) {
             ClassPathResource fileStream = new ClassPathResource(fileName);
             if (ObjectUtil.isEmpty(fileStream.getStream())) {
-                throw new ServiceException("RegionUtils初始化失败,原因:IP地址库数据不存在!");
+                throw new BusinessException("RegionUtils初始化失败,原因:IP地址库数据不存在!");
             }
             FileUtils.writeFromStream(fileStream.getStream(), existFile);
         }
@@ -39,13 +39,13 @@ public class RegionUtils {
         try {
             cBuff = Searcher.loadContentFromFile(dbPath);
         } catch (Exception e) {
-            throw new ServiceException("RegionUtils初始化失败,原因:从ip2region.xdb文件加载内容失败!" + e.getMessage());
+            throw new BusinessException("RegionUtils初始化失败,原因:从ip2region.xdb文件加载内容失败!" + e.getMessage());
         }
         // 2、使用上述的 cBuff 创建一个完全基于内存的查询对象。
         try {
             SEARCHER = Searcher.newWithBuffer(cBuff);
         } catch (Exception e) {
-            throw new ServiceException("RegionUtils初始化失败,原因:" + e.getMessage());
+            throw new BusinessException("RegionUtils初始化失败,原因:" + e.getMessage());
         }
     }
 

+ 2 - 2
eco-common/common-encrypt/src/main/java/org/eco/common/encrypt/filter/CryptoFilter.java

@@ -2,7 +2,7 @@ package org.eco.common.encrypt.filter;
 
 import cn.hutool.core.util.ObjectUtil;
 import org.eco.common.core.constant.HttpStatus;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.utils.SpringUtils;
 import org.eco.common.core.utils.StringUtils;
 import org.eco.common.encrypt.annotation.ApiEncrypt;
@@ -64,7 +64,7 @@ public class CryptoFilter implements Filter {
                         HandlerExceptionResolver exceptionResolver = SpringUtils.getBean("handlerExceptionResolver", HandlerExceptionResolver.class);
                         exceptionResolver.resolveException(
                             servletRequest, servletResponse, null,
-                            new ServiceException("没有访问权限,请联系管理员授权", HttpStatus.FORBIDDEN));
+                            new BusinessException("没有访问权限,请联系管理员授权", HttpStatus.FORBIDDEN));
                         return;
                     }
                 }

+ 3 - 3
eco-common/common-excel/src/main/java/org/eco/common/excel/core/DropDownOptions.java

@@ -1,7 +1,7 @@
 package org.eco.common.excel.core;
 
 import cn.hutool.core.util.StrUtil;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
@@ -67,7 +67,7 @@ public class DropDownOptions {
         for (int i = 0; i < vars.length; i++) {
             String var = StrUtil.trimToEmpty(String.valueOf(vars[i]));
             if (!var.matches(regex)) {
-                throw new ServiceException("选项数据不符合规则,仅允许使用中英文字符以及数字");
+                throw new BusinessException("选项数据不符合规则,仅允许使用中英文字符以及数字");
             }
             stringBuffer.append(var);
             if (i < vars.length - 1) {
@@ -76,7 +76,7 @@ public class DropDownOptions {
             }
         }
         if (stringBuffer.toString().matches("^\\d_*$")) {
-            throw new ServiceException("禁止以数字开头");
+            throw new BusinessException("禁止以数字开头");
         }
         return stringBuffer.toString();
     }

+ 2 - 2
eco-common/common-excel/src/main/java/org/eco/common/excel/core/ExcelDownHandler.java

@@ -11,7 +11,7 @@ import com.alibaba.excel.util.ClassUtils;
 import com.alibaba.excel.write.handler.SheetWriteHandler;
 import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
 import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.service.DictService;
 import org.eco.common.core.utils.SpringUtils;
 import org.eco.common.core.utils.StreamUtils;
@@ -113,7 +113,7 @@ public class ExcelDownHandler implements SheetWriteHandler {
                 if (StrUtil.isNotBlank(dictType)) {
                     // 如果传递了字典名,则依据字典建立下拉
                     Collection<String> values = Optional.ofNullable(dictService.getAllDictByDictType(dictType))
-                        .orElseThrow(() -> new ServiceException(String.format("字典 %s 不存在", dictType)))
+                        .orElseThrow(() -> new BusinessException(String.format("字典 %s 不存在", dictType)))
                         .values();
                     options = new ArrayList<>(values);
                 } else if (StrUtil.isNotBlank(converterExp)) {

+ 2 - 2
eco-common/common-orm/src/main/java/org/eco/common/orm/listener/EntityInsertListener.java

@@ -2,7 +2,7 @@ package org.eco.common.orm.listener;
 
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.http.HttpStatus;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.orm.core.domain.BaseEntity;
 import org.eco.common.security.utils.LoginHelper;
 import com.mybatisflex.annotation.InsertListener;
@@ -32,7 +32,7 @@ public class EntityInsertListener implements InsertListener {
                 baseEntity.setUpdateTime(createTime);
             }
         } catch (Exception e) {
-            throw new ServiceException("全局插入数据监听器注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
+            throw new BusinessException("全局插入数据监听器注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
         }
     }
 }

+ 2 - 2
eco-common/common-orm/src/main/java/org/eco/common/orm/listener/EntityUpdateListener.java

@@ -2,7 +2,7 @@ package org.eco.common.orm.listener;
 
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.http.HttpStatus;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.orm.core.domain.BaseEntity;
 import org.eco.common.security.utils.LoginHelper;
 import com.mybatisflex.annotation.UpdateListener;
@@ -23,7 +23,7 @@ public class EntityUpdateListener implements UpdateListener {
                 baseEntity.setUpdateTime(new Date());
             }
         } catch (Exception e) {
-            throw new ServiceException("全局更新数据监听器注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
+            throw new BusinessException("全局更新数据监听器注入异常 => " + e.getMessage(), HttpStatus.HTTP_UNAUTHORIZED);
         }
 
     }

+ 5 - 5
eco-common/common-ratelimiter/src/main/java/org/eco/common/ratelimiter/aspectj/RateLimiterAspect.java

@@ -2,7 +2,7 @@ package org.eco.common.ratelimiter.aspectj;
 
 import cn.hutool.core.util.ArrayUtil;
 import org.eco.common.core.constant.GlobalConstants;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.utils.MessageUtils;
 import org.eco.common.core.utils.ServletUtils;
 import org.eco.common.core.utils.StringUtils;
@@ -69,11 +69,11 @@ public class RateLimiterAspect {
                 if (StringUtils.startsWith(message, "{") && StringUtils.endsWith(message, "}")) {
                     message = MessageUtils.message(StringUtils.substring(message, 1, message.length() - 1));
                 }
-                throw new ServiceException(message);
+                throw new BusinessException(message);
             }
             log.info("限制令牌 => {}, 剩余令牌 => {}, 缓存key => '{}'", count, number, combineKey);
         } catch (Exception e) {
-            if (e instanceof ServiceException) {
+            if (e instanceof BusinessException) {
                 throw e;
             } else {
                 throw new RuntimeException("服务器限流异常,请稍候再试");
@@ -94,7 +94,7 @@ public class RateLimiterAspect {
             // 获取方法上参数的名称
             String[] parameterNames = pnd.getParameterNames(method);
             if (ArrayUtil.isEmpty(parameterNames)) {
-                throw new ServiceException("限流key解析异常!请联系管理员!");
+                throw new BusinessException("限流key解析异常!请联系管理员!");
             }
             for (int i = 0; i < parameterNames.length; i++) {
                 context.setVariable(parameterNames[i], args[i]);
@@ -110,7 +110,7 @@ public class RateLimiterAspect {
                 }
                 key = expression.getValue(context, String.class) + ":";
             } catch (Exception e) {
-                throw new ServiceException("限流key解析异常!请联系管理员!");
+                throw new BusinessException("限流key解析异常!请联系管理员!");
             }
         }
         StringBuilder stringBuffer = new StringBuilder(GlobalConstants.RATE_LIMIT_KEY);

+ 3 - 3
eco-common/common-security/src/main/java/org/eco/common/security/handler/GlobalExceptionHandler.java

@@ -6,7 +6,7 @@ import cn.dev33.satoken.exception.NotRoleException;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.http.HttpStatus;
 import org.eco.common.core.core.domain.CommonResult;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.exception.base.BaseException;
 import org.eco.common.core.utils.StreamUtils;
 import jakarta.servlet.http.HttpServletRequest;
@@ -77,8 +77,8 @@ public class GlobalExceptionHandler {
     /**
      * 业务异常
      */
-    @ExceptionHandler(ServiceException.class)
-    public CommonResult<Void> handleServiceException(ServiceException e, HttpServletRequest request) {
+    @ExceptionHandler(BusinessException.class)
+    public CommonResult<Void> handleServiceException(BusinessException e, HttpServletRequest request) {
         log.error(e.getMessage());
         Integer code = e.getCode();
         return ObjectUtil.isNotNull(code) ? CommonResult.fail(code, e.getMessage()) : CommonResult.fail(e.getMessage());

+ 3 - 3
eco-common/common-web/src/main/java/org/eco/common/web/aspectj/RepeatSubmitAspect.java

@@ -6,7 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.crypto.SecureUtil;
 import org.eco.common.core.constant.GlobalConstants;
 import org.eco.common.core.core.domain.CommonResult;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.utils.MessageUtils;
 import org.eco.common.core.utils.ServletUtils;
 import org.eco.common.core.utils.StringUtils;
@@ -44,7 +44,7 @@ public class RepeatSubmitAspect {
         long interval = repeatSubmit.timeUnit().toMillis(repeatSubmit.interval());
 
         if (interval < 1000) {
-            throw new ServiceException("重复提交间隔时间不能小于'1'秒");
+            throw new BusinessException("重复提交间隔时间不能小于'1'秒");
         }
         HttpServletRequest request = ServletUtils.getRequest();
         String nowParams = argsArrayToString(point.getArgs());
@@ -65,7 +65,7 @@ public class RepeatSubmitAspect {
             if (StringUtils.startsWith(message, "{") && StringUtils.endsWith(message, "}")) {
                 message = MessageUtils.message(StringUtils.substring(message, 1, message.length() - 1));
             }
-            throw new ServiceException(message);
+            throw new BusinessException(message);
         }
     }
 

+ 11 - 11
eco-modules/generator/src/main/java/org/eco/generator/service/GenTableServiceImpl.java

@@ -8,7 +8,7 @@ import org.eco.common.core.constant.Constants;
 import org.eco.common.core.constant.GenConstants;
 import org.eco.common.core.core.page.PageResult;
 import org.eco.common.core.core.text.CharsetKit;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.utils.DateUtils;
 import org.eco.common.core.utils.StreamUtils;
 import org.eco.common.core.utils.StringUtils;
@@ -259,7 +259,7 @@ public class GenTableServiceImpl extends BaseServiceImpl<GenTableMapper, GenTabl
                 }
             }
         } catch (Exception e) {
-            throw new ServiceException("导入失败:" + e.getMessage());
+            throw new BusinessException("导入失败:" + e.getMessage());
         }
     }
 
@@ -333,7 +333,7 @@ public class GenTableServiceImpl extends BaseServiceImpl<GenTableMapper, GenTabl
                     String path = getGenPath(result.table(), template);
                     FileUtils.writeStringToFile(new File(path), sw.toString(), CharsetKit.UTF_8);
                 } catch (IOException e) {
-                    throw new ServiceException("渲染模板失败,表名:" + result.table().getTableName());
+                    throw new BusinessException("渲染模板失败,表名:" + result.table().getTableName());
                 }
             }
         }
@@ -343,11 +343,11 @@ public class GenTableServiceImpl extends BaseServiceImpl<GenTableMapper, GenTabl
         // 校验是否存在
         GenTable table = genTableMapper.selectOneWithRelationsById(tableId);
         if (ObjectUtil.isEmpty(table)) {
-            throw new ServiceException("表定义不存在");
+            throw new BusinessException("表定义不存在");
         }
         List<GenTableColumn> list = genTableColumnService.selectGenTableColumnListByTableId(table.getTableId());
         if(CollUtil.isEmpty(list)) {
-            throw new ServiceException("字段义不存在");
+            throw new BusinessException("字段义不存在");
         }
         table.setColumns(list);
         // 设置主子表信息
@@ -384,7 +384,7 @@ public class GenTableServiceImpl extends BaseServiceImpl<GenTableMapper, GenTabl
         Map<String, GenTableColumn> tableColumnMap = StreamUtils.toIdentityMap(tableColumns, GenTableColumn::getColumnName);
         List<GenTableColumn> dbTableColumns = genTableColumnMapper.selectDbTableColumnsByName(table.getTableName());
         if (CollUtil.isEmpty(dbTableColumns)) {
-            throw new ServiceException("同步数据失败,原表结构不存在");
+            throw new BusinessException("同步数据失败,原表结构不存在");
         }
         List<String> dbTableColumnNames = StreamUtils.toList(dbTableColumns, GenTableColumn::getColumnName);
         List<GenTableColumn> saveColumns = new ArrayList<>();
@@ -482,16 +482,16 @@ public class GenTableServiceImpl extends BaseServiceImpl<GenTableMapper, GenTabl
             String options = JSON.toJSONString(genTable.getParams());
             JSONObject paramsObj = JSON.parseObject(options);
             if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_CODE))) {
-                throw new ServiceException("树编码字段不能为空");
+                throw new BusinessException("树编码字段不能为空");
             } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_PARENT_CODE))) {
-                throw new ServiceException("树父编码字段不能为空");
+                throw new BusinessException("树父编码字段不能为空");
             } else if (StringUtils.isEmpty(paramsObj.getString(GenConstants.TREE_NAME))) {
-                throw new ServiceException("树名称字段不能为空");
+                throw new BusinessException("树名称字段不能为空");
             } else if (GenConstants.TPL_SUB.equals(genTable.getTplCategory())) {
                 if (StringUtils.isEmpty(genTable.getSubTableName())) {
-                    throw new ServiceException("关联子表的表名不能为空");
+                    throw new BusinessException("关联子表的表名不能为空");
                 } else if (StringUtils.isEmpty(genTable.getSubTableFkName())) {
-                    throw new ServiceException("子表关联的外键名不能为空");
+                    throw new BusinessException("子表关联的外键名不能为空");
                 }
             }
         }

+ 2 - 2
eco-modules/generator/src/main/resources/vm/java/listener.java.vm

@@ -4,7 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.event.AnalysisEventListener;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.utils.SpringUtils;
 import org.eco.common.core.utils.ValidatorUtils;
 import org.eco.common.excel.core.ExcelListener;
@@ -106,7 +106,7 @@ public class ${ClassName}ImportListener extends AnalysisEventListener<${ClassNam
             public String getAnalysis() {
                 if (failureNum > 0) {
                     failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据没有成功导入,错误如下:");
-                    throw new ServiceException(failureMsg.toString());
+                    throw new BusinessException(failureMsg.toString());
                 } else {
                     successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
                 }

+ 2 - 2
eco-modules/system/src/main/java/org/eco/system/listener/SysUserImportListener.java

@@ -5,9 +5,9 @@ import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.crypto.digest.BCrypt;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.event.AnalysisEventListener;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.system.domain.bo.SysUserBo;
 import org.eco.system.domain.vo.SysUserImportVo;
-import org.eco.common.core.exception.ServiceException;
 import org.eco.common.core.utils.SpringUtils;
 import org.eco.common.core.utils.StringUtils;
 import org.eco.common.core.utils.ValidatorUtils;
@@ -132,7 +132,7 @@ public class SysUserImportListener extends AnalysisEventListener<SysUserImportVo
             public String getAnalysis() {
                 if (failureNum > 0) {
                     failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据没有成功导入,错误如下:");
-                    throw new ServiceException(failureMsg.toString());
+                    throw new BusinessException(failureMsg.toString());
                 } else {
                     successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
                 }

+ 2 - 2
eco-modules/system/src/main/java/org/eco/system/service/impl/SysConfigServiceImpl.java

@@ -1,5 +1,6 @@
 package org.eco.system.service.impl;
 
+import org.eco.common.core.exception.BusinessException;
 import org.eco.system.domain.SysConfig;
 import org.eco.system.domain.bo.SysConfigBo;
 import org.eco.system.domain.vo.SysConfigVo;
@@ -7,7 +8,6 @@ import org.eco.common.core.constant.CacheNames;
 import org.eco.common.core.constant.UserConstants;
 import org.eco.common.core.core.page.PageResult;
 import org.eco.common.core.core.text.Convert;
-import org.eco.common.core.exception.ServiceException;
 import org.eco.common.core.service.ConfigService;
 import org.eco.common.core.utils.MapstructUtils;
 import org.eco.common.core.utils.SpringUtils;
@@ -180,7 +180,7 @@ public class SysConfigServiceImpl extends BaseServiceImpl<SysConfigMapper, SysCo
         for (Long configId : configIds) {
             SysConfigVo config = selectConfigById(configId);
             if (StringUtils.equals(UserConstants.YES, config.getConfigType())) {
-                throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
+                throw new BusinessException(String.format("内置参数【%1$s】不能删除 ", config.getConfigKey()));
             }
             this.removeById(configId);
             CacheUtils.evict(CacheNames.SYS_CONFIG, config.getConfigKey());

+ 3 - 3
eco-modules/system/src/main/java/org/eco/system/service/impl/SysDeptServiceImpl.java

@@ -11,7 +11,7 @@ import lombok.RequiredArgsConstructor;
 import org.eco.common.core.constant.CacheNames;
 import org.eco.common.core.constant.UserConstants;
 import org.eco.common.core.core.text.Convert;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.service.DeptService;
 import org.eco.common.core.utils.MapstructUtils;
 import org.eco.common.core.utils.SpringUtils;
@@ -248,7 +248,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
         dept.setDeptId(deptId);
         List<SysDeptVo> deptLists = SpringUtils.getAopProxy(this).selectDeptList(dept);
         if (ObjectUtil.isNull(deptLists)) {
-            throw new ServiceException("没有权限访问部门数据!");
+            throw new BusinessException("没有权限访问部门数据!");
         }
     }
 
@@ -263,7 +263,7 @@ public class SysDeptServiceImpl extends BaseServiceImpl<SysDeptMapper, SysDept>
         SysDeptVo info = selectDeptById(deptBo.getParentId());
         // 如果父节点不为正常状态,则不允许新增子节点
         if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) {
-            throw new ServiceException("部门停用,不允许新增");
+            throw new BusinessException("部门停用,不允许新增");
         }
         SysDept dept = MapstructUtils.convert(deptBo, SysDept.class);
         assert dept != null;

+ 4 - 4
eco-modules/system/src/main/java/org/eco/system/service/impl/SysDictTypeServiceImpl.java

@@ -2,6 +2,7 @@ package org.eco.system.service.impl;
 
 import cn.dev33.satoken.context.SaHolder;
 import cn.hutool.core.util.ObjectUtil;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.system.domain.SysDictType;
 import org.eco.system.domain.bo.SysDictTypeBo;
 import org.eco.system.domain.vo.SysDictTypeVo;
@@ -9,7 +10,6 @@ import org.eco.common.core.constant.CacheConstants;
 import org.eco.common.core.constant.CacheNames;
 import org.eco.common.core.constant.UserConstants;
 import org.eco.common.core.core.page.PageResult;
-import org.eco.common.core.exception.ServiceException;
 import org.eco.common.core.service.DictService;
 import org.eco.common.core.utils.MapstructUtils;
 import org.eco.common.core.utils.SpringUtils;
@@ -153,7 +153,7 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeMapper, S
         for (Long dictId : dictIds) {
             SysDictTypeVo dictType = selectDictTypeById(dictId);
             if (sysDictDataService.countDictDataByType(dictType.getDictType()) > 0) {
-                throw new ServiceException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
+                throw new BusinessException(String.format("%1$s已分配,不能删除", dictType.getDictName()));
             }
             CacheUtils.evict(CacheNames.SYS_DICT, dictType.getDictType());
         }
@@ -183,7 +183,7 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeMapper, S
             // 新增 type 下无 data 数据 返回空防止缓存穿透
             return new ArrayList<>();
         }
-        throw new ServiceException("插入操作失败");
+        throw new BusinessException("插入操作失败");
     }
 
     /**
@@ -207,7 +207,7 @@ public class SysDictTypeServiceImpl extends BaseServiceImpl<SysDictTypeMapper, S
             CacheUtils.evict(CacheNames.SYS_DICT, oldDict.getDictType());
             return sysDictDataService.selectDictDataByType(dict.getDictType());
         }
-        throw new ServiceException("修改操作失败");
+        throw new BusinessException("修改操作失败");
     }
 
     /**

+ 3 - 3
eco-modules/system/src/main/java/org/eco/system/service/impl/SysOssConfigServiceImpl.java

@@ -2,13 +2,13 @@ package org.eco.system.service.impl;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.system.domain.SysOssConfig;
 import org.eco.system.domain.bo.SysOssConfigBo;
 import org.eco.system.domain.vo.SysOssConfigVo;
 import org.eco.system.service.ISysOssConfigService;
 import org.eco.common.core.constant.CacheNames;
 import org.eco.common.core.core.page.PageResult;
-import org.eco.common.core.exception.ServiceException;
 import org.eco.common.core.utils.MapstructUtils;
 import org.eco.common.core.utils.StringUtils;
 import org.eco.common.json.utils.JsonUtils;
@@ -125,7 +125,7 @@ public class SysOssConfigServiceImpl extends BaseServiceImpl<SysOssConfigMapper,
     private void validEntityBeforeSave(SysOssConfig entity) {
         if (StringUtils.isNotEmpty(entity.getConfigKey())
             && !checkConfigKeyUnique(entity)) {
-            throw new ServiceException("操作配置'" + entity.getConfigKey() + "'失败, 配置key已存在!");
+            throw new BusinessException("操作配置'" + entity.getConfigKey() + "'失败, 配置key已存在!");
         }
     }
 
@@ -133,7 +133,7 @@ public class SysOssConfigServiceImpl extends BaseServiceImpl<SysOssConfigMapper,
     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
         if (isValid) {
             if (CollUtil.containsAny(ids, OssConstant.SYSTEM_DATA_IDS)) {
-                throw new ServiceException("系统内置, 不可删除!");
+                throw new BusinessException("系统内置, 不可删除!");
             }
         }
         List<SysOssConfig> list = CollUtil.newArrayList();

+ 5 - 5
eco-modules/system/src/main/java/org/eco/system/service/impl/SysOssServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.io.IoUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.system.domain.SysOss;
 import org.eco.system.domain.bo.SysOssBo;
 import org.eco.system.domain.vo.SysOssVo;
@@ -12,7 +13,6 @@ import org.eco.common.core.config.EcoConfig;
 import org.eco.common.core.constant.CacheNames;
 import org.eco.common.core.constant.Constants;
 import org.eco.common.core.core.page.PageResult;
-import org.eco.common.core.exception.ServiceException;
 import org.eco.common.core.service.OssService;
 import org.eco.common.core.utils.MapstructUtils;
 import org.eco.common.core.utils.SpringUtils;
@@ -128,7 +128,7 @@ public class SysOssServiceImpl extends BaseServiceImpl<SysOssMapper, SysOss> imp
     public void download(Long ossId, HttpServletResponse response) throws IOException {
         SysOssVo sysOss = SpringUtils.getAopProxy(this).getById(ossId);
         if (ObjectUtil.isNull(sysOss)) {
-            throw new ServiceException("文件数据不存在!");
+            throw new BusinessException("文件数据不存在!");
         }
         FileUtils.setAttachmentResponseHeader(response, sysOss.getOriginalName());
         response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE + "; charset=UTF-8");
@@ -138,7 +138,7 @@ public class SysOssServiceImpl extends BaseServiceImpl<SysOssMapper, SysOss> imp
             IoUtil.copy(inputStream, response.getOutputStream(), available);
             response.setContentLength(available);
         } catch (Exception e) {
-            throw new ServiceException(e.getMessage());
+            throw new BusinessException(e.getMessage());
         }
     }
 
@@ -152,7 +152,7 @@ public class SysOssServiceImpl extends BaseServiceImpl<SysOssMapper, SysOss> imp
         try {
             uploadResult = storage.uploadSuffix(file.getBytes(), suffix);
         } catch (IOException e) {
-            throw new ServiceException(e.getMessage());
+            throw new BusinessException(e.getMessage());
         }
         // 保存文件信息
         return buildResultEntity(originalFilename, suffix, storage.getConfigKey(), uploadResult);
@@ -194,7 +194,7 @@ public class SysOssServiceImpl extends BaseServiceImpl<SysOssMapper, SysOss> imp
                 String filePath = EcoConfig.getProfile() + StringUtils.substringAfter(sysOss.getFileName(), Constants.RESOURCE_PREFIX);
                 boolean deleted = FileUtil.del(filePath);
                 if (!deleted) {
-                    throw new ServiceException(sysOss.getFileName() + "文件删除失败,可能是因为文件不存在或无权限删除。");
+                    throw new BusinessException(sysOss.getFileName() + "文件删除失败,可能是因为文件不存在或无权限删除。");
                 }
             } else {
                 OssClient storage = OssFactory.instance(sysOss.getService());

+ 2 - 2
eco-modules/system/src/main/java/org/eco/system/service/impl/SysPostServiceImpl.java

@@ -1,10 +1,10 @@
 package org.eco.system.service.impl;
 
+import org.eco.common.core.exception.BusinessException;
 import org.eco.system.domain.SysPost;
 import org.eco.system.domain.bo.SysPostBo;
 import org.eco.common.core.constant.UserConstants;
 import org.eco.common.core.core.page.PageResult;
-import org.eco.common.core.exception.ServiceException;
 import org.eco.common.core.utils.MapstructUtils;
 import org.eco.common.core.utils.StringUtils;
 import org.eco.common.orm.core.page.PageQuery;
@@ -212,7 +212,7 @@ public class SysPostServiceImpl extends BaseServiceImpl<SysPostMapper, SysPost>
         for (Long postId : postIds) {
             SysPostVo post = selectPostById(postId);
             if (userPostService.countUserPostById(postId) > 0) {
-                throw new ServiceException(String.format("%1$s已分配,不能删除!", post.getPostName()));
+                throw new BusinessException(String.format("%1$s已分配,不能删除!", post.getPostName()));
             }
         }
         return this.removeByIds(Arrays.asList(postIds));

+ 8 - 8
eco-modules/system/src/main/java/org/eco/system/service/impl/SysRoleServiceImpl.java

@@ -4,6 +4,7 @@ import cn.dev33.satoken.exception.NotLoginException;
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.system.domain.SysRole;
 import org.eco.system.domain.SysRoleDept;
 import org.eco.system.domain.SysRoleMenu;
@@ -13,7 +14,6 @@ import org.eco.common.core.constant.UserConstants;
 import org.eco.common.core.core.domain.dto.RoleDTO;
 import org.eco.common.core.core.domain.model.LoginUser;
 import org.eco.common.core.core.page.PageResult;
-import org.eco.common.core.exception.ServiceException;
 import org.eco.common.core.utils.MapstructUtils;
 import org.eco.common.core.utils.SpringUtils;
 import org.eco.common.core.utils.StringUtils;
@@ -295,13 +295,13 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
     @Override
     public void checkRoleAllowed(SysRoleBo roleBo) {
         if (ObjectUtil.isNotNull(roleBo.getRoleId()) && LoginHelper.isSuperAdmin(roleBo.getRoleId())) {
-            throw new ServiceException("不允许操作超级管理员角色");
+            throw new BusinessException("不允许操作超级管理员角色");
         }
         String[] keys = new String[]{TenantConstants.SUPER_ADMIN_ROLE_KEY, TenantConstants.TENANT_ADMIN_ROLE_KEY};
         // 新增:不允许使用 管理员标识符
         if (ObjectUtil.isNull(roleBo.getRoleId())
             && StringUtils.equalsAny(roleBo.getRoleKey(), keys)) {
-            throw new ServiceException("不允许使用系统内置管理员角色标识符!");
+            throw new BusinessException("不允许使用系统内置管理员角色标识符!");
         }
         // 修改:不允许修改 管理员标识符
         if (ObjectUtil.isNotNull(roleBo.getRoleId())) {
@@ -309,9 +309,9 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
             // 如果标识符不相等 判断为修改了管理员标识符
             if (!StringUtils.equals(sysRole.getRoleKey(), roleBo.getRoleKey())) {
                 if (StringUtils.equalsAny(sysRole.getRoleKey(), keys)) {
-                    throw new ServiceException("不允许修改系统内置管理员角色标识符!");
+                    throw new BusinessException("不允许修改系统内置管理员角色标识符!");
                 } else if (StringUtils.equalsAny(roleBo.getRoleKey(), keys)) {
-                    throw new ServiceException("不允许使用系统内置管理员角色标识符!");
+                    throw new BusinessException("不允许使用系统内置管理员角色标识符!");
                 }
             }
         }
@@ -334,7 +334,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
         role.setRoleId(roleId);
         List<SysRoleVo> roles = SpringUtils.getAopProxy(this).selectRoleList(role);
         if (CollUtil.isEmpty(roles)) {
-            throw new ServiceException("没有权限访问角色数据!");
+            throw new BusinessException("没有权限访问角色数据!");
         }
     }
 
@@ -392,7 +392,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
         Long roleId = role.getRoleId();
         String status = role.getStatus();
         if (UserConstants.ROLE_DISABLE.equals(status) && userRoleService.countUserRoleByRoleId(roleId) > 0) {
-            throw new ServiceException("角色已分配,不能禁用!");
+            throw new BusinessException("角色已分配,不能禁用!");
         }
 
         // 修改角色信息
@@ -480,7 +480,7 @@ public class SysRoleServiceImpl extends BaseServiceImpl<SysRoleMapper, SysRole>
             checkRoleDataScope(roleId);
             SysRoleVo role = selectRoleById(roleId);
             if (userRoleService.countUserRoleByRoleId(roleId) > 0) {
-                throw new ServiceException(String.format("%1$s已分配,不能删除!", role.getRoleName()));
+                throw new BusinessException(String.format("%1$s已分配,不能删除!", role.getRoleName()));
             }
         }
         // 删除角色与菜单关联

+ 2 - 2
eco-modules/system/src/main/java/org/eco/system/service/impl/SysTenantPackageServiceImpl.java

@@ -7,7 +7,7 @@ import org.eco.system.domain.bo.SysTenantPackageBo;
 import org.eco.system.domain.vo.SysTenantPackageVo;
 import org.eco.common.core.constant.TenantConstants;
 import org.eco.common.core.core.page.PageResult;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.utils.MapstructUtils;
 import org.eco.common.core.utils.StringUtils;
 import org.eco.common.orm.core.page.PageQuery;
@@ -178,7 +178,7 @@ public class SysTenantPackageServiceImpl extends BaseServiceImpl<SysTenantPackag
         if (isValid) {
             boolean exists = tenantMapper.selectCountByQuery(query().where(SYS_TENANT.PACKAGE_ID.in(List.of(packageIds)))) > 0;
             if (exists) {
-                throw new ServiceException("租户套餐已被使用");
+                throw new BusinessException("租户套餐已被使用");
             }
         }
         return this.removeByIds(Arrays.asList(packageIds));

+ 16 - 16
eco-modules/system/src/main/java/org/eco/system/service/impl/SysTenantServiceImpl.java

@@ -21,7 +21,7 @@ import org.eco.common.core.constant.CacheNames;
 import org.eco.common.core.constant.Constants;
 import org.eco.common.core.constant.TenantConstants;
 import org.eco.common.core.core.page.PageResult;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.utils.MapstructUtils;
 import org.eco.common.core.utils.SpringUtils;
 import org.eco.common.core.utils.StringUtils;
@@ -168,7 +168,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
         return TenantHelper.ignore(() -> {
             SysTenant sysTenant = MapstructUtils.convert(sysTenantBo, SysTenant.class);
             if (ObjectUtil.isNull(sysTenant)) {
-                throw new ServiceException("新增租户参数为空");
+                throw new BusinessException("新增租户参数为空");
             }
             Long loginUserId = LoginHelper.getUserId();
             Date createTime = new Date();
@@ -178,7 +178,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
             sysTenant.setUpdateTime(createTime);
             boolean inserted = this.save(sysTenant);
             if (!inserted) {
-                throw new ServiceException("新增租户失败");
+                throw new BusinessException("新增租户失败");
             }
             Long tenantId = sysTenant.getTenantId();
 
@@ -195,7 +195,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
             dept.setDelFlag(0);//0 代表存在
             int insertedDeptRows = deptMapper.insert(dept, true);
             if (insertedDeptRows != 1) {
-                throw new ServiceException("新增租户的部门记录失败");
+                throw new BusinessException("新增租户的部门记录失败");
             }
             Long deptId = dept.getDeptId();
 
@@ -205,7 +205,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
             roleDept.setDeptId(deptId);
             int insertedRoleDept = roleDeptMapper.insertWithPk(roleDept);
             if (insertedRoleDept != 1) {
-                throw new ServiceException("新增租户的角色部门记录失败");
+                throw new BusinessException("新增租户的角色部门记录失败");
             }
 
             // 新增系统用户
@@ -220,7 +220,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
             user.setUserType("sys_user");//sys_user是系统用户
             int insertedUser = userMapper.insert(user, true);
             if (insertedUser != 1) {
-                throw new ServiceException("新增租户的用户记录失败");
+                throw new BusinessException("新增租户的用户记录失败");
             }
 
             // 用户和角色关联表
@@ -229,7 +229,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
             userRole.setRoleId(roleId);
             int insertedUserRole = userRoleMapper.insertWithPk(userRole);
             if (insertedUserRole != 1) {
-                throw new ServiceException("新增租户的用户角色记录失败");
+                throw new BusinessException("新增租户的用户角色记录失败");
             }
 
             // 增加字典记录
@@ -284,7 +284,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
         // 获取租户套餐
         SysTenantPackageVo tenantPackageVo = tenantPackageService.selectById(packageId);
         if (ObjectUtil.isNull(tenantPackageVo)) {
-            throw new ServiceException("套餐不存在");
+            throw new BusinessException("套餐不存在");
         }
         // 获取套餐菜单id
         List<Long> menuIds = StringUtils.splitTo(tenantPackageVo.getMenuIds(), Convert::toLong);
@@ -300,14 +300,14 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
         role.setDataScope("1");//默认1:全部数据权限
         int insertedRows = roleMapper.insert(role, true);
         if (insertedRows != 1) {
-            throw new ServiceException("添加租户管理员角色记录失败!");
+            throw new BusinessException("添加租户管理员角色记录失败!");
         }
         Long roleId = role.getRoleId();
         role.setMenuIds(menuIds.toArray(new Long[menuIds.size()]));
         //新增角色菜单记录
         boolean insertedRoleMenu = roleService.insertRoleMenu(role);
         if (!insertedRoleMenu) {
-            throw new ServiceException("添加租户管理员的角色菜单记录失败!");
+            throw new BusinessException("添加租户管理员的角色菜单记录失败!");
         }
 
         return roleId;
@@ -323,7 +323,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
         return TenantHelper.ignore(() -> {
             SysTenant tenant = MapstructUtils.convert(sysTenantBo, SysTenant.class);
             if (ObjectUtil.isNull(tenant)) {
-                throw new ServiceException("租户的参数为空!");
+                throw new BusinessException("租户的参数为空!");
             }
 
             //如果更换了套餐,则需要同步套餐sys_role_menu表
@@ -331,7 +331,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
             if (!oldTenantVo.getPackageId().equals(tenant.getPackageId())) {
                 boolean synced = syncTenantPackage(tenant.getTenantId(), tenant.getPackageId());
                 if (!synced) {
-                    throw new ServiceException("同步套餐失败!");
+                    throw new BusinessException("同步套餐失败!");
                 }
             }
 
@@ -372,7 +372,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
     @Override
     public void checkTenantAllowed(Long tenantId) {
         if (ObjectUtil.isNotNull(tenantId) && TenantConstants.DEFAULT_TENANT_ID.equals(tenantId)) {
-            throw new ServiceException("不允许操作超级管理员租户");
+            throw new BusinessException("不允许操作超级管理员租户");
         }
     }
 
@@ -385,7 +385,7 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
         if (isValid) {
             // 做一些业务上的校验,判断是否需要校验
             if (tenantIds.contains(TenantConstants.SUPER_ADMIN_ID)) {
-                throw new ServiceException("超级管理员租户不能删除");
+                throw new BusinessException("超级管理员租户不能删除");
             }
         }
         return TenantHelper.ignore(() -> this.removeByIds(tenantIds));//逻辑删除
@@ -445,13 +445,13 @@ public class SysTenantServiceImpl extends BaseServiceImpl<SysTenantMapper, SysTe
                     if (TenantConstants.TENANT_ADMIN_ROLE_KEY.equals(role.getRoleKey())) {
                         int deletedRoleMenu = roleMenuMapper.deleteByQuery(QueryWrapper.create().from(SYS_ROLE_MENU).where(SYS_ROLE_MENU.ROLE_ID.eq(role.getRoleId())));
                         if (deletedRoleMenu == 0) {
-                            throw new ServiceException("删除租户的角色菜单记录失败!");
+                            throw new BusinessException("删除租户的角色菜单记录失败!");
                         }
 
                         role.setMenuIds(menuIds.toArray(new Long[menuIds.size()]));
                         boolean insertedRoleMenu = roleService.insertRoleMenu(role);
                         if (!insertedRoleMenu) {
-                            throw new ServiceException("添加租户管理员的角色菜单记录失败!");
+                            throw new BusinessException("添加租户管理员的角色菜单记录失败!");
                         }
                     } else {
                         roleIds.add(role.getRoleId());

+ 5 - 5
eco-modules/system/src/main/java/org/eco/system/service/impl/SysUserServiceImpl.java

@@ -12,7 +12,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.eco.common.core.constant.CacheNames;
 import org.eco.common.core.constant.UserConstants;
 import org.eco.common.core.core.page.PageResult;
-import org.eco.common.core.exception.ServiceException;
+import org.eco.common.core.exception.BusinessException;
 import org.eco.common.core.service.UserService;
 import org.eco.common.core.utils.MapstructUtils;
 import org.eco.common.core.utils.SpringUtils;
@@ -391,7 +391,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
     @Override
     public void checkUserAllowed(Long userId) {
         if (ObjectUtil.isNotNull(userId) && LoginHelper.isSuperAdmin(userId)) {
-            throw new ServiceException("不允许操作超级管理员用户");
+            throw new BusinessException("不允许操作超级管理员用户");
         }
     }
 
@@ -413,7 +413,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
         user.setUserId(userId);
         List<SysUserVo> users = SpringUtils.getAopProxy(this).selectUserList(user);
         if (StringUtils.isEmpty(users)) {
-            throw new ServiceException("没有权限访问用户数据!");
+            throw new BusinessException("没有权限访问用户数据!");
         }
     }
 
@@ -638,7 +638,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
     @Override
     public String importUser(List<SysUser> userList, Boolean isUpdateSupport, Long operId) {
         if (StringUtils.isNull(userList) || userList.isEmpty()) {
-            throw new ServiceException("导入用户数据不能为空!");
+            throw new BusinessException("导入用户数据不能为空!");
         }
         int successNum = 0;
         int failureNum = 0;
@@ -679,7 +679,7 @@ public class SysUserServiceImpl extends BaseServiceImpl<SysUserMapper, SysUser>
         }
         if (failureNum > 0) {
             failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
-            throw new ServiceException(failureMsg.toString());
+            throw new BusinessException(failureMsg.toString());
         } else {
             successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
         }

+ 2 - 2
eco-start/src/main/java/org/eco/web/service/IAuthStrategy.java

@@ -1,8 +1,8 @@
 package org.eco.web.service;
 
 
+import org.eco.common.core.exception.BusinessException;
 import org.eco.web.domain.vo.LoginVo;
-import org.eco.common.core.exception.ServiceException;
 import org.eco.common.core.utils.SpringUtils;
 import org.eco.system.domain.SysClient;
 
@@ -22,7 +22,7 @@ public interface IAuthStrategy {
         // 授权类型和客户端id
         String beanName = grantType + BASE_NAME;
         if (!SpringUtils.containsBean(beanName)) {
-            throw new ServiceException("授权类型不正确!");
+            throw new BusinessException("授权类型不正确!");
         }
         IAuthStrategy instance = SpringUtils.getBean(beanName);
         return instance.login(body, client);