|
|
@@ -1,99 +1,64 @@
|
|
|
-//package com.platform.controller;
|
|
|
-//
|
|
|
-//import com.alibaba.nacos.api.model.v2.Result;
|
|
|
-//import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
-//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-//import com.platform.entity.IotDevice;
|
|
|
-//import com.platform.result.HttpResult;
|
|
|
-//import com.platform.service.IotDeviceService;
|
|
|
-//import lombok.RequiredArgsConstructor;
|
|
|
-//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-//import org.springframework.web.bind.annotation.*;
|
|
|
-//import javax.validation.Valid;
|
|
|
-//import java.util.List;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * 物联网设备管理控制器
|
|
|
-// * @author PC
|
|
|
-// */
|
|
|
-//@RestController
|
|
|
-//@RequestMapping("/iot/device")
|
|
|
-//@RequiredArgsConstructor
|
|
|
-//public class IotDeviceController {
|
|
|
-//
|
|
|
-//
|
|
|
-// private IotDeviceService iotDeviceService;
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 添加物联网设备
|
|
|
-// */
|
|
|
-// @PostMapping
|
|
|
-// public HttpResult<IotDevice> addDevice(@RequestBody IotDevice device) {
|
|
|
-// iotDeviceService.addDevice(device);
|
|
|
-// return HttpResult.success();
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取物联网设备详情
|
|
|
-// */
|
|
|
-// @GetMapping("/{id}")
|
|
|
-// public HttpResult<IotDevice> getDevice(@PathVariable String guid) {
|
|
|
-// IotDevice device = iotDeviceService.getDevice(guid);
|
|
|
-// return null;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 物联网设备列表(分页)
|
|
|
-// */
|
|
|
-// @GetMapping
|
|
|
-// public Result<IPage<IotDevice>> listDevices(
|
|
|
-// @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
-// @RequestParam(defaultValue = "10") Integer pageSize,
|
|
|
-// IotDeviceQuery query) {
|
|
|
-// Page<IotDevice> page = new Page<>(pageNum, pageSize);
|
|
|
-// IPage<IotDevice> result = iotDeviceService.pageDevices(page, query);
|
|
|
-// return Result.success(result);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 编辑物联网设备
|
|
|
-// */
|
|
|
-// @PutMapping
|
|
|
-// public <Boolean> updateDevice(@RequestBody IotDevice device) {
|
|
|
-// boolean updated = iotDeviceService.updateById(device);
|
|
|
-// return ;
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 删除物联网设备
|
|
|
-// */
|
|
|
-// @DeleteMapping("/{id}")
|
|
|
-// public Result<Boolean> deleteDevice(@PathVariable Long id) {
|
|
|
-// boolean removed = iotDeviceService.removeById(id);
|
|
|
-// return removed ? Result.success(true) : Result.failed("删除设备失败");
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 设备黑白名单管理
|
|
|
-// */
|
|
|
-// @PostMapping("/whitelist")
|
|
|
-// public Result<Boolean> addToWhitelist(@RequestBody List<String> deviceGuids) {
|
|
|
-// boolean success = iotDeviceService.addToWhitelist(deviceGuids);
|
|
|
-// return success ? Result.success(true) : Result.failed("添加白名单失败");
|
|
|
-// }
|
|
|
-//
|
|
|
-// @PostMapping("/blacklist")
|
|
|
-// public Result<Boolean> addToBlacklist(@RequestBody List<String> deviceGuids) {
|
|
|
-// boolean success = iotDeviceService.addToBlacklist(deviceGuids);
|
|
|
-// return success ? Result.success(true) : Result.failed("添加黑名单失败");
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 设备动态信息
|
|
|
-// */
|
|
|
-// @GetMapping("/status/{guid}")
|
|
|
-// public Result<DeviceStatusDTO> getDeviceStatus(@PathVariable String guid) {
|
|
|
-// DeviceStatusDTO status = iotDeviceService.getDeviceStatus(guid);
|
|
|
-// return status != null ? Result.success(status) : Result.failed("获取设备状态失败");
|
|
|
-// }
|
|
|
-//}
|
|
|
+package com.platform.controller;
|
|
|
+
|
|
|
+import com.platform.entity.IotDevice;
|
|
|
+import com.platform.manage.IotDeviceManage;
|
|
|
+import com.platform.request.device.DeviceDetailReq;
|
|
|
+import com.platform.request.device.IotDeviceRequest;
|
|
|
+import com.platform.response.DeviceDetailResp;
|
|
|
+import com.platform.response.DevicePageResp;
|
|
|
+import com.platform.result.HttpResult;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 物联网设备管理控制器
|
|
|
+ * @author PC
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/iot/device")
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class IotDeviceController {
|
|
|
+
|
|
|
+ private final IotDeviceManage iotDeviceManage;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加物联网设备
|
|
|
+ */
|
|
|
+ @PostMapping("/addDevice")
|
|
|
+ public HttpResult<Boolean> addDevice(@RequestBody IotDeviceRequest request) {
|
|
|
+ return HttpResult.success(iotDeviceManage.addDevice(request));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改物联网设备
|
|
|
+ */
|
|
|
+ @PostMapping("/updateDevice")
|
|
|
+ public HttpResult<Boolean> updateDevice(@RequestBody IotDeviceRequest request) {
|
|
|
+ return HttpResult.success(iotDeviceManage.updateDevice(request));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除物联网设备
|
|
|
+ */
|
|
|
+ @GetMapping("/delDevice")
|
|
|
+ public HttpResult<Boolean> deleteDevice(String guid) {
|
|
|
+ return HttpResult.success(iotDeviceManage.deleteDevice(guid));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 物联设备详情查询
|
|
|
+ */
|
|
|
+ @PostMapping("/getDeviceDetail")
|
|
|
+ public HttpResult<DeviceDetailResp> getDeviceDetail(DeviceDetailReq req) {
|
|
|
+ return HttpResult.success(iotDeviceManage.getDeviceDetail(req));
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 分页查询物联设备
|
|
|
+ */
|
|
|
+ @PostMapping("/pageDeviceDetail")
|
|
|
+ public HttpResult<DevicePageResp> pageDeviceDetail(DeviceDetailReq req) {
|
|
|
+ return HttpResult.success(iotDeviceManage.pageDeviceDetail(req));
|
|
|
+ }
|
|
|
+
|
|
|
+ //todo cxf 备黑白名单,设备动态
|
|
|
+}
|