|
|
@ -4,8 +4,11 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.enums.GenderEnum; |
|
|
|
import com.epmet.commons.tools.enums.HouseTypeEnum; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.dataaggre.constant.DataSourceConstant; |
|
|
|
import com.epmet.dataaggre.constant.OrgConstant; |
|
|
|
import com.epmet.dataaggre.dao.epmetuser.IcResiUserDao; |
|
|
|
import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO; |
|
|
|
import com.epmet.dataaggre.dto.epmetuser.form.IcResiDetailFormDTO; |
|
|
@ -49,23 +52,23 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
* 分页查询居民信息列表 |
|
|
|
* |
|
|
|
* @param formDTO |
|
|
|
* @return com.epmet.commons.tools.page.PageData<com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO> |
|
|
|
* @return com.epmet.commons.tools.page.PageData<com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO> |
|
|
|
* @author yinzuomei |
|
|
|
* @date 2021/10/28 10:30 上午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageData<IcResiUserPageResultDTO> pageResi(IcResiUserPageFormDTO formDTO) { |
|
|
|
// 查询列表展示项,如果没有,直接返回
|
|
|
|
List<IcFormResColumnDTO> resultColumns=customerFootBarService.queryConditions(formDTO.getCustomerId(),formDTO.getFormCode()); |
|
|
|
if(CollectionUtils.isEmpty(resultColumns)){ |
|
|
|
List<IcFormResColumnDTO> resultColumns = customerFootBarService.queryConditions(formDTO.getCustomerId(), formDTO.getFormCode()); |
|
|
|
if (CollectionUtils.isEmpty(resultColumns)) { |
|
|
|
log.warn("没有配置列表展示列"); |
|
|
|
return new PageData(new ArrayList(), NumConstant.ZERO); |
|
|
|
} |
|
|
|
log.warn("列表展示项:"+JSON.toJSONString(resultColumns)); |
|
|
|
log.warn("列表展示项:" + JSON.toJSONString(resultColumns)); |
|
|
|
// 查询列表展示项需要用到哪些子表
|
|
|
|
// 拼接好的left join table_name on (ic_resi_user.ID=table_name.IC_RESI_USER AND table_name.del_flag='0')
|
|
|
|
List<String> subTables=customerFootBarService.querySubTables(formDTO.getCustomerId(),formDTO.getFormCode()); |
|
|
|
log.warn("子表:"+JSON.toJSONString(subTables)); |
|
|
|
List<String> subTables = customerFootBarService.querySubTables(formDTO.getCustomerId(), formDTO.getFormCode()); |
|
|
|
log.warn("子表:" + JSON.toJSONString(subTables)); |
|
|
|
/* Set<String> subTableList=resultColumns.stream().filter(item->!item.getTableName().equals("ic_resi_user") |
|
|
|
&& StringUtils.isNotBlank(item.getLink())) |
|
|
|
.map(IcFormResColumnDTO :: getTableName).collect(Collectors.toSet()); |
|
|
@ -76,30 +79,30 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
subTables.add(joinSql); |
|
|
|
});*/ |
|
|
|
PageInfo<IcResiUserPageResultDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), |
|
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> icResiUserDao.selectListResi(formDTO.getCustomerId(), |
|
|
|
formDTO.getFormCode(), |
|
|
|
formDTO.getConditions(), |
|
|
|
resultColumns, |
|
|
|
subTables)); |
|
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> icResiUserDao.selectListResi(formDTO.getCustomerId(), |
|
|
|
formDTO.getFormCode(), |
|
|
|
formDTO.getConditions(), |
|
|
|
resultColumns, |
|
|
|
subTables)); |
|
|
|
List<IcResiUserPageResultDTO> list = pageInfo.getList(); |
|
|
|
//查询网格名称
|
|
|
|
List<String> gridIds=list.stream().map(IcResiUserPageResultDTO::getGridId).collect(Collectors.toList()); |
|
|
|
log.warn("gridIds:"+JSON.toJSONString(gridIds)); |
|
|
|
List<String> gridIds = list.stream().map(IcResiUserPageResultDTO::getGridId).collect(Collectors.toList()); |
|
|
|
log.warn("gridIds:" + JSON.toJSONString(gridIds)); |
|
|
|
|
|
|
|
List<GridsInfoListResultDTO> gridInfoList=govOrgService.gridListByIds(gridIds); |
|
|
|
List<GridsInfoListResultDTO> gridInfoList = govOrgService.gridListByIds(gridIds); |
|
|
|
log.warn(JSON.toJSONString(gridInfoList)); |
|
|
|
|
|
|
|
Map<String, GridsInfoListResultDTO> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(GridsInfoListResultDTO::getGridId, Function.identity())); |
|
|
|
|
|
|
|
//查询房子名称
|
|
|
|
Set<String> houseIds=list.stream().map(IcResiUserPageResultDTO::getHomeId).collect(Collectors.toSet()); |
|
|
|
List<HouseInfoDTO> houseInfoDTOList=govOrgService.queryHouseInfo(houseIds); |
|
|
|
Set<String> houseIds = list.stream().map(IcResiUserPageResultDTO::getHomeId).collect(Collectors.toSet()); |
|
|
|
List<HouseInfoDTO> houseInfoDTOList = govOrgService.queryHouseInfo(houseIds); |
|
|
|
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); |
|
|
|
for(IcResiUserPageResultDTO resultDTO:list){ |
|
|
|
if(null !=gridInfoMap&&gridInfoMap.containsKey(resultDTO.getGridId())){ |
|
|
|
for (IcResiUserPageResultDTO resultDTO : list) { |
|
|
|
if (null != gridInfoMap && gridInfoMap.containsKey(resultDTO.getGridId())) { |
|
|
|
resultDTO.setGridName(gridInfoMap.get(resultDTO.getGridId()).getGridName()); |
|
|
|
} |
|
|
|
if(null !=houseInfoMap &&houseInfoMap.containsKey(resultDTO.getHomeId())){ |
|
|
|
if (null != houseInfoMap && houseInfoMap.containsKey(resultDTO.getHomeId())) { |
|
|
|
resultDTO.setBuildName(houseInfoMap.get(resultDTO.getHomeId()).getBuildingName()); |
|
|
|
resultDTO.setVallageName(houseInfoMap.get(resultDTO.getHomeId()).getNeighborHoodName()); |
|
|
|
resultDTO.setUnitName(houseInfoMap.get(resultDTO.getHomeId()).getUnitName()); |
|
|
@ -108,7 +111,7 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
} |
|
|
|
} |
|
|
|
pageInfo.setList(list); |
|
|
|
return new PageData<>(pageInfo.getList(),pageInfo.getTotal()); |
|
|
|
return new PageData<>(pageInfo.getList(), pageInfo.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -119,17 +122,27 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
log.warn("没有配置列表展示列"); |
|
|
|
return new PageData(new ArrayList(), NumConstant.ZERO); |
|
|
|
} |
|
|
|
//log.warn("列表展示项:" + JSON.toJSONString(resultColumns));
|
|
|
|
// 查询列表展示项需要用到哪些子表
|
|
|
|
// 拼接好的left join table_name on (ic_resi_user.ID=table_name.IC_RESI_USER AND table_name.del_flag='0')
|
|
|
|
List<String> subTables = customerFootBarService.querySubTables(formDTO.getCustomerId(), formDTO.getFormCode()); |
|
|
|
//log.info("子表:" + JSON.toJSONString(subTables));
|
|
|
|
PageInfo<Map<String, Object>> pageInfo = PageHelper.startPage(formDTO.getPageNo(), |
|
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> icResiUserDao.selectListResiMap(formDTO.getCustomerId(), |
|
|
|
formDTO.getFormCode(), |
|
|
|
formDTO.getConditions(), |
|
|
|
resultColumns, |
|
|
|
subTables)); |
|
|
|
PageInfo<Map<String, Object>> pageInfo=new PageInfo<>(); |
|
|
|
if (null == formDTO.getPageFlag()||formDTO.getPageFlag()) { |
|
|
|
//分页
|
|
|
|
pageInfo= PageHelper.startPage(formDTO.getPageNo(), |
|
|
|
formDTO.getPageSize()).doSelectPageInfo(() -> icResiUserDao.selectListResiMap(formDTO.getCustomerId(), |
|
|
|
formDTO.getFormCode(), |
|
|
|
formDTO.getConditions(), |
|
|
|
resultColumns, |
|
|
|
subTables)); |
|
|
|
}else{ |
|
|
|
List<Map<String,Object>> list=icResiUserDao.selectListResiMap(formDTO.getCustomerId(), |
|
|
|
formDTO.getFormCode(), |
|
|
|
formDTO.getConditions(), |
|
|
|
resultColumns, |
|
|
|
subTables); |
|
|
|
pageInfo.setTotal(CollectionUtils.isEmpty(list)?NumConstant.ZERO:list.size()); |
|
|
|
pageInfo.setList(list); |
|
|
|
} |
|
|
|
|
|
|
|
List<Map<String, Object>> list = pageInfo.getList(); |
|
|
|
//查询网格名称
|
|
|
@ -137,17 +150,15 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
Set<String> houseIds = new HashSet<>(); |
|
|
|
for (Map<String, Object> map : list) { |
|
|
|
log.warn(JSON.toJSONString(map)); |
|
|
|
if (map.containsKey("GRID_ID") && null != map.get("GRID_ID") && StringUtils.isNotBlank(map.get("GRID_ID").toString())) { |
|
|
|
gridIds.add(map.get("GRID_ID").toString()); |
|
|
|
if (map.containsKey(OrgConstant.GRID_ID) && null != map.get(OrgConstant.GRID_ID) && StringUtils.isNotBlank(map.get(OrgConstant.GRID_ID).toString())) { |
|
|
|
gridIds.add(map.get(OrgConstant.GRID_ID).toString()); |
|
|
|
} |
|
|
|
if (map.containsKey("HOME_ID") && null != map.get("HOME_ID") && StringUtils.isNotBlank(map.get("HOME_ID").toString())) { |
|
|
|
houseIds.add(map.get("HOME_ID").toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
//log.warn("gridIds:" + JSON.toJSONString(gridIds));
|
|
|
|
|
|
|
|
List<GridsInfoListResultDTO> gridInfoList = govOrgService.gridListByIds(gridIds); |
|
|
|
//log.warn(JSON.toJSONString(gridInfoList));
|
|
|
|
|
|
|
|
Map<String, GridsInfoListResultDTO> gridInfoMap = gridInfoList.stream().collect(Collectors.toMap(GridsInfoListResultDTO::getGridId, Function.identity())); |
|
|
|
|
|
|
@ -155,11 +166,11 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
List<HouseInfoDTO> houseInfoDTOList = govOrgService.queryHouseInfo(houseIds); |
|
|
|
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); |
|
|
|
for (Map<String, Object> resultMap : list) { |
|
|
|
String gridIdValue = null != resultMap.get("GRID_ID") ? resultMap.get("GRID_ID").toString() : StrConstant.EPMETY_STR; |
|
|
|
String gridIdValue = null != resultMap.get(OrgConstant.GRID_ID) ? resultMap.get(OrgConstant.GRID_ID).toString() : StrConstant.EPMETY_STR; |
|
|
|
resultMap.put("GRID_ID_VALUE", gridIdValue); |
|
|
|
if (null != gridInfoMap && gridInfoMap.containsKey(gridIdValue) && null != gridInfoMap.get(gridIdValue)) { |
|
|
|
//GRID_NAME
|
|
|
|
resultMap.put("GRID_ID", gridInfoMap.get(gridIdValue).getGridName()); |
|
|
|
resultMap.put(OrgConstant.GRID_ID, gridInfoMap.get(gridIdValue).getGridName()); |
|
|
|
} |
|
|
|
|
|
|
|
String homeId = null != resultMap.get("HOME_ID") ? resultMap.get("HOME_ID").toString() : StrConstant.EPMETY_STR; |
|
|
@ -180,25 +191,26 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
|
|
|
|
String houseType = StringUtils.isNotBlank(houseInfoDTO.getHouseType()) ? houseInfoDTO.getHouseType() : StrConstant.EPMETY_STR; |
|
|
|
//房屋类型,1楼房,2平房,3别墅
|
|
|
|
resultMap.put("HOUSE_TYPE", ""); |
|
|
|
if ("1".equals(houseType)) { |
|
|
|
resultMap.put("HOUSE_TYPE", "楼房"); |
|
|
|
} else if ("2".equals(houseType)) { |
|
|
|
resultMap.put("HOUSE_TYPE", "平房"); |
|
|
|
} else if ("3".equals(houseType)) { |
|
|
|
resultMap.put("HOUSE_TYPE", "别墅"); |
|
|
|
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, ""); |
|
|
|
if (HouseTypeEnum.LOUFANG.getCode().equals(houseType)) { |
|
|
|
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, HouseTypeEnum.LOUFANG.getName()); |
|
|
|
} else if (HouseTypeEnum.PINGFANG.getCode().equals(houseType)) { |
|
|
|
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, HouseTypeEnum.PINGFANG.getName()); |
|
|
|
} else if (HouseTypeEnum.BIESHU.getCode().equals(houseType)) { |
|
|
|
resultMap.put(OrgConstant.HOUSE_TYPE_KEY, HouseTypeEnum.BIESHU.getName()); |
|
|
|
} |
|
|
|
|
|
|
|
resultMap.put("HOME_ID", neighBorName.concat(buildName).concat(unitName).concat(doorName)); |
|
|
|
} |
|
|
|
if (resultMap.containsKey("GENDER")) { |
|
|
|
String genderValue = null != resultMap.get("GENDER") ? resultMap.get("GENDER").toString() : StrConstant.EPMETY_STR; |
|
|
|
if ("1".equals(genderValue)) { |
|
|
|
resultMap.put("GENDER", "男"); |
|
|
|
} else if ("2".equals(genderValue)) { |
|
|
|
resultMap.put("HOUSE_TYPE", "女"); |
|
|
|
} else if ("0".equals(genderValue)) { |
|
|
|
resultMap.put("HOUSE_TYPE", "未知"); |
|
|
|
|
|
|
|
if (resultMap.containsKey(OrgConstant.GENDER)) { |
|
|
|
String genderValue = null != resultMap.get(OrgConstant.GENDER) ? resultMap.get(OrgConstant.GENDER).toString() : StrConstant.EPMETY_STR; |
|
|
|
if (GenderEnum.MAN.getCode().equals(genderValue)) { |
|
|
|
resultMap.put(OrgConstant.GENDER, GenderEnum.MAN.getName()); |
|
|
|
} else if (GenderEnum.WOMAN.getCode().equals(genderValue)) { |
|
|
|
resultMap.put(OrgConstant.GENDER, GenderEnum.WOMAN.getName()); |
|
|
|
} else if (GenderEnum.UN_KNOWN.getCode().equals(genderValue)) { |
|
|
|
resultMap.put(OrgConstant.GENDER, GenderEnum.UN_KNOWN.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -210,26 +222,26 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
* 编辑页面,显示居民信息详情 |
|
|
|
* |
|
|
|
* @param pageFormDTO |
|
|
|
* @return java.util.Map |
|
|
|
* @return java.util.Map |
|
|
|
* @author yinzuomei |
|
|
|
* @date 2021/10/28 10:29 上午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Map queryIcResiDetail(IcResiDetailFormDTO pageFormDTO) { |
|
|
|
Map resultMap=new HashMap(); |
|
|
|
Map resultMap = new HashMap(); |
|
|
|
// 先查询主表,主表没有记录,直接返回空
|
|
|
|
List<Map<String,Object>> icResiUserMapList=icResiUserDao.selectById(pageFormDTO.getIcResiUserId()); |
|
|
|
if(CollectionUtils.isEmpty(icResiUserMapList)){ |
|
|
|
List<Map<String, Object>> icResiUserMapList = icResiUserDao.selectById(pageFormDTO.getIcResiUserId()); |
|
|
|
if (CollectionUtils.isEmpty(icResiUserMapList)) { |
|
|
|
return new HashMap(); |
|
|
|
} |
|
|
|
resultMap.put("ic_resi_user",icResiUserMapList); |
|
|
|
resultMap.put("ic_resi_user", icResiUserMapList); |
|
|
|
|
|
|
|
//循环查询每个子表的记录
|
|
|
|
Set<String> subTableList=customerFootBarService.queryIcResiSubTables(pageFormDTO.getCustomerId(),pageFormDTO.getFormCode()); |
|
|
|
for(String subTalbeName:subTableList){ |
|
|
|
List<Map<String,Object>> list=icResiUserDao.selectSubTableRecords(pageFormDTO.getIcResiUserId(),subTalbeName); |
|
|
|
if(!CollectionUtils.isEmpty(list)){ |
|
|
|
resultMap.put(subTalbeName,list); |
|
|
|
Set<String> subTableList = customerFootBarService.queryIcResiSubTables(pageFormDTO.getCustomerId(), pageFormDTO.getFormCode()); |
|
|
|
for (String subTalbeName : subTableList) { |
|
|
|
List<Map<String, Object>> list = icResiUserDao.selectSubTableRecords(pageFormDTO.getIcResiUserId(), subTalbeName); |
|
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
|
resultMap.put(subTalbeName, list); |
|
|
|
} |
|
|
|
//else{
|
|
|
|
// resultMap.put(subTalbeName,new ArrayList<>());
|
|
|
|