Commit 1f5dff77c2befefb60e7b7de36975a9ddca0a2cd

Authored by YunaiV
1 parent 1ad4e08c

reactor:【IoT 物联网】增加 IotDataRuleDO 的定义,对标阿里云 IoT 的「云产品流转」

Showing 22 changed files with 223 additions and 77 deletions
yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/rule/IotDataBridgeTypeEnum.java renamed to yudao-module-iot/yudao-module-iot-api/src/main/java/cn/iocoder/yudao/module/iot/enums/rule/IotDataRuleSinkTypeEnum.java
... ... @@ -7,13 +7,13 @@ 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 IotDataBridgeTypeEnum implements ArrayValuable<Integer> {
  16 +public enum IotDataRuleSinkTypeEnum implements ArrayValuable<Integer> {
17 17  
18 18 HTTP(1, "HTTP"),
19 19 TCP(2, "TCP"),
... ... @@ -32,7 +32,7 @@ public enum IotDataBridgeTypeEnum implements ArrayValuable&lt;Integer&gt; {
32 32  
33 33 private final String name;
34 34  
35   - public static final Integer[] ARRAYS = Arrays.stream(values()).map(IotDataBridgeTypeEnum::getType).toArray(Integer[]::new);
  35 + public static final Integer[] ARRAYS = Arrays.stream(values()).map(IotDataRuleSinkTypeEnum::getType).toArray(Integer[]::new);
36 36  
37 37 @Override
38 38 public Integer[] array() {
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/IotDataBridgeController.java
... ... @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
7 7 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgePageReqVO;
8 8 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgeRespVO;
9 9 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgeSaveReqVO;
10   -import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataBridgeDO;
  10 +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleSinkDO;
11 11 import cn.iocoder.yudao.module.iot.service.rule.IotDataBridgeService;
12 12 import io.swagger.v3.oas.annotations.Operation;
13 13 import io.swagger.v3.oas.annotations.Parameter;
... ... @@ -61,7 +61,7 @@ public class IotDataBridgeController {
61 61 @Parameter(name = "id", description = "编号", required = true, example = "1024")
62 62 @PreAuthorize("@ss.hasPermission('iot:data-bridge:query')")
63 63 public CommonResult<IotDataBridgeRespVO> getDataBridge(@RequestParam("id") Long id) {
64   - IotDataBridgeDO dataBridge = dataBridgeService.getDataBridge(id);
  64 + IotDataRuleSinkDO dataBridge = dataBridgeService.getDataBridge(id);
65 65 return success(BeanUtils.toBean(dataBridge, IotDataBridgeRespVO.class));
66 66 }
67 67  
... ... @@ -69,14 +69,14 @@ public class IotDataBridgeController {
69 69 @Operation(summary = "获得数据桥梁分页")
70 70 @PreAuthorize("@ss.hasPermission('iot:data-bridge:query')")
71 71 public CommonResult<PageResult<IotDataBridgeRespVO>> getDataBridgePage(@Valid IotDataBridgePageReqVO pageReqVO) {
72   - PageResult<IotDataBridgeDO> pageResult = dataBridgeService.getDataBridgePage(pageReqVO);
  72 + PageResult<IotDataRuleSinkDO> pageResult = dataBridgeService.getDataBridgePage(pageReqVO);
73 73 return success(BeanUtils.toBean(pageResult, IotDataBridgeRespVO.class));
74 74 }
75 75  
76 76 @GetMapping("/simple-list")
77 77 @Operation(summary = "获取数据桥梁的精简信息列表", description = "主要用于前端的下拉选项")
78 78 public CommonResult<List<IotDataBridgeRespVO>> getSimpleDataBridgeList() {
79   - List<IotDataBridgeDO> list = dataBridgeService.getDataBridgeList(CommonStatusEnum.ENABLE.getStatus());
  79 + List<IotDataRuleSinkDO> list = dataBridgeService.getDataBridgeList(CommonStatusEnum.ENABLE.getStatus());
80 80 return success(convertList(list, dataBridge -> // 只返回 id、name 字段
81 81 new IotDataBridgeRespVO().setId(dataBridge.getId()).setName(dataBridge.getName())));
82 82 }
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/IotDataBridgeSaveReqVO.java
... ... @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
4 4 import cn.iocoder.yudao.framework.common.validation.InEnum;
5 5 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config.IotDataBridgeAbstractConfig;
6 6 import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeDirectionEnum;
7   -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeTypeEnum;
  7 +import cn.iocoder.yudao.module.iot.enums.rule.IotDataRuleSinkTypeEnum;
8 8 import io.swagger.v3.oas.annotations.media.Schema;
9 9 import jakarta.validation.constraints.NotEmpty;
10 10 import jakarta.validation.constraints.NotNull;
... ... @@ -36,7 +36,7 @@ public class IotDataBridgeSaveReqVO {
36 36  
37 37 @Schema(description = "桥梁类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
38 38 @NotNull(message = "桥梁类型不能为空")
39   - @InEnum(IotDataBridgeTypeEnum.class)
  39 + @InEnum(IotDataRuleSinkTypeEnum.class)
40 40 private Integer type;
41 41  
42 42 @Schema(description = "桥梁配置")
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/databridge/config/IotDataBridgeAbstractConfig.java
1 1 package cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config;
2 2  
3   -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeTypeEnum;
  3 +import cn.iocoder.yudao.module.iot.enums.rule.IotDataRuleSinkTypeEnum;
4 4 import com.fasterxml.jackson.annotation.JsonSubTypes;
5 5 import com.fasterxml.jackson.annotation.JsonTypeInfo;
6 6 import lombok.Data;
... ... @@ -28,7 +28,7 @@ public abstract class IotDataBridgeAbstractConfig {
28 28 /**
29 29 * 配置类型
30 30 *
31   - * 枚举 {@link IotDataBridgeTypeEnum#getType()}
  31 + * 枚举 {@link IotDataRuleSinkTypeEnum#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/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
... ...
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 com.baomidou.mybatisplus.annotation.KeySequence;
  5 +import com.baomidou.mybatisplus.annotation.TableName;
  6 +import lombok.AllArgsConstructor;
  7 +import lombok.Builder;
  8 +import lombok.Data;
  9 +import lombok.NoArgsConstructor;
  10 +
  11 +import java.util.List;
  12 +
  13 +/**
  14 + * IoT 数据流转 DO
  15 + *
  16 + * 组合 {@link IotDataRuleSourceDO} => {@link IotDataRuleSinkDO}
  17 + *
  18 + * @author 芋道源码
  19 + */
  20 +@TableName(value = "iot_data_flow", autoResultMap = true)
  21 +@KeySequence("iot_data_flow_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  22 +@Data
  23 +@Builder
  24 +@NoArgsConstructor
  25 +@AllArgsConstructor
  26 +public class IotDataRuleDO {
  27 +
  28 + /**
  29 + * 数据流转编号
  30 + */
  31 + private Long id;
  32 + /**
  33 + * 数据流转名称
  34 + */
  35 + private String name;
  36 + /**
  37 + * 数据流转描述
  38 + */
  39 + private String description;
  40 + /**
  41 + * 数据流转状态
  42 + *
  43 + * 枚举 {@link CommonStatusEnum}
  44 + */
  45 + private Integer status;
  46 +
  47 + /**
  48 + * 数据源编号
  49 + *
  50 + * 关联 {@link IotDataRuleSourceDO#getId()}
  51 + */
  52 + private List<Long> sourceIds;
  53 + /**
  54 + * 数据目的编号
  55 + *
  56 + * 关联 {@link IotDataRuleSinkDO#getId()}
  57 + */
  58 + private List<Long> sinkIds;
  59 +
  60 + // TODO @芋艿:未来考虑使用 groovy;支持数据处理;
  61 +
  62 +}
... ...
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/IotDataRuleSinkDO.java
... ... @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
4 4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
5 5 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config.IotDataBridgeAbstractConfig;
6 6 import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeDirectionEnum;
7   -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeTypeEnum;
  7 +import cn.iocoder.yudao.module.iot.enums.rule.IotDataRuleSinkTypeEnum;
8 8 import com.baomidou.mybatisplus.annotation.KeySequence;
9 9 import com.baomidou.mybatisplus.annotation.TableField;
10 10 import com.baomidou.mybatisplus.annotation.TableId;
... ... @@ -13,7 +13,7 @@ import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
13 13 import lombok.*;
14 14  
15 15 /**
16   - * IoT 数据桥梁 DO
  16 + * IoT 数据流转的数据目的 DO
17 17 *
18 18 * @author 芋道源码
19 19 */
... ... @@ -23,19 +23,19 @@ import lombok.*;
23 23 @Builder
24 24 @NoArgsConstructor
25 25 @AllArgsConstructor
26   -public class IotDataBridgeDO extends BaseDO {
  26 +public class IotDataRuleSinkDO extends BaseDO {
27 27  
28 28 /**
29   - * 桥梁编号
  29 + * 数据目的编号
30 30 */
31 31 @TableId
32 32 private Long id;
33 33 /**
34   - * 桥梁名称
  34 + * 数据目的名称
35 35 */
36 36 private String name;
37 37 /**
38   - * 桥梁描述
  38 + * 数据目的描述
39 39 */
40 40 private String description;
41 41 /**
... ... @@ -43,23 +43,25 @@ public class IotDataBridgeDO extends BaseDO {
43 43 *
44 44 * 枚举 {@link CommonStatusEnum}
45 45 */
  46 + @Deprecated // TODO @puhui999:这个删除
46 47 private Integer status;
47 48 /**
48 49 * 桥梁方向
49 50 *
50 51 * 枚举 {@link IotDataBridgeDirectionEnum}
51 52 */
  53 + @Deprecated // TODO @puhui999:这个删除
52 54 private Integer direction;
53 55  
54 56 /**
55   - * 桥梁类型
  57 + * 数据目的类型
56 58 *
57   - * 枚举 {@link IotDataBridgeTypeEnum}
  59 + * 枚举 {@link IotDataRuleSinkTypeEnum}
58 60 */
59 61 private Integer type;
60 62  
61 63 /**
62   - * 桥梁配置
  64 + * 数据目的配置
63 65 */
64 66 @TableField(typeHandler = JacksonTypeHandler.class)
65 67 private IotDataBridgeAbstractConfig config;
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotDataRuleSourceDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.iot.dal.dataobject.rule;
  2 +
  3 +import cn.iocoder.yudao.module.iot.core.enums.IotDeviceMessageMethodEnum;
  4 +import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO;
  5 +import cn.iocoder.yudao.module.iot.dal.dataobject.product.IotProductDO;
  6 +import cn.iocoder.yudao.module.iot.dal.dataobject.thingmodel.IotThingModelDO;
  7 +import com.baomidou.mybatisplus.annotation.KeySequence;
  8 +import com.baomidou.mybatisplus.annotation.TableName;
  9 +import lombok.AllArgsConstructor;
  10 +import lombok.Builder;
  11 +import lombok.Data;
  12 +import lombok.NoArgsConstructor;
  13 +
  14 +import java.util.List;
  15 +
  16 +/**
  17 + * IoT 数据流转的数据源 DO
  18 + *
  19 + * @author 芋道源码
  20 + */
  21 +@TableName(value = "iot_data_flow_source", autoResultMap = true)
  22 +@KeySequence("iot_data_flow_source_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  23 +@Data
  24 +@Builder
  25 +@NoArgsConstructor
  26 +@AllArgsConstructor
  27 +public class IotDataRuleSourceDO {
  28 +
  29 + /**
  30 + * 数据源编号
  31 + */
  32 + private Long id;
  33 + /**
  34 + * 数据源名称
  35 + */
  36 + private String name;
  37 +
  38 + /**
  39 + * 配置数组
  40 + */
  41 + private List<Config> configs;
  42 +
  43 + /**
  44 + * 配置
  45 + */
  46 + @Data
  47 + public static class Config {
  48 +
  49 + /**
  50 + * 消息方法
  51 + *
  52 + * 枚举 {@link IotDeviceMessageMethodEnum} 中的 upstream 上行部分
  53 + */
  54 + private String method;
  55 +
  56 + /**
  57 + * 产品编号
  58 + *
  59 + * 关联 {@link IotProductDO#getId()}
  60 + */
  61 + private Long productId;
  62 + /**
  63 + * 设备编号
  64 + *
  65 + * 关联 {@link IotDeviceDO#getId()}
  66 + * 特殊:如果为 {@link IotDeviceDO#DEVICE_ID_ALL} 时,则是全部设备
  67 + */
  68 + private Long deviceId;
  69 +
  70 + /**
  71 + * 标识符
  72 + *
  73 + * 1. 物模型时,对应:{@link IotThingModelDO#getIdentifier()}
  74 + */
  75 + private String identifier;
  76 +
  77 + }
  78 +
  79 +}
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotRuleSceneDO.java
... ... @@ -201,7 +201,7 @@ public class IotRuleSceneDO extends TenantBaseDO {
201 201 * 数据桥接编号
202 202 *
203 203 * 必填:当 {@link #type} 为 {@link IotRuleSceneActionTypeEnum#DATA_BRIDGE} 时
204   - * 关联:{@link IotDataBridgeDO#getId()}
  204 + * 关联:{@link IotDataRuleSinkDO#getId()}
205 205 */
206 206 private Long dataBridgeId;
207 207  
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotRuleScene2DO.java renamed to yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotSceneRuleDO.java
1 1 package cn.iocoder.yudao.module.iot.dal.dataobject.rule;
2 2  
  3 +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
3 4 import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
4 5 import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
5 6 import cn.iocoder.yudao.module.iot.dal.dataobject.device.IotDeviceDO;
... ... @@ -25,38 +26,35 @@ import java.util.List;
25 26 /**
26 27 * IoT 场景联动 DO
27 28 *
  29 + * 基于 {@link Trigger} 触发 {@link Action}
  30 + *
28 31 * @author 芋道源码
29 32 */
30   -@TableName(value = "iot_rule_scene2", autoResultMap = true)
31   -@KeySequence("iot_rule_scene_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  33 +@TableName(value = "iot_scene_rule", autoResultMap = true)
  34 +@KeySequence("iot_scene_rule_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
32 35 @Data
33 36 @Builder
34 37 @NoArgsConstructor
35 38 @AllArgsConstructor
36   -public class IotRuleScene2DO extends TenantBaseDO {
37   -
38   - /**
39   - * 设备编号 - 全部设备
40   - */
41   - public static final Long DEVICE_ID_ALL = 0L;
  39 +public class IotSceneRuleDO extends TenantBaseDO {
42 40  
43 41 /**
44   - * 场景编号
  42 + * 场景联动编号
45 43 */
46 44 @TableId
47 45 private Long id;
48 46 /**
49   - * 场景名称
  47 + * 场景联动名称
50 48 */
51 49 private String name;
52 50 /**
53   - * 场景描述
  51 + * 场景联动描述
54 52 */
55 53 private String description;
56 54 /**
57   - * 场景状态
  55 + * 场景联动状态
58 56 *
59   - * 枚举 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
  57 + * 枚举 {@link CommonStatusEnum}
60 58 */
61 59 private Integer status;
62 60  
... ... @@ -103,7 +101,7 @@ public class IotRuleScene2DO extends TenantBaseDO {
103 101 * 设备编号
104 102 *
105 103 * 关联 {@link IotDeviceDO#getId()}
106   - * 特殊:如果为 0,则是全部
  104 + * 特殊:如果为 {@link IotDeviceDO#DEVICE_ID_ALL} 时,则是全部设备
107 105 */
108 106 private Long deviceId;
109 107 /**
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/rule/IotDataBridgeMapper.java
... ... @@ -4,7 +4,7 @@ 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 6 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgePageReqVO;
7   -import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataBridgeDO;
  7 +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleSinkDO;
8 8 import org.apache.ibatis.annotations.Mapper;
9 9  
10 10 import java.util.List;
... ... @@ -15,20 +15,20 @@ import java.util.List;
15 15 * @author HUIHUI
16 16 */
17 17 @Mapper
18   -public interface IotDataBridgeMapper extends BaseMapperX<IotDataBridgeDO> {
  18 +public interface IotDataBridgeMapper extends BaseMapperX<IotDataRuleSinkDO> {
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<IotDataRuleSinkDO> selectPage(IotDataBridgePageReqVO reqVO) {
  21 + return selectPage(reqVO, new LambdaQueryWrapperX<IotDataRuleSinkDO>()
  22 + .likeIfPresent(IotDataRuleSinkDO::getName, reqVO.getName())
  23 + .eqIfPresent(IotDataRuleSinkDO::getStatus, reqVO.getStatus())
  24 + .betweenIfPresent(IotDataRuleSinkDO::getCreateTime, reqVO.getCreateTime())
  25 + .orderByDesc(IotDataRuleSinkDO::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<IotDataRuleSinkDO> selectList(Integer status) {
  29 + return selectList(new LambdaQueryWrapperX<IotDataRuleSinkDO>()
  30 + .eqIfPresent(IotDataRuleSinkDO::getStatus, status)
  31 + .orderByDesc(IotDataRuleSinkDO::getId));
32 32 }
33 33  
34 34 }
35 35 \ No newline at end of file
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/IotDataBridgeService.java
... ... @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.iot.service.rule;
3 3 import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgePageReqVO;
5 5 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgeSaveReqVO;
6   -import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataBridgeDO;
  6 +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleSinkDO;
7 7 import jakarta.validation.Valid;
8 8  
9 9 import java.util.List;
... ... @@ -43,7 +43,7 @@ public interface IotDataBridgeService {
43 43 * @param id 编号
44 44 * @return 数据桥梁
45 45 */
46   - IotDataBridgeDO getDataBridge(Long id);
  46 + IotDataRuleSinkDO getDataBridge(Long id);
47 47  
48 48 /**
49 49 * 获得数据桥梁分页
... ... @@ -51,7 +51,7 @@ public interface IotDataBridgeService {
51 51 * @param pageReqVO 分页查询
52 52 * @return 数据桥梁分页
53 53 */
54   - PageResult<IotDataBridgeDO> getDataBridgePage(IotDataBridgePageReqVO pageReqVO);
  54 + PageResult<IotDataRuleSinkDO> getDataBridgePage(IotDataBridgePageReqVO pageReqVO);
55 55  
56 56 /**
57 57 * 获取数据桥梁列表
... ... @@ -59,6 +59,6 @@ public interface IotDataBridgeService {
59 59 * @param status 状态,如果为空,则不进行筛选
60 60 * @return 数据桥梁列表
61 61 */
62   - List<IotDataBridgeDO> getDataBridgeList(Integer status);
  62 + List<IotDataRuleSinkDO> getDataBridgeList(Integer status);
63 63  
64 64 }
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/IotDataBridgeServiceImpl.java
... ... @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
4 4 import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
5 5 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgePageReqVO;
6 6 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.IotDataBridgeSaveReqVO;
7   -import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataBridgeDO;
  7 +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleSinkDO;
8 8 import cn.iocoder.yudao.module.iot.dal.mysql.rule.IotDataBridgeMapper;
9 9 import jakarta.annotation.Resource;
10 10 import org.springframework.stereotype.Service;
... ... @@ -30,7 +30,7 @@ public class IotDataBridgeServiceImpl implements IotDataBridgeService {
30 30 @Override
31 31 public Long createDataBridge(IotDataBridgeSaveReqVO createReqVO) {
32 32 // 插入
33   - IotDataBridgeDO dataBridge = BeanUtils.toBean(createReqVO, IotDataBridgeDO.class);
  33 + IotDataRuleSinkDO dataBridge = BeanUtils.toBean(createReqVO, IotDataRuleSinkDO.class);
34 34 dataBridgeMapper.insert(dataBridge);
35 35 // 返回
36 36 return dataBridge.getId();
... ... @@ -41,7 +41,7 @@ public class IotDataBridgeServiceImpl implements IotDataBridgeService {
41 41 // 校验存在
42 42 validateDataBridgeExists(updateReqVO.getId());
43 43 // 更新
44   - IotDataBridgeDO updateObj = BeanUtils.toBean(updateReqVO, IotDataBridgeDO.class);
  44 + IotDataRuleSinkDO updateObj = BeanUtils.toBean(updateReqVO, IotDataRuleSinkDO.class);
45 45 dataBridgeMapper.updateById(updateObj);
46 46 }
47 47  
... ... @@ -60,17 +60,17 @@ public class IotDataBridgeServiceImpl implements IotDataBridgeService {
60 60 }
61 61  
62 62 @Override
63   - public IotDataBridgeDO getDataBridge(Long id) {
  63 + public IotDataRuleSinkDO getDataBridge(Long id) {
64 64 return dataBridgeMapper.selectById(id);
65 65 }
66 66  
67 67 @Override
68   - public PageResult<IotDataBridgeDO> getDataBridgePage(IotDataBridgePageReqVO pageReqVO) {
  68 + public PageResult<IotDataRuleSinkDO> getDataBridgePage(IotDataBridgePageReqVO pageReqVO) {
69 69 return dataBridgeMapper.selectPage(pageReqVO);
70 70 }
71 71  
72 72 @Override
73   - public List<IotDataBridgeDO> getDataBridgeList(Integer status) {
  73 + public List<IotDataRuleSinkDO> getDataBridgeList(Integer status) {
74 74 return dataBridgeMapper.selectList(status);
75 75 }
76 76  
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/action/IotRuleSceneDataBridgeAction.java
... ... @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.iot.service.rule.action;
3 3 import cn.hutool.core.lang.Assert;
4 4 import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
5 5 import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
6   -import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataBridgeDO;
  6 +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleSinkDO;
7 7 import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotRuleSceneDO;
8 8 import cn.iocoder.yudao.module.iot.enums.rule.IotRuleSceneActionTypeEnum;
9 9 import cn.iocoder.yudao.module.iot.service.rule.IotDataBridgeService;
... ... @@ -36,7 +36,7 @@ public class IotRuleSceneDataBridgeAction implements IotRuleSceneAction {
36 36 }
37 37 // 1.2 获得数据桥梁
38 38 Assert.notNull(config.getDataBridgeId(), "数据桥梁编号不能为空");
39   - IotDataBridgeDO dataBridge = dataBridgeService.getDataBridge(config.getDataBridgeId());
  39 + IotDataRuleSinkDO dataBridge = dataBridgeService.getDataBridge(config.getDataBridgeId());
40 40 if (dataBridge == null || dataBridge.getConfig() == null) {
41 41 log.error("[execute][message({}) config({}) 对应的数据桥梁不存在]", message, config);
42 42 return;
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/action/databridge/AbstractCacheableDataBridgeExecute.java
... ... @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.iot.service.rule.action.databridge;
2 2  
3 3 import cn.hutool.core.util.ObjUtil;
4 4 import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
5   -import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataBridgeDO;
  5 +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleSinkDO;
6 6 import com.google.common.cache.CacheBuilder;
7 7 import com.google.common.cache.CacheLoader;
8 8 import com.google.common.cache.LoadingCache;
... ... @@ -100,7 +100,7 @@ public abstract class AbstractCacheableDataBridgeExecute&lt;Config, Producer&gt; imple
100 100  
101 101 @Override
102 102 @SuppressWarnings({"unchecked"})
103   - public void execute(IotDeviceMessage message, IotDataBridgeDO dataBridge) {
  103 + public void execute(IotDeviceMessage message, IotDataRuleSinkDO dataBridge) {
104 104 if (ObjUtil.notEqual(dataBridge.getType(), getType())) {
105 105 return;
106 106 }
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/action/databridge/IotDataBridgeExecute.java
1 1 package cn.iocoder.yudao.module.iot.service.rule.action.databridge;
2 2  
3 3 import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
4   -import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataBridgeDO;
  4 +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleSinkDO;
5 5  
6 6 /**
7 7 * IoT 数据桥梁的执行器 execute 接口
... ... @@ -24,7 +24,7 @@ public interface IotDataBridgeExecute&lt;Config&gt; {
24 24 * @param dataBridge 数据桥梁
25 25 */
26 26 @SuppressWarnings({"unchecked"})
27   - default void execute(IotDeviceMessage message, IotDataBridgeDO dataBridge) throws Exception {
  27 + default void execute(IotDeviceMessage message, IotDataRuleSinkDO dataBridge) throws Exception {
28 28 // 1.1 校验数据桥梁类型
29 29 if (!getType().equals(dataBridge.getType())) {
30 30 return;
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/action/databridge/IotHttpDataBridgeExecute.java
... ... @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.common.util.http.HttpUtils;
5 5 import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
6 6 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config.IotDataBridgeHttpConfig;
7 7 import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
8   -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeTypeEnum;
  8 +import cn.iocoder.yudao.module.iot.enums.rule.IotDataRuleSinkTypeEnum;
9 9 import jakarta.annotation.Resource;
10 10 import lombok.extern.slf4j.Slf4j;
11 11 import org.springframework.http.*;
... ... @@ -30,7 +30,7 @@ public class IotHttpDataBridgeExecute implements IotDataBridgeExecute&lt;IotDataBri
30 30  
31 31 @Override
32 32 public Integer getType() {
33   - return IotDataBridgeTypeEnum.HTTP.getType();
  33 + return IotDataRuleSinkTypeEnum.HTTP.getType();
34 34 }
35 35  
36 36 @Override
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/action/databridge/IotKafkaMQDataBridgeExecute.java
... ... @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.iot.service.rule.action.databridge;
2 2  
3 3 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config.IotDataBridgeKafkaMQConfig;
4 4 import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
5   -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeTypeEnum;
  5 +import cn.iocoder.yudao.module.iot.enums.rule.IotDataRuleSinkTypeEnum;
6 6 import lombok.extern.slf4j.Slf4j;
7 7 import org.apache.kafka.clients.producer.ProducerConfig;
8 8 import org.apache.kafka.common.serialization.StringSerializer;
... ... @@ -31,7 +31,7 @@ public class IotKafkaMQDataBridgeExecute extends
31 31  
32 32 @Override
33 33 public Integer getType() {
34   - return IotDataBridgeTypeEnum.KAFKA.getType();
  34 + return IotDataRuleSinkTypeEnum.KAFKA.getType();
35 35 }
36 36  
37 37 @Override
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/action/databridge/IotRabbitMQDataBridgeExecute.java
... ... @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.iot.service.rule.action.databridge;
2 2  
3 3 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config.IotDataBridgeRabbitMQConfig;
4 4 import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
5   -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeTypeEnum;
  5 +import cn.iocoder.yudao.module.iot.enums.rule.IotDataRuleSinkTypeEnum;
6 6 import com.rabbitmq.client.Channel;
7 7 import com.rabbitmq.client.Connection;
8 8 import com.rabbitmq.client.ConnectionFactory;
... ... @@ -26,7 +26,7 @@ public class IotRabbitMQDataBridgeExecute extends
26 26  
27 27 @Override
28 28 public Integer getType() {
29   - return IotDataBridgeTypeEnum.RABBITMQ.getType();
  29 + return IotDataRuleSinkTypeEnum.RABBITMQ.getType();
30 30 }
31 31  
32 32 @Override
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/action/databridge/IotRedisStreamDataBridgeExecute.java
... ... @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.iot.service.rule.action.databridge;
3 3 import cn.hutool.core.util.StrUtil;
4 4 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config.IotDataBridgeRedisStreamConfig;
5 5 import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
6   -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeTypeEnum;
  6 +import cn.iocoder.yudao.module.iot.enums.rule.IotDataRuleSinkTypeEnum;
7 7 import lombok.extern.slf4j.Slf4j;
8 8 import org.redisson.Redisson;
9 9 import org.redisson.api.RedissonClient;
... ... @@ -29,7 +29,7 @@ public class IotRedisStreamDataBridgeExecute extends
29 29  
30 30 @Override
31 31 public Integer getType() {
32   - return IotDataBridgeTypeEnum.REDIS_STREAM.getType();
  32 + return IotDataRuleSinkTypeEnum.REDIS_STREAM.getType();
33 33 }
34 34  
35 35 @Override
... ...
yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/action/databridge/IotRocketMQDataBridgeExecute.java
... ... @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.iot.service.rule.action.databridge;
2 2  
3 3 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config.IotDataBridgeRocketMQConfig;
4 4 import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
5   -import cn.iocoder.yudao.module.iot.enums.rule.IotDataBridgeTypeEnum;
  5 +import cn.iocoder.yudao.module.iot.enums.rule.IotDataRuleSinkTypeEnum;
6 6 import lombok.extern.slf4j.Slf4j;
7 7 import org.apache.rocketmq.client.producer.DefaultMQProducer;
8 8 import org.apache.rocketmq.client.producer.SendResult;
... ... @@ -25,7 +25,7 @@ public class IotRocketMQDataBridgeExecute extends
25 25  
26 26 @Override
27 27 public Integer getType() {
28   - return IotDataBridgeTypeEnum.ROCKETMQ.getType();
  28 + return IotDataRuleSinkTypeEnum.ROCKETMQ.getType();
29 29 }
30 30  
31 31 @Override
... ...
yudao-module-iot/yudao-module-iot-biz/src/test/java/cn/iocoder/yudao/module/iot/service/rule/action/databridge/IotDataBridgeExecuteTest.java
... ... @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.iot.service.rule.action.databridge;
3 3 import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest;
4 4 import cn.iocoder.yudao.module.iot.controller.admin.rule.vo.databridge.config.*;
5 5 import cn.iocoder.yudao.module.iot.core.mq.message.IotDeviceMessage;
6   -import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataBridgeDO;
  6 +import cn.iocoder.yudao.module.iot.dal.dataobject.rule.IotDataRuleSinkDO;
7 7 import lombok.extern.slf4j.Slf4j;
8 8 import org.junit.jupiter.api.BeforeEach;
9 9 import org.junit.jupiter.api.Disabled;
... ... @@ -129,7 +129,7 @@ public class IotDataBridgeExecuteTest extends BaseMockitoUnitTest {
129 129  
130 130 // 3. 执行测试
131 131 log.info("[testHttpDataBridge][执行HTTP数据桥接测试]");
132   - httpDataBridgeExecute.execute(message, new IotDataBridgeDO()
  132 + httpDataBridgeExecute.execute(message, new IotDataRuleSinkDO()
133 133 .setType(httpDataBridgeExecute.getType()).setConfig(config));
134 134 }
135 135  
... ... @@ -144,10 +144,10 @@ public class IotDataBridgeExecuteTest extends BaseMockitoUnitTest {
144 144 private void executeAndVerifyCache(IotDataBridgeExecute<?> action, IotDataBridgeAbstractConfig config, String type)
145 145 throws Exception {
146 146 log.info("[test{}DataBridge][第一次执行,应该会创建新的 producer]", type);
147   - action.execute(message, new IotDataBridgeDO().setType(action.getType()).setConfig(config));
  147 + action.execute(message, new IotDataRuleSinkDO().setType(action.getType()).setConfig(config));
148 148  
149 149 log.info("[test{}DataBridge][第二次执行,应该会复用缓存的 producer]", type);
150   - action.execute(message, new IotDataBridgeDO().setType(action.getType()).setConfig(config));
  150 + action.execute(message, new IotDataRuleSinkDO().setType(action.getType()).setConfig(config));
151 151 }
152 152  
153 153 }
... ...