Skip to content

Commit a39647e

Browse files
committed
Merge branch 'master-jdk17' of https://gitee.com/zhijiantianya/ruoyi-vue-pro
# Conflicts: # yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/service/rule/scene/IotSceneRuleServiceImpl.java
2 parents f3ef0e7 + 853afd2 commit a39647e

33 files changed

Lines changed: 3060 additions & 48 deletions

File tree

yudao-module-bpm/src/main/java/cn/iocoder/yudao/module/bpm/service/task/BpmTaskServiceImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public PageResult<Task> getTaskTodoPage(Long userId, BpmTaskPageReqVO pageVO) {
116116
.taskAssignee(String.valueOf(userId)) // 分配给自己
117117
.active()
118118
.includeProcessVariables()
119+
.taskTenantId(FlowableUtils.getTenantId())
119120
.orderByTaskCreateTime().desc(); // 创建时间倒序
120121
if (StrUtil.isNotBlank(pageVO.getName())) {
121122
taskQuery.taskNameLike("%" + pageVO.getName() + "%");

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/device/vo/device/IotDevicePageReqVO.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,7 @@ public class IotDevicePageReqVO extends PageParam {
3131
@Schema(description = "设备分组编号", example = "1024")
3232
private Long groupId;
3333

34+
@Schema(description = "网关设备 ID", example = "16380")
35+
private Long gatewayId;
36+
3437
}

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/controller/admin/rule/vo/data/sink/IotDataSinkPageReqVO.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
44
import cn.iocoder.yudao.framework.common.pojo.PageParam;
55
import cn.iocoder.yudao.framework.common.validation.InEnum;
6+
import cn.iocoder.yudao.module.iot.enums.rule.IotDataSinkTypeEnum;
67
import io.swagger.v3.oas.annotations.media.Schema;
78
import lombok.Data;
89
import org.springframework.format.annotation.DateTimeFormat;
@@ -22,6 +23,10 @@ public class IotDataSinkPageReqVO extends PageParam {
2223
@InEnum(CommonStatusEnum.class)
2324
private Integer status;
2425

26+
@Schema(description = "数据目的类型", example = "1")
27+
@InEnum(IotDataSinkTypeEnum.class)
28+
private Integer type;
29+
2530
@Schema(description = "创建时间")
2631
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
2732
private LocalDateTime[] createTime;

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/IotSceneRuleDO.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import lombok.Data;
2222
import lombok.NoArgsConstructor;
2323

24+
import java.time.LocalDateTime;
2425
import java.util.List;
2526

2627
/**
@@ -56,6 +57,11 @@ public class IotSceneRuleDO extends TenantBaseDO {
5657
*/
5758
private Integer status;
5859

60+
/**
61+
* 最后触发时间
62+
*/
63+
private LocalDateTime lastTriggerTime;
64+
5965
/**
6066
* 场景定义配置
6167
*/

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/config/IotDataSinkTcpConfig.java

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,35 @@
1010
@Data
1111
public class IotDataSinkTcpConfig extends IotAbstractDataSinkConfig {
1212

13+
/**
14+
* 默认连接超时时间(毫秒)
15+
*/
16+
public static final int DEFAULT_CONNECT_TIMEOUT_MS = 5000;
17+
/**
18+
* 默认读取超时时间(毫秒)
19+
*/
20+
public static final int DEFAULT_READ_TIMEOUT_MS = 10000;
21+
/**
22+
* 默认是否启用 SSL
23+
*/
24+
public static final boolean DEFAULT_SSL = false;
25+
/**
26+
* 默认数据格式
27+
*/
28+
public static final String DEFAULT_DATA_FORMAT = "JSON";
29+
/**
30+
* 默认心跳间隔时间(毫秒)
31+
*/
32+
public static final long DEFAULT_HEARTBEAT_INTERVAL_MS = 30000L;
33+
/**
34+
* 默认重连间隔时间(毫秒)
35+
*/
36+
public static final long DEFAULT_RECONNECT_INTERVAL_MS = 5000L;
37+
/**
38+
* 默认最大重连次数
39+
*/
40+
public static final int DEFAULT_MAX_RECONNECT_ATTEMPTS = 3;
41+
1342
/**
1443
* TCP 服务器地址
1544
*/
@@ -23,17 +52,17 @@ public class IotDataSinkTcpConfig extends IotAbstractDataSinkConfig {
2352
/**
2453
* 连接超时时间(毫秒)
2554
*/
26-
private Integer connectTimeoutMs = 5000;
55+
private Integer connectTimeoutMs = DEFAULT_CONNECT_TIMEOUT_MS;
2756

2857
/**
2958
* 读取超时时间(毫秒)
3059
*/
31-
private Integer readTimeoutMs = 10000;
60+
private Integer readTimeoutMs = DEFAULT_READ_TIMEOUT_MS;
3261

3362
/**
3463
* 是否启用 SSL
3564
*/
36-
private Boolean ssl = false;
65+
private Boolean ssl = DEFAULT_SSL;
3766

3867
/**
3968
* SSL 证书路径(当 ssl=true 时需要)
@@ -43,21 +72,21 @@ public class IotDataSinkTcpConfig extends IotAbstractDataSinkConfig {
4372
/**
4473
* 数据格式:JSON 或 BINARY
4574
*/
46-
private String dataFormat = "JSON";
75+
private String dataFormat = DEFAULT_DATA_FORMAT;
4776

4877
/**
4978
* 心跳间隔时间(毫秒),0 表示不启用心跳
5079
*/
51-
private Long heartbeatIntervalMs = 30000L;
80+
private Long heartbeatIntervalMs = DEFAULT_HEARTBEAT_INTERVAL_MS;
5281

5382
/**
5483
* 重连间隔时间(毫秒)
5584
*/
56-
private Long reconnectIntervalMs = 5000L;
85+
private Long reconnectIntervalMs = DEFAULT_RECONNECT_INTERVAL_MS;
5786

5887
/**
5988
* 最大重连次数
6089
*/
61-
private Integer maxReconnectAttempts = 3;
90+
private Integer maxReconnectAttempts = DEFAULT_MAX_RECONNECT_ATTEMPTS;
6291

6392
}

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/dataobject/rule/config/IotDataSinkWebSocketConfig.java

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,51 @@
1313
@Data
1414
public class IotDataSinkWebSocketConfig extends IotAbstractDataSinkConfig {
1515

16+
/**
17+
* 默认连接超时时间(毫秒)
18+
*/
19+
public static final int DEFAULT_CONNECT_TIMEOUT_MS = 5000;
20+
/**
21+
* 默认发送超时时间(毫秒)
22+
*/
23+
public static final int DEFAULT_SEND_TIMEOUT_MS = 10000;
24+
/**
25+
* 默认心跳间隔时间(毫秒)
26+
*/
27+
public static final long DEFAULT_HEARTBEAT_INTERVAL_MS = 30000L;
28+
/**
29+
* 默认心跳消息内容
30+
*/
31+
public static final String DEFAULT_HEARTBEAT_MESSAGE = "{\"type\":\"heartbeat\"}";
32+
/**
33+
* 默认是否启用 SSL 证书验证
34+
*/
35+
public static final boolean DEFAULT_VERIFY_SSL_CERT = true;
36+
/**
37+
* 默认数据格式
38+
*/
39+
public static final String DEFAULT_DATA_FORMAT = "JSON";
40+
/**
41+
* 默认重连间隔时间(毫秒)
42+
*/
43+
public static final long DEFAULT_RECONNECT_INTERVAL_MS = 5000L;
44+
/**
45+
* 默认最大重连次数
46+
*/
47+
public static final int DEFAULT_MAX_RECONNECT_ATTEMPTS = 3;
48+
/**
49+
* 默认是否启用压缩
50+
*/
51+
public static final boolean DEFAULT_ENABLE_COMPRESSION = false;
52+
/**
53+
* 默认消息发送重试次数
54+
*/
55+
public static final int DEFAULT_SEND_RETRY_COUNT = 1;
56+
/**
57+
* 默认消息发送重试间隔(毫秒)
58+
*/
59+
public static final long DEFAULT_SEND_RETRY_INTERVAL_MS = 1000L;
60+
1661
/**
1762
* WebSocket 服务器地址
1863
* 例如:ws://localhost:8080/ws 或 wss://example.com/ws
@@ -22,22 +67,22 @@ public class IotDataSinkWebSocketConfig extends IotAbstractDataSinkConfig {
2267
/**
2368
* 连接超时时间(毫秒)
2469
*/
25-
private Integer connectTimeoutMs = 5000;
70+
private Integer connectTimeoutMs = DEFAULT_CONNECT_TIMEOUT_MS;
2671

2772
/**
2873
* 发送超时时间(毫秒)
2974
*/
30-
private Integer sendTimeoutMs = 10000;
75+
private Integer sendTimeoutMs = DEFAULT_SEND_TIMEOUT_MS;
3176

3277
/**
3378
* 心跳间隔时间(毫秒),0 表示不启用心跳
3479
*/
35-
private Long heartbeatIntervalMs = 30000L;
80+
private Long heartbeatIntervalMs = DEFAULT_HEARTBEAT_INTERVAL_MS;
3681

3782
/**
3883
* 心跳消息内容(JSON 格式)
3984
*/
40-
private String heartbeatMessage = "{\"type\":\"heartbeat\"}";
85+
private String heartbeatMessage = DEFAULT_HEARTBEAT_MESSAGE;
4186

4287
/**
4388
* 子协议列表(逗号分隔)
@@ -52,36 +97,36 @@ public class IotDataSinkWebSocketConfig extends IotAbstractDataSinkConfig {
5297
/**
5398
* 是否启用 SSL 证书验证(仅对 wss:// 生效)
5499
*/
55-
private Boolean verifySslCert = true;
100+
private Boolean verifySslCert = DEFAULT_VERIFY_SSL_CERT;
56101

57102
/**
58103
* 数据格式:JSON 或 TEXT
59104
*/
60-
private String dataFormat = "JSON";
105+
private String dataFormat = DEFAULT_DATA_FORMAT;
61106

62107
/**
63108
* 重连间隔时间(毫秒)
64109
*/
65-
private Long reconnectIntervalMs = 5000L;
110+
private Long reconnectIntervalMs = DEFAULT_RECONNECT_INTERVAL_MS;
66111

67112
/**
68113
* 最大重连次数
69114
*/
70-
private Integer maxReconnectAttempts = 3;
115+
private Integer maxReconnectAttempts = DEFAULT_MAX_RECONNECT_ATTEMPTS;
71116

72117
/**
73118
* 是否启用压缩
74119
*/
75-
private Boolean enableCompression = false;
120+
private Boolean enableCompression = DEFAULT_ENABLE_COMPRESSION;
76121

77122
/**
78123
* 消息发送重试次数
79124
*/
80-
private Integer sendRetryCount = 1;
125+
private Integer sendRetryCount = DEFAULT_SEND_RETRY_COUNT;
81126

82127
/**
83128
* 消息发送重试间隔(毫秒)
84129
*/
85-
private Long sendRetryIntervalMs = 1000L;
130+
private Long sendRetryIntervalMs = DEFAULT_SEND_RETRY_INTERVAL_MS;
86131

87132
}

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/device/IotDeviceMapper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ default PageResult<IotDeviceDO> selectPage(IotDevicePageReqVO reqVO) {
3131
.eqIfPresent(IotDeviceDO::getDeviceType, reqVO.getDeviceType())
3232
.likeIfPresent(IotDeviceDO::getNickname, reqVO.getNickname())
3333
.eqIfPresent(IotDeviceDO::getState, reqVO.getStatus())
34+
.eqIfPresent(IotDeviceDO::getGatewayId, reqVO.getGatewayId())
3435
.apply(ObjectUtil.isNotNull(reqVO.getGroupId()), "FIND_IN_SET(" + reqVO.getGroupId() + ",group_ids) > 0")
3536
.orderByDesc(IotDeviceDO::getId));
3637
}

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/rule/IotDataRuleMapper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,8 @@ default List<IotDataRuleDO> selectListByStatus(Integer status) {
3535
return selectList(IotDataRuleDO::getStatus, status);
3636
}
3737

38+
default IotDataRuleDO selectByName(String name) {
39+
return selectOne(IotDataRuleDO::getName, name);
40+
}
41+
3842
}

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/dal/mysql/rule/IotDataSinkMapper.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ default PageResult<IotDataSinkDO> selectPage(IotDataSinkPageReqVO reqVO) {
2121
return selectPage(reqVO, new LambdaQueryWrapperX<IotDataSinkDO>()
2222
.likeIfPresent(IotDataSinkDO::getName, reqVO.getName())
2323
.eqIfPresent(IotDataSinkDO::getStatus, reqVO.getStatus())
24+
.eqIfPresent(IotDataSinkDO::getType, reqVO.getType())
2425
.betweenIfPresent(IotDataSinkDO::getCreateTime, reqVO.getCreateTime())
2526
.orderByDesc(IotDataSinkDO::getId));
2627
}
@@ -29,4 +30,8 @@ default List<IotDataSinkDO> selectListByStatus(Integer status) {
2930
return selectList(IotDataSinkDO::getStatus, status);
3031
}
3132

33+
default IotDataSinkDO selectByName(String name) {
34+
return selectOne(IotDataSinkDO::getName, name);
35+
}
36+
3237
}

yudao-module-iot/yudao-module-iot-biz/src/main/java/cn/iocoder/yudao/module/iot/enums/ErrorCodeConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,12 @@ public interface ErrorCodeConstants {
6565

6666
// ========== IoT 数据流转规则 1-050-010-000 ==========
6767
ErrorCode DATA_RULE_NOT_EXISTS = new ErrorCode(1_050_010_000, "数据流转规则不存在");
68+
ErrorCode DATA_RULE_NAME_EXISTS = new ErrorCode(1_050_010_001, "数据流转规则名称已存在");
6869

6970
// ========== IoT 数据流转目的 1-050-011-000 ==========
7071
ErrorCode DATA_SINK_NOT_EXISTS = new ErrorCode(1_050_011_000, "数据桥梁不存在");
7172
ErrorCode DATA_SINK_DELETE_FAIL_USED_BY_RULE = new ErrorCode(1_050_011_001, "数据流转目的正在被数据流转规则使用,无法删除");
73+
ErrorCode DATA_SINK_NAME_EXISTS = new ErrorCode(1_050_011_002, "数据流转目的名称已存在");
7274

7375
// ========== IoT 场景联动 1-050-012-000 ==========
7476
ErrorCode RULE_SCENE_NOT_EXISTS = new ErrorCode(1_050_012_000, "场景联动不存在");

0 commit comments

Comments
 (0)