Kaynağa Gözat

提交修改pom

chenxiaofei 3 ay önce
ebeveyn
işleme
7afb079622

+ 64 - 99
iot-platform-manager/src/main/java/com/platform/controller/IotDeviceController.java

@@ -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 备黑白名单,设备动态
+}

+ 35 - 0
iot-platform-manager/src/main/java/com/platform/manage/IotDeviceManage.java

@@ -0,0 +1,35 @@
+package com.platform.manage;
+
+import com.platform.request.device.DeviceDetailReq;
+import com.platform.request.device.IotDeviceRequest;
+import com.platform.response.DeviceDetailResp;
+import com.platform.response.DevicePageResp;
+import org.springframework.stereotype.Service;
+
+
+
+/**
+ * @author PC
+ */
+@Service
+public class IotDeviceManage {
+    public Boolean addDevice(IotDeviceRequest request) {
+        return true;
+    }
+
+    public Boolean updateDevice(IotDeviceRequest request) {
+        return true;
+    }
+
+    public Boolean deleteDevice(String guid) {
+        return true;
+    }
+
+    public DeviceDetailResp getDeviceDetail(DeviceDetailReq req) {
+
+    }
+
+    public DevicePageResp pageDeviceDetail(DeviceDetailReq req) {
+
+    }
+}

+ 12 - 0
iot-platform-manager/src/main/java/com/platform/request/Demo.java

@@ -0,0 +1,12 @@
+package com.platform.request;
+
+/**
+ * @Author: 马超伟
+ * @CreateTime: 2025-10-09
+ * @Description:
+ * @Version: 1.0
+ */
+
+
+public class Demo {
+}

+ 16 - 0
iot-platform-manager/src/main/java/com/platform/request/device/DeviceDetailReq.java

@@ -0,0 +1,16 @@
+package com.platform.request.device;
+
+import lombok.Data;
+
+/**
+ * @Author: 马超伟
+ * @CreateTime: 2025-10-09
+ * @Description:
+ * @Version: 1.0
+ */
+
+
+@Data
+public class DeviceDetailReq {
+    private String guid;
+}

+ 113 - 0
iot-platform-manager/src/main/java/com/platform/request/device/IotDeviceRequest.java

@@ -0,0 +1,113 @@
+package com.platform.request.device;
+
+import lombok.Data;
+
+/**
+ * 设备表实体类
+ * @author cxf
+ */
+@Data
+public class IotDeviceRequest {
+
+
+    private Long id;
+
+    /**
+     * 租户id
+     */
+    private String tenantId;
+
+    /**
+     * 所属客户id
+     */
+    private Long companyId;
+
+    /**
+     * 唯一标识[暂时保留]
+     */
+    private String guid;
+
+    /**
+     * 设备编号
+     */
+    private String deviceCode;
+
+    /**
+     * sn通常是:IMEI
+     */
+    private String sn;
+
+    /**
+     * 物联网模型码值
+     */
+    private String modCode;
+
+    /**
+     * 设备名称[旧系统的title]
+     */
+
+    private String deviceName;
+
+    /**
+     * 设备品牌名称
+     */
+
+    private String brand;
+
+    /**
+     * 型号
+     */
+
+    private String modelCode;
+
+    /**
+     * 最后一次设备更新信息值[旧系统的desc]
+     */
+    private String description;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 1在线2离线3异常
+     */
+    private Integer status;
+
+    /**
+     * 经度[lng]
+     */
+    private String longitude;
+
+    /**
+     * 纬度[lat]
+     */
+    private String latitude;
+
+    /**
+     * 高度
+     */
+    private String high;
+
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 更新人
+     */
+    private String updateUser;
+
+    /**
+     * 0-未删除,1-删除
+     */
+    private Integer delFlag;
+
+    /**
+     * 设备类别
+     */
+    private Long egId;
+}

+ 12 - 0
iot-platform-manager/src/main/java/com/platform/response/Demo.java

