Browse Source

/epmetuser/icresiuser/ownerrelation调整适配灵山需求

master
yinzuomei 2 years ago
parent
commit
af2936cfc1
  1. 6
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PersonDataFormDTO.java
  2. 8
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcResiUserBriefDTO.java
  3. 25
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/OwnerRelationResultDTO.java
  4. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  5. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  6. 51
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

6
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PersonDataFormDTO.java

@ -23,4 +23,10 @@ public class PersonDataFormDTO implements Serializable {
@NotBlank(message = "tokenDto获取customerId不能为空",groups = PersonDataForm.class) @NotBlank(message = "tokenDto获取customerId不能为空",groups = PersonDataForm.class)
private String customerId; private String customerId;
/**
* 灵山项目需求改造此接口添加houseId支持查询房屋里的所有人
* /epmetuser/icresiuser/ownerrelation接口userId与houseId至少传一个值
*/
private String houseId;
} }

8
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcResiUserBriefDTO.java

@ -97,10 +97,14 @@ public class IcResiUserBriefDTO extends HouseUserDTO implements Serializable {
* 民族 * 民族
*/ */
private String mz; private String mz;
/** /**
* 因灵山项目添加此列 * 因灵山项目添加此列
* 与户主关系存储字典纸 * 民族姓名
*/
private String mzName;
/**
* 因灵山项目添加此列
* 与户主关系存储字典/sys/dict/data/relationship
*/ */
private String yhzgx; private String yhzgx;

25
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/OwnerRelationResultDTO.java

@ -15,7 +15,18 @@ import java.util.List;
public class OwnerRelationResultDTO implements Serializable { public class OwnerRelationResultDTO implements Serializable {
private static final long serialVersionUID = 2876258704168954941L; private static final long serialVersionUID = 2876258704168954941L;
/**
* 与户主关系是本人的居民
*/
private String ownerName; private String ownerName;
/**
* 与户主关系是本人的居民id
*/
private String ownerUserId;
/**
* 房屋里的所有人
*/
private List<UserListBean> userList; private List<UserListBean> userList;
@NoArgsConstructor @NoArgsConstructor
@ -24,11 +35,25 @@ public class OwnerRelationResultDTO implements Serializable {
private String userId; private String userId;
private String userName; private String userName;
private String isSelf; private String isSelf;
/**
* 与户主关系key字典表
*/
private String yhzgx;
/**
* 与户主关系名称
*/
private String relation; private String relation;
/**
* 人户情况
*/
private String rhzk;
/** /**
* 2022.11.17人户状况人户一致人在户不在户在人不在暂不清楚 * 2022.11.17人户状况人户一致人在户不在户在人不在暂不清楚
*/ */
private String renHuCondition; private String renHuCondition;
} }
} }

2
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -859,7 +859,7 @@ public class IcResiUserController implements ResultDataResolver {
*/ */
@PostMapping("ownerrelation") @PostMapping("ownerrelation")
public Result<OwnerRelationResultDTO> getOwnerRelation(@RequestBody PersonDataFormDTO formDTO) { public Result<OwnerRelationResultDTO> getOwnerRelation(@RequestBody PersonDataFormDTO formDTO) {
return new Result<OwnerRelationResultDTO>().ok(icResiUserService.getOwnerRelation(formDTO.getUserId())); return new Result<OwnerRelationResultDTO>().ok(icResiUserService.getOwnerRelation(formDTO.getUserId(),formDTO.getHouseId()));
} }
/** /**

2
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -134,7 +134,7 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @Author zhaoqifeng * @Author zhaoqifeng
* @Date 2021/11/5 10:28 * @Date 2021/11/5 10:28
*/ */
OwnerRelationResultDTO getOwnerRelation(String userId); OwnerRelationResultDTO getOwnerRelation(String userId,String houseId);
/** /**
* @Description 获取一栋楼每个房间人员分类的数量 * @Description 获取一栋楼每个房间人员分类的数量

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

@ -1550,41 +1550,65 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
* @Date 2021/11/5 10:28 * @Date 2021/11/5 10:28
*/ */
@Override @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(); OwnerRelationResultDTO result = new OwnerRelationResultDTO();
result.setOwnerName("");
if(StringUtils.isBlank(houseId)){
//获取用户信息 //获取用户信息
IcResiUserEntity user = baseDao.selectById(userId); IcResiUserEntity user = baseDao.selectById(userId);
result.setOwnerName("");
if (null != user) { if (null != user) {
houseId=user.getHomeId();
}
}
//获取用户所在家庭里所有人员信息 //获取用户所在家庭里所有人员信息
LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcResiUserEntity::getHomeId, user.getHomeId()); wrapper.eq(IcResiUserEntity::getHomeId, houseId);
wrapper.eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR); wrapper.eq(IcResiUserEntity::getStatus,NumConstant.ZERO_STR);
wrapper.orderByAsc(IcResiUserEntity::getYhzgx); wrapper.orderByAsc(IcResiUserEntity::getYhzgx);
List<IcResiUserEntity> resiUserList = baseDao.selectList(wrapper); List<IcResiUserEntity> resiUserList = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(resiUserList)) { 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(); OwnerRelationResultDTO.UserListBean bean = new OwnerRelationResultDTO.UserListBean();
bean.setUserId(item.getId()); bean.setUserId(item.getId());
bean.setUserName(item.getName()); bean.setUserName(item.getName());
bean.setYhzgx(item.getYhzgx());
bean.setRelation(RelationshipEnum.getEnum(item.getYhzgx()).getName()); bean.setRelation(RelationshipEnum.getEnum(item.getYhzgx()).getName());
bean.setIsSelf(NumConstant.ZERO_STR);
// 与入参里的居民id对比
if (StringUtils.isNotBlank(userId)) {
if (userId.equals(item.getId())) { if (userId.equals(item.getId())) {
bean.setIsSelf(NumConstant.ONE_STR); bean.setIsSelf(NumConstant.ONE_STR);
} }
//如果与房主的关系是本人,则这个人就是房主
if (RelationshipEnum.SELF.getCode().equals(item.getYhzgx())) {
result.setOwnerName(item.getName());
} }
//2022.11.17 返参增加人户状况名称 //2022.11.17 返参增加人户状况名称
bean.setRhzk(item.getRhzk());
if (StringUtils.isBlank(item.getRhzk())){ if (StringUtils.isBlank(item.getRhzk())){
bean.setRenHuCondition(RenHuConditionEnum.ZBQC.getName()); bean.setRenHuCondition(RenHuConditionEnum.ZBQC.getName());
}else { }else {
bean.setRenHuCondition(RenHuConditionEnum.getNameByCode(item.getRhzk())); bean.setRenHuCondition(RenHuConditionEnum.getNameByCode(item.getRhzk()));
} }
return bean; userList.add(bean);
}).collect(Collectors.toList()); }
result.setUserList(userList);
} }
result.setUserList(userList);
} }
return result; return result;
} }
@ -1673,6 +1697,13 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
r.setGzdw(resiEntity.getGzdw()); r.setGzdw(resiEntity.getGzdw());
// 因灵山项目添加一下几列 start // 因灵山项目添加一下几列 start
r.setMz(resiEntity.getMz()); 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.setYhzgx(resiEntity.getYhzgx());
r.setYhzgxName(StrConstant.EPMETY_STR); r.setYhzgxName(StrConstant.EPMETY_STR);
Result<List<OptionResultDTO>> yhzgxRes=epmetAdminOpenFeignClient.getRelationshipOption(); Result<List<OptionResultDTO>> yhzgxRes=epmetAdminOpenFeignClient.getRelationshipOption();

Loading…
Cancel
Save