Commit 0c01ea2e094990b8c5dfa857a1175f2626909a1b
1 parent
7c6d0194
refactor: 组态数据交互逻辑优化
1、数据源和事件交互的组织解绑
Showing
8 changed files
with
38 additions
and
29 deletions
@@ -36,7 +36,7 @@ public class YtConfigurationNodeController extends BaseController { | @@ -36,7 +36,7 @@ public class YtConfigurationNodeController extends BaseController { | ||
36 | private final YtConfigurationActService actService; | 36 | private final YtConfigurationActService actService; |
37 | 37 | ||
38 | @PostMapping | 38 | @PostMapping |
39 | - @ApiOperation("编辑节点信息") | 39 | + @ApiOperation("保存节点数据源并刷新节点的交互和动效信息") |
40 | public ResponseEntity<ConfigurationNodeStateDTO> saveNode( | 40 | public ResponseEntity<ConfigurationNodeStateDTO> saveNode( |
41 | @Validated({AddGroup.class}) @RequestBody ConfigurationNodeStateDTO nodeDTO) | 41 | @Validated({AddGroup.class}) @RequestBody ConfigurationNodeStateDTO nodeDTO) |
42 | throws ThingsboardException { | 42 | throws ThingsboardException { |
@@ -23,11 +23,7 @@ public class ConfigurationActDTO extends ConfigurationDTO { | @@ -23,11 +23,7 @@ public class ConfigurationActDTO extends ConfigurationDTO { | ||
23 | 23 | ||
24 | @ApiModelProperty(value = "动画类型", required = true) | 24 | @ApiModelProperty(value = "动画类型", required = true) |
25 | private ActTypeEnum type; | 25 | private ActTypeEnum type; |
26 | - @ApiModelProperty(value = "orgId", required = true) | ||
27 | - @NotEmpty( | ||
28 | - message = "设备所属组织ID", | ||
29 | - groups = {UpdateGroup.class, AddGroup.class}) | ||
30 | - private String orgId; | 26 | + |
31 | 27 | ||
32 | @ApiModelProperty(value = "tbDeviceId", required = true) | 28 | @ApiModelProperty(value = "tbDeviceId", required = true) |
33 | @NotEmpty( | 29 | @NotEmpty( |
@@ -31,5 +31,9 @@ public class ConfigurationDTO extends TenantDTO { | @@ -31,5 +31,9 @@ public class ConfigurationDTO extends TenantDTO { | ||
31 | groups = {UpdateGroup.class, AddGroup.class}) | 31 | groups = {UpdateGroup.class, AddGroup.class}) |
32 | private String contentId; | 32 | private String contentId; |
33 | 33 | ||
34 | - | 34 | + @ApiModelProperty(value = "orgId", required = true) |
35 | + @NotEmpty( | ||
36 | + message = "设备所属组织ID", | ||
37 | + groups = {UpdateGroup.class, AddGroup.class}) | ||
38 | + private String orgId; | ||
35 | } | 39 | } |
@@ -24,11 +24,7 @@ public class ConfigurationDatasourceDTO extends ConfigurationDTO { | @@ -24,11 +24,7 @@ public class ConfigurationDatasourceDTO extends ConfigurationDTO { | ||
24 | message = "组件ID不能未空或空字符串", | 24 | message = "组件ID不能未空或空字符串", |
25 | groups = {UpdateGroup.class, AddGroup.class}) | 25 | groups = {UpdateGroup.class, AddGroup.class}) |
26 | private String nodeId; | 26 | private String nodeId; |
27 | - @ApiModelProperty(value = "orgId", required = true) | ||
28 | - @NotEmpty( | ||
29 | - message = "设备所属组织ID", | ||
30 | - groups = {UpdateGroup.class, AddGroup.class}) | ||
31 | - private String orgId; | 27 | + |
32 | 28 | ||
33 | @ApiModelProperty(value = "tbDeviceId", required = true) | 29 | @ApiModelProperty(value = "tbDeviceId", required = true) |
34 | @NotEmpty( | 30 | @NotEmpty( |
@@ -16,19 +16,14 @@ import org.thingsboard.server.common.data.yunteng.enums.ActTypeEnum; | @@ -16,19 +16,14 @@ import org.thingsboard.server.common.data.yunteng.enums.ActTypeEnum; | ||
16 | @EqualsAndHashCode(callSuper = true) | 16 | @EqualsAndHashCode(callSuper = true) |
17 | @TableName(value = ModelConstants.Table.IOTFS_CONFIGURATION_ACT, autoResultMap = true) | 17 | @TableName(value = ModelConstants.Table.IOTFS_CONFIGURATION_ACT, autoResultMap = true) |
18 | @Data | 18 | @Data |
19 | -public class ConfigurationAct extends TenantBaseEntity { | 19 | +public class ConfigurationAct extends ConfigurationBaseEntity { |
20 | private static final long serialVersionUID = -4125982858197381343L; | 20 | private static final long serialVersionUID = -4125982858197381343L; |
21 | - private String configurationId; | ||
22 | - private String contentId; | ||
23 | @TableField(typeHandler = EnumTypeHandler.class) | 21 | @TableField(typeHandler = EnumTypeHandler.class) |
24 | private ActTypeEnum type; | 22 | private ActTypeEnum type; |
25 | - private String remark; | ||
26 | - private String orgId; | ||
27 | private String deviceId; | 23 | private String deviceId; |
28 | private String slaveDeviceId; | 24 | private String slaveDeviceId; |
29 | private String attr; | 25 | private String attr; |
30 | @TableField(typeHandler = JacksonTypeHandler.class) | 26 | @TableField(typeHandler = JacksonTypeHandler.class) |
31 | private JsonNode condition; | 27 | private JsonNode condition; |
32 | - private boolean enabled; | ||
33 | 28 | ||
34 | } | 29 | } |
dao/src/main/java/org/thingsboard/server/dao/yunteng/entities/ConfigurationBaseEntity.java
0 → 100644
1 | +package org.thingsboard.server.dao.yunteng.entities; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
4 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
5 | +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | ||
6 | +import com.fasterxml.jackson.databind.JsonNode; | ||
7 | +import lombok.Data; | ||
8 | +import lombok.EqualsAndHashCode; | ||
9 | +import lombok.Getter; | ||
10 | +import lombok.Setter; | ||
11 | +import org.apache.ibatis.type.EnumTypeHandler; | ||
12 | +import org.thingsboard.server.common.data.yunteng.constant.ModelConstants; | ||
13 | +import org.thingsboard.server.common.data.yunteng.enums.ActTypeEnum; | ||
14 | + | ||
15 | +/** | ||
16 | + * @author Administrator | ||
17 | + */ | ||
18 | +@Getter | ||
19 | +@Setter | ||
20 | +public class ConfigurationBaseEntity extends TenantBaseEntity { | ||
21 | + private String configurationId; | ||
22 | + private String contentId; | ||
23 | + private String remark; | ||
24 | + private String orgId; | ||
25 | + private boolean enabled; | ||
26 | + | ||
27 | +} |
@@ -17,16 +17,11 @@ import java.util.List; | @@ -17,16 +17,11 @@ import java.util.List; | ||
17 | @EqualsAndHashCode(callSuper = true) | 17 | @EqualsAndHashCode(callSuper = true) |
18 | @TableName(value = ModelConstants.Table.IOTFS_CONFIGURATION_DATASOURCE, autoResultMap = true) | 18 | @TableName(value = ModelConstants.Table.IOTFS_CONFIGURATION_DATASOURCE, autoResultMap = true) |
19 | @Data | 19 | @Data |
20 | -public class ConfigurationDatasource extends TenantBaseEntity { | 20 | +public class ConfigurationDatasource extends ConfigurationBaseEntity { |
21 | private static final long serialVersionUID = 2830393872646826226L; | 21 | private static final long serialVersionUID = 2830393872646826226L; |
22 | - private String configurationId; | ||
23 | - private String contentId; | ||
24 | private String nodeId; | 22 | private String nodeId; |
25 | - private String orgId; | ||
26 | private String deviceId; | 23 | private String deviceId; |
27 | private String slaveDeviceId; | 24 | private String slaveDeviceId; |
28 | private String attr; | 25 | private String attr; |
29 | - private String remark; | ||
30 | - private boolean enabled; | ||
31 | 26 | ||
32 | } | 27 | } |
@@ -16,14 +16,10 @@ import org.thingsboard.server.common.data.yunteng.enums.EventTypeEnum; | @@ -16,14 +16,10 @@ import org.thingsboard.server.common.data.yunteng.enums.EventTypeEnum; | ||
16 | @EqualsAndHashCode(callSuper = true) | 16 | @EqualsAndHashCode(callSuper = true) |
17 | @TableName(value = ModelConstants.Table.IOTFS_CONFIGURATION_EVENT, autoResultMap = true) | 17 | @TableName(value = ModelConstants.Table.IOTFS_CONFIGURATION_EVENT, autoResultMap = true) |
18 | @Data | 18 | @Data |
19 | -public class ConfigurationEvent extends TenantBaseEntity { | 19 | +public class ConfigurationEvent extends ConfigurationBaseEntity { |
20 | private static final long serialVersionUID = 4613503997176066996L; | 20 | private static final long serialVersionUID = 4613503997176066996L; |
21 | - private String configurationId; | ||
22 | - private String contentId; | ||
23 | @TableField(typeHandler = JacksonTypeHandler.class) | 21 | @TableField(typeHandler = JacksonTypeHandler.class) |
24 | private JsonNode content; | 22 | private JsonNode content; |
25 | @TableField(typeHandler = EnumTypeHandler.class) | 23 | @TableField(typeHandler = EnumTypeHandler.class) |
26 | private EventTypeEnum type; | 24 | private EventTypeEnum type; |
27 | - private String remark; | ||
28 | - private boolean enabled; | ||
29 | } | 25 | } |