@@ -0,0 +1,12 @@
+package com.platform.response;
+
+/**
+ * @Author: 马超伟
+ * @CreateTime: 2025-10-09
+ * @Description:
+ * @Version: 1.0
+ */
+
+
+public class Demo {
+}

+ 116 - 0
iot-platform-manager/src/main/java/com/platform/response/DeviceDetailResp.java

@@ -0,0 +1,116 @@
+package com.platform.response;
+
+import lombok.Data;
+
+/**
+ * @Author: 马超伟
+ * @CreateTime: 2025-10-09
+ * @Description:
+ * @Version: 1.0
+ */
+
+
+@Data
+public class DeviceDetailResp {
+
+    private Long id;
+
+    /**
+     * 租户id
+     */
+    private String tenantId;
+
+    /**
+     * 所属客户id
+     */
+    private Long companyId;
+
+    /**
+     * 唯一标识[暂时保留]
+     */
+    private String guid;
+
+    /**
+     * 设备编号
+     */
+    private String deviceCode;
+
+    /**
+     * sn通常是:IMEI
+     */
+    private String sn;
+
+    /**
+     * 物联网模型码值
+     */
+    private String modCode;
+
+    /**
+     * 设备名称[旧系统的title]
+     */
+
+    private String deviceName;
+
+    /**
+     * 设备品牌名称
+     */
+
+    private String brand;
+
+    /**
+     * 型号
+     */
+
+    private String modelCode;
+
+    /**
+     * 最后一次设备更新信息值[旧系统的desc]
+     */
+    private String description;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 1在线2离线3异常
+     */
+    private Integer status;
+
+    /**
+     * 经度[lng]
+     */
+    private String longitude;
+
+    /**
+     * 纬度[lat]
+     */
+    private String latitude;
+
+    /**
+     * 高度
+     */
+    private String high;
+
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 更新人
+     */
+    private String updateUser;
+
+    /**
+     * 0-未删除,1-删除
+     */
+    private Integer delFlag;
+
+    /**
+     * 设备类别
+     */
+    private Long egId;
+}

+ 120 - 0
iot-platform-manager/src/main/java/com/platform/response/DevicePageResp.java

@@ -0,0 +1,120 @@
+package com.platform.response;
+
+import lombok.Data;
+
+/**
+ * @Author: 马超伟
+ * @CreateTime: 2025-10-09
+ * @Description:
+ * @Version: 1.0
+ */
+
+
+@Data
+public class DevicePageResp {
+
+    private Long id;
+
+    /**
+     * 租户id
+     */
+    private String tenantId;
+
+    /**
+     * 所属客户id
+     */
+    private Long companyId;
+
+    /**
+     * 唯一标识[暂时保留]
+     */
+    private String guid;
+
+    /**
+     * 设备编号
+     */
+    private String deviceCode;
+
+    /**
+     * sn通常是:IMEI
+     */
+    private String sn;
+
+    /**
+     * 物联网模型码值
+     */
+    private String modCode;
+
+    /**
+     * 物联网模型名称
+     */
+    private String modName;
+
+    /**
+     * 设备名称[旧系统的title]
+     */
+    private String deviceName;
+
+    /**
+     * 设备品牌名称
+     */
+
+    private String brand;
+
+    /**
+     * 型号
+     */
+
+    private String modelCode;
+
+    /**
+     * 最后一次设备更新信息值[旧系统的desc]
+     */
+    private String description;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 1在线2离线3异常
+     */
+    private Integer status;
+
+    /**
+     * 经度[lng]
+     */
+    private String longitude;
+
+    /**
+     * 纬度[lat]
+     */
+    private String latitude;
+
+    /**
+     * 高度
+     */
+    private String high;
+
+
+    /**
+     * 创建人
+     */
+    private String createUser;
+
+    /**
+     * 更新人
+     */
+    private String updateUser;
+
+    /**
+     * 0-未删除,1-删除
+     */
+    private Integer delFlag;
+
+    /**
+     * 设备类别
+     */
+    private Long egId;
+}