|
|
|
@ -71,8 +71,8 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
|
|
|
|
public Map<String, Object> importExcel(List<String> paths) throws Exception {
|
|
|
|
|
Map<String, Object> errmap = new HashMap<String, Object>();
|
|
|
|
|
List<String> errArea = new ArrayList<String>();
|
|
|
|
|
List<String> errFile = new ArrayList<String>();
|
|
|
|
|
ArrayList<String> rowErr = new ArrayList<String>();
|
|
|
|
|
List<HashMap<String, Object>> errFile = new ArrayList<HashMap<String, Object>>();
|
|
|
|
|
List<HashMap<String, Object>> rowErr = new ArrayList<HashMap<String, Object>>();
|
|
|
|
|
// 待增加的
|
|
|
|
|
List<PreDataInfo> all2Insert = new ArrayList<PreDataInfo>();
|
|
|
|
|
//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<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
map.put("name", tmpf.getName());
|
|
|
|
|
map.put("value", errMsg);
|
|
|
|
|
errFile.add((HashMap<String, Object>) map);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (!f.exists()) {
|
|
|
|
|
log.error(filePath + ",文件 不存在!");
|
|
|
|
|
errFile.add(f.getName()+ ",文件 不存在!");
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
map.put("name", f.getName());
|
|
|
|
|
map.put("value", "文件 不存在!");
|
|
|
|
|
errFile.add((HashMap<String, Object>) 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<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
map.put("name", f.getName());
|
|
|
|
|
map.put("value", errMsg);
|
|
|
|
|
errFile.add((HashMap<String, Object>) map);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -157,7 +166,7 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
|
|
|
|
|
}
|
|
|
|
|
if (errFile.size() > 0) {
|
|
|
|
|
if (errmap.containsKey("err")) {
|
|
|
|
|
errFile.addAll((Collection<? extends String>) errmap.get("err"));
|
|
|
|
|
errFile.addAll( (Collection<? extends HashMap<String, Object>>) errmap.get("err"));
|
|
|
|
|
}
|
|
|
|
|
errmap.put("err",errFile);
|
|
|
|
|
}
|
|
|
|
|