|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.epmet.dataaggre.service.epmetuser.impl; |
|
|
|
|
|
|
|
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.page.PageData; |
|
|
@ -9,7 +10,10 @@ import com.epmet.dataaggre.dto.epmetuser.IcFormResColumnDTO; |
|
|
|
import com.epmet.dataaggre.dto.epmetuser.form.IcResiDetailFormDTO; |
|
|
|
import com.epmet.dataaggre.dto.epmetuser.form.IcResiUserPageFormDTO; |
|
|
|
import com.epmet.dataaggre.dto.epmetuser.result.IcResiUserPageResultDTO; |
|
|
|
import com.epmet.dataaggre.dto.govorg.result.GridsInfoListResultDTO; |
|
|
|
import com.epmet.dataaggre.dto.govorg.result.HouseInfoDTO; |
|
|
|
import com.epmet.dataaggre.service.epmetuser.IcResiUserService; |
|
|
|
import com.epmet.dataaggre.service.govorg.GovOrgService; |
|
|
|
import com.epmet.dataaggre.service.opercustomize.CustomerFootBarService; |
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
@ -19,6 +23,8 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description TODO |
|
|
@ -33,7 +39,8 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
private IcResiUserDao icResiUserDao; |
|
|
|
@Autowired |
|
|
|
private CustomerFootBarService customerFootBarService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private GovOrgService govOrgService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -52,10 +59,11 @@ 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.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()); |
|
|
@ -72,10 +80,30 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
resultColumns, |
|
|
|
subTables)); |
|
|
|
List<IcResiUserPageResultDTO> list = pageInfo.getList(); |
|
|
|
//todo 还早着呢
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询网格名称
|
|
|
|
List<String> gridIds=list.stream().map(IcResiUserPageResultDTO::getGridId).collect(Collectors.toList()); |
|
|
|
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())); |
|
|
|
|
|
|
|
//查询房子名称
|
|
|
|
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())){ |
|
|
|
resultDTO.setGridName(gridInfoMap.get(resultDTO.getGridId()).getGridName()); |
|
|
|
} |
|
|
|
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()); |
|
|
|
resultDTO.setHomeName(houseInfoMap.get(resultDTO.getHomeId()).getDoorName()); |
|
|
|
} |
|
|
|
} |
|
|
|
pageInfo.setList(list); |
|
|
|
return new PageData<>(pageInfo.getList(),pageInfo.getTotal()); |
|
|
|
} |
|
|
@ -94,6 +122,7 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
@Override |
|
|
|
public Map queryIcResiDetail(IcResiDetailFormDTO pageFormDTO) { |
|
|
|
Map resultMap=new HashMap(); |
|
|
|
// 先查询主表,主表没有记录,直接返回空
|
|
|
|
List<Map<String,Object>> icResiUserMapList=icResiUserDao.selectById(pageFormDTO.getIcResiUserId()); |
|
|
|
if(CollectionUtils.isEmpty(icResiUserMapList)){ |
|
|
|
return new HashMap(); |
|
|
@ -104,8 +133,12 @@ public class IcResiUserServiceImpl implements IcResiUserService { |
|
|
|
Set<String> subTableList=customerFootBarService.queryIcResiSubTables(pageFormDTO.getCustomerId(),pageFormDTO.getFormCode()); |
|
|
|
for(String subTalbeName:subTableList){ |
|
|
|
List<Map<String,Object>> list=icResiUserDao.selectSubTableRecords(pageFormDTO.getIcResiUserId(),subTalbeName); |
|
|
|
|
|
|
|
resultMap.put(subTalbeName,list); |
|
|
|
if(!CollectionUtils.isEmpty(list)){ |
|
|
|
resultMap.put(subTalbeName,list); |
|
|
|
} |
|
|
|
//else{
|
|
|
|
// resultMap.put(subTalbeName,new ArrayList<>());
|
|
|
|
//}
|
|
|
|
} |
|
|
|
return resultMap; |
|
|
|
} |
|
|
|