Browse Source

Merge remote-tracking branch 'origin/develop' into release_temp

dev
zxc 4 years ago
parent
commit
d723aec044
  1. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java
  2. 8
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java

@ -17,6 +17,7 @@
package com.epmet.controller; package com.epmet.controller;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
@ -37,6 +38,7 @@ import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcNeighborHoodService; import com.epmet.service.IcNeighborHoodService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -54,6 +56,7 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("icneighborhood") @RequestMapping("icneighborhood")
@Slf4j
public class IcNeighborHoodController { public class IcNeighborHoodController {
@Autowired @Autowired
@ -145,6 +148,7 @@ public class IcNeighborHoodController {
if (!importTask.success()){ if (!importTask.success()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"","存在进行中的导入"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"","存在进行中的导入");
} }
log.info("插入任务结果"+ JSON.toJSONString(importTask.getData()));
icNeighborHoodService.neighborhoodImport(formDTO,file,importTask); icNeighborHoodService.neighborhoodImport(formDTO,file,importTask);
return new Result(); return new Result();
} }

8
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java

@ -2,6 +2,7 @@ package com.epmet.model;
import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.excel.event.AnalysisEventListener;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
@ -23,6 +24,7 @@ import com.epmet.entity.IcPropertyManagementEntity;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.redis.IcHouseRedis; import com.epmet.redis.IcHouseRedis;
import com.epmet.service.IcNeighborHoodService; import com.epmet.service.IcNeighborHoodService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -38,6 +40,7 @@ import java.util.stream.Collectors;
* @DateTime 2022/2/15 2:16 下午 * @DateTime 2022/2/15 2:16 下午
* @DESC * @DESC
*/ */
@Slf4j
public class ImportNeighborHoodInfoListener extends AnalysisEventListener<NeighborHoodInfoModel> { public class ImportNeighborHoodInfoListener extends AnalysisEventListener<NeighborHoodInfoModel> {
List<Integer> nums = new ArrayList<>(); List<Integer> nums = new ArrayList<>();
@ -83,6 +86,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
} }
info = data; info = data;
num = num + NumConstant.ONE; num = num + NumConstant.ONE;
log.info("读数据"+num);
if (StringUtils.isBlank(data.getNeighborHoodName()) || if (StringUtils.isBlank(data.getNeighborHoodName()) ||
StringUtils.isBlank(data.getGridName()) || StringUtils.isBlank(data.getAgencyName()) || StringUtils.isBlank(data.getAddress())){ StringUtils.isBlank(data.getGridName()) || StringUtils.isBlank(data.getAgencyName()) || StringUtils.isBlank(data.getAddress())){
nums.add(num); nums.add(num);
@ -121,6 +125,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
if (num%NumConstant.ONE_HUNDRED == NumConstant.ZERO){ if (num%NumConstant.ONE_HUNDRED == NumConstant.ZERO){
finalDispose(); finalDispose();
} }
log.info("读数据"+num+"完毕");
} }
public void finalDispose(){ public void finalDispose(){
@ -336,6 +341,7 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
icHouseRedis.delTemporaryCacheHouses(formDTO.getCustomerId(), formDTO.getUserId()); icHouseRedis.delTemporaryCacheHouses(formDTO.getCustomerId(), formDTO.getUserId());
// 放结果 // 放结果
icHouseRedis.setImportResultDTO(formDTO.getCustomerId(), formDTO.getUserId(), new ImportResultDTO(nums,num)); icHouseRedis.setImportResultDTO(formDTO.getCustomerId(), formDTO.getUserId(), new ImportResultDTO(nums,num));
log.info("数据处理完毕,开始更新任务状态");
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
input.setOperatorId(formDTO.getUserId()); input.setOperatorId(formDTO.getUserId());
input.setTaskId(taskId); input.setTaskId(taskId);
@ -354,6 +360,8 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
} }
} }
epmetCommonServiceOpenFeignClient.finishImportTask(input); epmetCommonServiceOpenFeignClient.finishImportTask(input);
log.info("任务状态更新完毕");
} }
log.info("任务DTO"+JSON.toJSONString(input));
} }
} }

Loading…
Cancel
Save