Commit 2905efec28827af68918d24bcfdb52d6980003c8
Merge branch 'feature/iot' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/iot
Showing
192 changed files
with
4623 additions
and
2981 deletions
Too many changes.
To preserve performance only 100 of 192 files are displayed.
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java
| 1 | 1 | package cn.iocoder.yudao.framework.mybatis.config; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.collection.CollUtil; | |
| 3 | 4 | import cn.hutool.core.util.StrUtil; |
| 4 | 5 | import cn.iocoder.yudao.framework.mybatis.core.handler.DefaultDBFieldHandler; |
| 5 | 6 | import com.baomidou.mybatisplus.annotation.DbType; |
| 6 | 7 | import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; |
| 7 | 8 | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| 8 | 9 | import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator; |
| 10 | +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | |
| 9 | 11 | import com.baomidou.mybatisplus.extension.incrementer.*; |
| 10 | 12 | import com.baomidou.mybatisplus.extension.parser.JsqlParserGlobal; |
| 11 | 13 | import com.baomidou.mybatisplus.extension.parser.cache.JdkSerialCaffeineJsqlParseCache; |
| 12 | 14 | import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; |
| 13 | 15 | import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; |
| 16 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
| 14 | 17 | import org.apache.ibatis.annotations.Mapper; |
| 15 | 18 | import org.mybatis.spring.annotation.MapperScan; |
| 16 | 19 | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| ... | ... | @@ -18,6 +21,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| 18 | 21 | import org.springframework.context.annotation.Bean; |
| 19 | 22 | import org.springframework.core.env.ConfigurableEnvironment; |
| 20 | 23 | |
| 24 | +import java.util.List; | |
| 21 | 25 | import java.util.concurrent.TimeUnit; |
| 22 | 26 | |
| 23 | 27 | /** |
| ... | ... | @@ -73,4 +77,11 @@ public class YudaoMybatisAutoConfiguration { |
| 73 | 77 | throw new IllegalArgumentException(StrUtil.format("DbType{} 找不到合适的 IKeyGenerator 实现类", dbType)); |
| 74 | 78 | } |
| 75 | 79 | |
| 80 | + @Bean | |
| 81 | + public JacksonTypeHandler jacksonTypeHandler(List<ObjectMapper> objectMappers) { | |
| 82 | + // 特殊:设置 JacksonTypeHandler 的 ObjectMapper! | |
| 83 | + JacksonTypeHandler.setObjectMapper(CollUtil.getFirst(objectMappers)); | |
| 84 | + return new JacksonTypeHandler(Object.class); | |
| 85 | + } | |
| 86 | + | |
| 76 | 87 | } | ... | ... |
yudao-module-iot/pom.xml
yudao-module-iot/yudao-module-iot-api/pom.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<project xmlns="http://maven.apache.org/POM/4.0.0" | |
| 3 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 4 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 5 | - <parent> | |
| 6 | - <artifactId>yudao-module-iot</artifactId> | |
| 7 | - <groupId>cn.iocoder.boot</groupId> | |
| 8 | - <version>${revision}</version> | |
| 9 | - </parent> | |
| 10 | - <modelVersion>4.0.0</modelVersion> | |
| 11 | - <artifactId>yudao-module-iot-api</artifactId> | |
| 12 | - <packaging>jar</packaging> | |
| 13 | - | |
| 14 | - <name>${project.artifactId}</name> | |
| 15 | - <!-- TODO 芋艿:需要在整理下,特别是 PF4J --> | |
| 16 | - <description> | |
| 17 | - 物联网 模块 API,暴露给其它模块调用 | |
| 18 | - </description> | |
| 19 | - | |
| 20 | - <dependencies> | |
| 21 | - <dependency> | |
| 22 | - <groupId>cn.iocoder.boot</groupId> | |
| 23 | - <artifactId>yudao-common</artifactId> | |
| 24 | - </dependency> | |
| 25 | - | |
| 26 | - <!-- Web 相关 --> | |
| 27 | - <dependency> | |
| 28 | - <groupId>org.springframework</groupId> | |
| 29 | - <artifactId>spring-web</artifactId> | |
| 30 | - <scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 --> | |
| 31 | - </dependency> | |
| 32 | - | |
| 33 | - <!-- 工具类相关 --> | |
| 34 | - <dependency> | |
| 35 | - <groupId>com.fasterxml.jackson.core</groupId> | |
| 36 | - <artifactId>jackson-databind</artifactId> | |
| 37 | - <scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 --> | |
| 38 | - </dependency> | |
| 39 | - | |
| 40 | - <!-- <dependency>--> | |
| 41 | - <!-- <groupId>org.pf4j</groupId> <!– PF4J:内置插件机制 –>--> | |
| 42 | - <!-- <artifactId>pf4j-spring</artifactId>--> | |
| 43 | - <!-- </dependency>--> | |
| 44 | - | |
| 45 | - <!-- 参数校验 --> | |
| 46 | - <dependency> | |
| 47 | - <groupId>org.springframework.boot</groupId> | |
| 48 | - <artifactId>spring-boot-starter-validation</artifactId> | |
| 49 | - <optional>true</optional> | |
| 50 | - </dependency> | |
| 51 | - </dependencies> | |
| 52 | - | |
| 53 | -</project> |
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceEventReportReqDTO.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream; | |
| 2 | - | |
| 3 | -import jakarta.validation.constraints.NotEmpty; | |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | -import java.util.Map; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * IoT 设备【事件】上报 Request DTO | |
| 10 | - * | |
| 11 | - * @author 芋道源码 | |
| 12 | - */ | |
| 13 | -@Data | |
| 14 | -public class IotDeviceEventReportReqDTO extends IotDeviceUpstreamAbstractReqDTO { | |
| 15 | - | |
| 16 | - /** | |
| 17 | - * 事件标识 | |
| 18 | - */ | |
| 19 | - @NotEmpty(message = "事件标识不能为空") | |
| 20 | - private String identifier; | |
| 21 | - /** | |
| 22 | - * 事件参数 | |
| 23 | - */ | |
| 24 | - private Map<String, Object> params; | |
| 25 | - | |
| 26 | -} |
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDevicePropertyReportReqDTO.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream; | |
| 2 | - | |
| 3 | -import jakarta.validation.constraints.NotEmpty; | |
| 4 | -import lombok.Data; | |
| 5 | - | |
| 6 | -import java.util.Map; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * IoT 设备【属性】上报 Request DTO | |
| 10 | - * | |
| 11 | - * @author 芋道源码 | |
| 12 | - */ | |
| 13 | -@Data | |
| 14 | -public class IotDevicePropertyReportReqDTO extends IotDeviceUpstreamAbstractReqDTO { | |
| 15 | - | |
| 16 | - /** | |
| 17 | - * 属性参数 | |
| 18 | - */ | |
| 19 | - @NotEmpty(message = "属性参数不能为空") | |
| 20 | - private Map<String, Object> properties; | |
| 21 | - | |
| 22 | -} | |
| 23 | 0 | \ No newline at end of file |
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/api/device/dto/control/upstream/IotDeviceUpstreamAbstractReqDTO.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.api.device.dto.control.upstream; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.util.json.databind.TimestampLocalDateTimeSerializer; | |
| 4 | -import com.fasterxml.jackson.databind.annotation.JsonSerialize; | |
| 5 | -import jakarta.validation.constraints.NotEmpty; | |
| 6 | -import lombok.Data; | |
| 7 | - | |
| 8 | -import java.time.LocalDateTime; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * IoT 设备上行的抽象 Request DTO | |
| 12 | - * | |
| 13 | - * @author 芋道源码 | |
| 14 | - */ | |
| 15 | -@Data | |
| 16 | -public abstract class IotDeviceUpstreamAbstractReqDTO { | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 请求编号 | |
| 20 | - */ | |
| 21 | - private String requestId; | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * 插件实例的进程编号 | |
| 25 | - */ | |
| 26 | - private String processId; | |
| 27 | - | |
| 28 | - /** | |
| 29 | - * 产品标识 | |
| 30 | - */ | |
| 31 | - @NotEmpty(message = "产品标识不能为空") | |
| 32 | - private String productKey; | |
| 33 | - /** | |
| 34 | - * 设备名称 | |
| 35 | - */ | |
| 36 | - @NotEmpty(message = "设备名称不能为空") | |
| 37 | - private String deviceName; | |
| 38 | - | |
| 39 | - /** | |
| 40 | - * 上报时间 | |
| 41 | - */ | |
| 42 | - @JsonSerialize(using = TimestampLocalDateTimeSerializer.class) // 解决 iot plugins 序列化 LocalDateTime 是数组,导致无法解析的问题 | |
| 43 | - private LocalDateTime reportTime; | |
| 44 | - | |
| 45 | -} |
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/rule/IotDataBridgeTypeEnum.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.enums.rule; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.core.ArrayValuable; | |
| 4 | -import lombok.Getter; | |
| 5 | -import lombok.RequiredArgsConstructor; | |
| 6 | - | |
| 7 | -import java.util.Arrays; | |
| 8 | - | |
| 9 | -/** | |
| 10 | - * IoT 数据桥接的类型枚举 | |
| 11 | - * | |
| 12 | - * @author 芋道源码 | |
| 13 | - */ | |
| 14 | -@RequiredArgsConstructor | |
| 15 | -@Getter | |
| 16 | -public enum IotDataBridgeTypeEnum implements ArrayValuable<Integer> { | |
| 17 | - | |
| 18 | - HTTP(1, "HTTP"), | |
| 19 | - TCP(2, "TCP"), | |
| 20 | - WEBSOCKET(3, "WEBSOCKET"), | |
| 21 | - | |
| 22 | - MQTT(10, "MQTT"), | |
| 23 | - | |
| 24 | - DATABASE(20, "DATABASE"), | |
| 25 | - REDIS_STREAM(21, "REDIS_STREAM"), | |
| 26 | - | |
| 27 | - ROCKETMQ(30, "ROCKETMQ"), | |
| 28 | - RABBITMQ(31, "RABBITMQ"), | |
| 29 | - KAFKA(32, "KAFKA"); | |
| 30 | - | |
| 31 | - private final Integer type; | |
| 32 | - | |
| 33 | - private final String name; | |
| 34 | - | |
| 35 | - public static final Integer[] ARRAYS = Arrays.stream(values()).map(IotDataBridgeTypeEnum::getType).toArray(Integer[]::new); | |
| 36 | - | |
| 37 | - @Override | |
| 38 | - public Integer[] array() { | |
| 39 | - return ARRAYS; | |
| 40 | - } | |
| 41 | - | |
| 42 | -} |
yudao-module-iot/yudao-module-iot-biz/pom.xml
| ... | ... | @@ -25,11 +25,6 @@ |
| 25 | 25 | </dependency> |
| 26 | 26 | <dependency> |
| 27 | 27 | <groupId>cn.iocoder.boot</groupId> |
| 28 | - <artifactId>yudao-module-iot-api</artifactId> | |
| 29 | - <version>${revision}</version> | |
| 30 | - </dependency> | |
| 31 | - <dependency> | |
| 32 | - <groupId>cn.iocoder.boot</groupId> | |
| 33 | 28 | <artifactId>yudao-module-iot-core</artifactId> |
| 34 | 29 | <version>${revision}</version> |
| 35 | 30 | </dependency> | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/alert/IotAlertConfigController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.alert; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.alert.vo.config.IotAlertConfigPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.iot.controller.admin.alert.vo.config.IotAlertConfigRespVO; | |
| 9 | +import cn.iocoder.yudao.module.iot.controller.admin.alert.vo.config.IotAlertConfigSaveReqVO; | |
| 10 | +import cn.iocoder.yudao.module.iot.dal.dataobject.alert.IotAlertConfigDO; | |
| 11 | +import cn.iocoder.yudao.module.iot.service.alert.IotAlertConfigService; | |
| 12 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | |
| 13 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | |
| 14 | +import io.swagger.v3.oas.annotations.Operation; | |
| 15 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 16 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 17 | +import jakarta.annotation.Resource; | |
| 18 | +import jakarta.validation.Valid; | |
| 19 | + | |
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 21 | +import org.springframework.validation.annotation.Validated; | |
| 22 | +import org.springframework.web.bind.annotation.*; | |
| 23 | + | |
| 24 | +import java.util.List; | |
| 25 | +import java.util.Map; | |
| 26 | +import java.util.Objects; | |
| 27 | +import java.util.stream.Collectors; | |
| 28 | + | |
| 29 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 30 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 31 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; | |
| 32 | + | |
| 33 | +@Tag(name = "管理后台 - IoT 告警配置") | |
| 34 | +@RestController | |
| 35 | +@RequestMapping("/iot/alert-config") | |
| 36 | +@Validated | |
| 37 | +public class IotAlertConfigController { | |
| 38 | + | |
| 39 | + @Resource | |
| 40 | + private IotAlertConfigService alertConfigService; | |
| 41 | + | |
| 42 | + @Resource | |
| 43 | + private AdminUserApi adminUserApi; | |
| 44 | + | |
| 45 | + @PostMapping("/create") | |
| 46 | + @Operation(summary = "创建告警配置") | |
| 47 | + @PreAuthorize("@ss.hasPermission('iot:alert-config:create')") | |
| 48 | + public CommonResult<Long> createAlertConfig(@Valid @RequestBody IotAlertConfigSaveReqVO createReqVO) { | |
| 49 | + return success(alertConfigService.createAlertConfig(createReqVO)); | |
| 50 | + } | |
| 51 | + | |
| 52 | + @PutMapping("/update") | |
| 53 | + @Operation(summary = "更新告警配置") | |
| 54 | + @PreAuthorize("@ss.hasPermission('iot:alert-config:update')") | |
| 55 | + public CommonResult<Boolean> updateAlertConfig(@Valid @RequestBody IotAlertConfigSaveReqVO updateReqVO) { | |
| 56 | + alertConfigService.updateAlertConfig(updateReqVO); | |
| 57 | + return success(true); | |
| 58 | + } | |
| 59 | + | |
| 60 | + @DeleteMapping("/delete") | |
| 61 | + @Operation(summary = "删除告警配置") | |
| 62 | + @Parameter(name = "id", description = "编号", required = true) | |
| 63 | + @PreAuthorize("@ss.hasPermission('iot:alert-config:delete')") | |
| 64 | + public CommonResult<Boolean> deleteAlertConfig(@RequestParam("id") Long id) { | |
| 65 | + alertConfigService.deleteAlertConfig(id); | |
| 66 | + return success(true); | |
| 67 | + } | |
| 68 | + | |
| 69 | + @GetMapping("/get") | |
| 70 | + @Operation(summary = "获得告警配置") | |
| 71 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 72 | + @PreAuthorize("@ss.hasPermission('iot:alert-config:query')") | |
| 73 | + public CommonResult<IotAlertConfigRespVO> getAlertConfig(@RequestParam("id") Long id) { | |
| 74 | + IotAlertConfigDO alertConfig = alertConfigService.getAlertConfig(id); | |
| 75 | + return success(BeanUtils.toBean(alertConfig, IotAlertConfigRespVO.class)); | |
| 76 | + } | |
| 77 | + | |
| 78 | + @GetMapping("/page") | |
| 79 | + @Operation(summary = "获得告警配置分页") | |
| 80 | + @PreAuthorize("@ss.hasPermission('iot:alert-config:query')") | |
| 81 | + public CommonResult<PageResult<IotAlertConfigRespVO>> getAlertConfigPage(@Valid IotAlertConfigPageReqVO pageReqVO) { | |
| 82 | + PageResult<IotAlertConfigDO> pageResult = alertConfigService.getAlertConfigPage(pageReqVO); | |
| 83 | + | |
| 84 | + // 转换返回 | |
| 85 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( | |
| 86 | + convertSetByFlatMap(pageResult.getList(), config -> config.getReceiveUserIds().stream())); | |
| 87 | + return success(BeanUtils.toBean(pageResult, IotAlertConfigRespVO.class, vo -> { | |
| 88 | + vo.setReceiveUserNames(vo.getReceiveUserIds().stream() | |
| 89 | + .map(userMap::get) | |
| 90 | + .filter(Objects::nonNull) | |
| 91 | + .map(AdminUserRespDTO::getNickname) | |
| 92 | + .collect(Collectors.toList())); | |
| 93 | + })); | |
| 94 | + } | |
| 95 | + | |
| 96 | + @GetMapping("/simple-list") | |
| 97 | + @Operation(summary = "获得告警配置简单列表", description = "只包含被开启的告警配置,主要用于前端的下拉选项") | |
| 98 | + @PreAuthorize("@ss.hasPermission('iot:alert-config:query')") | |
| 99 | + public CommonResult<List<IotAlertConfigRespVO>> getAlertConfigSimpleList() { | |
| 100 | + List<IotAlertConfigDO> list = alertConfigService.getAlertConfigListByStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 101 | + return success(convertList(list, config -> // 只返回 id、name 字段 | |
| 102 | + new IotAlertConfigRespVO().setId(config.getId()).setName(config.getName()))); | |
| 103 | + } | |
| 104 | + | |
| 105 | +} | |
| 0 | 106 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/alert/IotAlertRecordController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.alert; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.alert.vo.recrod.IotAlertRecordPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.alert.vo.recrod.IotAlertRecordProcessReqVO; | |
| 8 | +import cn.iocoder.yudao.module.iot.controller.admin.alert.vo.recrod.IotAlertRecordRespVO; | |
| 9 | +import cn.iocoder.yudao.module.iot.dal.dataobject.alert.IotAlertRecordDO; | |
| 10 | +import cn.iocoder.yudao.module.iot.service.alert.IotAlertRecordService; | |
| 11 | +import io.swagger.v3.oas.annotations.Operation; | |
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 14 | +import jakarta.annotation.Resource; | |
| 15 | +import jakarta.validation.Valid; | |
| 16 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 17 | +import org.springframework.validation.annotation.Validated; | |
| 18 | +import org.springframework.web.bind.annotation.*; | |
| 19 | + | |
| 20 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 21 | +import static java.util.Collections.singleton; | |
| 22 | + | |
| 23 | +@Tag(name = "管理后台 - IoT 告警记录") | |
| 24 | +@RestController | |
| 25 | +@RequestMapping("/iot/alert-record") | |
| 26 | +@Validated | |
| 27 | +public class IotAlertRecordController { | |
| 28 | + | |
| 29 | + @Resource | |
| 30 | + private IotAlertRecordService alertRecordService; | |
| 31 | + | |
| 32 | + @GetMapping("/get") | |
| 33 | + @Operation(summary = "获得告警记录") | |
| 34 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 35 | + @PreAuthorize("@ss.hasPermission('iot:alert-record:query')") | |
| 36 | + public CommonResult<IotAlertRecordRespVO> getAlertRecord(@RequestParam("id") Long id) { | |
| 37 | + IotAlertRecordDO alertRecord = alertRecordService.getAlertRecord(id); | |
| 38 | + return success(BeanUtils.toBean(alertRecord, IotAlertRecordRespVO.class)); | |
| 39 | + } | |
| 40 | + | |
| 41 | + @GetMapping("/page") | |
| 42 | + @Operation(summary = "获得告警记录分页") | |
| 43 | + @PreAuthorize("@ss.hasPermission('iot:alert-record:query')") | |
| 44 | + public CommonResult<PageResult<IotAlertRecordRespVO>> getAlertRecordPage(@Valid IotAlertRecordPageReqVO pageReqVO) { | |
| 45 | + PageResult<IotAlertRecordDO> pageResult = alertRecordService.getAlertRecordPage(pageReqVO); | |
| 46 | + return success(BeanUtils.toBean(pageResult, IotAlertRecordRespVO.class)); | |
| 47 | + } | |
| 48 | + | |
| 49 | + @PutMapping("/process") | |
| 50 | + @Operation(summary = "处理告警记录") | |
| 51 | + @PreAuthorize("@ss.hasPermission('iot:alert-record:process')") | |
| 52 | + public CommonResult<Boolean> processAlertRecord(@Valid @RequestBody IotAlertRecordProcessReqVO processReqVO) { | |
| 53 | + alertRecordService.processAlertRecordList(singleton(processReqVO.getId()), processReqVO.getProcessRemark()); | |
| 54 | + return success(true); | |
| 55 | + } | |
| 56 | + | |
| 57 | +} | |
| 0 | 58 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/alert/vo/config/IotAlertConfigPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.alert.vo.config; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | + | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - IoT 告警配置分页 Request VO") | |
| 13 | +@Data | |
| 14 | +public class IotAlertConfigPageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "配置名称", example = "赵六") | |
| 17 | + private String name; | |
| 18 | + | |
| 19 | + @Schema(description = "配置状态", example = "1") | |
| 20 | + private Integer status; | |
| 21 | + | |
| 22 | + @Schema(description = "创建时间") | |
| 23 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 24 | + private LocalDateTime[] createTime; | |
| 25 | + | |
| 26 | +} | |
| 0 | 27 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/alert/vo/config/IotAlertConfigRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.alert.vo.config; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - IoT 告警配置 Response VO") | |
| 10 | +@Data | |
| 11 | +public class IotAlertConfigRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "配置编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "3566") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "配置名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 17 | + private String name; | |
| 18 | + | |
| 19 | + @Schema(description = "配置描述", example = "你猜") | |
| 20 | + private String description; | |
| 21 | + | |
| 22 | + @Schema(description = "告警级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 23 | + private Integer level; | |
| 24 | + | |
| 25 | + @Schema(description = "配置状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 26 | + private Integer status; | |
| 27 | + | |
| 28 | + @Schema(description = "关联的场景联动规则编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,2,3") | |
| 29 | + private List<Long> sceneRuleIds; | |
| 30 | + | |
| 31 | + @Schema(description = "接收的用户编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "100,200") | |
| 32 | + private List<Long> receiveUserIds; | |
| 33 | + | |
| 34 | + @Schema(description = "接收的用户名称数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三,李四") | |
| 35 | + private List<String> receiveUserNames; | |
| 36 | + | |
| 37 | + @Schema(description = "接收的类型数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,2,3") | |
| 38 | + private List<Integer> receiveTypes; | |
| 39 | + | |
| 40 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 41 | + private LocalDateTime createTime; | |
| 42 | + | |
| 43 | +} | |
| 0 | 44 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/alert/vo/config/IotAlertConfigSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.alert.vo.config; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 6 | +import jakarta.validation.constraints.NotEmpty; | |
| 7 | +import jakarta.validation.constraints.NotNull; | |
| 8 | +import lombok.Data; | |
| 9 | + | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - IoT 告警配置新增/修改 Request VO") | |
| 13 | +@Data | |
| 14 | +public class IotAlertConfigSaveReqVO { | |
| 15 | + | |
| 16 | + @Schema(description = "配置编号", example = "3566") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "配置名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 20 | + @NotEmpty(message = "配置名称不能为空") | |
| 21 | + private String name; | |
| 22 | + | |
| 23 | + @Schema(description = "配置描述", example = "你猜") | |
| 24 | + private String description; | |
| 25 | + | |
| 26 | + @Schema(description = "告警级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 27 | + @NotNull(message = "告警级别不能为空") | |
| 28 | + private Integer level; | |
| 29 | + | |
| 30 | + @Schema(description = "配置状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 31 | + @NotNull(message = "配置状态不能为空") | |
| 32 | + @InEnum(CommonStatusEnum.class) | |
| 33 | + private Integer status; | |
| 34 | + | |
| 35 | + @Schema(description = "关联的场景联动规则编号数组") | |
| 36 | + @NotEmpty(message = "关联的场景联动规则编号数组不能为空") | |
| 37 | + private List<Long> sceneRuleIds; | |
| 38 | + | |
| 39 | + @Schema(description = "接收的用户编号数组") | |
| 40 | + @NotEmpty(message = "接收的用户编号数组不能为空") | |
| 41 | + private List<Long> receiveUserIds; | |
| 42 | + | |
| 43 | + @Schema(description = "接收的类型数组") | |
| 44 | + @NotEmpty(message = "接收的类型数组不能为空") | |
| 45 | + private List<Integer> receiveTypes; | |
| 46 | + | |
| 47 | +} | |
| 0 | 48 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/alert/vo/recrod/IotAlertRecordPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.alert.vo.recrod; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | + | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - IoT 告警记录分页 Request VO") | |
| 13 | +@Data | |
| 14 | +public class IotAlertRecordPageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "告警配置编号", example = "29320") | |
| 17 | + private Long configId; | |
| 18 | + | |
| 19 | + @Schema(description = "告警级别", example = "1") | |
| 20 | + private Integer level; | |
| 21 | + | |
| 22 | + @Schema(description = "产品编号", example = "2050") | |
| 23 | + private Long productId; | |
| 24 | + | |
| 25 | + @Schema(description = "设备编号", example = "21727") | |
| 26 | + private String deviceId; | |
| 27 | + | |
| 28 | + @Schema(description = "是否处理", example = "true") | |
| 29 | + private Boolean processStatus; | |
| 30 | + | |
| 31 | + @Schema(description = "创建时间") | |
| 32 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 33 | + private LocalDateTime[] createTime; | |
| 34 | + | |
| 35 | +} | |
| 0 | 36 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/alert/vo/recrod/IotAlertRecordProcessReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.alert.vo.recrod; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import jakarta.validation.constraints.NotNull; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +@Schema(description = "管理后台 - IoT 告警记录处理 Request VO") | |
| 8 | +@Data | |
| 9 | +public class IotAlertRecordProcessReqVO { | |
| 10 | + | |
| 11 | + @Schema(description = "记录编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 12 | + @NotNull(message = "记录编号不能为空") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "处理结果(备注)", requiredMode = Schema.RequiredMode.REQUIRED, example = "已处理告警,问题已解决") | |
| 16 | + private String processRemark; | |
| 17 | + | |
| 18 | +} | |
| 0 | 19 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/alert/vo/recrod/IotAlertRecordRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.alert.vo.recrod; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - IoT 告警记录 Response VO") | |
| 10 | +@Data | |
| 11 | +public class IotAlertRecordRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "记录编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19904") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "告警配置编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "29320") | |
| 17 | + private Long configId; | |
| 18 | + | |
| 19 | + @Schema(description = "告警名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三") | |
| 20 | + private String configName; | |
| 21 | + | |
| 22 | + @Schema(description = "告警级别", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 23 | + private Integer configLevel; | |
| 24 | + | |
| 25 | + @Schema(description = "产品编号", example = "2050") | |
| 26 | + private Long productId; | |
| 27 | + | |
| 28 | + @Schema(description = "设备编号", example = "21727") | |
| 29 | + private Long deviceId; | |
| 30 | + | |
| 31 | + @Schema(description = "触发的设备消息") | |
| 32 | + private IotDeviceMessage deviceMessage; | |
| 33 | + | |
| 34 | + @Schema(description = "是否处理", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 35 | + private Boolean processStatus; | |
| 36 | + | |
| 37 | + @Schema(description = "处理结果(备注)", example = "你说的对") | |
| 38 | + private String processRemark; | |
| 39 | + | |
| 40 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 41 | + private LocalDateTime createTime; | |
| 42 | + | |
| 43 | +} | |
| 0 | 44 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDeviceController.java
| ... | ... | @@ -9,9 +9,9 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 9 | 9 | import cn.iocoder.yudao.module.iot.controller.admin.device.vo.device.*; |
| 10 | 10 | import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; |
| 11 | 11 | import cn.iocoder.yudao.module.iot.service.device.IotDeviceService; |
| 12 | -import cn.iocoder.yudao.module.iot.service.device.message.IotDeviceMessageService; | |
| 13 | 12 | import io.swagger.v3.oas.annotations.Operation; |
| 14 | 13 | import io.swagger.v3.oas.annotations.Parameter; |
| 14 | +import io.swagger.v3.oas.annotations.Parameters; | |
| 15 | 15 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 16 | 16 | import jakarta.annotation.Resource; |
| 17 | 17 | import jakarta.servlet.http.HttpServletResponse; |
| ... | ... | @@ -38,8 +38,6 @@ public class IotDeviceController { |
| 38 | 38 | |
| 39 | 39 | @Resource |
| 40 | 40 | private IotDeviceService deviceService; |
| 41 | - @Resource | |
| 42 | - private IotDeviceMessageService deviceMessageService; | |
| 43 | 41 | |
| 44 | 42 | @PostMapping("/create") |
| 45 | 43 | @Operation(summary = "创建设备") |
| ... | ... | @@ -124,12 +122,17 @@ public class IotDeviceController { |
| 124 | 122 | |
| 125 | 123 | @GetMapping("/simple-list") |
| 126 | 124 | @Operation(summary = "获取设备的精简信息列表", description = "主要用于前端的下拉选项") |
| 127 | - @Parameter(name = "deviceType", description = "设备类型", example = "1") | |
| 128 | - public CommonResult<List<IotDeviceRespVO>> getSimpleDeviceList( | |
| 129 | - @RequestParam(value = "deviceType", required = false) Integer deviceType) { | |
| 130 | - List<IotDeviceDO> list = deviceService.getDeviceListByDeviceType(deviceType); | |
| 131 | - return success(convertList(list, device -> // 只返回 id、name 字段 | |
| 132 | - new IotDeviceRespVO().setId(device.getId()).setDeviceName(device.getDeviceName()))); | |
| 125 | + @Parameters({ | |
| 126 | + @Parameter(name = "deviceType", description = "设备类型", example = "1"), | |
| 127 | + @Parameter(name = "productId", description = "产品编号", example = "1024") | |
| 128 | + }) | |
| 129 | + public CommonResult<List<IotDeviceRespVO>> getDeviceSimpleList( | |
| 130 | + @RequestParam(value = "deviceType", required = false) Integer deviceType, | |
| 131 | + @RequestParam(value = "productId", required = false) Long productId) { | |
| 132 | + List<IotDeviceDO> list = deviceService.getDeviceListByCondition(deviceType, productId); | |
| 133 | + return success(convertList(list, device -> // 只返回 id、name、productId 字段 | |
| 134 | + new IotDeviceRespVO().setId(device.getId()).setDeviceName(device.getDeviceName()) | |
| 135 | + .setProductId(device.getProductId()))); | |
| 133 | 136 | } |
| 134 | 137 | |
| 135 | 138 | @PostMapping("/import") | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/IotDevicePropertyController.java
| ... | ... | @@ -6,7 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | 6 | import cn.iocoder.yudao.module.iot.controller.admin.device.vo.property.IotDevicePropertyDetailRespVO; |
| 7 | 7 | import cn.iocoder.yudao.module.iot.controller.admin.device.vo.property.IotDevicePropertyHistoryListReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.iot.controller.admin.device.vo.property.IotDevicePropertyRespVO; |
| 9 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelProperty; | |
| 9 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelProperty; | |
| 10 | 10 | import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; |
| 11 | 11 | import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDevicePropertyDO; |
| 12 | 12 | import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO; | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/property/IotDevicePropertyDetailRespVO.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.device.vo.property; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType.ThingModelDataSpecs; | |
| 3 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.dataType.ThingModelDataSpecs; | |
| 4 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/IotOtaFirmwareController.java
| ... | ... | @@ -3,12 +3,14 @@ package cn.iocoder.yudao.module.iot.controller.admin.ota; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwareCreateReqVO; | |
| 6 | 7 | import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwarePageReqVO; |
| 7 | 8 | import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwareRespVO; |
| 8 | -import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwareCreateReqVO; | |
| 9 | 9 | import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwareUpdateReqVO; |
| 10 | 10 | import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaFirmwareDO; |
| 11 | +import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; | |
| 11 | 12 | import cn.iocoder.yudao.module.iot.service.ota.IotOtaFirmwareService; |
| 13 | +import cn.iocoder.yudao.module.iot.service.product.IotProductService; | |
| 12 | 14 | import io.swagger.v3.oas.annotations.Operation; |
| 13 | 15 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 14 | 16 | import jakarta.annotation.Resource; |
| ... | ... | @@ -21,12 +23,14 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 21 | 23 | |
| 22 | 24 | @Tag(name = "管理后台 - IoT OTA 固件") |
| 23 | 25 | @RestController |
| 24 | -@RequestMapping("/iot/ota-firmware") | |
| 26 | +@RequestMapping("/iot/ota/firmware") | |
| 25 | 27 | @Validated |
| 26 | 28 | public class IotOtaFirmwareController { |
| 27 | 29 | |
| 28 | 30 | @Resource |
| 29 | 31 | private IotOtaFirmwareService otaFirmwareService; |
| 32 | + @Resource | |
| 33 | + private IotProductService productService; | |
| 30 | 34 | |
| 31 | 35 | @PostMapping("/create") |
| 32 | 36 | @Operation(summary = "创建 OTA 固件") |
| ... | ... | @@ -47,8 +51,16 @@ public class IotOtaFirmwareController { |
| 47 | 51 | @Operation(summary = "获得 OTA 固件") |
| 48 | 52 | @PreAuthorize("@ss.hasPermission('iot:ota-firmware:query')") |
| 49 | 53 | public CommonResult<IotOtaFirmwareRespVO> getOtaFirmware(@RequestParam("id") Long id) { |
| 50 | - IotOtaFirmwareDO otaFirmware = otaFirmwareService.getOtaFirmware(id); | |
| 51 | - return success(BeanUtils.toBean(otaFirmware, IotOtaFirmwareRespVO.class)); | |
| 54 | + IotOtaFirmwareDO firmware = otaFirmwareService.getOtaFirmware(id); | |
| 55 | + if (firmware == null) { | |
| 56 | + return success(null); | |
| 57 | + } | |
| 58 | + return success(BeanUtils.toBean(firmware, IotOtaFirmwareRespVO.class, o -> { | |
| 59 | + IotProductDO product = productService.getProduct(firmware.getProductId()); | |
| 60 | + if (product != null) { | |
| 61 | + o.setProductName(product.getName()); | |
| 62 | + } | |
| 63 | + })); | |
| 52 | 64 | } |
| 53 | 65 | |
| 54 | 66 | @GetMapping("/page") | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/IotOtaTaskController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.ota; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task.IotOtaTaskPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task.IotOtaTaskRespVO; | |
| 8 | +import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task.IotOtaTaskCreateReqVO; | |
| 9 | +import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaTaskDO; | |
| 10 | +import cn.iocoder.yudao.module.iot.service.ota.IotOtaTaskService; | |
| 11 | +import io.swagger.v3.oas.annotations.Operation; | |
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 14 | +import jakarta.annotation.Resource; | |
| 15 | +import jakarta.validation.Valid; | |
| 16 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 17 | +import org.springframework.validation.annotation.Validated; | |
| 18 | +import org.springframework.web.bind.annotation.*; | |
| 19 | + | |
| 20 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 21 | + | |
| 22 | +@Tag(name = "管理后台 - IoT OTA 升级任务") | |
| 23 | +@RestController | |
| 24 | +@RequestMapping("/iot/ota/task") | |
| 25 | +@Validated | |
| 26 | +public class IotOtaTaskController { | |
| 27 | + | |
| 28 | + @Resource | |
| 29 | + private IotOtaTaskService otaTaskService; | |
| 30 | + | |
| 31 | + @PostMapping("/create") | |
| 32 | + @Operation(summary = "创建 OTA 升级任务") | |
| 33 | + @PreAuthorize(value = "@ss.hasPermission('iot:ota-task:create')") | |
| 34 | + public CommonResult<Long> createOtaTask(@Valid @RequestBody IotOtaTaskCreateReqVO createReqVO) { | |
| 35 | + return success(otaTaskService.createOtaTask(createReqVO)); | |
| 36 | + } | |
| 37 | + | |
| 38 | + @PostMapping("/cancel") | |
| 39 | + @Operation(summary = "取消 OTA 升级任务") | |
| 40 | + @Parameter(name = "id", description = "升级任务编号", required = true) | |
| 41 | + @PreAuthorize(value = "@ss.hasPermission('iot:ota-task:cancel')") | |
| 42 | + public CommonResult<Boolean> cancelOtaTask(@RequestParam("id") Long id) { | |
| 43 | + otaTaskService.cancelOtaTask(id); | |
| 44 | + return success(true); | |
| 45 | + } | |
| 46 | + | |
| 47 | + @GetMapping("/page") | |
| 48 | + @Operation(summary = "获得 OTA 升级任务分页") | |
| 49 | + @PreAuthorize(value = "@ss.hasPermission('iot:ota-task:query')") | |
| 50 | + public CommonResult<PageResult<IotOtaTaskRespVO>> getOtaTaskPage(@Valid IotOtaTaskPageReqVO pageReqVO) { | |
| 51 | + PageResult<IotOtaTaskDO> pageResult = otaTaskService.getOtaTaskPage(pageReqVO); | |
| 52 | + return success(BeanUtils.toBean(pageResult, IotOtaTaskRespVO.class)); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @GetMapping("/get") | |
| 56 | + @Operation(summary = "获得 OTA 升级任务") | |
| 57 | + @Parameter(name = "id", description = "升级任务编号", required = true, example = "1024") | |
| 58 | + @PreAuthorize(value = "@ss.hasPermission('iot:ota-task:query')") | |
| 59 | + public CommonResult<IotOtaTaskRespVO> getOtaTask(@RequestParam("id") Long id) { | |
| 60 | + IotOtaTaskDO upgradeTask = otaTaskService.getOtaTask(id); | |
| 61 | + return success(BeanUtils.toBean(upgradeTask, IotOtaTaskRespVO.class)); | |
| 62 | + } | |
| 63 | + | |
| 64 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/IotOtaTaskRecordController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.ota; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task.record.IotOtaTaskRecordPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task.record.IotOtaTaskRecordRespVO; | |
| 9 | +import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; | |
| 10 | +import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaFirmwareDO; | |
| 11 | +import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaTaskRecordDO; | |
| 12 | +import cn.iocoder.yudao.module.iot.service.device.IotDeviceService; | |
| 13 | +import cn.iocoder.yudao.module.iot.service.ota.IotOtaFirmwareService; | |
| 14 | +import cn.iocoder.yudao.module.iot.service.ota.IotOtaTaskRecordService; | |
| 15 | +import io.swagger.v3.oas.annotations.Operation; | |
| 16 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 17 | +import io.swagger.v3.oas.annotations.Parameters; | |
| 18 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 19 | +import jakarta.annotation.Resource; | |
| 20 | +import jakarta.validation.Valid; | |
| 21 | +import org.dromara.hutool.core.collection.CollUtil; | |
| 22 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 23 | +import org.springframework.validation.annotation.Validated; | |
| 24 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 25 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 26 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 27 | +import org.springframework.web.bind.annotation.RestController; | |
| 28 | + | |
| 29 | +import java.util.Map; | |
| 30 | + | |
| 31 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 32 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 33 | + | |
| 34 | +@Tag(name = "管理后台 - IoT OTA 升级任务记录") | |
| 35 | +@RestController | |
| 36 | +@RequestMapping("/iot/ota/task/record") | |
| 37 | +@Validated | |
| 38 | +public class IotOtaTaskRecordController { | |
| 39 | + | |
| 40 | + @Resource | |
| 41 | + private IotOtaTaskRecordService otaTaskRecordService; | |
| 42 | + @Resource | |
| 43 | + private IotDeviceService deviceService; | |
| 44 | + @Resource | |
| 45 | + private IotOtaFirmwareService otaFirmwareService; | |
| 46 | + | |
| 47 | + @GetMapping("/get-status-statistics") | |
| 48 | + @Operation(summary = "获得 OTA 升级记录状态统计") | |
| 49 | + @Parameters({ | |
| 50 | + @Parameter(name = "firmwareId", description = "固件编号", example = "1024"), | |
| 51 | + @Parameter(name = "taskId", description = "升级任务编号", example = "2048") | |
| 52 | + }) | |
| 53 | + @PreAuthorize("@ss.hasPermission('iot:ota-task-record:query')") | |
| 54 | + public CommonResult<Map<Integer, Long>> getOtaTaskRecordStatusStatistics( | |
| 55 | + @RequestParam(value = "firmwareId", required = false) Long firmwareId, | |
| 56 | + @RequestParam(value = "taskId", required = false) Long taskId) { | |
| 57 | + return success(otaTaskRecordService.getOtaTaskRecordStatusStatistics(firmwareId, taskId)); | |
| 58 | + } | |
| 59 | + | |
| 60 | + @GetMapping("/page") | |
| 61 | + @Operation(summary = "获得 OTA 升级记录分页") | |
| 62 | + @PreAuthorize("@ss.hasPermission('iot:ota-task-record:query')") | |
| 63 | + public CommonResult<PageResult<IotOtaTaskRecordRespVO>> getOtaTaskRecordPage( | |
| 64 | + @Valid IotOtaTaskRecordPageReqVO pageReqVO) { | |
| 65 | + PageResult<IotOtaTaskRecordDO> pageResult = otaTaskRecordService.getOtaTaskRecordPage(pageReqVO); | |
| 66 | + if (CollUtil.isEmpty(pageResult.getList())) { | |
| 67 | + return success(PageResult.empty()); | |
| 68 | + } | |
| 69 | + | |
| 70 | + // 批量查询固件信息 | |
| 71 | + Map<Long, IotOtaFirmwareDO> firmwareMap = otaFirmwareService.getOtaFirmwareMap( | |
| 72 | + convertSet(pageResult.getList(), IotOtaTaskRecordDO::getFromFirmwareId)); | |
| 73 | + Map<Long, IotDeviceDO> deviceMap = deviceService.getDeviceMap( | |
| 74 | + convertSet(pageResult.getList(), IotOtaTaskRecordDO::getDeviceId)); | |
| 75 | + // 转换为响应 VO | |
| 76 | + return success(BeanUtils.toBean(pageResult, IotOtaTaskRecordRespVO.class, (vo) -> { | |
| 77 | + MapUtils.findAndThen(firmwareMap, vo.getFromFirmwareId(), firmware -> | |
| 78 | + vo.setFromFirmwareVersion(firmware.getVersion())); | |
| 79 | + MapUtils.findAndThen(deviceMap, vo.getDeviceId(), device -> | |
| 80 | + vo.setDeviceName(device.getDeviceName())); | |
| 81 | + })); | |
| 82 | + } | |
| 83 | + | |
| 84 | + @GetMapping("/get") | |
| 85 | + @Operation(summary = "获得 OTA 升级记录") | |
| 86 | + @PreAuthorize("@ss.hasPermission('iot:ota-task-record:query')") | |
| 87 | + @Parameter(name = "id", description = "升级记录编号", required = true, example = "1024") | |
| 88 | + public CommonResult<IotOtaTaskRecordRespVO> getOtaTaskRecord(@RequestParam("id") Long id) { | |
| 89 | + IotOtaTaskRecordDO upgradeRecord = otaTaskRecordService.getOtaTaskRecord(id); | |
| 90 | + return success(BeanUtils.toBean(upgradeRecord, IotOtaTaskRecordRespVO.class)); | |
| 91 | + } | |
| 92 | + | |
| 93 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/IotOtaUpgradeRecordController.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.ota; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.record.IotOtaUpgradeRecordPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.record.IotOtaUpgradeRecordRespVO; | |
| 8 | -import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaUpgradeRecordDO; | |
| 9 | -import cn.iocoder.yudao.module.iot.service.ota.IotOtaUpgradeRecordService; | |
| 10 | -import io.swagger.v3.oas.annotations.Operation; | |
| 11 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 12 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 13 | -import jakarta.annotation.Resource; | |
| 14 | -import jakarta.validation.Valid; | |
| 15 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 16 | -import org.springframework.validation.annotation.Validated; | |
| 17 | -import org.springframework.web.bind.annotation.*; | |
| 18 | - | |
| 19 | -import java.util.Map; | |
| 20 | - | |
| 21 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 22 | - | |
| 23 | -@Tag(name = "管理后台 - IoT OTA 升级记录") | |
| 24 | -@RestController | |
| 25 | -@RequestMapping("/iot/ota-upgrade-record") | |
| 26 | -@Validated | |
| 27 | -public class IotOtaUpgradeRecordController { | |
| 28 | - | |
| 29 | - @Resource | |
| 30 | - private IotOtaUpgradeRecordService upgradeRecordService; | |
| 31 | - | |
| 32 | - @GetMapping("/get-statistics") | |
| 33 | - @Operation(summary = "固件升级设备统计") | |
| 34 | - @PreAuthorize("@ss.hasPermission('iot:ota-upgrade-record:query')") | |
| 35 | - @Parameter(name = "firmwareId", description = "固件编号", required = true, example = "1024") | |
| 36 | - public CommonResult<Map<Integer, Long>> getOtaUpgradeRecordStatistics(@RequestParam(value = "firmwareId") Long firmwareId) { | |
| 37 | - return success(upgradeRecordService.getOtaUpgradeRecordStatistics(firmwareId)); | |
| 38 | - } | |
| 39 | - | |
| 40 | - @GetMapping("/get-count") | |
| 41 | - @Operation(summary = "获得升级记录分页 tab 数量") | |
| 42 | - @PreAuthorize("@ss.hasPermission('iot:ota-upgrade-record:query')") | |
| 43 | - public CommonResult<Map<Integer, Long>> getOtaUpgradeRecordCount( | |
| 44 | - @Valid IotOtaUpgradeRecordPageReqVO pageReqVO) { | |
| 45 | - return success(upgradeRecordService.getOtaUpgradeRecordCount(pageReqVO)); | |
| 46 | - } | |
| 47 | - | |
| 48 | - @GetMapping("/page") | |
| 49 | - @Operation(summary = "获得升级记录分页") | |
| 50 | - @PreAuthorize("@ss.hasPermission('iot:ota-upgrade-record:query')") | |
| 51 | - public CommonResult<PageResult<IotOtaUpgradeRecordRespVO>> getUpgradeRecordPage( | |
| 52 | - @Valid IotOtaUpgradeRecordPageReqVO pageReqVO) { | |
| 53 | - PageResult<IotOtaUpgradeRecordDO> pageResult = upgradeRecordService.getUpgradeRecordPage(pageReqVO); | |
| 54 | - return success(BeanUtils.toBean(pageResult, IotOtaUpgradeRecordRespVO.class)); | |
| 55 | - } | |
| 56 | - | |
| 57 | - @GetMapping("/get") | |
| 58 | - @Operation(summary = "获得升级记录") | |
| 59 | - @PreAuthorize("@ss.hasPermission('iot:ota-upgrade-record:query')") | |
| 60 | - @Parameter(name = "id", description = "升级记录编号", required = true, example = "1024") | |
| 61 | - public CommonResult<IotOtaUpgradeRecordRespVO> getUpgradeRecord(@RequestParam("id") Long id) { | |
| 62 | - IotOtaUpgradeRecordDO upgradeRecord = upgradeRecordService.getUpgradeRecord(id); | |
| 63 | - return success(BeanUtils.toBean(upgradeRecord, IotOtaUpgradeRecordRespVO.class)); | |
| 64 | - } | |
| 65 | - | |
| 66 | - @PutMapping("/retry") | |
| 67 | - @Operation(summary = "重试升级记录") | |
| 68 | - @PreAuthorize("@ss.hasPermission('iot:ota-upgrade-record:retry')") | |
| 69 | - @Parameter(name = "id", description = "升级记录编号", required = true, example = "1024") | |
| 70 | - public CommonResult<Boolean> retryUpgradeRecord(@RequestParam("id") Long id) { | |
| 71 | - upgradeRecordService.retryUpgradeRecord(id); | |
| 72 | - return success(true); | |
| 73 | - } | |
| 74 | - | |
| 75 | -} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/IotOtaUpgradeTaskController.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.ota; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.task.IotOtaUpgradeTaskPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.task.IotOtaUpgradeTaskRespVO; | |
| 8 | -import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.task.IotOtaUpgradeTaskSaveReqVO; | |
| 9 | -import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaUpgradeTaskDO; | |
| 10 | -import cn.iocoder.yudao.module.iot.service.ota.IotOtaUpgradeTaskService; | |
| 11 | -import io.swagger.v3.oas.annotations.Operation; | |
| 12 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 13 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 14 | -import jakarta.annotation.Resource; | |
| 15 | -import jakarta.validation.Valid; | |
| 16 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 17 | -import org.springframework.validation.annotation.Validated; | |
| 18 | -import org.springframework.web.bind.annotation.*; | |
| 19 | - | |
| 20 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 21 | - | |
| 22 | -@Tag(name = "管理后台 - IoT OTA 升级任务") | |
| 23 | -@RestController | |
| 24 | -@RequestMapping("/iot/ota-upgrade-task") | |
| 25 | -@Validated | |
| 26 | -public class IotOtaUpgradeTaskController { | |
| 27 | - | |
| 28 | - @Resource | |
| 29 | - private IotOtaUpgradeTaskService upgradeTaskService; | |
| 30 | - | |
| 31 | - @PostMapping("/create") | |
| 32 | - @Operation(summary = "创建升级任务") | |
| 33 | - @PreAuthorize(value = "@ss.hasPermission('iot:ota-upgrade-task:create')") | |
| 34 | - public CommonResult<Long> createUpgradeTask(@Valid @RequestBody IotOtaUpgradeTaskSaveReqVO createReqVO) { | |
| 35 | - return success(upgradeTaskService.createUpgradeTask(createReqVO)); | |
| 36 | - } | |
| 37 | - | |
| 38 | - @PostMapping("/cancel") | |
| 39 | - @Operation(summary = "取消升级任务") | |
| 40 | - @Parameter(name = "id", description = "升级任务编号", required = true) | |
| 41 | - @PreAuthorize(value = "@ss.hasPermission('iot:ota-upgrade-task:cancel')") | |
| 42 | - public CommonResult<Boolean> cancelUpgradeTask(@RequestParam("id") Long id) { | |
| 43 | - upgradeTaskService.cancelUpgradeTask(id); | |
| 44 | - return success(true); | |
| 45 | - } | |
| 46 | - | |
| 47 | - @GetMapping("/page") | |
| 48 | - @Operation(summary = "获得升级任务分页") | |
| 49 | - @PreAuthorize(value = "@ss.hasPermission('iot:ota-upgrade-task:query')") | |
| 50 | - public CommonResult<PageResult<IotOtaUpgradeTaskRespVO>> getUpgradeTaskPage(@Valid IotOtaUpgradeTaskPageReqVO pageReqVO) { | |
| 51 | - PageResult<IotOtaUpgradeTaskDO> pageResult = upgradeTaskService.getUpgradeTaskPage(pageReqVO); | |
| 52 | - return success(BeanUtils.toBean(pageResult, IotOtaUpgradeTaskRespVO.class)); | |
| 53 | - } | |
| 54 | - | |
| 55 | - @GetMapping("/get") | |
| 56 | - @Operation(summary = "获得升级任务") | |
| 57 | - @Parameter(name = "id", description = "升级任务编号", required = true, example = "1024") | |
| 58 | - @PreAuthorize(value = "@ss.hasPermission('iot:ota-upgrade-task:query')") | |
| 59 | - public CommonResult<IotOtaUpgradeTaskRespVO> getUpgradeTask(@RequestParam("id") Long id) { | |
| 60 | - IotOtaUpgradeTaskDO upgradeTask = upgradeTaskService.getUpgradeTask(id); | |
| 61 | - return success(BeanUtils.toBean(upgradeTask, IotOtaUpgradeTaskRespVO.class)); | |
| 62 | - } | |
| 63 | - | |
| 64 | -} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/firmware/IotOtaFirmwareCreateReqVO.java
| ... | ... | @@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import jakarta.validation.constraints.NotEmpty; |
| 5 | 5 | import jakarta.validation.constraints.NotNull; |
| 6 | 6 | import lombok.Data; |
| 7 | +import org.hibernate.validator.constraints.URL; | |
| 7 | 8 | |
| 8 | 9 | @Schema(description = "管理后台 - IoT OTA 固件创建 Request VO") |
| 9 | 10 | @Data |
| ... | ... | @@ -22,17 +23,11 @@ public class IotOtaFirmwareCreateReqVO { |
| 22 | 23 | |
| 23 | 24 | @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 24 | 25 | @NotNull(message = "产品编号不能为空") |
| 25 | - private String productId; | |
| 26 | + private Long productId; | |
| 26 | 27 | |
| 27 | - @Schema(description = "签名方式", example = "MD5") | |
| 28 | - // TODO @li:是不是必传哈 | |
| 29 | - private String signMethod; | |
| 30 | - | |
| 31 | - @Schema(description = "固件文件 URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/yudao-firmware.zip") | |
| 28 | + @Schema(description = "固件文件 URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.zip") | |
| 32 | 29 | @NotEmpty(message = "固件文件 URL 不能为空") |
| 30 | + @URL(message = "固件文件 URL 格式错误") | |
| 33 | 31 | private String fileUrl; |
| 34 | 32 | |
| 35 | - @Schema(description = "自定义信息,建议使用 JSON 格式", example = "{\"key1\":\"value1\",\"key2\":\"value2\"}") | |
| 36 | - private String information; | |
| 37 | - | |
| 38 | 33 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/firmware/IotOtaFirmwarePageReqVO.java
| ... | ... | @@ -3,21 +3,24 @@ package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | 5 | import lombok.Data; |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | + | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 6 | 11 | |
| 7 | -@Data | |
| 8 | 12 | @Schema(description = "管理后台 - IoT OTA 固件分页 Request VO") |
| 13 | +@Data | |
| 9 | 14 | public class IotOtaFirmwarePageReqVO extends PageParam { |
| 10 | 15 | |
| 11 | - /** | |
| 12 | - * 固件名称 | |
| 13 | - */ | |
| 14 | 16 | @Schema(description = "固件名称", example = "智能开关固件") |
| 15 | 17 | private String name; |
| 16 | 18 | |
| 17 | - /** | |
| 18 | - * 产品标识 | |
| 19 | - */ | |
| 20 | 19 | @Schema(description = "产品标识", example = "1024") |
| 21 | 20 | private String productId; |
| 22 | 21 | |
| 22 | + @Schema(description = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]") | |
| 23 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 24 | + private LocalDateTime[] createTime; | |
| 25 | + | |
| 23 | 26 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/firmware/IotOtaFirmwareRespVO.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; | |
| 4 | -import com.fhs.core.trans.anno.Trans; | |
| 5 | -import com.fhs.core.trans.constant.TransType; | |
| 6 | 3 | import com.fhs.core.trans.vo.VO; |
| 7 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | 5 | import lombok.Data; |
| 9 | 6 | |
| 10 | -@Data | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 11 | 9 | @Schema(description = "管理后台 - IoT OTA 固件 Response VO") |
| 10 | +@Data | |
| 12 | 11 | public class IotOtaFirmwareRespVO implements VO { |
| 13 | 12 | |
| 14 | - /** | |
| 15 | - * 固件编号 | |
| 16 | - */ | |
| 17 | 13 | @Schema(description = "固件编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 18 | 14 | private Long id; |
| 19 | - /** | |
| 20 | - * 固件名称 | |
| 21 | - */ | |
| 22 | - @Schema(description = "固件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "OTA固件") | |
| 15 | + | |
| 16 | + @Schema(description = "固件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "OTA 固件") | |
| 23 | 17 | private String name; |
| 24 | - /** | |
| 25 | - * 固件描述 | |
| 26 | - */ | |
| 18 | + | |
| 27 | 19 | @Schema(description = "固件描述") |
| 28 | 20 | private String description; |
| 29 | - /** | |
| 30 | - * 版本号 | |
| 31 | - */ | |
| 21 | + | |
| 32 | 22 | @Schema(description = "版本号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1.0.0") |
| 33 | 23 | private String version; |
| 34 | 24 | |
| 35 | - /** | |
| 36 | - * 产品编号 | |
| 37 | - * <p> | |
| 38 | - * 关联 {@link cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO#getId()} | |
| 39 | - */ | |
| 40 | 25 | @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 41 | - @Trans(type = TransType.SIMPLE, target = IotProductDO.class, fields = {"name"}, refs = {"productName"}) | |
| 42 | - private String productId; | |
| 43 | - /** | |
| 44 | - * 产品标识 | |
| 45 | - * <p> | |
| 46 | - * 冗余 {@link cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO#getProductKey()} | |
| 47 | - */ | |
| 48 | - @Schema(description = "产品标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "iot-product-key") | |
| 49 | - private String productKey; | |
| 50 | - /** | |
| 51 | - * 产品名称 | |
| 52 | - */ | |
| 53 | - @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "OTA产品") | |
| 26 | + private Long productId; | |
| 27 | + | |
| 28 | + @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "智能设备") | |
| 54 | 29 | private String productName; |
| 55 | - /** | |
| 56 | - * 签名方式 | |
| 57 | - * <p> | |
| 58 | - * 例如说:MD5、SHA256 | |
| 59 | - */ | |
| 60 | - @Schema(description = "签名方式", example = "MD5") | |
| 61 | - private String signMethod; | |
| 62 | - /** | |
| 63 | - * 固件文件签名 | |
| 64 | - */ | |
| 65 | - @Schema(description = "固件文件签名", example = "1024") | |
| 66 | - private String fileSign; | |
| 67 | - /** | |
| 68 | - * 固件文件大小 | |
| 69 | - */ | |
| 30 | + | |
| 31 | + @Schema(description = "固件文件 URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/firmware.bin") | |
| 32 | + private String fileUrl; | |
| 33 | + | |
| 70 | 34 | @Schema(description = "固件文件大小", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 71 | 35 | private Long fileSize; |
| 72 | - /** | |
| 73 | - * 固件文件 URL | |
| 74 | - */ | |
| 75 | - @Schema(description = "固件文件 URL", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn") | |
| 76 | - private String fileUrl; | |
| 77 | - /** | |
| 78 | - * 自定义信息,建议使用 JSON 格式 | |
| 79 | - */ | |
| 80 | - @Schema(description = "自定义信息,建议使用 JSON 格式") | |
| 81 | - private String information; | |
| 36 | + | |
| 37 | + @Schema(description = "固件文件签名算法", example = "MD5") | |
| 38 | + private String fileDigestAlgorithm; | |
| 39 | + | |
| 40 | + @Schema(description = "固件文件签名结果", example = "d41d8cd98f00b204e9800998ecf8427e") | |
| 41 | + private String fileDigestValue; | |
| 42 | + | |
| 43 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 44 | + private LocalDateTime createTime; | |
| 45 | + | |
| 46 | + @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 47 | + private LocalDateTime updateTime; | |
| 82 | 48 | |
| 83 | 49 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/firmware/IotOtaFirmwareUpdateReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware; |
| 2 | 2 | |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | -import jakarta.validation.constraints.NotEmpty; | |
| 5 | 4 | import jakarta.validation.constraints.NotNull; |
| 6 | 5 | import lombok.Data; |
| 7 | 6 | |
| ... | ... | @@ -13,9 +12,7 @@ public class IotOtaFirmwareUpdateReqVO { |
| 13 | 12 | @NotNull(message = "固件编号不能为空") |
| 14 | 13 | private Long id; |
| 15 | 14 | |
| 16 | - // TODO @li:name 是不是可以飞必传哈 | |
| 17 | - @Schema(description = "固件名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "智能开关固件") | |
| 18 | - @NotEmpty(message = "固件名称不能为空") | |
| 15 | + @Schema(description = "固件名称", example = "智能开关固件") | |
| 19 | 16 | private String name; |
| 20 | 17 | |
| 21 | 18 | @Schema(description = "固件描述", example = "某品牌型号固件,测试用") | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/upgrade/task/IotOtaUpgradeTaskSaveReqVO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/task/IotOtaTaskCreateReqVO.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.task; | |
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | -import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; | |
| 5 | -import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaFirmwareDO; | |
| 6 | -import cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeTaskScopeEnum; | |
| 4 | +import cn.iocoder.yudao.module.iot.enums.ota.IotOtaTaskDeviceScopeEnum; | |
| 7 | 5 | import io.swagger.v3.oas.annotations.media.Schema; |
| 8 | 6 | import jakarta.validation.constraints.NotEmpty; |
| 9 | 7 | import jakarta.validation.constraints.NotNull; |
| ... | ... | @@ -11,51 +9,29 @@ import lombok.Data; |
| 11 | 9 | |
| 12 | 10 | import java.util.List; |
| 13 | 11 | |
| 12 | +@Schema(description = "管理后台 - IoT OTA 升级任务创建 Request VO") | |
| 14 | 13 | @Data |
| 15 | -@Schema(description = "管理后台 - IoT OTA 升级任务创建/修改 Request VO") | |
| 16 | -public class IotOtaUpgradeTaskSaveReqVO { | |
| 14 | +public class IotOtaTaskCreateReqVO { | |
| 17 | 15 | |
| 18 | - // TODO @li:已经有注解,不用重复注释 | |
| 19 | - // TODO @li: @Schema 写在参数校验前面。先有定义;其他的,也检查下; | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 任务名称 | |
| 23 | - */ | |
| 24 | 16 | @NotEmpty(message = "任务名称不能为空") |
| 25 | 17 | @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "升级任务") |
| 26 | 18 | private String name; |
| 27 | 19 | |
| 28 | - /** | |
| 29 | - * 任务描述 | |
| 30 | - */ | |
| 31 | 20 | @Schema(description = "任务描述", example = "升级任务") |
| 32 | 21 | private String description; |
| 33 | 22 | |
| 34 | - /** | |
| 35 | - * 固件编号 | |
| 36 | - * <p> | |
| 37 | - * 关联 {@link IotOtaFirmwareDO#getId()} | |
| 38 | - */ | |
| 39 | - @NotNull(message = "固件编号不能为空") | |
| 40 | 23 | @Schema(description = "固件编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 24 | + @NotNull(message = "固件编号不能为空") | |
| 41 | 25 | private Long firmwareId; |
| 42 | 26 | |
| 43 | - /** | |
| 44 | - * 升级范围 | |
| 45 | - * <p> | |
| 46 | - * 关联 {@link cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeTaskScopeEnum} | |
| 47 | - */ | |
| 48 | - @NotNull(message = "升级范围不能为空") | |
| 49 | - @InEnum(value = IotOtaUpgradeTaskScopeEnum.class) | |
| 50 | 27 | @Schema(description = "升级范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
| 51 | - private Integer scope; | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * 选中的设备编号数组 | |
| 55 | - * <p> | |
| 56 | - * 关联 {@link IotDeviceDO#getId()} | |
| 57 | - */ | |
| 58 | - @Schema(description = "选中的设备编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "[1,2,3,4]") | |
| 28 | + @NotNull(message = "升级范围不能为空") | |
| 29 | + @InEnum(value = IotOtaTaskDeviceScopeEnum.class) | |
| 30 | + private Integer deviceScope; | |
| 31 | + | |
| 32 | + @Schema(description = "选中的设备编号数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1,2,3") | |
| 59 | 33 | private List<Long> deviceIds; |
| 60 | 34 | |
| 35 | + // TODO @li:如果 deviceScope 等于 2 时,deviceIds 校验非空; | |
| 36 | + | |
| 61 | 37 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/upgrade/task/IotOtaUpgradeTaskPageReqVO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/task/IotOtaTaskPageReqVO.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.task; | |
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 5 | -import jakarta.validation.constraints.NotNull; | |
| 6 | 5 | import lombok.Data; |
| 7 | 6 | |
| 8 | -@Data | |
| 9 | 7 | @Schema(description = "管理后台 - IoT OTA 升级任务分页 Request VO") |
| 10 | -public class IotOtaUpgradeTaskPageReqVO extends PageParam { | |
| 8 | +@Data | |
| 9 | +public class IotOtaTaskPageReqVO extends PageParam { | |
| 11 | 10 | |
| 12 | - /** | |
| 13 | - * 任务名称字段,用于描述任务的名称 | |
| 14 | - */ | |
| 15 | 11 | @Schema(description = "任务名称", example = "升级任务") |
| 16 | 12 | private String name; |
| 17 | 13 | |
| 18 | - /** | |
| 19 | - * 固件编号字段,用于唯一标识固件,不能为空 | |
| 20 | - */ | |
| 21 | - @NotNull(message = "固件编号不能为空") | |
| 22 | - @Schema(description = "固件编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | + @Schema(description = "固件编号", example = "1024") | |
| 23 | 15 | private Long firmwareId; |
| 24 | 16 | |
| 25 | 17 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/task/IotOtaTaskRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task; | |
| 2 | + | |
| 3 | +import com.fhs.core.trans.vo.VO; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - IoT OTA 升级任务 Response VO") | |
| 10 | +@Data | |
| 11 | +public class IotOtaTaskRespVO implements VO { | |
| 12 | + | |
| 13 | + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "升级任务") | |
| 17 | + private String name; | |
| 18 | + | |
| 19 | + @Schema(description = "任务描述", example = "升级任务") | |
| 20 | + private String description; | |
| 21 | + | |
| 22 | + @Schema(description = "固件编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 23 | + private Long firmwareId; | |
| 24 | + | |
| 25 | + @Schema(description = "任务状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | |
| 26 | + private Integer status; | |
| 27 | + | |
| 28 | + @Schema(description = "升级范围", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 29 | + private Integer deviceScope; | |
| 30 | + | |
| 31 | + @Schema(description = "设备总共数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 32 | + private Integer deviceTotalCount; | |
| 33 | + | |
| 34 | + @Schema(description = "设备成功数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "66") | |
| 35 | + private Integer deviceSuccessCount; | |
| 36 | + | |
| 37 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022-07-08 07:30:00") | |
| 38 | + private LocalDateTime createTime; | |
| 39 | + | |
| 40 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/task/record/IotOtaTaskRecordPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task.record; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import cn.iocoder.yudao.module.iot.enums.ota.IotOtaTaskRecordStatusEnum; | |
| 6 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 7 | +import lombok.Data; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - IoT OTA 升级记录分页 Request VO") | |
| 10 | +@Data | |
| 11 | +public class IotOtaTaskRecordPageReqVO extends PageParam { | |
| 12 | + | |
| 13 | + @Schema(description = "升级任务编号", example = "1024") | |
| 14 | + private Long taskId; | |
| 15 | + | |
| 16 | + @Schema(description = "升级记录状态", example = "5") | |
| 17 | + @InEnum(IotOtaTaskRecordStatusEnum.class) | |
| 18 | + private Integer status; | |
| 19 | + | |
| 20 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/task/record/IotOtaTaskRecordRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task.record; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | + | |
| 8 | +@Schema(description = "管理后台 - IoT OTA 升级任务记录 Response VO") | |
| 9 | +@Data | |
| 10 | +public class IotOtaTaskRecordRespVO { | |
| 11 | + | |
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 13 | + private Long id; | |
| 14 | + | |
| 15 | + @Schema(description = "固件编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 16 | + private Long firmwareId; | |
| 17 | + | |
| 18 | + @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") | |
| 19 | + private Long taskId; | |
| 20 | + | |
| 21 | + @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 22 | + private Long deviceId; | |
| 23 | + | |
| 24 | + @Schema(description = "设备名称", example = "智能开关") | |
| 25 | + private String deviceName; | |
| 26 | + | |
| 27 | + @Schema(description = "来源的固件编号", example = "1023") | |
| 28 | + private Long fromFirmwareId; | |
| 29 | + | |
| 30 | + @Schema(description = "来源固件版本", example = "1.0.0") | |
| 31 | + private String fromFirmwareVersion; | |
| 32 | + | |
| 33 | + @Schema(description = "升级状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 34 | + private Integer status; | |
| 35 | + | |
| 36 | + @Schema(description = "升级进度,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "50") | |
| 37 | + private Integer progress; | |
| 38 | + | |
| 39 | + @Schema(description = "升级进度描述", example = "正在下载固件...") | |
| 40 | + private String description; | |
| 41 | + | |
| 42 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 43 | + private LocalDateTime createTime; | |
| 44 | + | |
| 45 | + @Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 46 | + private LocalDateTime updateTime; | |
| 47 | + | |
| 48 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/upgrade/record/IotOtaUpgradeRecordPageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.record; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | -import jakarta.validation.constraints.NotNull; | |
| 6 | -import lombok.Data; | |
| 7 | - | |
| 8 | -@Data | |
| 9 | -@Schema(description = "管理后台 - IoT OTA 升级记录分页 Request VO") | |
| 10 | -public class IotOtaUpgradeRecordPageReqVO extends PageParam { | |
| 11 | - | |
| 12 | - // TODO @li:已经有注解,不用重复注释 | |
| 13 | - /** | |
| 14 | - * 升级任务编号字段。 | |
| 15 | - * <p> | |
| 16 | - * 该字段用于标识升级任务的唯一编号,不能为空。 | |
| 17 | - */ | |
| 18 | - @Schema(description = "升级任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 19 | - @NotNull(message = "升级任务编号不能为空") | |
| 20 | - private Long taskId; | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 设备标识字段。 | |
| 24 | - * <p> | |
| 25 | - * 该字段用于标识设备的名称,通常用于区分不同的设备。 | |
| 26 | - */ | |
| 27 | - @Schema(description = "设备标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "摄像头A1-1") | |
| 28 | - private String deviceName; | |
| 29 | - | |
| 30 | -} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/upgrade/record/IotOtaUpgradeRecordRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.record; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; | |
| 4 | -import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceMessageDO; | |
| 5 | -import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaFirmwareDO; | |
| 6 | -import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaUpgradeTaskDO; | |
| 7 | -import com.fhs.core.trans.anno.Trans; | |
| 8 | -import com.fhs.core.trans.constant.TransType; | |
| 9 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 10 | -import lombok.Data; | |
| 11 | - | |
| 12 | -import java.time.LocalDateTime; | |
| 13 | - | |
| 14 | -@Data | |
| 15 | -@Schema(description = "管理后台 - IoT OTA 升级记录 Response VO") | |
| 16 | -public class IotOtaUpgradeRecordRespVO { | |
| 17 | - | |
| 18 | - /** | |
| 19 | - * 升级记录编号 | |
| 20 | - */ | |
| 21 | - @Schema(description = "升级记录编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 22 | - private Long id; | |
| 23 | - /** | |
| 24 | - * 固件编号 | |
| 25 | - * <p> | |
| 26 | - * 关联 {@link IotOtaFirmwareDO#getId()} | |
| 27 | - */ | |
| 28 | - @Schema(description = "固件编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 29 | - @Trans(type = TransType.SIMPLE, target = IotOtaFirmwareDO.class, fields = {"version"}, refs = {"firmwareVersion"}) | |
| 30 | - private Long firmwareId; | |
| 31 | - /** | |
| 32 | - * 固件版本 | |
| 33 | - */ | |
| 34 | - @Schema(description = "固件版本", requiredMode = Schema.RequiredMode.REQUIRED, example = "v1.0.0") | |
| 35 | - private String firmwareVersion; | |
| 36 | - /** | |
| 37 | - * 任务编号 | |
| 38 | - * <p> | |
| 39 | - * 关联 {@link IotOtaUpgradeTaskDO#getId()} | |
| 40 | - */ | |
| 41 | - @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 42 | - private Long taskId; | |
| 43 | - /** | |
| 44 | - * 产品标识 | |
| 45 | - * <p> | |
| 46 | - * 关联 {@link cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO#getId()} | |
| 47 | - */ | |
| 48 | - @Schema(description = "产品标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "iot") | |
| 49 | - private String productKey; | |
| 50 | - /** | |
| 51 | - * 设备名称 | |
| 52 | - * <p> | |
| 53 | - * 关联 {@link cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO#getId()} | |
| 54 | - */ | |
| 55 | - @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "iot") | |
| 56 | - private String deviceName; | |
| 57 | - /** | |
| 58 | - * 设备编号 | |
| 59 | - * <p> | |
| 60 | - * 关联 {@link cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO#getId()} | |
| 61 | - */ | |
| 62 | - @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 63 | - private String deviceId; | |
| 64 | - /** | |
| 65 | - * 来源的固件编号 | |
| 66 | - * <p> | |
| 67 | - * 关联 {@link IotDeviceDO#getFirmwareId()} | |
| 68 | - */ | |
| 69 | - @Schema(description = "来源的固件编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 70 | - @Trans(type = TransType.SIMPLE, target = IotOtaFirmwareDO.class, fields = {"version"}, refs = {"fromFirmwareVersion"}) | |
| 71 | - private Long fromFirmwareId; | |
| 72 | - /** | |
| 73 | - * 来源的固件版本 | |
| 74 | - */ | |
| 75 | - @Schema(description = "来源的固件版本", requiredMode = Schema.RequiredMode.REQUIRED, example = "v1.0.0") | |
| 76 | - private String fromFirmwareVersion; | |
| 77 | - /** | |
| 78 | - * 升级状态 | |
| 79 | - * <p> | |
| 80 | - * 关联 {@link cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeRecordStatusEnum} | |
| 81 | - */ | |
| 82 | - @Schema(description = "升级状态", requiredMode = Schema.RequiredMode.REQUIRED, allowableValues = {"0", "10", "20", "30", "40", "50"}) | |
| 83 | - private Integer status; | |
| 84 | - /** | |
| 85 | - * 升级进度,百分比 | |
| 86 | - */ | |
| 87 | - @Schema(description = "升级进度,百分比", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | |
| 88 | - private Integer progress; | |
| 89 | - /** | |
| 90 | - * 升级进度描述 | |
| 91 | - * <p> | |
| 92 | - * 注意,只记录设备最后一次的升级进度描述 | |
| 93 | - * 如果想看历史记录,可以查看 {@link IotDeviceMessageDO} 设备日志 | |
| 94 | - */ | |
| 95 | - @Schema(description = "升级进度描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | |
| 96 | - private String description; | |
| 97 | - /** | |
| 98 | - * 升级开始时间 | |
| 99 | - */ | |
| 100 | - @Schema(description = "升级开始时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022-07-08 07:30:00") | |
| 101 | - private LocalDateTime startTime; | |
| 102 | - /** | |
| 103 | - * 升级结束时间 | |
| 104 | - */ | |
| 105 | - @Schema(description = "升级结束时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022-07-08 07:30:00") | |
| 106 | - private LocalDateTime endTime; | |
| 107 | - | |
| 108 | -} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/ota/vo/upgrade/task/IotOtaUpgradeTaskRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.task; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; | |
| 4 | -import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaFirmwareDO; | |
| 5 | -import com.fhs.core.trans.vo.VO; | |
| 6 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 7 | -import lombok.Data; | |
| 8 | - | |
| 9 | -import java.time.LocalDateTime; | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -@Data | |
| 13 | -@Schema(description = "管理后台 - IoT OTA 升级任务 Response VO") | |
| 14 | -public class IotOtaUpgradeTaskRespVO implements VO { | |
| 15 | - | |
| 16 | - /** | |
| 17 | - * 任务编号 | |
| 18 | - */ | |
| 19 | - @Schema(description = "任务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 20 | - private Long id; | |
| 21 | - /** | |
| 22 | - * 任务名称 | |
| 23 | - */ | |
| 24 | - @Schema(description = "任务名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "升级任务") | |
| 25 | - private String name; | |
| 26 | - /** | |
| 27 | - * 任务描述 | |
| 28 | - */ | |
| 29 | - @Schema(description = "任务描述", example = "升级任务") | |
| 30 | - private String description; | |
| 31 | - /** | |
| 32 | - * 固件编号 | |
| 33 | - * <p> | |
| 34 | - * 关联 {@link IotOtaFirmwareDO#getId()} | |
| 35 | - */ | |
| 36 | - @Schema(description = "固件编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 37 | - private Long firmwareId; | |
| 38 | - /** | |
| 39 | - * 任务状态 | |
| 40 | - * <p> | |
| 41 | - * 关联 {@link cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeTaskStatusEnum} | |
| 42 | - */ | |
| 43 | - @Schema(description = "任务状态", requiredMode = Schema.RequiredMode.REQUIRED, allowableValues = {"10", "20", "21", "30"}) | |
| 44 | - private Integer status; | |
| 45 | - /** | |
| 46 | - * 任务状态名称 | |
| 47 | - */ | |
| 48 | - @Schema(description = "任务状态名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "进行中") | |
| 49 | - private String statusName; | |
| 50 | - /** | |
| 51 | - * 升级范围 | |
| 52 | - * <p> | |
| 53 | - * 关联 {@link cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeTaskScopeEnum} | |
| 54 | - */ | |
| 55 | - @Schema(description = "升级范围", requiredMode = Schema.RequiredMode.REQUIRED, allowableValues = {"1", "2"}) | |
| 56 | - private Integer scope; | |
| 57 | - /** | |
| 58 | - * 设备数量 | |
| 59 | - */ | |
| 60 | - @Schema(description = "设备数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 61 | - private Long deviceCount; | |
| 62 | - /** | |
| 63 | - * 选中的设备编号数组 | |
| 64 | - * <p> | |
| 65 | - * 关联 {@link IotDeviceDO#getId()} | |
| 66 | - */ | |
| 67 | - @Schema(description = "选中的设备编号数组", example = "1024") | |
| 68 | - private List<Long> deviceIds; | |
| 69 | - /** | |
| 70 | - * 选中的设备名字数组 | |
| 71 | - * <p> | |
| 72 | - * 关联 {@link IotDeviceDO#getDeviceName()} | |
| 73 | - */ | |
| 74 | - @Schema(description = "选中的设备名字数组", example = "1024") | |
| 75 | - private List<String> deviceNames; | |
| 76 | - /** | |
| 77 | - * 创建时间 | |
| 78 | - */ | |
| 79 | - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "2022-07-08 07:30:00") | |
| 80 | - private LocalDateTime createTime; | |
| 81 | - | |
| 82 | -} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/product/IotProductController.java
| ... | ... | @@ -143,7 +143,7 @@ public class IotProductController { |
| 143 | 143 | |
| 144 | 144 | @GetMapping("/simple-list") |
| 145 | 145 | @Operation(summary = "获取产品的精简信息列表", description = "主要用于前端的下拉选项") |
| 146 | - public CommonResult<List<IotProductRespVO>> getSimpleProductList() { | |
| 146 | + public CommonResult<List<IotProductRespVO>> getProductSimpleList() { | |
| 147 | 147 | List<IotProductDO> list = productService.getProductList(); |
| 148 | 148 | return success(convertList(list, product -> // 只返回 id、name 字段 |
| 149 | 149 | new IotProductRespVO().setId(product.getId()).setName(product.getName()) | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/IotDataBridgeController.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.rule; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 7 | -import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgePageReqVO; | |
| 8 | -import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgeRespVO; | |
| 9 | -import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgeSaveReqVO; | |
| 10 | -import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataBridgeDO; | |
| 11 | -import cn.iocoder.yudao.module.iot.service.rule.IotDataBridgeService; | |
| 12 | -import io.swagger.v3.oas.annotations.Operation; | |
| 13 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 14 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 15 | -import jakarta.annotation.Resource; | |
| 16 | -import jakarta.validation.Valid; | |
| 17 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 18 | -import org.springframework.validation.annotation.Validated; | |
| 19 | -import org.springframework.web.bind.annotation.*; | |
| 20 | - | |
| 21 | -import java.util.List; | |
| 22 | - | |
| 23 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 24 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 25 | - | |
| 26 | -@Tag(name = "管理后台 - IoT 数据桥梁") | |
| 27 | -@RestController | |
| 28 | -@RequestMapping("/iot/data-bridge") | |
| 29 | -@Validated | |
| 30 | -public class IotDataBridgeController { | |
| 31 | - | |
| 32 | - @Resource | |
| 33 | - private IotDataBridgeService dataBridgeService; | |
| 34 | - | |
| 35 | - @PostMapping("/create") | |
| 36 | - @Operation(summary = "创建数据桥梁") | |
| 37 | - @PreAuthorize("@ss.hasPermission('iot:data-bridge:create')") | |
| 38 | - public CommonResult<Long> createDataBridge(@Valid @RequestBody IotDataBridgeSaveReqVO createReqVO) { | |
| 39 | - return success(dataBridgeService.createDataBridge(createReqVO)); | |
| 40 | - } | |
| 41 | - | |
| 42 | - @PutMapping("/update") | |
| 43 | - @Operation(summary = "更新数据桥梁") | |
| 44 | - @PreAuthorize("@ss.hasPermission('iot:data-bridge:update')") | |
| 45 | - public CommonResult<Boolean> updateDataBridge(@Valid @RequestBody IotDataBridgeSaveReqVO updateReqVO) { | |
| 46 | - dataBridgeService.updateDataBridge(updateReqVO); | |
| 47 | - return success(true); | |
| 48 | - } | |
| 49 | - | |
| 50 | - @DeleteMapping("/delete") | |
| 51 | - @Operation(summary = "删除数据桥梁") | |
| 52 | - @Parameter(name = "id", description = "编号", required = true) | |
| 53 | - @PreAuthorize("@ss.hasPermission('iot:data-bridge:delete')") | |
| 54 | - public CommonResult<Boolean> deleteDataBridge(@RequestParam("id") Long id) { | |
| 55 | - dataBridgeService.deleteDataBridge(id); | |
| 56 | - return success(true); | |
| 57 | - } | |
| 58 | - | |
| 59 | - @GetMapping("/get") | |
| 60 | - @Operation(summary = "获得数据桥梁") | |
| 61 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 62 | - @PreAuthorize("@ss.hasPermission('iot:data-bridge:query')") | |
| 63 | - public CommonResult<IotDataBridgeRespVO> getDataBridge(@RequestParam("id") Long id) { | |
| 64 | - IotDataBridgeDO dataBridge = dataBridgeService.getDataBridge(id); | |
| 65 | - return success(BeanUtils.toBean(dataBridge, IotDataBridgeRespVO.class)); | |
| 66 | - } | |
| 67 | - | |
| 68 | - @GetMapping("/page") | |
| 69 | - @Operation(summary = "获得数据桥梁分页") | |
| 70 | - @PreAuthorize("@ss.hasPermission('iot:data-bridge:query')") | |
| 71 | - public CommonResult<PageResult<IotDataBridgeRespVO>> getDataBridgePage(@Valid IotDataBridgePageReqVO pageReqVO) { | |
| 72 | - PageResult<IotDataBridgeDO> pageResult = dataBridgeService.getDataBridgePage(pageReqVO); | |
| 73 | - return success(BeanUtils.toBean(pageResult, IotDataBridgeRespVO.class)); | |
| 74 | - } | |
| 75 | - | |
| 76 | - @GetMapping("/simple-list") | |
| 77 | - @Operation(summary = "获取数据桥梁的精简信息列表", description = "主要用于前端的下拉选项") | |
| 78 | - public CommonResult<List<IotDataBridgeRespVO>> getSimpleDataBridgeList() { | |
| 79 | - List<IotDataBridgeDO> list = dataBridgeService.getDataBridgeList(CommonStatusEnum.ENABLE.getStatus()); | |
| 80 | - return success(convertList(list, dataBridge -> // 只返回 id、name 字段 | |
| 81 | - new IotDataBridgeRespVO().setId(dataBridge.getId()).setName(dataBridge.getName()))); | |
| 82 | - } | |
| 83 | - | |
| 84 | -} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/IotDataRuleController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.rule; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.rule.IotDataRulePageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.rule.IotDataRuleRespVO; | |
| 8 | +import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.rule.IotDataRuleSaveReqVO; | |
| 9 | +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleDO; | |
| 10 | +import cn.iocoder.yudao.module.iot.service.rule.data.IotDataRuleService; | |
| 11 | +import io.swagger.v3.oas.annotations.Operation; | |
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 14 | +import jakarta.annotation.Resource; | |
| 15 | +import jakarta.validation.Valid; | |
| 16 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 17 | +import org.springframework.validation.annotation.Validated; | |
| 18 | +import org.springframework.web.bind.annotation.*; | |
| 19 | + | |
| 20 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 21 | + | |
| 22 | +@Tag(name = "管理后台 - IoT 数据流转规则") | |
| 23 | +@RestController | |
| 24 | +@RequestMapping("/iot/data-rule") | |
| 25 | +@Validated | |
| 26 | +public class IotDataRuleController { | |
| 27 | + | |
| 28 | + @Resource | |
| 29 | + private IotDataRuleService dataRuleService; | |
| 30 | + | |
| 31 | + @PostMapping("/create") | |
| 32 | + @Operation(summary = "创建数据流转规则") | |
| 33 | + @PreAuthorize("@ss.hasPermission('iot:data-rule:create')") | |
| 34 | + public CommonResult<Long> createDataRule(@Valid @RequestBody IotDataRuleSaveReqVO createReqVO) { | |
| 35 | + return success(dataRuleService.createDataRule(createReqVO)); | |
| 36 | + } | |
| 37 | + | |
| 38 | + @PutMapping("/update") | |
| 39 | + @Operation(summary = "更新数据流转规则") | |
| 40 | + @PreAuthorize("@ss.hasPermission('iot:data-rule:update')") | |
| 41 | + public CommonResult<Boolean> updateDataRule(@Valid @RequestBody IotDataRuleSaveReqVO updateReqVO) { | |
| 42 | + dataRuleService.updateDataRule(updateReqVO); | |
| 43 | + return success(true); | |
| 44 | + } | |
| 45 | + | |
| 46 | + @DeleteMapping("/delete") | |
| 47 | + @Operation(summary = "删除数据流转规则") | |
| 48 | + @Parameter(name = "id", description = "编号", required = true) | |
| 49 | + @PreAuthorize("@ss.hasPermission('iot:data-rule:delete')") | |
| 50 | + public CommonResult<Boolean> deleteDataRule(@RequestParam("id") Long id) { | |
| 51 | + dataRuleService.deleteDataRule(id); | |
| 52 | + return success(true); | |
| 53 | + } | |
| 54 | + | |
| 55 | + @GetMapping("/get") | |
| 56 | + @Operation(summary = "获得数据流转规则") | |
| 57 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 58 | + @PreAuthorize("@ss.hasPermission('iot:data-rule:query')") | |
| 59 | + public CommonResult<IotDataRuleRespVO> getDataRule(@RequestParam("id") Long id) { | |
| 60 | + IotDataRuleDO dataRule = dataRuleService.getDataRule(id); | |
| 61 | + return success(BeanUtils.toBean(dataRule, IotDataRuleRespVO.class)); | |
| 62 | + } | |
| 63 | + | |
| 64 | + @GetMapping("/page") | |
| 65 | + @Operation(summary = "获得数据流转规则分页") | |
| 66 | + @PreAuthorize("@ss.hasPermission('iot:data-rule:query')") | |
| 67 | + public CommonResult<PageResult<IotDataRuleRespVO>> getDataRulePage(@Valid IotDataRulePageReqVO pageReqVO) { | |
| 68 | + PageResult<IotDataRuleDO> pageResult = dataRuleService.getDataRulePage(pageReqVO); | |
| 69 | + return success(BeanUtils.toBean(pageResult, IotDataRuleRespVO.class)); | |
| 70 | + } | |
| 71 | + | |
| 72 | +} | |
| 0 | 73 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/IotDataSinkController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.rule; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.sink.IotDataSinkPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.sink.IotDataSinkRespVO; | |
| 9 | +import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.sink.IotDataSinkSaveReqVO; | |
| 10 | +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataSinkDO; | |
| 11 | +import cn.iocoder.yudao.module.iot.service.rule.data.IotDataSinkService; | |
| 12 | +import io.swagger.v3.oas.annotations.Operation; | |
| 13 | +import io.swagger.v3.oas.annotations.Parameter; | |
| 14 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 15 | +import jakarta.annotation.Resource; | |
| 16 | +import jakarta.validation.Valid; | |
| 17 | +import org.springframework.security.access.prepost.PreAuthorize; | |
| 18 | +import org.springframework.validation.annotation.Validated; | |
| 19 | +import org.springframework.web.bind.annotation.*; | |
| 20 | + | |
| 21 | +import java.util.List; | |
| 22 | + | |
| 23 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 24 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 25 | + | |
| 26 | +@Tag(name = "管理后台 - IoT 数据流转目的") | |
| 27 | +@RestController | |
| 28 | +@RequestMapping("/iot/data-sink") | |
| 29 | +@Validated | |
| 30 | +public class IotDataSinkController { | |
| 31 | + | |
| 32 | + @Resource | |
| 33 | + private IotDataSinkService dataSinkService; | |
| 34 | + | |
| 35 | + @PostMapping("/create") | |
| 36 | + @Operation(summary = "创建数据目的") | |
| 37 | + @PreAuthorize("@ss.hasPermission('iot:data-sink:create')") | |
| 38 | + public CommonResult<Long> createDataSink(@Valid @RequestBody IotDataSinkSaveReqVO createReqVO) { | |
| 39 | + return success(dataSinkService.createDataSink(createReqVO)); | |
| 40 | + } | |
| 41 | + | |
| 42 | + @PutMapping("/update") | |
| 43 | + @Operation(summary = "更新数据目的") | |
| 44 | + @PreAuthorize("@ss.hasPermission('iot:data-sink:update')") | |
| 45 | + public CommonResult<Boolean> updateDataSink(@Valid @RequestBody IotDataSinkSaveReqVO updateReqVO) { | |
| 46 | + dataSinkService.updateDataSink(updateReqVO); | |
| 47 | + return success(true); | |
| 48 | + } | |
| 49 | + | |
| 50 | + @DeleteMapping("/delete") | |
| 51 | + @Operation(summary = "删除数据目的") | |
| 52 | + @Parameter(name = "id", description = "编号", required = true) | |
| 53 | + @PreAuthorize("@ss.hasPermission('iot:data-sink:delete')") | |
| 54 | + public CommonResult<Boolean> deleteDataSink(@RequestParam("id") Long id) { | |
| 55 | + dataSinkService.deleteDataSink(id); | |
| 56 | + return success(true); | |
| 57 | + } | |
| 58 | + | |
| 59 | + @GetMapping("/get") | |
| 60 | + @Operation(summary = "获得数据目的") | |
| 61 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 62 | + @PreAuthorize("@ss.hasPermission('iot:data-sink:query')") | |
| 63 | + public CommonResult<IotDataSinkRespVO> getDataSink(@RequestParam("id") Long id) { | |
| 64 | + IotDataSinkDO sink = dataSinkService.getDataSink(id); | |
| 65 | + return success(BeanUtils.toBean(sink, IotDataSinkRespVO.class)); | |
| 66 | + } | |
| 67 | + | |
| 68 | + @GetMapping("/page") | |
| 69 | + @Operation(summary = "获得数据目的分页") | |
| 70 | + @PreAuthorize("@ss.hasPermission('iot:data-sink:query')") | |
| 71 | + public CommonResult<PageResult<IotDataSinkRespVO>> getDataSinkPage(@Valid IotDataSinkPageReqVO pageReqVO) { | |
| 72 | + PageResult<IotDataSinkDO> pageResult = dataSinkService.getDataSinkPage(pageReqVO); | |
| 73 | + return success(BeanUtils.toBean(pageResult, IotDataSinkRespVO.class)); | |
| 74 | + } | |
| 75 | + | |
| 76 | + @GetMapping("/simple-list") | |
| 77 | + @Operation(summary = "获取数据目的的精简信息列表", description = "主要用于前端的下拉选项") | |
| 78 | + public CommonResult<List<IotDataSinkRespVO>> getDataSinkSimpleList() { | |
| 79 | + List<IotDataSinkDO> list = dataSinkService.getDataSinkListByStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 80 | + return success(convertList(list, sink -> // 只返回 id、name 字段 | |
| 81 | + new IotDataSinkRespVO().setId(sink.getId()).setName(sink.getName()))); | |
| 82 | + } | |
| 83 | + | |
| 84 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/IotRuleSceneController.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.rule; |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 3 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | 6 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| ... | ... | @@ -7,7 +8,7 @@ import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.scene.IotRuleScenePa |
| 7 | 8 | import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.scene.IotRuleSceneRespVO; |
| 8 | 9 | import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.scene.IotRuleSceneSaveReqVO; |
| 9 | 10 | import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotRuleSceneDO; |
| 10 | -import cn.iocoder.yudao.module.iot.service.rule.IotRuleSceneService; | |
| 11 | +import cn.iocoder.yudao.module.iot.service.rule.scene.IotRuleSceneService; | |
| 11 | 12 | import io.swagger.v3.oas.annotations.Operation; |
| 12 | 13 | import io.swagger.v3.oas.annotations.Parameter; |
| 13 | 14 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -18,7 +19,10 @@ import org.springframework.security.access.prepost.PreAuthorize; |
| 18 | 19 | import org.springframework.validation.annotation.Validated; |
| 19 | 20 | import org.springframework.web.bind.annotation.*; |
| 20 | 21 | |
| 22 | +import java.util.List; | |
| 23 | + | |
| 21 | 24 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 25 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | |
| 22 | 26 | |
| 23 | 27 | @Tag(name = "管理后台 - IoT 场景联动") |
| 24 | 28 | @RestController |
| ... | ... | @@ -70,6 +74,14 @@ public class IotRuleSceneController { |
| 70 | 74 | return success(BeanUtils.toBean(pageResult, IotRuleSceneRespVO.class)); |
| 71 | 75 | } |
| 72 | 76 | |
| 77 | + @GetMapping("/simple-list") | |
| 78 | + @Operation(summary = "获取场景联动的精简信息列表", description = "主要用于前端的下拉选项") | |
| 79 | + public CommonResult<List<IotRuleSceneRespVO>> getRuleSceneSimpleList() { | |
| 80 | + List<IotRuleSceneDO> list = ruleSceneService.getRuleSceneListByStatus(CommonStatusEnum.ENABLE.getStatus()); | |
| 81 | + return success(convertList(list, scene -> // 只返回 id、name 字段 | |
| 82 | + new IotRuleSceneRespVO().setId(scene.getId()).setName(scene.getName()))); | |
| 83 | + } | |
| 84 | + | |
| 73 | 85 | @GetMapping("/test") |
| 74 | 86 | @PermitAll |
| 75 | 87 | public void test() { | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/data/package-info.java
0 → 100644
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/data/rule/IotDataRulePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.rule; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | |
| 7 | + | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | + | |
| 10 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - IoT 数据流转规则分页 Request VO") | |
| 13 | +@Data | |
| 14 | +public class IotDataRulePageReqVO extends PageParam { | |
| 15 | + | |
| 16 | + @Schema(description = "数据流转规则名称", example = "芋艿") | |
| 17 | + private String name; | |
| 18 | + | |
| 19 | + @Schema(description = "数据流转规则状态", example = "1") | |
| 20 | + private Integer status; | |
| 21 | + | |
| 22 | + @Schema(description = "创建时间") | |
| 23 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | |
| 24 | + private LocalDateTime[] createTime; | |
| 25 | + | |
| 26 | +} | |
| 0 | 27 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/data/rule/IotDataRuleRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.rule; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleDO; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | +import java.util.List; | |
| 9 | + | |
| 10 | +@Schema(description = "管理后台 - IoT 数据流转规则 Response VO") | |
| 11 | +@Data | |
| 12 | +public class IotDataRuleRespVO { | |
| 13 | + | |
| 14 | + @Schema(description = "数据流转规则编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8540") | |
| 15 | + private Long id; | |
| 16 | + | |
| 17 | + @Schema(description = "数据流转规则名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | |
| 18 | + private String name; | |
| 19 | + | |
| 20 | + @Schema(description = "数据流转规则描述", example = "你猜") | |
| 21 | + private String description; | |
| 22 | + | |
| 23 | + @Schema(description = "数据流转规则状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 24 | + private Integer status; | |
| 25 | + | |
| 26 | + @Schema(description = "数据源配置数组", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 27 | + private List<IotDataRuleDO.SourceConfig> sourceConfigs; | |
| 28 | + | |
| 29 | + @Schema(description = "数据目的编号数组", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 30 | + private List<Long> sinkIds; | |
| 31 | + | |
| 32 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 33 | + private LocalDateTime createTime; | |
| 34 | + | |
| 35 | +} | |
| 0 | 36 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/data/rule/IotDataRuleSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.rule; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleDO; | |
| 6 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | +import jakarta.validation.constraints.NotNull; | |
| 9 | +import lombok.Data; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +@Schema(description = "管理后台 - IoT 数据流转规则新增/修改 Request VO") | |
| 14 | +@Data | |
| 15 | +public class IotDataRuleSaveReqVO { | |
| 16 | + | |
| 17 | + @Schema(description = "数据流转规则编号", example = "8540") | |
| 18 | + private Long id; | |
| 19 | + | |
| 20 | + @Schema(description = "数据流转规则名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | |
| 21 | + @NotEmpty(message = "数据流转规则名称不能为空") | |
| 22 | + private String name; | |
| 23 | + | |
| 24 | + @Schema(description = "数据流转规则描述", example = "你猜") | |
| 25 | + private String description; | |
| 26 | + | |
| 27 | + @Schema(description = "数据流转规则状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 28 | + @NotNull(message = "数据流转规则状态不能为空") | |
| 29 | + @InEnum(CommonStatusEnum.class) | |
| 30 | + private Integer status; | |
| 31 | + | |
| 32 | + @Schema(description = "数据源配置数组", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 33 | + @NotEmpty(message = "数据源配置数组不能为空") | |
| 34 | + private List<IotDataRuleDO.SourceConfig> sourceConfigs; | |
| 35 | + | |
| 36 | + @Schema(description = "数据目的编号数组", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 37 | + @NotEmpty(message = "数据目的编号数组不能为空") | |
| 38 | + private List<Long> sinkIds; | |
| 39 | + | |
| 40 | +} | |
| 0 | 41 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/IotDataBridgePageReqVO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/data/sink/IotDataSinkPageReqVO.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge; | |
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.sink; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| ... | ... | @@ -11,14 +11,14 @@ import java.time.LocalDateTime; |
| 11 | 11 | |
| 12 | 12 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 13 | 13 | |
| 14 | -@Schema(description = "管理后台 - IoT 数据桥梁分页 Request VO") | |
| 14 | +@Schema(description = "管理后台 - IoT 数据流转目的分页 Request VO") | |
| 15 | 15 | @Data |
| 16 | -public class IotDataBridgePageReqVO extends PageParam { | |
| 16 | +public class IotDataSinkPageReqVO extends PageParam { | |
| 17 | 17 | |
| 18 | - @Schema(description = "桥梁名称", example = "赵六") | |
| 18 | + @Schema(description = "数据目的名称", example = "赵六") | |
| 19 | 19 | private String name; |
| 20 | 20 | |
| 21 | - @Schema(description = "桥梁状态", example = "1") | |
| 21 | + @Schema(description = "数据目的状态", example = "2") | |
| 22 | 22 | @InEnum(CommonStatusEnum.class) |
| 23 | 23 | private Integer status; |
| 24 | 24 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/data/sink/IotDataSinkRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.sink; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.config.IotAbstractDataSinkConfig; | |
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | +import lombok.Data; | |
| 6 | + | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | + | |
| 9 | +@Schema(description = "管理后台 - IoT 数据流转目的 Response VO") | |
| 10 | +@Data | |
| 11 | +public class IotDataSinkRespVO { | |
| 12 | + | |
| 13 | + @Schema(description = "数据目的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18564") | |
| 14 | + private Long id; | |
| 15 | + | |
| 16 | + @Schema(description = "数据目的名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 17 | + private String name; | |
| 18 | + | |
| 19 | + @Schema(description = "数据目的描述", example = "随便") | |
| 20 | + private String description; | |
| 21 | + | |
| 22 | + @Schema(description = "数据目的状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 23 | + private Integer status; | |
| 24 | + | |
| 25 | + @Schema(description = "数据目的类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 26 | + private Integer type; | |
| 27 | + | |
| 28 | + @Schema(description = "数据目的配置") | |
| 29 | + private IotAbstractDataSinkConfig config; | |
| 30 | + | |
| 31 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 32 | + private LocalDateTime createTime; | |
| 33 | + | |
| 34 | +} | |
| 0 | 35 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/data/sink/IotDataSinkSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.sink; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.config.IotAbstractDataSinkConfig; | |
| 6 | +import cn.iocoder.yudao.module.iot.enums.rule.IotDataSinkTypeEnum; | |
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 8 | +import jakarta.validation.constraints.NotEmpty; | |
| 9 | +import jakarta.validation.constraints.NotNull; | |
| 10 | +import lombok.Data; | |
| 11 | + | |
| 12 | +@Schema(description = "管理后台 - IoT 数据流转目的新增/修改 Request VO") | |
| 13 | +@Data | |
| 14 | +public class IotDataSinkSaveReqVO { | |
| 15 | + | |
| 16 | + @Schema(description = "数据目的编号", example = "18564") | |
| 17 | + private Long id; | |
| 18 | + | |
| 19 | + @Schema(description = "数据目的名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 20 | + @NotEmpty(message = "数据目的名称不能为空") | |
| 21 | + private String name; | |
| 22 | + | |
| 23 | + @Schema(description = "数据目的描述", example = "随便") | |
| 24 | + private String description; | |
| 25 | + | |
| 26 | + @Schema(description = "数据目的状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 27 | + @NotNull(message = "数据目的状态不能为空") | |
| 28 | + @InEnum(CommonStatusEnum.class) | |
| 29 | + private Integer status; | |
| 30 | + | |
| 31 | + @Schema(description = "数据目的类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 32 | + @NotNull(message = "数据目的类型不能为空") | |
| 33 | + @InEnum(IotDataSinkTypeEnum.class) | |
| 34 | + private Integer type; | |
| 35 | + | |
| 36 | + @Schema(description = "数据目的配置") | |
| 37 | + @NotNull(message = "数据目的配置不能为空") | |
| 38 | + private IotAbstractDataSinkConfig config; | |
| 39 | + | |
| 40 | +} | |
| 0 | 41 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/IotDataBridgeRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config.IotDataBridgeAbstractConfig; | |
| 4 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 5 | -import lombok.Data; | |
| 6 | - | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | - | |
| 9 | -@Schema(description = "管理后台 - IoT 数据桥梁 Response VO") | |
| 10 | -@Data | |
| 11 | -public class IotDataBridgeRespVO { | |
| 12 | - | |
| 13 | - @Schema(description = "桥梁编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18564") | |
| 14 | - private Long id; | |
| 15 | - | |
| 16 | - @Schema(description = "桥梁名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 17 | - private String name; | |
| 18 | - | |
| 19 | - @Schema(description = "桥梁描述", example = "随便") | |
| 20 | - private String description; | |
| 21 | - | |
| 22 | - @Schema(description = "桥梁状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 23 | - private Integer status; | |
| 24 | - | |
| 25 | - @Schema(description = "桥梁方向", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 26 | - private Integer direction; | |
| 27 | - | |
| 28 | - @Schema(description = "桥梁类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 29 | - private Integer type; | |
| 30 | - | |
| 31 | - @Schema(description = "桥梁配置") | |
| 32 | - private IotDataBridgeAbstractConfig config; | |
| 33 | - | |
| 34 | - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 35 | - private LocalDateTime createTime; | |
| 36 | - | |
| 37 | -} | |
| 38 | 0 | \ No newline at end of file |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/IotDataBridgeSaveReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | -import cn.iocoder.yudao.framework.common.validation.InEnum; | |
| 5 | -import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config.IotDataBridgeAbstractConfig; | |
| 6 | -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeDirectionEnum; | |
| 7 | -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeTypeEnum; | |
| 8 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 9 | -import jakarta.validation.constraints.NotEmpty; | |
| 10 | -import jakarta.validation.constraints.NotNull; | |
| 11 | -import lombok.Data; | |
| 12 | - | |
| 13 | -@Schema(description = "管理后台 - IoT 数据桥梁新增/修改 Request VO") | |
| 14 | -@Data | |
| 15 | -public class IotDataBridgeSaveReqVO { | |
| 16 | - | |
| 17 | - @Schema(description = "桥梁编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "18564") | |
| 18 | - private Long id; | |
| 19 | - | |
| 20 | - @Schema(description = "桥梁名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六") | |
| 21 | - @NotEmpty(message = "桥梁名称不能为空") | |
| 22 | - private String name; | |
| 23 | - | |
| 24 | - @Schema(description = "桥梁描述", example = "随便") | |
| 25 | - private String description; | |
| 26 | - | |
| 27 | - @Schema(description = "桥梁状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | |
| 28 | - @NotNull(message = "桥梁状态不能为空") | |
| 29 | - @InEnum(CommonStatusEnum.class) | |
| 30 | - private Integer status; | |
| 31 | - | |
| 32 | - @Schema(description = "桥梁方向", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 33 | - @NotNull(message = "桥梁方向不能为空") | |
| 34 | - @InEnum(IotDataBridgeDirectionEnum.class) | |
| 35 | - private Integer direction; | |
| 36 | - | |
| 37 | - @Schema(description = "桥梁类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 38 | - @NotNull(message = "桥梁类型不能为空") | |
| 39 | - @InEnum(IotDataBridgeTypeEnum.class) | |
| 40 | - private Integer type; | |
| 41 | - | |
| 42 | - @Schema(description = "桥梁配置") | |
| 43 | - @NotNull(message = "桥梁配置不能为空") | |
| 44 | - private IotDataBridgeAbstractConfig config; | |
| 45 | - | |
| 46 | -} | |
| 47 | 0 | \ No newline at end of file |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/IotThingModelController.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.thingmodel; |
| 2 | 2 | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.util.ObjUtil; | |
| 5 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 6 | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 7 | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 8 | 6 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.*; |
| 7 | +import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; | |
| 9 | 8 | import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO; |
| 10 | 9 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelTypeEnum; |
| 10 | +import cn.iocoder.yudao.module.iot.service.product.IotProductService; | |
| 11 | 11 | import cn.iocoder.yudao.module.iot.service.thingmodel.IotThingModelService; |
| 12 | +import com.google.common.base.Objects; | |
| 12 | 13 | import io.swagger.v3.oas.annotations.Operation; |
| 13 | 14 | import io.swagger.v3.oas.annotations.Parameter; |
| 14 | 15 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -32,6 +33,8 @@ public class IotThingModelController { |
| 32 | 33 | |
| 33 | 34 | @Resource |
| 34 | 35 | private IotThingModelService thingModelService; |
| 36 | + @Resource | |
| 37 | + private IotProductService productService; | |
| 35 | 38 | |
| 36 | 39 | @PostMapping("/create") |
| 37 | 40 | @Operation(summary = "创建产品物模型") |
| ... | ... | @@ -71,23 +74,21 @@ public class IotThingModelController { |
| 71 | 74 | @Parameter(name = "productId", description = "产品 ID", required = true, example = "1024") |
| 72 | 75 | @PreAuthorize("@ss.hasPermission('iot:thing-model:query')") |
| 73 | 76 | public CommonResult<IotThingModelTSLRespVO> getThingModelTsl(@RequestParam("productId") Long productId) { |
| 74 | - IotThingModelTSLRespVO tslRespVO = new IotThingModelTSLRespVO(); | |
| 75 | - // TODO @puhui999:是不是要先查询产品哈?原因是,万一没配置物模型,但是产品已经有了! | |
| 76 | - // 1. 获得产品所有物模型定义 | |
| 77 | - List<IotThingModelDO> thingModels = thingModelService.getThingModelListByProductId(productId); | |
| 78 | - if (CollUtil.isEmpty(thingModels)) { | |
| 79 | - return success(tslRespVO); | |
| 77 | + // 1. 获得产品 | |
| 78 | + IotProductDO product = productService.getProduct(productId); | |
| 79 | + if (product == null) { | |
| 80 | + return success(null); | |
| 80 | 81 | } |
| 81 | - | |
| 82 | - // 2. 设置公共部分参数 | |
| 83 | - IotThingModelDO thingModel = thingModels.get(0); | |
| 84 | - tslRespVO.setProductId(thingModel.getProductId()).setProductKey(thingModel.getProductKey()); | |
| 82 | + IotThingModelTSLRespVO tslRespVO = new IotThingModelTSLRespVO() | |
| 83 | + .setProductId(product.getId()).setProductKey(product.getProductKey()); | |
| 84 | + // 2. 获得物模型定义 | |
| 85 | + List<IotThingModelDO> thingModels = thingModelService.getThingModelListByProductId(productId); | |
| 85 | 86 | tslRespVO.setProperties(convertList(filterList(thingModels, item -> |
| 86 | - ObjUtil.equal(IotThingModelTypeEnum.PROPERTY.getType(), item.getType())), IotThingModelDO::getProperty)); | |
| 87 | - tslRespVO.setServices(convertList(filterList(thingModels, item -> | |
| 88 | - ObjUtil.equal(IotThingModelTypeEnum.SERVICE.getType(), item.getType())), IotThingModelDO::getService)); | |
| 89 | - tslRespVO.setEvents(convertList(filterList(thingModels, item -> | |
| 90 | - ObjUtil.equal(IotThingModelTypeEnum.EVENT.getType(), item.getType())), IotThingModelDO::getEvent)); | |
| 87 | + Objects.equal(IotThingModelTypeEnum.PROPERTY.getType(), item.getType())), IotThingModelDO::getProperty)) | |
| 88 | + .setServices(convertList(filterList(thingModels, item -> | |
| 89 | + Objects.equal(IotThingModelTypeEnum.SERVICE.getType(), item.getType())), IotThingModelDO::getService)) | |
| 90 | + .setEvents(convertList(filterList(thingModels, item -> | |
| 91 | + Objects.equal(IotThingModelTypeEnum.EVENT.getType(), item.getType())), IotThingModelDO::getEvent)); | |
| 91 | 92 | return success(tslRespVO); |
| 92 | 93 | } |
| 93 | 94 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/vo/IotThingModelRespVO.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelEvent; | |
| 4 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelProperty; | |
| 5 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelService; | |
| 3 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelEvent; | |
| 4 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelProperty; | |
| 5 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelService; | |
| 6 | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | 7 | import lombok.Data; |
| 8 | 8 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/vo/IotThingModelSaveReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelEvent; | |
| 5 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelProperty; | |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelService; | |
| 4 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelEvent; | |
| 5 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelProperty; | |
| 6 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelService; | |
| 7 | 7 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelTypeEnum; |
| 8 | 8 | import io.swagger.v3.oas.annotations.media.Schema; |
| 9 | 9 | import jakarta.validation.Valid; | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/vo/IotThingModelTSLRespVO.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelEvent; | |
| 4 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelProperty; | |
| 5 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelService; | |
| 3 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelEvent; | |
| 4 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelProperty; | |
| 5 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelService; | |
| 6 | 6 | import io.swagger.v3.oas.annotations.media.Schema; |
| 7 | 7 | import lombok.Data; |
| 8 | 8 | |
| ... | ... | @@ -12,7 +12,7 @@ import java.util.List; |
| 12 | 12 | @Data |
| 13 | 13 | public class IotThingModelTSLRespVO { |
| 14 | 14 | |
| 15 | - @Schema(description = "产品标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 15 | + @Schema(description = "产品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | |
| 16 | 16 | private Long productId; |
| 17 | 17 | |
| 18 | 18 | @Schema(description = "产品标识", requiredMode = Schema.RequiredMode.REQUIRED, example = "temperature_sensor") | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/convert/thingmodel/IotThingModelConvert.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.convert.thingmodel; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelEvent; | |
| 4 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelProperty; | |
| 5 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelService; | |
| 3 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelEvent; | |
| 4 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelProperty; | |
| 5 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelService; | |
| 6 | 6 | import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.vo.IotThingModelSaveReqVO; |
| 7 | 7 | import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO; |
| 8 | 8 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelTypeEnum; | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotAlertConfig.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/alert/IotAlertConfigDO.java
| 1 | -package cn.iocoder.yudao.module.iot.dal.dataobject.rule; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.alert; | |
| 2 | 2 | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 3 | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.module.iot.enums.rule.IotAlertConfigReceiveTypeEnum; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.type.IntegerListTypeHandler; | |
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; | |
| 7 | +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotRuleSceneDO; | |
| 8 | +import cn.iocoder.yudao.module.iot.enums.DictTypeConstants; | |
| 9 | +import cn.iocoder.yudao.module.iot.enums.alert.IotAlertReceiveTypeEnum; | |
| 5 | 10 | import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; |
| 6 | 11 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 7 | 12 | import com.baomidou.mybatisplus.annotation.TableField; |
| 8 | 13 | import com.baomidou.mybatisplus.annotation.TableId; |
| 9 | 14 | import com.baomidou.mybatisplus.annotation.TableName; |
| 10 | -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | |
| 11 | -import lombok.*; | |
| 15 | +import lombok.AllArgsConstructor; | |
| 16 | +import lombok.Builder; | |
| 17 | +import lombok.Data; | |
| 18 | +import lombok.NoArgsConstructor; | |
| 12 | 19 | |
| 13 | 20 | import java.util.List; |
| 14 | 21 | |
| ... | ... | @@ -17,13 +24,13 @@ import java.util.List; |
| 17 | 24 | * |
| 18 | 25 | * @author 芋道源码 |
| 19 | 26 | */ |
| 20 | -@TableName("iot_alert_config") | |
| 27 | +@TableName(value = "iot_alert_config", autoResultMap = true) | |
| 21 | 28 | @KeySequence("iot_alert_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 |
| 22 | 29 | @Data |
| 23 | 30 | @Builder |
| 24 | 31 | @NoArgsConstructor |
| 25 | 32 | @AllArgsConstructor |
| 26 | -public class IotAlertConfig extends BaseDO { | |
| 33 | +public class IotAlertConfigDO extends BaseDO { | |
| 27 | 34 | |
| 28 | 35 | /** |
| 29 | 36 | * 配置编号 |
| ... | ... | @@ -41,37 +48,37 @@ public class IotAlertConfig extends BaseDO { |
| 41 | 48 | /** |
| 42 | 49 | * 配置状态 |
| 43 | 50 | * |
| 44 | - * TODO 数据字典 | |
| 51 | + * 字典 {@link DictTypeConstants#ALERT_LEVEL} | |
| 45 | 52 | */ |
| 46 | 53 | private Integer level; |
| 47 | 54 | /** |
| 48 | 55 | * 配置状态 |
| 49 | 56 | * |
| 50 | - * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum} | |
| 57 | + * 枚举 {@link CommonStatusEnum} | |
| 51 | 58 | */ |
| 52 | 59 | private Integer status; |
| 53 | 60 | |
| 54 | 61 | /** |
| 55 | - * 关联的规则场景编号数组 | |
| 62 | + * 关联的场景联动规则编号数组 | |
| 56 | 63 | * |
| 57 | 64 | * 关联 {@link IotRuleSceneDO#getId()} |
| 58 | 65 | */ |
| 59 | - @TableField(typeHandler = JacksonTypeHandler.class) | |
| 60 | - private List<Long> ruleSceneIds; | |
| 66 | + @TableField(typeHandler = LongListTypeHandler.class) | |
| 67 | + private List<Long> sceneRuleIds; | |
| 61 | 68 | |
| 62 | 69 | /** |
| 63 | 70 | * 接收的用户编号数组 |
| 64 | 71 | * |
| 65 | 72 | * 关联 {@link AdminUserRespDTO#getId()} |
| 66 | 73 | */ |
| 67 | - @TableField(typeHandler = JacksonTypeHandler.class) | |
| 74 | + @TableField(typeHandler = LongListTypeHandler.class) | |
| 68 | 75 | private List<Long> receiveUserIds; |
| 69 | 76 | /** |
| 70 | 77 | * 接收的类型数组 |
| 71 | 78 | * |
| 72 | - * 枚举 {@link IotAlertConfigReceiveTypeEnum} | |
| 79 | + * 枚举 {@link IotAlertReceiveTypeEnum} | |
| 73 | 80 | */ |
| 74 | - @TableField(typeHandler = JacksonTypeHandler.class) | |
| 81 | + @TableField(typeHandler = IntegerListTypeHandler.class) | |
| 75 | 82 | private List<Integer> receiveTypes; |
| 76 | 83 | |
| 77 | 84 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotAlertRecordDO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/alert/IotAlertRecordDO.java
| 1 | -package cn.iocoder.yudao.module.iot.dal.dataobject.rule; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.alert; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 4 | import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage; |
| 5 | 5 | import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; |
| 6 | 6 | import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; |
| 7 | +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotRuleSceneDO; | |
| 7 | 8 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 8 | 9 | import com.baomidou.mybatisplus.annotation.TableField; |
| 10 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 9 | 11 | import com.baomidou.mybatisplus.annotation.TableName; |
| 10 | 12 | import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; |
| 11 | 13 | import lombok.AllArgsConstructor; |
| ... | ... | @@ -18,7 +20,7 @@ import lombok.NoArgsConstructor; |
| 18 | 20 | * |
| 19 | 21 | * @author 芋道源码 |
| 20 | 22 | */ |
| 21 | -@TableName("iot_alert_record") | |
| 23 | +@TableName(value = "iot_alert_record", autoResultMap = true) | |
| 22 | 24 | @KeySequence("iot_alert_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 |
| 23 | 25 | @Data |
| 24 | 26 | @Builder |
| ... | ... | @@ -29,47 +31,54 @@ public class IotAlertRecordDO extends BaseDO { |
| 29 | 31 | /** |
| 30 | 32 | * 记录编号 |
| 31 | 33 | */ |
| 32 | - @TableField | |
| 34 | + @TableId | |
| 33 | 35 | private Long id; |
| 34 | 36 | /** |
| 35 | 37 | * 告警名称 |
| 36 | 38 | * |
| 37 | - * 冗余 {@link IotAlertConfig#getName()} | |
| 39 | + * 冗余 {@link IotAlertConfigDO#getId()} | |
| 38 | 40 | */ |
| 39 | 41 | private Long configId; |
| 40 | 42 | /** |
| 41 | 43 | * 告警名称 |
| 42 | 44 | * |
| 43 | - * 冗余 {@link IotAlertConfig#getName()} | |
| 45 | + * 冗余 {@link IotAlertConfigDO#getName()} | |
| 44 | 46 | */ |
| 45 | - private String name; | |
| 46 | - | |
| 47 | + private String configName; | |
| 47 | 48 | /** |
| 48 | - * 产品标识 | |
| 49 | + * 告警级别 | |
| 49 | 50 | * |
| 50 | - * 关联 {@link IotProductDO#getProductKey()} ()} | |
| 51 | + * 冗余 {@link IotAlertConfigDO#getLevel()} | |
| 52 | + * 字典 {@link cn.iocoder.yudao.module.iot.enums.DictTypeConstants#ALERT_LEVEL} | |
| 51 | 53 | */ |
| 52 | - private String productKey; | |
| 54 | + private Integer configLevel; | |
| 53 | 55 | /** |
| 54 | - * 设备名称 | |
| 56 | + * 场景规则编号 | |
| 55 | 57 | * |
| 56 | - * 冗余 {@link IotDeviceDO#getDeviceName()} | |
| 58 | + * 关联 {@link IotRuleSceneDO#getId()} | |
| 57 | 59 | */ |
| 58 | - private String deviceName; | |
| 60 | + private Long sceneRuleId; | |
| 59 | 61 | |
| 60 | - // TODO @芋艿:有没更好的方式 | |
| 62 | + /** | |
| 63 | + * 产品编号 | |
| 64 | + * | |
| 65 | + * 关联 {@link IotProductDO#getId()} | |
| 66 | + */ | |
| 67 | + private Long productId; | |
| 68 | + /** | |
| 69 | + * 设备编号 | |
| 70 | + * | |
| 71 | + * 关联 {@link IotDeviceDO#getId()} | |
| 72 | + */ | |
| 73 | + private Long deviceId; | |
| 61 | 74 | /** |
| 62 | 75 | * 触发的设备消息 |
| 63 | 76 | */ |
| 64 | 77 | @TableField(typeHandler = JacksonTypeHandler.class) |
| 65 | 78 | private IotDeviceMessage deviceMessage; |
| 66 | 79 | |
| 67 | - // TODO @芋艿:换成枚举,枚举对应 ApiErrorLogProcessStatusEnum | |
| 68 | 80 | /** |
| 69 | - * 处理状态 | |
| 70 | - * | |
| 71 | - * true - 已处理 | |
| 72 | - * false - 未处理 | |
| 81 | + * 是否处理 | |
| 73 | 82 | */ |
| 74 | 83 | private Boolean processStatus; |
| 75 | 84 | /** | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/device/IotDeviceDO.java
| ... | ... | @@ -29,6 +29,11 @@ import java.util.Set; |
| 29 | 29 | public class IotDeviceDO extends TenantBaseDO { |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | + * 设备编号 - 全部设备 | |
| 33 | + */ | |
| 34 | + public static final Long DEVICE_ID_ALL = 0L; | |
| 35 | + | |
| 36 | + /** | |
| 32 | 37 | * 设备 ID,主键,自增 |
| 33 | 38 | */ |
| 34 | 39 | @TableId |
| ... | ... | @@ -112,7 +117,7 @@ public class IotDeviceDO extends TenantBaseDO { |
| 112 | 117 | * |
| 113 | 118 | * 关联 {@link IotOtaFirmwareDO#getId()} |
| 114 | 119 | */ |
| 115 | - private String firmwareId; | |
| 120 | + private Long firmwareId; | |
| 116 | 121 | |
| 117 | 122 | /** |
| 118 | 123 | * 设备密钥,用于设备认证 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/ota/IotOtaFirmwareDO.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.dal.dataobject.ota; |
| 2 | 2 | |
| 3 | +import cn.hutool.crypto.digest.DigestAlgorithm; | |
| 3 | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 5 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 5 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 6 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 6 | 7 | import com.baomidou.mybatisplus.annotation.TableName; |
| 7 | -import lombok.*; | |
| 8 | +import lombok.AllArgsConstructor; | |
| 9 | +import lombok.Builder; | |
| 10 | +import lombok.Data; | |
| 11 | +import lombok.NoArgsConstructor; | |
| 8 | 12 | |
| 9 | 13 | /** |
| 10 | 14 | * IoT OTA 固件 DO |
| ... | ... | @@ -24,14 +28,14 @@ public class IotOtaFirmwareDO extends BaseDO { |
| 24 | 28 | /** |
| 25 | 29 | * 固件编号 |
| 26 | 30 | */ |
| 27 | - @TableField | |
| 31 | + @TableId | |
| 28 | 32 | private Long id; |
| 29 | 33 | /** |
| 30 | 34 | * 固件名称 |
| 31 | 35 | */ |
| 32 | 36 | private String name; |
| 33 | 37 | /** |
| 34 | - * 固件版本 | |
| 38 | + * 固件描述 | |
| 35 | 39 | */ |
| 36 | 40 | private String description; |
| 37 | 41 | /** |
| ... | ... | @@ -44,37 +48,25 @@ public class IotOtaFirmwareDO extends BaseDO { |
| 44 | 48 | * |
| 45 | 49 | * 关联 {@link cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO#getId()} |
| 46 | 50 | */ |
| 47 | - // TODO @li:帮我改成 Long 哈,写错了 | |
| 48 | - private String productId; | |
| 49 | - /** | |
| 50 | - * 产品标识 | |
| 51 | - * | |
| 52 | - * 冗余 {@link cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO#getProductKey()} | |
| 53 | - */ | |
| 54 | - private String productKey; | |
| 51 | + private Long productId; | |
| 55 | 52 | |
| 56 | 53 | /** |
| 57 | - * 签名方式 | |
| 58 | - * | |
| 59 | - * 例如说:MD5、SHA256 | |
| 60 | - */ | |
| 61 | - private String signMethod; | |
| 62 | - /** | |
| 63 | - * 固件文件签名 | |
| 54 | + * 固件文件 URL | |
| 64 | 55 | */ |
| 65 | - private String fileSign; | |
| 56 | + private String fileUrl; | |
| 66 | 57 | /** |
| 67 | 58 | * 固件文件大小 |
| 68 | 59 | */ |
| 69 | 60 | private Long fileSize; |
| 70 | 61 | /** |
| 71 | - * 固件文件 URL | |
| 62 | + * 固件文件签名算法 | |
| 63 | + * | |
| 64 | + * 枚举 {@link DigestAlgorithm},目前只使用 MD5 | |
| 72 | 65 | */ |
| 73 | - private String fileUrl; | |
| 74 | - | |
| 66 | + private String fileDigestAlgorithm; | |
| 75 | 67 | /** |
| 76 | - * 自定义信息,建议使用 JSON 格式 | |
| 68 | + * 固件文件签名结果 | |
| 77 | 69 | */ |
| 78 | - private String information; | |
| 70 | + private String fileDigestValue; | |
| 79 | 71 | |
| 80 | 72 | } |
| 81 | 73 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/ota/IotOtaUpgradeTaskDO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/ota/IotOtaTaskDO.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.dal.dataobject.ota; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; | |
| 4 | +import cn.iocoder.yudao.module.iot.enums.ota.IotOtaTaskDeviceScopeEnum; | |
| 5 | +import cn.iocoder.yudao.module.iot.enums.ota.IotOtaTaskStatusEnum; | |
| 5 | 6 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 6 | -import com.baomidou.mybatisplus.annotation.TableField; | |
| 7 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 7 | 8 | import com.baomidou.mybatisplus.annotation.TableName; |
| 8 | -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | |
| 9 | -import lombok.*; | |
| 10 | - | |
| 11 | -import java.util.List; | |
| 9 | +import lombok.AllArgsConstructor; | |
| 10 | +import lombok.Builder; | |
| 11 | +import lombok.Data; | |
| 12 | +import lombok.NoArgsConstructor; | |
| 12 | 13 | |
| 13 | 14 | /** |
| 14 | 15 | * IoT OTA 升级任务 DO |
| 15 | 16 | * |
| 16 | 17 | * @author 芋道源码 |
| 17 | 18 | */ |
| 18 | -@TableName(value = "iot_ota_upgrade_task", autoResultMap = true) | |
| 19 | -@KeySequence("iot_ota_upgrade_task_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 19 | +@TableName(value = "iot_ota_task", autoResultMap = true) | |
| 20 | +@KeySequence("iot_ota_task_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 20 | 21 | @Data |
| 21 | 22 | @Builder |
| 22 | 23 | @NoArgsConstructor |
| 23 | 24 | @AllArgsConstructor |
| 24 | -public class IotOtaUpgradeTaskDO extends BaseDO { | |
| 25 | +public class IotOtaTaskDO extends BaseDO { | |
| 25 | 26 | |
| 26 | 27 | /** |
| 27 | 28 | * 任务编号 |
| 28 | 29 | */ |
| 29 | - @TableField | |
| 30 | + @TableId | |
| 30 | 31 | private Long id; |
| 31 | 32 | /** |
| 32 | 33 | * 任务名称 |
| ... | ... | @@ -47,26 +48,23 @@ public class IotOtaUpgradeTaskDO extends BaseDO { |
| 47 | 48 | /** |
| 48 | 49 | * 任务状态 |
| 49 | 50 | * <p> |
| 50 | - * 关联 {@link cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeTaskStatusEnum} | |
| 51 | + * 关联 {@link IotOtaTaskStatusEnum} | |
| 51 | 52 | */ |
| 52 | 53 | private Integer status; |
| 53 | 54 | |
| 54 | 55 | /** |
| 55 | - * 升级范围 | |
| 56 | + * 设备升级范围 | |
| 56 | 57 | * <p> |
| 57 | - * 关联 {@link cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeTaskScopeEnum} | |
| 58 | + * 关联 {@link IotOtaTaskDeviceScopeEnum} | |
| 58 | 59 | */ |
| 59 | - private Integer scope; | |
| 60 | + private Integer deviceScope; | |
| 60 | 61 | /** |
| 61 | - * 设备数量 | |
| 62 | + * 设备总数数量 | |
| 62 | 63 | */ |
| 63 | - private Long deviceCount; | |
| 64 | + private Integer deviceTotalCount; | |
| 64 | 65 | /** |
| 65 | - * 选中的设备编号数组 | |
| 66 | - * <p> | |
| 67 | - * 关联 {@link IotDeviceDO#getId()} | |
| 66 | + * 设备成功数量 | |
| 68 | 67 | */ |
| 69 | - @TableField(typeHandler = JacksonTypeHandler.class) | |
| 70 | - private List<Long> deviceIds; | |
| 68 | + private Integer deviceSuccessCount; | |
| 71 | 69 | |
| 72 | 70 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/ota/IotOtaUpgradeRecordDO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/ota/IotOtaTaskRecordDO.java
| ... | ... | @@ -3,25 +3,27 @@ package cn.iocoder.yudao.module.iot.dal.dataobject.ota; |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | 4 | import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; |
| 5 | 5 | import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceMessageDO; |
| 6 | +import cn.iocoder.yudao.module.iot.enums.ota.IotOtaTaskRecordStatusEnum; | |
| 6 | 7 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 7 | 8 | import com.baomidou.mybatisplus.annotation.TableId; |
| 8 | 9 | import com.baomidou.mybatisplus.annotation.TableName; |
| 9 | -import lombok.*; | |
| 10 | - | |
| 11 | -import java.time.LocalDateTime; | |
| 10 | +import lombok.AllArgsConstructor; | |
| 11 | +import lombok.Builder; | |
| 12 | +import lombok.Data; | |
| 13 | +import lombok.NoArgsConstructor; | |
| 12 | 14 | |
| 13 | 15 | /** |
| 14 | - * IoT OTA 升级记录 DO | |
| 16 | + * IoT OTA 升级任务记录 DO | |
| 15 | 17 | * |
| 16 | 18 | * @author 芋道源码 |
| 17 | 19 | */ |
| 18 | -@TableName(value = "iot_ota_upgrade_record", autoResultMap = true) | |
| 19 | -@KeySequence("iot_ota_upgrade_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 20 | +@TableName(value = "iot_ota_task_record", autoResultMap = true) | |
| 21 | +@KeySequence("iot_ota_task_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 20 | 22 | @Data |
| 21 | 23 | @Builder |
| 22 | 24 | @NoArgsConstructor |
| 23 | 25 | @AllArgsConstructor |
| 24 | -public class IotOtaUpgradeRecordDO extends BaseDO { | |
| 26 | +public class IotOtaTaskRecordDO extends BaseDO { | |
| 25 | 27 | |
| 26 | 28 | @TableId |
| 27 | 29 | private Long id; |
| ... | ... | @@ -35,28 +37,16 @@ public class IotOtaUpgradeRecordDO extends BaseDO { |
| 35 | 37 | /** |
| 36 | 38 | * 任务编号 |
| 37 | 39 | * |
| 38 | - * 关联 {@link IotOtaUpgradeTaskDO#getId()} | |
| 40 | + * 关联 {@link IotOtaTaskDO#getId()} | |
| 39 | 41 | */ |
| 40 | 42 | private Long taskId; |
| 41 | 43 | |
| 42 | 44 | /** |
| 43 | - * 产品标识 | |
| 44 | - * | |
| 45 | - * 关联 {@link cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO#getId()} | |
| 46 | - */ | |
| 47 | - private String productKey; | |
| 48 | - /** | |
| 49 | - * 设备名称 | |
| 50 | - * | |
| 51 | - * 关联 {@link cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO#getId()} | |
| 52 | - */ | |
| 53 | - private String deviceName; | |
| 54 | - /** | |
| 55 | 45 | * 设备编号 |
| 56 | 46 | * |
| 57 | - * 关联 {@link cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO#getId()} | |
| 47 | + * 关联 {@link IotDeviceDO#getId()} | |
| 58 | 48 | */ |
| 59 | - private String deviceId; | |
| 49 | + private Long deviceId; | |
| 60 | 50 | /** |
| 61 | 51 | * 来源的固件编号 |
| 62 | 52 | * |
| ... | ... | @@ -67,7 +57,7 @@ public class IotOtaUpgradeRecordDO extends BaseDO { |
| 67 | 57 | /** |
| 68 | 58 | * 升级状态 |
| 69 | 59 | * |
| 70 | - * 关联 {@link cn.iocoder.yudao.module.iot.enums.ota.IotOtaUpgradeRecordStatusEnum} | |
| 60 | + * 关联 {@link IotOtaTaskRecordStatusEnum} | |
| 71 | 61 | */ |
| 72 | 62 | private Integer status; |
| 73 | 63 | /** |
| ... | ... | @@ -81,13 +71,5 @@ public class IotOtaUpgradeRecordDO extends BaseDO { |
| 81 | 71 | * 如果想看历史记录,可以查看 {@link IotDeviceMessageDO} 设备日志 |
| 82 | 72 | */ |
| 83 | 73 | private String description; |
| 84 | - /** | |
| 85 | - * 升级开始时间 | |
| 86 | - */ | |
| 87 | - private LocalDateTime startTime; | |
| 88 | - /** | |
| 89 | - * 升级结束时间 | |
| 90 | - */ | |
| 91 | - private LocalDateTime endTime; | |
| 92 | 74 | |
| 93 | 75 | } |
| 94 | 76 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotDataRuleDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.rule; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler; | |
| 6 | +import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum; | |
| 7 | +import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; | |
| 8 | +import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; | |
| 9 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO; | |
| 10 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 11 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 12 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 13 | +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | |
| 14 | +import jakarta.validation.constraints.NotEmpty; | |
| 15 | +import lombok.AllArgsConstructor; | |
| 16 | +import lombok.Builder; | |
| 17 | +import lombok.Data; | |
| 18 | +import lombok.NoArgsConstructor; | |
| 19 | + | |
| 20 | +import java.util.List; | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * IoT 数据流转规则 DO | |
| 24 | + * | |
| 25 | + * 监听 {@link SourceConfig} 数据源,转发到 {@link IotDataSinkDO} 数据目的 | |
| 26 | + * | |
| 27 | + * @author 芋道源码 | |
| 28 | + */ | |
| 29 | +@TableName(value = "iot_data_rule", autoResultMap = true) | |
| 30 | +@KeySequence("iot_data_rule_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 31 | +@Data | |
| 32 | +@Builder | |
| 33 | +@NoArgsConstructor | |
| 34 | +@AllArgsConstructor | |
| 35 | +public class IotDataRuleDO extends BaseDO { | |
| 36 | + | |
| 37 | + /** | |
| 38 | + * 数据流转规格编号 | |
| 39 | + */ | |
| 40 | + private Long id; | |
| 41 | + /** | |
| 42 | + * 数据流转规格名称 | |
| 43 | + */ | |
| 44 | + private String name; | |
| 45 | + /** | |
| 46 | + * 数据流转规格描述 | |
| 47 | + */ | |
| 48 | + private String description; | |
| 49 | + /** | |
| 50 | + * 数据流转规格状态 | |
| 51 | + * | |
| 52 | + * 枚举 {@link CommonStatusEnum} | |
| 53 | + */ | |
| 54 | + private Integer status; | |
| 55 | + | |
| 56 | + /** | |
| 57 | + * 数据源配置数组 | |
| 58 | + */ | |
| 59 | + @TableField(typeHandler = JacksonTypeHandler.class) | |
| 60 | + private List<SourceConfig> sourceConfigs; | |
| 61 | + /** | |
| 62 | + * 数据目的编号数组 | |
| 63 | + * | |
| 64 | + * 关联 {@link IotDataSinkDO#getId()} | |
| 65 | + */ | |
| 66 | + @TableField(typeHandler = LongListTypeHandler.class) | |
| 67 | + private List<Long> sinkIds; | |
| 68 | + | |
| 69 | + // TODO @芋艿:未来考虑使用 groovy;支持数据处理; | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 数据源配置 | |
| 73 | + */ | |
| 74 | + @Data | |
| 75 | + public static class SourceConfig { | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 消息方法 | |
| 79 | + * | |
| 80 | + * 枚举 {@link IotDeviceMessageMethodEnum} 中的 upstream 上行部分 | |
| 81 | + */ | |
| 82 | + @NotEmpty(message = "消息方法不能为空") | |
| 83 | + private String method; | |
| 84 | + | |
| 85 | + /** | |
| 86 | + * 产品编号 | |
| 87 | + * | |
| 88 | + * 关联 {@link IotProductDO#getId()} | |
| 89 | + */ | |
| 90 | + private Long productId; | |
| 91 | + /** | |
| 92 | + * 设备编号 | |
| 93 | + * | |
| 94 | + * 关联 {@link IotDeviceDO#getId()} | |
| 95 | + * 特殊:如果为 {@link IotDeviceDO#DEVICE_ID_ALL} 时,则是全部设备 | |
| 96 | + */ | |
| 97 | + @NotEmpty(message = "设备编号不能为空") | |
| 98 | + private Long deviceId; | |
| 99 | + | |
| 100 | + /** | |
| 101 | + * 标识符 | |
| 102 | + * | |
| 103 | + * 1. 物模型时,对应:{@link IotThingModelDO#getIdentifier()} | |
| 104 | + */ | |
| 105 | + private String identifier; | |
| 106 | + | |
| 107 | + } | |
| 108 | + | |
| 109 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotDataBridgeDO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotDataSinkDO.java
| ... | ... | @@ -2,66 +2,61 @@ package cn.iocoder.yudao.module.iot.dal.dataobject.rule; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 5 | -import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config.IotDataBridgeAbstractConfig; | |
| 6 | -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeDirectionEnum; | |
| 7 | -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeTypeEnum; | |
| 5 | +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.config.IotAbstractDataSinkConfig; | |
| 6 | +import cn.iocoder.yudao.module.iot.enums.rule.IotDataSinkTypeEnum; | |
| 8 | 7 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 9 | 8 | import com.baomidou.mybatisplus.annotation.TableField; |
| 10 | 9 | import com.baomidou.mybatisplus.annotation.TableId; |
| 11 | 10 | import com.baomidou.mybatisplus.annotation.TableName; |
| 12 | 11 | import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; |
| 13 | -import lombok.*; | |
| 12 | +import lombok.AllArgsConstructor; | |
| 13 | +import lombok.Builder; | |
| 14 | +import lombok.Data; | |
| 15 | +import lombok.NoArgsConstructor; | |
| 14 | 16 | |
| 15 | 17 | /** |
| 16 | - * IoT 数据桥梁 DO | |
| 18 | + * IoT 数据流转目的 DO | |
| 17 | 19 | * |
| 18 | 20 | * @author 芋道源码 |
| 19 | 21 | */ |
| 20 | -@TableName(value = "iot_data_bridge", autoResultMap = true) | |
| 22 | +@TableName(value = "iot_data_sink", autoResultMap = true) | |
| 21 | 23 | @KeySequence("iot_data_bridge_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 |
| 22 | 24 | @Data |
| 23 | 25 | @Builder |
| 24 | 26 | @NoArgsConstructor |
| 25 | 27 | @AllArgsConstructor |
| 26 | -public class IotDataBridgeDO extends BaseDO { | |
| 28 | +public class IotDataSinkDO extends BaseDO { | |
| 27 | 29 | |
| 28 | 30 | /** |
| 29 | - * 桥梁编号 | |
| 31 | + * 数据流转目的编号 | |
| 30 | 32 | */ |
| 31 | 33 | @TableId |
| 32 | 34 | private Long id; |
| 33 | 35 | /** |
| 34 | - * 桥梁名称 | |
| 36 | + * 数据流转目的名称 | |
| 35 | 37 | */ |
| 36 | 38 | private String name; |
| 37 | 39 | /** |
| 38 | - * 桥梁描述 | |
| 40 | + * 数据流转目的描述 | |
| 39 | 41 | */ |
| 40 | 42 | private String description; |
| 41 | 43 | /** |
| 42 | - * 桥梁状态 | |
| 44 | + * 数据流转目的状态 | |
| 43 | 45 | * |
| 44 | - * 枚举 {@link CommonStatusEnum} | |
| 46 | + * 枚举 {@link CommonStatusEnum} | |
| 45 | 47 | */ |
| 46 | 48 | private Integer status; |
| 47 | - /** | |
| 48 | - * 桥梁方向 | |
| 49 | - * | |
| 50 | - * 枚举 {@link IotDataBridgeDirectionEnum} | |
| 51 | - */ | |
| 52 | - private Integer direction; | |
| 53 | 49 | |
| 54 | 50 | /** |
| 55 | - * 桥梁类型 | |
| 51 | + * 数据流转目的类型 | |
| 56 | 52 | * |
| 57 | - * 枚举 {@link IotDataBridgeTypeEnum} | |
| 53 | + * 枚举 {@link IotDataSinkTypeEnum} | |
| 58 | 54 | */ |
| 59 | 55 | private Integer type; |
| 60 | - | |
| 61 | 56 | /** |
| 62 | - * 桥梁配置 | |
| 57 | + * 数据流转目的配置 | |
| 63 | 58 | */ |
| 64 | 59 | @TableField(typeHandler = JacksonTypeHandler.class) |
| 65 | - private IotDataBridgeAbstractConfig config; | |
| 60 | + private IotAbstractDataSinkConfig config; | |
| 66 | 61 | |
| 67 | 62 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotRuleSceneDO.java
| ... | ... | @@ -7,7 +7,7 @@ import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO; |
| 7 | 7 | import cn.iocoder.yudao.module.iot.enums.device.IotDeviceMessageIdentifierEnum; |
| 8 | 8 | import cn.iocoder.yudao.module.iot.enums.device.IotDeviceMessageTypeEnum; |
| 9 | 9 | import cn.iocoder.yudao.module.iot.enums.rule.IotRuleSceneActionTypeEnum; |
| 10 | -import cn.iocoder.yudao.module.iot.enums.rule.IotRuleSceneTriggerConditionParameterOperatorEnum; | |
| 10 | +import cn.iocoder.yudao.module.iot.enums.rule.IotRuleSceneConditionOperatorEnum; | |
| 11 | 11 | import cn.iocoder.yudao.module.iot.enums.rule.IotRuleSceneTriggerTypeEnum; |
| 12 | 12 | import com.baomidou.mybatisplus.annotation.KeySequence; |
| 13 | 13 | import com.baomidou.mybatisplus.annotation.TableField; |
| ... | ... | @@ -22,8 +22,9 @@ import lombok.NoArgsConstructor; |
| 22 | 22 | import java.util.List; |
| 23 | 23 | import java.util.Map; |
| 24 | 24 | |
| 25 | +// TODO @芋艿:优化注释; | |
| 25 | 26 | /** |
| 26 | - * IoT 场景联动 DO | |
| 27 | + * IoT 场景联动规则 DO | |
| 27 | 28 | * |
| 28 | 29 | * @author 芋道源码 |
| 29 | 30 | */ |
| ... | ... | @@ -163,7 +164,7 @@ public class IotRuleSceneDO extends TenantBaseDO { |
| 163 | 164 | /** |
| 164 | 165 | * 操作符 |
| 165 | 166 | * |
| 166 | - * 枚举 {@link IotRuleSceneTriggerConditionParameterOperatorEnum} | |
| 167 | + * 枚举 {@link IotRuleSceneConditionOperatorEnum} | |
| 167 | 168 | */ |
| 168 | 169 | private String operator; |
| 169 | 170 | |
| ... | ... | @@ -171,7 +172,7 @@ public class IotRuleSceneDO extends TenantBaseDO { |
| 171 | 172 | * 比较值 |
| 172 | 173 | * |
| 173 | 174 | * 如果有多个值,则使用 "," 分隔,类似 "1,2,3"。 |
| 174 | - * 例如说,{@link IotRuleSceneTriggerConditionParameterOperatorEnum#IN}、{@link IotRuleSceneTriggerConditionParameterOperatorEnum#BETWEEN} | |
| 175 | + * 例如说,{@link IotRuleSceneConditionOperatorEnum#IN}、{@link IotRuleSceneConditionOperatorEnum#BETWEEN} | |
| 175 | 176 | */ |
| 176 | 177 | private String value; |
| 177 | 178 | |
| ... | ... | @@ -193,18 +194,10 @@ public class IotRuleSceneDO extends TenantBaseDO { |
| 193 | 194 | /** |
| 194 | 195 | * 设备控制 |
| 195 | 196 | * |
| 196 | - * 必填:当 {@link #type} 为 {@link IotRuleSceneActionTypeEnum#DEVICE_CONTROL} 时 | |
| 197 | + * 必填:当 {@link #type} 为 {@link IotRuleSceneActionTypeEnum#DEVICE_PROPERTY_SET} 时 | |
| 197 | 198 | */ |
| 198 | 199 | private ActionDeviceControl deviceControl; |
| 199 | 200 | |
| 200 | - /** | |
| 201 | - * 数据桥接编号 | |
| 202 | - * | |
| 203 | - * 必填:当 {@link #type} 为 {@link IotRuleSceneActionTypeEnum#DATA_BRIDGE} 时 | |
| 204 | - * 关联:{@link IotDataBridgeDO#getId()} | |
| 205 | - */ | |
| 206 | - private Long dataBridgeId; | |
| 207 | - | |
| 208 | 201 | } |
| 209 | 202 | |
| 210 | 203 | /** | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotSceneRuleDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.rule; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | |
| 4 | +import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; | |
| 5 | +import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage; | |
| 6 | +import cn.iocoder.yudao.module.iot.dal.dataobject.alert.IotAlertConfigDO; | |
| 7 | +import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; | |
| 8 | +import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; | |
| 9 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO; | |
| 10 | +import cn.iocoder.yudao.module.iot.enums.rule.IotRuleSceneActionTypeEnum; | |
| 11 | +import cn.iocoder.yudao.module.iot.enums.rule.IotRuleSceneConditionOperatorEnum; | |
| 12 | +import cn.iocoder.yudao.module.iot.enums.rule.IotRuleSceneConditionTypeEnum; | |
| 13 | +import cn.iocoder.yudao.module.iot.enums.rule.IotRuleSceneTriggerTypeEnum; | |
| 14 | +import com.baomidou.mybatisplus.annotation.KeySequence; | |
| 15 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 16 | +import com.baomidou.mybatisplus.annotation.TableId; | |
| 17 | +import com.baomidou.mybatisplus.annotation.TableName; | |
| 18 | +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | |
| 19 | +import lombok.AllArgsConstructor; | |
| 20 | +import lombok.Builder; | |
| 21 | +import lombok.Data; | |
| 22 | +import lombok.NoArgsConstructor; | |
| 23 | + | |
| 24 | +import java.util.List; | |
| 25 | + | |
| 26 | +// TODO @puhui999:还是在 IotRuleSceneDO 里搞,这里主要可以看到变化字段哈。 | |
| 27 | +/** | |
| 28 | + * IoT 场景联动 DO | |
| 29 | + * | |
| 30 | + * 基于 {@link Trigger} 触发 {@link Action} | |
| 31 | + * | |
| 32 | + * @author 芋道源码 | |
| 33 | + */ | |
| 34 | +@TableName(value = "iot_scene_rule", autoResultMap = true) | |
| 35 | +@KeySequence("iot_scene_rule_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | |
| 36 | +@Data | |
| 37 | +@Builder | |
| 38 | +@NoArgsConstructor | |
| 39 | +@AllArgsConstructor | |
| 40 | +public class IotSceneRuleDO extends TenantBaseDO { | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * 场景联动编号 | |
| 44 | + */ | |
| 45 | + @TableId | |
| 46 | + private Long id; | |
| 47 | + /** | |
| 48 | + * 场景联动名称 | |
| 49 | + */ | |
| 50 | + private String name; | |
| 51 | + /** | |
| 52 | + * 场景联动描述 | |
| 53 | + */ | |
| 54 | + private String description; | |
| 55 | + /** | |
| 56 | + * 场景联动状态 | |
| 57 | + * | |
| 58 | + * 枚举 {@link CommonStatusEnum} | |
| 59 | + */ | |
| 60 | + private Integer status; | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * 场景定义配置 | |
| 64 | + */ | |
| 65 | + @TableField(typeHandler = JacksonTypeHandler.class) | |
| 66 | + private List<Trigger> triggers; | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * 场景动作配置 | |
| 70 | + */ | |
| 71 | + @TableField(typeHandler = JacksonTypeHandler.class) | |
| 72 | + private List<Action> actions; | |
| 73 | + | |
| 74 | + /** | |
| 75 | + * 场景定义配置 | |
| 76 | + */ | |
| 77 | + @Data | |
| 78 | + public static class Trigger { | |
| 79 | + | |
| 80 | + // ========== 事件部分 ========== | |
| 81 | + | |
| 82 | + /** | |
| 83 | + * 场景事件类型 | |
| 84 | + * | |
| 85 | + * 枚举 {@link IotRuleSceneTriggerTypeEnum} | |
| 86 | + * 1. {@link IotRuleSceneTriggerTypeEnum#DEVICE_STATE_UPDATE} 时,operator 非空,并且 value 为在线状态 | |
| 87 | + * 2. {@link IotRuleSceneTriggerTypeEnum#DEVICE_PROPERTY_POST} | |
| 88 | + * {@link IotRuleSceneTriggerTypeEnum#DEVICE_EVENT_POST} 时,identifier、operator 非空,并且 value 为属性值 | |
| 89 | + * 3. {@link IotRuleSceneTriggerTypeEnum#DEVICE_EVENT_POST} | |
| 90 | + * {@link IotRuleSceneTriggerTypeEnum#DEVICE_SERVICE_INVOKE} 时,identifier 非空,但是 operator、value 为空 | |
| 91 | + * 4. {@link IotRuleSceneTriggerTypeEnum#TIMER} 时,conditions 非空,并且设备无关(无需 productId、deviceId 字段) | |
| 92 | + */ | |
| 93 | + private Integer type; | |
| 94 | + | |
| 95 | + /** | |
| 96 | + * 产品编号 | |
| 97 | + * | |
| 98 | + * 关联 {@link IotProductDO#getId()} | |
| 99 | + */ | |
| 100 | + private Long productId; | |
| 101 | + /** | |
| 102 | + * 设备编号 | |
| 103 | + * | |
| 104 | + * 关联 {@link IotDeviceDO#getId()} | |
| 105 | + * 特殊:如果为 {@link IotDeviceDO#DEVICE_ID_ALL} 时,则是全部设备 | |
| 106 | + */ | |
| 107 | + private Long deviceId; | |
| 108 | + /** | |
| 109 | + * 物模型标识符 | |
| 110 | + * | |
| 111 | + * 对应:{@link IotThingModelDO#getIdentifier()} | |
| 112 | + */ | |
| 113 | + private String identifier; | |
| 114 | + /** | |
| 115 | + * 操作符 | |
| 116 | + * | |
| 117 | + * 枚举 {@link IotRuleSceneConditionOperatorEnum} | |
| 118 | + */ | |
| 119 | + private String operator; | |
| 120 | + /** | |
| 121 | + * 参数(属性值、在线状态) | |
| 122 | + * | |
| 123 | + * 如果有多个值,则使用 "," 分隔,类似 "1,2,3"。 | |
| 124 | + * 例如说,{@link IotRuleSceneConditionOperatorEnum#IN}、{@link IotRuleSceneConditionOperatorEnum#BETWEEN} | |
| 125 | + */ | |
| 126 | + private String value; | |
| 127 | + | |
| 128 | + /** | |
| 129 | + * CRON 表达式 | |
| 130 | + */ | |
| 131 | + private String cronExpression; | |
| 132 | + | |
| 133 | + // ========== 条件部分 ========== | |
| 134 | + | |
| 135 | + /** | |
| 136 | + * 触发条件分组(状态条件分组)的数组 | |
| 137 | + * | |
| 138 | + * 第一层 List:分组与分组之间,是“或”的关系 | |
| 139 | + * 第二层 List:条件与条件之间,是“且”的关系 | |
| 140 | + */ | |
| 141 | + private List<List<TriggerCondition>> conditionGroups; | |
| 142 | + | |
| 143 | + } | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * 触发条件(状态条件) | |
| 147 | + */ | |
| 148 | + @Data | |
| 149 | + public static class TriggerCondition { | |
| 150 | + | |
| 151 | + /** | |
| 152 | + * 触发条件类型 | |
| 153 | + * | |
| 154 | + * 枚举 {@link IotRuleSceneConditionTypeEnum} | |
| 155 | + * 1. {@link IotRuleSceneConditionTypeEnum#DEVICE_STATE} 时,operator 非空,并且 value 为在线状态 | |
| 156 | + * 2. {@link IotRuleSceneConditionTypeEnum#DEVICE_PROPERTY} 时,identifier、operator 非空,并且 value 为属性值 | |
| 157 | + * 3. {@link IotRuleSceneConditionTypeEnum#CURRENT_TIME} 时,operator 非空(使用 DATE_TIME_ 和 TIME_ 部分),并且 value 非空 | |
| 158 | + */ | |
| 159 | + private Integer type; | |
| 160 | + | |
| 161 | + /** | |
| 162 | + * 产品编号 | |
| 163 | + * | |
| 164 | + * 关联 {@link IotProductDO#getId()} | |
| 165 | + */ | |
| 166 | + private Long productId; | |
| 167 | + /** | |
| 168 | + * 设备编号 | |
| 169 | + * | |
| 170 | + * 关联 {@link IotDeviceDO#getId()} | |
| 171 | + */ | |
| 172 | + private Long deviceId; | |
| 173 | + /** | |
| 174 | + * 标识符(属性) | |
| 175 | + * | |
| 176 | + * 关联 {@link IotThingModelDO#getIdentifier()} | |
| 177 | + */ | |
| 178 | + private String identifier; | |
| 179 | + /** | |
| 180 | + * 操作符 | |
| 181 | + * | |
| 182 | + * 枚举 {@link IotRuleSceneConditionOperatorEnum} | |
| 183 | + */ | |
| 184 | + private String operator; | |
| 185 | + /** | |
| 186 | + * 参数 | |
| 187 | + * | |
| 188 | + * 如果有多个值,则使用 "," 分隔,类似 "1,2,3"。 | |
| 189 | + * 例如说,{@link IotRuleSceneConditionOperatorEnum#IN}、{@link IotRuleSceneConditionOperatorEnum#BETWEEN} | |
| 190 | + */ | |
| 191 | + private String param; | |
| 192 | + | |
| 193 | + } | |
| 194 | + | |
| 195 | + /** | |
| 196 | + * 场景动作配置 | |
| 197 | + */ | |
| 198 | + @Data | |
| 199 | + public static class Action { | |
| 200 | + | |
| 201 | + /** | |
| 202 | + * 执行类型 | |
| 203 | + * | |
| 204 | + * 枚举 {@link IotRuleSceneActionTypeEnum} | |
| 205 | + * 1. {@link IotRuleSceneActionTypeEnum#DEVICE_PROPERTY_SET} 时,params 非空 | |
| 206 | + * {@link IotRuleSceneActionTypeEnum#DEVICE_SERVICE_INVOKE} 时,params 非空 | |
| 207 | + * 2. {@link IotRuleSceneActionTypeEnum#ALERT_TRIGGER} 时,alertConfigId 为空,因为是 {@link IotAlertConfigDO} 里面关联它 | |
| 208 | + * 3. {@link IotRuleSceneActionTypeEnum#ALERT_RECOVER} 时,alertConfigId 非空 | |
| 209 | + */ | |
| 210 | + private Integer type; | |
| 211 | + | |
| 212 | + /** | |
| 213 | + * 产品编号 | |
| 214 | + * | |
| 215 | + * 关联 {@link IotProductDO#getId()} | |
| 216 | + */ | |
| 217 | + private Long productId; | |
| 218 | + /** | |
| 219 | + * 设备编号 | |
| 220 | + * | |
| 221 | + * 关联 {@link IotDeviceDO#getId()} | |
| 222 | + */ | |
| 223 | + private Long deviceId; | |
| 224 | + /** | |
| 225 | + * 请求参数 | |
| 226 | + * | |
| 227 | + * 一般来说,对应 {@link IotDeviceMessage#getParams()} 请求参数 | |
| 228 | + */ | |
| 229 | + private Object params; | |
| 230 | + | |
| 231 | + /** | |
| 232 | + * 告警配置编号 | |
| 233 | + * | |
| 234 | + * 关联 {@link IotAlertConfigDO#getId()} | |
| 235 | + */ | |
| 236 | + private Long alertConfigId; | |
| 237 | + | |
| 238 | + } | |
| 239 | + | |
| 240 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/config/IotDataBridgeAbstractConfig.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/config/IotAbstractDataSinkConfig.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.rule.config; | |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeTypeEnum; | |
| 3 | +import cn.iocoder.yudao.module.iot.enums.rule.IotDataSinkTypeEnum; | |
| 4 | 4 | import com.fasterxml.jackson.annotation.JsonSubTypes; |
| 5 | 5 | import com.fasterxml.jackson.annotation.JsonTypeInfo; |
| 6 | 6 | import lombok.Data; |
| ... | ... | @@ -8,7 +8,7 @@ import lombok.Data; |
| 8 | 8 | /** |
| 9 | 9 | * IoT IotDataBridgeConfig 抽象类 |
| 10 | 10 | * |
| 11 | - * 用于表示数据桥梁配置数据的通用类型,根据具体的 "type" 字段动态映射到对应的子类 | |
| 11 | + * 用于表示数据目的配置数据的通用类型,根据具体的 "type" 字段动态映射到对应的子类 | |
| 12 | 12 | * 提供多态支持,适用于不同类型的数据结构序列化和反序列化场景。 |
| 13 | 13 | * |
| 14 | 14 | * @author HUIHUI |
| ... | ... | @@ -16,19 +16,19 @@ import lombok.Data; |
| 16 | 16 | @Data |
| 17 | 17 | @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", visible = true) |
| 18 | 18 | @JsonSubTypes({ |
| 19 | - @JsonSubTypes.Type(value = IotDataBridgeHttpConfig.class, name = "1"), | |
| 20 | - @JsonSubTypes.Type(value = IotDataBridgeMqttConfig.class, name = "10"), | |
| 21 | - @JsonSubTypes.Type(value = IotDataBridgeRedisStreamConfig.class, name = "21"), | |
| 22 | - @JsonSubTypes.Type(value = IotDataBridgeRocketMQConfig.class, name = "30"), | |
| 23 | - @JsonSubTypes.Type(value = IotDataBridgeRabbitMQConfig.class, name = "31"), | |
| 24 | - @JsonSubTypes.Type(value = IotDataBridgeKafkaMQConfig.class, name = "32"), | |
| 19 | + @JsonSubTypes.Type(value = IotDataSinkHttpConfig.class, name = "1"), | |
| 20 | + @JsonSubTypes.Type(value = IotDataSinkMqttConfig.class, name = "10"), | |
| 21 | + @JsonSubTypes.Type(value = IotDataSinkRedisStreamConfig.class, name = "21"), | |
| 22 | + @JsonSubTypes.Type(value = IotDataSinkRocketMQConfig.class, name = "30"), | |
| 23 | + @JsonSubTypes.Type(value = IotDataSinkRabbitMQConfig.class, name = "31"), | |
| 24 | + @JsonSubTypes.Type(value = IotDataSinkKafkaConfig.class, name = "32"), | |
| 25 | 25 | }) |
| 26 | -public abstract class IotDataBridgeAbstractConfig { | |
| 26 | +public abstract class IotAbstractDataSinkConfig { | |
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * 配置类型 |
| 30 | 30 | * |
| 31 | - * 枚举 {@link IotDataBridgeTypeEnum#getType()} | |
| 31 | + * 枚举 {@link IotDataSinkTypeEnum#getType()} | |
| 32 | 32 | */ |
| 33 | 33 | private String type; |
| 34 | 34 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/config/IotDataBridgeHttpConfig.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/config/IotDataSinkHttpConfig.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.rule.config; | |
| 2 | 2 | |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | 5 | import java.util.Map; |
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | - * IoT HTTP 配置 {@link IotDataBridgeAbstractConfig} 实现类 | |
| 8 | + * IoT HTTP 配置 {@link IotAbstractDataSinkConfig} 实现类 | |
| 9 | 9 | * |
| 10 | 10 | * @author HUIHUI |
| 11 | 11 | */ |
| 12 | 12 | @Data |
| 13 | -public class IotDataBridgeHttpConfig extends IotDataBridgeAbstractConfig { | |
| 13 | +public class IotDataSinkHttpConfig extends IotAbstractDataSinkConfig { | |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | 16 | * 请求 URL | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/config/IotDataBridgeKafkaMQConfig.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/config/IotDataSinkKafkaConfig.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.rule.config; | |
| 2 | 2 | |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * IoT Kafka 配置 {@link IotDataBridgeAbstractConfig} 实现类 | |
| 6 | + * IoT Kafka 配置 {@link IotAbstractDataSinkConfig} 实现类 | |
| 7 | 7 | * |
| 8 | 8 | * @author HUIHUI |
| 9 | 9 | */ |
| 10 | 10 | @Data |
| 11 | -public class IotDataBridgeKafkaMQConfig extends IotDataBridgeAbstractConfig { | |
| 11 | +public class IotDataSinkKafkaConfig extends IotAbstractDataSinkConfig { | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Kafka 服务器地址 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/config/IotDataBridgeMqttConfig.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/config/IotDataSinkMqttConfig.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.rule.config; | |
| 2 | 2 | |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * IoT MQTT 配置 {@link IotDataBridgeAbstractConfig} 实现类 | |
| 6 | + * IoT MQTT 配置 {@link IotAbstractDataSinkConfig} 实现类 | |
| 7 | 7 | * |
| 8 | 8 | * @author HUIHUI |
| 9 | 9 | */ |
| 10 | 10 | @Data |
| 11 | -public class IotDataBridgeMqttConfig extends IotDataBridgeAbstractConfig { | |
| 11 | +public class IotDataSinkMqttConfig extends IotAbstractDataSinkConfig { | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * MQTT 服务器地址 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/config/IotDataBridgeRabbitMQConfig.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/config/IotDataSinkRabbitMQConfig.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.rule.config; | |
| 2 | 2 | |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * IoT RabbitMQ 配置 {@link IotDataBridgeAbstractConfig} 实现类 | |
| 6 | + * IoT RabbitMQ 配置 {@link IotAbstractDataSinkConfig} 实现类 | |
| 7 | 7 | * |
| 8 | 8 | * @author HUIHUI |
| 9 | 9 | */ |
| 10 | 10 | @Data |
| 11 | -public class IotDataBridgeRabbitMQConfig extends IotDataBridgeAbstractConfig { | |
| 11 | +public class IotDataSinkRabbitMQConfig extends IotAbstractDataSinkConfig { | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * RabbitMQ 服务器地址 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/config/IotDataBridgeRedisStreamConfig.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/config/IotDataSinkRedisStreamConfig.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.rule.config; | |
| 2 | 2 | |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * IoT Redis Stream 配置 {@link IotDataBridgeAbstractConfig} 实现类 | |
| 6 | + * IoT Redis Stream 配置 {@link IotAbstractDataSinkConfig} 实现类 | |
| 7 | 7 | * |
| 8 | 8 | * @author HUIHUI |
| 9 | 9 | */ |
| 10 | 10 | @Data |
| 11 | -public class IotDataBridgeRedisStreamConfig extends IotDataBridgeAbstractConfig { | |
| 11 | +public class IotDataSinkRedisStreamConfig extends IotAbstractDataSinkConfig { | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Redis 服务器地址 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/config/IotDataBridgeRocketMQConfig.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/config/IotDataSinkRocketMQConfig.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.rule.config; | |
| 2 | 2 | |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | - * IoT RocketMQ 配置 {@link IotDataBridgeAbstractConfig} 实现类 | |
| 6 | + * IoT RocketMQ 配置 {@link IotAbstractDataSinkConfig} 实现类 | |
| 7 | 7 | * |
| 8 | 8 | * @author HUIHUI |
| 9 | 9 | */ |
| 10 | 10 | @Data |
| 11 | -public class IotDataBridgeRocketMQConfig extends IotDataBridgeAbstractConfig { | |
| 11 | +public class IotDataSinkRocketMQConfig extends IotAbstractDataSinkConfig { | |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * RocketMQ 名称服务器地址 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thingmodel/IotThingModelDO.java
| 1 | 1 | package cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; |
| 4 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelEvent; | |
| 5 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelProperty; | |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.ThingModelService; | |
| 4 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelEvent; | |
| 5 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelProperty; | |
| 6 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.ThingModelService; | |
| 7 | 7 | import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO; |
| 8 | 8 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelTypeEnum; |
| 9 | 9 | import com.baomidou.mybatisplus.annotation.KeySequence; | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/model/ThingModelEvent.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thingmodel/model/ThingModelEvent.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | 4 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelServiceEventTypeEnum; |
| ... | ... | @@ -9,6 +9,7 @@ import lombok.Data; |
| 9 | 9 | |
| 10 | 10 | import java.util.List; |
| 11 | 11 | |
| 12 | +// TODO @puhui999:感觉这个,是不是放到 dal 里会好点?(讨论下,先不改哈) | |
| 12 | 13 | /** |
| 13 | 14 | * IoT 物模型中的事件 |
| 14 | 15 | * | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/model/ThingModelParam.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thingmodel/model/ThingModelParam.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType.ThingModelDataSpecs; | |
| 4 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.dataType.ThingModelDataSpecs; | |
| 5 | 5 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotDataSpecsDataTypeEnum; |
| 6 | 6 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelParamDirectionEnum; |
| 7 | 7 | import jakarta.validation.constraints.NotEmpty; | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/model/ThingModelProperty.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thingmodel/model/ThingModelProperty.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | -import cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType.ThingModelDataSpecs; | |
| 4 | +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.dataType.ThingModelDataSpecs; | |
| 5 | 5 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotDataSpecsDataTypeEnum; |
| 6 | 6 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelAccessModeEnum; |
| 7 | 7 | import jakarta.validation.constraints.NotEmpty; | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/model/ThingModelService.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thingmodel/model/ThingModelService.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | 4 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelServiceCallTypeEnum; | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/model/dataType/ThingModelArrayDataSpecs.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thingmodel/model/dataType/ThingModelArrayDataSpecs.java
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/model/dataType/ThingModelBoolOrEnumDataSpecs.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thingmodel/model/dataType/ThingModelBoolOrEnumDataSpecs.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.dataType; | |
| 2 | 2 | |
| 3 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 4 | 4 | import jakarta.validation.constraints.NotEmpty; |
| ... | ... | @@ -10,7 +10,7 @@ import lombok.EqualsAndHashCode; |
| 10 | 10 | /** |
| 11 | 11 | * IoT 物模型数据类型为布尔型或枚举型的 DataSpec 定义 |
| 12 | 12 | * |
| 13 | - * 数据类型,取值为 bool 或 enum。 | |
| 13 | + * 数据类型,取值为 bool 或 enum | |
| 14 | 14 | * |
| 15 | 15 | * @author HUIHUI |
| 16 | 16 | */ | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/model/dataType/ThingModelDataSpecs.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thingmodel/model/dataType/ThingModelDataSpecs.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.dataType; | |
| 2 | 2 | |
| 3 | 3 | import com.fasterxml.jackson.annotation.JsonSubTypes; |
| 4 | 4 | import com.fasterxml.jackson.annotation.JsonTypeInfo; |
| ... | ... | @@ -7,8 +7,8 @@ import lombok.Data; |
| 7 | 7 | /** |
| 8 | 8 | * IoT ThingModelDataSpecs 抽象类 |
| 9 | 9 | * |
| 10 | - * 用于表示物模型数据的通用类型,根据具体的 "dataType" 字段动态映射到对应的子类。 | |
| 11 | - * 提供多态支持,适用于不同类型的数据结构序列化和反序列化场景。 | |
| 10 | + * 用于表示物模型数据的通用类型,根据具体的 "dataType" 字段动态映射到对应的子类 | |
| 11 | + * 提供多态支持,适用于不同类型的数据结构序列化和反序列化场景 | |
| 12 | 12 | * |
| 13 | 13 | * @author HUIHUI |
| 14 | 14 | */ | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/model/dataType/ThingModelDateOrTextDataSpecs.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thingmodel/model/dataType/ThingModelDateOrTextDataSpecs.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.dataType; | |
| 2 | 2 | |
| 3 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 4 | 4 | import jakarta.validation.constraints.Max; |
| ... | ... | @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; |
| 8 | 8 | /** |
| 9 | 9 | * IoT 物模型数据类型为时间型或文本型的 DataSpec 定义 |
| 10 | 10 | * |
| 11 | - * 数据类型,取值为 date 或 text。 | |
| 11 | + * 数据类型,取值为 date 或 text | |
| 12 | 12 | * |
| 13 | 13 | * @author HUIHUI |
| 14 | 14 | */ |
| ... | ... | @@ -18,13 +18,14 @@ import lombok.EqualsAndHashCode; |
| 18 | 18 | public class ThingModelDateOrTextDataSpecs extends ThingModelDataSpecs { |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - * 数据长度,单位为字节。取值不能超过 2048。 | |
| 22 | - * 当 dataType 为 text 时,需传入该参数。 | |
| 21 | + * 数据长度,单位为字节。取值不能超过 2048 | |
| 22 | + * | |
| 23 | + * 当 dataType 为 text 时,需传入该参数 | |
| 23 | 24 | */ |
| 24 | 25 | @Max(value = 2048, message = "数据长度不能超过 2048") |
| 25 | 26 | private Integer length; |
| 26 | 27 | /** |
| 27 | - * 默认值,可选参数,用于存储默认值。 | |
| 28 | + * 默认值,可选参数,用于存储默认值 | |
| 28 | 29 | */ |
| 29 | 30 | private String defaultValue; |
| 30 | 31 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/model/dataType/ThingModelNumericDataSpec.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thingmodel/model/dataType/ThingModelNumericDataSpec.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.dataType; | |
| 2 | 2 | |
| 3 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 4 | 4 | import jakarta.validation.constraints.NotEmpty; |
| ... | ... | @@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode; |
| 9 | 9 | /** |
| 10 | 10 | * IoT 物模型数据类型为数值的 DataSpec 定义 |
| 11 | 11 | * |
| 12 | - * 数据类型,取值为 int、float 或 double。 | |
| 12 | + * 数据类型,取值为 int、float 或 double | |
| 13 | 13 | * |
| 14 | 14 | * @author HUIHUI |
| 15 | 15 | */ |
| ... | ... | @@ -19,37 +19,37 @@ import lombok.EqualsAndHashCode; |
| 19 | 19 | public class ThingModelNumericDataSpec extends ThingModelDataSpecs { |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | - * 最大值,需转为字符串类型。值必须与 dataType 类型一致。 | |
| 22 | + * 最大值,需转为字符串类型。值必须与 dataType 类型一致 | |
| 23 | 23 | */ |
| 24 | 24 | @NotEmpty(message = "最大值不能为空") |
| 25 | 25 | @Pattern(regexp = "^-?\\d+(\\.\\d+)?$", message = "最大值必须为数值类型") |
| 26 | 26 | private String max; |
| 27 | 27 | /** |
| 28 | - * 最小值,需转为字符串类型。值必须与 dataType 类型一致。 | |
| 28 | + * 最小值,需转为字符串类型。值必须与 dataType 类型一致 | |
| 29 | 29 | */ |
| 30 | 30 | @NotEmpty(message = "最小值不能为空") |
| 31 | 31 | @Pattern(regexp = "^-?\\d+(\\.\\d+)?$", message = "最小值必须为数值类型") |
| 32 | 32 | private String min; |
| 33 | 33 | /** |
| 34 | - * 步长,需转为字符串类型。值必须与 dataType 类型一致。 | |
| 34 | + * 步长,需转为字符串类型。值必须与 dataType 类型一致 | |
| 35 | 35 | */ |
| 36 | 36 | @NotEmpty(message = "步长不能为空") |
| 37 | 37 | @Pattern(regexp = "^-?\\d+(\\.\\d+)?$", message = "步长必须为数值类型") |
| 38 | 38 | private String step; |
| 39 | 39 | /** |
| 40 | - * 精度。当 dataType 为 float 或 double 时可选传入。 | |
| 40 | + * 精度。当 dataType 为 float 或 double 时可选传入 | |
| 41 | 41 | */ |
| 42 | 42 | private String precise; |
| 43 | 43 | /** |
| 44 | - * 默认值,可传入用于存储的默认值。 | |
| 44 | + * 默认值,可传入用于存储的默认值 | |
| 45 | 45 | */ |
| 46 | 46 | private String defaultValue; |
| 47 | 47 | /** |
| 48 | - * 单位的符号。 | |
| 48 | + * 单位的符号 | |
| 49 | 49 | */ |
| 50 | 50 | private String unit; |
| 51 | 51 | /** |
| 52 | - * 单位的名称。 | |
| 52 | + * 单位的名称 | |
| 53 | 53 | */ |
| 54 | 54 | private String unitName; |
| 55 | 55 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/thingmodel/model/dataType/ThingModelStructDataSpecs.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/thingmodel/model/dataType/ThingModelStructDataSpecs.java
| 1 | -package cn.iocoder.yudao.module.iot.controller.admin.thingmodel.model.dataType; | |
| 1 | +package cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.model.dataType; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.validation.InEnum; |
| 4 | 4 | import cn.iocoder.yudao.module.iot.enums.thingmodel.IotThingModelAccessModeEnum; | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/alert/IotAlertConfigMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.dal.mysql.alert; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.alert.vo.config.IotAlertConfigPageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.iot.dal.dataobject.alert.IotAlertConfigDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * IoT 告警配置 Mapper | |
| 15 | + * | |
| 16 | + * @author 芋道源码 | |
| 17 | + */ | |
| 18 | +@Mapper | |
| 19 | +public interface IotAlertConfigMapper extends BaseMapperX<IotAlertConfigDO> { | |
| 20 | + | |
| 21 | + default PageResult<IotAlertConfigDO> selectPage(IotAlertConfigPageReqVO reqVO) { | |
| 22 | + return selectPage(reqVO, new LambdaQueryWrapperX<IotAlertConfigDO>() | |
| 23 | + .likeIfPresent(IotAlertConfigDO::getName, reqVO.getName()) | |
| 24 | + .eqIfPresent(IotAlertConfigDO::getStatus, reqVO.getStatus()) | |
| 25 | + .betweenIfPresent(IotAlertConfigDO::getCreateTime, reqVO.getCreateTime()) | |
| 26 | + .orderByDesc(IotAlertConfigDO::getId)); | |
| 27 | + } | |
| 28 | + | |
| 29 | + default List<IotAlertConfigDO> selectListByStatus(Integer status) { | |
| 30 | + return selectList(IotAlertConfigDO::getStatus, status); | |
| 31 | + } | |
| 32 | + | |
| 33 | + default List<IotAlertConfigDO> selectListBySceneRuleIdAndStatus(Long sceneRuleId, Integer status) { | |
| 34 | + return selectList(new LambdaQueryWrapperX<IotAlertConfigDO>() | |
| 35 | + .eq(IotAlertConfigDO::getStatus, status) | |
| 36 | + .apply(MyBatisUtils.findInSet("scene_rule_id", sceneRuleId))); | |
| 37 | + } | |
| 38 | + | |
| 39 | +} | |
| 0 | 40 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/alert/IotAlertRecordMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.dal.mysql.alert; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.alert.vo.recrod.IotAlertRecordPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.iot.dal.dataobject.alert.IotAlertRecordDO; | |
| 8 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | + | |
| 11 | +import java.util.Collection; | |
| 12 | +import java.util.List; | |
| 13 | + | |
| 14 | +/** | |
| 15 | + * IoT 告警记录 Mapper | |
| 16 | + * | |
| 17 | + * @author 芋道源码 | |
| 18 | + */ | |
| 19 | +@Mapper | |
| 20 | +public interface IotAlertRecordMapper extends BaseMapperX<IotAlertRecordDO> { | |
| 21 | + | |
| 22 | + default PageResult<IotAlertRecordDO> selectPage(IotAlertRecordPageReqVO reqVO) { | |
| 23 | + return selectPage(reqVO, new LambdaQueryWrapperX<IotAlertRecordDO>() | |
| 24 | + .eqIfPresent(IotAlertRecordDO::getConfigId, reqVO.getConfigId()) | |
| 25 | + .eqIfPresent(IotAlertRecordDO::getConfigLevel, reqVO.getLevel()) | |
| 26 | + .eqIfPresent(IotAlertRecordDO::getProductId, reqVO.getProductId()) | |
| 27 | + .eqIfPresent(IotAlertRecordDO::getDeviceId, reqVO.getDeviceId()) | |
| 28 | + .eqIfPresent(IotAlertRecordDO::getProcessStatus, reqVO.getProcessStatus()) | |
| 29 | + .betweenIfPresent(IotAlertRecordDO::getCreateTime, reqVO.getCreateTime()) | |
| 30 | + .orderByDesc(IotAlertRecordDO::getId)); | |
| 31 | + } | |
| 32 | + | |
| 33 | + default List<IotAlertRecordDO> selectListBySceneRuleId(Long sceneRuleId, Long deviceId, Boolean processStatus) { | |
| 34 | + return selectList(new LambdaQueryWrapperX<IotAlertRecordDO>() | |
| 35 | + .eq(IotAlertRecordDO::getSceneRuleId, sceneRuleId) | |
| 36 | + .eqIfPresent(IotAlertRecordDO::getDeviceId, deviceId) | |
| 37 | + .eqIfPresent(IotAlertRecordDO::getProcessStatus, processStatus) | |
| 38 | + .orderByDesc(IotAlertRecordDO::getId)); | |
| 39 | + } | |
| 40 | + | |
| 41 | + default int updateList(Collection<Long> ids, IotAlertRecordDO updateObj) { | |
| 42 | + return update(updateObj, new LambdaUpdateWrapper<IotAlertRecordDO>() | |
| 43 | + .in(IotAlertRecordDO::getId, ids)); | |
| 44 | + } | |
| 45 | + | |
| 46 | +} | |
| 0 | 47 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/device/IotDeviceMapper.java
| ... | ... | @@ -6,13 +6,15 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 6 | 6 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 7 | 7 | import cn.iocoder.yudao.module.iot.controller.admin.device.vo.device.IotDevicePageReqVO; |
| 8 | 8 | import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO; |
| 9 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |
| 10 | +import jakarta.annotation.Nullable; | |
| 9 | 11 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 12 | |
| 11 | -import javax.annotation.Nullable; | |
| 12 | 13 | import java.time.LocalDateTime; |
| 13 | 14 | import java.util.Collection; |
| 14 | 15 | import java.util.List; |
| 15 | 16 | import java.util.Map; |
| 17 | +import java.util.stream.Collectors; | |
| 16 | 18 | |
| 17 | 19 | /** |
| 18 | 20 | * IoT 设备 Mapper |
| ... | ... | @@ -50,8 +52,11 @@ public interface IotDeviceMapper extends BaseMapperX<IotDeviceDO> { |
| 50 | 52 | return selectCount(IotDeviceDO::getProductId, productId); |
| 51 | 53 | } |
| 52 | 54 | |
| 53 | - default List<IotDeviceDO> selectListByDeviceType(Integer deviceType) { | |
| 54 | - return selectList(IotDeviceDO::getDeviceType, deviceType); | |
| 55 | + default List<IotDeviceDO> selectListByCondition(@Nullable Integer deviceType, | |
| 56 | + @Nullable Long productId) { | |
| 57 | + return selectList(new LambdaQueryWrapperX<IotDeviceDO>() | |
| 58 | + .eqIfPresent(IotDeviceDO::getDeviceType, deviceType) | |
| 59 | + .eqIfPresent(IotDeviceDO::getProductId, productId)); | |
| 55 | 60 | } |
| 56 | 61 | |
| 57 | 62 | default List<IotDeviceDO> selectListByState(Integer state) { |
| ... | ... | @@ -78,20 +83,38 @@ public interface IotDeviceMapper extends BaseMapperX<IotDeviceDO> { |
| 78 | 83 | .in(IotDeviceDO::getDeviceName, deviceNames)); |
| 79 | 84 | } |
| 80 | 85 | |
| 86 | + default IotDeviceDO selectBySerialNumber(String serialNumber) { | |
| 87 | + return selectOne(IotDeviceDO::getSerialNumber, serialNumber); | |
| 88 | + } | |
| 89 | + | |
| 81 | 90 | /** |
| 82 | - * 查询指定产品下各状态的设备数量 | |
| 91 | + * 查询指定产品下的设备数量 | |
| 83 | 92 | * |
| 84 | - * @return 设备数量统计列表 | |
| 93 | + * @return 产品编号 -> 设备数量的映射 | |
| 85 | 94 | */ |
| 86 | - // TODO @super:通过 mybatis-plus 来写哈,然后返回 Map 貌似就行了?! | |
| 87 | - List<Map<String, Object>> selectDeviceCountMapByProductId(); | |
| 95 | + default Map<Long, Integer> selectDeviceCountMapByProductId() { | |
| 96 | + List<Map<String, Object>> result = selectMaps(new QueryWrapper<IotDeviceDO>() | |
| 97 | + .select("product_id AS productId", "COUNT(1) AS deviceCount") | |
| 98 | + .groupBy("product_id")); | |
| 99 | + return result.stream().collect(Collectors.toMap( | |
| 100 | + map -> Long.valueOf(map.get("productId").toString()), | |
| 101 | + map -> Integer.valueOf(map.get("deviceCount").toString()) | |
| 102 | + )); | |
| 103 | + } | |
| 88 | 104 | |
| 89 | - // TODO @super:通过 mybatis-plus 来写哈,然后返回 Map 貌似就行了?! | |
| 90 | 105 | /** |
| 91 | 106 | * 查询各个状态下的设备数量 |
| 92 | 107 | * |
| 93 | - * @return 设备数量统计列表 | |
| 108 | + * @return 设备状态 -> 设备数量的映射 | |
| 94 | 109 | */ |
| 95 | - List<Map<String, Object>> selectDeviceCountGroupByState(); | |
| 110 | + default Map<Integer, Long> selectDeviceCountGroupByState() { | |
| 111 | + List<Map<String, Object>> result = selectMaps(new QueryWrapper<IotDeviceDO>() | |
| 112 | + .select("state", "COUNT(1) AS deviceCount") | |
| 113 | + .groupBy("state")); | |
| 114 | + return result.stream().collect(Collectors.toMap( | |
| 115 | + map -> Integer.valueOf(map.get("state").toString()), | |
| 116 | + map -> Long.valueOf(map.get("deviceCount").toString()) | |
| 117 | + )); | |
| 118 | + } | |
| 96 | 119 | |
| 97 | 120 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/ota/IotOtaFirmwareMapper.java
| ... | ... | @@ -7,34 +7,19 @@ import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.firmware.IotOtaFirmwa |
| 7 | 7 | import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaFirmwareDO; |
| 8 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -// TODO @li:参考 IotOtaUpgradeRecordMapper 的写法 | |
| 13 | 10 | @Mapper |
| 14 | 11 | public interface IotOtaFirmwareMapper extends BaseMapperX<IotOtaFirmwareDO> { |
| 15 | 12 | |
| 16 | - /** | |
| 17 | - * 根据产品ID和固件版本号查询固件信息列表。 | |
| 18 | - * | |
| 19 | - * @param productId 产品ID,用于筛选固件信息。 | |
| 20 | - * @param version 固件版本号,用于筛选固件信息。 | |
| 21 | - * @return 返回符合条件的固件信息列表。 | |
| 22 | - */ | |
| 23 | - default List<IotOtaFirmwareDO> selectByProductIdAndVersion(String productId, String version) { | |
| 24 | - return selectList(IotOtaFirmwareDO::getProductId, productId, | |
| 13 | + default IotOtaFirmwareDO selectByProductIdAndVersion(Long productId, String version) { | |
| 14 | + return selectOne(IotOtaFirmwareDO::getProductId, productId, | |
| 25 | 15 | IotOtaFirmwareDO::getVersion, version); |
| 26 | 16 | } |
| 27 | 17 | |
| 28 | - /** | |
| 29 | - * 分页查询固件信息,支持根据名称和产品ID进行筛选,并按创建时间降序排列。 | |
| 30 | - * | |
| 31 | - * @param pageReqVO 分页查询请求对象,包含分页参数和筛选条件。 | |
| 32 | - * @return 返回分页查询结果,包含符合条件的固件信息列表。 | |
| 33 | - */ | |
| 34 | 18 | default PageResult<IotOtaFirmwareDO> selectPage(IotOtaFirmwarePageReqVO pageReqVO) { |
| 35 | 19 | return selectPage(pageReqVO, new LambdaQueryWrapperX<IotOtaFirmwareDO>() |
| 36 | 20 | .likeIfPresent(IotOtaFirmwareDO::getName, pageReqVO.getName()) |
| 37 | 21 | .eqIfPresent(IotOtaFirmwareDO::getProductId, pageReqVO.getProductId()) |
| 22 | + .betweenIfPresent(IotOtaFirmwareDO::getCreateTime, pageReqVO.getCreateTime()) | |
| 38 | 23 | .orderByDesc(IotOtaFirmwareDO::getCreateTime)); |
| 39 | 24 | } |
| 40 | 25 | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/ota/IotOtaTaskMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.dal.mysql.ota; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task.IotOtaTaskPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaTaskDO; | |
| 8 | +import org.apache.ibatis.annotations.Mapper; | |
| 9 | + | |
| 10 | +@Mapper | |
| 11 | +public interface IotOtaTaskMapper extends BaseMapperX<IotOtaTaskDO> { | |
| 12 | + | |
| 13 | + default IotOtaTaskDO selectByFirmwareIdAndName(Long firmwareId, String name) { | |
| 14 | + return selectOne(IotOtaTaskDO::getFirmwareId, firmwareId, | |
| 15 | + IotOtaTaskDO::getName, name); | |
| 16 | + } | |
| 17 | + | |
| 18 | + default PageResult<IotOtaTaskDO> selectUpgradeTaskPage(IotOtaTaskPageReqVO pageReqVO) { | |
| 19 | + return selectPage(pageReqVO, new LambdaQueryWrapperX<IotOtaTaskDO>() | |
| 20 | + .eqIfPresent(IotOtaTaskDO::getFirmwareId, pageReqVO.getFirmwareId()) | |
| 21 | + .likeIfPresent(IotOtaTaskDO::getName, pageReqVO.getName())); | |
| 22 | + } | |
| 23 | + | |
| 24 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/ota/IotOtaTaskRecordMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.dal.mysql.ota; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.task.record.IotOtaTaskRecordPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaTaskRecordDO; | |
| 8 | +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | +import java.util.Set; | |
| 13 | + | |
| 14 | +@Mapper | |
| 15 | +public interface IotOtaTaskRecordMapper extends BaseMapperX<IotOtaTaskRecordDO> { | |
| 16 | + | |
| 17 | + default List<IotOtaTaskRecordDO> selectListByFirmwareIdAndTaskId(Long firmwareId, Long taskId) { | |
| 18 | + return selectList(new LambdaQueryWrapperX<IotOtaTaskRecordDO>() | |
| 19 | + .eqIfPresent(IotOtaTaskRecordDO::getFirmwareId, firmwareId) | |
| 20 | + .eqIfPresent(IotOtaTaskRecordDO::getTaskId, taskId) | |
| 21 | + .select(IotOtaTaskRecordDO::getDeviceId, IotOtaTaskRecordDO::getStatus)); | |
| 22 | + } | |
| 23 | + | |
| 24 | + default PageResult<IotOtaTaskRecordDO> selectPage(IotOtaTaskRecordPageReqVO pageReqVO) { | |
| 25 | + return selectPage(pageReqVO, new LambdaQueryWrapperX<IotOtaTaskRecordDO>() | |
| 26 | + .eqIfPresent(IotOtaTaskRecordDO::getTaskId, pageReqVO.getTaskId()) | |
| 27 | + .eqIfPresent(IotOtaTaskRecordDO::getStatus, pageReqVO.getStatus())); | |
| 28 | + } | |
| 29 | + | |
| 30 | + default void updateByTaskIdAndStatus(Long taskId, Integer fromStatus, IotOtaTaskRecordDO updateRecord) { | |
| 31 | + update(updateRecord, new LambdaUpdateWrapper<IotOtaTaskRecordDO>() | |
| 32 | + .eq(IotOtaTaskRecordDO::getTaskId, taskId) | |
| 33 | + .eq(IotOtaTaskRecordDO::getStatus, fromStatus)); | |
| 34 | + } | |
| 35 | + | |
| 36 | + default List<IotOtaTaskRecordDO> selectListByDeviceIdAndStatus(Set<Long> deviceIds, Set<Integer> statuses) { | |
| 37 | + return selectList(new LambdaQueryWrapperX<IotOtaTaskRecordDO>() | |
| 38 | + .inIfPresent(IotOtaTaskRecordDO::getDeviceId, deviceIds) | |
| 39 | + .inIfPresent(IotOtaTaskRecordDO::getStatus, statuses)); | |
| 40 | + } | |
| 41 | + | |
| 42 | +} | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/ota/IotOtaUpgradeRecordMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.dal.mysql.ota; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.record.IotOtaUpgradeRecordPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaUpgradeRecordDO; | |
| 8 | -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |
| 9 | -import org.apache.ibatis.annotations.Mapper; | |
| 10 | -import org.apache.ibatis.annotations.Param; | |
| 11 | -import org.apache.ibatis.annotations.Select; | |
| 12 | - | |
| 13 | -import java.util.List; | |
| 14 | -import java.util.Map; | |
| 15 | - | |
| 16 | -@Mapper | |
| 17 | -public interface IotOtaUpgradeRecordMapper extends BaseMapperX<IotOtaUpgradeRecordDO> { | |
| 18 | - | |
| 19 | - // TODO @li:selectByFirmwareIdAndTaskIdAndDeviceId;让方法自解释 | |
| 20 | - /** | |
| 21 | - * 根据条件查询单个OTA升级记录 | |
| 22 | - * | |
| 23 | - * @param firmwareId 固件ID,可选参数,用于筛选固件ID匹配的记录 | |
| 24 | - * @param taskId 任务ID,可选参数,用于筛选任务ID匹配的记录 | |
| 25 | - * @param deviceId 设备ID,可选参数,用于筛选设备ID匹配的记录 | |
| 26 | - * @return 返回符合条件的单个OTA升级记录,如果不存在则返回null | |
| 27 | - */ | |
| 28 | - default IotOtaUpgradeRecordDO selectByConditions(Long firmwareId, Long taskId, String deviceId) { | |
| 29 | - // 使用LambdaQueryWrapperX构建查询条件,根据传入的参数动态添加查询条件 | |
| 30 | - return selectOne(new LambdaQueryWrapperX<IotOtaUpgradeRecordDO>() | |
| 31 | - .eqIfPresent(IotOtaUpgradeRecordDO::getFirmwareId, firmwareId) | |
| 32 | - .eqIfPresent(IotOtaUpgradeRecordDO::getTaskId, taskId) | |
| 33 | - .eqIfPresent(IotOtaUpgradeRecordDO::getDeviceId, deviceId)); | |
| 34 | - } | |
| 35 | - | |
| 36 | - // TODO @li:这个是不是 groupby status 就 ok 拉? | |
| 37 | - /** | |
| 38 | - * 根据任务ID和设备名称查询OTA升级记录的状态统计信息。 | |
| 39 | - * 该函数通过SQL查询统计不同状态(0到5)的记录数量,并返回一个包含统计结果的Map列表。 | |
| 40 | - * | |
| 41 | - * @param taskId 任务ID,用于筛选特定任务的OTA升级记录。 | |
| 42 | - * @param deviceName 设备名称,支持模糊查询,用于筛选特定设备的OTA升级记录。 | |
| 43 | - * @return 返回一个Map列表,每个Map包含不同状态(0到5)的记录数量。 | |
| 44 | - */ | |
| 45 | - @Select("select count(case when status = 0 then 1 else 0) as `0` " + | |
| 46 | - "count(case when status = 1 then 1 else 0) as `1` " + | |
| 47 | - "count(case when status = 2 then 1 else 0) as `2` " + | |
| 48 | - "count(case when status = 3 then 1 else 0) as `3` " + | |
| 49 | - "count(case when status = 4 then 1 else 0) as `4` " + | |
| 50 | - "count(case when status = 5 then 1 else 0) as `5` " + | |
| 51 | - "from iot_ota_upgrade_record " + | |
| 52 | - "where task_id = #{taskId} " + | |
| 53 | - "and device_name like concat('%', #{deviceName}, '%') " + | |
| 54 | - "and status = #{status}") | |
| 55 | - List<Map<String, Object>> selectOtaUpgradeRecordCount(@Param("taskId") Long taskId, | |
| 56 | - @Param("deviceName") String deviceName); | |
| 57 | - | |
| 58 | - /** | |
| 59 | - * 根据固件ID查询OTA升级记录的状态统计信息。 | |
| 60 | - * 该函数通过SQL查询统计不同状态(0到5)的记录数量,并返回一个包含统计结果的Map列表。 | |
| 61 | - * | |
| 62 | - * @param firmwareId 固件ID,用于筛选特定固件的OTA升级记录。 | |
| 63 | - * @return 返回一个Map列表,每个Map包含不同状态(0到5)的记录数量。 | |
| 64 | - */ | |
| 65 | - @Select("select count(case when status = 0 then 1 else 0) as `0` " + | |
| 66 | - "count(case when status = 1 then 1 else 0) as `1` " + | |
| 67 | - "count(case when status = 2 then 1 else 0) as `2` " + | |
| 68 | - "count(case when status = 3 then 1 else 0) as `3` " + | |
| 69 | - "count(case when status = 4 then 1 else 0) as `4` " + | |
| 70 | - "count(case when status = 5 then 1 else 0) as `5` " + | |
| 71 | - "from iot_ota_upgrade_record " + | |
| 72 | - "where firmware_id = #{firmwareId}") | |
| 73 | - List<Map<String, Object>> selectOtaUpgradeRecordStatistics(Long firmwareId); | |
| 74 | - | |
| 75 | - // TODO @li:这里的注释,可以去掉哈 | |
| 76 | - /** | |
| 77 | - * 根据分页查询条件获取 OTA升级记录的分页结果 | |
| 78 | - * | |
| 79 | - * @param pageReqVO 分页查询请求参数,包含设备名称、任务ID等查询条件 | |
| 80 | - * @return 返回分页查询结果,包含符合条件的 OTA升级记录列表 | |
| 81 | - */ | |
| 82 | - // TODO @li:selectPage 就 ok 拉。 | |
| 83 | - default PageResult<IotOtaUpgradeRecordDO> selectUpgradeRecordPage(IotOtaUpgradeRecordPageReqVO pageReqVO) { | |
| 84 | - // TODO @li:这里的注释,可以去掉哈;然后下面的“如果”。。。也没必要注释 | |
| 85 | - // 使用LambdaQueryWrapperX构建查询条件,并根据请求参数动态添加查询条件 | |
| 86 | - return selectPage(pageReqVO, new LambdaQueryWrapperX<IotOtaUpgradeRecordDO>() | |
| 87 | - .likeIfPresent(IotOtaUpgradeRecordDO::getDeviceName, pageReqVO.getDeviceName()) // 如果设备名称存在,则添加模糊查询条件 | |
| 88 | - .eqIfPresent(IotOtaUpgradeRecordDO::getTaskId, pageReqVO.getTaskId())); // 如果任务ID存在,则添加等值查询条件 | |
| 89 | - } | |
| 90 | - | |
| 91 | - // TODO @li:这里的注释,可以去掉哈 | |
| 92 | - /** | |
| 93 | - * 根据任务ID和状态更新升级记录的状态 | |
| 94 | - * <p> | |
| 95 | - * 该函数用于将符合指定任务ID和状态的升级记录的状态更新为新的状态。 | |
| 96 | - * | |
| 97 | - * @param setStatus 要设置的新状态值,类型为Integer | |
| 98 | - * @param taskId 要更新的升级记录对应的任务ID,类型为Long | |
| 99 | - * @param whereStatus 用于筛选升级记录的当前状态值,类型为Integer | |
| 100 | - */ | |
| 101 | - // TODO @li:改成 updateByTaskIdAndStatus(taskId, status, IotOtaUpgradeRecordDO) 更通用一些。 | |
| 102 | - default void updateUpgradeRecordStatusByTaskIdAndStatus(Integer setStatus, Long taskId, Integer whereStatus) { | |
| 103 | - // 使用LambdaUpdateWrapper构建更新条件,将指定状态的记录更新为指定状态 | |
| 104 | - update(new LambdaUpdateWrapper<IotOtaUpgradeRecordDO>() | |
| 105 | - .set(IotOtaUpgradeRecordDO::getStatus, setStatus) | |
| 106 | - .eq(IotOtaUpgradeRecordDO::getTaskId, taskId) | |
| 107 | - .eq(IotOtaUpgradeRecordDO::getStatus, whereStatus) | |
| 108 | - ); | |
| 109 | - } | |
| 110 | - | |
| 111 | - // TODO @li:参考上面的建议,调整下这个方法 | |
| 112 | - /** | |
| 113 | - * 根据状态查询符合条件的升级记录列表 | |
| 114 | - * <p> | |
| 115 | - * 该函数使用LambdaQueryWrapperX构建查询条件,查询指定状态的升级记录。 | |
| 116 | - * | |
| 117 | - * @param state 升级记录的状态,用于筛选符合条件的记录 | |
| 118 | - * @return 返回符合指定状态的升级记录列表,类型为List<IotOtaUpgradeRecordDO> | |
| 119 | - */ | |
| 120 | - default List<IotOtaUpgradeRecordDO> selectUpgradeRecordListByState(Integer state) { | |
| 121 | - // 使用LambdaQueryWrapperX构建查询条件,根据状态查询符合条件的升级记录 | |
| 122 | - return selectList(new LambdaQueryWrapperX<IotOtaUpgradeRecordDO>() | |
| 123 | - .eq(IotOtaUpgradeRecordDO::getStatus, state)); | |
| 124 | - } | |
| 125 | - | |
| 126 | - // TODO @li:参考上面的建议,调整下这个方法 | |
| 127 | - /** | |
| 128 | - * 更新升级记录状态 | |
| 129 | - * <p> | |
| 130 | - * 该函数用于批量更新指定ID列表中的升级记录状态。通过传入的ID列表和状态值,使用LambdaUpdateWrapper构建更新条件, | |
| 131 | - * 并执行更新操作。 | |
| 132 | - * | |
| 133 | - * @param ids 需要更新的升级记录ID列表,类型为List<Long>。传入的ID列表中的记录将被更新。 | |
| 134 | - * @param status 要更新的状态值,类型为Integer。该值将被设置到符合条件的升级记录中。 | |
| 135 | - */ | |
| 136 | - default void updateUpgradeRecordStatus(List<Long> ids, Integer status) { | |
| 137 | - // 使用LambdaUpdateWrapper构建更新条件,设置状态字段,并根据ID列表进行筛选 | |
| 138 | - update(new LambdaUpdateWrapper<IotOtaUpgradeRecordDO>() | |
| 139 | - .set(IotOtaUpgradeRecordDO::getStatus, status) | |
| 140 | - .in(IotOtaUpgradeRecordDO::getId, ids) | |
| 141 | - ); | |
| 142 | - } | |
| 143 | - | |
| 144 | - // TODO @li:参考上面的建议,调整下这个方法 | |
| 145 | - /** | |
| 146 | - * 根据任务ID查询升级记录列表 | |
| 147 | - * <p> | |
| 148 | - * 该函数通过任务ID查询符合条件的升级记录,并返回查询结果列表。 | |
| 149 | - * | |
| 150 | - * @param taskId 任务ID,用于筛选升级记录 | |
| 151 | - * @return 返回符合条件的升级记录列表,若未找到则返回空列表 | |
| 152 | - */ | |
| 153 | - default List<IotOtaUpgradeRecordDO> selectUpgradeRecordListByTaskId(Long taskId) { | |
| 154 | - // 使用LambdaQueryWrapperX构建查询条件,根据任务ID查询符合条件的升级记录 | |
| 155 | - return selectList(new LambdaQueryWrapperX<IotOtaUpgradeRecordDO>() | |
| 156 | - .eq(IotOtaUpgradeRecordDO::getTaskId, taskId)); | |
| 157 | - } | |
| 158 | - | |
| 159 | -} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/ota/IotOtaUpgradeTaskMapper.java deleted
| 1 | -package cn.iocoder.yudao.module.iot.dal.mysql.ota; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.ota.vo.upgrade.task.IotOtaUpgradeTaskPageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.iot.dal.dataobject.ota.IotOtaUpgradeTaskDO; | |
| 8 | -import org.apache.ibatis.annotations.Mapper; | |
| 9 | - | |
| 10 | -import java.util.List; | |
| 11 | - | |
| 12 | -/** | |
| 13 | - * OTA 升级任务Mapper | |
| 14 | - * | |
| 15 | - * @author Shelly | |
| 16 | - */ | |
| 17 | -@Mapper | |
| 18 | -public interface IotOtaUpgradeTaskMapper extends BaseMapperX<IotOtaUpgradeTaskDO> { | |
| 19 | - | |
| 20 | - /** | |
| 21 | - * 根据固件ID和任务名称查询升级任务列表。 | |
| 22 | - * | |
| 23 | - * @param firmwareId 固件ID,用于筛选升级任务 | |
| 24 | - * @param name 任务名称,用于筛选升级任务 | |
| 25 | - * @return 符合条件的升级任务列表 | |
| 26 | - */ | |
| 27 | - default List<IotOtaUpgradeTaskDO> selectByFirmwareIdAndName(Long firmwareId, String name) { | |
| 28 | - return selectList(new LambdaQueryWrapperX<IotOtaUpgradeTaskDO>() | |
| 29 | - .eqIfPresent(IotOtaUpgradeTaskDO::getFirmwareId, firmwareId) | |
| 30 | - .eqIfPresent(IotOtaUpgradeTaskDO::getName, name)); | |
| 31 | - } | |
| 32 | - | |
| 33 | - /** | |
| 34 | - * 分页查询升级任务列表,支持根据固件ID和任务名称进行筛选。 | |
| 35 | - * | |
| 36 | - * @param pageReqVO 分页查询请求对象,包含分页参数和筛选条件 | |
| 37 | - * @return 分页结果,包含符合条件的升级任务列表 | |
| 38 | - */ | |
| 39 | - default PageResult<IotOtaUpgradeTaskDO> selectUpgradeTaskPage(IotOtaUpgradeTaskPageReqVO pageReqVO) { | |
| 40 | - return selectPage(pageReqVO, new LambdaQueryWrapperX<IotOtaUpgradeTaskDO>() | |
| 41 | - .eqIfPresent(IotOtaUpgradeTaskDO::getFirmwareId, pageReqVO.getFirmwareId()) | |
| 42 | - .likeIfPresent(IotOtaUpgradeTaskDO::getName, pageReqVO.getName())); | |
| 43 | - } | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * 根据任务状态查询升级任务列表 | |
| 47 | - * <p> | |
| 48 | - * 该函数通过传入的任务状态,查询数据库中符合条件的升级任务列表。 | |
| 49 | - * | |
| 50 | - * @param status 任务状态,用于筛选升级任务的状态值 | |
| 51 | - * @return 返回符合条件的升级任务列表,列表中的每个元素为 IotOtaUpgradeTaskDO 对象 | |
| 52 | - */ | |
| 53 | - default List<IotOtaUpgradeTaskDO> selectUpgradeTaskByState(Integer status) { | |
| 54 | - return selectList(IotOtaUpgradeTaskDO::getStatus, status); | |
| 55 | - } | |
| 56 | - | |
| 57 | -} |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/rule/IotDataRuleMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.iot.dal.mysql.rule; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | |
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | |
| 6 | +import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils; | |
| 7 | +import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.rule.IotDataRulePageReqVO; | |
| 8 | +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleDO; | |
| 9 | +import org.apache.ibatis.annotations.Mapper; | |
| 10 | + | |
| 11 | +import java.util.List; | |
| 12 | + | |
| 13 | +/** | |
| 14 | + * IoT 数据流转规则 Mapper | |
| 15 | + * | |
| 16 | + * @author 芋道源码 | |
| 17 | + */ | |
| 18 | +@Mapper | |
| 19 | +public interface IotDataRuleMapper extends BaseMapperX<IotDataRuleDO> { | |
| 20 | + | |
| 21 | + default PageResult<IotDataRuleDO> selectPage(IotDataRulePageReqVO reqVO) { | |
| 22 | + return selectPage(reqVO, new LambdaQueryWrapperX<IotDataRuleDO>() | |
| 23 | + .likeIfPresent(IotDataRuleDO::getName, reqVO.getName()) | |
| 24 | + .eqIfPresent(IotDataRuleDO::getStatus, reqVO.getStatus()) | |
| 25 | + .betweenIfPresent(IotDataRuleDO::getCreateTime, reqVO.getCreateTime()) | |
| 26 | + .orderByDesc(IotDataRuleDO::getId)); | |
| 27 | + } | |
| 28 | + | |
| 29 | + default List<IotDataRuleDO> selectListBySinkId(Long sinkId) { | |
| 30 | + return selectList(new LambdaQueryWrapperX<IotDataRuleDO>() | |
| 31 | + .apply(MyBatisUtils.findInSet("sink_ids", sinkId))); | |
| 32 | + } | |
| 33 | + | |
| 34 | + default List<IotDataRuleDO> selectListByStatus(Integer status) { | |
| 35 | + return selectList(IotDataRuleDO::getStatus, status); | |
| 36 | + } | |
| 37 | + | |
| 38 | +} | |
| 0 | 39 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/rule/IotDataBridgeMapper.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/rule/IotDataSinkMapper.java
| ... | ... | @@ -3,32 +3,30 @@ package cn.iocoder.yudao.module.iot.dal.mysql.rule; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgePageReqVO; | |
| 7 | -import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataBridgeDO; | |
| 6 | +import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.data.sink.IotDataSinkPageReqVO; | |
| 7 | +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataSinkDO; | |
| 8 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | |
| 10 | 10 | import java.util.List; |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | - * IoT 数据桥梁 Mapper | |
| 13 | + * IoT 数据流转目的 Mapper | |
| 14 | 14 | * |
| 15 | 15 | * @author HUIHUI |
| 16 | 16 | */ |
| 17 | 17 | @Mapper |
| 18 | -public interface IotDataBridgeMapper extends BaseMapperX<IotDataBridgeDO> { | |
| 18 | +public interface IotDataSinkMapper extends BaseMapperX<IotDataSinkDO> { | |
| 19 | 19 | |
| 20 | - default PageResult<IotDataBridgeDO> selectPage(IotDataBridgePageReqVO reqVO) { | |
| 21 | - return selectPage(reqVO, new LambdaQueryWrapperX<IotDataBridgeDO>() | |
| 22 | - .likeIfPresent(IotDataBridgeDO::getName, reqVO.getName()) | |
| 23 | - .eqIfPresent(IotDataBridgeDO::getStatus, reqVO.getStatus()) | |
| 24 | - .betweenIfPresent(IotDataBridgeDO::getCreateTime, reqVO.getCreateTime()) | |
| 25 | - .orderByDesc(IotDataBridgeDO::getId)); | |
| 20 | + default PageResult<IotDataSinkDO> selectPage(IotDataSinkPageReqVO reqVO) { | |
| 21 | + return selectPage(reqVO, new LambdaQueryWrapperX<IotDataSinkDO>() | |
| 22 | + .likeIfPresent(IotDataSinkDO::getName, reqVO.getName()) | |
| 23 | + .eqIfPresent(IotDataSinkDO::getStatus, reqVO.getStatus()) | |
| 24 | + .betweenIfPresent(IotDataSinkDO::getCreateTime, reqVO.getCreateTime()) | |
| 25 | + .orderByDesc(IotDataSinkDO::getId)); | |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - default List<IotDataBridgeDO> selectList(Integer status) { | |
| 29 | - return selectList(new LambdaQueryWrapperX<IotDataBridgeDO>() | |
| 30 | - .eqIfPresent(IotDataBridgeDO::getStatus, status) | |
| 31 | - .orderByDesc(IotDataBridgeDO::getId)); | |
| 28 | + default List<IotDataSinkDO> selectListByStatus(Integer status) { | |
| 29 | + return selectList(IotDataSinkDO::getStatus, status); | |
| 32 | 30 | } |
| 33 | 31 | |
| 34 | 32 | } |
| 35 | 33 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/rule/IotRuleSceneMapper.java
| ... | ... | @@ -7,6 +7,8 @@ import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.scene.IotRuleScenePa |
| 7 | 7 | import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotRuleSceneDO; |
| 8 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | |
| 10 | +import java.util.List; | |
| 11 | + | |
| 10 | 12 | /** |
| 11 | 13 | * IoT 场景联动 Mapper |
| 12 | 14 | * |
| ... | ... | @@ -24,4 +26,8 @@ public interface IotRuleSceneMapper extends BaseMapperX<IotRuleSceneDO> { |
| 24 | 26 | .orderByDesc(IotRuleSceneDO::getId)); |
| 25 | 27 | } |
| 26 | 28 | |
| 29 | + default List<IotRuleSceneDO> selectListByStatus(Integer status) { | |
| 30 | + return selectList(IotRuleSceneDO::getStatus, status); | |
| 31 | + } | |
| 32 | + | |
| 27 | 33 | } | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/thingmodel/IotThingModelMapper.java
| ... | ... | @@ -25,8 +25,6 @@ public interface IotThingModelMapper extends BaseMapperX<IotThingModelDO> { |
| 25 | 25 | .likeIfPresent(IotThingModelDO::getName, reqVO.getName()) |
| 26 | 26 | .eqIfPresent(IotThingModelDO::getType, reqVO.getType()) |
| 27 | 27 | .eqIfPresent(IotThingModelDO::getProductId, reqVO.getProductId()) |
| 28 | - // TODO @芋艿:看看要不要加枚举 | |
| 29 | - .notIn(IotThingModelDO::getIdentifier, "get", "set", "post") | |
| 30 | 28 | .orderByDesc(IotThingModelDO::getId)); |
| 31 | 29 | } |
| 32 | 30 | |
| ... | ... | @@ -36,8 +34,6 @@ public interface IotThingModelMapper extends BaseMapperX<IotThingModelDO> { |
| 36 | 34 | .likeIfPresent(IotThingModelDO::getName, reqVO.getName()) |
| 37 | 35 | .eqIfPresent(IotThingModelDO::getType, reqVO.getType()) |
| 38 | 36 | .eqIfPresent(IotThingModelDO::getProductId, reqVO.getProductId()) |
| 39 | - // TODO @芋艿:看看要不要加枚举 | |
| 40 | - .notIn(IotThingModelDO::getIdentifier, "get", "set", "post") | |
| 41 | 37 | .orderByDesc(IotThingModelDO::getId)); |
| 42 | 38 | } |
| 43 | 39 | |
| ... | ... | @@ -61,15 +57,6 @@ public interface IotThingModelMapper extends BaseMapperX<IotThingModelDO> { |
| 61 | 57 | IotThingModelDO::getType, type); |
| 62 | 58 | } |
| 63 | 59 | |
| 64 | - default List<IotThingModelDO> selectListByProductIdAndIdentifiersAndTypes(Long productId, | |
| 65 | - List<String> identifiers, | |
| 66 | - List<Integer> types) { | |
| 67 | - return selectList(new LambdaQueryWrapperX<IotThingModelDO>() | |
| 68 | - .eq(IotThingModelDO::getProductId, productId) | |
| 69 | - .in(IotThingModelDO::getIdentifier, identifiers) | |
| 70 | - .in(IotThingModelDO::getType, types)); | |
| 71 | - } | |
| 72 | - | |
| 73 | 60 | default IotThingModelDO selectByProductIdAndName(Long productId, String name) { |
| 74 | 61 | return selectOne(IotThingModelDO::getProductId, productId, |
| 75 | 62 | IotThingModelDO::getName, name); | ... | ... |
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/redis/RedisKeyConstants.java
| ... | ... | @@ -60,4 +60,20 @@ public interface RedisKeyConstants { |
| 60 | 60 | */ |
| 61 | 61 | String THING_MODEL_LIST = "iot:thing_model_list"; |
| 62 | 62 | |
| 63 | + /** | |
| 64 | + * 数据流转规则的数据缓存,使用 Spring Cache 操作 | |
| 65 | + * | |
| 66 | + * KEY 格式:data_rule_list_${deviceId}_${method}_${identifier} | |
| 67 | + * VALUE 数据类型:String 数组(JSON),即 {@link cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleDO} 列表 | |
| 68 | + */ | |
| 69 | + String DATA_RULE_LIST = "iot:data_rule_list"; | |
| 70 | + | |
| 71 | + /** | |
| 72 | + * 数据目的的数据缓存,使用 Spring Cache 操作 | |
| 73 | + * | |
| 74 | + * KEY 格式:data_sink_${id} | |
| 75 | + * VALUE 数据类型:String(JSON),即 {@link cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataSinkDO} | |
| 76 | + */ | |
| 77 | + String DATA_SINK = "iot:data_sink"; | |
| 78 | + | |
| 63 | 79 | } | ... | ... |
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/DictTypeConstants.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/enums/DictTypeConstants.java
| ... | ... | @@ -14,5 +14,10 @@ public class DictTypeConstants { |
| 14 | 14 | |
| 15 | 15 | public static final String DEVICE_STATE = "iot_device_state"; |
| 16 | 16 | |
| 17 | + public static final String ALERT_LEVEL = "iot_alert_level"; | |
| 18 | + | |
| 19 | + public static final String OTA_TASK_DEVICE_SCOPE = "iot_ota_task_device_scope"; | |
| 20 | + public static final String OTA_TASK_STATUS = "iot_ota_task_status"; | |
| 21 | + public static final String OTA_TASK_RECORD_STATUS = "iot_ota_task_record_status"; | |
| 17 | 22 | |
| 18 | 23 | } | ... | ... |
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/ErrorCodeConstants.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/enums/ErrorCodeConstants.java
| ... | ... | @@ -14,6 +14,7 @@ public interface ErrorCodeConstants { |
| 14 | 14 | ErrorCode PRODUCT_KEY_EXISTS = new ErrorCode(1_050_001_001, "产品标识已经存在"); |
| 15 | 15 | ErrorCode PRODUCT_STATUS_NOT_DELETE = new ErrorCode(1_050_001_002, "产品状是发布状态,不允许删除"); |
| 16 | 16 | ErrorCode PRODUCT_STATUS_NOT_ALLOW_THING_MODEL = new ErrorCode(1_050_001_003, "产品状是发布状态,不允许操作物模型"); |
| 17 | + ErrorCode PRODUCT_DELETE_FAIL_HAS_DEVICE = new ErrorCode(1_050_001_004, "产品下存在设备,不允许删除"); | |
| 17 | 18 | |
| 18 | 19 | // ========== 产品物模型 1-050-002-000 ============ |
| 19 | 20 | ErrorCode THING_MODEL_NOT_EXISTS = new ErrorCode(1_050_002_000, "产品物模型不存在"); |
| ... | ... | @@ -31,6 +32,7 @@ public interface ErrorCodeConstants { |
| 31 | 32 | ErrorCode DEVICE_NOT_GATEWAY = new ErrorCode(1_050_003_005, "设备不是网关设备"); |
| 32 | 33 | ErrorCode DEVICE_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_050_003_006, "导入设备数据不能为空!"); |
| 33 | 34 | ErrorCode DEVICE_DOWNSTREAM_FAILED_SERVER_ID_NULL = new ErrorCode(1_050_003_007, "下行设备消息失败,原因:设备未连接网关"); |
| 35 | + ErrorCode DEVICE_SERIAL_NUMBER_EXISTS = new ErrorCode(1_050_003_008, "设备序列号已存在,序列号必须全局唯一"); | |
| 34 | 36 | |
| 35 | 37 | // ========== 产品分类 1-050-004-000 ========== |
| 36 | 38 | ErrorCode PRODUCT_CATEGORY_NOT_EXISTS = new ErrorCode(1_050_004_000, "产品分类不存在"); |
| ... | ... | @@ -39,25 +41,40 @@ public interface ErrorCodeConstants { |
| 39 | 41 | ErrorCode DEVICE_GROUP_NOT_EXISTS = new ErrorCode(1_050_005_000, "设备分组不存在"); |
| 40 | 42 | ErrorCode DEVICE_GROUP_DELETE_FAIL_DEVICE_EXISTS = new ErrorCode(1_050_005_001, "设备分组下存在设备,不允许删除"); |
| 41 | 43 | |
| 42 | - // ========== 固件相关 1-050-008-000 ========== | |
| 44 | + // ========== OTA 固件相关 1-050-008-000 ========== | |
| 43 | 45 | |
| 44 | 46 | ErrorCode OTA_FIRMWARE_NOT_EXISTS = new ErrorCode(1_050_008_000, "固件信息不存在"); |
| 45 | 47 | ErrorCode OTA_FIRMWARE_PRODUCT_VERSION_DUPLICATE = new ErrorCode(1_050_008_001, "产品版本号重复"); |
| 46 | 48 | |
| 47 | - ErrorCode OTA_UPGRADE_TASK_NOT_EXISTS = new ErrorCode(1_050_008_100, "升级任务不存在"); | |
| 48 | - ErrorCode OTA_UPGRADE_TASK_NAME_DUPLICATE = new ErrorCode(1_050_008_101, "升级任务名称重复"); | |
| 49 | - ErrorCode OTA_UPGRADE_TASK_DEVICE_IDS_EMPTY = new ErrorCode(1_050_008_102, "设备编号列表不能为空"); | |
| 50 | - ErrorCode OTA_UPGRADE_TASK_DEVICE_LIST_EMPTY = new ErrorCode(1_050_008_103, "设备列表不能为空"); | |
| 51 | - ErrorCode OTA_UPGRADE_TASK_CANNOT_CANCEL = new ErrorCode(1_050_008_104, "升级任务不能取消"); | |
| 49 | + // ========== OTA 升级任务相关 1-050-008-100 ========== | |
| 52 | 50 | |
| 53 | - ErrorCode OTA_UPGRADE_RECORD_NOT_EXISTS = new ErrorCode(1_050_008_200, "升级记录不存在"); | |
| 54 | - ErrorCode OTA_UPGRADE_RECORD_DUPLICATE = new ErrorCode(1_050_008_201, "升级记录重复"); | |
| 55 | - ErrorCode OTA_UPGRADE_RECORD_CANNOT_RETRY = new ErrorCode(1_050_008_202, "升级记录不能重试"); | |
| 51 | + ErrorCode OTA_TASK_NOT_EXISTS = new ErrorCode(1_050_008_100, "升级任务不存在"); | |
| 52 | + ErrorCode OTA_TASK_CREATE_FAIL_NAME_DUPLICATE = new ErrorCode(1_050_008_101, "创建 OTA 任务失败,原因:任务名称重复"); | |
| 53 | + ErrorCode OTA_TASK_CREATE_FAIL_DEVICE_FIRMWARE_EXISTS = new ErrorCode(1_050_008_102, | |
| 54 | + "创建 OTA 任务失败,原因:设备({})已经是该固件版本"); | |
| 55 | + ErrorCode OTA_TASK_CREATE_FAIL_DEVICE_OTA_IN_PROCESS = new ErrorCode(1_050_008_102, | |
| 56 | + "创建 OTA 任务失败,原因:设备({})已经在升级中..."); | |
| 57 | + ErrorCode OTA_TASK_CREATE_FAIL_DEVICE_EMPTY = new ErrorCode(1_050_008_103, "创建 OTA 任务失败,原因:没有可升级的设备"); | |
| 58 | + ErrorCode OTA_TASK_CANCEL_FAIL_STATUS_END = new ErrorCode(1_050_008_104, "取消 OTA 任务失败,原因:任务状态不是进行中"); | |
| 56 | 59 | |
| 57 | - // ========== IoT 数据桥梁 1-050-010-000 ========== | |
| 58 | - ErrorCode DATA_BRIDGE_NOT_EXISTS = new ErrorCode(1_050_010_000, "IoT 数据桥梁不存在"); | |
| 60 | + // ========== OTA 升级任务相关 1-050-008-100 ========== | |
| 59 | 61 | |
| 60 | - // ========== IoT 场景联动 1-050-011-000 ========== | |
| 61 | - ErrorCode RULE_SCENE_NOT_EXISTS = new ErrorCode(1_050_011_000, "IoT 场景联动不存在"); | |
| 62 | + ErrorCode OTA_TASK_RECORD_NOT_EXISTS = new ErrorCode(1_050_008_200, "升级记录不存在"); | |
| 63 | + | |
| 64 | + // ========== IoT 数据流转规则 1-050-010-000 ========== | |
| 65 | + ErrorCode DATA_RULE_NOT_EXISTS = new ErrorCode(1_050_010_000, "数据流转规则不存在"); | |
| 66 | + | |
| 67 | + // ========== IoT 数据流转目的 1-050-011-000 ========== | |
| 68 | + ErrorCode DATA_SINK_NOT_EXISTS = new ErrorCode(1_050_011_000, "数据桥梁不存在"); | |
| 69 | + ErrorCode DATA_SINK_DELETE_FAIL_USED_BY_RULE = new ErrorCode(1_050_011_001, "数据流转目的正在被数据流转规则使用,无法删除"); | |
| 70 | + | |
| 71 | + // ========== IoT 场景联动 1-050-012-000 ========== | |
| 72 | + ErrorCode RULE_SCENE_NOT_EXISTS = new ErrorCode(1_050_012_000, "场景联动不存在"); | |
| 73 | + | |
| 74 | + // ========== IoT 告警配置 1-050-013-000 ========== | |
| 75 | + ErrorCode ALERT_CONFIG_NOT_EXISTS = new ErrorCode(1_050_013_000, "IoT 告警配置不存在"); | |
| 76 | + | |
| 77 | + // ========== IoT 告警记录 1-050-014-000 ========== | |
| 78 | + ErrorCode ALERT_RECORD_NOT_EXISTS = new ErrorCode(1_050_014_000, "IoT 告警记录不存在"); | |
| 62 | 79 | |
| 63 | 80 | } |
| 64 | 81 | \ No newline at end of file | ... | ... |
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/rule/IotAlertConfigReceiveTypeEnum.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/enums/alert/IotAlertReceiveTypeEnum.java
| 1 | -package cn.iocoder.yudao.module.iot.enums.rule; | |
| 1 | +package cn.iocoder.yudao.module.iot.enums.alert; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.core.ArrayValuable; |
| 4 | 4 | import lombok.Getter; |
| ... | ... | @@ -7,21 +7,22 @@ import lombok.RequiredArgsConstructor; |
| 7 | 7 | import java.util.Arrays; |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | - * IoT 告警配置的接收方式枚举 | |
| 10 | + * IoT 告警的接收方式枚举 | |
| 11 | 11 | * |
| 12 | 12 | * @author 芋道源码 |
| 13 | 13 | */ |
| 14 | 14 | @RequiredArgsConstructor |
| 15 | 15 | @Getter |
| 16 | -public enum IotAlertConfigReceiveTypeEnum implements ArrayValuable<Integer> { | |
| 16 | +public enum IotAlertReceiveTypeEnum implements ArrayValuable<Integer> { | |
| 17 | 17 | |
| 18 | 18 | SMS(1), // 短信 |
| 19 | 19 | MAIL(2), // 邮箱 |
| 20 | - NOTIFY(3); // 通知 | |
| 20 | + NOTIFY(3); // 站内信 | |
| 21 | + // TODO 待实现(欢迎 pull request):webhook 4 | |
| 21 | 22 | |
| 22 | 23 | private final Integer type; |
| 23 | 24 | |
| 24 | - public static final Integer[] ARRAYS = Arrays.stream(values()).map(IotAlertConfigReceiveTypeEnum::getType).toArray(Integer[]::new); | |
| 25 | + public static final Integer[] ARRAYS = Arrays.stream(values()).map(IotAlertReceiveTypeEnum::getType).toArray(Integer[]::new); | |
| 25 | 26 | |
| 26 | 27 | @Override |
| 27 | 28 | public Integer[] array() { | ... | ... |
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/device/IotDeviceMessageIdentifierEnum.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/enums/device/IotDeviceMessageIdentifierEnum.java