【代码评审】IoT:插件管理相关的逻辑
This commit is contained in:
@@ -20,7 +20,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMPTY;
|
||||
|
||||
@Tag(name = "管理后台 - IoT 插件信息")
|
||||
@@ -86,7 +85,6 @@ public class PluginInfoController {
|
||||
return success(true);
|
||||
}
|
||||
|
||||
// 修改插件状态
|
||||
@PutMapping("/update-status")
|
||||
@Operation(summary = "修改插件状态")
|
||||
@PreAuthorize("@ss.hasPermission('iot:plugin-info:update')")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.plugininfo.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.iot.enums.plugin.IotPluginTypeEnum;
|
||||
import lombok.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
@@ -8,13 +10,12 @@ import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
// TODO @haohao:只查询必要字段哈
|
||||
@Schema(description = "管理后台 - IoT 插件信息分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PluginInfoPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "插件包id", example = "24627")
|
||||
@Schema(description = "插件包 ID ", example = "24627")
|
||||
private String pluginId;
|
||||
|
||||
@Schema(description = "插件名称", example = "赵六")
|
||||
@@ -33,6 +34,7 @@ public class PluginInfoPageReqVO extends PageParam {
|
||||
private String version;
|
||||
|
||||
@Schema(description = "插件类型", example = "2")
|
||||
@InEnum(IotPluginTypeEnum.class)
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "设备插件协议类型")
|
||||
|
||||
@@ -1,22 +1,23 @@
|
||||
package cn.iocoder.yudao.module.iot.controller.admin.plugininfo.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - IoT 插件信息 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PluginInfoRespVO {
|
||||
|
||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11546")
|
||||
@ExcelProperty("主键ID")
|
||||
@Schema(description = "主键 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11546")
|
||||
@ExcelProperty("主键 ID")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "插件包id", requiredMode = Schema.RequiredMode.REQUIRED, example = "24627")
|
||||
@ExcelProperty("插件包id")
|
||||
@Schema(description = "插件包 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24627")
|
||||
@ExcelProperty("插件包 ID")
|
||||
private String pluginId;
|
||||
|
||||
@Schema(description = "插件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
|
||||
@@ -8,6 +8,7 @@ import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
// TODO @haohao:建议搞个 plugin,然后里面分 info 和 instance。另外,是不是 info => config 会好点,插件配置?
|
||||
@Schema(description = "管理后台 - IoT 插件实例分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
||||
@@ -22,12 +22,13 @@ import lombok.*;
|
||||
public class PluginInfoDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
* 主键 ID
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
// TODO @haohao:这个是不是改成类似 key 之类的字段哈?
|
||||
/**
|
||||
* 插件包id
|
||||
* 插件包 ID
|
||||
*/
|
||||
private String pluginId;
|
||||
/**
|
||||
@@ -41,10 +42,12 @@ public class PluginInfoDO extends BaseDO {
|
||||
/**
|
||||
* 部署方式
|
||||
*/
|
||||
// TODO @haohao:枚举
|
||||
private Integer deployType;
|
||||
/**
|
||||
* 插件包文件名
|
||||
*/
|
||||
// TODO @haohao:是不是叫 fileName 哈?避免后续有别的字段,类似 fileUrl?
|
||||
private String file;
|
||||
/**
|
||||
* 插件版本
|
||||
@@ -53,6 +56,7 @@ public class PluginInfoDO extends BaseDO {
|
||||
/**
|
||||
* 插件类型
|
||||
*/
|
||||
// TODO @haohao:枚举
|
||||
private Integer type;
|
||||
/**
|
||||
* 设备插件协议类型
|
||||
@@ -61,6 +65,7 @@ public class PluginInfoDO extends BaseDO {
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
// TODO @haohao:枚举
|
||||
private Integer status;
|
||||
/**
|
||||
* 插件配置项描述信息
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package cn.iocoder.yudao.module.iot.dal.dataobject.plugininstance;
|
||||
|
||||
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;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
// TODO @haohao:一些必要的关联、枚举
|
||||
/**
|
||||
* IoT 插件实例 DO
|
||||
*
|
||||
@@ -28,7 +28,7 @@ public class PluginInstanceDO extends BaseDO {
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 插件主程序id
|
||||
* 插件主程序 ID
|
||||
*/
|
||||
private String mainId;
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ public class PluginInstanceDO extends BaseDO {
|
||||
*/
|
||||
private Integer port;
|
||||
/**
|
||||
* 心跳时间,心路时间超过30秒需要剔除
|
||||
* 心跳时间,心路时间超过 30 秒需要剔除
|
||||
*/
|
||||
private Long heartbeatAt;
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.Map;
|
||||
*/
|
||||
public interface IotDeviceDataService {
|
||||
|
||||
|
||||
/**
|
||||
* 保存设备数据
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user