|
|
@ -4,7 +4,6 @@ import com.alibaba.excel.context.AnalysisContext; |
|
|
|
import com.alibaba.excel.event.AnalysisEventListener; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
@ -28,7 +27,6 @@ import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
@ -332,35 +330,43 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb |
|
|
|
|
|
|
|
@Override |
|
|
|
public void doAfterAllAnalysed(AnalysisContext context) { |
|
|
|
finalDispose(); |
|
|
|
// 删除缓存
|
|
|
|
icHouseRedis.delTemporaryCacheGrids(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
icHouseRedis.delTemporaryCacheNeighBorHood(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
icHouseRedis.delTemporaryCacheBuilding(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
icHouseRedis.delTemporaryCacheBuildingUnit(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
icHouseRedis.delTemporaryCacheHouses(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
// 放结果
|
|
|
|
icHouseRedis.setImportResultDTO(formDTO.getCustomerId(), formDTO.getUserId(), new ImportResultDTO(nums,num)); |
|
|
|
log.info("数据处理完毕,开始更新任务状态"); |
|
|
|
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); |
|
|
|
input.setOperatorId(formDTO.getUserId()); |
|
|
|
input.setTaskId(taskId); |
|
|
|
if (CollectionUtils.isEmpty(nums)){ |
|
|
|
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); |
|
|
|
epmetCommonServiceOpenFeignClient.finishImportTask(input); |
|
|
|
}else { |
|
|
|
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); |
|
|
|
if (!CollectionUtils.isEmpty(errorInfos)){ |
|
|
|
try { |
|
|
|
String s = neighborHoodService.orgGeneralImport(errorInfos, NeighborHoodErrorInfoModel.class); |
|
|
|
input.setResultDescFilePath(s); |
|
|
|
} catch (IOException e) { |
|
|
|
epmetCommonServiceOpenFeignClient.finishImportTask(input); |
|
|
|
e.printStackTrace(); |
|
|
|
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); |
|
|
|
try { |
|
|
|
finalDispose(); |
|
|
|
// 删除缓存
|
|
|
|
icHouseRedis.delTemporaryCacheGrids(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
icHouseRedis.delTemporaryCacheNeighBorHood(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
icHouseRedis.delTemporaryCacheBuilding(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
icHouseRedis.delTemporaryCacheBuildingUnit(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
icHouseRedis.delTemporaryCacheHouses(formDTO.getCustomerId(), formDTO.getUserId()); |
|
|
|
// 放结果
|
|
|
|
icHouseRedis.setImportResultDTO(formDTO.getCustomerId(), formDTO.getUserId(), new ImportResultDTO(nums,num)); |
|
|
|
log.info("数据处理完毕,开始更新任务状态"); |
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(nums)){ |
|
|
|
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); |
|
|
|
epmetCommonServiceOpenFeignClient.finishImportTask(input); |
|
|
|
}else { |
|
|
|
if (!CollectionUtils.isEmpty(errorInfos)){ |
|
|
|
try { |
|
|
|
String s = neighborHoodService.orgGeneralImport(errorInfos, NeighborHoodErrorInfoModel.class); |
|
|
|
if (s == null){ |
|
|
|
log.warn("doAfterAllAnalysed orgGeneralImport fail,return null,taskId:{}", taskId); |
|
|
|
} |
|
|
|
input.setResultDescFilePath(s); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("doAfterAllAnalysed orgGeneralImport exception", e); |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("任务状态更新完毕"); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.error("doAfterAllAnalysed exception", e); |
|
|
|
} finally { |
|
|
|
epmetCommonServiceOpenFeignClient.finishImportTask(input); |
|
|
|
log.info("任务状态更新完毕"); |
|
|
|
} |
|
|
|
log.info("任务DTO"+JSON.toJSONString(input)); |
|
|
|
} |
|
|
|