From 99163b8f094d63eb075f0e056dcf9fbad42e6efd Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 22 Jun 2022 19:04:20 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AF=BC=E5=85=A5end?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/excel/EnterpriseImportExcelDTO.java | 8 ++++---- .../excel/handler/IcEnterpriseExcelImportListener.java | 8 ++++---- .../com/epmet/service/impl/IcEnterpriseServiceImpl.java | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java index c3a666b4ba..8507192422 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/EnterpriseImportExcelDTO.java @@ -69,22 +69,22 @@ public class EnterpriseImportExcelDTO { public static class ErrorRow { @ColumnWidth(20) - @ExcelProperty(value = "1场所类型") + @ExcelProperty(value = "场所类型") private String placeTypeName; @ColumnWidth(20) - @ExcelProperty(value = "2场所区域") + @ExcelProperty(value = "场所区域") private String gridName; @ColumnWidth(20) - @ExcelProperty(value = "3场所名称") + @ExcelProperty(value = "场所名称") private String placeOrgName; /** * 场所地址 */ @ColumnWidth(30) - @ExcelProperty(value = "4场所地址") + @ExcelProperty(value = "场所地址") private String address; @ColumnWidth(20) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcEnterpriseExcelImportListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcEnterpriseExcelImportListener.java index 5263746016..65b5cda5f0 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcEnterpriseExcelImportListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcEnterpriseExcelImportListener.java @@ -12,7 +12,6 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.entity.IcEnterpriseEntity; import com.epmet.excel.EnterpriseImportExcelDTO; import com.epmet.service.impl.IcEnterpriseServiceImpl; -import lombok.Data; import lombok.extern.slf4j.Slf4j; import java.util.ArrayList; @@ -57,19 +56,20 @@ public class IcEnterpriseExcelImportListener implements ReadListener gridMap=gridList.stream().collect(Collectors.toMap(GridListResultDTO::getGridName,GridListResultDTO::getGridId)); - IcEnterpriseExcelImportListener listener = new IcEnterpriseExcelImportListener(customerId,staffInfo, this,placeTypeMap,scaleMap,gridMap); - EasyExcel.read(filePath.toFile(), EnterpriseImportExcelDTO.class, listener).headRowNumber(2).sheet(0).doRead(); + IcEnterpriseExcelImportListener listener = new IcEnterpriseExcelImportListener(customerId,staffInfo, this,placeTypeMap,scaleMap,gridMap); + EasyExcel.read(filePath.toFile(), EnterpriseImportExcelDTO.class, listener).headRowNumber(1).sheet(0).doRead(); Path errorDescFile = null; String errorDesFileUrl = null; From e46c88fc4f826111391bb7dac97cb46132a687bb Mon Sep 17 00:00:00 2001 From: wangxianzhang Date: Wed, 22 Jun 2022 21:43:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?if=5Fhouse=EF=BC=9A=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E8=A1=A5=E5=85=85orgIdPath=E7=9A=84=E6=8E=A5=E5=8F=A3:POST=20/?= =?UTF-8?q?gov/org/agency/orgIdPathInit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/HouseController.java | 10 +++++ .../java/com/epmet/service/HouseService.java | 2 + .../epmet/service/impl/HouseServiceImpl.java | 45 +++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java index da97859fb9..0e556df1ea 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java @@ -569,4 +569,14 @@ public class HouseController implements ResultDataResolver { return houseService.getHomeInfoByHouseCode(dto); } + /** + * 初始化房屋的组织ID路径 + * @return + */ + @PostMapping("orgIdPathInit") + public Result orgIdPathInit() { + houseService.orgIdPathInit(); + return new Result(); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java index 04c0fc819c..a5c940b0c1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java @@ -173,4 +173,6 @@ public interface HouseService { * @return com.epmet.commons.tools.utils.Result */ Result getHomeInfoByHouseCode(HouseInfoFormDTO dto); + + void orgIdPathInit(); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index 7b551f0515..f6a79dde4f 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -5,6 +5,7 @@ import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelReader; import com.alibaba.excel.read.metadata.ReadSheet; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; @@ -1082,5 +1083,49 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { return new Result().ok(house); } + @Override + public void orgIdPathInit() { + // 循环查询所有没有fullname字段的数据 + LambdaQueryWrapper query = new LambdaQueryWrapper<>(); + query.eq(IcHouseEntity::getId, "1508686441788137474"); + //query.isNull(IcHouseEntity::getOrgIdPath); + //query.last(" limit 1000 "); + + while (true) { + List houses2Dispose = icHouseDao.selectList(query); + + if (org.apache.commons.collections4.CollectionUtils.isEmpty(houses2Dispose)) { + break; + } + + houses2Dispose.stream().forEach(h -> { + IcNeighborHoodDTO neighborhood = neighborHoodService.get(h.getNeighborHoodId()); + ArrayList pidList = new ArrayList<>(); + recureAppendParentAgencyId(neighborhood.getAgencyId(), pidList); + String orgIdPath = String.join(":", pidList); + + // 更新 + IcHouseEntity house = new IcHouseEntity(); + house.setId(h.getId()); + house.setOrgIdPath(orgIdPath); + + icHouseDao.updateById(house); + }); + } + } + /** + * 递归拼接orgIdPath + * @param agencyId + * @param result + */ + private void recureAppendParentAgencyId(String agencyId, List result) { + result.add(0, agencyId); + CustomerAgencyEntity agency = customerAgencyDao.selectById(agencyId); + String pid = agency.getPid(); + if (StringUtils.isBlank(pid) || "0".equals(pid)) { + return; + } + recureAppendParentAgencyId(pid, result); + } }