HC小区接口文档

添加业主接口文档

一、接口名称

添加业主

二、接口描述

该接口用于第三方系统(如招商系统)同步业主信息到物业管理系统中,支持添加业主和家庭成员信息,并可同步门禁人脸信息。

三、接口路径

http://{ip}:{port}/iot/api/owner.saveOwner

四、请求方法

POST

五、请求头

参数名称 必填 类型 描述
Authorization String 用户认证token
app-id String 应用ID
transaction-id String 请求流水号
sign String 签名,请参考物业系统签名
req-time String 请求时间 YYYYMMDDhhmmss

签名方法|HC小区接口文档

六、请求参数

6.1 请求体参数

参数名称 必填 类型 长度 描述 示例值
communityId String 30 小区ID "2022121921870161"
name String 64 业主姓名 "王王"
link String 11 业主手机号 "18909718888"
idCard String 30 业主身份证号 ""
address String 512 地址 "张三"
sex String 12 性别(男:1,女:0) "0"
ownerTypeCd String 12 业主类型(1001:业主,2002:家庭成员) "1001"
remark String 512 备注 ""
ownerId String 30 业主ID(业主类型填-1,家庭成员填业主ID) "-1"
ownerPhoto String - 业主人脸照片(用于门禁同步) ""
age String - 年龄 ""
roomId String - 房屋ID(绑定房屋时需要) ""
state 条件必填 String - 状态(绑定房屋时需要) ""
storeId 条件必填 String - 商铺ID(绑定房屋时需要) ""
attrs JSONArray - 业主扩展属性 []

七、返回值

7.1 返回值结构

参数名称 类型 长度 描述 示例值
code int 11 返回码(0成功) 0
msg String 250 返回信息 "成功"

八、示例请求

{
    "name": "王王",
    "age": "",
    "link": "18909718888",
    "address": "张三",
    "sex": "0",
    "ownerTypeCd": "1001",
    "remark": "",
    "ownerId": -1,
    "ownerPhoto": "",
    "idCard": "",
    "communityId": "2022121921870161"
}

九、示例响应

{
    "code": 0,
    "msg": "成功"
}

十、业务逻辑说明

  1. 参数校验

    • 必填字段校验(name, age, link, sex, ownerTypeCd, communityId)
    • 如果包含roomId,则必须校验state和storeId
    • 属性值校验
  2. 数据校验

    • 手机号唯一性校验(同一小区内)
    • 身份证号唯一性校验(如果提供)
  3. 业务处理

    • 生成业主memberId
    • 保存业主基本信息
    • 如果包含房屋信息,建立业主房屋关系
    • 保存业主照片(用于门禁系统)
    • 同步门禁系统
    • 处理业主扩展属性
  4. 事务处理

    • 整个操作在事务中执行,保证数据一致性

十一、注意事项

  1. 当ownerTypeCd为"1001"(业主)时,ownerId必须传"-1"
  2. 当ownerTypeCd为"2002"(家庭成员)时,ownerId必须传对应业主ID
  3. 手机号在同一小区内必须唯一
  4. 身份证号在同一小区内必须唯一(如果提供)
  5. 绑定房屋时需要提供roomId、state和storeId