excel导入

web_backend_develope
chenlw 8 years ago
parent 39171057dd
commit fa7f06433d

@ -88,16 +88,16 @@ 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
try {
workbook = new XSSFWorkbook(tmpf);
} catch (Exception e) {
log.error(filePath+ errMsg);
log.error("["+filePath+ errMsg);
log.error(e);
errFile.add(tmpf.getName()+errMsg);
errFile.add("["+tmpf.getName()+errMsg);
continue;
}
}
@ -111,9 +111,9 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
try {
workbook = new XSSFWorkbook(f);
} catch (Exception e) {
log.error(filePath+errMsg);
log.error("["+filePath+errMsg);
log.error(e);
errFile.add(f.getName()+errMsg);
errFile.add("["+f.getName()+errMsg);
continue;
}
}
@ -123,7 +123,7 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
PreDataInfo pre = new PreDataInfo();
//excel数据 --> java bean
@SuppressWarnings("unchecked")
List<PreDataInfo> subPreData = ExcelOperation.readExcel4Update(workbook, Constant.EXCEL_TEMPLATE_INIT_ROW, 0, f.getName(), rowErr,pre, "id", "dataId", "workRange","sysCode","updateTime","userTablespaceStatus", "checkoutIndicateStatus", "checkoutPayStatus", "userTablespacePath", "checkoutIndicatePath", "checkoutPayPath", "sqlList", "dataVersion", "collectingTime", "collUpdate");
List<PreDataInfo> subPreData = ExcelOperation.readExcel4Update(workbook, Constant.EXCEL_TEMPLATE_INIT_ROW, 0, "["+f.getName()+"] ", rowErr,pre, "id", "dataId", "workRange","sysCode","updateTime","userTablespaceStatus", "checkoutIndicateStatus", "checkoutPayStatus", "userTablespacePath", "checkoutIndicatePath", "checkoutPayPath", "sqlList", "dataVersion", "collectingTime", "collUpdate");
if (null != subPreData && subPreData.size() > 0) {
// 是否是 同一个县区的 系统--是则 加入
boolean isSameArea = true;
@ -163,6 +163,9 @@ public class PreDataInfoServiceImpl implements IPreDataInfoService {
// if (errArea.size() > 0) {
// errmap.put("areaUnImport", errArea);
// }
if (errmap.containsKey("err")) {
return errmap;
}
//根据 操作 类别 分类(修改, 新增行政区划,新增信息系统)
if (all.size() > 0) {
for (PreDataInfo preDataInfo : all) {

Loading…
Cancel
Save