Browse Source

居民信息查询条件,列表调整

master
yinzuomei 2 years ago
parent
commit
e0c293d215
  1. 9
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java
  2. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java
  3. 86
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

9
epmet-admin/epmet-admin-server/src/main/java/com/epmet/service/impl/SysDictDataServiceImpl.java

@ -24,15 +24,13 @@ import com.epmet.dto.SysDictDataDTO;
import com.epmet.entity.SysDictDataEntity;
import com.epmet.entity.SysDictTypeEntity;
import com.epmet.service.SysDictDataService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -223,6 +221,9 @@ public class SysDictDataServiceImpl extends BaseServiceImpl<SysDictDataDao, SysD
@Override
public Map<String, String> dictMap(String dictType) {
List<DictListResultDTO> resultDTOList = baseDao.selectDictList(dictType);
if(CollectionUtils.isEmpty(resultDTOList)){
return new HashMap<>();
}
return resultDTOList.stream().collect(Collectors.toMap(DictListResultDTO::getValue, DictListResultDTO::getLabel));
}

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java

@ -34,6 +34,9 @@ public enum DictTypeEnum {
TRAFFIC_TYPE("traffic_type", "交通方式", 36),
SOJOURN_HISTORY("sojourn_history", "7天内旅居史情况", 37),
TRIP_DATA_TYPE("trip_data_type", "行程记录类型", 39),
YT_KEY_POINT_USER_TYPE("yt_key_point_user_type","重点人群",40),
YT_POPULATION_TYPE("yt_population_type","人口类型",41),
YT_POLITICS_STATUS("yt_politics_status","政治面貌",42)
;
private final String code;

86
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -796,7 +796,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
/**
* @description: 生成居民变更记录
* @param null:
* @return
* @author: sun
*/
@ -922,15 +921,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
@Override
public PageData<Map<String, Object>> pageResiMap(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();
List<IcFormResColumnDTO> resultColumns = queryResultColumns(formDTO);
// 查询结果列对应的表:
Set<String> resultColumnTables = resultColumns.stream().map(IcFormResColumnDTO::getTableName).collect(Collectors.toSet());
@ -984,7 +976,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}).collect(Collectors.toList());
}
// 查询列表展示项需要用到哪些子表
Result<List<SubTableJoinDTO>> subTablesRes = operCustomizeOpenFeignClient.querySubTables(queryDTO1);
Result<List<SubTableJoinDTO>> subTablesRes = operCustomizeOpenFeignClient.querySubTables(ConvertUtils.sourceToTarget(formDTO,CustomerFormQueryDTO.class));
List<SubTableJoinDTO> subTables = subTablesRes.getData();
// log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true));
@ -1041,7 +1033,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
List<Map<String, Object>> list = pageInfo.getList();
//查询网格名称
//查询网格名称、房屋名称用
List<String> gridIds = new ArrayList<>();
Set<String> houseIds = new HashSet<>();
for (Map<String, Object> map : list) {
@ -1052,25 +1044,47 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
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()));
Map<String, AllGridsByUserIdResultDTO> gridInfoMap =getGridInfoMap(gridIds);
//查询房子名称
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()));
Map<String, HouseInfoDTO> houseInfoMap =getHouseInfoMap(houseIds,formDTO.getCustomerId());
handleList(list,gridInfoMap,houseInfoMap,formDTO.getCustomerId());
pageInfo.setList(list);
if (formDTO.getIsPage()) {
return new PageData<>(pageInfo.getList(), pageInfo.getTotal(), formDTO.getPageSize());
}
return new PageData<>(pageInfo.getList(), pageInfo.getTotal());
}
private List<IcFormResColumnDTO> queryResultColumns(IcResiUserPageFormDTO formDTO) {
// 查询列表展示项,如果没有,直接返回
CustomerFormQueryDTO queryDTO1 = ConvertUtils.sourceToTarget(formDTO,CustomerFormQueryDTO.class);
Result<List<IcFormResColumnDTO>> resultColumnRes = operCustomizeOpenFeignClient.queryConditions(queryDTO1);
if (!resultColumnRes.success() || CollectionUtils.isEmpty(resultColumnRes.getData())) {
log.error(formDTO.getCustomerId()+"没有配置列表展示列");
// return new PageData(new ArrayList(), NumConstant.ZERO);
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"居民信息表单未配置列表展示项","居民信息表单未配置列表展示项");
}
List<IcFormResColumnDTO> resultColumns = resultColumnRes.getData();
return resultColumns;
}
private void handleList(List<Map<String, Object>> list, Map<String, AllGridsByUserIdResultDTO> gridInfoMap, Map<String, HouseInfoDTO> houseInfoMap,String customerId) {
if(CollectionUtils.isEmpty(list)){
return;
}
//查询需求分类字典
UserDemandNameQueryFormDTO userDemandNameQueryFormDTO = new UserDemandNameQueryFormDTO();
userDemandNameQueryFormDTO.setCustomerId(formDTO.getCustomerId());
userDemandNameQueryFormDTO.setCustomerId(customerId);
userDemandNameQueryFormDTO.setCodeSet(new HashSet<>());
Result<List<IcResiDemandDictDTO>> demandNameRes = heartOpenFeignClient.queryDemandNames(userDemandNameQueryFormDTO);
if (!demandNameRes.success() || CollectionUtils.isEmpty(demandNameRes.getData())) {
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "获取需求分类字典表数据异常", EpmetErrorCode.SERVER_ERROR.getMsg());
}
Map<String, IcResiDemandDictDTO> demandDictMap = demandNameRes.getData().stream().collect(Collectors.toMap(IcResiDemandDictDTO::getCategoryCode, Function.identity()));
// 重点人群+人口类型+政治面貌需要特殊赋值
Result<Map<String, String>> keyPointUserTypeMapRes = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.YT_KEY_POINT_USER_TYPE.getCode());
Result<Map<String, String>> populationTypeMapRes = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.YT_POPULATION_TYPE.getCode());
Result<Map<String, String>> politicsStatusMapRes = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.YT_POLITICS_STATUS.getCode());
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);
@ -1120,12 +1134,36 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
resultMap.put(UserConstant.GENDER, GenderEnum.UN_KNOWN.getName());
}
}
// 烟台需求:列表又又又又增加了:重点人群、国籍、人口类型、政治面貌,其中 重点人群+人口类型+政治面貌需要特殊赋值
if (resultMap.containsKey("KEY_POINT_USER_TYPE")) {
String keyPointUserType = (String) resultMap.get("KEY_POINT_USER_TYPE");
resultMap.put("KEY_POINT_USER_TYPE", keyPointUserTypeMapRes.getData().get(keyPointUserType));
}
pageInfo.setList(list);
if (formDTO.getIsPage()) {
return new PageData<>(pageInfo.getList(), pageInfo.getTotal(), formDTO.getPageSize());
if (resultMap.containsKey("POPULATION_TYPE")) {
String populationType = (String) resultMap.get("POPULATION_TYPE");
resultMap.put("POPULATION_TYPE", populationTypeMapRes.getData().get(populationType));
}
return new PageData<>(pageInfo.getList(), pageInfo.getTotal());
if (resultMap.containsKey("POLITICS_STATUS")) {
String politicsStatus = (String) resultMap.get("POLITICS_STATUS");
resultMap.put("POLITICS_STATUS", politicsStatusMapRes.getData().get(politicsStatus));
}
}
}
private Map<String, HouseInfoDTO> getHouseInfoMap(Set<String> houseIds,String customerId) {
//查询房子名称
Result<List<HouseInfoDTO>> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, customerId);
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()));
return houseInfoMap;
}
private Map<String, AllGridsByUserIdResultDTO> getGridInfoMap(List<String> gridIds) {
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()));
return gridInfoMap;
}
private String queryUserDemandName(String icResiUserId, Map<String, IcResiDemandDictDTO> demandDictMap) {

Loading…
Cancel
Save