9 changed files with 1062 additions and 57 deletions
@ -0,0 +1,245 @@ |
|||||
|
package cn.iocoder.yudao.module.interphone.controller.admin; |
||||
|
|
||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
||||
|
import cn.iocoder.yudao.module.interphone.service.InterphoneApiService; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.Parameter; |
||||
|
import io.swagger.v3.oas.annotations.Parameters; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import jakarta.annotation.Resource; |
||||
|
import jakarta.annotation.security.PermitAll; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
||||
|
|
||||
|
@Tag(name = "开放接口 - 对讲平台代理") |
||||
|
@RestController |
||||
|
@RequestMapping("/interphone/open-api") |
||||
|
@Validated |
||||
|
public class InterphoneOpenController { |
||||
|
|
||||
|
@Resource |
||||
|
private InterphoneApiService interphoneApiService; |
||||
|
|
||||
|
@GetMapping("/profile/agent") |
||||
|
@Operation(summary = "获取代理商个人信息") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getAgentProfile() { |
||||
|
return success(interphoneApiService.getAgentProfile()); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/agent/list") |
||||
|
@Operation(summary = "查询代理商列表") |
||||
|
@Parameters({ |
||||
|
@Parameter(name = "pageNo", description = "页码", required = true), |
||||
|
@Parameter(name = "pageSize", description = "每页数量", required = true), |
||||
|
@Parameter(name = "name", description = "代理商名称") |
||||
|
}) |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getAgentList(@RequestParam("pageNo") Integer pageNo, |
||||
|
@RequestParam("pageSize") Integer pageSize, |
||||
|
@RequestParam(value = "name", required = false) String name) { |
||||
|
return success(interphoneApiService.getAgentList(pageNo, pageSize, name)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/agent/detail") |
||||
|
@Operation(summary = "查询代理商详情") |
||||
|
@Parameter(name = "id", description = "代理商 ID", required = true) |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getAgentDetail(@RequestParam("id") String id) { |
||||
|
return success(interphoneApiService.getAgentDetail(id)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/profile/faststats") |
||||
|
@Operation(summary = "查询代理商单位群组用户统计") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getFastStats() { |
||||
|
return success(interphoneApiService.getFastStats()); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/group/getGroupName") |
||||
|
@Operation(summary = "查询群组名称") |
||||
|
@Parameter(name = "orgId", description = "单位 ID", required = true) |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getGroupName(@RequestParam("orgId") String orgId) { |
||||
|
return success(interphoneApiService.getGroupName(orgId)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/terminal/querySubordinateUser") |
||||
|
@Operation(summary = "查询下级用户") |
||||
|
@Parameters({ |
||||
|
@Parameter(name = "pageNo", description = "页码", required = true), |
||||
|
@Parameter(name = "pageSize", description = "每页数量", required = true), |
||||
|
@Parameter(name = "agentId", description = "代理商 ID"), |
||||
|
@Parameter(name = "orgId", description = "单位 ID"), |
||||
|
@Parameter(name = "groupId", description = "群组 ID"), |
||||
|
@Parameter(name = "userName", description = "用户名称"), |
||||
|
@Parameter(name = "account", description = "账号") |
||||
|
}) |
||||
|
@PermitAll |
||||
|
public CommonResult<String> querySubordinateUser(@RequestParam("pageNo") Integer pageNo, |
||||
|
@RequestParam("pageSize") Integer pageSize, |
||||
|
@RequestParam(value = "agentId", required = false) String agentId, |
||||
|
@RequestParam(value = "orgId", required = false) String orgId, |
||||
|
@RequestParam(value = "groupId", required = false) String groupId, |
||||
|
@RequestParam(value = "userName", required = false) String userName, |
||||
|
@RequestParam(value = "account", required = false) String account) { |
||||
|
return success(interphoneApiService.querySubordinateUser(pageNo, pageSize, agentId, orgId, groupId, userName, account)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/agent/orgs") |
||||
|
@Operation(summary = "查询单位列表") |
||||
|
@Parameters({ |
||||
|
@Parameter(name = "pageNo", description = "页码", required = true), |
||||
|
@Parameter(name = "pageSize", description = "每页数量", required = true), |
||||
|
@Parameter(name = "name", description = "单位名称") |
||||
|
}) |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getAgentOrgs(@RequestParam("pageNo") Integer pageNo, |
||||
|
@RequestParam("pageSize") Integer pageSize, |
||||
|
@RequestParam(value = "name", required = false) String name) { |
||||
|
return success(interphoneApiService.getAgentOrgs(pageNo, pageSize, name)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/group/list") |
||||
|
@Operation(summary = "查询群组列表") |
||||
|
@Parameters({ |
||||
|
@Parameter(name = "pageNo", description = "页码", required = true), |
||||
|
@Parameter(name = "pageSize", description = "每页数量", required = true), |
||||
|
@Parameter(name = "name", description = "群组名称"), |
||||
|
@Parameter(name = "orgname", description = "单位名称") |
||||
|
}) |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getGroupList(@RequestParam("pageNo") Integer pageNo, |
||||
|
@RequestParam("pageSize") Integer pageSize, |
||||
|
@RequestParam(value = "name", required = false) String name, |
||||
|
@RequestParam(value = "orgname", required = false) String orgName) { |
||||
|
return success(interphoneApiService.getGroupList(pageNo, pageSize, name, orgName)); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/group/add") |
||||
|
@Operation(summary = "新增群组") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> addGroup(@RequestBody String requestBody) { |
||||
|
return success(interphoneApiService.addGroup(requestBody)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/group/detail") |
||||
|
@Operation(summary = "查询群组详情") |
||||
|
@Parameter(name = "id", description = "群组 ID", required = true) |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getGroupDetail(@RequestParam("id") String id) { |
||||
|
return success(interphoneApiService.getGroupDetail(id)); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/group/updateGroup") |
||||
|
@Operation(summary = "编辑群组") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> updateGroup(@RequestBody String requestBody) { |
||||
|
return success(interphoneApiService.updateGroup(requestBody)); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/group/delete") |
||||
|
@Operation(summary = "删除群组") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> deleteGroup(@RequestBody String requestBody) { |
||||
|
return success(interphoneApiService.deleteGroup(requestBody)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/group/members") |
||||
|
@Operation(summary = "获取群组成员") |
||||
|
@Parameter(name = "id", description = "群组 ID", required = true) |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getGroupMembers(@RequestParam("id") String id) { |
||||
|
return success(interphoneApiService.getGroupMembers(id)); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/group/members/add") |
||||
|
@Operation(summary = "添加群组成员") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> addGroupMembers(@RequestBody String requestBody) { |
||||
|
return success(interphoneApiService.addGroupMembers(requestBody)); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/group/members/remove") |
||||
|
@Operation(summary = "移除群组成员") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> removeGroupMembers(@RequestBody String requestBody) { |
||||
|
return success(interphoneApiService.removeGroupMembers(requestBody)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/jsp/queryGroupByUId") |
||||
|
@Operation(summary = "查询用户群组") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> queryGroupByUid(@RequestParam Map<String, String> queryParams) { |
||||
|
return success(interphoneApiService.queryGroupByUid(queryParams)); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/terminal/batch") |
||||
|
@Operation(summary = "创建对讲用户") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> createTerminalUsers(@RequestBody String requestBody) { |
||||
|
return success(interphoneApiService.createTerminalUsers(requestBody)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/terminal/list") |
||||
|
@Operation(summary = "查询对讲用户列表") |
||||
|
@Parameters({ |
||||
|
@Parameter(name = "pageNo", description = "页码", required = true), |
||||
|
@Parameter(name = "pageSize", description = "每页数量", required = true), |
||||
|
@Parameter(name = "org_id", description = "单位 ID"), |
||||
|
@Parameter(name = "groupId", description = "群组 ID"), |
||||
|
@Parameter(name = "name", description = "用户名称") |
||||
|
}) |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getTerminalList(@RequestParam("pageNo") Integer pageNo, |
||||
|
@RequestParam("pageSize") Integer pageSize, |
||||
|
@RequestParam(value = "org_id", required = false) String orgId, |
||||
|
@RequestParam(value = "groupId", required = false) String groupId, |
||||
|
@RequestParam(value = "name", required = false) String name) { |
||||
|
return success(interphoneApiService.getTerminalList(pageNo, pageSize, orgId, groupId, name)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/terminal/detail") |
||||
|
@Operation(summary = "查询对讲用户详情") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getTerminalDetail(@RequestParam Map<String, String> queryParams) { |
||||
|
return success(interphoneApiService.getTerminalDetail(queryParams)); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/terminal/updateUser") |
||||
|
@Operation(summary = "修改对讲用户信息") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> updateTerminalUser(@RequestBody String requestBody) { |
||||
|
return success(interphoneApiService.updateTerminalUser(requestBody)); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/terminal/deleteUser") |
||||
|
@Operation(summary = "删除对讲用户") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> deleteTerminalUser(@RequestBody String requestBody) { |
||||
|
return success(interphoneApiService.deleteTerminalUser(requestBody)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/terminal/userOnlineStatus") |
||||
|
@Operation(summary = "查询对讲用户在线状态") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getTerminalUserOnlineStatus(@RequestParam Map<String, String> queryParams) { |
||||
|
return success(interphoneApiService.getTerminalUserOnlineStatus(queryParams)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/record/list") |
||||
|
@Operation(summary = "查询录音列表") |
||||
|
@PermitAll |
||||
|
public CommonResult<String> getRecordList(@RequestParam Map<String, String> queryParams) { |
||||
|
return success(interphoneApiService.getRecordList(queryParams)); |
||||
|
} |
||||
|
} |
||||
@ -1,28 +0,0 @@ |
|||||
package cn.iocoder.yudao.module.interphone.demo; |
|
||||
|
|
||||
|
|
||||
import cn.iocoder.yudao.module.interphone.core.ApiClient; |
|
||||
import cn.iocoder.yudao.module.interphone.core.ApiRequest; |
|
||||
import cn.iocoder.yudao.module.interphone.core.ApiResponse; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
import java.util.HashMap; |
|
||||
import java.util.Map; |
|
||||
|
|
||||
@Component |
|
||||
public class DemoRemoteClient { |
|
||||
|
|
||||
private final ApiClient apiClient; |
|
||||
|
|
||||
public DemoRemoteClient(ApiClient apiClient) { |
|
||||
this.apiClient = apiClient; |
|
||||
} |
|
||||
|
|
||||
public String getUserInfo() { |
|
||||
|
|
||||
ApiRequest request = ApiRequest.get("/profile/agent"); |
|
||||
ApiResponse response = apiClient.execute(request); |
|
||||
return response.getBody(); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -0,0 +1,53 @@ |
|||||
|
package cn.iocoder.yudao.module.interphone.service; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
|
||||
|
public interface InterphoneApiService { |
||||
|
|
||||
|
String getAgentProfile(); |
||||
|
|
||||
|
String getAgentList(Integer pageNo, Integer pageSize, String name); |
||||
|
|
||||
|
String getAgentDetail(String id); |
||||
|
|
||||
|
String getFastStats(); |
||||
|
|
||||
|
String getGroupName(String orgId); |
||||
|
|
||||
|
String querySubordinateUser(Integer pageNo, Integer pageSize, String agentId, String orgId, |
||||
|
String groupId, String userName, String account); |
||||
|
|
||||
|
String getAgentOrgs(Integer pageNo, Integer pageSize, String name); |
||||
|
|
||||
|
String getGroupList(Integer pageNo, Integer pageSize, String name, String orgName); |
||||
|
|
||||
|
String addGroup(String requestBody); |
||||
|
|
||||
|
String getGroupDetail(String id); |
||||
|
|
||||
|
String updateGroup(String requestBody); |
||||
|
|
||||
|
String deleteGroup(String requestBody); |
||||
|
|
||||
|
String getGroupMembers(String id); |
||||
|
|
||||
|
String addGroupMembers(String requestBody); |
||||
|
|
||||
|
String removeGroupMembers(String requestBody); |
||||
|
|
||||
|
String queryGroupByUid(Map<String, String> queryParams); |
||||
|
|
||||
|
String createTerminalUsers(String requestBody); |
||||
|
|
||||
|
String getTerminalList(Integer pageNo, Integer pageSize, String orgId, String groupId, String name); |
||||
|
|
||||
|
String getTerminalDetail(Map<String, String> queryParams); |
||||
|
|
||||
|
String updateTerminalUser(String requestBody); |
||||
|
|
||||
|
String deleteTerminalUser(String requestBody); |
||||
|
|
||||
|
String getTerminalUserOnlineStatus(Map<String, String> queryParams); |
||||
|
|
||||
|
String getRecordList(Map<String, String> queryParams); |
||||
|
} |
||||
@ -0,0 +1,470 @@ |
|||||
|
# 管理平台 API 文档 |
||||
|
|
||||
|
Base URL |
||||
|
|
||||
|
```text |
||||
|
https://chat.zdhlcn.com:9443/api |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 通用返回格式 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"code": 20001, |
||||
|
"msg": "OK", |
||||
|
"data": {}, |
||||
|
"count": 0 |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 1 用户信息 |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 1.1 个人信息 - 代理商 |
||||
|
|
||||
|
### 接口 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/profile/agent |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | 说明 | |
||||
|
| ------------ | ------ | -- | ---- | |
||||
|
| access_token | String | 是 | 登录凭证 | |
||||
|
| openid | String | 是 | 用户ID | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
### 返回示例 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"code":20001, |
||||
|
"msg":"OK", |
||||
|
"data":{ |
||||
|
"loginname":"broadtest", |
||||
|
"usertype":0, |
||||
|
"agentinfo":{ |
||||
|
"id":"efad38ced1bb4ac0bf97665041db752a", |
||||
|
"name":"测试平台", |
||||
|
"contact":"测试测试", |
||||
|
"country_id":86, |
||||
|
"blance":939 |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 2 代理商管理 |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 2.1 代理商查询 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/agent/list |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ------------ | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
| pageNo | int | 是 | |
||||
|
| pageSize | int | 是 | |
||||
|
| name | string | 否 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 2.2 查询代理商详情 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/agent/detail |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ------------ | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
| id | String | 是 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 2.3 查询代理商单位群组用户数 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/profile/faststats |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ------------ | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
### 返回示例 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"agent_count":232, |
||||
|
"org_count":107, |
||||
|
"group_count":107, |
||||
|
"user_count":488 |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 3 群组相关 |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 3.1 查询群组名称 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/group/getGroupName |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ------------ | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
| orgId | String | 是 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 3.2 查询下级用户 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/terminal/querySubordinateUser |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ------------ | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
| pageNo | int | 是 | |
||||
|
| pageSize | int | 是 | |
||||
|
| agentId | String | 否 | |
||||
|
| orgId | String | 否 | |
||||
|
| groupId | String | 否 | |
||||
|
| userName | String | 否 | |
||||
|
| account | String | 否 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 4 单位管理 |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 4.1 单位查询 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/agent/orgs |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ------------ | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
| pageNo | int | 是 | |
||||
|
| pageSize | int | 是 | |
||||
|
| name | string | 否 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 5 群组管理 |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 5.1 群组查询 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/group/list |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ------------ | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
| pageNo | int | 是 | |
||||
|
| pageSize | int | 是 | |
||||
|
| name | string | 否 | |
||||
|
| orgname | string | 否 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 5.2 添加群组 |
||||
|
|
||||
|
``` |
||||
|
POST /v1/group/add |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ---------------------- | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
| orgId | String | 是 | |
||||
|
| cgName | String | 是 | |
||||
|
| cg_speech_limit_second | int | 是 | |
||||
|
| remarks | String | 否 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 5.3 群组详情 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/group/detail |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ------------ | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
| id | String | 是 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 5.4 编辑群组 |
||||
|
|
||||
|
``` |
||||
|
POST /v1/group/updateGroup |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ---------------------- | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
| id | String | 是 | |
||||
|
| cgName | String | 是 | |
||||
|
| cg_speech_limit_second | int | 是 | |
||||
|
| remarks | String | 是 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 5.5 删除群组 |
||||
|
|
||||
|
``` |
||||
|
POST /v1/group/delete |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ------------ | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
| id | String | 是 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 6 群组成员 |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 6.1 获取群组成员 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/group/members |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | 必填 | |
||||
|
| ------------ | ------ | -- | |
||||
|
| access_token | String | 是 | |
||||
|
| openid | String | 是 | |
||||
|
| id | String | 是 | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 6.2 添加群组成员 |
||||
|
|
||||
|
``` |
||||
|
POST /v1/group/members/add |
||||
|
``` |
||||
|
|
||||
|
### 示例 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"id":"groupId", |
||||
|
"members":[ |
||||
|
{ |
||||
|
"id":"userUuid", |
||||
|
"user_id":5583024, |
||||
|
"priorities":1 |
||||
|
} |
||||
|
] |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 6.3 移除群组成员 |
||||
|
|
||||
|
``` |
||||
|
POST /v1/group/members/remove |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 6.4 获取用户群组 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/jsp/queryGroupByUId |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 7 对讲用户 |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 7.1 创建用户 |
||||
|
|
||||
|
``` |
||||
|
POST /v1/terminal/batch |
||||
|
``` |
||||
|
|
||||
|
### 示例 |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"orgId":"uuid", |
||||
|
"groups":[{"id":"groupId"}], |
||||
|
"prefix":"test", |
||||
|
"accounts":["imei1","imei2"], |
||||
|
"cardTypes":[0,2] |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 7.2 用户查询 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/terminal/list |
||||
|
``` |
||||
|
|
||||
|
### 参数 |
||||
|
|
||||
|
| 参数 | 类型 | |
||||
|
| -------- | ------ | |
||||
|
| pageNo | int | |
||||
|
| pageSize | int | |
||||
|
| org_id | String | |
||||
|
| groupId | String | |
||||
|
| name | String | |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 7.3 用户详情 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/terminal/detail |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 7.4 修改用户信息 |
||||
|
|
||||
|
``` |
||||
|
POST /v1/terminal/updateUser |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 7.5 删除用户 |
||||
|
|
||||
|
``` |
||||
|
POST /v1/terminal/deleteUser |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 7.6 查询用户在线状态 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/terminal/userOnlineStatus |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 8 录音 |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 8.1 查询录音 |
||||
|
|
||||
|
``` |
||||
|
GET /v1/record/list |
||||
|
``` |
||||
|
|
||||
|
--- |
||||
|
|
||||
|
# 接口模块结构 |
||||
|
|
||||
|
``` |
||||
|
用户 |
||||
|
├─ 个人信息 |
||||
|
|
||||
|
代理商 |
||||
|
├─ 查询 |
||||
|
├─ 详情 |
||||
|
├─ 统计 |
||||
|
|
||||
|
单位 |
||||
|
├─ 查询 |
||||
|
|
||||
|
群组 |
||||
|
├─ 查询 |
||||
|
├─ 创建 |
||||
|
├─ 编辑 |
||||
|
├─ 删除 |
||||
|
|
||||
|
群组成员 |
||||
|
├─ 获取 |
||||
|
├─ 添加 |
||||
|
├─ 删除 |
||||
|
|
||||
|
对讲用户 |
||||
|
├─ 创建 |
||||
|
├─ 查询 |
||||
|
├─ 详情 |
||||
|
├─ 修改 |
||||
|
├─ 删除 |
||||
|
├─ 在线状态 |
||||
|
|
||||
|
录音 |
||||
|
├─ 查询 |
||||
|
``` |
||||
@ -0,0 +1,207 @@ |
|||||
|
package cn.iocoder.yudao.module.interphone.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import cn.iocoder.yudao.module.interphone.core.ApiClient; |
||||
|
import cn.iocoder.yudao.module.interphone.core.ApiRequest; |
||||
|
import cn.iocoder.yudao.module.interphone.core.ApiResponse; |
||||
|
import cn.iocoder.yudao.module.interphone.service.InterphoneApiService; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
|
||||
|
import java.util.LinkedHashMap; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
@Service |
||||
|
@Validated |
||||
|
public class InterphoneApiServiceImpl implements InterphoneApiService { |
||||
|
|
||||
|
private final ApiClient apiClient; |
||||
|
|
||||
|
public InterphoneApiServiceImpl(ApiClient apiClient) { |
||||
|
this.apiClient = apiClient; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getAgentProfile() { |
||||
|
return executeGet("/profile/agent"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getAgentList(Integer pageNo, Integer pageSize, String name) { |
||||
|
Map<String, String> queryParams = new LinkedHashMap<>(); |
||||
|
putIfNotNull(queryParams, "pageNo", pageNo); |
||||
|
putIfNotNull(queryParams, "pageSize", pageSize); |
||||
|
putIfHasText(queryParams, "name", name); |
||||
|
return executeGet("/agent/list", queryParams); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getAgentDetail(String id) { |
||||
|
return executeGet("/agent/detail", Map.of("id", id)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getFastStats() { |
||||
|
return executeGet("/profile/faststats"); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getGroupName(String orgId) { |
||||
|
return executeGet("/group/getGroupName", Map.of("orgId", orgId)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String querySubordinateUser(Integer pageNo, Integer pageSize, String agentId, String orgId, |
||||
|
String groupId, String userName, String account) { |
||||
|
Map<String, String> queryParams = new LinkedHashMap<>(); |
||||
|
putIfNotNull(queryParams, "pageNo", pageNo); |
||||
|
putIfNotNull(queryParams, "pageSize", pageSize); |
||||
|
putIfHasText(queryParams, "agentId", agentId); |
||||
|
putIfHasText(queryParams, "orgId", orgId); |
||||
|
putIfHasText(queryParams, "groupId", groupId); |
||||
|
putIfHasText(queryParams, "userName", userName); |
||||
|
putIfHasText(queryParams, "account", account); |
||||
|
return executeGet("/terminal/querySubordinateUser", queryParams); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getAgentOrgs(Integer pageNo, Integer pageSize, String name) { |
||||
|
Map<String, String> queryParams = new LinkedHashMap<>(); |
||||
|
putIfNotNull(queryParams, "pageNo", pageNo); |
||||
|
putIfNotNull(queryParams, "pageSize", pageSize); |
||||
|
putIfHasText(queryParams, "name", name); |
||||
|
return executeGet("/agent/orgs", queryParams); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getGroupList(Integer pageNo, Integer pageSize, String name, String orgName) { |
||||
|
Map<String, String> queryParams = new LinkedHashMap<>(); |
||||
|
putIfNotNull(queryParams, "pageNo", pageNo); |
||||
|
putIfNotNull(queryParams, "pageSize", pageSize); |
||||
|
putIfHasText(queryParams, "name", name); |
||||
|
putIfHasText(queryParams, "orgname", orgName); |
||||
|
return executeGet("/group/list", queryParams); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String addGroup(String requestBody) { |
||||
|
return executePost("/group/add", requestBody); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getGroupDetail(String id) { |
||||
|
return executeGet("/group/detail", Map.of("id", id)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String updateGroup(String requestBody) { |
||||
|
return executePost("/group/updateGroup", requestBody); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String deleteGroup(String requestBody) { |
||||
|
return executePost("/group/delete", requestBody); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getGroupMembers(String id) { |
||||
|
return executeGet("/group/members", Map.of("id", id)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String addGroupMembers(String requestBody) { |
||||
|
return executePost("/group/members/add", requestBody); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String removeGroupMembers(String requestBody) { |
||||
|
return executePost("/group/members/remove", requestBody); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String queryGroupByUid(Map<String, String> queryParams) { |
||||
|
return executeGet("/jsp/queryGroupByUId", queryParams); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String createTerminalUsers(String requestBody) { |
||||
|
return executePost("/terminal/batch", requestBody); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getTerminalList(Integer pageNo, Integer pageSize, String orgId, String groupId, String name) { |
||||
|
Map<String, String> queryParams = new LinkedHashMap<>(); |
||||
|
putIfNotNull(queryParams, "pageNo", pageNo); |
||||
|
putIfNotNull(queryParams, "pageSize", pageSize); |
||||
|
putIfHasText(queryParams, "org_id", orgId); |
||||
|
putIfHasText(queryParams, "groupId", groupId); |
||||
|
putIfHasText(queryParams, "name", name); |
||||
|
return executeGet("/terminal/list", queryParams); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getTerminalDetail(Map<String, String> queryParams) { |
||||
|
return executeGet("/terminal/detail", queryParams); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String updateTerminalUser(String requestBody) { |
||||
|
return executePost("/terminal/updateUser", requestBody); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String deleteTerminalUser(String requestBody) { |
||||
|
return executePost("/terminal/deleteUser", requestBody); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getTerminalUserOnlineStatus(Map<String, String> queryParams) { |
||||
|
return executeGet("/terminal/userOnlineStatus", queryParams); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public String getRecordList(Map<String, String> queryParams) { |
||||
|
return executeGet("/record/list", queryParams); |
||||
|
} |
||||
|
|
||||
|
private String executeGet(String path) { |
||||
|
return executeGet(path, null); |
||||
|
} |
||||
|
|
||||
|
private String executeGet(String path, Map<String, String> queryParams) { |
||||
|
ApiRequest request = ApiRequest.get(path, sanitizeQueryParams(queryParams)); |
||||
|
ApiResponse response = apiClient.execute(request); |
||||
|
return response.getBody(); |
||||
|
} |
||||
|
|
||||
|
private String executePost(String path, String requestBody) { |
||||
|
ApiRequest request = ApiRequest.postJson(path, StrUtil.emptyToDefault(requestBody, "")); |
||||
|
ApiResponse response = apiClient.execute(request); |
||||
|
return response.getBody(); |
||||
|
} |
||||
|
|
||||
|
private Map<String, String> sanitizeQueryParams(Map<String, String> queryParams) { |
||||
|
if (queryParams == null || queryParams.isEmpty()) { |
||||
|
return null; |
||||
|
} |
||||
|
Map<String, String> sanitized = new LinkedHashMap<>(); |
||||
|
queryParams.forEach((key, value) -> { |
||||
|
if (value != null) { |
||||
|
sanitized.put(key, value); |
||||
|
} |
||||
|
}); |
||||
|
return sanitized.isEmpty() ? null : sanitized; |
||||
|
} |
||||
|
|
||||
|
private void putIfHasText(Map<String, String> queryParams, String key, String value) { |
||||
|
if (StrUtil.isNotBlank(value)) { |
||||
|
queryParams.put(key, value); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
private void putIfNotNull(Map<String, String> queryParams, String key, Object value) { |
||||
|
if (value != null) { |
||||
|
queryParams.put(key, String.valueOf(value)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,76 @@ |
|||||
|
<configuration> |
||||
|
<!-- 引用 Spring Boot 的 logback 基础配置 --> |
||||
|
<include resource="org/springframework/boot/logging/logback/defaults.xml" /> |
||||
|
<!-- 变量 yudao.info.base-package,基础业务包 --> |
||||
|
<springProperty scope="context" name="yudao.info.base-package" source="yudao.info.base-package"/> |
||||
|
<!-- 格式化输出:%d 表示日期,%X{tid} SkWalking 链路追踪编号,%thread 表示线程名,%-5level:级别从左显示 5 个字符宽度,%msg:日志消息,%n是换行符 --> |
||||
|
<property name="PATTERN_DEFAULT" value="%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} | %highlight(${LOG_LEVEL_PATTERN:-%5p} ${PID:- }) | %boldYellow(%thread [%tid]) %boldGreen(%-40.40logger{39}) | %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/> |
||||
|
|
||||
|
<!-- 控制台 Appender --> |
||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> |
||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> |
||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout"> |
||||
|
<pattern>${PATTERN_DEFAULT}</pattern> |
||||
|
</layout> |
||||
|
</encoder> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 文件 Appender --> |
||||
|
<!-- 参考 Spring Boot 的 file-appender.xml 编写 --> |
||||
|
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> |
||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout"> |
||||
|
<pattern>${PATTERN_DEFAULT}</pattern> |
||||
|
</layout> |
||||
|
</encoder> |
||||
|
<!-- 日志文件名 --> |
||||
|
<file>${LOG_FILE}</file> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> |
||||
|
<!-- 滚动后的日志文件名 --> |
||||
|
<fileNamePattern>${LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN:-${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz}</fileNamePattern> |
||||
|
<!-- 启动服务时,是否清理历史日志,一般不建议清理 --> |
||||
|
<cleanHistoryOnStart>${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart> |
||||
|
<!-- 日志文件,到达多少容量,进行滚动 --> |
||||
|
<maxFileSize>${LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE:-10MB}</maxFileSize> |
||||
|
<!-- 日志文件的总大小,0 表示不限制 --> |
||||
|
<totalSizeCap>${LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP:-0}</totalSizeCap> |
||||
|
<!-- 日志文件的保留天数 --> |
||||
|
<maxHistory>${LOGBACK_ROLLINGPOLICY_MAX_HISTORY:-30}</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
</appender> |
||||
|
<!-- 异步写入日志,提升性能 --> |
||||
|
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender"> |
||||
|
<!-- 不丢失日志。默认的,如果队列的 80% 已满,则会丢弃 TRACT、DEBUG、INFO 级别的日志 --> |
||||
|
<discardingThreshold>0</discardingThreshold> |
||||
|
<!-- 更改默认的队列的深度,该值会影响性能。默认值为 256 --> |
||||
|
<queueSize>256</queueSize> |
||||
|
<appender-ref ref="FILE"/> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- SkyWalking GRPC 日志收集,实现日志中心。注意:SkyWalking 8.4.0 版本开始支持 --> |
||||
|
<appender name="GRPC" class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender"> |
||||
|
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder"> |
||||
|
<layout class="org.apache.skywalking.apm.toolkit.log.logback.v1.x.TraceIdPatternLogbackLayout"> |
||||
|
<pattern>${PATTERN_DEFAULT}</pattern> |
||||
|
</layout> |
||||
|
</encoder> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 本地环境 --> |
||||
|
<springProfile name="local"> |
||||
|
<root level="INFO"> |
||||
|
<appender-ref ref="STDOUT"/> |
||||
|
<appender-ref ref="GRPC"/> <!-- 本地环境下,如果不想接入 SkyWalking 日志服务,可以注释掉本行 --> |
||||
|
<appender-ref ref="ASYNC"/> <!-- 本地环境下,如果不想打印日志,可以注释掉本行 --> |
||||
|
</root> |
||||
|
</springProfile> |
||||
|
<!-- 其它环境 --> |
||||
|
<springProfile name="dev,test,stage,prod,default"> |
||||
|
<root level="INFO"> |
||||
|
<appender-ref ref="STDOUT"/> |
||||
|
<appender-ref ref="ASYNC"/> |
||||
|
<appender-ref ref="GRPC"/> |
||||
|
</root> |
||||
|
</springProfile> |
||||
|
|
||||
|
</configuration> |
||||
Loading…
Reference in new issue