Browse Source

Merge remote-tracking branch 'remotes/origin/dev_ic_platform' into develop

dev_shibei_match
jianjun 4 years ago
parent
commit
eddc8e2c5b
  1. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcHouseExcel.java
  2. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  3. BIN
      epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_template.xlsx
  4. 2
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  5. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/IcHouseExcel.java

@ -95,7 +95,13 @@ public class IcHouseExcel extends ExcelVerifyInfo implements Serializable {
@Excel(name = "更新时间")
private Date updatedTime;*/
@Excel(name = "所属组织")
@NotBlank(message = "所属组织不能位空")
private String agencyName;
@Excel(name = "所属网格")
@NotBlank(message = "所属网格不能位空")
private String gridName;
@Excel(name = "所属小区")
@NotBlank(message = "小区名称不能位空")

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -17,9 +17,7 @@ import com.epmet.dto.form.IcHouseFormDTO;
import com.epmet.dto.form.ListIcNeighborHoodFormDTO;
import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.IcNeighborHoodResultDTO;
import com.epmet.entity.IcBuildingEntity;
import com.epmet.entity.IcHouseEntity;
import com.epmet.entity.IcNeighborHoodEntity;
import com.epmet.enums.HousePurposeEnums;
import com.epmet.enums.HouseRentFlagEnums;
import com.epmet.enums.HouseTypeEnums;
@ -202,9 +200,9 @@ public class HouseServiceImpl implements HouseService {
}
private List<IcHouseExcel> searchAllHouse(ListIcNeighborHoodFormDTO formDTO) {
IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
//IcNeighborHoodEntity neighbor = ConvertUtils.sourceToTarget(formDTO, IcNeighborHoodEntity.class);
//
//IcBuildingEntity building = ConvertUtils.sourceToTarget(formDTO, IcBuildingEntity.class);
IcHouseEntity house = ConvertUtils.sourceToTarget(formDTO, IcHouseEntity.class);

BIN
epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_template.xlsx

Binary file not shown.

2
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

@ -157,7 +157,7 @@
a.OWNER_ID_CARD as ownerIdCard,
b.BUILDING_NAME as buildingName,
c.NEIGHBOR_HOOD_NAME as neighborHoodName,
d.UNIT_NUM as unitName
d.UNIT_NUM as buildingUnit
from ic_house a
INNER JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0'
INNER JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID and c.DEL_FLAG = '0'

15
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

@ -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);

Loading…
Cancel
Save