# 后端通信

平台提供了后端 SDK,用于开发者调用平台开放的接口

SDK 下载地址 (opens new window)

# 导入和调用

新建一个对象AssetCloudRequest()

  • url:完整的请求路径 https://platform.assetcloud.org.cn/dev-api/+请求路径;

  • keysecret:平台获取的 key 和 secret

Get 调用方法:

AssetCloudRequest request = new AssetCloudRequest();
request.setUrl("");
request.setKey("");
request.setSecret("");
request.setHttpMethods(HttpMethods.GET);
HttpRequestUtil.send(request);

Post 调用方法:

AssetCloudRequest request = new AssetCloudRequest();
request.setUrl("");
request.setKey("");
request.setSecret("");
request.setBody("");
request.setHttpMethods(HttpMethods.POST);
HttpRequestUtil.send(request);

Delete 调用方法:

AssetCloudRequest request = new AssetCloudRequest();
request.setUrl("");
request.setKey("");
request.setSecret("");
request.setHttpMethods(HttpMethods.DELETE);
HttpRequestUtil.send(request);

Put 调用方法:

AssetCloudRequest request = new AssetCloudRequest();
request.setUrl("");
request.setKey("");
request.setSecret("");
request.setBody("");
request.setHttpMethods(HttpMethods.Put);
HttpRequestUtil.send(request);

返回结果为:AssetCloudResponse<T>

字段 类型 说明
code int 状态码
success Boolean 是否成功
data T 承载数据
msg String 返回消息

# 后端可用接口

# 1. 根据userId获取用户信息

# 接口地址

/asset-system/person/get/person/by/id

# 接口描述

根据用户id获取用户信息

# 请求参数


参数名称 是否必须 数据类型 参数说明
userId true Long 用户Id
# 请求方法

GET

# 调用样例

/asset-system/person/get/person/by/id?userId=1272914195944538975

# 返回结果示例

{
    "code": 200,
    "success": true,
    "data": {
        "createUser": -1,
        "createTime": "2020-09-11 15:11:15",
        "updateUser": -1,
        "updateTime": "2020-09-11 07:11:23",
        "status": 2,
        "isDeleted": 0,
        "id": "1304316556292919298",
        "tenantCode": "ZH2009110711144JcuuI",
        "realName": "测试账号",
        "idCard": "",
        "gender": -1,
        "userBirthday": "",
        "userEmail": "",
        "userPhoto": "",
        "userId": "1272914195944538975",
        "phoneNumber": "12300000004",
        "province": "",
        "city": "",
        "streetAddress": "",
        "userCode": "",
        "isMaster": 1,
        "deptIdList": [],
        "masterUnitId": -1,
        "masterPersonId": -1,
        "masterTenantCode": "",
        "roleId": "2,269",
        "roleName": "集团管理员,单位管理员",
        "deptName": "",
        "password": "",
        "isCreated": 2,
        "theme": "default",
        "ifPurchase": true,
        "deptList": []
    },
    "msg": "操作成功"
}

# 错误返回值

# 错误代码对照表

错误代码 返回信息 详细描述
400 系统错误,请稍候再试 业务异常
401 系统错误,请稍候再试 接口未授权
404 系统错误,请稍候再试 请求地址有误
405 系统错误,请稍候再试 请求方法不支持
500 系统错误,请稍候再试 服务器错误
Last Updated: 3/10/2022, 10:39:52 PM