|
@ -787,9 +787,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
public PageData<Map<String, Object>> pageResiMap(IcResiUserPageFormDTO formDTO) { |
|
|
public PageData<Map<String, Object>> pageResiMap(IcResiUserPageFormDTO formDTO) { |
|
|
|
|
|
|
|
|
// 查询列表展示项,如果没有,直接返回
|
|
|
// 查询列表展示项,如果没有,直接返回
|
|
|
CustomerFormQueryDTO queryDTO1 = new CustomerFormQueryDTO(); |
|
|
CustomerFormQueryDTO queryDTO1 = ConvertUtils.sourceToTarget(formDTO,CustomerFormQueryDTO.class); |
|
|
queryDTO1.setCustomerId(formDTO.getCustomerId()); |
|
|
|
|
|
queryDTO1.setFormCode(formDTO.getFormCode()); |
|
|
|
|
|
Result<List<IcFormResColumnDTO>> resultColumnRes = operCustomizeOpenFeignClient.queryConditions(queryDTO1); |
|
|
Result<List<IcFormResColumnDTO>> resultColumnRes = operCustomizeOpenFeignClient.queryConditions(queryDTO1); |
|
|
if (!resultColumnRes.success() || CollectionUtils.isEmpty(resultColumnRes.getData())) { |
|
|
if (!resultColumnRes.success() || CollectionUtils.isEmpty(resultColumnRes.getData())) { |
|
|
log.warn("没有配置列表展示列"); |
|
|
log.warn("没有配置列表展示列"); |
|
@ -3045,4 +3043,181 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
List<SendPointNoticeFormDTO.UserListBean> list = ConvertUtils.sourceToTarget(userList,SendPointNoticeFormDTO.UserListBean.class); |
|
|
List<SendPointNoticeFormDTO.UserListBean> list = ConvertUtils.sourceToTarget(userList,SendPointNoticeFormDTO.UserListBean.class); |
|
|
return list; |
|
|
return list; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 综合治理图层-查询各类别(信访人员、安置帮教、吸毒人员、社区矫正、不良青少年、肇事肇祸精神病、邪教人员)居民信息 |
|
|
|
|
|
* |
|
|
|
|
|
* @param formDTO |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public PageData<Map<String, Object>> listResiZhzl(IcResiUserPageFormDTO formDTO) { |
|
|
|
|
|
// 查询列表展示项,如果没有,直接返回
|
|
|
|
|
|
CustomerFormQueryDTO queryDTO1 = ConvertUtils.sourceToTarget(formDTO,CustomerFormQueryDTO.class); |
|
|
|
|
|
Result<List<IcFormResColumnDTO>> resultColumnRes = operCustomizeOpenFeignClient.queryConditions(queryDTO1); |
|
|
|
|
|
if (!resultColumnRes.success() || CollectionUtils.isEmpty(resultColumnRes.getData())) { |
|
|
|
|
|
log.warn("没有配置列表展示列"); |
|
|
|
|
|
return new PageData(new ArrayList(), NumConstant.ZERO); |
|
|
|
|
|
} |
|
|
|
|
|
List<IcFormResColumnDTO> resultColumns = resultColumnRes.getData(); |
|
|
|
|
|
// 查询结果列对应的表:
|
|
|
|
|
|
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()) |
|
|
|
|
|
&& CollectionUtils.isNotEmpty(o.getColumnValue()) && StringUtils.isNotBlank(o.getColumnValue().get(NumConstant.ZERO))) |
|
|
|
|
|
.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); |
|
|
|
|
|
List<SubTableJoinDTO> subTables = subTablesRes.getData(); |
|
|
|
|
|
log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true)); |
|
|
|
|
|
|
|
|
|
|
|
//关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重
|
|
|
|
|
|
Set<String> whereConditionTables = formDTO.getConditions().stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); |
|
|
|
|
|
Set<String> tables = new HashSet<>(); |
|
|
|
|
|
tables.addAll(whereConditionTables); |
|
|
|
|
|
tables.addAll(resultColumnTables); |
|
|
|
|
|
log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true)); |
|
|
|
|
|
//最终关联的子表对应的sql:
|
|
|
|
|
|
List<String> finalSubTables = new ArrayList<>(); |
|
|
|
|
|
//groupBy用到的表
|
|
|
|
|
|
Set<String> groupByTables = new HashSet<>(); |
|
|
|
|
|
subTables.forEach(subTable -> { |
|
|
|
|
|
if (tables.contains(subTable.getTableName())) { |
|
|
|
|
|
finalSubTables.add(subTable.getJoinTableSql()); |
|
|
|
|
|
if (subTable.getSupportAdd()) { |
|
|
|
|
|
groupByTables.add(subTable.getTableName()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(); |
|
|
|
|
|
if (null == formDTO.getIsPage() || formDTO.getIsPage()) { |
|
|
|
|
|
//分页
|
|
|
|
|
|
String finalStaffOrgPath = staffOrgPath; |
|
|
|
|
|
pageInfo = PageHelper.startPage(formDTO.getPageNo(), |
|
|
|
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectListResiMap(formDTO.getCustomerId(), |
|
|
|
|
|
formDTO.getFormCode(), |
|
|
|
|
|
formDTO.getConditions(), |
|
|
|
|
|
resultColumns, |
|
|
|
|
|
finalSubTables, |
|
|
|
|
|
agencyId, finalStaffOrgPath,null, formDTO.getKeyword(), |
|
|
|
|
|
groupByTables)); |
|
|
|
|
|
} else { |
|
|
|
|
|
List<Map<String, Object>> list = baseDao.selectListResiMap(formDTO.getCustomerId(), |
|
|
|
|
|
formDTO.getFormCode(), |
|
|
|
|
|
formDTO.getConditions(), |
|
|
|
|
|
resultColumns, |
|
|
|
|
|
finalSubTables, |
|
|
|
|
|
agencyId, |
|
|
|
|
|
staffOrgPath,null, |
|
|
|
|
|
formDTO.getKeyword(), |
|
|
|
|
|
groupByTables); |
|
|
|
|
|
pageInfo.setTotal(CollectionUtils.isEmpty(list) ? NumConstant.ZERO : list.size()); |
|
|
|
|
|
pageInfo.setList(list); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> list = pageInfo.getList(); |
|
|
|
|
|
//查询网格名称
|
|
|
|
|
|
List<String> gridIds = new ArrayList<>(); |
|
|
|
|
|
Set<String> houseIds = new HashSet<>(); |
|
|
|
|
|
for (Map<String, Object> map : list) { |
|
|
|
|
|
if (map.containsKey(UserConstant.GRID_ID) && null != map.get(UserConstant.GRID_ID) && StringUtils.isNotBlank(map.get(UserConstant.GRID_ID).toString())) { |
|
|
|
|
|
gridIds.add(map.get(UserConstant.GRID_ID).toString()); |
|
|
|
|
|
} |
|
|
|
|
|
if (map.containsKey(UserConstant.HOME_ID) && null != map.get(UserConstant.HOME_ID) && StringUtils.isNotBlank(map.get(UserConstant.HOME_ID).toString())) { |
|
|
|
|
|
houseIds.add(map.get(UserConstant.HOME_ID).toString()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
Result<List<AllGridsByUserIdResultDTO>> gridInfoRes = govOrgOpenFeignClient.getGridListByGridIds(gridIds); |
|
|
|
|
|
List<AllGridsByUserIdResultDTO> gridInfoList = gridInfoRes.success() && !CollectionUtils.isEmpty(gridInfoRes.getData()) ? gridInfoRes.getData() : new ArrayList<>(); |
|
|
|
|
|
Map<String, AllGridsByUserIdResultDTO> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(AllGridsByUserIdResultDTO::getGridId, Function.identity())); |
|
|
|
|
|
|
|
|
|
|
|
//查询房子名称
|
|
|
|
|
|
Result<List<HouseInfoDTO>> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId()); |
|
|
|
|
|
List<HouseInfoDTO> houseInfoDTOList = houseInfoRes.success() && !CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); |
|
|
|
|
|
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Map<String, Object> resultMap : list) { |
|
|
|
|
|
String gridIdValue = null != resultMap.get(UserConstant.GRID_ID) ? resultMap.get(UserConstant.GRID_ID).toString() : StrConstant.EPMETY_STR; |
|
|
|
|
|
resultMap.put("GRID_ID_VALUE", gridIdValue); |
|
|
|
|
|
if (gridInfoMap.containsKey(gridIdValue) && null != gridInfoMap.get(gridIdValue)) { |
|
|
|
|
|
//GRID_NAME
|
|
|
|
|
|
resultMap.put(UserConstant.GRID_ID, gridInfoMap.get(gridIdValue).getGridName()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String homeId = null != resultMap.get(UserConstant.HOME_ID) ? resultMap.get(UserConstant.HOME_ID).toString() : StrConstant.EPMETY_STR; |
|
|
|
|
|
resultMap.put("HOME_ID_VALUE", homeId); |
|
|
|
|
|
if (houseInfoMap.containsKey(homeId) && null != houseInfoMap.get(homeId)) { |
|
|
|
|
|
HouseInfoDTO houseInfoDTO = houseInfoMap.get(homeId); |
|
|
|
|
|
String buildName = StringUtils.isNotBlank(houseInfoDTO.getBuildingName()) ? houseInfoDTO.getBuildingName() : StrConstant.EPMETY_STR; |
|
|
|
|
|
resultMap.put("BUILD_NAME", buildName); |
|
|
|
|
|
|
|
|
|
|
|
String neighBorName = StringUtils.isNotBlank(houseInfoDTO.getNeighborHoodName()) ? houseInfoDTO.getNeighborHoodName() : StrConstant.EPMETY_STR; |
|
|
|
|
|
resultMap.put("VILLAGE_NAME", neighBorName); |
|
|
|
|
|
|
|
|
|
|
|
String unitName = StringUtils.isNotBlank(houseInfoDTO.getUnitName()) ? houseInfoDTO.getUnitName() : StrConstant.EPMETY_STR; |
|
|
|
|
|
resultMap.put("UNIT_NAME", unitName); |
|
|
|
|
|
|
|
|
|
|
|
String doorName = StringUtils.isNotBlank(houseInfoDTO.getDoorName()) ? houseInfoDTO.getDoorName() : StrConstant.EPMETY_STR; |
|
|
|
|
|
resultMap.put("DOOR_NAME", doorName); |
|
|
|
|
|
|
|
|
|
|
|
String houseType = StringUtils.isNotBlank(houseInfoDTO.getHouseType()) ? houseInfoDTO.getHouseType() : StrConstant.EPMETY_STR; |
|
|
|
|
|
//房屋类型,1楼房,2平房,3别墅
|
|
|
|
|
|
resultMap.put(UserConstant.HOUSE_TYPE_KEY, ""); |
|
|
|
|
|
if (HouseTypeEnum.LOUFANG.getCode().equals(houseType)) { |
|
|
|
|
|
resultMap.put(UserConstant.HOUSE_TYPE_KEY, HouseTypeEnum.LOUFANG.getName()); |
|
|
|
|
|
} else if (HouseTypeEnum.PINGFANG.getCode().equals(houseType)) { |
|
|
|
|
|
resultMap.put(UserConstant.HOUSE_TYPE_KEY, HouseTypeEnum.PINGFANG.getName()); |
|
|
|
|
|
} else if (HouseTypeEnum.BIESHU.getCode().equals(houseType)) { |
|
|
|
|
|
resultMap.put(UserConstant.HOUSE_TYPE_KEY, HouseTypeEnum.BIESHU.getName()); |
|
|
|
|
|
} |
|
|
|
|
|
resultMap.put(UserConstant.HOME_ID, neighBorName.concat(buildName).concat(unitName).concat(doorName)); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (resultMap.containsKey(UserConstant.GENDER)) { |
|
|
|
|
|
String genderValue = null != resultMap.get(UserConstant.GENDER) ? resultMap.get(UserConstant.GENDER).toString() : StrConstant.EPMETY_STR; |
|
|
|
|
|
if (GenderEnum.MAN.getCode().equals(genderValue)) { |
|
|
|
|
|
resultMap.put(UserConstant.GENDER, GenderEnum.MAN.getName()); |
|
|
|
|
|
} else if (GenderEnum.WOMAN.getCode().equals(genderValue)) { |
|
|
|
|
|
resultMap.put(UserConstant.GENDER, GenderEnum.WOMAN.getName()); |
|
|
|
|
|
} else if (GenderEnum.UN_KNOWN.getCode().equals(genderValue)) { |
|
|
|
|
|
resultMap.put(UserConstant.GENDER, GenderEnum.UN_KNOWN.getName()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
// 如果是信访人员
|
|
|
|
|
|
|
|
|
|
|
|
// 如果是特殊人群,且有特殊人群类别
|
|
|
|
|
|
} |
|
|
|
|
|
pageInfo.setList(list); |
|
|
|
|
|
return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|