From c469db25d29deba57baa5d058bcfc399f1dab62a Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 22 Jun 2022 13:51:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B1=85=E6=B0=91=E4=BF=A1=E6=81=AF=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=20=E5=85=BC=E5=AE=B9=20=E6=8C=89=E7=85=A7=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/IcResiUserServiceImpl.java | 42 ++++++++++++++----- .../main/resources/mapper/IcResiUserDao.xml | 3 +- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index a7d1183196..f2fa4196a4 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -56,12 +56,12 @@ import com.epmet.dto.form.*; import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.result.*; import com.epmet.dto.result.demand.IcResiDemandDictDTO; +import com.epmet.dto.result.demand.OptionDTO; import com.epmet.entity.*; import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.feign.*; import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; import com.epmet.service.*; -import com.epmet.dto.result.demand.OptionDTO; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; @@ -745,13 +745,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> pageResiMap(IcResiUserPageFormDTO formDTO) { - CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); - String staffOrgPath; - if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { - staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId()); - } else { - staffOrgPath = staffInfoCacheResult.getAgencyId(); - } // 查询列表展示项,如果没有,直接返回 CustomerFormQueryDTO queryDTO1 = new CustomerFormQueryDTO(); @@ -765,7 +758,36 @@ public class IcResiUserServiceImpl extends BaseServiceImpl resultColumns = resultColumnRes.getData(); // 查询结果列对应的表: Set resultColumnTables = resultColumns.stream().map(IcFormResColumnDTO::getTableName).collect(Collectors.toSet()); + List queryAgencyIdList = formDTO.getConditions().stream() + .filter(o -> IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && "AGENCY_ID".equals(o.getColumnName())) + .flatMap(o -> o.getColumnValue().stream()).collect(Collectors.toList()); + //添加数据权限 + String staffOrgPath; + String agencyId; + //如果查询条件中 有居民表的agencyId 则匹配查询该组织下的 数据 + if (queryAgencyIdList.isEmpty()){ + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId()); + agencyId = staffInfoCacheResult.getAgencyId(); + if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { + staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(":").concat(staffInfoCacheResult.getAgencyId()); + } else { + staffOrgPath = staffInfoCacheResult.getAgencyId(); + } + } else { + formDTO.getConditions().removeIf(o->IcResiUserConstant.IC_RESI_USER.equals(o.getTableName()) && "AGENCY_ID".equals(o.getColumnName())); + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(queryAgencyIdList.get(NumConstant.ZERO)); + if (agencyInfo == null){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取组织信息失败"); + } + agencyId = agencyInfo.getId(); + staffOrgPath = agencyInfo.getPids(); + if (StringUtils.isBlank(staffOrgPath)){ + staffOrgPath = agencyId; + }else{ + staffOrgPath = staffOrgPath+StrConstant.COLON+agencyInfo.getId(); + } + } // 查询列表展示项需要用到哪些子表 Result> subTablesRes = operCustomizeOpenFeignClient.querySubTables(queryDTO1); List subTables = subTablesRes.getData(); @@ -800,7 +822,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> list=baseDao.selectListResiMap(formDTO.getCustomerId(), @@ -808,7 +830,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl AND ${resultTableName}.ID IS NOT NULL - and ic_resi_user.customer_id=#{customerId} - and (ic_resi_user.AGENCY_ID =#{currentStaffAgencyId} or ic_resi_user.pids like concat(#{staffOrgPath},'%')) + and ic_resi_user.pids like concat(#{staffOrgPath},'%')