From 7b99c4d1c5209622b786063c67019ba9848e9195 Mon Sep 17 00:00:00 2001 From: chenlw <874313221@qq.com> Date: Mon, 19 Dec 2016 16:34:37 +0800 Subject: [PATCH] =?UTF-8?q?excel=E5=AF=BC=E5=85=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PreDataInfoServiceImpl.java | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/com/platform/service/impl/PreDataInfoServiceImpl.java b/src/com/platform/service/impl/PreDataInfoServiceImpl.java index bb279a1f..078c37fc 100644 --- a/src/com/platform/service/impl/PreDataInfoServiceImpl.java +++ b/src/com/platform/service/impl/PreDataInfoServiceImpl.java @@ -71,8 +71,8 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService { public Map importExcel(List paths) throws Exception { Map errmap = new HashMap(); List errArea = new ArrayList(); - List errFile = new ArrayList(); - ArrayList rowErr = new ArrayList(); + List> errFile = new ArrayList>(); + List> rowErr = new ArrayList>(); // 待增加的 List all2Insert = new ArrayList(); //excel读出的 所有 @@ -89,7 +89,7 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService { XSSFWorkbook workbook = null; File tmpf = new File(filePath + ".temp"); File f = new File(filePath); - String errMsg= "] 读取失败,请使用标准的excel模板,编辑后再导入"; + String errMsg= "读取失败,请使用标准的excel模板,编辑后再导入"; // file.temp 文件存在 if (tmpf.exists()) { //删除 file @@ -98,14 +98,20 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService { } catch (Exception e) { log.error("["+filePath+ errMsg); log.error(e); - errFile.add("["+tmpf.getName()+errMsg); + Map map = new HashMap(); + map.put("name", tmpf.getName()); + map.put("value", errMsg); + errFile.add((HashMap) map); continue; } } else { if (!f.exists()) { log.error(filePath + ",文件 不存在!"); - errFile.add(f.getName()+ ",文件 不存在!"); + Map map = new HashMap(); + map.put("name", f.getName()); + map.put("value", "文件 不存在!"); + errFile.add((HashMap) map); continue; } else { @@ -114,7 +120,10 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService { } catch (Exception e) { log.error("["+filePath+errMsg); log.error(e); - errFile.add("["+f.getName()+errMsg); + Map map = new HashMap(); + map.put("name", f.getName()); + map.put("value", errMsg); + errFile.add((HashMap) map); continue; } } @@ -157,7 +166,7 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService { } if (errFile.size() > 0) { if (errmap.containsKey("err")) { - errFile.addAll((Collection) errmap.get("err")); + errFile.addAll( (Collection>) errmap.get("err")); } errmap.put("err",errFile); }