|
@ -234,8 +234,36 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao |
|
|
*/ |
|
|
*/ |
|
|
@Override |
|
|
@Override |
|
|
@Async |
|
|
@Async |
|
|
public void neighborhoodImport(ImportInfoFormDTO formDTO, MultipartFile file,Result<ImportTaskCommonResultDTO> importTask) throws IOException { |
|
|
public Result neighborhoodImport(ImportInfoFormDTO formDTO, MultipartFile file,Result<ImportTaskCommonResultDTO> importTask) throws IOException { |
|
|
importNeighbor(formDTO,file,importTask); |
|
|
// importNeighbor(formDTO,file,importTask);
|
|
|
|
|
|
ExcelReader excelReader = null; |
|
|
|
|
|
try { |
|
|
|
|
|
InputStream inputStream = null; |
|
|
|
|
|
try { |
|
|
|
|
|
inputStream = file.getInputStream(); |
|
|
|
|
|
} catch (IOException e) { |
|
|
|
|
|
return new Result<String>().error("读取文件失败"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
excelReader = EasyExcel.read(inputStream).build(); |
|
|
|
|
|
// 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener
|
|
|
|
|
|
ReadSheet readSheet = EasyExcel.readSheet(0).head(NeighborHoodInfoModel.class) |
|
|
|
|
|
.registerReadListener(new ImportNeighborHoodInfoListener(formDTO,icHouseRedis,icBuildingDao,this,propertyManagementDao,epmetCommonServiceOpenFeignClient,importTask.getData().getTaskId())) |
|
|
|
|
|
.build(); |
|
|
|
|
|
excelReader.read(readSheet); |
|
|
|
|
|
} catch (Exception e){ |
|
|
|
|
|
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); |
|
|
|
|
|
input.setOperatorId(formDTO.getUserId()); |
|
|
|
|
|
input.setTaskId(importTask.getData().getTaskId()); |
|
|
|
|
|
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); |
|
|
|
|
|
epmetCommonServiceOpenFeignClient.finishImportTask(input); |
|
|
|
|
|
} finally { |
|
|
|
|
|
if (excelReader != null) { |
|
|
|
|
|
excelReader.finish(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new Result<>(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|