|
|
@ -1596,41 +1596,65 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
* @Date 2021/11/5 10:28 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public OwnerRelationResultDTO getOwnerRelation(String userId) { |
|
|
|
public OwnerRelationResultDTO getOwnerRelation(String userId,String houseId) { |
|
|
|
if (StringUtils.isBlank(userId) && StringUtils.isBlank(houseId)) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "入参错误userId,houseId不能同时为空", "入参错误"); |
|
|
|
} |
|
|
|
OwnerRelationResultDTO result = new OwnerRelationResultDTO(); |
|
|
|
result.setOwnerName(""); |
|
|
|
if(StringUtils.isBlank(houseId)){ |
|
|
|
//获取用户信息
|
|
|
|
IcResiUserEntity user = baseDao.selectById(userId); |
|
|
|
result.setOwnerName(""); |
|
|
|
if (null != user) { |
|
|
|
houseId=user.getHomeId(); |
|
|
|
} |
|
|
|
} |
|
|
|
//获取用户所在家庭里所有人员信息
|
|
|
|
LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
wrapper.eq(IcResiUserEntity::getHomeId, user.getHomeId()); |
|
|
|
wrapper.eq(IcResiUserEntity::getHomeId, houseId); |
|
|
|
wrapper.eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR); |
|
|
|
wrapper.orderByAsc(IcResiUserEntity::getYhzgx); |
|
|
|
List<IcResiUserEntity> resiUserList = baseDao.selectList(wrapper); |
|
|
|
if (CollectionUtils.isNotEmpty(resiUserList)) { |
|
|
|
List<OwnerRelationResultDTO.UserListBean> userList = resiUserList.stream().map(item -> { |
|
|
|
|
|
|
|
//先找到户主:正常情况下只会有一个户主,所以找到之后,终止循环
|
|
|
|
for(IcResiUserEntity resiUserEntity:resiUserList){ |
|
|
|
//如果与房主的关系是本人,则这个人就是房主
|
|
|
|
if (RelationshipEnum.SELF.getCode().equals(resiUserEntity.getYhzgx())) { |
|
|
|
result.setOwnerName(resiUserEntity.getName()); |
|
|
|
result.setOwnerUserId(resiUserEntity.getId()); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
List<OwnerRelationResultDTO.UserListBean> userList=new ArrayList<>(); |
|
|
|
for(IcResiUserEntity item:resiUserList){ |
|
|
|
//成员里排除户主
|
|
|
|
if(!result.getOwnerUserId().equals(item.getId())){ |
|
|
|
OwnerRelationResultDTO.UserListBean bean = new OwnerRelationResultDTO.UserListBean(); |
|
|
|
bean.setUserId(item.getId()); |
|
|
|
bean.setUserName(item.getName()); |
|
|
|
bean.setYhzgx(item.getYhzgx()); |
|
|
|
bean.setRelation(RelationshipEnum.getEnum(item.getYhzgx()).getName()); |
|
|
|
bean.setIsSelf(NumConstant.ZERO_STR); |
|
|
|
|
|
|
|
// 与入参里的居民id对比
|
|
|
|
if (StringUtils.isNotBlank(userId)) { |
|
|
|
if (userId.equals(item.getId())) { |
|
|
|
bean.setIsSelf(NumConstant.ONE_STR); |
|
|
|
} |
|
|
|
//如果与房主的关系是本人,则这个人就是房主
|
|
|
|
if (RelationshipEnum.SELF.getCode().equals(item.getYhzgx())) { |
|
|
|
result.setOwnerName(item.getName()); |
|
|
|
} |
|
|
|
|
|
|
|
//2022.11.17 返参增加人户状况名称
|
|
|
|
bean.setRhzk(item.getRhzk()); |
|
|
|
if (StringUtils.isBlank(item.getRhzk())){ |
|
|
|
bean.setRenHuCondition(RenHuConditionEnum.ZBQC.getName()); |
|
|
|
}else { |
|
|
|
bean.setRenHuCondition(RenHuConditionEnum.getNameByCode(item.getRhzk())); |
|
|
|
} |
|
|
|
return bean; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
result.setUserList(userList); |
|
|
|
userList.add(bean); |
|
|
|
} |
|
|
|
} |
|
|
|
result.setUserList(userList); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
@ -1719,6 +1743,13 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi |
|
|
|
r.setGzdw(resiEntity.getGzdw()); |
|
|
|
// 因灵山项目添加一下几列 start
|
|
|
|
r.setMz(resiEntity.getMz()); |
|
|
|
Result<List<OptionResultDTO>> mzRes=epmetAdminOpenFeignClient.getNationOption(); |
|
|
|
if(mzRes.success()&&CollectionUtils.isNotEmpty(mzRes.getData())){ |
|
|
|
Map<String, String> mzMap = mzRes.getData().stream().collect(Collectors.toMap(OptionResultDTO::getValue, OptionResultDTO::getLabel)); |
|
|
|
if(MapUtils.isNotEmpty(mzMap)&&mzMap.containsKey(r.getMz())){ |
|
|
|
r.setMzName(mzMap.get(r.getMz())); |
|
|
|
} |
|
|
|
} |
|
|
|
r.setYhzgx(resiEntity.getYhzgx()); |
|
|
|
r.setYhzgxName(StrConstant.EPMETY_STR); |
|
|
|
Result<List<OptionResultDTO>> yhzgxRes=epmetAdminOpenFeignClient.getRelationshipOption(); |
|
|
|