|
|
@ -3,6 +3,7 @@ package com.epmet.service.impl; |
|
|
|
import cn.afterturn.easypoi.excel.ExcelExportUtil; |
|
|
|
import cn.afterturn.easypoi.excel.annotation.Excel; |
|
|
|
import cn.afterturn.easypoi.excel.entity.ExportParams; |
|
|
|
import com.alibaba.excel.EasyExcel; |
|
|
|
import com.alibaba.excel.EasyExcelFactory; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
@ -206,10 +207,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
String errors = JSON.toJSONString(errorRows.get()); |
|
|
|
//String errors = JSON.toJSONString(errorRows.get());
|
|
|
|
//String skipeds = JSON.toJSONString(skipedRows.get());
|
|
|
|
|
|
|
|
log.error(errors); |
|
|
|
//log.error(errors);
|
|
|
|
//log.error(skipeds);
|
|
|
|
|
|
|
|
try { |
|
|
@ -252,7 +253,8 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
private Object importIcResiBaseInfoFromExcel(String excelPathName, int sheetNo, int headRowNumber, String currUserAgencyId, String currUserAgencyPids, String currentUserId, |
|
|
|
String tableName) { |
|
|
|
DynamicEasyExcelListener readListener = new DynamicEasyExcelListener(); |
|
|
|
EasyExcelFactory.read(new File(excelPathName)).registerReadListener(readListener).headRowNumber(headRowNumber).sheet(sheetNo).doRead(); |
|
|
|
//EasyExcelFactory.read(new File(excelPathName)).registerReadListener(readListener).headRowNumber(headRowNumber).sheet(sheetNo).doRead();
|
|
|
|
EasyExcel.read(new File(excelPathName)).registerReadListener(readListener).headRowNumber(headRowNumber).sheet(sheetNo).doRead(); |
|
|
|
|
|
|
|
List<Map<Integer, String>> headList = readListener.getHeadList(); |
|
|
|
List<Map<Integer, String>> dataList = readListener.getDataList(); |
|
|
@ -592,7 +594,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
} |
|
|
|
|
|
|
|
if (interupt) { |
|
|
|
throw new RenException(String.join(",", errorColumnNames) + "的值未填写"); |
|
|
|
throw new RenException(String.join(",", errorColumnNames) + "的值未填写,或者所填写信息在系统中未找到"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -918,15 +920,16 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res |
|
|
|
//public static final ThreadLocal<Map<String, List<ErrorRow>>> errorRows = new ThreadLocal<>();
|
|
|
|
|
|
|
|
String fileName = "导入失败条目清单.xls"; |
|
|
|
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); |
|
|
|
response.setHeader("content-Type", "application/vnd.ms-excel"); |
|
|
|
response.addHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(fileName, "UTF-8")); |
|
|
|
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(fileName, "UTF-8")); |
|
|
|
|
|
|
|
LinkedList<ErrorRow> list = new LinkedList<>(); |
|
|
|
for (Map.Entry<String, List<ErrorRow>> entry : errorRows.get().entrySet()) { |
|
|
|
list.addAll(entry.getValue()); |
|
|
|
} |
|
|
|
|
|
|
|
list.forEach(row -> {System.out.println(row.getTableName());row.setSheetName(IcResiUserTableEnums.getObjectByTableName(row.tableName).getTableComment());}); |
|
|
|
//list.forEach(row -> {System.out.println(row.getTableName());row.setSheetName(IcResiUserTableEnums.getObjectByTableName(row.tableName).getTableComment());});
|
|
|
|
|
|
|
|
Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的条目列表","导入失败"), |
|
|
|
ErrorRow.class, list); |
|
|
|