Browse Source

居民信息查询 兼容 按照组织查询

master
jianjun 3 years ago
parent
commit
c469db25d2
  1. 42
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  2. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

42
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.form.demand.UserDemandNameQueryFormDTO;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.dto.result.demand.IcResiDemandDictDTO; import com.epmet.dto.result.demand.IcResiDemandDictDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.*; import com.epmet.entity.*;
import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.excel.support.ExportResiUserItemDTO;
import com.epmet.feign.*; import com.epmet.feign.*;
import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient;
import com.epmet.service.*; import com.epmet.service.*;
import com.epmet.dto.result.demand.OptionDTO;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -745,13 +745,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
@Override @Override
public PageData<Map<String, Object>> pageResiMap(IcResiUserPageFormDTO formDTO) { public PageData<Map<String, Object>> 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(); CustomerFormQueryDTO queryDTO1 = new CustomerFormQueryDTO();
@ -765,7 +758,36 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
List<IcFormResColumnDTO> resultColumns = resultColumnRes.getData(); List<IcFormResColumnDTO> resultColumns = resultColumnRes.getData();
// 查询结果列对应的表: // 查询结果列对应的表:
Set<String> resultColumnTables = resultColumns.stream().map(IcFormResColumnDTO::getTableName).collect(Collectors.toSet()); Set<String> resultColumnTables = resultColumns.stream().map(IcFormResColumnDTO::getTableName).collect(Collectors.toSet());
List<String> 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<List<SubTableJoinDTO>> subTablesRes = operCustomizeOpenFeignClient.querySubTables(queryDTO1); Result<List<SubTableJoinDTO>> subTablesRes = operCustomizeOpenFeignClient.querySubTables(queryDTO1);
List<SubTableJoinDTO> subTables = subTablesRes.getData(); List<SubTableJoinDTO> subTables = subTablesRes.getData();
@ -800,7 +822,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
formDTO.getConditions(), formDTO.getConditions(),
resultColumns, resultColumns,
finalSubTables, finalSubTables,
staffInfoCacheResult.getAgencyId(), finalStaffOrgPath,null, formDTO.getKeyword(), agencyId, finalStaffOrgPath,null, formDTO.getKeyword(),
groupByTables)); groupByTables));
}else{ }else{
List<Map<String,Object>> list=baseDao.selectListResiMap(formDTO.getCustomerId(), List<Map<String,Object>> list=baseDao.selectListResiMap(formDTO.getCustomerId(),
@ -808,7 +830,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
formDTO.getConditions(), formDTO.getConditions(),
resultColumns, resultColumns,
finalSubTables, finalSubTables,
staffInfoCacheResult.getAgencyId(), agencyId,
staffOrgPath,null, staffOrgPath,null,
formDTO.getKeyword(), formDTO.getKeyword(),
groupByTables); groupByTables);

3
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -90,8 +90,7 @@
<if test="resultTableName != null and resultTableName != ''"> <if test="resultTableName != null and resultTableName != ''">
AND ${resultTableName}.ID IS NOT NULL AND ${resultTableName}.ID IS NOT NULL
</if> </if>
and ic_resi_user.customer_id=#{customerId} and ic_resi_user.pids like concat(#{staffOrgPath},'%')
and (ic_resi_user.AGENCY_ID =#{currentStaffAgencyId} or ic_resi_user.pids like concat(#{staffOrgPath},'%'))
<if test="null != conditions and conditions.size() > 0"> <if test="null != conditions and conditions.size() > 0">
<foreach item="subCondition" collection="conditions" open="" separator="" close=""> <foreach item="subCondition" collection="conditions" open="" separator="" close="">
<if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0"> <if test="null != subCondition.columnValue and subCondition.columnValue.size() > 0">

Loading…
Cancel
Save