tianwu.sun 3 miesięcy temu
rodzic
commit
7cdc5cb9b3

+ 6 - 0
src/main/java/com/bootdo/datas/controller/DataController.java

@@ -139,6 +139,9 @@ public class DataController {
             return R.ok();
         } catch (BDException e){
             return R.error(e.getMessage());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("导入失败");
         }
     }
 
@@ -430,6 +433,9 @@ public class DataController {
             return R.ok();
         } catch (BDException e){
             return R.error(e.getMessage());
+         } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("导入失败");
         }
     }
 

+ 6 - 0
src/main/java/com/bootdo/datas/controller/DataSendProvinceController.java

@@ -183,6 +183,9 @@ public class DataSendProvinceController {
             return R.ok();
         } catch (BDException e){
             return R.error(e.getMessage());
+        }  catch (Exception e) {
+            e.printStackTrace();
+            return R.error("导入失败");
         }
     }
 
@@ -230,6 +233,9 @@ public class DataSendProvinceController {
             return R.ok();
         } catch (BDException e){
             return R.error(e.getMessage());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("导入失败");
         }
     }
 

+ 6 - 0
src/main/java/com/bootdo/datas/controller/GyDataImportController.java

@@ -124,6 +124,9 @@ public class GyDataImportController {
             return R.ok("0");
         } catch (BDException e){
             return R.error(e.getMessage());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("导入失败");
         }
     }
 
@@ -252,6 +255,9 @@ public class GyDataImportController {
             return R.ok();
         } catch (BDException e){
             return R.error(e.getMessage());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return R.error("导入失败");
         }
     }
 

+ 2 - 2
src/main/java/com/bootdo/datas/service/GyDataService.java

@@ -16,9 +16,9 @@ public interface GyDataService {
 
     int countTotal(Map<String, Object> map);
 
-    String cipherTextImport(String decFlg,int type);
+    String cipherTextImport(String decFlg,int type) throws Exception;
 
-    String plainTextImport(MultipartFile file,int type);
+    String plainTextImport(MultipartFile file,int type) throws Exception;
 
     GyDataImportDTO get(Long id);
 

+ 5 - 9
src/main/java/com/bootdo/datas/service/impl/GyDataServiceImpl.java

@@ -175,7 +175,7 @@ public class GyDataServiceImpl implements GyDataService {
      * @date: 2022/9/7 14:28
      */
     @Override
-    public String cipherTextImport(String decFlg,int type) {
+    public String cipherTextImport(String decFlg,int type) throws Exception {
         File file = new File(decFlg);
         String result = null;
 
@@ -185,8 +185,6 @@ public class GyDataServiceImpl implements GyDataService {
             result = imp(is,type);
             // 清除临时数据
             FileUtil.deleteFile(decFlg);
-        } catch (Exception e) {
-            e.printStackTrace();
         } finally {
             try {
                 if (is != null) {
@@ -208,18 +206,13 @@ public class GyDataServiceImpl implements GyDataService {
      * @date: 2022/9/7 14:23
      */
     @Override
-    public String plainTextImport(MultipartFile file,int type) {
+    public String plainTextImport(MultipartFile file,int type) throws Exception {
 
         String result = null;
         InputStream is = null;
         try {
             is = file.getInputStream();
             result = imp(is,type);
-        } catch (BDException e) {
-            e.printStackTrace();
-            throw e;
-        } catch (Exception e) {
-            e.printStackTrace();
         } finally {
             try {
                 is.close();
@@ -243,6 +236,7 @@ public class GyDataServiceImpl implements GyDataService {
         List<GyUnitDO> gyUnitList = new ArrayList();
         // 数据目录
         List<GyDataDO> dataList = new ArrayList();
+
         // 用户信息
         UserDO currUser = ShiroUtils.getUser();
         log.info("currUser:" + currUser.toString());
@@ -313,6 +307,7 @@ public class GyDataServiceImpl implements GyDataService {
             // 数据信息
             GyDataDO gyDataDO = new GyDataDO();
 
+
             GyUnitDO tmpGyUnitDO = gyUnitDao.getGyUnitByCreditCode(row.getCell(17).getStringCellValue());
             //判断是否已经在gu_unit表中添加企业信息
             if (ObjectUtils.isEmpty(tmpGyUnitDO) ) {
@@ -517,6 +512,7 @@ public class GyDataServiceImpl implements GyDataService {
             }
             result = sb.toString();
         }
+
         return result;
     }