46 changed files with 1197 additions and 1008 deletions
@ -1,245 +0,0 @@ |
|||
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)); |
|||
} |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
package cn.iocoder.yudao.module.interphone.controller.admin.agent; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneAgentService; |
|||
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.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
|||
|
|||
@Tag(name = "开放接口 - 对讲平台代理商") |
|||
@RestController |
|||
@RequestMapping("/interphone/open-api/agent") |
|||
@Validated |
|||
public class InterphoneAgentController { |
|||
|
|||
@Resource |
|||
private InterphoneAgentService interphoneAgentService; |
|||
|
|||
@GetMapping("/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(interphoneAgentService.getAgentList(pageNo, pageSize, name)); |
|||
} |
|||
|
|||
@GetMapping("/detail") |
|||
@Operation(summary = "查询代理商详情") |
|||
@Parameter(name = "id", description = "代理商 ID", required = true) |
|||
@PermitAll |
|||
public CommonResult<String> getAgentDetail(@RequestParam("id") String id) { |
|||
return success(interphoneAgentService.getAgentDetail(id)); |
|||
} |
|||
} |
|||
@ -0,0 +1,104 @@ |
|||
package cn.iocoder.yudao.module.interphone.controller.admin.group; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneGroupService; |
|||
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 static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
|||
|
|||
@Tag(name = "开放接口 - 对讲平台群组") |
|||
@RestController |
|||
@RequestMapping("/interphone/open-api/group") |
|||
@Validated |
|||
public class InterphoneGroupController { |
|||
|
|||
@Resource |
|||
private InterphoneGroupService interphoneGroupService; |
|||
|
|||
@GetMapping("/getGroupName") |
|||
@Operation(summary = "查询群组名称") |
|||
@Parameter(name = "orgId", description = "单位 ID", required = true) |
|||
@PermitAll |
|||
public CommonResult<String> getGroupName(@RequestParam("orgId") String orgId) { |
|||
return success(interphoneGroupService.getGroupName(orgId)); |
|||
} |
|||
|
|||
@GetMapping("/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(interphoneGroupService.getGroupList(pageNo, pageSize, name, orgName)); |
|||
} |
|||
|
|||
@PostMapping("/add") |
|||
@Operation(summary = "新增群组") |
|||
@PermitAll |
|||
public CommonResult<String> addGroup(@RequestBody String requestBody) { |
|||
return success(interphoneGroupService.addGroup(requestBody)); |
|||
} |
|||
|
|||
@GetMapping("/detail") |
|||
@Operation(summary = "查询群组详情") |
|||
@Parameter(name = "id", description = "群组 ID", required = true) |
|||
@PermitAll |
|||
public CommonResult<String> getGroupDetail(@RequestParam("id") String id) { |
|||
return success(interphoneGroupService.getGroupDetail(id)); |
|||
} |
|||
|
|||
@PostMapping("/updateGroup") |
|||
@Operation(summary = "编辑群组") |
|||
@PermitAll |
|||
public CommonResult<String> updateGroup(@RequestBody String requestBody) { |
|||
return success(interphoneGroupService.updateGroup(requestBody)); |
|||
} |
|||
|
|||
@PostMapping("/delete") |
|||
@Operation(summary = "删除群组") |
|||
@PermitAll |
|||
public CommonResult<String> deleteGroup(@RequestBody String requestBody) { |
|||
return success(interphoneGroupService.deleteGroup(requestBody)); |
|||
} |
|||
|
|||
@GetMapping("/members") |
|||
@Operation(summary = "获取群组成员") |
|||
@Parameter(name = "id", description = "群组 ID", required = true) |
|||
@PermitAll |
|||
public CommonResult<String> getGroupMembers(@RequestParam("id") String id) { |
|||
return success(interphoneGroupService.getGroupMembers(id)); |
|||
} |
|||
|
|||
@PostMapping("/members/add") |
|||
@Operation(summary = "添加群组成员") |
|||
@PermitAll |
|||
public CommonResult<String> addGroupMembers(@RequestBody String requestBody) { |
|||
return success(interphoneGroupService.addGroupMembers(requestBody)); |
|||
} |
|||
|
|||
@PostMapping("/members/remove") |
|||
@Operation(summary = "移除群组成员") |
|||
@PermitAll |
|||
public CommonResult<String> removeGroupMembers(@RequestBody String requestBody) { |
|||
return success(interphoneGroupService.removeGroupMembers(requestBody)); |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
package cn.iocoder.yudao.module.interphone.controller.admin.jsp; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneJspService; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
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.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/jsp") |
|||
@Validated |
|||
public class InterphoneJspController { |
|||
|
|||
@Resource |
|||
private InterphoneJspService interphoneJspService; |
|||
|
|||
@GetMapping("/queryGroupByUId") |
|||
@Operation(summary = "查询用户群组") |
|||
@PermitAll |
|||
public CommonResult<String> queryGroupByUid(@RequestParam Map<String, String> queryParams) { |
|||
return success(interphoneJspService.queryGroupByUid(queryParams)); |
|||
} |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package cn.iocoder.yudao.module.interphone.controller.admin.org; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|||
import cn.iocoder.yudao.framework.common.pojo.PageResult; |
|||
import cn.iocoder.yudao.module.interphone.controller.admin.org.vo.InterphoneOrgCreateReqVO; |
|||
import cn.iocoder.yudao.module.interphone.controller.admin.org.vo.InterphoneOrgPageReqVO; |
|||
import cn.iocoder.yudao.module.interphone.controller.admin.org.vo.InterphoneOrgRespVO; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneOrgService; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import jakarta.annotation.Resource; |
|||
import jakarta.annotation.security.PermitAll; |
|||
import jakarta.validation.Valid; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
|||
|
|||
@Tag(name = "开放接口 - 对讲平台单位创建") |
|||
@RestController |
|||
@RequestMapping("/interphone/open-api/org") |
|||
@Validated |
|||
public class InterphoneOrgController { |
|||
|
|||
@Resource |
|||
private InterphoneOrgService interphoneOrgService; |
|||
|
|||
@GetMapping("/orgs") |
|||
@Operation(summary = "查询单位列表") |
|||
@PermitAll |
|||
public CommonResult<PageResult<InterphoneOrgRespVO>> getAgentOrgs(@Valid InterphoneOrgPageReqVO reqVO) { |
|||
return success(interphoneOrgService.getAgentOrgs(reqVO)); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
package cn.iocoder.yudao.module.interphone.controller.admin.org.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonIgnore; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import jakarta.validation.constraints.AssertTrue; |
|||
import jakarta.validation.constraints.Max; |
|||
import jakarta.validation.constraints.Min; |
|||
import jakarta.validation.constraints.NotBlank; |
|||
import jakarta.validation.constraints.NotNull; |
|||
import lombok.Data; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
|
|||
@Schema(description = "管理后台 - 对讲平台单位创建 Request VO") |
|||
@Data |
|||
public class InterphoneOrgCreateReqVO { |
|||
|
|||
@Schema(description = "单位id(uuid类型)") |
|||
private String id; |
|||
|
|||
@Schema(description = "单位名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "测试平台") |
|||
@NotBlank(message = "单位名称不能为空") |
|||
private String name; |
|||
|
|||
@Schema(description = "账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "broadtest") |
|||
private String loginname; |
|||
|
|||
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") |
|||
private String password; |
|||
|
|||
@Schema(description = "联系人", requiredMode = Schema.RequiredMode.REQUIRED, example = "测试测试") |
|||
private String contact; |
|||
|
|||
@Schema(description = "手机号", example = "13800138000") |
|||
private String phone; |
|||
|
|||
@Schema(description = "详细地址", example = "广东省深圳市") |
|||
private String address; |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
package cn.iocoder.yudao.module.interphone.controller.admin.org.vo; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.PageParam; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
@Schema(description = "管理后台 - 对讲平台单位分页 Request VO") |
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
public class InterphoneOrgPageReqVO extends PageParam { |
|||
|
|||
@Schema(description = "单位名称", example = "测试平台") |
|||
private String name; |
|||
} |
|||
@ -0,0 +1,88 @@ |
|||
package cn.iocoder.yudao.module.interphone.controller.admin.org.vo; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonProperty; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
@Schema(description = "管理后台 - 对讲平台单位 Response VO") |
|||
@Data |
|||
public class InterphoneOrgRespVO { |
|||
|
|||
@Schema(description = "单位自增 ID", example = "865") |
|||
@JsonProperty("corg_id") |
|||
private Long corgId; |
|||
|
|||
@Schema(description = "单位名称", example = "测试透传") |
|||
@JsonProperty("corg_name") |
|||
private String corgName; |
|||
|
|||
@Schema(description = "父级单位 ID", example = "0") |
|||
@JsonProperty("corg_parent") |
|||
private Integer corgParent; |
|||
|
|||
@Schema(description = "单位层级", example = "0") |
|||
@JsonProperty("corg_level") |
|||
private Integer corgLevel; |
|||
|
|||
@Schema(description = "是否允许用户设置优先级", example = "1") |
|||
@JsonProperty("corg_isallowusersetprior") |
|||
private Integer corgIsAllowUserSetPrior; |
|||
|
|||
@Schema(description = "临时群组优先级", example = "1") |
|||
@JsonProperty("corg_tempgroupprior") |
|||
private Integer corgTempGroupPrior; |
|||
|
|||
@Schema(description = "临时群组发言时长限制", example = "30") |
|||
@JsonProperty("corg_tempgrouplimitsecond") |
|||
private Integer corgTempGroupLimitSecond; |
|||
|
|||
@Schema(description = "单位类型", example = "0") |
|||
@JsonProperty("corg_type") |
|||
private Integer corgType; |
|||
|
|||
@Schema(description = "是否启用", example = "1") |
|||
@JsonProperty("isactive") |
|||
private Integer active; |
|||
|
|||
@Schema(description = "代理商 ID", example = "efad38ced1bb4ac0bf97665041db752a") |
|||
@JsonProperty("agent_id") |
|||
private String agentId; |
|||
|
|||
@Schema(description = "单位 UUID", example = "30b119a9c36c46de8a19afe8722e99d6") |
|||
private String id; |
|||
|
|||
@Schema(description = "手机号", example = "13800138000") |
|||
private String mobile; |
|||
|
|||
@Schema(description = "地址", example = "广东省深圳市") |
|||
private String address; |
|||
|
|||
@Schema(description = "联系人", example = "测试测试") |
|||
private String contact; |
|||
|
|||
@Schema(description = "成员详情级别", example = "1") |
|||
@JsonProperty("corg_memberdetaillevel") |
|||
private Integer corgMemberDetailLevel; |
|||
|
|||
@Schema(description = "是否开启降噪", example = "false") |
|||
@JsonProperty("is_denoise") |
|||
private Boolean denoise; |
|||
|
|||
@Schema(description = "手机号码串", example = "") |
|||
private String mobiles; |
|||
|
|||
@Schema(description = "群组总数", example = "2") |
|||
@JsonProperty("group_count") |
|||
private Integer groupCount; |
|||
|
|||
@Schema(description = "名称", example = "测试平台") |
|||
private String name; |
|||
|
|||
@Schema(description = "登录账号", example = "broadtest") |
|||
@JsonProperty("loginname") |
|||
private String loginName; |
|||
|
|||
@Schema(description = "用户总数", example = "2") |
|||
@JsonProperty("user_count") |
|||
private Integer userCount; |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
package cn.iocoder.yudao.module.interphone.controller.admin.profile; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneProfileService; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
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.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
|||
|
|||
@Tag(name = "开放接口 - 对讲平台个人信息") |
|||
@RestController |
|||
@RequestMapping("/interphone/open-api/profile") |
|||
@Validated |
|||
public class InterphoneProfileController { |
|||
|
|||
@Resource |
|||
private InterphoneProfileService interphoneProfileService; |
|||
|
|||
@GetMapping("/agent") |
|||
@Operation(summary = "获取代理商个人信息") |
|||
@PermitAll |
|||
public CommonResult<String> getAgentProfile() { |
|||
return success(interphoneProfileService.getAgentProfile()); |
|||
} |
|||
|
|||
@GetMapping("/faststats") |
|||
@Operation(summary = "查询代理商单位群组用户统计") |
|||
@PermitAll |
|||
public CommonResult<String> getFastStats() { |
|||
return success(interphoneProfileService.getFastStats()); |
|||
} |
|||
} |
|||
@ -0,0 +1,34 @@ |
|||
package cn.iocoder.yudao.module.interphone.controller.admin.record; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneRecordService; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
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.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/record") |
|||
@Validated |
|||
public class InterphoneRecordController { |
|||
|
|||
@Resource |
|||
private InterphoneRecordService interphoneRecordService; |
|||
|
|||
@GetMapping("/list") |
|||
@Operation(summary = "查询录音列表") |
|||
@PermitAll |
|||
public CommonResult<String> getRecordList(@RequestParam Map<String, String> queryParams) { |
|||
return success(interphoneRecordService.getRecordList(queryParams)); |
|||
} |
|||
} |
|||
@ -0,0 +1,106 @@ |
|||
package cn.iocoder.yudao.module.interphone.controller.admin.terminal; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneTerminalService; |
|||
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/terminal") |
|||
@Validated |
|||
public class InterphoneTerminalController { |
|||
|
|||
@Resource |
|||
private InterphoneTerminalService interphoneTerminalService; |
|||
|
|||
@GetMapping("/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(interphoneTerminalService.querySubordinateUser(pageNo, pageSize, agentId, orgId, groupId, userName, account)); |
|||
} |
|||
|
|||
@PostMapping("/batch") |
|||
@Operation(summary = "创建对讲用户") |
|||
@PermitAll |
|||
public CommonResult<String> createTerminalUsers(@RequestBody String requestBody) { |
|||
return success(interphoneTerminalService.createTerminalUsers(requestBody)); |
|||
} |
|||
|
|||
@GetMapping("/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(interphoneTerminalService.getTerminalList(pageNo, pageSize, orgId, groupId, name)); |
|||
} |
|||
|
|||
@GetMapping("/detail") |
|||
@Operation(summary = "查询对讲用户详情") |
|||
@PermitAll |
|||
public CommonResult<String> getTerminalDetail(@RequestParam Map<String, String> queryParams) { |
|||
return success(interphoneTerminalService.getTerminalDetail(queryParams)); |
|||
} |
|||
|
|||
@PostMapping("/updateUser") |
|||
@Operation(summary = "修改对讲用户信息") |
|||
@PermitAll |
|||
public CommonResult<String> updateTerminalUser(@RequestBody String requestBody) { |
|||
return success(interphoneTerminalService.updateTerminalUser(requestBody)); |
|||
} |
|||
|
|||
@PostMapping("/deleteUser") |
|||
@Operation(summary = "删除对讲用户") |
|||
@PermitAll |
|||
public CommonResult<String> deleteTerminalUser(@RequestBody String requestBody) { |
|||
return success(interphoneTerminalService.deleteTerminalUser(requestBody)); |
|||
} |
|||
|
|||
@GetMapping("/userOnlineStatus") |
|||
@Operation(summary = "查询对讲用户在线状态") |
|||
@PermitAll |
|||
public CommonResult<String> getTerminalUserOnlineStatus(@RequestParam Map<String, String> queryParams) { |
|||
return success(interphoneTerminalService.getTerminalUserOnlineStatus(queryParams)); |
|||
} |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package cn.iocoder.yudao.module.interphone.service; |
|||
|
|||
public interface InterphoneAgentService { |
|||
|
|||
String getAgentList(Integer pageNo, Integer pageSize, String name); |
|||
|
|||
String getAgentDetail(String id); |
|||
} |
|||
@ -1,53 +0,0 @@ |
|||
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,22 @@ |
|||
package cn.iocoder.yudao.module.interphone.service; |
|||
|
|||
public interface InterphoneGroupService { |
|||
|
|||
String getGroupName(String orgId); |
|||
|
|||
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); |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package cn.iocoder.yudao.module.interphone.service; |
|||
|
|||
import java.util.Map; |
|||
|
|||
public interface InterphoneJspService { |
|||
|
|||
String queryGroupByUid(Map<String, String> queryParams); |
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
package cn.iocoder.yudao.module.interphone.service; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.PageResult; |
|||
import cn.iocoder.yudao.module.interphone.controller.admin.org.vo.InterphoneOrgCreateReqVO; |
|||
import cn.iocoder.yudao.module.interphone.controller.admin.org.vo.InterphoneOrgPageReqVO; |
|||
import cn.iocoder.yudao.module.interphone.controller.admin.org.vo.InterphoneOrgRespVO; |
|||
|
|||
public interface InterphoneOrgService { |
|||
|
|||
/** |
|||
* 新增单位 |
|||
* @param createReqVO |
|||
* @return 单位ID |
|||
*/ |
|||
String addOrg(InterphoneOrgCreateReqVO createReqVO); |
|||
|
|||
PageResult<InterphoneOrgRespVO> getAgentOrgs(InterphoneOrgPageReqVO reqVO); |
|||
|
|||
/** |
|||
* 删除单位 |
|||
* @param id 单位id(uuid类型) |
|||
*/ |
|||
void deleteOrg(String id); |
|||
|
|||
/** |
|||
* 修改单位信息 |
|||
*/ |
|||
void updateOrg(InterphoneOrgCreateReqVO createReqVO); |
|||
|
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package cn.iocoder.yudao.module.interphone.service; |
|||
|
|||
public interface InterphoneProfileService { |
|||
|
|||
String getAgentProfile(); |
|||
|
|||
String getFastStats(); |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package cn.iocoder.yudao.module.interphone.service; |
|||
|
|||
import java.util.Map; |
|||
|
|||
public interface InterphoneRecordService { |
|||
|
|||
String getRecordList(Map<String, String> queryParams); |
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
package cn.iocoder.yudao.module.interphone.service; |
|||
|
|||
import java.util.Map; |
|||
|
|||
public interface InterphoneTerminalService { |
|||
|
|||
String querySubordinateUser(Integer pageNo, Integer pageSize, String agentId, String orgId, |
|||
String groupId, String userName, String account); |
|||
|
|||
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); |
|||
} |
|||
@ -0,0 +1,17 @@ |
|||
package cn.iocoder.yudao.module.interphone.service.dto; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
public class InterphonePageResponse<T> { |
|||
|
|||
private Integer code; |
|||
|
|||
private String msg; |
|||
|
|||
private List<T> data; |
|||
|
|||
private Long count; |
|||
} |
|||
@ -0,0 +1,74 @@ |
|||
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 com.alibaba.fastjson.JSONObject; |
|||
|
|||
import java.util.LinkedHashMap; |
|||
import java.util.Map; |
|||
|
|||
public abstract class AbstractInterphoneServiceSupport { |
|||
|
|||
private final ApiClient apiClient; |
|||
|
|||
protected AbstractInterphoneServiceSupport(ApiClient apiClient) { |
|||
this.apiClient = apiClient; |
|||
} |
|||
|
|||
protected String executeGet(String path) { |
|||
return executeGet(path, null); |
|||
} |
|||
|
|||
protected String executeGet(String path, Map<String, String> queryParams) { |
|||
ApiRequest request = ApiRequest.get(path, sanitizeQueryParams(queryParams)); |
|||
ApiResponse response = apiClient.execute(request); |
|||
JSONObject jsonBody = JSONObject.parseObject(response.getBody()); |
|||
|
|||
if (!jsonBody.getString("code").startsWith("200")) throw new RuntimeException(response.getBody()); |
|||
// 修改后
|
|||
JSONObject data = jsonBody.getJSONObject("data"); |
|||
return data != null ? data.toString() : ""; |
|||
} |
|||
|
|||
protected String executePost(String path, Map<String, String> queryParams) { |
|||
ApiRequest request = ApiRequest.postParam(path, sanitizeQueryParams(queryParams)); |
|||
ApiResponse response = apiClient.execute(request); |
|||
JSONObject jsonBody = JSONObject.parseObject(response.getBody()); |
|||
|
|||
if (!jsonBody.getString("code").startsWith("200")) throw new RuntimeException(response.getBody()); |
|||
// 修改后
|
|||
JSONObject data = jsonBody.getJSONObject("data"); |
|||
return data != null ? data.toString() : ""; |
|||
} |
|||
|
|||
protected Map<String, String> newQueryParams() { |
|||
return new LinkedHashMap<>(); |
|||
} |
|||
|
|||
protected void putIfHasText(Map<String, String> queryParams, String key, String value) { |
|||
if (StrUtil.isNotBlank(value)) { |
|||
queryParams.put(key, value); |
|||
} |
|||
} |
|||
|
|||
protected void putIfNotNull(Map<String, String> queryParams, String key, Object value) { |
|||
if (value != null) { |
|||
queryParams.put(key, String.valueOf(value)); |
|||
} |
|||
} |
|||
|
|||
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; |
|||
} |
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
package cn.iocoder.yudao.module.interphone.service.impl; |
|||
|
|||
import cn.iocoder.yudao.module.interphone.core.ApiClient; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneAgentService; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.validation.annotation.Validated; |
|||
|
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
@Validated |
|||
public class InterphoneAgentServiceImpl extends AbstractInterphoneServiceSupport implements InterphoneAgentService { |
|||
|
|||
public InterphoneAgentServiceImpl(ApiClient apiClient) { |
|||
super(apiClient); |
|||
} |
|||
|
|||
@Override |
|||
public String getAgentList(Integer pageNo, Integer pageSize, String name) { |
|||
Map<String, String> queryParams = newQueryParams(); |
|||
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)); |
|||
} |
|||
} |
|||
@ -1,207 +0,0 @@ |
|||
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,67 @@ |
|||
package cn.iocoder.yudao.module.interphone.service.impl; |
|||
|
|||
import cn.iocoder.yudao.module.interphone.core.ApiClient; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneGroupService; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.validation.annotation.Validated; |
|||
|
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
@Validated |
|||
public class InterphoneGroupServiceImpl extends AbstractInterphoneServiceSupport implements InterphoneGroupService { |
|||
|
|||
public InterphoneGroupServiceImpl(ApiClient apiClient) { |
|||
super(apiClient); |
|||
} |
|||
|
|||
@Override |
|||
public String getGroupName(String orgId) { |
|||
return executeGet("/group/getGroupName", Map.of("orgId", orgId)); |
|||
} |
|||
|
|||
@Override |
|||
public String getGroupList(Integer pageNo, Integer pageSize, String name, String orgName) { |
|||
Map<String, String> queryParams = newQueryParams(); |
|||
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 null; |
|||
} |
|||
|
|||
@Override |
|||
public String getGroupDetail(String id) { |
|||
return executeGet("/group/detail", Map.of("id", id)); |
|||
} |
|||
|
|||
@Override |
|||
public String updateGroup(String requestBody) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public String deleteGroup(String requestBody) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public String getGroupMembers(String id) { |
|||
return executeGet("/group/members", Map.of("id", id)); |
|||
} |
|||
|
|||
@Override |
|||
public String addGroupMembers(String requestBody) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public String removeGroupMembers(String requestBody) { |
|||
return null; |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package cn.iocoder.yudao.module.interphone.service.impl; |
|||
|
|||
import cn.iocoder.yudao.module.interphone.core.ApiClient; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneJspService; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.validation.annotation.Validated; |
|||
|
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
@Validated |
|||
public class InterphoneJspServiceImpl extends AbstractInterphoneServiceSupport implements InterphoneJspService { |
|||
|
|||
public InterphoneJspServiceImpl(ApiClient apiClient) { |
|||
super(apiClient); |
|||
} |
|||
|
|||
@Override |
|||
public String queryGroupByUid(Map<String, String> queryParams) { |
|||
return executeGet("/jsp/queryGroupByUId", queryParams); |
|||
} |
|||
} |
|||
@ -0,0 +1,83 @@ |
|||
package cn.iocoder.yudao.module.interphone.service.impl; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.PageResult; |
|||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
|||
import cn.iocoder.yudao.module.interphone.controller.admin.org.vo.InterphoneOrgCreateReqVO; |
|||
import cn.iocoder.yudao.module.interphone.controller.admin.org.vo.InterphoneOrgPageReqVO; |
|||
import cn.iocoder.yudao.module.interphone.controller.admin.org.vo.InterphoneOrgRespVO; |
|||
import cn.iocoder.yudao.module.interphone.core.ApiClient; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneOrgService; |
|||
import cn.iocoder.yudao.module.interphone.service.dto.InterphonePageResponse; |
|||
import com.fasterxml.jackson.core.type.TypeReference; |
|||
import lombok.extern.log4j.Log4j; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.validation.annotation.Validated; |
|||
|
|||
import java.util.Collections; |
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
@Validated |
|||
@Slf4j |
|||
public class InterphoneOrgServiceImpl extends AbstractInterphoneServiceSupport implements InterphoneOrgService { |
|||
|
|||
public InterphoneOrgServiceImpl(ApiClient apiClient) { |
|||
super(apiClient); |
|||
} |
|||
|
|||
@Override |
|||
public String addOrg(InterphoneOrgCreateReqVO createReqVO) { |
|||
Map<String, String> queryParams = newQueryParams(); |
|||
putIfHasText(queryParams, "name", createReqVO.getName()); |
|||
putIfHasText(queryParams, "loginname", createReqVO.getLoginname()); |
|||
putIfHasText(queryParams, "password", createReqVO.getPassword()); |
|||
putIfHasText(queryParams, "phone", createReqVO.getPhone()); |
|||
putIfHasText(queryParams, "address", createReqVO.getAddress()); |
|||
putIfHasText(queryParams, "contact", createReqVO.getContact()); |
|||
putIfNotNull(queryParams, "isDefault", "0"); |
|||
|
|||
String responseBody = executePost("/org/add", queryParams); |
|||
try { |
|||
InterphoneOrgRespVO response = JsonUtils.parseObject(responseBody, InterphoneOrgRespVO.class); |
|||
return response.getId(); |
|||
} catch (Exception e) { |
|||
throw new RuntimeException("对讲平台新增单位失败", e); |
|||
} |
|||
|
|||
} |
|||
|
|||
@Override |
|||
public PageResult<InterphoneOrgRespVO> getAgentOrgs(InterphoneOrgPageReqVO reqVO) { |
|||
Map<String, String> queryParams = newQueryParams(); |
|||
putIfNotNull(queryParams, "pageNo", reqVO.getPageNo()); |
|||
putIfNotNull(queryParams, "pageSize", reqVO.getPageSize()); |
|||
putIfHasText(queryParams, "name", reqVO.getName()); |
|||
String responseBody = executeGet("/agent/orgs", queryParams); |
|||
InterphonePageResponse<InterphoneOrgRespVO> response = JsonUtils.parseObject(responseBody, |
|||
new TypeReference<InterphonePageResponse<InterphoneOrgRespVO>>() { |
|||
}); |
|||
if (response == null) { |
|||
return PageResult.empty(); |
|||
} |
|||
return new PageResult<>(response.getData() == null ? Collections.emptyList() : response.getData(), |
|||
response.getCount() == null ? 0L : response.getCount()); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteOrg(String id) { |
|||
Map<String, String> queryParams = newQueryParams(); |
|||
putIfHasText(queryParams, "id", id); |
|||
executePost("/org/deletingUnit", queryParams); |
|||
} |
|||
|
|||
@Override |
|||
public void updateOrg(InterphoneOrgCreateReqVO createReqVO) { |
|||
Map<String, String> queryParams = newQueryParams(); |
|||
putIfHasText(queryParams, "id", createReqVO.getId()); |
|||
putIfHasText(queryParams, "corgName", createReqVO.getName()); |
|||
putIfHasText(queryParams, "contact", createReqVO.getContact()); |
|||
putIfHasText(queryParams, "address", createReqVO.getAddress()); |
|||
executePost("/org/xiugaiUnit", queryParams); |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package cn.iocoder.yudao.module.interphone.service.impl; |
|||
|
|||
import cn.iocoder.yudao.module.interphone.core.ApiClient; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneProfileService; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.validation.annotation.Validated; |
|||
|
|||
@Service |
|||
@Validated |
|||
public class InterphoneProfileServiceImpl extends AbstractInterphoneServiceSupport implements InterphoneProfileService { |
|||
|
|||
public InterphoneProfileServiceImpl(ApiClient apiClient) { |
|||
super(apiClient); |
|||
} |
|||
|
|||
@Override |
|||
public String getAgentProfile() { |
|||
return executeGet("/profile/agent"); |
|||
} |
|||
|
|||
@Override |
|||
public String getFastStats() { |
|||
return executeGet("/profile/faststats"); |
|||
} |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package cn.iocoder.yudao.module.interphone.service.impl; |
|||
|
|||
import cn.iocoder.yudao.module.interphone.core.ApiClient; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneRecordService; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.validation.annotation.Validated; |
|||
|
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
@Validated |
|||
public class InterphoneRecordServiceImpl extends AbstractInterphoneServiceSupport implements InterphoneRecordService { |
|||
|
|||
public InterphoneRecordServiceImpl(ApiClient apiClient) { |
|||
super(apiClient); |
|||
} |
|||
|
|||
@Override |
|||
public String getRecordList(Map<String, String> queryParams) { |
|||
return executeGet("/record/list", queryParams); |
|||
} |
|||
} |
|||
@ -0,0 +1,67 @@ |
|||
package cn.iocoder.yudao.module.interphone.service.impl; |
|||
|
|||
import cn.iocoder.yudao.module.interphone.core.ApiClient; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneTerminalService; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.validation.annotation.Validated; |
|||
|
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
@Validated |
|||
public class InterphoneTerminalServiceImpl extends AbstractInterphoneServiceSupport implements InterphoneTerminalService { |
|||
|
|||
public InterphoneTerminalServiceImpl(ApiClient apiClient) { |
|||
super(apiClient); |
|||
} |
|||
|
|||
@Override |
|||
public String querySubordinateUser(Integer pageNo, Integer pageSize, String agentId, String orgId, |
|||
String groupId, String userName, String account) { |
|||
Map<String, String> queryParams = newQueryParams(); |
|||
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 createTerminalUsers(String requestBody) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public String getTerminalList(Integer pageNo, Integer pageSize, String orgId, String groupId, String name) { |
|||
Map<String, String> queryParams = newQueryParams(); |
|||
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 null; |
|||
} |
|||
|
|||
@Override |
|||
public String deleteTerminalUser(String requestBody) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public String getTerminalUserOnlineStatus(Map<String, String> queryParams) { |
|||
return executeGet("/terminal/userOnlineStatus", queryParams); |
|||
} |
|||
} |
|||
@ -0,0 +1,46 @@ |
|||
package cn.iocoder.yudao.module.interphone.demo; |
|||
|
|||
import cn.iocoder.yudao.framework.test.core.ut.BaseRedisUnitTest; |
|||
import cn.iocoder.yudao.module.interphone.auth.DefaultLoginService; |
|||
import cn.iocoder.yudao.module.interphone.auth.DefaultTokenManager; |
|||
import cn.iocoder.yudao.module.interphone.config.OkHttpClientConfig; |
|||
import cn.iocoder.yudao.module.interphone.controller.admin.org.vo.InterphoneOrgCreateReqVO; |
|||
import cn.iocoder.yudao.module.interphone.core.ApiClient; |
|||
import cn.iocoder.yudao.module.interphone.retry.TokenExpiredRetryHandler; |
|||
import cn.iocoder.yudao.module.interphone.service.InterphoneOrgService; |
|||
import cn.iocoder.yudao.module.interphone.service.impl.InterphoneOrgServiceImpl; |
|||
import jakarta.annotation.Resource; |
|||
import okhttp3.OkHttpClient; |
|||
import org.checkerframework.checker.units.qual.A; |
|||
import org.junit.jupiter.api.Test; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.context.annotation.Import; |
|||
|
|||
@Import({ |
|||
OkHttpClientConfig.class, |
|||
DefaultLoginService.class, |
|||
DefaultTokenManager.class, |
|||
ApiClient.class, |
|||
TokenExpiredRetryHandler.class, |
|||
OkHttpClient.class, |
|||
InterphoneOrgServiceImpl.class |
|||
}) |
|||
public class orgClientTest extends BaseRedisUnitTest { |
|||
|
|||
@Autowired |
|||
private InterphoneOrgService orgService; |
|||
|
|||
@Test |
|||
public void testAddOrg_Success() { |
|||
InterphoneOrgCreateReqVO createReqVO = new InterphoneOrgCreateReqVO(); |
|||
createReqVO.setName("fubowen"); |
|||
createReqVO.setLoginname("fubowen"); |
|||
createReqVO.setPassword("Gsking164411."); |
|||
createReqVO.setContact("fubowen"); |
|||
String s = orgService.addOrg(createReqVO); |
|||
System.out.println(s); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -1,104 +0,0 @@ |
|||
package cn.iocoder.yudao.module.system.controller.admin.tenantinterphone; |
|||
|
|||
import org.springframework.web.bind.annotation.*; |
|||
import jakarta.annotation.Resource; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.security.access.prepost.PreAuthorize; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
|
|||
import jakarta.validation.constraints.*; |
|||
import jakarta.validation.*; |
|||
import jakarta.servlet.http.*; |
|||
import java.util.*; |
|||
import java.io.IOException; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.PageParam; |
|||
import cn.iocoder.yudao.framework.common.pojo.PageResult; |
|||
import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
|||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
|||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
|||
|
|||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
|||
|
|||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; |
|||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*; |
|||
|
|||
import cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo.*; |
|||
import cn.iocoder.yudao.module.system.dal.dataobject.tenantinterphone.TenantInterphoneDO; |
|||
import cn.iocoder.yudao.module.system.service.tenantinterphone.TenantInterphoneService; |
|||
|
|||
@Tag(name = "管理后台 - 租户对讲平台对应") |
|||
@RestController |
|||
@RequestMapping("/system/tenant-interphone") |
|||
@Validated |
|||
public class TenantInterphoneController { |
|||
|
|||
@Resource |
|||
private TenantInterphoneService tenantInterphoneService; |
|||
|
|||
@PostMapping("/create") |
|||
@Operation(summary = "创建租户对讲平台对应") |
|||
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:create')") |
|||
public CommonResult<Long> createTenantInterphone(@Valid @RequestBody TenantInterphoneSaveReqVO createReqVO) { |
|||
return success(tenantInterphoneService.createTenantInterphone(createReqVO)); |
|||
} |
|||
|
|||
@PutMapping("/update") |
|||
@Operation(summary = "更新租户对讲平台对应") |
|||
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:update')") |
|||
public CommonResult<Boolean> updateTenantInterphone(@Valid @RequestBody TenantInterphoneSaveReqVO updateReqVO) { |
|||
tenantInterphoneService.updateTenantInterphone(updateReqVO); |
|||
return success(true); |
|||
} |
|||
|
|||
@DeleteMapping("/delete") |
|||
@Operation(summary = "删除租户对讲平台对应") |
|||
@Parameter(name = "id", description = "编号", required = true) |
|||
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:delete')") |
|||
public CommonResult<Boolean> deleteTenantInterphone(@RequestParam("id") Long id) { |
|||
tenantInterphoneService.deleteTenantInterphone(id); |
|||
return success(true); |
|||
} |
|||
|
|||
@DeleteMapping("/delete-list") |
|||
@Parameter(name = "ids", description = "编号", required = true) |
|||
@Operation(summary = "批量删除租户对讲平台对应") |
|||
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:delete')") |
|||
public CommonResult<Boolean> deleteTenantInterphoneList(@RequestParam("ids") List<Long> ids) { |
|||
tenantInterphoneService.deleteTenantInterphoneListByIds(ids); |
|||
return success(true); |
|||
} |
|||
|
|||
@GetMapping("/get") |
|||
@Operation(summary = "获得租户对讲平台对应") |
|||
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
|||
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:query')") |
|||
public CommonResult<TenantInterphoneRespVO> getTenantInterphone(@RequestParam("id") Long id) { |
|||
TenantInterphoneDO tenantInterphone = tenantInterphoneService.getTenantInterphone(id); |
|||
return success(BeanUtils.toBean(tenantInterphone, TenantInterphoneRespVO.class)); |
|||
} |
|||
|
|||
@GetMapping("/page") |
|||
@Operation(summary = "获得租户对讲平台对应分页") |
|||
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:query')") |
|||
public CommonResult<PageResult<TenantInterphoneRespVO>> getTenantInterphonePage(@Valid TenantInterphonePageReqVO pageReqVO) { |
|||
PageResult<TenantInterphoneDO> pageResult = tenantInterphoneService.getTenantInterphonePage(pageReqVO); |
|||
return success(BeanUtils.toBean(pageResult, TenantInterphoneRespVO.class)); |
|||
} |
|||
|
|||
@GetMapping("/export-excel") |
|||
@Operation(summary = "导出租户对讲平台对应 Excel") |
|||
@PreAuthorize("@ss.hasPermission('system:tenant-interphone:export')") |
|||
@ApiAccessLog(operateType = EXPORT) |
|||
public void exportTenantInterphoneExcel(@Valid TenantInterphonePageReqVO pageReqVO, |
|||
HttpServletResponse response) throws IOException { |
|||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); |
|||
List<TenantInterphoneDO> list = tenantInterphoneService.getTenantInterphonePage(pageReqVO).getList(); |
|||
// 导出 Excel
|
|||
ExcelUtils.write(response, "租户对讲平台对应.xls", "数据", TenantInterphoneRespVO.class, |
|||
BeanUtils.toBean(list, TenantInterphoneRespVO.class)); |
|||
} |
|||
|
|||
} |
|||
@ -1,44 +0,0 @@ |
|||
package cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo; |
|||
|
|||
import lombok.*; |
|||
import java.util.*; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import cn.iocoder.yudao.framework.common.pojo.PageParam; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import java.time.LocalDateTime; |
|||
|
|||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
|||
|
|||
@Schema(description = "管理后台 - 租户对讲平台对应分页 Request VO") |
|||
@Data |
|||
public class TenantInterphonePageReqVO extends PageParam { |
|||
|
|||
@Schema(description = "租户id", example = "18871") |
|||
private Long tendId; |
|||
|
|||
@Schema(description = "创建时间") |
|||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
|||
private LocalDateTime[] createTime; |
|||
|
|||
@Schema(description = "对讲平台单位id", example = "16985") |
|||
private Long corgId; |
|||
|
|||
@Schema(description = "对讲平台单位名称", example = "张三") |
|||
private String corgName; |
|||
|
|||
@Schema(description = "对讲平台用户数量", example = "11267") |
|||
private Long userCount; |
|||
|
|||
@Schema(description = "对讲平台群组数量", example = "27649") |
|||
private Long groupCount; |
|||
|
|||
@Schema(description = "对讲平台账号", example = "张三") |
|||
private String loginname; |
|||
|
|||
@Schema(description = "对讲平台联系人") |
|||
private String contact; |
|||
|
|||
@Schema(description = "对讲平台单位是否绑定平台") |
|||
private Integer bindingPlatform; |
|||
|
|||
} |
|||
@ -1,55 +0,0 @@ |
|||
package cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.*; |
|||
import java.util.*; |
|||
import org.springframework.format.annotation.DateTimeFormat; |
|||
import java.time.LocalDateTime; |
|||
import com.alibaba.excel.annotation.*; |
|||
|
|||
@Schema(description = "管理后台 - 租户对讲平台对应 Response VO") |
|||
@Data |
|||
@ExcelIgnoreUnannotated |
|||
public class TenantInterphoneRespVO { |
|||
|
|||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "8781") |
|||
@ExcelProperty("id") |
|||
private Long id; |
|||
|
|||
@Schema(description = "租户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18871") |
|||
@ExcelProperty("租户id") |
|||
private Long tendId; |
|||
|
|||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
|||
@ExcelProperty("创建时间") |
|||
private LocalDateTime createTime; |
|||
|
|||
@Schema(description = "对讲平台单位id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16985") |
|||
@ExcelProperty("对讲平台单位id") |
|||
private Long corgId; |
|||
|
|||
@Schema(description = "对讲平台单位名称", example = "张三") |
|||
@ExcelProperty("对讲平台单位名称") |
|||
private String corgName; |
|||
|
|||
@Schema(description = "对讲平台用户数量", example = "11267") |
|||
@ExcelProperty("对讲平台用户数量") |
|||
private Long userCount; |
|||
|
|||
@Schema(description = "对讲平台群组数量", example = "27649") |
|||
@ExcelProperty("对讲平台群组数量") |
|||
private Long groupCount; |
|||
|
|||
@Schema(description = "对讲平台账号", example = "张三") |
|||
@ExcelProperty("对讲平台账号") |
|||
private String loginname; |
|||
|
|||
@Schema(description = "对讲平台联系人") |
|||
@ExcelProperty("对讲平台联系人") |
|||
private String contact; |
|||
|
|||
@Schema(description = "对讲平台单位是否绑定平台") |
|||
@ExcelProperty("对讲平台单位是否绑定平台") |
|||
private Integer bindingPlatform; |
|||
|
|||
} |
|||
@ -1,44 +0,0 @@ |
|||
package cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.*; |
|||
import java.util.*; |
|||
import jakarta.validation.constraints.*; |
|||
|
|||
@Schema(description = "管理后台 - 租户对讲平台对应新增/修改 Request VO") |
|||
@Data |
|||
public class TenantInterphoneSaveReqVO { |
|||
|
|||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "8781") |
|||
private Long id; |
|||
|
|||
@Schema(description = "租户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "18871") |
|||
@NotNull(message = "租户id不能为空") |
|||
private Long tendId; |
|||
|
|||
@Schema(description = "对讲平台单位id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16985") |
|||
@NotNull(message = "对讲平台单位id不能为空") |
|||
private Long corgId; |
|||
|
|||
@Schema(description = "对讲平台单位名称", example = "张三") |
|||
private String corgName; |
|||
|
|||
@Schema(description = "对讲平台用户数量", example = "11267") |
|||
private Long userCount; |
|||
|
|||
@Schema(description = "对讲平台群组数量", example = "27649") |
|||
private Long groupCount; |
|||
|
|||
@Schema(description = "对讲平台账号", example = "张三") |
|||
private String loginname; |
|||
|
|||
@Schema(description = "对讲平台密码") |
|||
private String password; |
|||
|
|||
@Schema(description = "对讲平台联系人") |
|||
private String contact; |
|||
|
|||
@Schema(description = "对讲平台单位是否绑定平台") |
|||
private Integer bindingPlatform; |
|||
|
|||
} |
|||
@ -1,68 +0,0 @@ |
|||
package cn.iocoder.yudao.module.system.dal.dataobject.tenantinterphone; |
|||
|
|||
import lombok.*; |
|||
import java.util.*; |
|||
import java.time.LocalDateTime; |
|||
import java.time.LocalDateTime; |
|||
import com.baomidou.mybatisplus.annotation.*; |
|||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
|||
|
|||
/** |
|||
* 租户对讲平台对应 DO |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@TableName("system_tenant_interphone") |
|||
@KeySequence("system_tenant_interphone_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
|||
@Data |
|||
@EqualsAndHashCode(callSuper = true) |
|||
@ToString(callSuper = true) |
|||
@Builder |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class TenantInterphoneDO extends BaseDO { |
|||
|
|||
/** |
|||
* id |
|||
*/ |
|||
@TableId |
|||
private Long id; |
|||
/** |
|||
* 租户id |
|||
*/ |
|||
private Long tendId; |
|||
/** |
|||
* 对讲平台单位id |
|||
*/ |
|||
private Long corgId; |
|||
/** |
|||
* 对讲平台单位名称 |
|||
*/ |
|||
private String corgName; |
|||
/** |
|||
* 对讲平台用户数量 |
|||
*/ |
|||
private Long userCount; |
|||
/** |
|||
* 对讲平台群组数量 |
|||
*/ |
|||
private Long groupCount; |
|||
/** |
|||
* 对讲平台账号 |
|||
*/ |
|||
private String loginname; |
|||
/** |
|||
* 对讲平台密码 |
|||
*/ |
|||
private String password; |
|||
/** |
|||
* 对讲平台联系人 |
|||
*/ |
|||
private String contact; |
|||
/** |
|||
* 对讲平台单位是否绑定平台 |
|||
*/ |
|||
private Integer bindingPlatform; |
|||
|
|||
|
|||
} |
|||
@ -1,34 +0,0 @@ |
|||
package cn.iocoder.yudao.module.system.dal.mysql.tenantinterphone; |
|||
|
|||
import java.util.*; |
|||
|
|||
import cn.iocoder.yudao.framework.common.pojo.PageResult; |
|||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
|||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
|||
import cn.iocoder.yudao.module.system.dal.dataobject.tenantinterphone.TenantInterphoneDO; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo.*; |
|||
|
|||
/** |
|||
* 租户对讲平台对应 Mapper |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@Mapper |
|||
public interface TenantInterphoneMapper extends BaseMapperX<TenantInterphoneDO> { |
|||
|
|||
default PageResult<TenantInterphoneDO> selectPage(TenantInterphonePageReqVO reqVO) { |
|||
return selectPage(reqVO, new LambdaQueryWrapperX<TenantInterphoneDO>() |
|||
.eqIfPresent(TenantInterphoneDO::getTendId, reqVO.getTendId()) |
|||
.betweenIfPresent(TenantInterphoneDO::getCreateTime, reqVO.getCreateTime()) |
|||
.eqIfPresent(TenantInterphoneDO::getCorgId, reqVO.getCorgId()) |
|||
.likeIfPresent(TenantInterphoneDO::getCorgName, reqVO.getCorgName()) |
|||
.eqIfPresent(TenantInterphoneDO::getUserCount, reqVO.getUserCount()) |
|||
.eqIfPresent(TenantInterphoneDO::getGroupCount, reqVO.getGroupCount()) |
|||
.likeIfPresent(TenantInterphoneDO::getLoginname, reqVO.getLoginname()) |
|||
.eqIfPresent(TenantInterphoneDO::getContact, reqVO.getContact()) |
|||
.eqIfPresent(TenantInterphoneDO::getBindingPlatform, reqVO.getBindingPlatform()) |
|||
.orderByDesc(TenantInterphoneDO::getId)); |
|||
} |
|||
|
|||
} |
|||
@ -1,62 +0,0 @@ |
|||
package cn.iocoder.yudao.module.system.service.tenantinterphone; |
|||
|
|||
import java.util.*; |
|||
import jakarta.validation.*; |
|||
import cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo.*; |
|||
import cn.iocoder.yudao.module.system.dal.dataobject.tenantinterphone.TenantInterphoneDO; |
|||
import cn.iocoder.yudao.framework.common.pojo.PageResult; |
|||
import cn.iocoder.yudao.framework.common.pojo.PageParam; |
|||
|
|||
/** |
|||
* 租户对讲平台对应 Service 接口 |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
public interface TenantInterphoneService { |
|||
|
|||
/** |
|||
* 创建租户对讲平台对应 |
|||
* |
|||
* @param createReqVO 创建信息 |
|||
* @return 编号 |
|||
*/ |
|||
Long createTenantInterphone(@Valid TenantInterphoneSaveReqVO createReqVO); |
|||
|
|||
/** |
|||
* 更新租户对讲平台对应 |
|||
* |
|||
* @param updateReqVO 更新信息 |
|||
*/ |
|||
void updateTenantInterphone(@Valid TenantInterphoneSaveReqVO updateReqVO); |
|||
|
|||
/** |
|||
* 删除租户对讲平台对应 |
|||
* |
|||
* @param id 编号 |
|||
*/ |
|||
void deleteTenantInterphone(Long id); |
|||
|
|||
/** |
|||
* 批量删除租户对讲平台对应 |
|||
* |
|||
* @param ids 编号 |
|||
*/ |
|||
void deleteTenantInterphoneListByIds(List<Long> ids); |
|||
|
|||
/** |
|||
* 获得租户对讲平台对应 |
|||
* |
|||
* @param id 编号 |
|||
* @return 租户对讲平台对应 |
|||
*/ |
|||
TenantInterphoneDO getTenantInterphone(Long id); |
|||
|
|||
/** |
|||
* 获得租户对讲平台对应分页 |
|||
* |
|||
* @param pageReqVO 分页查询 |
|||
* @return 租户对讲平台对应分页 |
|||
*/ |
|||
PageResult<TenantInterphoneDO> getTenantInterphonePage(TenantInterphonePageReqVO pageReqVO); |
|||
|
|||
} |
|||
@ -1,85 +0,0 @@ |
|||
package cn.iocoder.yudao.module.system.service.tenantinterphone; |
|||
|
|||
import cn.hutool.core.collection.CollUtil; |
|||
import org.springframework.stereotype.Service; |
|||
import jakarta.annotation.Resource; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.*; |
|||
import cn.iocoder.yudao.module.system.controller.admin.tenantinterphone.vo.*; |
|||
import cn.iocoder.yudao.module.system.dal.dataobject.tenantinterphone.TenantInterphoneDO; |
|||
import cn.iocoder.yudao.framework.common.pojo.PageResult; |
|||
import cn.iocoder.yudao.framework.common.pojo.PageParam; |
|||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
|||
|
|||
import cn.iocoder.yudao.module.system.dal.mysql.tenantinterphone.TenantInterphoneMapper; |
|||
|
|||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
|||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; |
|||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.diffList; |
|||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; |
|||
|
|||
/** |
|||
* 租户对讲平台对应 Service 实现类 |
|||
* |
|||
* @author 超级管理员 |
|||
*/ |
|||
@Service |
|||
@Validated |
|||
public class TenantInterphoneServiceImpl implements TenantInterphoneService { |
|||
|
|||
@Resource |
|||
private TenantInterphoneMapper tenantInterphoneMapper; |
|||
|
|||
@Override |
|||
public Long createTenantInterphone(TenantInterphoneSaveReqVO createReqVO) { |
|||
// 插入
|
|||
TenantInterphoneDO tenantInterphone = BeanUtils.toBean(createReqVO, TenantInterphoneDO.class); |
|||
tenantInterphoneMapper.insert(tenantInterphone); |
|||
|
|||
// 返回
|
|||
return tenantInterphone.getId(); |
|||
} |
|||
|
|||
@Override |
|||
public void updateTenantInterphone(TenantInterphoneSaveReqVO updateReqVO) { |
|||
// 校验存在
|
|||
validateTenantInterphoneExists(updateReqVO.getId()); |
|||
// 更新
|
|||
TenantInterphoneDO updateObj = BeanUtils.toBean(updateReqVO, TenantInterphoneDO.class); |
|||
tenantInterphoneMapper.updateById(updateObj); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteTenantInterphone(Long id) { |
|||
// 校验存在
|
|||
validateTenantInterphoneExists(id); |
|||
// 删除
|
|||
tenantInterphoneMapper.deleteById(id); |
|||
} |
|||
|
|||
@Override |
|||
public void deleteTenantInterphoneListByIds(List<Long> ids) { |
|||
// 删除
|
|||
tenantInterphoneMapper.deleteByIds(ids); |
|||
} |
|||
|
|||
|
|||
private void validateTenantInterphoneExists(Long id) { |
|||
if (tenantInterphoneMapper.selectById(id) == null) { |
|||
throw exception(TENANT_INTERPHONE_NOT_EXISTS); |
|||
} |
|||
} |
|||
|
|||
@Override |
|||
public TenantInterphoneDO getTenantInterphone(Long id) { |
|||
return tenantInterphoneMapper.selectById(id); |
|||
} |
|||
|
|||
@Override |
|||
public PageResult<TenantInterphoneDO> getTenantInterphonePage(TenantInterphonePageReqVO pageReqVO) { |
|||
return tenantInterphoneMapper.selectPage(pageReqVO); |
|||
} |
|||
|
|||
} |
|||
Loading…
Reference in new issue