Browse Source

发下开发试试吧

master
yinzuomei 3 years ago
parent
commit
9176a251e4
  1. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelPoiUtils.java
  2. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelPoiUtils.java

@ -238,7 +238,7 @@ public class ExcelPoiUtils {
params.setTitleRows(titleRows);
params.setHeadRows(headerRows);
params.setSaveUrl("/tmp/excel/");
params.setNeedSave(false);
params.setNeedSave(true);
try {
// return ExcelImportUtil.importExcel(inputStream, pojoClass, params);
return (new ExcelImportService()).importExcelByIs(inputStream, pojoClass, params, false);

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java

@ -510,8 +510,9 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
List<CommunitySelfOrgImportExcel> fileList = new ArrayList<>();
CommunitySelfOrgImportExcel excel = null;
//1.读取Excel数据
ExcelImportResult<ImportCommunitySelfOrganization> testExcelImportResult = ExcelPoiUtils.importExcelMore(inputStream,0,2,ImportCommunitySelfOrganization.class);
ExcelImportResult<ImportCommunitySelfOrganization> testExcelImportResult = ExcelPoiUtils.importExcel1(inputStream,0,2,ImportCommunitySelfOrganization.class);
//2.存在错误行数据时存入错误数据集合中
if(CollectionUtils.isNotEmpty(testExcelImportResult.getFailList())){
for (ImportCommunitySelfOrganization entity : testExcelImportResult.getFailList()) {
//打印失败的行 和失败的信息
log.warn("第{}行,{}", entity.getRowNum(), entity.getErrorMsg());
@ -521,6 +522,7 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
excel.setErrorInfo(entity.getErrorMsg());
fileList.add(excel);
}
}
//正确行数据集合
List<ImportCommunitySelfOrganization> list = testExcelImportResult.getList();
if (CollectionUtils.isNotEmpty(list)){

Loading…
Cancel
Save