diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcCityManagementExcelImportListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcCityManagementExcelImportListener.java index 8bbd73fed0..91199dfde1 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcCityManagementExcelImportListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcCityManagementExcelImportListener.java @@ -2,10 +2,12 @@ package com.epmet.excel.handler; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.read.listener.ReadListener; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dao.IcCityManagementDao; import com.epmet.dto.result.IcCoverageCategoryDictListResultDTO; import com.epmet.entity.IcCityManagementEntity; import com.epmet.excel.IcCityManagementExcel; @@ -13,9 +15,11 @@ import com.epmet.service.CoverageService; import com.epmet.service.impl.IcCityManagementServiceImpl; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -42,14 +46,19 @@ public class IcCityManagementExcelImportListener implements ReadListener otherRows = new ArrayList<>(); private IcCityManagementServiceImpl IcCityManagementServiceImpl; private CoverageService coverageService; + private IcCityManagementDao icCityManagementDao; + //存放当前组织下已存在的场所信息 + private Map existMap = null; - public IcCityManagementExcelImportListener(String currentUserId, String currentCustomerId, String currentAgencyId, String currentAgencyPids, IcCityManagementServiceImpl IcCityManagementServiceImpl, CoverageService coverageService) { + public IcCityManagementExcelImportListener(String currentUserId, String currentCustomerId, String currentAgencyId, String currentAgencyPids, + IcCityManagementServiceImpl IcCityManagementServiceImpl, CoverageService coverageService, IcCityManagementDao icCityManagementDao) { this.currentUserId = currentUserId; this.currentCustomerId = currentCustomerId; this.currentAgencyId = currentAgencyId; this.currentAgencyPids = currentAgencyPids; this.IcCityManagementServiceImpl = IcCityManagementServiceImpl; this.coverageService = coverageService; + this.icCityManagementDao = icCityManagementDao; } @Override @@ -59,6 +68,15 @@ public class IcCityManagementExcelImportListener implements ReadListener getExistMap(String agencyId) { + LambdaQueryWrapper tWrapper = new LambdaQueryWrapper<>(); + tWrapper.eq(IcCityManagementEntity::getAgencyId, agencyId); + List entityList = icCityManagementDao.selectList(tWrapper); + Map existMap = new HashMap<>(16); + if (CollectionUtils.isNotEmpty(entityList)) { + existMap = entityList.stream().collect(Collectors.toMap(IcCityManagementEntity::getName, IcCityManagementEntity::getId, (v1, v2) -> v1)); + } + return existMap; + } + /** * 执行持久化 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcPublicServiceExcelImportListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcPublicServiceExcelImportListener.java index b3da93cedd..b03764be92 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcPublicServiceExcelImportListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcPublicServiceExcelImportListener.java @@ -2,10 +2,12 @@ package com.epmet.excel.handler; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.read.listener.ReadListener; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dao.IcPublicServiceDao; import com.epmet.dto.result.IcCoverageCategoryDictListResultDTO; import com.epmet.entity.IcPublicServiceEntity; import com.epmet.excel.IcPublicServiceExcel; @@ -13,9 +15,11 @@ import com.epmet.service.CoverageService; import com.epmet.service.impl.IcPublicServiceServiceImpl; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -42,14 +46,19 @@ public class IcPublicServiceExcelImportListener implements ReadListener otherRows = new ArrayList<>(); private IcPublicServiceServiceImpl IcPublicServiceServiceImpl; private CoverageService coverageService; + private IcPublicServiceDao icPublicServiceDao; + //存放当前组织下已存在的场所信息 + private Map existMap = null; - public IcPublicServiceExcelImportListener(String currentUserId, String currentCustomerId, String currentAgencyId, String currentAgencyPids, IcPublicServiceServiceImpl IcPublicServiceServiceImpl, CoverageService coverageService) { + public IcPublicServiceExcelImportListener(String currentUserId, String currentCustomerId, String currentAgencyId, String currentAgencyPids, + IcPublicServiceServiceImpl IcPublicServiceServiceImpl, CoverageService coverageService, IcPublicServiceDao icPublicServiceDao) { this.currentUserId = currentUserId; this.currentCustomerId = currentCustomerId; this.currentAgencyId = currentAgencyId; this.currentAgencyPids = currentAgencyPids; this.IcPublicServiceServiceImpl = IcPublicServiceServiceImpl; this.coverageService = coverageService; + this.icPublicServiceDao = icPublicServiceDao; } @Override @@ -59,6 +68,15 @@ public class IcPublicServiceExcelImportListener implements ReadListener getExistMap(String agencyId) { + LambdaQueryWrapper tWrapper = new LambdaQueryWrapper<>(); + tWrapper.eq(IcPublicServiceEntity::getAgencyId, agencyId); + List entityList = icPublicServiceDao.selectList(tWrapper); + Map existMap = new HashMap<>(16); + if (CollectionUtils.isNotEmpty(entityList)) { + existMap = entityList.stream().collect(Collectors.toMap(IcPublicServiceEntity::getName, IcPublicServiceEntity::getId, (v1, v2) -> v1)); + } + return existMap; + } + /** * 执行持久化 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcSuperiorResourceExcelImportListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcSuperiorResourceExcelImportListener.java index 7317cdc5b1..178809ef42 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcSuperiorResourceExcelImportListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/excel/handler/IcSuperiorResourceExcelImportListener.java @@ -2,22 +2,24 @@ package com.epmet.excel.handler; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.read.listener.ReadListener; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dao.IcSuperiorResourceDao; import com.epmet.dto.result.IcCoverageCategoryDictListResultDTO; -import com.epmet.dto.result.IcSuperiorResourceListResultDTO; import com.epmet.entity.IcSuperiorResourceEntity; import com.epmet.excel.IcSuperiorResourceExcel; import com.epmet.service.CoverageService; import com.epmet.service.impl.IcSuperiorResourceServiceImpl; import lombok.Data; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -44,14 +46,20 @@ public class IcSuperiorResourceExcelImportListener implements ReadListener otherRows = new ArrayList<>(); private IcSuperiorResourceServiceImpl icSuperiorResourceServiceImpl; private CoverageService coverageService; + private IcSuperiorResourceDao icSuperiorResourceDao; + //存放当前组织下已存在的场所信息 + private Map existMap = null; - public IcSuperiorResourceExcelImportListener(String currentUserId, String currentCustomerId, String currentAgencyId, String currentAgencyPids, IcSuperiorResourceServiceImpl icSuperiorResourceServiceImpl, CoverageService coverageService) { + + public IcSuperiorResourceExcelImportListener(String currentUserId, String currentCustomerId, String currentAgencyId, String currentAgencyPids, + IcSuperiorResourceServiceImpl icSuperiorResourceServiceImpl, CoverageService coverageService, IcSuperiorResourceDao icSuperiorResourceDao) { this.currentUserId = currentUserId; this.currentCustomerId = currentCustomerId; this.currentAgencyId = currentAgencyId; this.currentAgencyPids = currentAgencyPids; this.icSuperiorResourceServiceImpl = icSuperiorResourceServiceImpl; this.coverageService = coverageService; + this.icSuperiorResourceDao = icSuperiorResourceDao; } @Override @@ -61,6 +69,15 @@ public class IcSuperiorResourceExcelImportListener implements ReadListener getExistMap(String agencyId) { + LambdaQueryWrapper tWrapper = new LambdaQueryWrapper<>(); + tWrapper.eq(IcSuperiorResourceEntity::getAgencyId, agencyId); + List entityList = icSuperiorResourceDao.selectList(tWrapper); + Map existMap = new HashMap<>(16); + if (CollectionUtils.isNotEmpty(entityList)) { + existMap = entityList.stream().collect(Collectors.toMap(IcSuperiorResourceEntity::getName, IcSuperiorResourceEntity::getId, (v1, v2) -> v1)); + } + return existMap; + } + /** * 执行持久化 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcCityManagementServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcCityManagementServiceImpl.java index 198c14f01d..526ef118cc 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcCityManagementServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcCityManagementServiceImpl.java @@ -74,6 +74,8 @@ public class IcCityManagementServiceImpl extends BaseServiceImpl