Commit a923c93e80a8ebf4aacd7f1fea27eed16e0b5cbb
1 parent
1aff86ed
feat: 组态节点相关功能
1、新增组态动画效果 2、完善组态数据源字段
Showing
12 changed files
with
283 additions
and
9 deletions
@@ -10,9 +10,11 @@ import org.springframework.web.bind.annotation.*; | @@ -10,9 +10,11 @@ import org.springframework.web.bind.annotation.*; | ||
10 | import org.thingsboard.server.common.data.exception.ThingsboardException; | 10 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
11 | import org.thingsboard.server.common.data.yunteng.common.AddGroup; | 11 | import org.thingsboard.server.common.data.yunteng.common.AddGroup; |
12 | import org.thingsboard.server.common.data.yunteng.common.DeleteGroup; | 12 | import org.thingsboard.server.common.data.yunteng.common.DeleteGroup; |
13 | +import org.thingsboard.server.common.data.yunteng.dto.ConfigurationActDTO; | ||
13 | import org.thingsboard.server.common.data.yunteng.dto.ConfigurationDatasourceDTO; | 14 | import org.thingsboard.server.common.data.yunteng.dto.ConfigurationDatasourceDTO; |
14 | import org.thingsboard.server.common.data.yunteng.dto.ConfigurationEventDTO; | 15 | import org.thingsboard.server.common.data.yunteng.dto.ConfigurationEventDTO; |
15 | import org.thingsboard.server.controller.BaseController; | 16 | import org.thingsboard.server.controller.BaseController; |
17 | +import org.thingsboard.server.dao.yunteng.service.YtConfigurationActService; | ||
16 | import org.thingsboard.server.dao.yunteng.service.YtConfigurationDatasourceService; | 18 | import org.thingsboard.server.dao.yunteng.service.YtConfigurationDatasourceService; |
17 | import org.thingsboard.server.dao.yunteng.service.YtConfigurationEventService; | 19 | import org.thingsboard.server.dao.yunteng.service.YtConfigurationEventService; |
18 | 20 | ||
@@ -31,6 +33,7 @@ public class YtConfigurationNodeController extends BaseController { | @@ -31,6 +33,7 @@ public class YtConfigurationNodeController extends BaseController { | ||
31 | 33 | ||
32 | private final YtConfigurationDatasourceService datasourceService; | 34 | private final YtConfigurationDatasourceService datasourceService; |
33 | private final YtConfigurationEventService eventService; | 35 | private final YtConfigurationEventService eventService; |
36 | + private final YtConfigurationActService actService; | ||
34 | 37 | ||
35 | @PostMapping("datascource") | 38 | @PostMapping("datascource") |
36 | @ApiOperation("编辑数据源") | 39 | @ApiOperation("编辑数据源") |
@@ -52,11 +55,20 @@ public class YtConfigurationNodeController extends BaseController { | @@ -52,11 +55,20 @@ public class YtConfigurationNodeController extends BaseController { | ||
52 | eventService.saveConfigurationEvent(eventDTO)); | 55 | eventService.saveConfigurationEvent(eventDTO)); |
53 | } | 56 | } |
54 | 57 | ||
58 | + @PostMapping("act") | ||
59 | + @ApiOperation("编辑动画效果") | ||
60 | + public ResponseEntity<ConfigurationActDTO> saveAct( | ||
61 | + @Validated({AddGroup.class}) @RequestBody ConfigurationActDTO actDTO) | ||
62 | + throws ThingsboardException { | ||
63 | + actDTO.setTenantId(getCurrentUser().getCurrentTenantId()); | ||
64 | + return ResponseEntity.ok( | ||
65 | + actService.saveConfigurationAct(actDTO)); | ||
66 | + } | ||
67 | + | ||
55 | 68 | ||
56 | @DeleteMapping("datascource") | 69 | @DeleteMapping("datascource") |
57 | @ApiOperation("删除数据源") | 70 | @ApiOperation("删除数据源") |
58 | - public ResponseEntity<Boolean> deleteDatascource( | ||
59 | - @Validated({DeleteGroup.class}) @RequestBody ConfigurationDatasourceDTO deleteDTO) | 71 | + public ResponseEntity<Boolean> deleteDatascource(@RequestBody ConfigurationDatasourceDTO deleteDTO) |
60 | throws ThingsboardException { | 72 | throws ThingsboardException { |
61 | deleteDTO.setTenantId(getCurrentUser().getCurrentTenantId()); | 73 | deleteDTO.setTenantId(getCurrentUser().getCurrentTenantId()); |
62 | return ResponseEntity.ok(datasourceService.deleteConfigurationDatasource(deleteDTO)); | 74 | return ResponseEntity.ok(datasourceService.deleteConfigurationDatasource(deleteDTO)); |
@@ -64,12 +76,18 @@ public class YtConfigurationNodeController extends BaseController { | @@ -64,12 +76,18 @@ public class YtConfigurationNodeController extends BaseController { | ||
64 | 76 | ||
65 | @DeleteMapping("event") | 77 | @DeleteMapping("event") |
66 | @ApiOperation("删除数据交互") | 78 | @ApiOperation("删除数据交互") |
67 | - public ResponseEntity<Boolean> deleteEvent( | ||
68 | - @Validated({DeleteGroup.class}) @RequestBody ConfigurationEventDTO deleteDTO) | 79 | + public ResponseEntity<Boolean> deleteEvent( @RequestBody ConfigurationEventDTO deleteDTO) |
69 | throws ThingsboardException { | 80 | throws ThingsboardException { |
70 | deleteDTO.setTenantId(getCurrentUser().getCurrentTenantId()); | 81 | deleteDTO.setTenantId(getCurrentUser().getCurrentTenantId()); |
71 | return ResponseEntity.ok(eventService.deleteConfigurationEvent(deleteDTO)); | 82 | return ResponseEntity.ok(eventService.deleteConfigurationEvent(deleteDTO)); |
72 | } | 83 | } |
84 | + @DeleteMapping("act") | ||
85 | + @ApiOperation("删除动画效果") | ||
86 | + public ResponseEntity<Boolean> deleteAct( @RequestBody ConfigurationActDTO deleteDTO) | ||
87 | + throws ThingsboardException { | ||
88 | + deleteDTO.setTenantId(getCurrentUser().getCurrentTenantId()); | ||
89 | + return ResponseEntity.ok(actService.deleteConfigurationAct(deleteDTO)); | ||
90 | + } | ||
73 | 91 | ||
74 | 92 | ||
75 | @GetMapping("/{levelType}/{levelId}") | 93 | @GetMapping("/{levelType}/{levelId}") |
@@ -81,6 +99,7 @@ public class YtConfigurationNodeController extends BaseController { | @@ -81,6 +99,7 @@ public class YtConfigurationNodeController extends BaseController { | ||
81 | 99 | ||
82 | List<ConfigurationDatasourceDTO> sources = datasourceService.listConfigurationDatasource(tenantId, levelType, levelId); | 100 | List<ConfigurationDatasourceDTO> sources = datasourceService.listConfigurationDatasource(tenantId, levelType, levelId); |
83 | List<ConfigurationEventDTO> events = eventService.listConfigurationEvent(tenantId, levelType, levelId); | 101 | List<ConfigurationEventDTO> events = eventService.listConfigurationEvent(tenantId, levelType, levelId); |
102 | + List<ConfigurationActDTO> acts = actService.listConfigurationAct(tenantId, levelType, levelId); | ||
84 | Map<String, List> result = new HashMap<>(); | 103 | Map<String, List> result = new HashMap<>(); |
85 | if (sources != null && sources.size() > 0) { | 104 | if (sources != null && sources.size() > 0) { |
86 | result.put("dataSources", sources); | 105 | result.put("dataSources", sources); |
@@ -88,6 +107,9 @@ public class YtConfigurationNodeController extends BaseController { | @@ -88,6 +107,9 @@ public class YtConfigurationNodeController extends BaseController { | ||
88 | if (events != null && events.size() > 0) { | 107 | if (events != null && events.size() > 0) { |
89 | result.put("event", events); | 108 | result.put("event", events); |
90 | } | 109 | } |
110 | + if (acts != null && acts.size() > 0) { | ||
111 | + result.put("act", acts); | ||
112 | + } | ||
91 | return ResponseEntity.ok(result); | 113 | return ResponseEntity.ok(result); |
92 | } | 114 | } |
93 | 115 |
@@ -75,10 +75,12 @@ public final class ModelConstants { | @@ -75,10 +75,12 @@ public final class ModelConstants { | ||
75 | public static final String IOTFS_CONFIGURATION_CENTER_NAME = "iotfs_configuration_center"; | 75 | public static final String IOTFS_CONFIGURATION_CENTER_NAME = "iotfs_configuration_center"; |
76 | /** 组态内容 */ | 76 | /** 组态内容 */ |
77 | public static final String IOTFS_CONFIGURATION_CONTENT_NAME = "iotfs_configuration_content"; | 77 | public static final String IOTFS_CONFIGURATION_CONTENT_NAME = "iotfs_configuration_content"; |
78 | - /** 组态内容 */ | 78 | + /** 组态节点数据源 */ |
79 | public static final String IOTFS_CONFIGURATION_DATASOURCE = "iotfs_configuration_datasource"; | 79 | public static final String IOTFS_CONFIGURATION_DATASOURCE = "iotfs_configuration_datasource"; |
80 | - /** 组态内容 */ | 80 | + /** 组态节点数据交互 */ |
81 | public static final String IOTFS_CONFIGURATION_EVENT = "iotfs_configuration_event"; | 81 | public static final String IOTFS_CONFIGURATION_EVENT = "iotfs_configuration_event"; |
82 | + /** 组态节点动画效果 */ | ||
83 | + public static final String IOTFS_CONFIGURATION_ACT = "iotfs_configuration_act"; | ||
82 | /** 视频流 */ | 84 | /** 视频流 */ |
83 | public static final String IOTFS_VIDEO_STREAM_TABLE_NAME = "iotfs_device_camera"; | 85 | public static final String IOTFS_VIDEO_STREAM_TABLE_NAME = "iotfs_device_camera"; |
84 | /** 意见反馈 */ | 86 | /** 意见反馈 */ |
common/data/src/main/java/org/thingsboard/server/common/data/yunteng/dto/ConfigurationActDTO.java
0 → 100644
1 | +package org.thingsboard.server.common.data.yunteng.dto; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.databind.JsonNode; | ||
4 | +import io.swagger.annotations.ApiModelProperty; | ||
5 | +import lombok.Data; | ||
6 | +import lombok.EqualsAndHashCode; | ||
7 | +import org.thingsboard.server.common.data.yunteng.common.AddGroup; | ||
8 | +import org.thingsboard.server.common.data.yunteng.common.UpdateGroup; | ||
9 | +import org.thingsboard.server.common.data.yunteng.enums.ActTypeEnum; | ||
10 | +import org.thingsboard.server.common.data.yunteng.enums.EventTypeEnum; | ||
11 | + | ||
12 | +import javax.validation.constraints.NotEmpty; | ||
13 | +import java.util.List; | ||
14 | + | ||
15 | +/** | ||
16 | + * 组态节点动画效果 | ||
17 | + * @author Administrator | ||
18 | + */ | ||
19 | +@EqualsAndHashCode(callSuper = true) | ||
20 | +@Data | ||
21 | +public class ConfigurationActDTO extends TenantDTO { | ||
22 | + @ApiModelProperty(value = "组态ID", required = true) | ||
23 | + @NotEmpty( | ||
24 | + message = "组态ID不能为空或空字符串", | ||
25 | + groups = {UpdateGroup.class, AddGroup.class}) | ||
26 | + private String configurationId; | ||
27 | + | ||
28 | + @ApiModelProperty(value = "页面ID", required = true) | ||
29 | + @NotEmpty( | ||
30 | + message = "页面ID不能为空或空字符串", | ||
31 | + groups = {UpdateGroup.class, AddGroup.class}) | ||
32 | + private String contentId; | ||
33 | + | ||
34 | + @ApiModelProperty(value = "动画类型", required = true) | ||
35 | + @NotEmpty( | ||
36 | + message = "tbDeviceId不能未空或空字符串", | ||
37 | + groups = {UpdateGroup.class, AddGroup.class}) | ||
38 | + private ActTypeEnum type; | ||
39 | + @ApiModelProperty(value = "orgId", required = true) | ||
40 | + @NotEmpty( | ||
41 | + message = "设备所属组织ID", | ||
42 | + groups = {UpdateGroup.class, AddGroup.class}) | ||
43 | + private String orgId; | ||
44 | + | ||
45 | + @ApiModelProperty(value = "tbDeviceId", required = true) | ||
46 | + @NotEmpty( | ||
47 | + message = "tbDeviceId不能未空或空字符串", | ||
48 | + groups = {UpdateGroup.class, AddGroup.class}) | ||
49 | + private String deviceId; | ||
50 | + private String slaveDeviceId; | ||
51 | + | ||
52 | + @ApiModelProperty(value = "组件关注的指标") | ||
53 | + private String attr; | ||
54 | + @ApiModelProperty(value = "触发条件") | ||
55 | + private JsonNode content; | ||
56 | + | ||
57 | + @ApiModelProperty(value = "组态描述") | ||
58 | + private String remark; | ||
59 | +} |
@@ -9,6 +9,7 @@ import org.thingsboard.server.common.data.yunteng.common.UpdateGroup; | @@ -9,6 +9,7 @@ import org.thingsboard.server.common.data.yunteng.common.UpdateGroup; | ||
9 | 9 | ||
10 | import javax.validation.constraints.NotEmpty; | 10 | import javax.validation.constraints.NotEmpty; |
11 | import javax.validation.constraints.NotNull; | 11 | import javax.validation.constraints.NotNull; |
12 | +import java.util.List; | ||
12 | 13 | ||
13 | /** | 14 | /** |
14 | * 组态结点数据源 | 15 | * 组态结点数据源 |
@@ -35,14 +36,21 @@ public class ConfigurationDatasourceDTO extends TenantDTO { | @@ -35,14 +36,21 @@ public class ConfigurationDatasourceDTO extends TenantDTO { | ||
35 | groups = {UpdateGroup.class, AddGroup.class}) | 36 | groups = {UpdateGroup.class, AddGroup.class}) |
36 | private String nodeId; | 37 | private String nodeId; |
37 | 38 | ||
39 | + @ApiModelProperty(value = "orgId", required = true) | ||
40 | + @NotEmpty( | ||
41 | + message = "设备所属组织ID", | ||
42 | + groups = {UpdateGroup.class, AddGroup.class}) | ||
43 | + private String orgId; | ||
44 | + | ||
38 | @ApiModelProperty(value = "tbDeviceId", required = true) | 45 | @ApiModelProperty(value = "tbDeviceId", required = true) |
39 | @NotEmpty( | 46 | @NotEmpty( |
40 | message = "tbDeviceId不能未空或空字符串", | 47 | message = "tbDeviceId不能未空或空字符串", |
41 | groups = {UpdateGroup.class, AddGroup.class}) | 48 | groups = {UpdateGroup.class, AddGroup.class}) |
42 | private String deviceId; | 49 | private String deviceId; |
50 | + private String slaveDeviceId; | ||
43 | 51 | ||
44 | @ApiModelProperty(value = "组件关注的指标") | 52 | @ApiModelProperty(value = "组件关注的指标") |
45 | - private JsonNode attr; | 53 | + private List<String> attr; |
46 | 54 | ||
47 | @ApiModelProperty(value = "组态描述") | 55 | @ApiModelProperty(value = "组态描述") |
48 | private String remark; | 56 | private String remark; |
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 org.apache.ibatis.type.EnumTypeHandler; | ||
10 | +import org.thingsboard.server.common.data.yunteng.constant.ModelConstants; | ||
11 | +import org.thingsboard.server.common.data.yunteng.enums.ActTypeEnum; | ||
12 | + | ||
13 | +/** | ||
14 | + * @author Administrator | ||
15 | + */ | ||
16 | +@EqualsAndHashCode(callSuper = true) | ||
17 | +@TableName(ModelConstants.Table.IOTFS_CONFIGURATION_ACT) | ||
18 | +@Data | ||
19 | +public class ConfigurationAct extends TenantBaseEntity { | ||
20 | + private static final long serialVersionUID = -4125982858197381343L; | ||
21 | + private String configurationId; | ||
22 | + private String contentId; | ||
23 | + @TableField(typeHandler = EnumTypeHandler.class) | ||
24 | + private ActTypeEnum type; | ||
25 | + private String remark; | ||
26 | + private String orgId; | ||
27 | + private String deviceId; | ||
28 | + private String slaveDeviceId; | ||
29 | + private String attr; | ||
30 | + @TableField(typeHandler = JacksonTypeHandler.class) | ||
31 | + private JsonNode content; | ||
32 | +} |
1 | package org.thingsboard.server.dao.yunteng.entities; | 1 | package org.thingsboard.server.dao.yunteng.entities; |
2 | 2 | ||
3 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
3 | import com.baomidou.mybatisplus.annotation.TableName; | 4 | import com.baomidou.mybatisplus.annotation.TableName; |
5 | +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | ||
4 | import com.fasterxml.jackson.databind.JsonNode; | 6 | import com.fasterxml.jackson.databind.JsonNode; |
5 | import lombok.Data; | 7 | import lombok.Data; |
6 | import lombok.EqualsAndHashCode; | 8 | import lombok.EqualsAndHashCode; |
7 | import org.thingsboard.server.common.data.yunteng.constant.ModelConstants; | 9 | import org.thingsboard.server.common.data.yunteng.constant.ModelConstants; |
10 | +import org.thingsboard.server.dao.yunteng.mapper.ListStringTypeHandler; | ||
11 | + | ||
12 | +import java.util.List; | ||
8 | 13 | ||
9 | /** | 14 | /** |
10 | * @author Administrator | 15 | * @author Administrator |
@@ -17,7 +22,10 @@ public class ConfigurationDatasource extends TenantBaseEntity { | @@ -17,7 +22,10 @@ public class ConfigurationDatasource extends TenantBaseEntity { | ||
17 | private String configurationId; | 22 | private String configurationId; |
18 | private String contentId; | 23 | private String contentId; |
19 | private String nodeId; | 24 | private String nodeId; |
25 | + private String orgId; | ||
20 | private String deviceId; | 26 | private String deviceId; |
21 | - private JsonNode attr; | 27 | + private String slaveDeviceId; |
28 | + @TableField(typeHandler = ListStringTypeHandler.class) | ||
29 | + private List<String> attr; | ||
22 | private String remark; | 30 | private String remark; |
23 | } | 31 | } |
1 | package org.thingsboard.server.dao.yunteng.entities; | 1 | package org.thingsboard.server.dao.yunteng.entities; |
2 | 2 | ||
3 | +import com.baomidou.mybatisplus.annotation.TableField; | ||
3 | import com.baomidou.mybatisplus.annotation.TableName; | 4 | import com.baomidou.mybatisplus.annotation.TableName; |
5 | +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; | ||
4 | import com.fasterxml.jackson.databind.JsonNode; | 6 | import com.fasterxml.jackson.databind.JsonNode; |
5 | import lombok.Data; | 7 | import lombok.Data; |
6 | import lombok.EqualsAndHashCode; | 8 | import lombok.EqualsAndHashCode; |
9 | +import org.apache.ibatis.type.EnumTypeHandler; | ||
7 | import org.thingsboard.server.common.data.yunteng.constant.ModelConstants; | 10 | import org.thingsboard.server.common.data.yunteng.constant.ModelConstants; |
8 | import org.thingsboard.server.common.data.yunteng.enums.EventTypeEnum; | 11 | import org.thingsboard.server.common.data.yunteng.enums.EventTypeEnum; |
9 | 12 | ||
@@ -17,7 +20,9 @@ public class ConfigurationEvent extends TenantBaseEntity { | @@ -17,7 +20,9 @@ public class ConfigurationEvent extends TenantBaseEntity { | ||
17 | private static final long serialVersionUID = 4613503997176066996L; | 20 | private static final long serialVersionUID = 4613503997176066996L; |
18 | private String configurationId; | 21 | private String configurationId; |
19 | private String contentId; | 22 | private String contentId; |
23 | + @TableField(typeHandler = JacksonTypeHandler.class) | ||
20 | private JsonNode content; | 24 | private JsonNode content; |
25 | + @TableField(typeHandler = EnumTypeHandler.class) | ||
21 | private EventTypeEnum type; | 26 | private EventTypeEnum type; |
22 | private String remark; | 27 | private String remark; |
23 | } | 28 | } |
dao/src/main/java/org/thingsboard/server/dao/yunteng/impl/YtConfigurationActServiceImpl.java
0 → 100644
1 | +package org.thingsboard.server.dao.yunteng.impl; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||
4 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
5 | +import lombok.RequiredArgsConstructor; | ||
6 | +import lombok.extern.slf4j.Slf4j; | ||
7 | +import org.apache.commons.lang3.StringUtils; | ||
8 | +import org.springframework.stereotype.Service; | ||
9 | +import org.springframework.transaction.annotation.Transactional; | ||
10 | +import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | ||
11 | +import org.thingsboard.server.common.data.yunteng.core.exception.YtDataValidationException; | ||
12 | +import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | ||
13 | +import org.thingsboard.server.common.data.yunteng.dto.ConfigurationActDTO; | ||
14 | +import org.thingsboard.server.dao.yunteng.entities.ConfigurationAct; | ||
15 | +import org.thingsboard.server.dao.yunteng.mapper.ConfigurationActMapper; | ||
16 | +import org.thingsboard.server.dao.yunteng.service.AbstractBaseService; | ||
17 | +import org.thingsboard.server.dao.yunteng.service.YtConfigurationActService; | ||
18 | + | ||
19 | +import java.util.List; | ||
20 | +import java.util.stream.Collectors; | ||
21 | + | ||
22 | +/** | ||
23 | + * @author Administrator | ||
24 | + */ | ||
25 | +@Slf4j | ||
26 | +@Service | ||
27 | +@RequiredArgsConstructor | ||
28 | +public class YtConfigurationActServiceImpl | ||
29 | + extends AbstractBaseService<ConfigurationActMapper, ConfigurationAct> | ||
30 | + implements YtConfigurationActService { | ||
31 | + | ||
32 | + | ||
33 | + @Override | ||
34 | + @Transactional(rollbackFor = Exception.class) | ||
35 | + public ConfigurationActDTO saveConfigurationAct(ConfigurationActDTO actDTO) { | ||
36 | + LambdaQueryWrapper<ConfigurationAct> filter = new QueryWrapper<ConfigurationAct>().lambda() | ||
37 | + .eq(ConfigurationAct::getType, actDTO.getType()) | ||
38 | + .eq(ConfigurationAct::getId, actDTO.getId()); | ||
39 | + ConfigurationAct old = baseMapper.selectOne(filter); | ||
40 | + ConfigurationAct newData = actDTO.getEntity(ConfigurationAct.class); | ||
41 | + if (old == null) { | ||
42 | + baseMapper.insert(newData); | ||
43 | + } else if(!actDTO.getTenantId().equals(old.getTenantId())){ | ||
44 | + throw new YtDataValidationException(ErrorMessage.HAVE_NO_PERMISSION.getMessage()); | ||
45 | + } else { | ||
46 | + baseMapper.update(newData, filter); | ||
47 | + } | ||
48 | + return actDTO; | ||
49 | + } | ||
50 | + | ||
51 | + @Override | ||
52 | + @Transactional(rollbackFor = Exception.class) | ||
53 | + public boolean deleteConfigurationAct(ConfigurationActDTO eventDTO) { | ||
54 | + LambdaQueryWrapper<ConfigurationAct> filter = new QueryWrapper<ConfigurationAct>().lambda() | ||
55 | + .eq(ConfigurationAct::getTenantId,eventDTO.getTenantId()) | ||
56 | + .eq(StringUtils.isNotBlank(eventDTO.getConfigurationId()), ConfigurationAct::getConfigurationId, eventDTO.getConfigurationId()) | ||
57 | + .eq(StringUtils.isNotBlank(eventDTO.getContentId()), ConfigurationAct::getContentId, eventDTO.getContentId()) | ||
58 | + .eq(StringUtils.isNotBlank(eventDTO.getId()), ConfigurationAct::getId, eventDTO.getId()); | ||
59 | + int result = baseMapper.delete(filter); | ||
60 | + return result > 0; | ||
61 | + } | ||
62 | + | ||
63 | + @Override | ||
64 | + public List<ConfigurationActDTO> listConfigurationAct(String tenantId,String levelType,String levelId) { | ||
65 | + if(!FastIotConstants.ConfigureLevel.CONTENT.equals(levelType) | ||
66 | + && !FastIotConstants.ConfigureLevel.NODE.equals(levelType)){ | ||
67 | + throw new YtDataValidationException("please provide correct levelType!"); | ||
68 | + } | ||
69 | + LambdaQueryWrapper<ConfigurationAct> filter = new QueryWrapper<ConfigurationAct>().lambda() | ||
70 | + .eq(ConfigurationAct::getTenantId,tenantId) | ||
71 | + .eq(FastIotConstants.ConfigureLevel.CONTENT.equals(levelType), ConfigurationAct::getContentId, levelId) | ||
72 | + .eq(FastIotConstants.ConfigureLevel.NODE.equals(levelType), ConfigurationAct::getId, levelId); | ||
73 | + List<ConfigurationAct> result = baseMapper.selectList(filter); | ||
74 | + if (result == null || result.isEmpty()) { | ||
75 | + return null; | ||
76 | + } | ||
77 | + return result.stream() | ||
78 | + .map(i -> i.getDTO(ConfigurationActDTO.class)) | ||
79 | + .collect(Collectors.toList()); | ||
80 | + } | ||
81 | + | ||
82 | + | ||
83 | +} |
@@ -35,7 +35,6 @@ public class YtConfigurationEventServiceImpl | @@ -35,7 +35,6 @@ public class YtConfigurationEventServiceImpl | ||
35 | @Transactional(rollbackFor = Exception.class) | 35 | @Transactional(rollbackFor = Exception.class) |
36 | public ConfigurationEventDTO saveConfigurationEvent(ConfigurationEventDTO eventDTO) { | 36 | public ConfigurationEventDTO saveConfigurationEvent(ConfigurationEventDTO eventDTO) { |
37 | LambdaQueryWrapper<ConfigurationEvent> filter = new QueryWrapper<ConfigurationEvent>().lambda() | 37 | LambdaQueryWrapper<ConfigurationEvent> filter = new QueryWrapper<ConfigurationEvent>().lambda() |
38 | - .eq(ConfigurationEvent::getTenantId,eventDTO.getTenantId()) | ||
39 | .eq(ConfigurationEvent::getType, eventDTO.getType()) | 38 | .eq(ConfigurationEvent::getType, eventDTO.getType()) |
40 | .eq(ConfigurationEvent::getId, eventDTO.getId()); | 39 | .eq(ConfigurationEvent::getId, eventDTO.getId()); |
41 | ConfigurationEvent old = baseMapper.selectOne(filter); | 40 | ConfigurationEvent old = baseMapper.selectOne(filter); |
1 | +package org.thingsboard.server.dao.yunteng.mapper; | ||
2 | + | ||
3 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
4 | +import org.apache.ibatis.annotations.Mapper; | ||
5 | +import org.thingsboard.server.dao.yunteng.entities.ConfigurationAct; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author Administrator | ||
9 | + */ | ||
10 | +@Mapper | ||
11 | +public interface ConfigurationActMapper extends BaseMapper<ConfigurationAct> { | ||
12 | +} |
dao/src/main/java/org/thingsboard/server/dao/yunteng/service/YtConfigurationActService.java
0 → 100644
1 | +package org.thingsboard.server.dao.yunteng.service; | ||
2 | + | ||
3 | +import org.thingsboard.server.common.data.yunteng.dto.ConfigurationActDTO; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author Administrator | ||
9 | + */ | ||
10 | +public interface YtConfigurationActService { | ||
11 | + | ||
12 | + /** | ||
13 | + * 保存节点动画效果信息,每种事件类型只会有1个 | ||
14 | + * | ||
15 | + * @param eventDTO | ||
16 | + * @return | ||
17 | + */ | ||
18 | + ConfigurationActDTO saveConfigurationAct(ConfigurationActDTO eventDTO); | ||
19 | + | ||
20 | + /** | ||
21 | + * 删除动画效果信息 | ||
22 | + * | ||
23 | + * @param eventDTO 组态ID、内容ID、结点ID任选其一 | ||
24 | + * @return | ||
25 | + */ | ||
26 | + boolean deleteConfigurationAct(ConfigurationActDTO eventDTO); | ||
27 | + | ||
28 | + /** | ||
29 | + * 查看动画效果信息 | ||
30 | + * @param tenantId 租户ID | ||
31 | + * @param levelType 组件类型 | ||
32 | + * @param levelId 内容ID、结点ID任选其一 | ||
33 | + * @return | ||
34 | + */ | ||
35 | + List<ConfigurationActDTO> listConfigurationAct(String tenantId,String levelType,String levelId); | ||
36 | +} |