| | |
| | | import com.mes.device.vo.DeviceGroupVO; |
| | | import com.mes.device.vo.StatisticsVO; |
| | | import com.mes.vo.Result; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("device/group") |
| | | @Tag(name = "设备组管理", description = "设备组管理相关接口") |
| | | @Api(tags = "设备组管理") |
| | | public class DeviceGroupController { |
| | | |
| | | @Resource |
| | |
| | | * 创建设备组 |
| | | */ |
| | | @PostMapping("/create") |
| | | @Operation(summary = "创建设备组", description = "创建设备组信息") |
| | | @ApiOperation("创建设备组") |
| | | public Result<DeviceGroupConfig> createGroup( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 更新设备组配置 |
| | | */ |
| | | @PostMapping("/update") |
| | | @Operation(summary = "更新设备组配置", description = "更新指定ID的设备组配置") |
| | | @ApiOperation("更新设备组配置") |
| | | public Result<DeviceGroupConfig> updateGroup( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 删除设备组配置 |
| | | */ |
| | | @PostMapping("/delete") |
| | | @Operation(summary = "删除设备组配置", description = "删除指定ID的设备组配置") |
| | | @ApiOperation("删除设备组配置") |
| | | public Result<Void> deleteGroup( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 根据ID获取设备组配置 |
| | | */ |
| | | @PostMapping("/detail") |
| | | @Operation(summary = "获取设备组配置详情", description = "根据ID获取设备组配置的详细信息") |
| | | @ApiOperation("获取设备组配置详情") |
| | | public Result<DeviceGroupConfig> getGroupById( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 分页查询设备组列表 |
| | | */ |
| | | @PostMapping("/list") |
| | | @Operation(summary = "分页查询设备组列表", description = "分页查询设备组列表") |
| | | @ApiOperation("分页查询设备组列表") |
| | | public Result<Page<DeviceGroupVO.GroupInfo>> getGroupList( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 启用设备组 |
| | | */ |
| | | @PostMapping("/enable") |
| | | @Operation(summary = "启用设备组", description = "启用指定设备组") |
| | | @ApiOperation("启用设备组") |
| | | public Result<Void> enableGroup( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 禁用设备组 |
| | | */ |
| | | @PostMapping("/disable") |
| | | @Operation(summary = "禁用设备组", description = "禁用指定设备组") |
| | | @ApiOperation("禁用设备组") |
| | | public Result<Void> disableGroup( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 批量启用设备组 |
| | | */ |
| | | @PostMapping("/batch-enable") |
| | | @Operation(summary = "批量启用设备组", description = "批量启用指定ID列表的设备组") |
| | | @ApiOperation("批量启用设备组") |
| | | public Result<Void> batchEnableGroups( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 批量禁用设备组 |
| | | */ |
| | | @PostMapping("/batch-disable") |
| | | @Operation(summary = "批量禁用设备组", description = "批量禁用指定ID列表的设备组") |
| | | @ApiOperation("批量禁用设备组") |
| | | public Result<Void> batchDisableGroups( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 获取设备组统计信息 |
| | | */ |
| | | @PostMapping("/statistics/groups") |
| | | @Operation(summary = "获取设备组统计信息", description = "获取设备组相关的统计信息") |
| | | @ApiOperation("获取设备组统计信息") |
| | | public Result<StatisticsVO.GroupStatistics> getGroupStatistics( |
| | | @RequestBody(required = false) Map<String, Object> request) { |
| | | try { |
| | |
| | | * 检查设备组编码是否已存在 |
| | | */ |
| | | @PostMapping("/check-code") |
| | | @Operation(summary = "检查设备组编码", description = "检查设备组编码是否已存在") |
| | | @ApiOperation("检查设备组编码") |
| | | public Result<Boolean> checkGroupCodeExists( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 获取设备组类型列表 |
| | | */ |
| | | @PostMapping("/types") |
| | | @Operation(summary = "获取设备组类型列表", description = "获取所有可用的设备组类型") |
| | | @ApiOperation("获取设备组类型列表") |
| | | public Result<List<String>> getGroupTypes() { |
| | | try { |
| | | List<String> groupTypes = deviceGroupConfigService.getAllGroupTypes(); |
| | |
| | | * 获取设备组状态列表 |
| | | */ |
| | | @PostMapping("/statuses") |
| | | @Operation(summary = "获取设备组状态列表", description = "获取所有可用的设备组状态") |
| | | @ApiOperation("获取设备组状态列表") |
| | | public Result<List<String>> getGroupStatuses() { |
| | | try { |
| | | List<String> groupStatuses = deviceGroupConfigService.getAllGroupStatuses(); |
| | |
| | | * 添加设备到设备组 |
| | | */ |
| | | @PostMapping("/devices") |
| | | @Operation(summary = "添加设备到设备组", description = "将指定设备添加到设备组中") |
| | | @ApiOperation("添加设备到设备组") |
| | | public Result<Void> addDeviceToGroup( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 从设备组移除设备 |
| | | */ |
| | | @PostMapping("/devices/remove") |
| | | @Operation(summary = "从设备组移除设备", description = "从设备组中移除指定设备") |
| | | @ApiOperation("从设备组移除设备") |
| | | public Result<Void> removeDeviceFromGroup( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 更新设备角色 |
| | | */ |
| | | @PostMapping("/devices/role") |
| | | @Operation(summary = "更新设备角色", description = "更新设备在设备组中的角色") |
| | | @ApiOperation("更新设备角色") |
| | | public Result<Void> updateDeviceRole( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 获取设备组设备列表 |
| | | */ |
| | | @PostMapping("/devices/list") |
| | | @Operation(summary = "获取设备组设备列表", description = "获取指定设备组下的所有设备") |
| | | @ApiOperation("获取设备组设备列表") |
| | | public Result<List<DeviceGroupVO.DeviceInfo>> getGroupDevices( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 获取设备设备组列表 |
| | | */ |
| | | @PostMapping("/devices/groups") |
| | | @Operation(summary = "获取设备设备组列表", description = "获取指定设备所属的所有设备组") |
| | | @ApiOperation("获取设备设备组列表") |
| | | public Result<List<DeviceGroupVO.GroupInfo>> getDeviceGroups( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 批量添加设备到设备组 |
| | | */ |
| | | @PostMapping("/batch-add-devices") |
| | | @Operation(summary = "批量添加设备到设备组", description = "批量将指定设备列表添加到设备组中") |
| | | @ApiOperation("批量添加设备到设备组") |
| | | public Result<Void> batchAddDevicesToGroup( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 批量从设备组移除设备 |
| | | */ |
| | | @PostMapping("/devices/batch-remove") |
| | | @Operation(summary = "批量从设备组移除设备", description = "批量从设备组中移除指定设备列表") |
| | | @ApiOperation("批量从设备组移除设备") |
| | | public Result<Void> batchRemoveDevicesFromGroup( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 设备组健康检查 |
| | | */ |
| | | @PostMapping("/health-check") |
| | | @Operation(summary = "设备组健康检查", description = "对指定设备组进行健康检查") |
| | | @ApiOperation("设备组健康检查") |
| | | public Result<DeviceGroupVO.HealthCheckResult> performGroupHealthCheck( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |
| | |
| | | * 获取设备组性能统计 |
| | | */ |
| | | @PostMapping("/performance") |
| | | @Operation(summary = "获取设备组性能统计", description = "获取指定设备组的性能统计信息") |
| | | @ApiOperation("获取设备组性能统计") |
| | | public Result<DeviceGroupVO.PerformanceStats> getGroupPerformance( |
| | | @Valid @RequestBody DeviceGroupRequest request) { |
| | | try { |