diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RelationshipEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RelationshipEnum.java new file mode 100644 index 0000000000..39a0f81550 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/RelationshipEnum.java @@ -0,0 +1,58 @@ +package com.epmet.commons.tools.enums; + +/** + * @author Administrator + */ + +public enum RelationshipEnum { + /** + * 环境变量枚举 + */ + UN_KNOWN("0", "暂不清楚", 0), + SELF("1", "本人", 1), + spouse("2", "配偶", 2), + CHILD("3", "子女", 3), + PARENT("4", "父母", 4), + PARENT_IN_LAW("5", "岳父母或公婆", 5), + GRANDPARENT_IN_LAW("6", "祖父母", 6), + CHILD_IN_LAW("7", "媳婿", 7), + GRANDCHILD("8", "孙子女", 8), + BROTHER_AND_SISTER("9", "兄弟姐妹", 9), + OTHER("10", "其他", 10), + ; + + private final String code; + private final String name; + private final Integer sort; + + + + RelationshipEnum(String code, String name, Integer sort) { + this.code = code; + this.name = name; + this.sort = sort; + } + + public static RelationshipEnum getEnum(String code) { + RelationshipEnum[] values = RelationshipEnum.values(); + for (RelationshipEnum value : values) { + if (value.getCode().equals(code)) { + return value; + } + } + return RelationshipEnum.UN_KNOWN; + } + + + public String getCode() { + return code; + } + + public String getName() { + return name; + } + + public Integer getSort(){ + return sort; + } +} \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 4784584218..5b18f345d2 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -516,4 +516,7 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/ichouse/selecthouseinfobyidcard") Result> selectHouseInfoByIdCard(@RequestParam("idCard")String idCard); + + @GetMapping("/gov/org/ichouse/{id}") + Result get(@PathVariable("id") String id); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 95219d6b1b..c6e0f96aa4 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -310,6 +310,11 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectHouseInfoByIdCard", idCard); } + @Override + public Result get(String id) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "get", id); + } + @Override public Result selectPidsByGridId(String gridId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "selectPidsByGridId", gridId); diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/OwnerRelationResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/OwnerRelationResultDTO.java new file mode 100644 index 0000000000..9a3e0c23d7 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/OwnerRelationResultDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.result; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zhaoqifeng + * @DateTime 2020/11/18 下午1:47 + */ +@NoArgsConstructor +@Data +public class OwnerRelationResultDTO implements Serializable { + + private static final long serialVersionUID = 2876258704168954941L; + private String ownerName; + private List userList; + + @NoArgsConstructor + @Data + public static class UserListBean { + private String userId; + private String userName; + private String isSelf; + private String relation; + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index f525d82218..7030248522 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -31,7 +31,6 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.service.IcResiUserImportService; import com.epmet.service.IcResiUserService; @@ -272,4 +271,16 @@ public class IcResiUserController { return resultForm.getData(); } + /** + * @Description 个人信息-家庭关系 + * @Param formDTO + * @Return {@link Result< OwnerRelationResultDTO>} + * @Author zhaoqifeng + * @Date 2021/11/5 11:13 + */ + @PostMapping("ownerrelation") + public Result getOwnerRelation(@RequestBody PersonDataFormDTO formDTO) { + return new Result().ok(icResiUserService.getOwnerRelation(formDTO.getUserId())); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index 2e9e5cf70d..ea67a9b872 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -21,10 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.form.*; -import com.epmet.dto.result.FormItem; -import com.epmet.dto.result.HomeUserResultDTO; -import com.epmet.dto.result.PersonDataResultDTO; -import com.epmet.dto.result.SearchByNameResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.IcResiUserEntity; import java.util.List; @@ -107,4 +104,12 @@ public interface IcResiUserService extends BaseService { */ Map> getDataForExport(Map itemList, String customerId, String formCode, String baseTableName, List conditions); + /** + * @Description 家庭关系 + * @Param userId + * @Return {@link OwnerRelationResultDTO} + * @Author zhaoqifeng + * @Date 2021/11/5 10:28 + */ + OwnerRelationResultDTO getOwnerRelation(String userId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index b353507792..33db29fba4 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -28,6 +28,7 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.GenderEnum; import com.epmet.commons.tools.enums.HouseTypeEnum; +import com.epmet.commons.tools.enums.RelationshipEnum; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; @@ -39,6 +40,7 @@ import com.epmet.constant.UserConstant; import com.epmet.dao.IcResiUserDao; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerGridDTO; +import com.epmet.dto.IcHouseDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.IcResiUserEntity; @@ -603,4 +605,44 @@ public class IcResiUserServiceImpl extends BaseServiceImpl houseResult = govOrgOpenFeignClient.get(user.getHomeId()); + if (!houseResult.success()) { + throw new RenException(houseResult.getCode(),houseResult.getMsg()); + } + result.setOwnerName(houseResult.getData().getOwnerName()); + + //获取用户所在家庭里所有人员信息 + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcResiUserEntity::getHomeId, user.getHomeId()); + wrapper.orderByAsc(IcResiUserEntity::getYhzgx); + List resiUserList = baseDao.selectList(wrapper); + List userList = resiUserList.stream().map(item -> { + OwnerRelationResultDTO.UserListBean bean = new OwnerRelationResultDTO.UserListBean(); + bean.setUserId(item.getId()); + bean.setUserName(item.getName()); + bean.setRelation(RelationshipEnum.getEnum(item.getYhzgx()).getName()); + if (userId.equals(item.getId())) { + bean.setIsSelf(NumConstant.ONE_STR); + } + return bean; + }).collect(Collectors.toList()); + result.setUserList(userList); + return result; + } }