### Get New Notice Lists using Java SDK Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_消息服务/获取消息列表.md Demonstrates how to use the Qpaas Java SDK to fetch a list of new notices based on specified conditions. This includes setting up request parameters like start index, limit, source module, and custom conditions such as application and source keys. The example shows how to handle the response, checking for success and printing the data or error message. ```java int start = 0; int limit = 20; String from = "message"; Map conditions = new HashMap(); List apps = new ArrayList(); apps.add("appnotice"); conditions.put("app", apps); // 来源key(非必传,自定值,可传多个值,英文逗号分隔,用于过滤消息) conditions.put("sourceKey", "type1"); NoticeOnNewListsRequest request = new NoticeOnNewListsRequest(); request.setStart(start); request.setLimit(limit); //from 模块,标记消息在哪个模块被已读,有消息中心(messageCenter)、门户(portal)、启聊(qChat) ,正常查询时可不传 request.setFrom(from); //conditions是比较复杂,比如:{"app":["cc","urge"], "status":0,"entId":["APICeShiQiYe"],"tabType":"all"} 这里过滤的消息类型,已读未读、企业id、tab标签 request.setConditions(conditions); request.setDebug(true); //打开日志 QpaasHttpResponse> response = qpaasHttpClient.doAction(request); boolean result = response.getSuccess(); // response.getStatus(); if (result) { Map data = response.getData(); System.out.println(data); } else { String message = response.getMessage(); System.out.println(message); } ``` -------------------------------- ### Get Video Stream List using Java SDK Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_IOT_视频/获取视频流列表.md This Java code snippet demonstrates how to initialize the QpaasHttpClient and make a request to the /openservice/iot-service/video/list endpoint to retrieve a list of video streams. It shows how to set various request parameters such as category ID, category name, code, container ID, pagination details, and search criteria. The example also includes notes on using formData and setting custom headers. ```java package com.qpaas.open.api; import cn.hutool.json.JSONUtil; import java.util.*; import java.math.*; import com.qpaas.open.api.IotServiceVideoListPostRequest; import com.qpaas.open.api.model.*; import com.qpaas.sdk.core.QpaasCredential; import com.qpaas.sdk.core.http.QpaasHttpClient; public class IotServiceVideoListPostRequestClient { public static void main(String[] args){ String secretKey = "d673a9c2d9a24259862b85bbbbbbb"; String secretId = "n6aRhOcCuJb0usfUo7a7iccccccccc"; String endpoint = "http://qpaas.com"; long readTimeout = 10000; long connectTimeout=10000; int maxIdleConnection=5; QpaasCredential credential = new QpaasCredential(secretKey, secretId); QpaasHttpClient qpaasHttpClient = QpaasHttpClient.getInstance(credential, endpoint, readTimeout, connectTimeout, maxIdleConnection); IotServiceVideoListPostRequest request = new IotServiceVideoListPostRequest(); request.setCategoryId(categoryId);//分类id List categoryName = new ArrayList<>(); categoryName.add(new String()); request.setCategoryName(categoryName);//分类名称,精确匹配;或路径,如:/xx企业/安全 request.setCode(code);//编码 List codeList = new ArrayList<>(); codeList.add(new String()); request.setCodeList(codeList);//编码,批量查询编码使用 request.setContainerId(containerId);//容器id request.setPageNum(pageNum);//页码,默认1 request.setPageSize(pageSize);//每页数量(默认15,上限1000) request.setSearch(search);//搜索 /** * if formData use: JSONUtil.toJsonStr(qpaasHttpClient.doActionFormData(request)) */ System.out.print(JSONUtil.toJsonStr(qpaasHttpClient.doAction(request))); /** can use header openservice: request.sdkHeader.put("traceid", "xxxx"); openapi: request.getSdkHeader().put("traceid", "xxxx"); * apipath: /openservice/iot-service/video/list */ } } //以上为系统生成示例代码 ``` -------------------------------- ### Get App Extend Config using Qpaas Java SDK Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_业务流程/获取应用扩展配置.md This snippet demonstrates how to initialize the Qpaas HTTP client and make a request to get application extension configurations. It requires setting up credentials, endpoint, and timeouts. The output is printed as a JSON string. ```java package com.qpaas.open.api; import cn.hutool.json.JSONUtil; import java.util.*; import java.math.*; import com.qpaas.open.api.AppDesignerAppExtendConfigGetRequest; import com.qpaas.open.api.model.*; import com.qpaas.sdk.core.QpaasCredential; import com.qpaas.sdk.core.http.QpaasHttpClient; public class AppDesignerAppExtendConfigGetRequestClient { public static void main(String[] args){ String secretKey = "d673a9c2d9a24259862b85bbbbbbb"; String secretId = "n6aRhOcCuJb0usfUo7a7iccccccccc"; String endpoint = "http://qpaas.com"; long readTimeout = 10000; long connectTimeout=10000; int maxIdleConnection=5; QpaasCredential credential = new QpaasCredential(secretKey, secretId); QpaasHttpClient qpaasHttpClient = QpaasHttpClient.getInstance(credential, endpoint, readTimeout, connectTimeout, maxIdleConnection); AppDesignerAppExtendConfigGetRequest request = newAppDesignerAppExtendConfigGetRequest(); request.setEntId(entId);//操作企业id request.setUserId(userId);//当前操作人 request.setAppType(appType);//workflow|information request.setAppId(appId);//应用id /** * if formData use: JSONUtil.toJsonStr(qpaasHttpClient.doActionFormData(request)) */ System.out.print(JSONUtil.toJsonStr(qpaasHttpClient.doAction(request))); /** can use header openservice: request.sdkHeader.put("traceid", "xxxx"); openapi: request.getSdkHeader().put("traceid", "xxxx"); * apipath: /openservice/app-designer/appExtendConfig */ } } //以上为系统生成示例代码 ``` -------------------------------- ### Get Navigation Menus by Type using Java SDK Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_导航/根据类型获取导航菜单.md This snippet shows how to initialize the QpaasHttpClient, create a request object for getting menus by type, set necessary parameters like type, enterprise ID, and user ID, and then execute the request. It also includes notes on handling form data and custom headers. ```java package com.qpaas.open.api; import cn.hutool.json.JSONUtil; import java.util.*; import java.math.*; import com.qpaas.open.api.EagleUserNavigationGetMenusByTypeGetRequest; import com.qpaas.open.api.model.*; import com.qpaas.sdk.core.QpaasCredential; import com.qpaas.sdk.core.http.QpaasHttpClient; public class EagleUserNavigationGetMenusByTypeGetRequestClient { public static void main(String[] args){ String secretKey = "d673a9c2d9a24259862b85bbbbbbb"; String secretId = "n6aRhOcCuJb0usfUo7a7iccccccccc"; String endpoint = "http://qpaas.com"; long readTimeout = 10000; long connectTimeout=10000; int maxIdleConnection=5; QpaasCredential credential = new QpaasCredential(secretKey, secretId); QpaasHttpClient qpaasHttpClient = QpaasHttpClient.getInstance(credential, endpoint, readTimeout, connectTimeout, maxIdleConnection); EagleUserNavigationGetMenusByTypeGetRequest request = new EagleUserNavigationGetMenusByTypeGetRequest(); request.setType(type);//导航类型:sys-系统导航、app-app导航、 h5-h5导航 request.setEntId(entId);//企业id request.setCurUserId(curUserId);//用户id /** * if formData use: JSONUtil.toJsonStr(qpaasHttpClient.doActionFormData(request)) */ System.out.print(JSONUtil.toJsonStr(qpaasHttpClient.doAction(request))); /** can use header openservice: request.sdkHeader.put("traceid", "xxxx"); openapi: request.getSdkHeader().put("traceid", "xxxx"); * apipath: /openservice/eagle-user/navigation/getMenusByType */ } } //以上为系统生成示例代码 ``` -------------------------------- ### GET /openservice/iot-service/device/tech Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_IOT/工艺列表.md Retrieves a list of device technologies. ```APIDOC ## GET /openservice/iot-service/device/tech ### Description Retrieves a list of device technologies. ### Method GET ### Endpoint /openservice/iot-service/device/tech ### Parameters #### Query Parameters - **entId** (string) - Required - Enterprise ID. - **code** (string) - Required - Device code. - **propCode** (string) - Required - Device property code. ### Request Example ```json { "entId": "your_enterprise_id", "code": "your_device_code", "propCode": "your_property_code" } ``` ### Response #### Success Response (200) - **techList** (array) - A list of device technologies. - **techName** (string) - The name of the technology. - **techCode** (string) - The code of the technology. #### Response Example ```json { "techList": [ { "techName": "Technology A", "techCode": "TECH_A" }, { "techName": "Technology B", "techCode": "TECH_B" } ] } ``` ``` -------------------------------- ### GET /openservice/iot-service/sensor/queryOne Source: https://context7.com/qycloud/qpaas-java-sdk-docs/llms.txt 根据点位编码查询单个传感器的详细信息。 ```APIDOC ## GET /openservice/iot-service/sensor/queryOne ### Description 根据点位编码查询单个传感器的详细信息。 ### Method GET ### Endpoint /openservice/iot-service/sensor/queryOne ### Parameters #### Path Parameters N/A #### Query Parameters - **code** (string) - Required - 点位编码 #### Request Body N/A ### Request Example ``` GET /openservice/iot-service/sensor/queryOne?code=SENSOR001 ``` ### Response #### Success Response (200) - **code** (integer) - 响应码 - **message** (string) - 响应消息 - **data** (object) - 返回数据 - **code** (string) - 点位编码 - **name** (string) - 点位名称 - **description** (string) - 点位描述 - **gatewayCode** (string) - 网关编码 - **online** (integer) - 在线状态 #### Response Example ```json { "code": 0, "message": "Success", "data": { "code": "SENSOR001", "name": "车间温度", "description": "车间一号温度传感器", "gatewayCode": "GW001", "online": 1 } } ``` ``` -------------------------------- ### Get Video Online Rate using Java SDK Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_IOT_视频/获取视频在线率.md This snippet shows how to use the qpaas-java-sdk to call the POST /openservice/iot-service/video/onlineRate API to get the video online rate. It includes initializing the QpaasHttpClient with credentials and endpoint, setting request parameters like code, start time, end time, and space ID, and then making the API call. ```java package com.qpaas.open.api; import cn.hutool.json.JSONUtil; import java.util.*; import java.math.*; import com.qpaas.open.api.IotServiceVideoOnlineRatePostRequest; import com.qpaas.open.api.model.*; import com.qpaas.sdk.core.QpaasCredential; import com.qpaas.sdk.core.http.QpaasHttpClient; public class IotServiceVideoOnlineRatePostRequestClient { public static void main(String[] args){ String secretKey = "d673a9c2d9a24259862b85bbbbbbb"; String secretId = "n6aRhOcCuJb0usfUo7a7iccccccccc"; String endpoint = "http://qpaas.com"; long readTimeout = 10000; long connectTimeout=10000; int maxIdleConnection=5; QpaasCredential credential = new QpaasCredential(secretKey, secretId); QpaasHttpClient qpaasHttpClient = QpaasHttpClient.getInstance(credential, endpoint, readTimeout, connectTimeout, maxIdleConnection); IotServiceVideoOnlineRatePostRequest request = new IotServiceVideoOnlineRatePostRequest(); request.setCode(code);// request.setStartTime(startTime);//格式:yyyy-MM-dd HH:mm:ss request.setEndTime(endTime);// request.setSpaceId(spaceId);// /** * if formData use: JSONUtil.toJsonStr(qpaasHttpClient.doActionFormData(request)) */ System.out.print(JSONUtil.toJsonStr(qpaasHttpClient.doAction(request))); /** can use header openservice: request.sdkHeader.put("traceid", "xxxx"); openapi: request.getSdkHeader().put("traceid", "xxxx"); * apipath: /openservice/iot-service/video/onlineRate */ } } //以上为系统生成示例代码 ``` -------------------------------- ### Create Enterprise Source: https://context7.com/qycloud/qpaas-java-sdk-docs/llms.txt Creates a new enterprise tenant, including setting up an administrator account. ```APIDOC ## POST /openservice/paas-operation/enterprise/entcreation ### Description Creates a new enterprise tenant, including the setup of an administrator account. ### Method POST ### Endpoint /openservice/paas-operation/enterprise/entcreation ### Parameters #### Request Body - **entId** (string) - Required - Enterprise ID. - **userId** (string) - Required - User ID associated with the creation. - **channel** (string) - Optional - Channel information. - **referrer** (string) - Optional - Referrer information. - **industry** (string) - Optional - Industry type (e.g., "采矿业,煤炭/黑色金属矿开采/石油天然气开采"). - **nature** (string) - Optional - Enterprise nature (e.g., "正式企业", "测试企业"). - **name** (string) - Required - Name of the enterprise. - **address** (string) - Optional - Enterprise address. - **contact** (string) - Optional - Contact person's name. - **phone** (string) - Optional - Contact person's phone number. - **province** (string) - Optional - Province code. - **city** (string) - Optional - City code. - **serialNo** (string) - Optional - Serial number. - **callBackUrl** (string) - Optional - Callback URL for notifications. - **existAccount** (boolean) - Optional - Whether the account already exists. - **userBase** (object) - Required - Administrator account configuration. - **userId** (string) - Required - Administrator's user ID. - **realName** (string) - Required - Administrator's full name. - **password** (string) - Required - Administrator's password. - **phone** (string) - Optional - Administrator's phone number. - **email** (string) - Optional - Administrator's email address. ### Request Example ```json { "entId": "apiceshiqiye", "userId": "apitest", "channel": "", "referrer": "", "industry": "采矿业,煤炭/黑色金属矿开采/石油天然气开采", "nature": "正式企业", "name": "sdk创建", "address": "", "contact": "联系人", "phone": "18912970001", "province": "11", "city": "1101", "serialNo": "12", "callBackUrl": "http://callback.example.com/api/callback", "existAccount": false, "userBase": { "userId": "ceshichuangj", "realName": "管理员", "password": "111111", "phone": "18912970003", "email": "ceshichuangj@qq.com" } } ``` ### Response #### Success Response (200) - **data** (object) - Response data, typically empty for success. - **success** (boolean) - Indicates if the operation was successful. #### Response Example ```json { "success": true, "data": {} } ``` ``` -------------------------------- ### Add Product using Java SDK Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_IOT/新增产品.md Demonstrates how to add a new product using the Qpaas Java SDK. It includes initializing the QpaasHttpClient with credentials and endpoint, creating an IotServiceProductAddPostRequest object, setting product details, and executing the request. The output is printed as a JSON string. ```java package com.qpaas.open.api; import cn.hutool.json.JSONUtil; import java.util.*; import java.math.*; import com.qpaas.open.api.IotServiceProductAddPostRequest; import com.qpaas.open.api.model.*; import com.qpaas.sdk.core.QpaasCredential; import com.qpaas.sdk.core.http.QpaasHttpClient; public class IotServiceProductAddPostRequestClient { public static void main(String[] args){ String secretKey = "d673a9c2d9a24259862b85bbbbbbb"; String secretId = "n6aRhOcCuJb0usfUo7a7iccccccccc"; String endpoint = "http://qpaas.com"; long readTimeout = 10000; long connectTimeout=10000; int maxIdleConnection=5; QpaasCredential credential = new QpaasCredential(secretKey, secretId); QpaasHttpClient qpaasHttpClient = QpaasHttpClient.getInstance(credential, endpoint, readTimeout, connectTimeout, maxIdleConnection); IotServiceProductAddPostRequest request = new IotServiceProductAddPostRequest(); request.setEntId(entId);//企业id request.setUserId(userId);//用户id request.setName(name);//产品名称 request.setCategoryCode(categoryCode);//分类code request.setDescription(description);//描述 /** * if formData use: JSONUtil.toJsonStr(qpaasHttpClient.doActionFormData(request)) */ System.out.print(JSONUtil.toJsonStr(qpaasHttpClient.doAction(request))); /** can use header openservice: request.sdkHeader.put("traceid", "xxxx"); openapi: request.getSdkHeader().put("traceid", "xxxx"); * apipath: /openservice/iot-service/product/add */ } } //以上为系统生成示例代码 ``` -------------------------------- ### GET /openservice/paas-operation/enterprise/disable Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_租户服务/企业禁用.md This endpoint is used to disable an enterprise. The SDK example demonstrates how to make the request. ```APIDOC ## GET /openservice/paas-operation/enterprise/disable ### Description Disables an enterprise within the PaaS operation. ### Method GET ### Endpoint /openservice/paas-operation/enterprise/disable ### Parameters #### Query Parameters - **entId** (string) - Required - The ID of the enterprise to disable. ### Request Example ```java @Test public void enterpriseDisable(){ PaasOperationEnterpriseDisableGetRequest request = new PaasOperationEnterpriseDisableGetRequest(); request.setEntId("dapitest"); PaasOperationEnterpriseDisableResponse res = qpaasHttpClient.doAction(request); } ``` ### Response #### Success Response (200) - **code** (integer) - Response code. - **message** (string) - Response message. - **data** (object) - Response data, which may be empty or contain specific details about the operation. #### Response Example ```json { "code": 0, "message": "Success", "data": {} } ``` ``` -------------------------------- ### GET /openservice/eagle-user/role/pageRoleUsers Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_用户与角色_通讯录管理_角色管理/获取角色用户关系列表(分页).md Retrieves a paginated list of users associated with a specific role. This endpoint is useful for managing role assignments and understanding user permissions. ```APIDOC ## GET /openservice/eagle-user/role/pageRoleUsers ### Description Retrieves a paginated list of users associated with a specific role. ### Method GET ### Endpoint /openservice/eagle-user/role/pageRoleUsers ### Parameters #### Query Parameters - **roleId** (string) - Required - The ID of the role to retrieve users for. - **current** (integer) - Required - The current page number (use 0 for the first page). - **size** (integer) - Required - The number of items per page. - **currentEntId** (string) - Optional - The ID of the current entity. - **currentUserId** (string) - Optional - The ID of the current user. ### Request Example ```json { "roleId": "your_role_id", "current": 0, "size": 10, "currentEntId": "your_entity_id", "currentUserId": "your_user_id" } ``` ### Response #### Success Response (200) - **list** (array) - A list of user objects. - **userId** (string) - The ID of the user. - **username** (string) - The username of the user. - **nickName** (string) - The nickname of the user. - **total** (integer) - The total number of users. - **current** (integer) - The current page number. - **size** (integer) - The number of items per page. #### Response Example ```json { "list": [ { "userId": "user123", "username": "john_doe", "nickName": "John Doe" } ], "total": 50, "current": 0, "size": 10 } ``` ``` -------------------------------- ### POST /openApi/out/app/openworkflow/start Source: https://context7.com/qycloud/qpaas-java-sdk-docs/llms.txt Creates and initiates a business process. Supports saving as a draft or submitting directly to the next step. ```APIDOC ## POST /openApi/out/app/openworkflow/start ### Description Creates and initiates a business process. Supports saving as a draft or submitting directly to the next step. ### Method POST ### Endpoint /openApi/out/app/openworkflow/start ### Parameters #### Request Body - **loginUserId** (string) - Required - The ID of the logged-in user. - **entId** (string) - Required - The enterprise ID. - **appId** (string) - Required - The application ID. - **postButton** (string) - Required - Operation type: 'next' to submit, 'draft' to save as draft. - **postData** (object) - Required - Main form data in 'tableId_fieldId' format. - **parameter** (object) - Optional - Executioner configuration. - **workNode** (object) - Required - Work node details. - **AssignedTo** (array) - Required - List of assigned users/roles/departments. - **id** (string) - Required - Member user ID/role ID/department ID. - **type** (string) - Required - Type: 'member', 'group', or 'department'. - **AssignedMethods** (string) - Required - Assignment method: 'manual'. - **appointParameter** (boolean) - Optional - Whether to appoint parameters. - **slaveData** (object) - Optional - Slave table data. ### Request Example ```json { "loginUserId": "userId001", "entId": "entId001", "appId": "HuiYiShenQing", "postButton": "draft", "postData": { "huiyishenqing_huiyishimingcheng": "2#@zhanbishitu_huiyishimingcheng_2", "huiyishenqing_kaishishijian": "2024-01-15 10:00:00", "huiyishenqing_jieshushijian": "2024-01-15 10:30:00", "parameter": { "HuiYiShenQing_WorkNode_2": { "AssignedTo": [ { "id": "Umj", "type": "member" } ], "AssignedMethods": "manual" } }, "appointParameter": true }, "slaveData": {} } ``` ### Response #### Success Response (200) - **data** (object) - Response data, typically containing workflow instance information. - **message** (string) - Success message. - **code** (integer) - Status code (e.g., 0 for success). #### Response Example ```json { "data": { "instanceId": 12345, "status": "draft" }, "message": "Workflow started successfully", "code": 0 } ``` ``` -------------------------------- ### POST /openservice/iot-service/video/onlineRate Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_IOT_视频/获取视频在线率.md Retrieves the online rate of videos. Requires parameters like code, start time, end time, and space ID. ```APIDOC ## POST /openservice/iot-service/video/onlineRate ### Description Retrieves the online rate of videos within a specified time range and space ID. ### Method POST ### Endpoint /openservice/iot-service/video/onlineRate ### Parameters #### Request Body - **code** (string) - Required - The code for the video. - **startTime** (string) - Required - The start time in 'yyyy-MM-dd HH:mm:ss' format. - **endTime** (string) - Required - The end time in 'yyyy-MM-dd HH:mm:ss' format. - **spaceId** (string) - Required - The ID of the space. ### Request Example ```json { "code": "your_video_code", "startTime": "2023-01-01 00:00:00", "endTime": "2023-01-01 23:59:59", "spaceId": "your_space_id" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the online rate information. - **onlineRate** (number) - The online rate percentage. #### Response Example ```json { "code": 0, "message": "Success", "data": { "onlineRate": 95.5 } } ``` ``` -------------------------------- ### Export DF Detail Data using Java SDK Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_业务流程/模板打印导出(DF).md This Java code snippet shows how to initialize the QpaasHttpClient and make a request to the DF Detail Export API. It includes setting up credentials, endpoint, timeouts, and request parameters like enterprise ID, user ID, app ID, table ID, record ID, and file name. The output is printed as a JSON string. ```java package com.qpaas.open.api; import cn.hutool.json.JSONUtil; import java.util.*; import java.math.*; import com.qpaas.open.api.PhpDatacenterDataDfDetailExportPostRequest; import com.qpaas.open.api.model.*; import com.qpaas.sdk.core.QpaasCredential; import com.qpaas.sdk.core.http.QpaasHttpClient; public class PhpDatacenterDataDfDetailExportPostRequestClient { public static void main(String[] args){ String secretKey = "d673a9c2d9a24259862b85bbbbbbb"; String secretId = "n6aRhOcCuJb0usfUo7a7iccccccccc"; String endpoint = "http://qpaas.com"; long readTimeout = 10000; long connectTimeout=10000; int maxIdleConnection=5; QpaasCredential credential = new QpaasCredential(secretKey, secretId); QpaasHttpClient qpaasHttpClient = QpaasHttpClient.getInstance(credential, endpoint, readTimeout, connectTimeout, maxIdleConnection); PhpDatacenterDataDfDetailExportPostRequest request = new PhpDatacenterDataDfDetailExportPostRequest(); request.setEntId(entId);//操作企业id request.setUserId(userId);//当前操作人 request.setAppId(appId);// request.setTableId(tableId);// request.setRecordId(recordId);// request.setFileName(fileName);//来源(获取应用扩展配置/openservice/app-designer/appExtendConfig sdk中的documents) /** * if formData use: JSONUtil.toJsonStr(qpaasHttpClient.doActionFormData(request)) */ System.out.print(JSONUtil.toJsonStr(qpaasHttpClient.doAction(request))); /** can use header openservice: request.sdkHeader.put("traceid", "xxxx"); openapi: request.getSdkHeader().put("traceid", "xxxx"); * apipath: /openservice/php/datacenter/data/dfDetailExport */ } } //以上为系统生成示例代码 ``` -------------------------------- ### Get Real-time Sensor Data (Java) Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_IOT_点位/获取实时数据(单个).md This Java code snippet demonstrates how to use the Qpaas Java SDK to retrieve real-time data for a specific IoT sensor. It requires the SDK core library and includes setup for credentials, HTTP client, and request object. The output is printed as a JSON string. ```java package com.qpaas.open.api; import cn.hutool.json.JSONUtil; import java.util.*; import java.math.*; import com.qpaas.open.api.IotServiceSensorGetRealDataGetRequest; import com.qpaas.open.api.model.*; import com.qpaas.sdk.core.QpaasCredential; import com.qpaas.sdk.core.http.QpaasHttpClient; public class IotServiceSensorGetRealDataGetRequestClient { public static void main(String[] args){ String secretKey = "d673a9c2d9a24259862b85bbbbbbb"; String secretId = "n6aRhOcCuJb0usfUo7a7iccccccccc"; String endpoint = "http://qpaas.com"; long readTimeout = 10000; long connectTimeout=10000; int maxIdleConnection=5; QpaasCredential credential = new QpaasCredential(secretKey, secretId); QpaasHttpClient qpaasHttpClient = QpaasHttpClient.getInstance(credential, endpoint, readTimeout, connectTimeout, maxIdleConnection); IotServiceSensorGetRealDataGetRequest request = new IotServiceSensorGetRealDataGetRequest(); request.setCode(code);//点位编码 /** * if formData use: JSONUtil.toJsonStr(qpaasHttpClient.doActionFormData(request)) */ System.out.print(JSONUtil.toJsonStr(qpaasHttpClient.doAction(request))); /** can use header openservice: request.sdkHeader.put("traceid", "xxxx"); openapi: request.getSdkHeader().put("traceid", "xxxx"); * apipath: /openservice/iot-service/sensor/getRealData */ } } //以上为系统生成示例代码 ``` -------------------------------- ### Start Workflow Initialization with Java SDK Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_业务流程/流程发起(提交第一步,存草稿).md Demonstrates how to initiate or save a business process as a draft using the Qpaas Java SDK. This method is designed for a single invocation, similar to an 'add' button functionality. It requires setting request parameters like user ID, entity ID, application ID, post button type, master and slave table data, and execution parameters. ```java WorkflowStartRequest request = new WorkflowStartRequest(); request.setLoginUserId(this.getUserId()); request.setEntId(this.getEntId()); //应用ID request.setAppId("HuiYiShenQing"); //提交按钮(next:提交,draft:存草稿) request.setPostButton("draft"); //主表数据 (参考PC页面如何提交这些值 注意组织架构类型和数据源类型的值) Map masterData = new HashMap<>(); // 主表id + "_" + 字段id masterData.put("huiyishenqing_huiyishimingcheng", "2#@zhanbishitu_huiyishimingcheng_2"); //数据值+#@+原始数据源表id+原始数据源表的原始字段+原始据源表被引用的这条数据主id =》 这个结构有点复杂,参考pc页面提交 SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date dateNow = new Date(); masterData.put("huiyishenqing_kaishishijian", dateFormat.format(dateNow)); masterData.put("huiyishenqing_jieshushijian", dateFormat.format(dateNow.getTime()+30*60*1000)); masterData.put("huiyishenqing_shenpiyijian", ""); request.setPostData(masterData); //执行人的结构和PC页面form中的组织架构结构是一样的 可以直接参考 Map parameter = new HashMap<>(); Map workNode = new HashMap<>(); Map assignedTo = new HashMap<>(); assignedTo.put("id", "Umj"); //成员用户id/角色id/部门id assignedTo.put("type", "member"); //类型 ['member' => '成员','group' => '角色', 'department' => '部门']; workNode.put("AssignedTo", Arrays.asList(assignedTo)); workNode.put("AssignedMethods", "manual"); parameter.put("HuiYiShenQing_WorkNode_2", workNode);//需要提交的节点 应用id+"+"+节点id masterData.put("parameter", parameter); masterData.put("appointParameter", true); request.setPostData(masterData); //从表数据 (因为从表数据量不可控,所以如果从表数据多,请参考pc逻辑,请使用 数据应用 的数据插入) request.setSlaveData(Collections.EMPTY_MAP); request.setDebug(true); QpaasHttpResponse> response = qpaasHttpClient.doAction(request); System.out.println(response); ``` -------------------------------- ### POST /openservice/iot-service/sensor/getSensorAlarmData Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_IOT_点位/获取传感器报警列表.md Retrieves a list of sensor alarm data. This endpoint allows filtering by container ID, sensor code, alarm type, and time range. ```APIDOC ## POST /openservice/iot-service/sensor/getSensorAlarmData ### Description Retrieves a list of sensor alarm data. This endpoint allows filtering by container ID, sensor code, alarm type, and time range. ### Method POST ### Endpoint /openservice/iot-service/sensor/getSensorAlarmData ### Parameters #### Query Parameters - **containerId** (string) - Optional - The ID of the container. - **code** (string) - Optional - The code of the sensor. - **codes** (array of strings) - Optional - A list of sensor codes for batch querying. - **alarmType** (string) - Optional - The type of alarm. Possible values include: "传感器报警", "点位离线报警", "多阈值报警", "设备离线报警", "设备报警", "设备电量报警", "视频报警", "GPS离线报警". - **startTime** (long) - Optional - The start timestamp in milliseconds. - **endTime** (long) - Optional - The end timestamp in milliseconds. - **pageNum** (integer) - Optional - The page number for pagination. - **pageSize** (integer) - Optional - The number of items per page (maximum 1000). ### Request Example ```json { "containerId": "your_container_id", "code": "your_sensor_code", "codes": ["code1", "code2"], "alarmType": "传感器报警", "startTime": 1729574884000, "endTime": 1729575484000, "pageNum": 1, "pageSize": 1000 } ``` ### Response #### Success Response (200) - **data** (object) - Contains the list of alarm data. - **alarmList** (array of objects) - List of sensor alarm details. - **alarmId** (string) - The unique identifier for the alarm. - **alarmTime** (long) - The timestamp when the alarm occurred. - **alarmContent** (string) - The content or description of the alarm. - **sensorCode** (string) - The code of the sensor associated with the alarm. - **sensorName** (string) - The name of the sensor. - **containerId** (string) - The ID of the container. - **containerName** (string) - The name of the container. - **alarmType** (string) - The type of the alarm. - **alarmLevel** (string) - The severity level of the alarm. - **alarmStatus** (string) - The current status of the alarm. - **dealTime** (long) - The timestamp when the alarm was dealt with. - **dealUser** (string) - The user who dealt with the alarm. - **dealContent** (string) - The content of the action taken to deal with the alarm. - **total** (integer) - The total number of alarm records. #### Response Example ```json { "data": { "alarmList": [ { "alarmId": "alarm123", "alarmTime": 1729574884000, "alarmContent": "High temperature detected", "sensorCode": "temp001", "sensorName": "Temperature Sensor 1", "containerId": "containerA", "containerName": "Main Container", "alarmType": "传感器报警", "alarmLevel": "High", "alarmStatus": "Active", "dealTime": 0, "dealUser": "", "dealContent": "" } ], "total": 1 } } ``` ``` -------------------------------- ### Add User to Enterprise using Java SDK Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_用户与角色_通讯录管理_用户管理/将用户加入到指定企业.md This Java code snippet demonstrates how to add a user to a specified enterprise using the qpaas-java-sdk. It includes initializing the QpaasHttpClient with credentials and endpoint, creating a request object, setting user and enterprise IDs, and making the API call. Dependencies include cn.hutool.json and qpaas-sdk-core. ```java package com.qpaas.open.api; import cn.hutool.json.JSONUtil; import java.util.*; import java.math.*; import com.qpaas.open.api.EagleUserActionAddUserToEntPostRequest; import com.qpaas.open.api.model.*; import com.qpaas.sdk.core.QpaasCredential; import com.qpaas.sdk.core.http.QpaasHttpClient; public class EagleUserActionAddUserToEntPostRequestClient { public static void main(String[] args){ String secretKey = "d673a9c2d9a24259862b85bbbbbbb"; String secretId = "n6aRhOcCuJb0usfUo7a7iccccccccc"; String endpoint = "http://qpaas.com"; long readTimeout = 10000; long connectTimeout=10000; int maxIdleConnection=5; QpaasCredential credential = new QpaasCredential(secretKey, secretId); QpaasHttpClient qpaasHttpClient = QpaasHttpClient.getInstance(credential, endpoint, readTimeout, connectTimeout, maxIdleConnection); EagleUserActionAddUserToEntPostRequest request = new EagleUserActionAddUserToEntPostRequest(); request.setUserId(userId);// request.setEntId(entId);// request.setOperateUserId(operateUserId);// /** * if formData use: JSONUtil.toJsonStr(qpaasHttpClient.doActionFormData(request)) */ System.out.print(JSONUtil.toJsonStr(qpaasHttpClient.doAction(request))); /** can use header openservice: request.sdkHeader.put("traceid", "xxxx"); openapi: request.getSdkHeader().put("traceid", "xxxx"); * apipath: /openservice/eagle-user/action/addUserToEnt */ } } //以上为系统生成示例代码 ``` -------------------------------- ### Get Sensor Alarm Data using Java SDK Source: https://github.com/qycloud/qpaas-java-sdk-docs/blob/main/后端接口_IOT_点位/获取传感器报警列表.md This Java code snippet demonstrates how to use the Qpaas Java SDK to fetch sensor alarm data. It requires the `qpaas-java-sdk` library. The function initializes the `QpaasHttpClient`, sets various request parameters such as `containerId`, `codes`, `alarmType`, `startTime`, `endTime`, `pageNum`, and `pageSize`, and then calls `doAction` to retrieve the data. The output is printed as a JSON string. ```java package com.qpaas.open.api; import cn.hutool.json.JSONUtil; import java.util.*; import java.math.*; import com.qpaas.open.api.IotServiceSensorGetSensorAlarmDataPostRequest; import com.qpaas.open.api.model.*; import com.qpaas.sdk.core.QpaasCredential; import com.qpaas.sdk.core.http.QpaasHttpClient; public class IotServiceSensorGetSensorAlarmDataPostRequestClient { public static void main(String[] args){ String secretKey = "d673a9c2d9a24259862b85bbbbbbb"; String secretId = "n6aRhOcCuJb0usfUo7a7iccccccccc"; String endpoint = "http://qpaas.com"; long readTimeout = 10000; long connectTimeout=10000; int maxIdleConnection=5; QpaasCredential credential = new QpaasCredential(secretKey, secretId); QpaasHttpClient qpaasHttpClient = QpaasHttpClient.getInstance(credential, endpoint, readTimeout, connectTimeout, maxIdleConnection); IotServiceSensorGetSensorAlarmDataPostRequest request = new IotServiceSensorGetSensorAlarmDataPostRequest(); request.setContainerId(containerId);// request.setCode(code);// List codes = new ArrayList<>(); codes.add(new String()); request.setCodes(codes);//批量查询点位编码使用 request.setAlarmType(alarmType);//传感器报警、点位离线报警、多阈值报警、设备离线报警、设备报警、设备电量报警、视频报警、GPS离线报警 request.setStartTime(startTime);//时间戳毫秒,如:1729574884000 request.setEndTime(endTime);//时间戳毫秒,如:1729575484000 request.setPageNum(pageNum);// request.setPageSize(pageSize);//每页大小(上限1000) /** * if formData use: JSONUtil.toJsonStr(qpaasHttpClient.doActionFormData(request)) */ System.out.print(JSONUtil.toJsonStr(qpaasHttpClient.doAction(request))); /** can use header openservice: request.sdkHeader.put("traceid", "xxxx"); openapi: request.getSdkHeader().put("traceid", "xxxx"); * apipath: /openservice/iot-service/sensor/getSensorAlarmData */ } } //以上为系统生成示例代码 ```