蔡德晨 5 năm trước cách đây
mục cha
commit
9e9338be4d

+ 5 - 9
src/main/java/com/jeeplus/modules/sg/project/web/ProjectController.java

@@ -120,10 +120,9 @@ public class ProjectController extends BaseController {
      */
     @RequestMapping("/import")
     public String importFile(MultipartFile file,WbsItem wbsItem, RedirectAttributes redirectAttributes, HttpServletRequest request, Model model) throws IOException, InvalidFormatException {
-//        String type = wbsItem.getType();   //项目类型
         String id = getId();
         wbsItem.setId(id);
-//        try {
+        try {
            //判断结算数类型并保存数据到数据库
              String str = projectService.save(file,wbsItem);
              if(str.equals(BashInfo.INVALIDFORMAT)){
@@ -131,13 +130,10 @@ public class ProjectController extends BaseController {
              }
              addMessage(redirectAttributes, "导入成功");
              return "redirect:/a/jkxl/list?id="+id+"&type="+str;
-//        } catch (RuntimeException e) {
-//            addMessage(redirectAttributes, "导入失败,"+e.getMessage());
-//            return "redirect:/a/project/list";
-//        }   catch (Exception e){
-//            addMessage(redirectAttributes, "导入失败");
-//            return "redirect:/a/project/list";
-//        }
+        }   catch (Exception e){
+            addMessage(redirectAttributes, "导入失败,"+e.getMessage());
+            return "redirect:/a/project/list";
+        }
     }
 
     //导出

+ 2 - 10
src/main/java/com/jeeplus/modules/sg/project/web/ProjectTemController.java

@@ -99,14 +99,9 @@ public class ProjectTemController extends BaseController {
                     throw new RuntimeException(str);
                 }
             }
-        } catch (RuntimeException e) {
-            map.put("code",0);
-            map.put("msg","导入失败,"+fileName+e.getMessage());
-            projectService.delete(wbsProject);
-            return map;
         }  catch (Exception e){
             map.put("code",0);
-            map.put("msg","导入失败");
+            map.put("msg","导入失败,"+fileName+e.getMessage());
             projectService.delete(wbsProject);
             return map;
         }
@@ -133,11 +128,8 @@ public class ProjectTemController extends BaseController {
             }
             addMessage(redirectAttributes, "导入成功");
             return "redirect:/a/jkxl/list?id="+id+"&type="+str+"&projectId="+projectId;
-        } catch (RuntimeException e) {
-            addMessage(redirectAttributes, "导入失败,"+e.getMessage());
-            return "redirect:/a/project/tem/list?projectId="+projectId;
         }   catch (Exception e){
-            addMessage(redirectAttributes, "导入失败");
+            addMessage(redirectAttributes, "导入失败,"+e.getMessage());
             return "redirect:/a/project/tem/list?projectId="+projectId;
         }
     }