Browse Source

代码优化

gaodm 4 years ago
parent
commit
5f83cac15a
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/main/java/com/diagbot/util/ExcelUtils.java

+ 4 - 0
src/main/java/com/diagbot/util/ExcelUtils.java

@@ -148,9 +148,11 @@ public class ExcelUtils {
             list = ExcelImportUtil.importExcel(new File(filePath), pojoClass, params);
         } catch (NoSuchElementException e) {
             // throw new NormalException("模板不能为空");
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "模板不能为空");
         } catch (Exception e) {
             e.printStackTrace();
             // throw new NormalException(e.getMessage());
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "导入Excel异常");
         }
         return list;
     }
@@ -168,9 +170,11 @@ public class ExcelUtils {
             list = ExcelImportUtil.importExcel(file.getInputStream(), pojoClass, params);
         } catch (NoSuchElementException e) {
             // throw new NormalException("excel文件不能为空");
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "excel文件不能为空");
         } catch (Exception e) {
             // throw new NormalException(e.getMessage());
             System.out.println(e.getMessage());
+            throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "导入Excel异常");
         }
         return list;
     }