Commit e417d0546e7a8a38bc844ce6fdd1ffbc8ae0d7f8
Merge branch 'master_dev' into 'master'
Master dev See merge request yunteng/thingskit!412
Showing
81 changed files
with
645 additions
and
327 deletions
@@ -14,6 +14,7 @@ import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | @@ -14,6 +14,7 @@ import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | ||
14 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 14 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
15 | import org.thingsboard.server.controller.BaseController; | 15 | import org.thingsboard.server.controller.BaseController; |
16 | import org.thingsboard.server.dao.yunteng.service.AlarmProfileService; | 16 | import org.thingsboard.server.dao.yunteng.service.AlarmProfileService; |
17 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
17 | 18 | ||
18 | import java.util.HashMap; | 19 | import java.util.HashMap; |
19 | import java.util.List; | 20 | import java.util.List; |
@@ -22,6 +23,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -22,6 +23,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
22 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; | 23 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; |
23 | 24 | ||
24 | @RestController | 25 | @RestController |
26 | +@TbCoreComponent | ||
25 | @RequestMapping("api/yt/alarm/profile") | 27 | @RequestMapping("api/yt/alarm/profile") |
26 | @Api(tags = {"告警配置"}) | 28 | @Api(tags = {"告警配置"}) |
27 | @RequiredArgsConstructor | 29 | @RequiredArgsConstructor |
@@ -27,12 +27,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -27,12 +27,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
27 | import org.thingsboard.server.controller.BaseController; | 27 | import org.thingsboard.server.controller.BaseController; |
28 | import org.thingsboard.server.dao.exception.DataValidationException; | 28 | import org.thingsboard.server.dao.exception.DataValidationException; |
29 | import org.thingsboard.server.dao.yunteng.service.HomePageService; | 29 | import org.thingsboard.server.dao.yunteng.service.HomePageService; |
30 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
30 | import org.thingsboard.server.service.security.model.SecurityUser; | 31 | import org.thingsboard.server.service.security.model.SecurityUser; |
31 | 32 | ||
32 | @RequestMapping("api/yt/homepage") | 33 | @RequestMapping("api/yt/homepage") |
33 | @Api(tags = {"首页"}) | 34 | @Api(tags = {"首页"}) |
34 | @RequiredArgsConstructor | 35 | @RequiredArgsConstructor |
35 | @RestController | 36 | @RestController |
37 | +@TbCoreComponent | ||
36 | public class HomePageController extends BaseController { | 38 | public class HomePageController extends BaseController { |
37 | 39 | ||
38 | private final HomePageService homePageService; | 40 | private final HomePageService homePageService; |
@@ -32,9 +32,11 @@ import org.thingsboard.server.dao.util.yunteng.CronUtils; | @@ -32,9 +32,11 @@ import org.thingsboard.server.dao.util.yunteng.CronUtils; | ||
32 | import org.thingsboard.server.dao.util.yunteng.ScheduleUtils; | 32 | import org.thingsboard.server.dao.util.yunteng.ScheduleUtils; |
33 | import org.thingsboard.server.dao.yunteng.service.TkSysJobService; | 33 | import org.thingsboard.server.dao.yunteng.service.TkSysJobService; |
34 | import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; | 34 | import org.thingsboard.server.queue.discovery.TbServiceInfoProvider; |
35 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
35 | 36 | ||
36 | /** 调度任务信息操作处理 */ | 37 | /** 调度任务信息操作处理 */ |
37 | @RestController | 38 | @RestController |
39 | +@TbCoreComponent | ||
38 | @RequestMapping("api/yt/monitor/job") | 40 | @RequestMapping("api/yt/monitor/job") |
39 | @RequiredArgsConstructor | 41 | @RequiredArgsConstructor |
40 | @Api(tags = {"定时任务"}) | 42 | @Api(tags = {"定时任务"}) |
@@ -16,6 +16,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -16,6 +16,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
16 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 16 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
17 | import org.thingsboard.server.controller.BaseController; | 17 | import org.thingsboard.server.controller.BaseController; |
18 | import org.thingsboard.server.dao.yunteng.service.TkSysJobLogService; | 18 | import org.thingsboard.server.dao.yunteng.service.TkSysJobLogService; |
19 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
19 | 20 | ||
20 | import java.sql.Timestamp; | 21 | import java.sql.Timestamp; |
21 | import java.util.HashMap; | 22 | import java.util.HashMap; |
@@ -25,6 +26,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -25,6 +26,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
25 | 26 | ||
26 | /** 调度日志操作处理 */ | 27 | /** 调度日志操作处理 */ |
27 | @RestController | 28 | @RestController |
29 | +@TbCoreComponent | ||
28 | @RequestMapping("api/yt/monitor/job_log") | 30 | @RequestMapping("api/yt/monitor/job_log") |
29 | @RequiredArgsConstructor | 31 | @RequiredArgsConstructor |
30 | @Api(tags = {"定时任务执行日志"}) | 32 | @Api(tags = {"定时任务执行日志"}) |
@@ -33,6 +33,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -33,6 +33,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
33 | import org.thingsboard.server.controller.BaseController; | 33 | import org.thingsboard.server.controller.BaseController; |
34 | import org.thingsboard.server.dao.yunteng.service.ThingsModelService; | 34 | import org.thingsboard.server.dao.yunteng.service.ThingsModelService; |
35 | import org.thingsboard.server.dao.yunteng.service.TkDeviceProfileService; | 35 | import org.thingsboard.server.dao.yunteng.service.TkDeviceProfileService; |
36 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
36 | import org.thingsboard.server.service.entitiy.device.profile.TbDeviceProfileService; | 37 | import org.thingsboard.server.service.entitiy.device.profile.TbDeviceProfileService; |
37 | import org.thingsboard.server.utils.ImportModbusUtils; | 38 | import org.thingsboard.server.utils.ImportModbusUtils; |
38 | 39 | ||
@@ -48,6 +49,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -48,6 +49,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
48 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; | 49 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; |
49 | 50 | ||
50 | @RestController | 51 | @RestController |
52 | +@TbCoreComponent | ||
51 | @RequiredArgsConstructor | 53 | @RequiredArgsConstructor |
52 | @RequestMapping("api/yt/things_model") | 54 | @RequestMapping("api/yt/things_model") |
53 | @Api(tags = {"物模型管理"}) | 55 | @Api(tags = {"物模型管理"}) |
@@ -36,6 +36,7 @@ import org.thingsboard.server.dao.user.UserService; | @@ -36,6 +36,7 @@ import org.thingsboard.server.dao.user.UserService; | ||
36 | import org.thingsboard.server.dao.yunteng.service.MenuService; | 36 | import org.thingsboard.server.dao.yunteng.service.MenuService; |
37 | import org.thingsboard.server.dao.yunteng.service.TkTenantService; | 37 | import org.thingsboard.server.dao.yunteng.service.TkTenantService; |
38 | import org.thingsboard.server.dao.yunteng.service.TkUserService; | 38 | import org.thingsboard.server.dao.yunteng.service.TkUserService; |
39 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
39 | import org.thingsboard.server.service.entitiy.tenant.TbTenantService; | 40 | import org.thingsboard.server.service.entitiy.tenant.TbTenantService; |
40 | import org.thingsboard.server.service.entitiy.user.TbUserService; | 41 | import org.thingsboard.server.service.entitiy.user.TbUserService; |
41 | import org.thingsboard.server.service.install.InstallScripts; | 42 | import org.thingsboard.server.service.install.InstallScripts; |
@@ -51,6 +52,7 @@ import java.util.UUID; | @@ -51,6 +52,7 @@ import java.util.UUID; | ||
51 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 52 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
52 | 53 | ||
53 | @RestController | 54 | @RestController |
55 | +@TbCoreComponent | ||
54 | @RequestMapping("api/yt/admin") | 56 | @RequestMapping("api/yt/admin") |
55 | @Api(tags = {"租户管理", "菜单管理"}) | 57 | @Api(tags = {"租户管理", "菜单管理"}) |
56 | @RequiredArgsConstructor | 58 | @RequiredArgsConstructor |
@@ -21,6 +21,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -21,6 +21,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
21 | import org.thingsboard.server.controller.BaseController; | 21 | import org.thingsboard.server.controller.BaseController; |
22 | import org.thingsboard.server.dao.yunteng.service.AlarmProfileService; | 22 | import org.thingsboard.server.dao.yunteng.service.AlarmProfileService; |
23 | import org.thingsboard.server.dao.yunteng.service.TkAlarmContactService; | 23 | import org.thingsboard.server.dao.yunteng.service.TkAlarmContactService; |
24 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
24 | 25 | ||
25 | import java.net.URI; | 26 | import java.net.URI; |
26 | import java.util.HashMap; | 27 | import java.util.HashMap; |
@@ -36,6 +37,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -36,6 +37,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
36 | * @Description 告警联系人 @Author cxy @Date 2021/11/2 14:54 | 37 | * @Description 告警联系人 @Author cxy @Date 2021/11/2 14:54 |
37 | */ | 38 | */ |
38 | @RestController | 39 | @RestController |
40 | +@TbCoreComponent | ||
39 | @RequestMapping("/api/yt/alarm_contact") | 41 | @RequestMapping("/api/yt/alarm_contact") |
40 | @RequiredArgsConstructor | 42 | @RequiredArgsConstructor |
41 | @Api(tags = "告警联系人") | 43 | @Api(tags = "告警联系人") |
@@ -19,6 +19,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -19,6 +19,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
19 | import org.thingsboard.server.controller.BaseController; | 19 | import org.thingsboard.server.controller.BaseController; |
20 | import org.thingsboard.server.dao.yunteng.entities.TkAlarmEntity; | 20 | import org.thingsboard.server.dao.yunteng.entities.TkAlarmEntity; |
21 | import org.thingsboard.server.dao.yunteng.service.TkAlarmInfoService; | 21 | import org.thingsboard.server.dao.yunteng.service.TkAlarmInfoService; |
22 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
22 | 23 | ||
23 | import java.util.HashMap; | 24 | import java.util.HashMap; |
24 | import java.util.List; | 25 | import java.util.List; |
@@ -31,6 +32,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -31,6 +32,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
31 | * @Description 告警中心 @Author cxy @Date 2021/11/11 9:23 | 32 | * @Description 告警中心 @Author cxy @Date 2021/11/11 9:23 |
32 | */ | 33 | */ |
33 | @RestController | 34 | @RestController |
35 | +@TbCoreComponent | ||
34 | @RequestMapping("/api/yt/alarm") | 36 | @RequestMapping("/api/yt/alarm") |
35 | @RequiredArgsConstructor | 37 | @RequiredArgsConstructor |
36 | @Api(tags = "告警中心") | 38 | @Api(tags = "告警中心") |
@@ -9,6 +9,7 @@ import org.springframework.util.Assert; | @@ -9,6 +9,7 @@ import org.springframework.util.Assert; | ||
9 | import org.springframework.web.bind.annotation.*; | 9 | import org.springframework.web.bind.annotation.*; |
10 | import org.thingsboard.server.common.data.yunteng.dto.AlarmInfoDTO; | 10 | import org.thingsboard.server.common.data.yunteng.dto.AlarmInfoDTO; |
11 | import org.thingsboard.server.dao.yunteng.service.TkNoticeService; | 11 | import org.thingsboard.server.dao.yunteng.service.TkNoticeService; |
12 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
12 | import org.thingsboard.server.service.security.exception.JwtExpiredTokenException; | 13 | import org.thingsboard.server.service.security.exception.JwtExpiredTokenException; |
13 | 14 | ||
14 | import java.net.InetAddress; | 15 | import java.net.InetAddress; |
@@ -24,6 +25,7 @@ import java.net.InetAddress; | @@ -24,6 +25,7 @@ import java.net.InetAddress; | ||
24 | * @Copyright 2016-2018 - Powered By 云腾五洲 | 25 | * @Copyright 2016-2018 - Powered By 云腾五洲 |
25 | */ | 26 | */ |
26 | @RestController | 27 | @RestController |
28 | +@TbCoreComponent | ||
27 | @RequestMapping("/api/yt/notice") | 29 | @RequestMapping("/api/yt/notice") |
28 | @RequiredArgsConstructor | 30 | @RequiredArgsConstructor |
29 | @Slf4j | 31 | @Slf4j |
@@ -12,6 +12,7 @@ import org.thingsboard.server.common.data.yunteng.dto.SysAppDesignDTO; | @@ -12,6 +12,7 @@ import org.thingsboard.server.common.data.yunteng.dto.SysAppDesignDTO; | ||
12 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | 12 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; |
13 | import org.thingsboard.server.controller.BaseController; | 13 | import org.thingsboard.server.controller.BaseController; |
14 | import org.thingsboard.server.dao.yunteng.service.SysAppDesignService; | 14 | import org.thingsboard.server.dao.yunteng.service.SysAppDesignService; |
15 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
15 | 16 | ||
16 | /** | 17 | /** |
17 | * @author: 徐浩然 | 18 | * @author: 徐浩然 |
@@ -20,6 +21,7 @@ import org.thingsboard.server.dao.yunteng.service.SysAppDesignService; | @@ -20,6 +21,7 @@ import org.thingsboard.server.dao.yunteng.service.SysAppDesignService; | ||
20 | */ | 21 | */ |
21 | @Api(tags = "APP定制") | 22 | @Api(tags = "APP定制") |
22 | @RestController | 23 | @RestController |
24 | +@TbCoreComponent | ||
23 | @RequestMapping("api/yt/app_design") | 25 | @RequestMapping("api/yt/app_design") |
24 | @RequiredArgsConstructor | 26 | @RequiredArgsConstructor |
25 | public class TkAppDesignController extends BaseController { | 27 | public class TkAppDesignController extends BaseController { |
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | @@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.RequestMapping; | ||
9 | import org.springframework.web.bind.annotation.RestController; | 9 | import org.springframework.web.bind.annotation.RestController; |
10 | import org.thingsboard.server.common.data.yunteng.dto.SysAreaDTO; | 10 | import org.thingsboard.server.common.data.yunteng.dto.SysAreaDTO; |
11 | import org.thingsboard.server.dao.yunteng.service.SysAreaService; | 11 | import org.thingsboard.server.dao.yunteng.service.SysAreaService; |
12 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
12 | 13 | ||
13 | import java.util.List; | 14 | import java.util.List; |
14 | 15 | ||
@@ -19,6 +20,7 @@ import java.util.List; | @@ -19,6 +20,7 @@ import java.util.List; | ||
19 | */ | 20 | */ |
20 | @Api(tags = "中国省市区街关联") | 21 | @Api(tags = "中国省市区街关联") |
21 | @RestController | 22 | @RestController |
23 | +@TbCoreComponent | ||
22 | @RequestMapping("api/yt/area") | 24 | @RequestMapping("api/yt/area") |
23 | @RequiredArgsConstructor | 25 | @RequiredArgsConstructor |
24 | public class TkAreaController { | 26 | public class TkAreaController { |
@@ -23,6 +23,7 @@ import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | @@ -23,6 +23,7 @@ import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | ||
23 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 23 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
24 | import org.thingsboard.server.controller.BaseController; | 24 | import org.thingsboard.server.controller.BaseController; |
25 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationCenterService; | 25 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationCenterService; |
26 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
26 | 27 | ||
27 | import java.util.HashMap; | 28 | import java.util.HashMap; |
28 | import java.util.List; | 29 | import java.util.List; |
@@ -30,6 +31,7 @@ import java.util.List; | @@ -30,6 +31,7 @@ import java.util.List; | ||
30 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 31 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
31 | 32 | ||
32 | @RestController | 33 | @RestController |
34 | +@TbCoreComponent | ||
33 | @RequestMapping("/api/yt/configuration/center") | 35 | @RequestMapping("/api/yt/configuration/center") |
34 | @RequiredArgsConstructor | 36 | @RequiredArgsConstructor |
35 | @Api(tags = "组态中心") | 37 | @Api(tags = "组态中心") |
@@ -15,8 +15,10 @@ import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | @@ -15,8 +15,10 @@ import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | ||
15 | import org.thingsboard.server.common.data.yunteng.dto.request.ConfigurationContentInfoDTO; | 15 | import org.thingsboard.server.common.data.yunteng.dto.request.ConfigurationContentInfoDTO; |
16 | import org.thingsboard.server.controller.BaseController; | 16 | import org.thingsboard.server.controller.BaseController; |
17 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationContentService; | 17 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationContentService; |
18 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
18 | 19 | ||
19 | @RestController | 20 | @RestController |
21 | +@TbCoreComponent | ||
20 | @RequestMapping("/api/yt/configuration/content") | 22 | @RequestMapping("/api/yt/configuration/content") |
21 | @RequiredArgsConstructor | 23 | @RequiredArgsConstructor |
22 | @Api(tags = "组态内容") | 24 | @Api(tags = "组态内容") |
@@ -22,11 +22,13 @@ import org.thingsboard.server.dao.yunteng.service.TkConfigurationActService; | @@ -22,11 +22,13 @@ import org.thingsboard.server.dao.yunteng.service.TkConfigurationActService; | ||
22 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationContentNodeService; | 22 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationContentNodeService; |
23 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationDatasourceService; | 23 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationDatasourceService; |
24 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationEventService; | 24 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationEventService; |
25 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
25 | 26 | ||
26 | /** | 27 | /** |
27 | * @author Administrator | 28 | * @author Administrator |
28 | */ | 29 | */ |
29 | @RestController | 30 | @RestController |
31 | +@TbCoreComponent | ||
30 | @RequestMapping("/api/yt/new/configuration/node") | 32 | @RequestMapping("/api/yt/new/configuration/node") |
31 | @RequiredArgsConstructor | 33 | @RequiredArgsConstructor |
32 | @Api(tags = "组态结点管理(新)") | 34 | @Api(tags = "组态结点管理(新)") |
@@ -15,6 +15,7 @@ import org.thingsboard.server.controller.BaseController; | @@ -15,6 +15,7 @@ import org.thingsboard.server.controller.BaseController; | ||
15 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationActService; | 15 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationActService; |
16 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationDatasourceService; | 16 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationDatasourceService; |
17 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationEventService; | 17 | import org.thingsboard.server.dao.yunteng.service.TkConfigurationEventService; |
18 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
18 | 19 | ||
19 | import java.util.List; | 20 | import java.util.List; |
20 | import java.util.Optional; | 21 | import java.util.Optional; |
@@ -23,6 +24,7 @@ import java.util.Optional; | @@ -23,6 +24,7 @@ import java.util.Optional; | ||
23 | * @author Administrator | 24 | * @author Administrator |
24 | */ | 25 | */ |
25 | @RestController | 26 | @RestController |
27 | +@TbCoreComponent | ||
26 | @RequestMapping("/api/yt/configuration/node") | 28 | @RequestMapping("/api/yt/configuration/node") |
27 | @RequiredArgsConstructor | 29 | @RequiredArgsConstructor |
28 | @Api(tags = "组态结点管理") | 30 | @Api(tags = "组态结点管理") |
@@ -40,10 +40,12 @@ import org.thingsboard.server.controller.BaseController; | @@ -40,10 +40,12 @@ import org.thingsboard.server.controller.BaseController; | ||
40 | import org.thingsboard.server.dao.yunteng.service.ConvertConfigService; | 40 | import org.thingsboard.server.dao.yunteng.service.ConvertConfigService; |
41 | import org.thingsboard.server.dao.yunteng.service.SceneLinkageService; | 41 | import org.thingsboard.server.dao.yunteng.service.SceneLinkageService; |
42 | import org.thingsboard.server.dao.yunteng.service.TkRuleChainService; | 42 | import org.thingsboard.server.dao.yunteng.service.TkRuleChainService; |
43 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
43 | import org.thingsboard.server.service.rule.TbRuleChainService; | 44 | import org.thingsboard.server.service.rule.TbRuleChainService; |
44 | import org.thingsboard.server.service.security.permission.Operation; | 45 | import org.thingsboard.server.service.security.permission.Operation; |
45 | 46 | ||
46 | @RestController | 47 | @RestController |
48 | +@TbCoreComponent | ||
47 | @RequiredArgsConstructor | 49 | @RequiredArgsConstructor |
48 | @RequestMapping("api/yt/convert") | 50 | @RequestMapping("api/yt/convert") |
49 | @Api(tags = {"数据流转控制器"}) | 51 | @Api(tags = {"数据流转控制器"}) |
@@ -23,12 +23,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -23,12 +23,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
23 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 23 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
24 | import org.thingsboard.server.controller.BaseController; | 24 | import org.thingsboard.server.controller.BaseController; |
25 | import org.thingsboard.server.dao.yunteng.service.TkDataBoardService; | 25 | import org.thingsboard.server.dao.yunteng.service.TkDataBoardService; |
26 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
26 | 27 | ||
27 | import java.util.*; | 28 | import java.util.*; |
28 | 29 | ||
29 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 30 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
30 | 31 | ||
31 | @RestController | 32 | @RestController |
33 | +@TbCoreComponent | ||
32 | @RequiredArgsConstructor | 34 | @RequiredArgsConstructor |
33 | @RequestMapping("api/yt/data_board") | 35 | @RequestMapping("api/yt/data_board") |
34 | @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{})") | 36 | @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{})") |
@@ -24,11 +24,13 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -24,11 +24,13 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
24 | import org.thingsboard.server.controller.BaseController; | 24 | import org.thingsboard.server.controller.BaseController; |
25 | import org.thingsboard.server.dao.yunteng.service.TkDataBoardService; | 25 | import org.thingsboard.server.dao.yunteng.service.TkDataBoardService; |
26 | import org.thingsboard.server.dao.yunteng.service.TkDataComponentService; | 26 | import org.thingsboard.server.dao.yunteng.service.TkDataComponentService; |
27 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
27 | 28 | ||
28 | import java.util.ArrayList; | 29 | import java.util.ArrayList; |
29 | import java.util.List; | 30 | import java.util.List; |
30 | 31 | ||
31 | @RestController | 32 | @RestController |
33 | +@TbCoreComponent | ||
32 | @RequiredArgsConstructor | 34 | @RequiredArgsConstructor |
33 | @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{})") | 35 | @PreAuthorize("@check.checkPermissions({'TENANT_ADMIN','CUSTOMER_USER'},{})") |
34 | @RequestMapping("api/yt/data_component") | 36 | @RequestMapping("api/yt/data_component") |
application/src/main/java/org/thingsboard/server/controller/yunteng/TkDataViewContentController.java
@@ -15,11 +15,13 @@ import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | @@ -15,11 +15,13 @@ import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | ||
15 | import org.thingsboard.server.common.data.yunteng.dto.request.TkDataViewContentInfoDTO; | 15 | import org.thingsboard.server.common.data.yunteng.dto.request.TkDataViewContentInfoDTO; |
16 | import org.thingsboard.server.controller.BaseController; | 16 | import org.thingsboard.server.controller.BaseController; |
17 | import org.thingsboard.server.dao.yunteng.service.TkDataViewContentService; | 17 | import org.thingsboard.server.dao.yunteng.service.TkDataViewContentService; |
18 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
18 | 19 | ||
19 | /** | 20 | /** |
20 | * @author tianfuLei | 21 | * @author tianfuLei |
21 | */ | 22 | */ |
22 | @RestController | 23 | @RestController |
24 | +@TbCoreComponent | ||
23 | @RequestMapping("/api/yt/data_view/content") | 25 | @RequestMapping("/api/yt/data_view/content") |
24 | @RequiredArgsConstructor | 26 | @RequiredArgsConstructor |
25 | @Api(tags = "大屏内容") | 27 | @Api(tags = "大屏内容") |
@@ -21,6 +21,7 @@ import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | @@ -21,6 +21,7 @@ import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | ||
21 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 21 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
22 | import org.thingsboard.server.controller.BaseController; | 22 | import org.thingsboard.server.controller.BaseController; |
23 | import org.thingsboard.server.dao.yunteng.service.TkDataViewService; | 23 | import org.thingsboard.server.dao.yunteng.service.TkDataViewService; |
24 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
24 | 25 | ||
25 | import java.util.HashMap; | 26 | import java.util.HashMap; |
26 | 27 | ||
@@ -30,6 +31,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -30,6 +31,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
30 | * @author tianfuLei | 31 | * @author tianfuLei |
31 | */ | 32 | */ |
32 | @RestController | 33 | @RestController |
34 | +@TbCoreComponent | ||
33 | @RequestMapping("/api/yt/data_view") | 35 | @RequestMapping("/api/yt/data_view") |
34 | @RequiredArgsConstructor | 36 | @RequiredArgsConstructor |
35 | @Api(tags = "大屏设计器") | 37 | @Api(tags = "大屏设计器") |
@@ -18,6 +18,7 @@ import org.thingsboard.server.common.data.yunteng.enums.TkSystemTypeEnum; | @@ -18,6 +18,7 @@ import org.thingsboard.server.common.data.yunteng.enums.TkSystemTypeEnum; | ||
18 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 18 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
19 | import org.thingsboard.server.controller.BaseController; | 19 | import org.thingsboard.server.controller.BaseController; |
20 | import org.thingsboard.server.dao.yunteng.service.TkDataViewInterfaceService; | 20 | import org.thingsboard.server.dao.yunteng.service.TkDataViewInterfaceService; |
21 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
21 | 22 | ||
22 | import java.util.*; | 23 | import java.util.*; |
23 | 24 | ||
@@ -27,6 +28,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -27,6 +28,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
27 | * @author tianfuLei | 28 | * @author tianfuLei |
28 | */ | 29 | */ |
29 | @RestController | 30 | @RestController |
31 | +@TbCoreComponent | ||
30 | @RequestMapping("/api/yt/data_view_interface") | 32 | @RequestMapping("/api/yt/data_view_interface") |
31 | @RequiredArgsConstructor | 33 | @RequiredArgsConstructor |
32 | @Api(tags = "大屏公共接口") | 34 | @Api(tags = "大屏公共接口") |
@@ -19,12 +19,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -19,12 +19,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
19 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 19 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
20 | import org.thingsboard.server.controller.BaseController; | 20 | import org.thingsboard.server.controller.BaseController; |
21 | import org.thingsboard.server.dao.yunteng.service.TkDeviceAccessInformationService; | 21 | import org.thingsboard.server.dao.yunteng.service.TkDeviceAccessInformationService; |
22 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
22 | 23 | ||
23 | import java.util.HashMap; | 24 | import java.util.HashMap; |
24 | 25 | ||
25 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 26 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
26 | 27 | ||
27 | @RestController | 28 | @RestController |
29 | +@TbCoreComponent | ||
28 | @RequiredArgsConstructor | 30 | @RequiredArgsConstructor |
29 | @RequestMapping("api/yt/device_profile/access_information") | 31 | @RequestMapping("api/yt/device_profile/access_information") |
30 | @Api(tags = {"设备接入信息管理"}) | 32 | @Api(tags = {"设备接入信息管理"}) |
@@ -40,6 +40,7 @@ import org.thingsboard.server.dao.yunteng.service.TkAlarmInfoService; | @@ -40,6 +40,7 @@ import org.thingsboard.server.dao.yunteng.service.TkAlarmInfoService; | ||
40 | import org.thingsboard.server.dao.yunteng.service.TkDeviceProfileService; | 40 | import org.thingsboard.server.dao.yunteng.service.TkDeviceProfileService; |
41 | import org.thingsboard.server.dao.yunteng.service.TkDeviceService; | 41 | import org.thingsboard.server.dao.yunteng.service.TkDeviceService; |
42 | import org.thingsboard.server.dao.yunteng.service.media.TkVideoChannelService; | 42 | import org.thingsboard.server.dao.yunteng.service.media.TkVideoChannelService; |
43 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
43 | import org.thingsboard.server.service.entitiy.alarm.TbAlarmService; | 44 | import org.thingsboard.server.service.entitiy.alarm.TbAlarmService; |
44 | import org.thingsboard.server.service.entitiy.device.TbDeviceService; | 45 | import org.thingsboard.server.service.entitiy.device.TbDeviceService; |
45 | import org.thingsboard.server.service.entitiy.entity.relation.TbEntityRelationService; | 46 | import org.thingsboard.server.service.entitiy.entity.relation.TbEntityRelationService; |
@@ -55,6 +56,7 @@ import java.util.concurrent.ExecutionException; | @@ -55,6 +56,7 @@ import java.util.concurrent.ExecutionException; | ||
55 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 56 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
56 | 57 | ||
57 | @RestController | 58 | @RestController |
59 | +@TbCoreComponent | ||
58 | @RequiredArgsConstructor | 60 | @RequiredArgsConstructor |
59 | @RequestMapping("api/yt/device") | 61 | @RequestMapping("api/yt/device") |
60 | @Api(tags = {"设备管理"}) | 62 | @Api(tags = {"设备管理"}) |
@@ -15,12 +15,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -15,12 +15,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
15 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 15 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
16 | import org.thingsboard.server.controller.BaseController; | 16 | import org.thingsboard.server.controller.BaseController; |
17 | import org.thingsboard.server.dao.yunteng.service.TkDeviceProfileCategoryService; | 17 | import org.thingsboard.server.dao.yunteng.service.TkDeviceProfileCategoryService; |
18 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
18 | 19 | ||
19 | import java.util.HashMap; | 20 | import java.util.HashMap; |
20 | 21 | ||
21 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 22 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
22 | 23 | ||
23 | @RestController | 24 | @RestController |
25 | +@TbCoreComponent | ||
24 | @RequiredArgsConstructor | 26 | @RequiredArgsConstructor |
25 | @RequestMapping("api/yt/device_profile/category") | 27 | @RequestMapping("api/yt/device_profile/category") |
26 | @Api(tags = {"产品品类管理"}) | 28 | @Api(tags = {"产品品类管理"}) |
@@ -34,6 +34,7 @@ import org.thingsboard.server.controller.BaseController; | @@ -34,6 +34,7 @@ import org.thingsboard.server.controller.BaseController; | ||
34 | import org.thingsboard.server.dao.yunteng.service.ThingsModelService; | 34 | import org.thingsboard.server.dao.yunteng.service.ThingsModelService; |
35 | import org.thingsboard.server.dao.yunteng.service.TkDeviceProfileService; | 35 | import org.thingsboard.server.dao.yunteng.service.TkDeviceProfileService; |
36 | import org.thingsboard.server.dao.yunteng.service.TkDeviceScriptService; | 36 | import org.thingsboard.server.dao.yunteng.service.TkDeviceScriptService; |
37 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
37 | import org.thingsboard.server.service.entitiy.device.profile.TbDeviceProfileService; | 38 | import org.thingsboard.server.service.entitiy.device.profile.TbDeviceProfileService; |
38 | import org.thingsboard.server.service.security.permission.Operation; | 39 | import org.thingsboard.server.service.security.permission.Operation; |
39 | 40 | ||
@@ -45,6 +46,7 @@ import java.util.concurrent.ExecutionException; | @@ -45,6 +46,7 @@ import java.util.concurrent.ExecutionException; | ||
45 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 46 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
46 | 47 | ||
47 | @RestController | 48 | @RestController |
49 | +@TbCoreComponent | ||
48 | @RequiredArgsConstructor | 50 | @RequiredArgsConstructor |
49 | @RequestMapping("api/yt/device_profile") | 51 | @RequestMapping("api/yt/device_profile") |
50 | @Api(tags = {"设备配置管理"}) | 52 | @Api(tags = {"设备配置管理"}) |
@@ -200,8 +202,11 @@ public class TkDeviceProfileController extends BaseController { | @@ -200,8 +202,11 @@ public class TkDeviceProfileController extends BaseController { | ||
200 | .getProfileData().getTransportConfiguration(); | 202 | .getProfileData().getTransportConfiguration(); |
201 | if(tcpProfile.getTcpAuthType().equals(TcpAuthTypeEnum.DATA_COMBINATION)){ | 203 | if(tcpProfile.getTcpAuthType().equals(TcpAuthTypeEnum.DATA_COMBINATION)){ |
202 | String key = deviceProfileDTO.getTenantId() + "_" + deviceProfileDTO.getTbProfileId(); | 204 | String key = deviceProfileDTO.getTenantId() + "_" + deviceProfileDTO.getTbProfileId(); |
203 | - Map<String,Object> cacheMap = (Map<String, Object>) | ||
204 | - cacheUtils.get(cacheName, FastIotConstants.OtherKey.DATA_COMBINATION_KEY).get(); | 205 | + Optional<Object> stringObjectMap = cacheUtils.get(cacheName, FastIotConstants.OtherKey.DATA_COMBINATION_KEY); |
206 | + Map<String,Object> cacheMap = new HashMap<>(); | ||
207 | + if(stringObjectMap.isPresent()){ | ||
208 | + cacheMap = (Map<String,Object>)stringObjectMap.get(); | ||
209 | + } | ||
205 | cacheMap.put(key,tcpProfile); | 210 | cacheMap.put(key,tcpProfile); |
206 | cacheUtils.put(cacheName,FastIotConstants.OtherKey.DATA_COMBINATION_KEY,cacheMap); | 211 | cacheUtils.put(cacheName,FastIotConstants.OtherKey.DATA_COMBINATION_KEY,cacheMap); |
207 | } | 212 | } |
@@ -30,6 +30,8 @@ import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | @@ -30,6 +30,8 @@ import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | ||
30 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 30 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
31 | import org.thingsboard.server.controller.BaseController; | 31 | import org.thingsboard.server.controller.BaseController; |
32 | import org.thingsboard.server.dao.yunteng.service.TkDeviceScriptService; | 32 | import org.thingsboard.server.dao.yunteng.service.TkDeviceScriptService; |
33 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
34 | + | ||
33 | import java.util.HashMap; | 35 | import java.util.HashMap; |
34 | import java.util.List; | 36 | import java.util.List; |
35 | import java.util.Map; | 37 | import java.util.Map; |
@@ -38,6 +40,7 @@ import java.util.UUID; | @@ -38,6 +40,7 @@ import java.util.UUID; | ||
38 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 40 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
39 | 41 | ||
40 | @RestController | 42 | @RestController |
43 | +@TbCoreComponent | ||
41 | @RequiredArgsConstructor | 44 | @RequiredArgsConstructor |
42 | @RequestMapping("api/yt/js") | 45 | @RequestMapping("api/yt/js") |
43 | @Api(tags = {"设备数据解析脚本管理"}) | 46 | @Api(tags = {"设备数据解析脚本管理"}) |
@@ -81,9 +84,8 @@ public class TkDeviceScriptController extends BaseController { | @@ -81,9 +84,8 @@ public class TkDeviceScriptController extends BaseController { | ||
81 | 84 | ||
82 | /**脚本引擎启用/禁用时,刷新设备接入服务中的脚本,禁用时使用默认脚本*/ | 85 | /**脚本引擎启用/禁用时,刷新设备接入服务中的脚本,禁用时使用默认脚本*/ |
83 | scriptService.updateScriptStatus(tenantId, id, status); | 86 | scriptService.updateScriptStatus(tenantId, id, status); |
84 | - scriptService.getDeviceScript(tenantId, id).ifPresent(i->{ | ||
85 | - tbClusterService.onJsScriptChange(i,null); | ||
86 | - }); | 87 | + scriptDTO.setStatus(status); |
88 | + tbClusterService.onJsScriptChange(scriptDTO,null); | ||
87 | return ResponseEntity.ok(true); | 89 | return ResponseEntity.ok(true); |
88 | } | 90 | } |
89 | 91 |
@@ -18,6 +18,7 @@ import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | @@ -18,6 +18,7 @@ import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | ||
18 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 18 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
19 | import org.thingsboard.server.controller.BaseController; | 19 | import org.thingsboard.server.controller.BaseController; |
20 | import org.thingsboard.server.dao.yunteng.service.TkDeviceStateLogService; | 20 | import org.thingsboard.server.dao.yunteng.service.TkDeviceStateLogService; |
21 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
21 | 22 | ||
22 | import java.sql.Timestamp; | 23 | import java.sql.Timestamp; |
23 | import java.util.HashMap; | 24 | import java.util.HashMap; |
@@ -27,6 +28,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -27,6 +28,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
27 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; | 28 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; |
28 | 29 | ||
29 | @RestController | 30 | @RestController |
31 | +@TbCoreComponent | ||
30 | @RequiredArgsConstructor | 32 | @RequiredArgsConstructor |
31 | @RequestMapping("api/yt/device/state/log") | 33 | @RequestMapping("api/yt/device/state/log") |
32 | @Api(tags = {"设备上下线记录"}) | 34 | @Api(tags = {"设备上下线记录"}) |
@@ -17,10 +17,12 @@ import org.thingsboard.server.common.data.yunteng.dto.DeviceTypeDTO; | @@ -17,10 +17,12 @@ import org.thingsboard.server.common.data.yunteng.dto.DeviceTypeDTO; | ||
17 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | 17 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; |
18 | import org.thingsboard.server.controller.BaseController; | 18 | import org.thingsboard.server.controller.BaseController; |
19 | import org.thingsboard.server.dao.yunteng.service.TkDeviceTypeService; | 19 | import org.thingsboard.server.dao.yunteng.service.TkDeviceTypeService; |
20 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
20 | 21 | ||
21 | import java.util.List; | 22 | import java.util.List; |
22 | 23 | ||
23 | @RestController | 24 | @RestController |
25 | +@TbCoreComponent | ||
24 | @RequestMapping("api/yt/device_type") | 26 | @RequestMapping("api/yt/device_type") |
25 | @RequiredArgsConstructor | 27 | @RequiredArgsConstructor |
26 | @Api(value = "设备类型") | 28 | @Api(value = "设备类型") |
@@ -16,12 +16,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -16,12 +16,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
16 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 16 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
17 | import org.thingsboard.server.controller.BaseController; | 17 | import org.thingsboard.server.controller.BaseController; |
18 | import org.thingsboard.server.dao.yunteng.service.SysDictService; | 18 | import org.thingsboard.server.dao.yunteng.service.SysDictService; |
19 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
19 | 20 | ||
20 | import java.util.HashMap; | 21 | import java.util.HashMap; |
21 | 22 | ||
22 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 23 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
23 | 24 | ||
24 | @RestController | 25 | @RestController |
26 | +@TbCoreComponent | ||
25 | @RequestMapping("api/yt/dict") | 27 | @RequestMapping("api/yt/dict") |
26 | @RequiredArgsConstructor | 28 | @RequiredArgsConstructor |
27 | @PreAuthorize("@check.checkPermissions({'SYS_ADMIN','PLATFORM_ADMIN'},{})") | 29 | @PreAuthorize("@check.checkPermissions({'SYS_ADMIN','PLATFORM_ADMIN'},{})") |
@@ -17,6 +17,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -17,6 +17,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
17 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 17 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
18 | import org.thingsboard.server.controller.BaseController; | 18 | import org.thingsboard.server.controller.BaseController; |
19 | import org.thingsboard.server.dao.yunteng.service.SysDictItemService; | 19 | import org.thingsboard.server.dao.yunteng.service.SysDictItemService; |
20 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
20 | 21 | ||
21 | import java.util.HashMap; | 22 | import java.util.HashMap; |
22 | import java.util.List; | 23 | import java.util.List; |
@@ -25,6 +26,7 @@ import java.util.Map; | @@ -25,6 +26,7 @@ import java.util.Map; | ||
25 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 26 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
26 | 27 | ||
27 | @RestController | 28 | @RestController |
29 | +@TbCoreComponent | ||
28 | @RequestMapping("api/yt/dict_item") | 30 | @RequestMapping("api/yt/dict_item") |
29 | @RequiredArgsConstructor | 31 | @RequiredArgsConstructor |
30 | public class TkDictItemController extends BaseController { | 32 | public class TkDictItemController extends BaseController { |
@@ -10,6 +10,7 @@ import org.thingsboard.server.common.data.exception.ThingsboardException; | @@ -10,6 +10,7 @@ import org.thingsboard.server.common.data.exception.ThingsboardException; | ||
10 | import org.thingsboard.server.common.data.yunteng.dto.SysEnterpriseDTO; | 10 | import org.thingsboard.server.common.data.yunteng.dto.SysEnterpriseDTO; |
11 | import org.thingsboard.server.controller.BaseController; | 11 | import org.thingsboard.server.controller.BaseController; |
12 | import org.thingsboard.server.dao.yunteng.service.SysEnterpriseService; | 12 | import org.thingsboard.server.dao.yunteng.service.SysEnterpriseService; |
13 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
13 | 14 | ||
14 | /** | 15 | /** |
15 | * @author: 徐浩然 | 16 | * @author: 徐浩然 |
@@ -18,6 +19,7 @@ import org.thingsboard.server.dao.yunteng.service.SysEnterpriseService; | @@ -18,6 +19,7 @@ import org.thingsboard.server.dao.yunteng.service.SysEnterpriseService; | ||
18 | */ | 19 | */ |
19 | @Api(tags = "企业信息") | 20 | @Api(tags = "企业信息") |
20 | @RestController | 21 | @RestController |
22 | +@TbCoreComponent | ||
21 | @RequestMapping("api/yt/enterprise") | 23 | @RequestMapping("api/yt/enterprise") |
22 | @RequiredArgsConstructor | 24 | @RequiredArgsConstructor |
23 | public class TkEnterpriseController extends BaseController { | 25 | public class TkEnterpriseController extends BaseController { |
@@ -16,6 +16,7 @@ import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; | @@ -16,6 +16,7 @@ import org.thingsboard.server.common.data.yunteng.enums.DeviceEventTypeEnum; | ||
16 | import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; | 16 | import org.thingsboard.server.common.data.yunteng.enums.OrderTypeEnum; |
17 | import org.thingsboard.server.controller.BaseController; | 17 | import org.thingsboard.server.controller.BaseController; |
18 | import org.thingsboard.server.dao.yunteng.event.TkEventsService; | 18 | import org.thingsboard.server.dao.yunteng.event.TkEventsService; |
19 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
19 | 20 | ||
20 | import java.util.UUID; | 21 | import java.util.UUID; |
21 | 22 | ||
@@ -25,6 +26,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -25,6 +26,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
25 | * @author Administrator | 26 | * @author Administrator |
26 | */ | 27 | */ |
27 | @RestController | 28 | @RestController |
29 | +@TbCoreComponent | ||
28 | @RequestMapping("api/yt/event") | 30 | @RequestMapping("api/yt/event") |
29 | @Api(tags = {"设备事件"}) | 31 | @Api(tags = {"设备事件"}) |
30 | @RequiredArgsConstructor | 32 | @RequiredArgsConstructor |
@@ -8,8 +8,10 @@ import org.springframework.web.bind.annotation.*; | @@ -8,8 +8,10 @@ import org.springframework.web.bind.annotation.*; | ||
8 | import org.thingsboard.server.common.data.exception.ThingsboardException; | 8 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
9 | import org.thingsboard.server.common.data.yunteng.dto.FrpInfoDTO; | 9 | import org.thingsboard.server.common.data.yunteng.dto.FrpInfoDTO; |
10 | import org.thingsboard.server.dao.yunteng.service.TkFrpInfoService; | 10 | import org.thingsboard.server.dao.yunteng.service.TkFrpInfoService; |
11 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
11 | 12 | ||
12 | @RestController | 13 | @RestController |
14 | +@TbCoreComponent | ||
13 | @RequestMapping("api/yt/frp") | 15 | @RequestMapping("api/yt/frp") |
14 | @Api(tags = "Frp内网穿透信息") | 16 | @Api(tags = "Frp内网穿透信息") |
15 | @RequiredArgsConstructor | 17 | @RequiredArgsConstructor |
@@ -11,12 +11,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -11,12 +11,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
11 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | 11 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; |
12 | import org.thingsboard.server.controller.BaseController; | 12 | import org.thingsboard.server.controller.BaseController; |
13 | import org.thingsboard.server.dao.yunteng.service.TkMailLogService; | 13 | import org.thingsboard.server.dao.yunteng.service.TkMailLogService; |
14 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
14 | 15 | ||
15 | import java.util.HashMap; | 16 | import java.util.HashMap; |
16 | 17 | ||
17 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 18 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
18 | 19 | ||
19 | @RestController | 20 | @RestController |
21 | +@TbCoreComponent | ||
20 | @RequestMapping("api/yt/mail_log") | 22 | @RequestMapping("api/yt/mail_log") |
21 | @RequiredArgsConstructor | 23 | @RequiredArgsConstructor |
22 | public class TkMailLogController extends BaseController { | 24 | public class TkMailLogController extends BaseController { |
@@ -10,8 +10,10 @@ import org.thingsboard.server.common.data.yunteng.dto.TkMapGeoJsonDTO; | @@ -10,8 +10,10 @@ import org.thingsboard.server.common.data.yunteng.dto.TkMapGeoJsonDTO; | ||
10 | import org.thingsboard.server.common.data.yunteng.enums.AreaLevelEnum; | 10 | import org.thingsboard.server.common.data.yunteng.enums.AreaLevelEnum; |
11 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | 11 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; |
12 | import org.thingsboard.server.dao.yunteng.service.TkMapGeoJsonService; | 12 | import org.thingsboard.server.dao.yunteng.service.TkMapGeoJsonService; |
13 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
13 | 14 | ||
14 | @RestController | 15 | @RestController |
16 | +@TbCoreComponent | ||
15 | @RequestMapping("/api/yt/map/geo_json") | 17 | @RequestMapping("/api/yt/map/geo_json") |
16 | @RequiredArgsConstructor | 18 | @RequiredArgsConstructor |
17 | @Api(tags = "行政区域经纬度信息") | 19 | @Api(tags = "行政区域经纬度信息") |
@@ -12,6 +12,7 @@ import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidatio | @@ -12,6 +12,7 @@ import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidatio | ||
12 | import org.thingsboard.server.common.data.yunteng.dto.MenuDTO; | 12 | import org.thingsboard.server.common.data.yunteng.dto.MenuDTO; |
13 | import org.thingsboard.server.controller.BaseController; | 13 | import org.thingsboard.server.controller.BaseController; |
14 | import org.thingsboard.server.dao.yunteng.service.MenuService; | 14 | import org.thingsboard.server.dao.yunteng.service.MenuService; |
15 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
15 | 16 | ||
16 | import java.net.URI; | 17 | import java.net.URI; |
17 | import java.util.List; | 18 | import java.util.List; |
@@ -19,6 +20,7 @@ import java.util.Optional; | @@ -19,6 +20,7 @@ import java.util.Optional; | ||
19 | import java.util.Set; | 20 | import java.util.Set; |
20 | 21 | ||
21 | @RestController | 22 | @RestController |
23 | +@TbCoreComponent | ||
22 | @RequiredArgsConstructor | 24 | @RequiredArgsConstructor |
23 | @RequestMapping("api/yt/menu") | 25 | @RequestMapping("api/yt/menu") |
24 | public class TkMenuController extends BaseController { | 26 | public class TkMenuController extends BaseController { |
@@ -17,6 +17,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -17,6 +17,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
17 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 17 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
18 | import org.thingsboard.server.controller.BaseController; | 18 | import org.thingsboard.server.controller.BaseController; |
19 | import org.thingsboard.server.dao.yunteng.service.TkMessageConfigService; | 19 | import org.thingsboard.server.dao.yunteng.service.TkMessageConfigService; |
20 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
20 | 21 | ||
21 | import java.util.HashMap; | 22 | import java.util.HashMap; |
22 | import java.util.List; | 23 | import java.util.List; |
@@ -24,6 +25,7 @@ import java.util.List; | @@ -24,6 +25,7 @@ import java.util.List; | ||
24 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 25 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
25 | 26 | ||
26 | @RestController | 27 | @RestController |
28 | +@TbCoreComponent | ||
27 | @RequestMapping("api/yt/message") | 29 | @RequestMapping("api/yt/message") |
28 | @RequiredArgsConstructor | 30 | @RequiredArgsConstructor |
29 | public class TkMessageConfigController extends BaseController { | 31 | public class TkMessageConfigController extends BaseController { |
@@ -14,12 +14,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -14,12 +14,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
14 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | 14 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; |
15 | import org.thingsboard.server.controller.BaseController; | 15 | import org.thingsboard.server.controller.BaseController; |
16 | import org.thingsboard.server.dao.yunteng.service.TkMessageLogService; | 16 | import org.thingsboard.server.dao.yunteng.service.TkMessageLogService; |
17 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
17 | 18 | ||
18 | import java.util.HashMap; | 19 | import java.util.HashMap; |
19 | 20 | ||
20 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 21 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
21 | 22 | ||
22 | @RestController | 23 | @RestController |
24 | +@TbCoreComponent | ||
23 | @RequestMapping("api/yt/message_log") | 25 | @RequestMapping("api/yt/message_log") |
24 | @RequiredArgsConstructor | 26 | @RequiredArgsConstructor |
25 | public class TkMessageLogController extends BaseController { | 27 | public class TkMessageLogController extends BaseController { |
application/src/main/java/org/thingsboard/server/controller/yunteng/TkMessageTemplateController.java
@@ -25,12 +25,14 @@ import org.thingsboard.server.controller.BaseController; | @@ -25,12 +25,14 @@ import org.thingsboard.server.controller.BaseController; | ||
25 | import org.thingsboard.server.dao.yunteng.service.TkMailService; | 25 | import org.thingsboard.server.dao.yunteng.service.TkMailService; |
26 | import org.thingsboard.server.dao.yunteng.service.TkMessageTemplateService; | 26 | import org.thingsboard.server.dao.yunteng.service.TkMessageTemplateService; |
27 | import org.thingsboard.server.dao.yunteng.service.TkMessageService; | 27 | import org.thingsboard.server.dao.yunteng.service.TkMessageService; |
28 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
28 | 29 | ||
29 | import java.util.HashMap; | 30 | import java.util.HashMap; |
30 | 31 | ||
31 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 32 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
32 | 33 | ||
33 | @RestController | 34 | @RestController |
35 | +@TbCoreComponent | ||
34 | @RequestMapping("api/yt/template") | 36 | @RequestMapping("api/yt/template") |
35 | @RequiredArgsConstructor | 37 | @RequiredArgsConstructor |
36 | public class TkMessageTemplateController extends BaseController { | 38 | public class TkMessageTemplateController extends BaseController { |
@@ -21,6 +21,7 @@ import org.thingsboard.server.common.data.yunteng.enums.ViewType; | @@ -21,6 +21,7 @@ import org.thingsboard.server.common.data.yunteng.enums.ViewType; | ||
21 | import org.thingsboard.server.common.data.yunteng.utils.JacksonUtil; | 21 | import org.thingsboard.server.common.data.yunteng.utils.JacksonUtil; |
22 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | 22 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; |
23 | import org.thingsboard.server.dao.yunteng.service.*; | 23 | import org.thingsboard.server.dao.yunteng.service.*; |
24 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
24 | 25 | ||
25 | import java.net.UnknownHostException; | 26 | import java.net.UnknownHostException; |
26 | import java.util.List; | 27 | import java.util.List; |
@@ -29,6 +30,7 @@ import java.util.Optional; | @@ -29,6 +30,7 @@ import java.util.Optional; | ||
29 | import static org.thingsboard.server.common.data.yunteng.constant.FastIotConstants.CHINA_MOBILE_PATTERN; | 30 | import static org.thingsboard.server.common.data.yunteng.constant.FastIotConstants.CHINA_MOBILE_PATTERN; |
30 | 31 | ||
31 | @RestController | 32 | @RestController |
33 | +@TbCoreComponent | ||
32 | @RequestMapping("api/yt/noauth") | 34 | @RequestMapping("api/yt/noauth") |
33 | @RequiredArgsConstructor | 35 | @RequiredArgsConstructor |
34 | public class TkNoAuthController { | 36 | public class TkNoAuthController { |
@@ -18,6 +18,7 @@ import org.thingsboard.server.common.data.yunteng.enums.SysNoticeTypeEnum; | @@ -18,6 +18,7 @@ import org.thingsboard.server.common.data.yunteng.enums.SysNoticeTypeEnum; | ||
18 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 18 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
19 | import org.thingsboard.server.controller.BaseController; | 19 | import org.thingsboard.server.controller.BaseController; |
20 | import org.thingsboard.server.dao.yunteng.service.SysNoticeService; | 20 | import org.thingsboard.server.dao.yunteng.service.SysNoticeService; |
21 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
21 | 22 | ||
22 | import java.util.HashMap; | 23 | import java.util.HashMap; |
23 | import java.util.Map; | 24 | import java.util.Map; |
@@ -31,6 +32,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -31,6 +32,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
31 | */ | 32 | */ |
32 | @Api(tags = "通知管理") | 33 | @Api(tags = "通知管理") |
33 | @RestController | 34 | @RestController |
35 | +@TbCoreComponent | ||
34 | @RequestMapping("api/yt/notice") | 36 | @RequestMapping("api/yt/notice") |
35 | @RequiredArgsConstructor | 37 | @RequiredArgsConstructor |
36 | public class TkNoticeController extends BaseController { | 38 | public class TkNoticeController extends BaseController { |
@@ -12,6 +12,7 @@ import org.thingsboard.server.common.data.yunteng.enums.SysNoticeTypeEnum; | @@ -12,6 +12,7 @@ import org.thingsboard.server.common.data.yunteng.enums.SysNoticeTypeEnum; | ||
12 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 12 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
13 | import org.thingsboard.server.controller.BaseController; | 13 | import org.thingsboard.server.controller.BaseController; |
14 | import org.thingsboard.server.dao.yunteng.service.SysNoticeUserService; | 14 | import org.thingsboard.server.dao.yunteng.service.SysNoticeUserService; |
15 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
15 | 16 | ||
16 | import java.util.HashMap; | 17 | import java.util.HashMap; |
17 | import java.util.Map; | 18 | import java.util.Map; |
@@ -24,6 +25,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -24,6 +25,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
24 | */ | 25 | */ |
25 | @Api(tags = "我的通知") | 26 | @Api(tags = "我的通知") |
26 | @RestController | 27 | @RestController |
28 | +@TbCoreComponent | ||
27 | @RequestMapping("api/yt/notice_user") | 29 | @RequestMapping("api/yt/notice_user") |
28 | @RequiredArgsConstructor | 30 | @RequiredArgsConstructor |
29 | public class TkNoticeUserController extends BaseController { | 31 | public class TkNoticeUserController extends BaseController { |
@@ -16,10 +16,12 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -16,10 +16,12 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
16 | import org.thingsboard.server.controller.BaseController; | 16 | import org.thingsboard.server.controller.BaseController; |
17 | import org.thingsboard.server.dao.yunteng.entities.TkOpinionEntity; | 17 | import org.thingsboard.server.dao.yunteng.entities.TkOpinionEntity; |
18 | import org.thingsboard.server.dao.yunteng.service.TkOpinionService; | 18 | import org.thingsboard.server.dao.yunteng.service.TkOpinionService; |
19 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
19 | 20 | ||
20 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 21 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
21 | 22 | ||
22 | @RestController | 23 | @RestController |
24 | +@TbCoreComponent | ||
23 | @RequestMapping("api/yt/opinion") | 25 | @RequestMapping("api/yt/opinion") |
24 | @Api(tags = {"意见反馈"}) | 26 | @Api(tags = {"意见反馈"}) |
25 | @RequiredArgsConstructor | 27 | @RequiredArgsConstructor |
@@ -16,12 +16,14 @@ import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | @@ -16,12 +16,14 @@ import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | ||
16 | import org.thingsboard.server.common.data.yunteng.dto.OrganizationDTO; | 16 | import org.thingsboard.server.common.data.yunteng.dto.OrganizationDTO; |
17 | import org.thingsboard.server.controller.BaseController; | 17 | import org.thingsboard.server.controller.BaseController; |
18 | import org.thingsboard.server.dao.yunteng.service.TkOrganizationService; | 18 | import org.thingsboard.server.dao.yunteng.service.TkOrganizationService; |
19 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
19 | 20 | ||
20 | import java.net.URI; | 21 | import java.net.URI; |
21 | import java.util.List; | 22 | import java.util.List; |
22 | import java.util.Optional; | 23 | import java.util.Optional; |
23 | 24 | ||
24 | @RestController | 25 | @RestController |
26 | +@TbCoreComponent | ||
25 | @RequestMapping("api/yt/organization") | 27 | @RequestMapping("api/yt/organization") |
26 | @Api(tags = "组织管理") | 28 | @Api(tags = "组织管理") |
27 | @RequiredArgsConstructor | 29 | @RequiredArgsConstructor |
@@ -8,11 +8,13 @@ import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidatio | @@ -8,11 +8,13 @@ import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidatio | ||
8 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | 8 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; |
9 | import org.thingsboard.server.common.data.yunteng.core.utils.FileStorageService; | 9 | import org.thingsboard.server.common.data.yunteng.core.utils.FileStorageService; |
10 | import org.thingsboard.server.common.data.yunteng.dto.FileUploadResponse; | 10 | import org.thingsboard.server.common.data.yunteng.dto.FileUploadResponse; |
11 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
11 | 12 | ||
12 | import javax.servlet.http.HttpServletRequest; | 13 | import javax.servlet.http.HttpServletRequest; |
13 | import javax.servlet.http.HttpServletResponse; | 14 | import javax.servlet.http.HttpServletResponse; |
14 | 15 | ||
15 | @RestController | 16 | @RestController |
17 | +@TbCoreComponent | ||
16 | @RequestMapping("api/yt/oss") | 18 | @RequestMapping("api/yt/oss") |
17 | public class TkOssFileController { | 19 | public class TkOssFileController { |
18 | 20 |
@@ -12,6 +12,7 @@ import org.thingsboard.server.common.data.yunteng.dto.SysPlatformDesignDTO; | @@ -12,6 +12,7 @@ import org.thingsboard.server.common.data.yunteng.dto.SysPlatformDesignDTO; | ||
12 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | 12 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; |
13 | import org.thingsboard.server.controller.BaseController; | 13 | import org.thingsboard.server.controller.BaseController; |
14 | import org.thingsboard.server.dao.yunteng.service.SysPlatformDesignService; | 14 | import org.thingsboard.server.dao.yunteng.service.SysPlatformDesignService; |
15 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
15 | 16 | ||
16 | /** | 17 | /** |
17 | * @author: 徐浩然 | 18 | * @author: 徐浩然 |
@@ -20,6 +21,7 @@ import org.thingsboard.server.dao.yunteng.service.SysPlatformDesignService; | @@ -20,6 +21,7 @@ import org.thingsboard.server.dao.yunteng.service.SysPlatformDesignService; | ||
20 | */ | 21 | */ |
21 | @Api(tags = "平台定制") | 22 | @Api(tags = "平台定制") |
22 | @RestController | 23 | @RestController |
24 | +@TbCoreComponent | ||
23 | @RequestMapping("api/yt/platform") | 25 | @RequestMapping("api/yt/platform") |
24 | @RequiredArgsConstructor | 26 | @RequiredArgsConstructor |
25 | public class TkPlatformDesignController extends BaseController { | 27 | public class TkPlatformDesignController extends BaseController { |
@@ -22,6 +22,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -22,6 +22,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
22 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 22 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
23 | import org.thingsboard.server.controller.BaseController; | 23 | import org.thingsboard.server.controller.BaseController; |
24 | import org.thingsboard.server.dao.yunteng.service.TkReportFormConfigService; | 24 | import org.thingsboard.server.dao.yunteng.service.TkReportFormConfigService; |
25 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
25 | 26 | ||
26 | import java.sql.Timestamp; | 27 | import java.sql.Timestamp; |
27 | import java.util.HashMap; | 28 | import java.util.HashMap; |
@@ -30,6 +31,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -30,6 +31,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
30 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; | 31 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; |
31 | 32 | ||
32 | @RestController | 33 | @RestController |
34 | +@TbCoreComponent | ||
33 | @RequestMapping("api/yt/report_form/config") | 35 | @RequestMapping("api/yt/report_form/config") |
34 | @Api(tags = "报表配置信息") | 36 | @Api(tags = "报表配置信息") |
35 | @RequiredArgsConstructor | 37 | @RequiredArgsConstructor |
@@ -24,6 +24,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -24,6 +24,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
24 | import org.thingsboard.server.controller.BaseController; | 24 | import org.thingsboard.server.controller.BaseController; |
25 | import org.thingsboard.server.dao.yunteng.service.TkReportFormConfigService; | 25 | import org.thingsboard.server.dao.yunteng.service.TkReportFormConfigService; |
26 | import org.thingsboard.server.dao.yunteng.service.TkReportGenerateRecordService; | 26 | import org.thingsboard.server.dao.yunteng.service.TkReportGenerateRecordService; |
27 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
27 | 28 | ||
28 | import java.sql.Timestamp; | 29 | import java.sql.Timestamp; |
29 | import java.util.ArrayList; | 30 | import java.util.ArrayList; |
@@ -34,6 +35,7 @@ import java.util.Map; | @@ -34,6 +35,7 @@ import java.util.Map; | ||
34 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 35 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
35 | 36 | ||
36 | @RestController | 37 | @RestController |
38 | +@TbCoreComponent | ||
37 | @RequestMapping("api/yt/report/generate/record") | 39 | @RequestMapping("api/yt/report/generate/record") |
38 | @Api(tags = "报表生成记录") | 40 | @Api(tags = "报表生成记录") |
39 | @RequiredArgsConstructor | 41 | @RequiredArgsConstructor |
@@ -14,6 +14,7 @@ import org.thingsboard.server.common.data.yunteng.enums.RoleEnum; | @@ -14,6 +14,7 @@ import org.thingsboard.server.common.data.yunteng.enums.RoleEnum; | ||
14 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 14 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
15 | import org.thingsboard.server.controller.BaseController; | 15 | import org.thingsboard.server.controller.BaseController; |
16 | import org.thingsboard.server.dao.yunteng.service.RoleService; | 16 | import org.thingsboard.server.dao.yunteng.service.RoleService; |
17 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
17 | 18 | ||
18 | import java.util.HashMap; | 19 | import java.util.HashMap; |
19 | import java.util.List; | 20 | import java.util.List; |
@@ -22,6 +23,7 @@ import java.util.Set; | @@ -22,6 +23,7 @@ import java.util.Set; | ||
22 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 23 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
23 | 24 | ||
24 | @RestController | 25 | @RestController |
26 | +@TbCoreComponent | ||
25 | @RequestMapping("api/yt/role") | 27 | @RequestMapping("api/yt/role") |
26 | @RequiredArgsConstructor | 28 | @RequiredArgsConstructor |
27 | public class TkRoleController extends BaseController { | 29 | public class TkRoleController extends BaseController { |
@@ -18,6 +18,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -18,6 +18,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
18 | import org.thingsboard.server.controller.BaseController; | 18 | import org.thingsboard.server.controller.BaseController; |
19 | import org.thingsboard.server.dao.yunteng.entities.TkRpcRecordEntity; | 19 | import org.thingsboard.server.dao.yunteng.entities.TkRpcRecordEntity; |
20 | import org.thingsboard.server.dao.yunteng.service.TkRpcRecordService; | 20 | import org.thingsboard.server.dao.yunteng.service.TkRpcRecordService; |
21 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
21 | 22 | ||
22 | import java.sql.Timestamp; | 23 | import java.sql.Timestamp; |
23 | 24 | ||
@@ -27,6 +28,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -27,6 +28,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
27 | * @author Administrator | 28 | * @author Administrator |
28 | */ | 29 | */ |
29 | @RestController | 30 | @RestController |
31 | +@TbCoreComponent | ||
30 | @RequestMapping("api/yt/rpc") | 32 | @RequestMapping("api/yt/rpc") |
31 | @Api(tags = {"命令下发记录"}) | 33 | @Api(tags = {"命令下发记录"}) |
32 | @RequiredArgsConstructor | 34 | @RequiredArgsConstructor |
@@ -8,11 +8,13 @@ import org.springframework.web.bind.annotation.RequestParam; | @@ -8,11 +8,13 @@ import org.springframework.web.bind.annotation.RequestParam; | ||
8 | import org.springframework.web.bind.annotation.RestController; | 8 | import org.springframework.web.bind.annotation.RestController; |
9 | import org.thingsboard.server.common.data.StringUtils; | 9 | import org.thingsboard.server.common.data.StringUtils; |
10 | import org.thingsboard.server.dao.yunteng.service.rtsp.TkFLVService; | 10 | import org.thingsboard.server.dao.yunteng.service.rtsp.TkFLVService; |
11 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
11 | 12 | ||
12 | import javax.servlet.http.HttpServletRequest; | 13 | import javax.servlet.http.HttpServletRequest; |
13 | import javax.servlet.http.HttpServletResponse; | 14 | import javax.servlet.http.HttpServletResponse; |
14 | 15 | ||
15 | @RestController | 16 | @RestController |
17 | +@TbCoreComponent | ||
16 | @RequestMapping("api/yt/rtsp") | 18 | @RequestMapping("api/yt/rtsp") |
17 | @Api(tags = {"rtsp流转换"}) | 19 | @Api(tags = {"rtsp流转换"}) |
18 | @RequiredArgsConstructor | 20 | @RequiredArgsConstructor |
@@ -12,8 +12,10 @@ import org.thingsboard.server.common.data.id.TenantId; | @@ -12,8 +12,10 @@ import org.thingsboard.server.common.data.id.TenantId; | ||
12 | import org.thingsboard.server.common.data.rule.RuleChainType; | 12 | import org.thingsboard.server.common.data.rule.RuleChainType; |
13 | import org.thingsboard.server.controller.BaseController; | 13 | import org.thingsboard.server.controller.BaseController; |
14 | import org.thingsboard.server.dao.yunteng.service.TkRuleChainService; | 14 | import org.thingsboard.server.dao.yunteng.service.TkRuleChainService; |
15 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
15 | 16 | ||
16 | @RestController | 17 | @RestController |
18 | +@TbCoreComponent | ||
17 | @RequiredArgsConstructor | 19 | @RequiredArgsConstructor |
18 | @RequestMapping("api/yt/rule_chain") | 20 | @RequestMapping("api/yt/rule_chain") |
19 | @Api(tags = {"规则链管理"}) | 21 | @Api(tags = {"规则链管理"}) |
@@ -26,6 +26,7 @@ import org.thingsboard.server.controller.BaseController; | @@ -26,6 +26,7 @@ import org.thingsboard.server.controller.BaseController; | ||
26 | import org.thingsboard.server.controller.yunteng.aspect.annotation.AutoLog; | 26 | import org.thingsboard.server.controller.yunteng.aspect.annotation.AutoLog; |
27 | import org.thingsboard.server.dao.model.ModelConstants; | 27 | import org.thingsboard.server.dao.model.ModelConstants; |
28 | import org.thingsboard.server.dao.yunteng.service.SceneLinkageService; | 28 | import org.thingsboard.server.dao.yunteng.service.SceneLinkageService; |
29 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
29 | 30 | ||
30 | import java.net.URI; | 31 | import java.net.URI; |
31 | import java.util.*; | 32 | import java.util.*; |
@@ -35,6 +36,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -35,6 +36,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
35 | 36 | ||
36 | /** @Description 场景联动 @Author cxy @Date 2021/11/25 11:25 */ | 37 | /** @Description 场景联动 @Author cxy @Date 2021/11/25 11:25 */ |
37 | @RestController | 38 | @RestController |
39 | +@TbCoreComponent | ||
38 | @RequestMapping("/api/yt/scene_linkage") | 40 | @RequestMapping("/api/yt/scene_linkage") |
39 | @RequiredArgsConstructor | 41 | @RequiredArgsConstructor |
40 | @Api(tags = "场景联动") | 42 | @Api(tags = "场景联动") |
@@ -12,8 +12,10 @@ import org.thingsboard.server.common.data.yunteng.enums.ShareViewType; | @@ -12,8 +12,10 @@ import org.thingsboard.server.common.data.yunteng.enums.ShareViewType; | ||
12 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | 12 | import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; |
13 | import org.thingsboard.server.controller.BaseController; | 13 | import org.thingsboard.server.controller.BaseController; |
14 | import org.thingsboard.server.dao.yunteng.service.TkShareViewService; | 14 | import org.thingsboard.server.dao.yunteng.service.TkShareViewService; |
15 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
15 | 16 | ||
16 | @RestController | 17 | @RestController |
18 | +@TbCoreComponent | ||
17 | @RequiredArgsConstructor | 19 | @RequiredArgsConstructor |
18 | @RequestMapping("api/yt/share") | 20 | @RequestMapping("api/yt/share") |
19 | @Api(tags = {"分享的视图"}) | 21 | @Api(tags = {"分享的视图"}) |
@@ -17,10 +17,12 @@ import org.thingsboard.server.controller.BaseController; | @@ -17,10 +17,12 @@ import org.thingsboard.server.controller.BaseController; | ||
17 | import org.thingsboard.server.dao.model.ModelConstants; | 17 | import org.thingsboard.server.dao.model.ModelConstants; |
18 | import org.thingsboard.server.dao.yunteng.entities.SysLogEntity; | 18 | import org.thingsboard.server.dao.yunteng.entities.SysLogEntity; |
19 | import org.thingsboard.server.dao.yunteng.service.TkSysLogService; | 19 | import org.thingsboard.server.dao.yunteng.service.TkSysLogService; |
20 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
20 | 21 | ||
21 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 22 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
22 | 23 | ||
23 | @RestController | 24 | @RestController |
25 | +@TbCoreComponent | ||
24 | @RequestMapping("api/yt/log") | 26 | @RequestMapping("api/yt/log") |
25 | @Api(tags = {"日志管理"}) | 27 | @Api(tags = {"日志管理"}) |
26 | @RequiredArgsConstructor | 28 | @RequiredArgsConstructor |
@@ -22,6 +22,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -22,6 +22,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
22 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 22 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
23 | import org.thingsboard.server.controller.BaseController; | 23 | import org.thingsboard.server.controller.BaseController; |
24 | import org.thingsboard.server.dao.yunteng.service.TkTaskCenterService; | 24 | import org.thingsboard.server.dao.yunteng.service.TkTaskCenterService; |
25 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
25 | 26 | ||
26 | import java.util.HashMap; | 27 | import java.util.HashMap; |
27 | 28 | ||
@@ -29,6 +30,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -29,6 +30,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
29 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; | 30 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; |
30 | 31 | ||
31 | @RestController | 32 | @RestController |
33 | +@TbCoreComponent | ||
32 | @RequestMapping("api/yt/task_center") | 34 | @RequestMapping("api/yt/task_center") |
33 | @Api(tags = {"任务中心"}) | 35 | @Api(tags = {"任务中心"}) |
34 | @RequiredArgsConstructor | 36 | @RequiredArgsConstructor |
@@ -15,12 +15,14 @@ import org.thingsboard.server.common.data.yunteng.dto.request.SendResetPasswordE | @@ -15,12 +15,14 @@ import org.thingsboard.server.common.data.yunteng.dto.request.SendResetPasswordE | ||
15 | import org.thingsboard.server.common.data.yunteng.enums.MessageTypeEnum; | 15 | import org.thingsboard.server.common.data.yunteng.enums.MessageTypeEnum; |
16 | import org.thingsboard.server.dao.user.UserService; | 16 | import org.thingsboard.server.dao.user.UserService; |
17 | import org.thingsboard.server.dao.yunteng.service.TkUserService; | 17 | import org.thingsboard.server.dao.yunteng.service.TkUserService; |
18 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
18 | import org.thingsboard.server.service.security.model.SecurityUser; | 19 | import org.thingsboard.server.service.security.model.SecurityUser; |
19 | import org.thingsboard.server.service.security.system.SystemSecurityService; | 20 | import org.thingsboard.server.service.security.system.SystemSecurityService; |
20 | 21 | ||
21 | import java.util.UUID; | 22 | import java.util.UUID; |
22 | 23 | ||
23 | @RestController | 24 | @RestController |
25 | +@TbCoreComponent | ||
24 | @RequestMapping("/api/yt/tenant") | 26 | @RequestMapping("/api/yt/tenant") |
25 | public class TkTenantController extends AbstractUserAccount { | 27 | public class TkTenantController extends AbstractUserAccount { |
26 | 28 |
@@ -18,6 +18,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -18,6 +18,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
18 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 18 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
19 | import org.thingsboard.server.controller.BaseController; | 19 | import org.thingsboard.server.controller.BaseController; |
20 | import org.thingsboard.server.dao.yunteng.service.TkTenantService; | 20 | import org.thingsboard.server.dao.yunteng.service.TkTenantService; |
21 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
21 | 22 | ||
22 | import java.util.List; | 23 | import java.util.List; |
23 | import java.util.UUID; | 24 | import java.util.UUID; |
@@ -25,6 +26,7 @@ import java.util.UUID; | @@ -25,6 +26,7 @@ import java.util.UUID; | ||
25 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 26 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
26 | 27 | ||
27 | @RestController | 28 | @RestController |
29 | +@TbCoreComponent | ||
28 | @RequestMapping("/api/yt/tenant_profiles") | 30 | @RequestMapping("/api/yt/tenant_profiles") |
29 | @RequiredArgsConstructor | 31 | @RequiredArgsConstructor |
30 | public class TkTenantProfilesController extends BaseController { | 32 | public class TkTenantProfilesController extends BaseController { |
@@ -5,8 +5,10 @@ import org.springframework.web.bind.annotation.PostMapping; | @@ -5,8 +5,10 @@ import org.springframework.web.bind.annotation.PostMapping; | ||
5 | import org.springframework.web.bind.annotation.RequestBody; | 5 | import org.springframework.web.bind.annotation.RequestBody; |
6 | import org.springframework.web.bind.annotation.RequestMapping; | 6 | import org.springframework.web.bind.annotation.RequestMapping; |
7 | import org.springframework.web.bind.annotation.RestController; | 7 | import org.springframework.web.bind.annotation.RestController; |
8 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
8 | 9 | ||
9 | @RestController | 10 | @RestController |
11 | +@TbCoreComponent | ||
10 | @RequestMapping("/api/yt/noauth/test") | 12 | @RequestMapping("/api/yt/noauth/test") |
11 | public class TkTestController { | 13 | public class TkTestController { |
12 | @PostMapping | 14 | @PostMapping |
@@ -29,6 +29,7 @@ import org.thingsboard.server.dao.yunteng.entities.TkThirdUserEntity; | @@ -29,6 +29,7 @@ import org.thingsboard.server.dao.yunteng.entities.TkThirdUserEntity; | ||
29 | import org.thingsboard.server.dao.yunteng.service.TkTenantService; | 29 | import org.thingsboard.server.dao.yunteng.service.TkTenantService; |
30 | import org.thingsboard.server.dao.yunteng.service.TkThirdPlatformService; | 30 | import org.thingsboard.server.dao.yunteng.service.TkThirdPlatformService; |
31 | import org.thingsboard.server.dao.yunteng.service.TkUserService; | 31 | import org.thingsboard.server.dao.yunteng.service.TkUserService; |
32 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
32 | import org.thingsboard.server.service.security.auth.yunteng.TkLoginResponse; | 33 | import org.thingsboard.server.service.security.auth.yunteng.TkLoginResponse; |
33 | import org.thingsboard.server.service.security.model.SecurityUser; | 34 | import org.thingsboard.server.service.security.model.SecurityUser; |
34 | import org.thingsboard.server.service.security.model.UserPrincipal; | 35 | import org.thingsboard.server.service.security.model.UserPrincipal; |
@@ -45,6 +46,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -45,6 +46,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
45 | * @author Administrator | 46 | * @author Administrator |
46 | */ | 47 | */ |
47 | @RestController | 48 | @RestController |
49 | +@TbCoreComponent | ||
48 | @RequestMapping("api/yt/third") | 50 | @RequestMapping("api/yt/third") |
49 | @Api(tags = {"第三方小程序"}) | 51 | @Api(tags = {"第三方小程序"}) |
50 | @RequiredArgsConstructor | 52 | @RequiredArgsConstructor |
@@ -12,10 +12,12 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | @@ -12,10 +12,12 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.ResponseResult; | ||
12 | import org.thingsboard.server.controller.BaseController; | 12 | import org.thingsboard.server.controller.BaseController; |
13 | import org.thingsboard.server.dao.yunteng.entities.TkUserCollectEntity; | 13 | import org.thingsboard.server.dao.yunteng.entities.TkUserCollectEntity; |
14 | import org.thingsboard.server.dao.yunteng.service.TkUserCollectService; | 14 | import org.thingsboard.server.dao.yunteng.service.TkUserCollectService; |
15 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
15 | 16 | ||
16 | import java.util.List; | 17 | import java.util.List; |
17 | 18 | ||
18 | @RestController | 19 | @RestController |
20 | +@TbCoreComponent | ||
19 | @RequiredArgsConstructor | 21 | @RequiredArgsConstructor |
20 | @RequestMapping("api/yt/collect") | 22 | @RequestMapping("api/yt/collect") |
21 | @Api(tags = {"收藏功能"}) | 23 | @Api(tags = {"收藏功能"}) |
@@ -44,6 +44,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -44,6 +44,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
44 | import org.thingsboard.server.dao.user.UserService; | 44 | import org.thingsboard.server.dao.user.UserService; |
45 | import org.thingsboard.server.dao.yunteng.entities.SysUserEntity; | 45 | import org.thingsboard.server.dao.yunteng.entities.SysUserEntity; |
46 | import org.thingsboard.server.dao.yunteng.service.TkUserService; | 46 | import org.thingsboard.server.dao.yunteng.service.TkUserService; |
47 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
47 | import org.thingsboard.server.service.entitiy.customer.TbCustomerService; | 48 | import org.thingsboard.server.service.entitiy.customer.TbCustomerService; |
48 | import org.thingsboard.server.service.security.model.SecurityUser; | 49 | import org.thingsboard.server.service.security.model.SecurityUser; |
49 | import org.thingsboard.server.service.security.permission.Operation; | 50 | import org.thingsboard.server.service.security.permission.Operation; |
@@ -60,6 +61,7 @@ import java.util.UUID; | @@ -60,6 +61,7 @@ import java.util.UUID; | ||
60 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 61 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
61 | 62 | ||
62 | @RestController | 63 | @RestController |
64 | +@TbCoreComponent | ||
63 | @RequestMapping("api/yt/user") | 65 | @RequestMapping("api/yt/user") |
64 | @Api(value = "用户接口") | 66 | @Api(value = "用户接口") |
65 | public class TkUserController extends AbstractUserAccount { | 67 | public class TkUserController extends AbstractUserAccount { |
@@ -22,6 +22,7 @@ import org.thingsboard.server.controller.BaseController; | @@ -22,6 +22,7 @@ import org.thingsboard.server.controller.BaseController; | ||
22 | import org.thingsboard.server.dao.yunteng.mapper.DeviceMapper; | 22 | import org.thingsboard.server.dao.yunteng.mapper.DeviceMapper; |
23 | import org.thingsboard.server.dao.yunteng.service.TkDeviceService; | 23 | import org.thingsboard.server.dao.yunteng.service.TkDeviceService; |
24 | import org.thingsboard.server.dao.yunteng.service.media.TkVideoChannelService; | 24 | import org.thingsboard.server.dao.yunteng.service.media.TkVideoChannelService; |
25 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
25 | 26 | ||
26 | import java.util.HashMap; | 27 | import java.util.HashMap; |
27 | import java.util.List; | 28 | import java.util.List; |
@@ -30,6 +31,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -30,6 +31,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
30 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; | 31 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.ORDER_TYPE; |
31 | 32 | ||
32 | @RestController | 33 | @RestController |
34 | +@TbCoreComponent | ||
33 | @RequestMapping("api/yt/video/channel") | 35 | @RequestMapping("api/yt/video/channel") |
34 | @Api(tags = {"视频通道"}) | 36 | @Api(tags = {"视频通道"}) |
35 | @RequiredArgsConstructor | 37 | @RequiredArgsConstructor |
@@ -19,6 +19,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -19,6 +19,7 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
19 | import org.thingsboard.server.controller.BaseController; | 19 | import org.thingsboard.server.controller.BaseController; |
20 | import org.thingsboard.server.dao.yunteng.entities.TkVideoEntity; | 20 | import org.thingsboard.server.dao.yunteng.entities.TkVideoEntity; |
21 | import org.thingsboard.server.dao.yunteng.service.TkVideoService; | 21 | import org.thingsboard.server.dao.yunteng.service.TkVideoService; |
22 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
22 | 23 | ||
23 | import java.io.IOException; | 24 | import java.io.IOException; |
24 | import java.util.HashMap; | 25 | import java.util.HashMap; |
@@ -28,6 +29,7 @@ import java.util.Map; | @@ -28,6 +29,7 @@ import java.util.Map; | ||
28 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 29 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
29 | 30 | ||
30 | @RestController | 31 | @RestController |
32 | +@TbCoreComponent | ||
31 | @RequestMapping("api/yt/video") | 33 | @RequestMapping("api/yt/video") |
32 | @Api(tags = {"视频流"}) | 34 | @Api(tags = {"视频流"}) |
33 | @RequiredArgsConstructor | 35 | @RequiredArgsConstructor |
@@ -16,12 +16,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | @@ -16,12 +16,14 @@ import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | ||
16 | import org.thingsboard.server.controller.BaseController; | 16 | import org.thingsboard.server.controller.BaseController; |
17 | import org.thingsboard.server.dao.yunteng.entities.TkVideoPlatformEntity; | 17 | import org.thingsboard.server.dao.yunteng.entities.TkVideoPlatformEntity; |
18 | import org.thingsboard.server.dao.yunteng.service.TkVideoPlatformService; | 18 | import org.thingsboard.server.dao.yunteng.service.TkVideoPlatformService; |
19 | +import org.thingsboard.server.queue.util.TbCoreComponent; | ||
19 | 20 | ||
20 | import java.util.List; | 21 | import java.util.List; |
21 | 22 | ||
22 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; | 23 | import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant.*; |
23 | 24 | ||
24 | @RestController | 25 | @RestController |
26 | +@TbCoreComponent | ||
25 | @RequestMapping("api/yt/video/platform") | 27 | @RequestMapping("api/yt/video/platform") |
26 | @Api(tags = {"流媒体平台配置"}) | 28 | @Api(tags = {"流媒体平台配置"}) |
27 | @RequiredArgsConstructor | 29 | @RequiredArgsConstructor |
@@ -65,12 +65,14 @@ import org.thingsboard.server.common.data.page.PageData; | @@ -65,12 +65,14 @@ import org.thingsboard.server.common.data.page.PageData; | ||
65 | import org.thingsboard.server.common.data.page.PageLink; | 65 | import org.thingsboard.server.common.data.page.PageLink; |
66 | import org.thingsboard.server.common.data.queue.Queue; | 66 | import org.thingsboard.server.common.data.queue.Queue; |
67 | import org.thingsboard.server.common.data.relation.EntityRelation; | 67 | import org.thingsboard.server.common.data.relation.EntityRelation; |
68 | +import org.thingsboard.server.common.data.script.ScriptLanguage; | ||
68 | import org.thingsboard.server.common.data.security.DeviceCredentials; | 69 | import org.thingsboard.server.common.data.security.DeviceCredentials; |
69 | import org.thingsboard.server.common.data.security.DeviceCredentialsType; | 70 | import org.thingsboard.server.common.data.security.DeviceCredentialsType; |
70 | import org.thingsboard.server.common.data.yunteng.common.media.VideoStreamSessionManager; | 71 | import org.thingsboard.server.common.data.yunteng.common.media.VideoStreamSessionManager; |
71 | import org.thingsboard.server.common.data.yunteng.config.media.ZLMediaKitServerConfig; | 72 | import org.thingsboard.server.common.data.yunteng.config.media.ZLMediaKitServerConfig; |
72 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | 73 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; |
73 | import org.thingsboard.server.common.data.yunteng.core.cache.CacheUtils; | 74 | import org.thingsboard.server.common.data.yunteng.core.cache.CacheUtils; |
75 | +import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | ||
74 | import org.thingsboard.server.common.data.yunteng.dto.DeviceDTO; | 76 | import org.thingsboard.server.common.data.yunteng.dto.DeviceDTO; |
75 | import org.thingsboard.server.common.data.yunteng.dto.TkDeviceScriptDTO; | 77 | import org.thingsboard.server.common.data.yunteng.dto.TkDeviceScriptDTO; |
76 | import org.thingsboard.server.common.data.yunteng.dto.sip.MediaServerDTO; | 78 | import org.thingsboard.server.common.data.yunteng.dto.sip.MediaServerDTO; |
@@ -158,7 +160,7 @@ public class DefaultTransportApiService implements TransportApiService { | @@ -158,7 +160,7 @@ public class DefaultTransportApiService implements TransportApiService { | ||
158 | //thingskit | 160 | //thingskit |
159 | private final CacheUtils cacheUtils; | 161 | private final CacheUtils cacheUtils; |
160 | private final TkDeviceService tkDeviceService; | 162 | private final TkDeviceService tkDeviceService; |
161 | - private final TkDeviceScriptService scriptService; | 163 | + private final TkDeviceScriptService tkDeviceScriptService; |
162 | private final TkVideoChannelService channelService; | 164 | private final TkVideoChannelService channelService; |
163 | private final TkMediaServerNodeService mediaServerNodeService; | 165 | private final TkMediaServerNodeService mediaServerNodeService; |
164 | private final VideoStreamSessionManager videoStreamSessionManager; | 166 | private final VideoStreamSessionManager videoStreamSessionManager; |
@@ -254,6 +256,10 @@ public class DefaultTransportApiService implements TransportApiService { | @@ -254,6 +256,10 @@ public class DefaultTransportApiService implements TransportApiService { | ||
254 | TransportProtos.ValidateTcpDeviceTokenRequestMsg msg = transportApiRequestMsg.getValidateTcpTokenRequestMsg(); | 256 | TransportProtos.ValidateTcpDeviceTokenRequestMsg msg = transportApiRequestMsg.getValidateTcpTokenRequestMsg(); |
255 | final String token = msg.getToken(); | 257 | final String token = msg.getToken(); |
256 | result = handlerExecutor.submit(() -> validateTcpUdpCredentials(token, DeviceCredentialsType.ACCESS_TOKEN)); | 258 | result = handlerExecutor.submit(() -> validateTcpUdpCredentials(token, DeviceCredentialsType.ACCESS_TOKEN)); |
259 | + } else if(transportApiRequestMsg.hasUpScriptRequestMsg()){ | ||
260 | + result = handle(transportApiRequestMsg.getUpScriptRequestMsg()); | ||
261 | + } else if(transportApiRequestMsg.hasDataCombinationRequest()){ | ||
262 | + result = handle(transportApiRequestMsg.getDataCombinationRequest()); | ||
257 | } | 263 | } |
258 | 264 | ||
259 | return Futures.transform(Optional.ofNullable(result).orElseGet(this::getEmptyTransportApiResponseFuture), | 265 | return Futures.transform(Optional.ofNullable(result).orElseGet(this::getEmptyTransportApiResponseFuture), |
@@ -833,25 +839,41 @@ public class DefaultTransportApiService implements TransportApiService { | @@ -833,25 +839,41 @@ public class DefaultTransportApiService implements TransportApiService { | ||
833 | } | 839 | } |
834 | // Thingskit function | 840 | // Thingskit function |
835 | private ListenableFuture<TransportApiResponseMsg> handle(TransportProtos.ScriptProto requestMsg) { | 841 | private ListenableFuture<TransportApiResponseMsg> handle(TransportProtos.ScriptProto requestMsg) { |
836 | - List<TkDeviceScriptDTO> allScriptes = scriptService.getScriptes(); | ||
837 | - TransportApiResponseMsg.Builder responseBuilder = TransportApiResponseMsg.newBuilder(); | ||
838 | - allScriptes.forEach( | ||
839 | - item -> { | ||
840 | - UUID tenantId = UUID.fromString(item.getTenantId()); | ||
841 | - UUID id = UUID.fromString(item.getId()); | ||
842 | - responseBuilder.addScriptsResponseMsg( | ||
843 | - TransportProtos.ScriptProto.newBuilder() | ||
844 | - .setConvertJs(item.getConvertJs()) | ||
845 | - .setTenantIdLSB(tenantId.getLeastSignificantBits()) | ||
846 | - .setTenantIdMSB(tenantId.getMostSignificantBits()) | ||
847 | - .setScriptIdLSB(id.getLeastSignificantBits()) | ||
848 | - .setScriptIdMSB(id.getMostSignificantBits()) | ||
849 | - .setFunctionType(item.getScriptType()) | ||
850 | - .setStatus(item.getStatus())); | ||
851 | - }); | 842 | + List<TkDeviceScriptDTO> scriptDTOS = tkDeviceScriptService.findAllEnabledScript(); |
843 | + TransportApiResponseMsg.Builder responseBuilder = TransportApiResponseMsg.newBuilder(); | ||
844 | + if(null != scriptDTOS && !scriptDTOS.isEmpty()){ | ||
845 | + responseBuilder.addAllScriptResponseProto(scriptDTOS.stream().map(script->{ | ||
846 | + UUID uuid = UUID.fromString(script.getTenantId()); | ||
847 | + return TransportProtos.ScriptResponseProto.newBuilder().setTenantIdLSB(uuid.getLeastSignificantBits()) | ||
848 | + .setTenantIdMSB(uuid.getMostSignificantBits()) | ||
849 | + .setScriptId(script.getId()) | ||
850 | + .setScriptLanguage(script.getScriptLanguage().name()) | ||
851 | + .setScriptType(script.getScriptType()) | ||
852 | + .setContent(script.getScriptLanguage().equals(ScriptLanguage.TBEL)? | ||
853 | + script.getConvertTbel():script.getConvertJs()).build(); | ||
854 | + }).collect(Collectors.toList())).build(); | ||
855 | + } | ||
852 | return Futures.immediateFuture(responseBuilder.build()); | 856 | return Futures.immediateFuture(responseBuilder.build()); |
853 | } | 857 | } |
854 | 858 | ||
859 | + private ListenableFuture<TransportApiResponseMsg> handle(TransportProtos.DataCombinationMsg requestMsg){ | ||
860 | + try { | ||
861 | + List<DeviceProfile> profiles = deviceProfileService.findByDataCombinationIsTrue().get(); | ||
862 | + if(null != profiles && !profiles.isEmpty()){ | ||
863 | + Map<String, Object> cacheMap = new HashMap<>(); | ||
864 | + for (DeviceProfile deviceProfile : profiles) { | ||
865 | + cacheMap.put(deviceProfile.getTenantId() + "_" + | ||
866 | + deviceProfile.getId().toString(),deviceProfile.getProfileData().getTransportConfiguration()); | ||
867 | + } | ||
868 | + cacheUtils.put(FastIotConstants.CacheConfigKey.TCP_DATA_COMBINATION_KEY, FastIotConstants.OtherKey.DATA_COMBINATION_KEY,cacheMap); | ||
869 | + } | ||
870 | + }catch (Exception e){ | ||
871 | + log.error(ErrorMessage.CACHE_DATA_COMBINATION_FAILED.getMessage()); | ||
872 | + } | ||
873 | + TransportApiResponseMsg.Builder responseBuilder = TransportApiResponseMsg.newBuilder(); | ||
874 | + return Futures.immediateFuture(responseBuilder.build()); | ||
875 | + } | ||
876 | + | ||
855 | private ListenableFuture<TransportApiResponseMsg> handleGbt( | 877 | private ListenableFuture<TransportApiResponseMsg> handleGbt( |
856 | TransportProtos.Gbt28181RequestMsg requestMsg) { | 878 | TransportProtos.Gbt28181RequestMsg requestMsg) { |
857 | TransportProtos.Gbt28181ResponseMsg.Builder responseMsgBuilder = | 879 | TransportProtos.Gbt28181ResponseMsg.Builder responseMsgBuilder = |
@@ -1023,5 +1045,17 @@ public class DefaultTransportApiService implements TransportApiService { | @@ -1023,5 +1045,17 @@ public class DefaultTransportApiService implements TransportApiService { | ||
1023 | } | 1045 | } |
1024 | return null; | 1046 | return null; |
1025 | } | 1047 | } |
1026 | - | 1048 | + //thingskit |
1049 | + private ListenableFuture<TransportApiResponseMsg> handle(TransportProtos.UpScriptProto requestMsg){ | ||
1050 | + String upScriptId = requestMsg.getUpScriptId(); | ||
1051 | + TransportProtos.UpScriptResponseProto.Builder builder = TransportProtos.UpScriptResponseProto.newBuilder(); | ||
1052 | + if(StringUtils.isNotEmpty(upScriptId)){ | ||
1053 | + ScriptLanguage language = tkDeviceScriptService.findScriptLanguageById(upScriptId); | ||
1054 | + builder.setScriptLanguage(null != language ? language.name():null); | ||
1055 | + } | ||
1056 | + return Futures.immediateFuture( | ||
1057 | + TransportApiResponseMsg.newBuilder() | ||
1058 | + .setUpScriptResponseMsg(builder.build()) | ||
1059 | + .build()); | ||
1060 | + } | ||
1027 | } | 1061 | } |
@@ -21,6 +21,8 @@ import org.thingsboard.server.common.data.validation.NoXss; | @@ -21,6 +21,8 @@ import org.thingsboard.server.common.data.validation.NoXss; | ||
21 | import org.thingsboard.server.common.data.yunteng.enums.ProtocolAnalysisEnum; | 21 | import org.thingsboard.server.common.data.yunteng.enums.ProtocolAnalysisEnum; |
22 | import org.thingsboard.server.common.data.yunteng.enums.TcpAuthTypeEnum; | 22 | import org.thingsboard.server.common.data.yunteng.enums.TcpAuthTypeEnum; |
23 | 23 | ||
24 | +import java.io.Serializable; | ||
25 | + | ||
24 | @Data | 26 | @Data |
25 | public class TkTcpDeviceProfileTransportConfiguration implements DeviceProfileTransportConfiguration { | 27 | public class TkTcpDeviceProfileTransportConfiguration implements DeviceProfileTransportConfiguration { |
26 | /** | 28 | /** |
@@ -56,7 +58,8 @@ public class TkTcpDeviceProfileTransportConfiguration implements DeviceProfileTr | @@ -56,7 +58,8 @@ public class TkTcpDeviceProfileTransportConfiguration implements DeviceProfileTr | ||
56 | } | 58 | } |
57 | 59 | ||
58 | @Data | 60 | @Data |
59 | - public class DataCombinationAuth { | 61 | + public class DataCombinationAuth implements Serializable { |
62 | + | ||
60 | /** | 63 | /** |
61 | * 数据截取开始的下标 | 64 | * 数据截取开始的下标 |
62 | */ | 65 | */ |
@@ -17,22 +17,4 @@ public interface TkCommonService { | @@ -17,22 +17,4 @@ public interface TkCommonService { | ||
17 | * @return 返回字典Item表 | 17 | * @return 返回字典Item表 |
18 | */ | 18 | */ |
19 | SysDictItemDTO getDictValueByCodeAndText(String dictCode, String codeValue); | 19 | SysDictItemDTO getDictValueByCodeAndText(String dictCode, String codeValue); |
20 | - | ||
21 | - /** | ||
22 | - * 获取所有数据携带的产品即设备配置 | ||
23 | - * @return 产品列表 | ||
24 | - */ | ||
25 | - ListenableFuture<List<DeviceProfile>> findByDataCombinationIsTrue(); | ||
26 | - | ||
27 | - /** | ||
28 | - * 根据脚本ID查询脚本使用的语言 | ||
29 | - * @param scriptId 脚本ID | ||
30 | - * @return 脚本语言 | ||
31 | - */ | ||
32 | - ScriptLanguage getScriptLanguageById(String scriptId); | ||
33 | - | ||
34 | - /** | ||
35 | - * 启动所有的脚本 | ||
36 | - */ | ||
37 | - void evalAllEnabledScript(); | ||
38 | } | 20 | } |
@@ -133,6 +133,7 @@ public class LocalFileStorageService implements FileStorageService { | @@ -133,6 +133,7 @@ public class LocalFileStorageService implements FileStorageService { | ||
133 | 133 | ||
134 | @Override | 134 | @Override |
135 | public boolean deleteFile(String deleteFilePath) { | 135 | public boolean deleteFile(String deleteFilePath) { |
136 | + //TODO delete local file or delete datafile | ||
136 | return false; | 137 | return false; |
137 | } | 138 | } |
138 | 139 |
@@ -16,6 +16,7 @@ import org.springframework.util.StringUtils; | @@ -16,6 +16,7 @@ import org.springframework.util.StringUtils; | ||
16 | import org.springframework.web.context.request.RequestContextHolder; | 16 | import org.springframework.web.context.request.RequestContextHolder; |
17 | import org.springframework.web.context.request.ServletRequestAttributes; | 17 | import org.springframework.web.context.request.ServletRequestAttributes; |
18 | import org.springframework.web.multipart.MultipartFile; | 18 | import org.springframework.web.multipart.MultipartFile; |
19 | +import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | ||
19 | import org.thingsboard.server.common.data.yunteng.core.exception.FileStorageException; | 20 | import org.thingsboard.server.common.data.yunteng.core.exception.FileStorageException; |
20 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; | 21 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; |
21 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | 22 | import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; |
@@ -177,7 +178,13 @@ public class MinioFileStorageService implements FileStorageService { | @@ -177,7 +178,13 @@ public class MinioFileStorageService implements FileStorageService { | ||
177 | public boolean deleteFile(String deleteFilePath) { | 178 | public boolean deleteFile(String deleteFilePath) { |
178 | boolean result =false; | 179 | boolean result =false; |
179 | try{ | 180 | try{ |
180 | - minioClient.removeObject(RemoveObjectArgs.builder().bucket(fileStorageProperties.getBucketName()) | 181 | + String bucketName = fileStorageProperties.getBucketName(); |
182 | + int one = FastIotConstants.MagicNumber.ONE; | ||
183 | + String[] split = deleteFilePath.split(bucketName + "/"); | ||
184 | + if(split.length>one){ | ||
185 | + deleteFilePath = split[one]; | ||
186 | + } | ||
187 | + minioClient.removeObject(RemoveObjectArgs.builder().bucket(bucketName) | ||
181 | .object(deleteFilePath).build()); | 188 | .object(deleteFilePath).build()); |
182 | result = true; | 189 | result = true; |
183 | }catch (Exception e){ | 190 | }catch (Exception e){ |
@@ -16,7 +16,8 @@ public class TkDataViewContentInfoDTO { | @@ -16,7 +16,8 @@ public class TkDataViewContentInfoDTO { | ||
16 | private Integer state; | 16 | private Integer state; |
17 | @ApiModelProperty(value = "组织ID") | 17 | @ApiModelProperty(value = "组织ID") |
18 | private String organizationId; | 18 | private String organizationId; |
19 | - | 19 | + @ApiModelProperty(value = "缩略图") |
20 | + private String thumbnail; | ||
20 | @ApiModelProperty(value = "大屏内容",required = true) | 21 | @ApiModelProperty(value = "大屏内容",required = true) |
21 | private TkDataViewContentDTO dataViewContent; | 22 | private TkDataViewContentDTO dataViewContent; |
22 | } | 23 | } |
@@ -1278,6 +1278,8 @@ message TransportApiRequestMsg { | @@ -1278,6 +1278,8 @@ message TransportApiRequestMsg { | ||
1278 | Gbt28181RequestMsg gbt28181RequestMsg = 17; | 1278 | Gbt28181RequestMsg gbt28181RequestMsg = 17; |
1279 | Gbt28181MediaServerMsg gbt28181MediaServerMsg = 18; | 1279 | Gbt28181MediaServerMsg gbt28181MediaServerMsg = 18; |
1280 | ValidateTcpDeviceTokenRequestMsg validateTcpTokenRequestMsg = 19; | 1280 | ValidateTcpDeviceTokenRequestMsg validateTcpTokenRequestMsg = 19; |
1281 | + UpScriptProto upScriptRequestMsg = 20; | ||
1282 | + DataCombinationMsg dataCombinationRequest = 21; | ||
1281 | } | 1283 | } |
1282 | 1284 | ||
1283 | /* Response from ThingsBoard Core Service to Transport Service */ | 1285 | /* Response from ThingsBoard Core Service to Transport Service */ |
@@ -1294,9 +1296,10 @@ message TransportApiResponseMsg { | @@ -1294,9 +1296,10 @@ message TransportApiResponseMsg { | ||
1294 | GetDeviceCredentialsResponseMsg deviceCredentialsResponseMsg = 10; | 1296 | GetDeviceCredentialsResponseMsg deviceCredentialsResponseMsg = 10; |
1295 | repeated GetQueueRoutingInfoResponseMsg getQueueRoutingInfoResponseMsgs = 11; | 1297 | repeated GetQueueRoutingInfoResponseMsg getQueueRoutingInfoResponseMsgs = 11; |
1296 | //Thingskit function | 1298 | //Thingskit function |
1297 | - repeated ScriptProto scriptsResponseMsg = 12; | 1299 | + UpScriptResponseProto upScriptResponseMsg = 12; |
1298 | Gbt28181ResponseMsg gbt28181ResponseMsg = 13; | 1300 | Gbt28181ResponseMsg gbt28181ResponseMsg = 13; |
1299 | repeated Gbt28181MediaServerMsg gbt28181MediaServerMsg = 14; | 1301 | repeated Gbt28181MediaServerMsg gbt28181MediaServerMsg = 14; |
1302 | + repeated ScriptResponseProto scriptResponseProto = 15; | ||
1300 | } | 1303 | } |
1301 | 1304 | ||
1302 | /* Messages that are handled by ThingsBoard Core Service */ | 1305 | /* Messages that are handled by ThingsBoard Core Service */ |
@@ -1435,17 +1438,29 @@ message LifecycleEventProto { | @@ -1435,17 +1438,29 @@ message LifecycleEventProto { | ||
1435 | string error = 8; | 1438 | string error = 8; |
1436 | } | 1439 | } |
1437 | 1440 | ||
1438 | -//Thingskit function 请求:functionType、;响应:tenantId、projectId、scriptId、convertJs | 1441 | +//Thingskit function |
1442 | + | ||
1443 | +message DataCombinationMsg{ | ||
1444 | + | ||
1445 | +} | ||
1446 | + | ||
1439 | message ScriptProto{ | 1447 | message ScriptProto{ |
1448 | + | ||
1449 | +} | ||
1450 | +message ScriptResponseProto{ | ||
1440 | int64 tenantIdMSB = 1; | 1451 | int64 tenantIdMSB = 1; |
1441 | int64 tenantIdLSB = 2; | 1452 | int64 tenantIdLSB = 2; |
1442 | -// int64 projectIdMSB = 3; | ||
1443 | -// int64 projectIdLSB = 4; | ||
1444 | - int64 scriptIdMSB = 3; | ||
1445 | - int64 scriptIdLSB = 4; | ||
1446 | - string functionType = 5; | ||
1447 | - string convertJs = 6; | ||
1448 | - int32 status = 7; | 1453 | + string scriptId = 3; |
1454 | + string scriptLanguage = 4; | ||
1455 | + string scriptType = 5; | ||
1456 | + string content = 6; | ||
1457 | + | ||
1458 | +} | ||
1459 | +message UpScriptProto{ | ||
1460 | + string upScriptId = 1; | ||
1461 | +} | ||
1462 | +message UpScriptResponseProto{ | ||
1463 | + string scriptLanguage = 1; | ||
1449 | } | 1464 | } |
1450 | //thingskit function 设备上报的物模型事件 | 1465 | //thingskit function 设备上报的物模型事件 |
1451 | message PostEventMsg { | 1466 | message PostEventMsg { |
1 | /** | 1 | /** |
2 | * Copyright © 2016-2022 The Thingsboard Authors | 2 | * Copyright © 2016-2022 The Thingsboard Authors |
3 | * | 3 | * |
4 | - * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | - * you may not use this file except in compliance with the License. | ||
6 | - * You may obtain a copy of the License at | 4 | + * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file |
5 | + * except in compliance with the License. You may obtain a copy of the License at | ||
7 | * | 6 | * |
8 | - * http://www.apache.org/licenses/LICENSE-2.0 | 7 | + * <p>http://www.apache.org/licenses/LICENSE-2.0 |
9 | * | 8 | * |
10 | - * Unless required by applicable law or agreed to in writing, software | ||
11 | - * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | - * See the License for the specific language governing permissions and | 9 | + * <p>Unless required by applicable law or agreed to in writing, software distributed under the |
10 | + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
11 | + * express or implied. See the License for the specific language governing permissions and | ||
14 | * limitations under the License. | 12 | * limitations under the License. |
15 | */ | 13 | */ |
16 | package org.thingsboard.server.transport.tcp; | 14 | package org.thingsboard.server.transport.tcp; |
@@ -24,140 +22,185 @@ import org.springframework.beans.factory.annotation.Value; | @@ -24,140 +22,185 @@ import org.springframework.beans.factory.annotation.Value; | ||
24 | import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; | 22 | import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; |
25 | import org.springframework.boot.context.event.ApplicationReadyEvent; | 23 | import org.springframework.boot.context.event.ApplicationReadyEvent; |
26 | import org.springframework.context.event.EventListener; | 24 | import org.springframework.context.event.EventListener; |
27 | -import org.springframework.core.annotation.Order; | ||
28 | import org.springframework.stereotype.Component; | 25 | import org.springframework.stereotype.Component; |
29 | import org.thingsboard.common.util.ThingsBoardThreadFactory; | 26 | import org.thingsboard.common.util.ThingsBoardThreadFactory; |
27 | +import org.thingsboard.script.api.ScriptType; | ||
30 | import org.thingsboard.script.api.js.JsInvokeService; | 28 | import org.thingsboard.script.api.js.JsInvokeService; |
31 | import org.thingsboard.script.api.tbel.TbelInvokeService; | 29 | import org.thingsboard.script.api.tbel.TbelInvokeService; |
32 | -import org.thingsboard.server.common.data.DeviceProfile; | ||
33 | -import org.thingsboard.server.common.data.yunteng.common.TkCommonService; | 30 | +import org.thingsboard.server.common.data.id.TenantId; |
31 | +import org.thingsboard.server.common.data.script.ScriptLanguage; | ||
34 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | 32 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; |
35 | import org.thingsboard.server.common.data.yunteng.core.cache.CacheUtils; | 33 | import org.thingsboard.server.common.data.yunteng.core.cache.CacheUtils; |
36 | -import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | 34 | +import org.thingsboard.server.common.data.yunteng.dto.TkDeviceScriptDTO; |
35 | +import org.thingsboard.server.common.data.yunteng.enums.StatusEnum; | ||
37 | import org.thingsboard.server.common.transport.TransportContext; | 36 | import org.thingsboard.server.common.transport.TransportContext; |
37 | +import org.thingsboard.server.common.transport.yunteng.ScriptUpdatedEvent; | ||
38 | +import org.thingsboard.server.queue.util.AfterStartUp; | ||
38 | import org.thingsboard.server.transport.tcp.adaptors.JsonTcpAdaptor; | 39 | import org.thingsboard.server.transport.tcp.adaptors.JsonTcpAdaptor; |
39 | 40 | ||
40 | import javax.annotation.PostConstruct; | 41 | import javax.annotation.PostConstruct; |
41 | import java.net.InetSocketAddress; | 42 | import java.net.InetSocketAddress; |
42 | -import java.util.HashMap; | 43 | + |
44 | +import org.thingsboard.server.gen.transport.TransportProtos; | ||
45 | + | ||
43 | import java.util.List; | 46 | import java.util.List; |
44 | -import java.util.Map; | 47 | +import java.util.Objects; |
48 | +import java.util.UUID; | ||
49 | +import java.util.concurrent.ExecutionException; | ||
45 | import java.util.concurrent.Executors; | 50 | import java.util.concurrent.Executors; |
46 | import java.util.concurrent.ScheduledExecutorService; | 51 | import java.util.concurrent.ScheduledExecutorService; |
47 | import java.util.concurrent.TimeUnit; | 52 | import java.util.concurrent.TimeUnit; |
48 | import java.util.concurrent.atomic.AtomicInteger; | 53 | import java.util.concurrent.atomic.AtomicInteger; |
49 | 54 | ||
50 | -/** | ||
51 | - * Created by ashvayka on 04.10.18. | ||
52 | - */ | 55 | +/** Created by ashvayka on 04.10.18. */ |
53 | @Slf4j | 56 | @Slf4j |
54 | @Component | 57 | @Component |
55 | -@ConditionalOnExpression("'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.tcp.enabled}'=='true')") | 58 | +@ConditionalOnExpression( |
59 | + "'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.tcp.enabled}'=='true')") | ||
56 | public class TcpTransportContext extends TransportContext { | 60 | public class TcpTransportContext extends TransportContext { |
57 | 61 | ||
58 | - @Getter | ||
59 | - @Autowired(required = false) | ||
60 | - private TcpSslHandlerProvider sslHandlerProvider; | ||
61 | - | ||
62 | - /**注入多种数据协议处理器,例如:modbus等*/ | ||
63 | - @Getter | ||
64 | - @Autowired | ||
65 | - private JsonTcpAdaptor jsonTcpAdaptor; | ||
66 | - | ||
67 | - @Getter | ||
68 | - @Autowired | ||
69 | - private JsInvokeService jsEngine; | ||
70 | - | ||
71 | - @Getter | ||
72 | - @Autowired | ||
73 | - private TbelInvokeService tbelInvokeService; | ||
74 | - | ||
75 | - @Getter | ||
76 | - @Autowired | ||
77 | - private CacheUtils cacheUtils; | ||
78 | - | ||
79 | - @Getter | ||
80 | - @Autowired | ||
81 | - private TkCommonService tkCommonService; | ||
82 | - | ||
83 | - @Getter | ||
84 | - @Value("${transport.tcp.netty.max_payload_size}") | ||
85 | - private Integer maxPayloadSize; | ||
86 | - | ||
87 | - @Getter | ||
88 | - @Value("${transport.tcp.ssl.skip_validity_check_for_client_cert:false}") | ||
89 | - private boolean skipValidityCheckForClientCert; | ||
90 | - | ||
91 | - @Getter | ||
92 | - @Setter | ||
93 | - private SslHandler sslHandler; | ||
94 | - | ||
95 | - @Getter | ||
96 | - @Value("${transport.tcp.msg_queue_size_per_device_limit:100}") | ||
97 | - private int messageQueueSizePerDeviceLimit; | ||
98 | - | ||
99 | - @Getter | ||
100 | - @Value("${transport.tcp.timeout:10000}") | ||
101 | - private long timeout; | ||
102 | - | ||
103 | - @Getter | ||
104 | - @Value("${transport.tcp.proxy_enabled:false}") | ||
105 | - private boolean proxyEnabled; | ||
106 | - | ||
107 | - private final AtomicInteger connectionsCounter = new AtomicInteger(); | ||
108 | - protected ScheduledExecutorService schedulerExecutor; | ||
109 | - @Getter | ||
110 | - private boolean ready=false; | ||
111 | - @PostConstruct | ||
112 | - public void init() { | ||
113 | - super.init(); | ||
114 | - transportService.createGaugeStats("openConnections", connectionsCounter); | ||
115 | - schedulerExecutor = Executors.newSingleThreadScheduledExecutor(ThingsBoardThreadFactory.forName("tcp-init")); | 62 | + @Getter |
63 | + @Autowired(required = false) | ||
64 | + private TcpSslHandlerProvider sslHandlerProvider; | ||
65 | + | ||
66 | + /** 注入多种数据协议处理器,例如:modbus等 */ | ||
67 | + @Getter @Autowired private JsonTcpAdaptor jsonTcpAdaptor; | ||
68 | + | ||
69 | + @Getter @Autowired private JsInvokeService jsEngine; | ||
70 | + | ||
71 | + @Getter @Autowired private TbelInvokeService tbelInvokeService; | ||
72 | + | ||
73 | + @Getter @Autowired private CacheUtils cacheUtils; | ||
74 | + | ||
75 | + @Getter | ||
76 | + @Value("${transport.tcp.netty.max_payload_size}") | ||
77 | + private Integer maxPayloadSize; | ||
78 | + | ||
79 | + @Getter | ||
80 | + @Value("${transport.tcp.ssl.skip_validity_check_for_client_cert:false}") | ||
81 | + private boolean skipValidityCheckForClientCert; | ||
82 | + | ||
83 | + @Getter @Setter private SslHandler sslHandler; | ||
84 | + | ||
85 | + @Getter | ||
86 | + @Value("${transport.tcp.msg_queue_size_per_device_limit:100}") | ||
87 | + private int messageQueueSizePerDeviceLimit; | ||
88 | + | ||
89 | + @Getter | ||
90 | + @Value("${transport.tcp.timeout:10000}") | ||
91 | + private long timeout; | ||
92 | + | ||
93 | + @Getter | ||
94 | + @Value("${transport.tcp.proxy_enabled:false}") | ||
95 | + private boolean proxyEnabled; | ||
96 | + | ||
97 | + private final AtomicInteger connectionsCounter = new AtomicInteger(); | ||
98 | + protected ScheduledExecutorService schedulerExecutor; | ||
99 | + @Getter private boolean ready = false; | ||
100 | + | ||
101 | + @PostConstruct | ||
102 | + public void init() { | ||
103 | + super.init(); | ||
104 | + transportService.createGaugeStats("openConnections", connectionsCounter); | ||
105 | + schedulerExecutor = | ||
106 | + Executors.newSingleThreadScheduledExecutor(ThingsBoardThreadFactory.forName("tcp-init")); | ||
107 | + } | ||
108 | + | ||
109 | + public void channelRegistered() { | ||
110 | + connectionsCounter.incrementAndGet(); | ||
111 | + } | ||
112 | + | ||
113 | + public void channelUnregistered() { | ||
114 | + connectionsCounter.decrementAndGet(); | ||
115 | + } | ||
116 | + | ||
117 | + public boolean checkAddress(InetSocketAddress address) { | ||
118 | + return rateLimitService.checkAddress(address); | ||
119 | + } | ||
120 | + | ||
121 | + public void onAuthSuccess(InetSocketAddress address) { | ||
122 | + rateLimitService.onAuthSuccess(address); | ||
123 | + } | ||
124 | + | ||
125 | + public void onAuthFailure(InetSocketAddress address) { | ||
126 | + rateLimitService.onAuthFailure(address); | ||
127 | + } | ||
128 | + | ||
129 | + @EventListener(ApplicationReadyEvent.class) | ||
130 | + @AfterStartUp(order = AfterStartUp.AFTER_TRANSPORT_SERVICE) | ||
131 | + public void onApplicationEvent() { | ||
132 | + String cacheName = FastIotConstants.CacheConfigKey.TCP_DATA_COMBINATION_KEY; | ||
133 | + // 先清理掉数据携带的所有缓存 | ||
134 | + cacheUtils.invalidateCacheName(cacheName); | ||
135 | + transportService.process(TransportProtos.DataCombinationMsg.newBuilder().build()); | ||
136 | + List<TransportProtos.ScriptResponseProto> protoList = | ||
137 | + transportService.findAllEnabledScript(TransportProtos.ScriptProto.newBuilder().build()); | ||
138 | + | ||
139 | + if (null != protoList && !protoList.isEmpty()) { | ||
140 | + for (TransportProtos.ScriptResponseProto script : protoList) { | ||
141 | + TenantId tbTenantId = | ||
142 | + TenantId.fromUUID(new UUID(script.getTenantIdMSB(), script.getTenantIdLSB())); | ||
143 | + String scriptId = script.getScriptId(); | ||
144 | + ScriptType scriptType = ScriptType.valueOf(script.getScriptType()); | ||
145 | + String content = script.getContent(); | ||
146 | + evalScript( | ||
147 | + scriptId, | ||
148 | + scriptType, | ||
149 | + content, | ||
150 | + ScriptLanguage.valueOf(script.getScriptLanguage()), | ||
151 | + tbTenantId, | ||
152 | + StatusEnum.ENABLE.getIndex()); | ||
153 | + } | ||
116 | } | 154 | } |
117 | - | ||
118 | - public void channelRegistered() { | ||
119 | - connectionsCounter.incrementAndGet(); | ||
120 | - } | ||
121 | - | ||
122 | - public void channelUnregistered() { | ||
123 | - connectionsCounter.decrementAndGet(); | ||
124 | - } | ||
125 | - | ||
126 | - public boolean checkAddress(InetSocketAddress address) { | ||
127 | - return rateLimitService.checkAddress(address); | ||
128 | - } | ||
129 | - | ||
130 | - public void onAuthSuccess(InetSocketAddress address) { | ||
131 | - rateLimitService.onAuthSuccess(address); | ||
132 | - } | ||
133 | - | ||
134 | - public void onAuthFailure(InetSocketAddress address) { | ||
135 | - rateLimitService.onAuthFailure(address); | ||
136 | - } | ||
137 | - | ||
138 | - | ||
139 | - @EventListener(ApplicationReadyEvent.class) | ||
140 | - @Order(value = 2) | ||
141 | - public void onApplicationEvent() { | ||
142 | - String cacheName = FastIotConstants.CacheConfigKey.TCP_DATA_COMBINATION_KEY; | ||
143 | - //先清理掉数据携带的所有缓存 | ||
144 | - cacheUtils.invalidateCacheName(cacheName); | ||
145 | - try{ | ||
146 | - //检查是否有数据携带的产品,如果有则进行缓存 | ||
147 | - List<DeviceProfile> profiles = tkCommonService.findByDataCombinationIsTrue().get(); | ||
148 | - if(null != profiles && !profiles.isEmpty()){ | ||
149 | - Map<String, Object> cacheMap = new HashMap<>(); | ||
150 | - for (DeviceProfile deviceProfile : profiles) { | ||
151 | - cacheMap.put(deviceProfile.getTenantId() + "_" + | ||
152 | - deviceProfile.getId().toString(),deviceProfile.getProfileData().getTransportConfiguration()); | ||
153 | - } | ||
154 | - cacheUtils.put(cacheName, FastIotConstants.OtherKey.DATA_COMBINATION_KEY,cacheMap); | ||
155 | - } | ||
156 | - //获取所有启动的脚本,调用对应的脚本eval | ||
157 | - tkCommonService.evalAllEnabledScript(); | ||
158 | - }catch (Exception e){ | ||
159 | - log.error(ErrorMessage.CACHE_DATA_COMBINATION_FAILED.getMessage()); | 155 | + schedulerExecutor.schedule(() -> ready = true, timeout, TimeUnit.MILLISECONDS); |
156 | + } | ||
157 | + | ||
158 | + @EventListener(ScriptUpdatedEvent.class) | ||
159 | + public void onScriptUpdatedEvent(ScriptUpdatedEvent event) { | ||
160 | + TkDeviceScriptDTO script = event.getScript(); | ||
161 | + TenantId tenantId = TenantId.fromUUID(UUID.fromString(script.getTenantId())); | ||
162 | + String content = | ||
163 | + Objects.equals(script.getScriptLanguage(), ScriptLanguage.JS) | ||
164 | + ? script.getConvertJs() | ||
165 | + : script.getConvertTbel(); | ||
166 | + evalScript( | ||
167 | + script.getId(), | ||
168 | + ScriptType.valueOf(script.getScriptType()), | ||
169 | + content, | ||
170 | + script.getScriptLanguage(), | ||
171 | + tenantId, | ||
172 | + script.getStatus()); | ||
173 | + } | ||
174 | + | ||
175 | + private void evalScript( | ||
176 | + String scriptId, | ||
177 | + ScriptType scriptType, | ||
178 | + String content, | ||
179 | + ScriptLanguage scriptLanguage, | ||
180 | + TenantId tenantId, | ||
181 | + Integer status) { | ||
182 | + String[] argNames = new String[] {"msg", "metadata", "msgType"}; | ||
183 | + boolean enabled = status.equals(StatusEnum.ENABLE.getIndex()); | ||
184 | + String message = enabled ? "eval" : "release"; | ||
185 | + try { | ||
186 | + if (Objects.equals(scriptLanguage, ScriptLanguage.JS)) { | ||
187 | + if (enabled) { | ||
188 | + jsEngine.eval(tenantId, UUID.fromString(scriptId), scriptType, content, argNames).get(); | ||
189 | + } else { | ||
190 | + jsEngine.release(UUID.fromString(scriptId)); | ||
191 | + } | ||
192 | + } | ||
193 | + if (Objects.equals(scriptLanguage, ScriptLanguage.TBEL)) { | ||
194 | + if (enabled) { | ||
195 | + tbelInvokeService | ||
196 | + .eval(tenantId, UUID.fromString(scriptId), scriptType, content, argNames) | ||
197 | + .get(); | ||
198 | + } else { | ||
199 | + tbelInvokeService.release(UUID.fromString(scriptId)); | ||
160 | } | 200 | } |
161 | - schedulerExecutor.schedule(()->ready=true,timeout, TimeUnit.MILLISECONDS); | 201 | + } |
202 | + } catch (ExecutionException | InterruptedException e) { | ||
203 | + log.error("脚本{}{}失败", message, scriptId); | ||
162 | } | 204 | } |
205 | + } | ||
163 | } | 206 | } |
@@ -19,6 +19,7 @@ import org.thingsboard.server.common.data.id.TenantId; | @@ -19,6 +19,7 @@ import org.thingsboard.server.common.data.id.TenantId; | ||
19 | import org.thingsboard.server.common.data.script.ScriptLanguage; | 19 | import org.thingsboard.server.common.data.script.ScriptLanguage; |
20 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; | 20 | import org.thingsboard.server.common.data.yunteng.constant.FastIotConstants; |
21 | import org.thingsboard.server.common.data.yunteng.enums.ProtocolAnalysisEnum; | 21 | import org.thingsboard.server.common.data.yunteng.enums.ProtocolAnalysisEnum; |
22 | +import org.thingsboard.server.common.transport.TransportServiceCallback; | ||
22 | import org.thingsboard.server.common.transport.auth.TransportDeviceInfo; | 23 | import org.thingsboard.server.common.transport.auth.TransportDeviceInfo; |
23 | import org.thingsboard.server.common.transport.session.DeviceAwareSessionContext; | 24 | import org.thingsboard.server.common.transport.session.DeviceAwareSessionContext; |
24 | import org.thingsboard.server.gen.transport.TransportProtos; | 25 | import org.thingsboard.server.gen.transport.TransportProtos; |
@@ -99,7 +100,18 @@ public abstract class TcpDeviceWareSessionContext extends DeviceAwareSessionCont | @@ -99,7 +100,18 @@ public abstract class TcpDeviceWareSessionContext extends DeviceAwareSessionCont | ||
99 | TkTcpDeviceProfileTransportConfiguration tcpConfiguration = (TkTcpDeviceProfileTransportConfiguration) transportConfiguration; | 100 | TkTcpDeviceProfileTransportConfiguration tcpConfiguration = (TkTcpDeviceProfileTransportConfiguration) transportConfiguration; |
100 | if( tcpConfiguration.getProtocol().equals(ProtocolAnalysisEnum.CUSTOM)){ | 101 | if( tcpConfiguration.getProtocol().equals(ProtocolAnalysisEnum.CUSTOM)){ |
101 | this.telemetryScriptId = UUID.fromString(tcpConfiguration.getUpScriptId()); | 102 | this.telemetryScriptId = UUID.fromString(tcpConfiguration.getUpScriptId()); |
102 | - this.scriptLanguage = context.getTkCommonService().getScriptLanguageById(tcpConfiguration.getUpScriptId()); | 103 | + getContext().getTransportService().process(sessionInfo, TransportProtos.UpScriptProto.newBuilder() |
104 | + .setUpScriptId(tcpConfiguration.getUpScriptId()).build(), new TransportServiceCallback<TransportProtos.UpScriptResponseProto>() { | ||
105 | + @Override | ||
106 | + public void onSuccess(TransportProtos.UpScriptResponseProto msg) { | ||
107 | + scriptLanguage = ScriptLanguage.valueOf(msg.getScriptLanguage()); | ||
108 | + } | ||
109 | + | ||
110 | + @Override | ||
111 | + public void onError(Throwable e) { | ||
112 | + log.error("通过上行脚本id获取脚本语言失败"); | ||
113 | + } | ||
114 | + }); | ||
103 | } | 115 | } |
104 | 116 | ||
105 | } | 117 | } |
@@ -164,7 +164,7 @@ public interface TransportService { | @@ -164,7 +164,7 @@ public interface TransportService { | ||
164 | void createGaugeStats(String openConnections, AtomicInteger connectionsCounter); | 164 | void createGaugeStats(String openConnections, AtomicInteger connectionsCounter); |
165 | 165 | ||
166 | // Thingskit function:begin | 166 | // Thingskit function:begin |
167 | - List<TransportProtos.ScriptProto> getScripts(TransportProtos.ScriptProto msg); | 167 | + List<TransportProtos.ScriptResponseProto> findAllEnabledScript(TransportProtos.ScriptProto msg); |
168 | 168 | ||
169 | void process(SessionInfoProto sessionInfo, TransportProtos.PostEventMsg msg, TransportServiceCallback<Void> callback, | 169 | void process(SessionInfoProto sessionInfo, TransportProtos.PostEventMsg msg, TransportServiceCallback<Void> callback, |
170 | String topicName); | 170 | String topicName); |
@@ -178,5 +178,10 @@ public interface TransportService { | @@ -178,5 +178,10 @@ public interface TransportService { | ||
178 | 178 | ||
179 | void process(DeviceTransportType transportType, TransportProtos.ValidateTcpDeviceTokenRequestMsg msg, | 179 | void process(DeviceTransportType transportType, TransportProtos.ValidateTcpDeviceTokenRequestMsg msg, |
180 | TransportServiceCallback<ValidateDeviceCredentialsResponse> callback); | 180 | TransportServiceCallback<ValidateDeviceCredentialsResponse> callback); |
181 | + | ||
182 | + void process(SessionInfoProto sessionInfoProto,TransportProtos.UpScriptProto msg,TransportServiceCallback< | ||
183 | + TransportProtos.UpScriptResponseProto> callback); | ||
184 | + | ||
185 | + void process(TransportProtos.DataCombinationMsg msg); | ||
181 | // Thingskit function:end | 186 | // Thingskit function:end |
182 | } | 187 | } |
@@ -1329,22 +1329,20 @@ public class DefaultTransportService extends TransportActivityManager implements | @@ -1329,22 +1329,20 @@ public class DefaultTransportService extends TransportActivityManager implements | ||
1329 | } | 1329 | } |
1330 | 1330 | ||
1331 | // Thingskit function | 1331 | // Thingskit function |
1332 | - @Override | ||
1333 | - public List<TransportProtos.ScriptProto> getScripts(TransportProtos.ScriptProto msg) { | ||
1334 | - TbProtoQueueMsg<TransportProtos.TransportApiRequestMsg> protoMsg = | ||
1335 | - new TbProtoQueueMsg<>( | ||
1336 | - UUID.randomUUID(), | ||
1337 | - TransportProtos.TransportApiRequestMsg.newBuilder().setScript(msg).build()); | ||
1338 | - try { | ||
1339 | - TbProtoQueueMsg<TransportApiResponseMsg> response = | ||
1340 | - transportApiRequestTemplate.send(protoMsg).get(); | ||
1341 | - return response.getValue().getScriptsResponseMsgList(); | ||
1342 | - } catch (InterruptedException | ExecutionException e) { | ||
1343 | - throw new RuntimeException(e); | ||
1344 | - } | ||
1345 | - } | ||
1346 | - | ||
1347 | - // thingskit start | 1332 | + @Override |
1333 | + public List<TransportProtos.ScriptResponseProto> findAllEnabledScript(TransportProtos.ScriptProto msg){ | ||
1334 | + TbProtoQueueMsg<TransportProtos.TransportApiRequestMsg> protoMsg = | ||
1335 | + new TbProtoQueueMsg<>( | ||
1336 | + UUID.randomUUID(), | ||
1337 | + TransportProtos.TransportApiRequestMsg.newBuilder().setScript(msg).build()); | ||
1338 | + try { | ||
1339 | + TbProtoQueueMsg<TransportApiResponseMsg> response = transportApiRequestTemplate.send(protoMsg).get(); | ||
1340 | + return response.getValue().getScriptResponseProtoList(); | ||
1341 | + } catch (InterruptedException | ExecutionException e) { | ||
1342 | + throw new RuntimeException(e); | ||
1343 | + } | ||
1344 | + } | ||
1345 | + // thingskit start | ||
1348 | @Override | 1346 | @Override |
1349 | public void process( | 1347 | public void process( |
1350 | TransportProtos.SessionInfoProto sessionInfo, | 1348 | TransportProtos.SessionInfoProto sessionInfo, |
@@ -1390,5 +1388,23 @@ public class DefaultTransportService extends TransportActivityManager implements | @@ -1390,5 +1388,23 @@ public class DefaultTransportService extends TransportActivityManager implements | ||
1390 | TransportApiRequestMsg.newBuilder().setValidateTcpTokenRequestMsg(msg).build()); | 1388 | TransportApiRequestMsg.newBuilder().setValidateTcpTokenRequestMsg(msg).build()); |
1391 | doProcess(transportType, protoMsg, callback); | 1389 | doProcess(transportType, protoMsg, callback); |
1392 | } | 1390 | } |
1391 | + @Override | ||
1392 | + public void process(TransportProtos.SessionInfoProto sessionInfo,TransportProtos.UpScriptProto msg,TransportServiceCallback< | ||
1393 | + TransportProtos.UpScriptResponseProto> callback){ | ||
1394 | + TbProtoQueueMsg<TransportApiRequestMsg> protoMsg = new TbProtoQueueMsg<>(UUID.randomUUID(), | ||
1395 | + TransportApiRequestMsg.newBuilder().setUpScriptRequestMsg(msg).build()); | ||
1396 | + | ||
1397 | + AsyncCallbackTemplate.withCallback(transportApiRequestTemplate.send(protoMsg), response -> { | ||
1398 | + callback.onSuccess(response.getValue().getUpScriptResponseMsg()); | ||
1399 | + }, callback::onError, transportCallbackExecutor); | ||
1400 | + } | ||
1401 | + | ||
1402 | + @Override | ||
1403 | + public void process(TransportProtos.DataCombinationMsg msg) { | ||
1404 | + TbProtoQueueMsg<TransportProtos.TransportApiRequestMsg> protoMsg = | ||
1405 | + new TbProtoQueueMsg<>( | ||
1406 | + UUID.randomUUID(),TransportApiRequestMsg.newBuilder().setDataCombinationRequest(msg).build()); | ||
1407 | + transportApiRequestTemplate.send(protoMsg); | ||
1408 | + } | ||
1393 | // thingskit end | 1409 | // thingskit end |
1394 | } | 1410 | } |
1 | package org.thingsboard.server.dao.yunteng.impl; | 1 | package org.thingsboard.server.dao.yunteng.impl; |
2 | 2 | ||
3 | -import com.google.common.util.concurrent.ListenableFuture; | ||
4 | import lombok.RequiredArgsConstructor; | 3 | import lombok.RequiredArgsConstructor; |
5 | import lombok.extern.slf4j.Slf4j; | 4 | import lombok.extern.slf4j.Slf4j; |
6 | import org.springframework.stereotype.Service; | 5 | import org.springframework.stereotype.Service; |
7 | -import org.thingsboard.server.common.data.DeviceProfile; | ||
8 | -import org.thingsboard.server.common.data.StringUtils; | ||
9 | -import org.thingsboard.server.common.data.script.ScriptLanguage; | ||
10 | import org.thingsboard.server.common.data.yunteng.common.TkCommonService; | 6 | import org.thingsboard.server.common.data.yunteng.common.TkCommonService; |
11 | -import org.thingsboard.server.common.data.yunteng.core.message.ErrorMessage; | ||
12 | import org.thingsboard.server.common.data.yunteng.dto.SysDictItemDTO; | 7 | import org.thingsboard.server.common.data.yunteng.dto.SysDictItemDTO; |
13 | -import org.thingsboard.server.common.data.yunteng.dto.TkDeviceScriptDTO; | ||
14 | -import org.thingsboard.server.dao.device.DeviceProfileService; | ||
15 | import org.thingsboard.server.dao.yunteng.mapper.SysDictItemMapper; | 8 | import org.thingsboard.server.dao.yunteng.mapper.SysDictItemMapper; |
16 | -import org.thingsboard.server.dao.yunteng.service.TkDeviceScriptService; | ||
17 | - | ||
18 | -import java.util.List; | ||
19 | -import java.util.Optional; | ||
20 | -import java.util.concurrent.CompletableFuture; | ||
21 | 9 | ||
22 | @Slf4j | 10 | @Slf4j |
23 | @Service | 11 | @Service |
24 | @RequiredArgsConstructor | 12 | @RequiredArgsConstructor |
25 | public class TkCommonServiceImpl implements TkCommonService { | 13 | public class TkCommonServiceImpl implements TkCommonService { |
26 | 14 | ||
27 | - private final SysDictItemMapper sysDictItemMapper; | ||
28 | - private final DeviceProfileService deviceProfileService; | ||
29 | - private final TkDeviceScriptService tkDeviceScriptService; | ||
30 | - @Override | ||
31 | - public SysDictItemDTO getDictValueByCodeAndText(String dictCode, String codeValue) { | ||
32 | - return sysDictItemMapper.getDictValueByCodeAndText(dictCode, codeValue); | ||
33 | - } | ||
34 | - | ||
35 | - public ListenableFuture<List<DeviceProfile>> findByDataCombinationIsTrue(){ | ||
36 | - return deviceProfileService.findByDataCombinationIsTrue(); | ||
37 | - } | ||
38 | - | ||
39 | - @Override | ||
40 | - public ScriptLanguage getScriptLanguageById(String scriptId) { | ||
41 | - return tkDeviceScriptService.findScriptLanguageById(scriptId); | ||
42 | - } | 15 | + private final SysDictItemMapper sysDictItemMapper; |
43 | 16 | ||
44 | - @Override | ||
45 | - public void evalAllEnabledScript() { | ||
46 | - List<TkDeviceScriptDTO> scriptDTOS = tkDeviceScriptService.findAllEnabledScript(); | ||
47 | - if(null != scriptDTOS && !scriptDTOS.isEmpty()){ | ||
48 | - for (TkDeviceScriptDTO scriptDTO : scriptDTOS){ | ||
49 | - try { | ||
50 | - tkDeviceScriptService.eval(scriptDTO.getTenantId(),scriptDTO.getId()); | ||
51 | - }catch (Exception e){ | ||
52 | - log.error(String.format(ErrorMessage.SCRIPT_EVAL_FAILED.getMessage(),scriptDTO.getTenantId(),scriptDTO.getId(),e.getMessage())); | ||
53 | - } | ||
54 | - } | 17 | + @Override |
18 | + public SysDictItemDTO getDictValueByCodeAndText(String dictCode, String codeValue) { | ||
19 | + return sysDictItemMapper.getDictValueByCodeAndText(dictCode, codeValue); | ||
55 | } | 20 | } |
56 | - } | ||
57 | } | 21 | } |
1 | package org.thingsboard.server.dao.yunteng.impl; | 1 | package org.thingsboard.server.dao.yunteng.impl; |
2 | 2 | ||
3 | - | ||
4 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 4 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
6 | import com.baomidou.mybatisplus.core.metadata.IPage; | 5 | import com.baomidou.mybatisplus.core.metadata.IPage; |
@@ -12,7 +11,10 @@ import org.springframework.transaction.annotation.Transactional; | @@ -12,7 +11,10 @@ import org.springframework.transaction.annotation.Transactional; | ||
12 | import org.thingsboard.script.api.ScriptType; | 11 | import org.thingsboard.script.api.ScriptType; |
13 | import org.thingsboard.script.api.js.JsInvokeService; | 12 | import org.thingsboard.script.api.js.JsInvokeService; |
14 | import org.thingsboard.script.api.tbel.TbelInvokeService; | 13 | import org.thingsboard.script.api.tbel.TbelInvokeService; |
14 | +import org.thingsboard.server.cluster.TbClusterService; | ||
15 | +import org.thingsboard.server.common.data.DeviceProfile; | ||
15 | import org.thingsboard.server.common.data.device.profile.TkTcpDeviceProfileTransportConfiguration; | 16 | import org.thingsboard.server.common.data.device.profile.TkTcpDeviceProfileTransportConfiguration; |
17 | +import org.thingsboard.server.common.data.id.DeviceProfileId; | ||
16 | import org.thingsboard.server.common.data.id.EntityId; | 18 | import org.thingsboard.server.common.data.id.EntityId; |
17 | import org.thingsboard.server.common.data.id.TenantId; | 19 | import org.thingsboard.server.common.data.id.TenantId; |
18 | import org.thingsboard.server.common.data.script.ScriptLanguage; | 20 | import org.thingsboard.server.common.data.script.ScriptLanguage; |
@@ -26,6 +28,7 @@ import org.thingsboard.server.common.data.yunteng.enums.*; | @@ -26,6 +28,7 @@ import org.thingsboard.server.common.data.yunteng.enums.*; | ||
26 | import org.thingsboard.server.common.data.yunteng.utils.ByteUtils; | 28 | import org.thingsboard.server.common.data.yunteng.utils.ByteUtils; |
27 | import org.thingsboard.server.common.data.yunteng.utils.CrcUtils; | 29 | import org.thingsboard.server.common.data.yunteng.utils.CrcUtils; |
28 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 30 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
31 | +import org.thingsboard.server.dao.device.DeviceProfileService; | ||
29 | import org.thingsboard.server.dao.exception.DataValidationException; | 32 | import org.thingsboard.server.dao.exception.DataValidationException; |
30 | import org.thingsboard.server.dao.yunteng.entities.TkDeviceScriptEntity; | 33 | import org.thingsboard.server.dao.yunteng.entities.TkDeviceScriptEntity; |
31 | import org.thingsboard.server.dao.yunteng.mapper.TkDeviceScriptMapper; | 34 | import org.thingsboard.server.dao.yunteng.mapper.TkDeviceScriptMapper; |
@@ -48,6 +51,9 @@ public class TkDeviceScriptServiceImpl | @@ -48,6 +51,9 @@ public class TkDeviceScriptServiceImpl | ||
48 | private final TkDeviceService tkDeviceService; | 51 | private final TkDeviceService tkDeviceService; |
49 | private final JsInvokeService jsInvokeService; | 52 | private final JsInvokeService jsInvokeService; |
50 | private final TbelInvokeService tbelInvokeService; | 53 | private final TbelInvokeService tbelInvokeService; |
54 | + private final TbClusterService tbClusterService; | ||
55 | + private final DeviceProfileService deviceProfileService; | ||
56 | + private final TkTenantService tenantService; | ||
51 | 57 | ||
52 | @Override | 58 | @Override |
53 | public boolean validateFormdata(TkDeviceScriptDTO scriptDTO, boolean created) { | 59 | public boolean validateFormdata(TkDeviceScriptDTO scriptDTO, boolean created) { |
@@ -107,27 +113,31 @@ public class TkDeviceScriptServiceImpl | @@ -107,27 +113,31 @@ public class TkDeviceScriptServiceImpl | ||
107 | } | 113 | } |
108 | 114 | ||
109 | @Override | 115 | @Override |
110 | - public List<TkDeviceScriptDTO> getScriptes(){ | 116 | + public List<TkDeviceScriptDTO> getScriptes() { |
111 | LambdaQueryWrapper<TkDeviceScriptEntity> queryWrapper = | 117 | LambdaQueryWrapper<TkDeviceScriptEntity> queryWrapper = |
112 | new QueryWrapper<TkDeviceScriptEntity>().lambda(); | 118 | new QueryWrapper<TkDeviceScriptEntity>().lambda(); |
113 | queryWrapper.eq(TkDeviceScriptEntity::getStatus, StatusEnum.ENABLE.getIndex()); | 119 | queryWrapper.eq(TkDeviceScriptEntity::getStatus, StatusEnum.ENABLE.getIndex()); |
114 | List<TkDeviceScriptEntity> result = baseMapper.selectList(queryWrapper); | 120 | List<TkDeviceScriptEntity> result = baseMapper.selectList(queryWrapper); |
115 | return result.stream() | 121 | return result.stream() |
116 | - .map(item -> item.getDTO(TkDeviceScriptDTO.class)) | ||
117 | - .collect(Collectors.toList()); | 122 | + .map(item -> item.getDTO(TkDeviceScriptDTO.class)) |
123 | + .collect(Collectors.toList()); | ||
118 | } | 124 | } |
119 | 125 | ||
120 | @Override | 126 | @Override |
121 | public TkDeviceScriptDTO insertOrUpdate(TkDeviceScriptDTO deviceDTO) { | 127 | public TkDeviceScriptDTO insertOrUpdate(TkDeviceScriptDTO deviceDTO) { |
122 | - //判断脚本的内容 | ||
123 | - if(null == deviceDTO.getScriptLanguage()){ | 128 | + // 判断脚本的内容 |
129 | + if (null == deviceDTO.getScriptLanguage()) { | ||
124 | deviceDTO.setScriptLanguage(ScriptLanguage.JS); | 130 | deviceDTO.setScriptLanguage(ScriptLanguage.JS); |
125 | } | 131 | } |
126 | - if(Objects.equals(ScriptLanguage.JS,deviceDTO.getScriptLanguage()) && StringUtils.isEmpty(deviceDTO.getConvertJs())){ | ||
127 | - throw new DataValidationException(String.format(ErrorMessage.SCRIPT_CONTENT_IS_EMPTY.getMessage(),ScriptLanguage.JS)); | 132 | + if (Objects.equals(ScriptLanguage.JS, deviceDTO.getScriptLanguage()) |
133 | + && StringUtils.isEmpty(deviceDTO.getConvertJs())) { | ||
134 | + throw new DataValidationException( | ||
135 | + String.format(ErrorMessage.SCRIPT_CONTENT_IS_EMPTY.getMessage(), ScriptLanguage.JS)); | ||
128 | } | 136 | } |
129 | - if(Objects.equals(ScriptLanguage.TBEL,deviceDTO.getScriptLanguage())&& StringUtils.isEmpty(deviceDTO.getConvertTbel())){ | ||
130 | - throw new DataValidationException(String.format(ErrorMessage.SCRIPT_CONTENT_IS_EMPTY.getMessage(),ScriptLanguage.TBEL)); | 137 | + if (Objects.equals(ScriptLanguage.TBEL, deviceDTO.getScriptLanguage()) |
138 | + && StringUtils.isEmpty(deviceDTO.getConvertTbel())) { | ||
139 | + throw new DataValidationException( | ||
140 | + String.format(ErrorMessage.SCRIPT_CONTENT_IS_EMPTY.getMessage(), ScriptLanguage.TBEL)); | ||
131 | } | 141 | } |
132 | if (StringUtils.isBlank(deviceDTO.getId())) { | 142 | if (StringUtils.isBlank(deviceDTO.getId())) { |
133 | return insert(deviceDTO); | 143 | return insert(deviceDTO); |
@@ -139,15 +149,17 @@ public class TkDeviceScriptServiceImpl | @@ -139,15 +149,17 @@ public class TkDeviceScriptServiceImpl | ||
139 | @Override | 149 | @Override |
140 | public void checkDeviceScriptes(String tenantId, Set<String> ids) { | 150 | public void checkDeviceScriptes(String tenantId, Set<String> ids) { |
141 | // check if ids bind to device | 151 | // check if ids bind to device |
142 | - if(ids == null || ids.isEmpty()){ | 152 | + if (ids == null || ids.isEmpty()) { |
143 | throw new TkDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); | 153 | throw new TkDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); |
144 | } | 154 | } |
145 | - for(String id : ids){ | ||
146 | - List<DeviceProfileDTO> profileList = tkDeviceProfileService.findDeviceProfileByScriptId(tenantId,id); | ||
147 | - if(null != profileList && !profileList.isEmpty()){ | ||
148 | - | ||
149 | - throw new TkDataValidationException(String.format(ErrorMessage.PROJECT_USED_SCRIPT.getMessage(), | ||
150 | - profileList.get(0).getName())); | 155 | + for (String id : ids) { |
156 | + List<DeviceProfileDTO> profileList = | ||
157 | + tkDeviceProfileService.findDeviceProfileByScriptId(tenantId, id); | ||
158 | + if (null != profileList && !profileList.isEmpty()) { | ||
159 | + | ||
160 | + throw new TkDataValidationException( | ||
161 | + String.format( | ||
162 | + ErrorMessage.PROJECT_USED_SCRIPT.getMessage(), profileList.get(0).getName())); | ||
151 | } | 163 | } |
152 | } | 164 | } |
153 | } | 165 | } |
@@ -174,9 +186,13 @@ public class TkDeviceScriptServiceImpl | @@ -174,9 +186,13 @@ public class TkDeviceScriptServiceImpl | ||
174 | ModelConstants.TablePropertyMapping.UPDATER, | 186 | ModelConstants.TablePropertyMapping.UPDATER, |
175 | ModelConstants.TablePropertyMapping.CREATE_TIME, | 187 | ModelConstants.TablePropertyMapping.CREATE_TIME, |
176 | ModelConstants.TablePropertyMapping.UPDATE_TIME); | 188 | ModelConstants.TablePropertyMapping.UPDATE_TIME); |
177 | - profile.setScriptType(null == deviceDTO.getScriptType() ?ScriptType.TRANSPORT_TCP_UP:ScriptType.valueOf(deviceDTO.getScriptType())); | 189 | + profile.setScriptType( |
190 | + null == deviceDTO.getScriptType() | ||
191 | + ? ScriptType.TRANSPORT_TCP_UP | ||
192 | + : ScriptType.valueOf(deviceDTO.getScriptType())); | ||
178 | baseMapper.insert(profile); | 193 | baseMapper.insert(profile); |
179 | - return profile.getDTO(TkDeviceScriptDTO.class); | 194 | + deviceDTO.setId(profile.getId()); |
195 | + return deviceDTO; | ||
180 | } | 196 | } |
181 | 197 | ||
182 | private TkDeviceScriptDTO update(TkDeviceScriptDTO deviceDTO) { | 198 | private TkDeviceScriptDTO update(TkDeviceScriptDTO deviceDTO) { |
@@ -192,9 +208,35 @@ public class TkDeviceScriptServiceImpl | @@ -192,9 +208,35 @@ public class TkDeviceScriptServiceImpl | ||
192 | ModelConstants.TablePropertyMapping.CREATE_TIME, | 208 | ModelConstants.TablePropertyMapping.CREATE_TIME, |
193 | ModelConstants.TablePropertyMapping.UPDATE, | 209 | ModelConstants.TablePropertyMapping.UPDATE, |
194 | ModelConstants.TablePropertyMapping.UPDATE_TIME); | 210 | ModelConstants.TablePropertyMapping.UPDATE_TIME); |
211 | + String tenantId = deviceDTO.getTenantId(); | ||
212 | + String scriptId = deviceDTO.getId(); | ||
213 | + Optional<TkDeviceScriptDTO> optional = getDeviceScript(tenantId, scriptId); | ||
214 | + if (optional.isPresent()) { | ||
215 | + TkDeviceScriptDTO deviceScriptDTO = optional.get(); | ||
216 | + // 如果脚本语言有更新,且有正在使用的产品,则需通知产品进行变更(脚本语言进行变更) | ||
217 | + if (!Objects.equals(deviceScriptDTO.getScriptLanguage(), deviceDTO.getScriptLanguage())) { | ||
218 | + // 查找正在使用的产品 | ||
219 | + List<DeviceProfileDTO> profiles = | ||
220 | + tkDeviceProfileService.findDeviceProfileByScriptId(tenantId, scriptId); | ||
221 | + if (null != profiles && !profiles.isEmpty()) { | ||
222 | + for (DeviceProfileDTO dto : profiles) { | ||
223 | + DeviceProfileId deviceProfileId = | ||
224 | + new DeviceProfileId(UUID.fromString(dto.getTbProfileId())); | ||
225 | + DeviceProfile deviceProfile = | ||
226 | + deviceProfileService.findDeviceProfileById( | ||
227 | + TenantId.fromUUID(UUID.fromString(tenantId)), deviceProfileId); | ||
228 | + if (null != deviceProfile) { | ||
229 | + tbClusterService.onDeviceProfileChange(deviceProfile, null); | ||
230 | + } | ||
231 | + } | ||
232 | + } | ||
233 | + } | ||
234 | + } | ||
195 | baseMapper.updateById(device); | 235 | baseMapper.updateById(device); |
196 | device.setTenantId(deviceDTO.getTenantId()); | 236 | device.setTenantId(deviceDTO.getTenantId()); |
197 | - return device.getDTO(TkDeviceScriptDTO.class); | 237 | + TkDeviceScriptDTO updateScriptDTO = device.getDTO(TkDeviceScriptDTO.class); |
238 | + updateScriptDTO.setScriptType(deviceDTO.getScriptType()); | ||
239 | + return updateScriptDTO; | ||
198 | } | 240 | } |
199 | 241 | ||
200 | @Override | 242 | @Override |
@@ -202,12 +244,23 @@ public class TkDeviceScriptServiceImpl | @@ -202,12 +244,23 @@ public class TkDeviceScriptServiceImpl | ||
202 | LambdaQueryWrapper<TkDeviceScriptEntity> queryWrapper = | 244 | LambdaQueryWrapper<TkDeviceScriptEntity> queryWrapper = |
203 | new QueryWrapper<TkDeviceScriptEntity>() | 245 | new QueryWrapper<TkDeviceScriptEntity>() |
204 | .lambda() | 246 | .lambda() |
205 | - .eq(TkDeviceScriptEntity::getId, id).and(a -> a | ||
206 | - .eq(TkDeviceScriptEntity::getTenantId, tenantId).or(b->b.eq(TkDeviceScriptEntity::getTenantId,EntityId.NULL_UUID.toString()))); | 247 | + .eq(TkDeviceScriptEntity::getId, id) |
248 | + .and( | ||
249 | + a -> | ||
250 | + a.eq(TkDeviceScriptEntity::getTenantId, tenantId) | ||
251 | + .or( | ||
252 | + b -> | ||
253 | + b.eq( | ||
254 | + TkDeviceScriptEntity::getTenantId, | ||
255 | + EntityId.NULL_UUID.toString()))); | ||
207 | TkDeviceScriptEntity profile = baseMapper.selectOne(queryWrapper); | 256 | TkDeviceScriptEntity profile = baseMapper.selectOne(queryWrapper); |
208 | return Optional.ofNullable(profile) | 257 | return Optional.ofNullable(profile) |
209 | .map( | 258 | .map( |
210 | - entity -> entity.getDTO(TkDeviceScriptDTO.class)); | 259 | + entity -> { |
260 | + TkDeviceScriptDTO dto = entity.getDTO(TkDeviceScriptDTO.class); | ||
261 | + dto.setScriptType(entity.getScriptType().name()); | ||
262 | + return dto; | ||
263 | + }); | ||
211 | } | 264 | } |
212 | 265 | ||
213 | @Override | 266 | @Override |
@@ -224,11 +277,9 @@ public class TkDeviceScriptServiceImpl | @@ -224,11 +277,9 @@ public class TkDeviceScriptServiceImpl | ||
224 | .map(Object::toString) | 277 | .map(Object::toString) |
225 | .orElse(null); | 278 | .orElse(null); |
226 | String name = Optional.ofNullable(queryMap.get("name")).map(Object::toString).orElse(null); | 279 | String name = Optional.ofNullable(queryMap.get("name")).map(Object::toString).orElse(null); |
227 | - LocalDateTime startTime = | ||
228 | - (LocalDateTime) queryMap.get("startTime"); | ||
229 | - LocalDateTime endTime = | ||
230 | - (LocalDateTime) queryMap.get("endTime"); | ||
231 | - Integer status = null != queryMap.get("status") ? (Integer)queryMap.get("status") : null; | 280 | + LocalDateTime startTime = (LocalDateTime) queryMap.get("startTime"); |
281 | + LocalDateTime endTime = (LocalDateTime) queryMap.get("endTime"); | ||
282 | + Integer status = null != queryMap.get("status") ? (Integer) queryMap.get("status") : null; | ||
232 | Set<String> scriptIds = null; | 283 | Set<String> scriptIds = null; |
233 | if (!isTenantAdmin && StringUtils.isNotEmpty(customerId)) { | 284 | if (!isTenantAdmin && StringUtils.isNotEmpty(customerId)) { |
234 | scriptIds = getCustomerScripts(customerId, tenantId); | 285 | scriptIds = getCustomerScripts(customerId, tenantId); |
@@ -240,7 +291,7 @@ public class TkDeviceScriptServiceImpl | @@ -240,7 +291,7 @@ public class TkDeviceScriptServiceImpl | ||
240 | new QueryWrapper<TkDeviceScriptEntity>() | 291 | new QueryWrapper<TkDeviceScriptEntity>() |
241 | .lambda() | 292 | .lambda() |
242 | .eq(TkDeviceScriptEntity::getTenantId, tenantId) | 293 | .eq(TkDeviceScriptEntity::getTenantId, tenantId) |
243 | - .eq(null != status,TkDeviceScriptEntity::getStatus,status) | 294 | + .eq(null != status, TkDeviceScriptEntity::getStatus, status) |
244 | .like(StringUtils.isNotEmpty(name), TkDeviceScriptEntity::getName, name) | 295 | .like(StringUtils.isNotEmpty(name), TkDeviceScriptEntity::getName, name) |
245 | .and( | 296 | .and( |
246 | null != startTime && null != endTime, | 297 | null != startTime && null != endTime, |
@@ -258,14 +309,15 @@ public class TkDeviceScriptServiceImpl | @@ -258,14 +309,15 @@ public class TkDeviceScriptServiceImpl | ||
258 | } | 309 | } |
259 | 310 | ||
260 | @Override | 311 | @Override |
261 | - public List<TkDeviceScriptDTO> findDeviceScript(String tenantId, ScriptType scriptType,DeviceTypeEnum serviceType) { | 312 | + public List<TkDeviceScriptDTO> findDeviceScript( |
313 | + String tenantId, ScriptType scriptType, DeviceTypeEnum serviceType) { | ||
262 | LambdaQueryWrapper<TkDeviceScriptEntity> queryWrapper = | 314 | LambdaQueryWrapper<TkDeviceScriptEntity> queryWrapper = |
263 | new QueryWrapper<TkDeviceScriptEntity>() | 315 | new QueryWrapper<TkDeviceScriptEntity>() |
264 | .lambda() | 316 | .lambda() |
265 | - .eq(TkDeviceScriptEntity::getStatus,StatusEnum.ENABLE.getIndex()) | ||
266 | - .eq(scriptType!=null,TkDeviceScriptEntity::getScriptType, scriptType) | ||
267 | - .eq(serviceType!=null,TkDeviceScriptEntity::getServiceType,serviceType) | ||
268 | - .eq(TkDeviceScriptEntity::getTenantId, tenantId); | 317 | + .eq(TkDeviceScriptEntity::getStatus, StatusEnum.ENABLE.getIndex()) |
318 | + .eq(scriptType != null, TkDeviceScriptEntity::getScriptType, scriptType) | ||
319 | + .eq(serviceType != null, TkDeviceScriptEntity::getServiceType, serviceType) | ||
320 | + .eq(TkDeviceScriptEntity::getTenantId, tenantId); | ||
269 | return baseMapper.selectList(queryWrapper).stream() | 321 | return baseMapper.selectList(queryWrapper).stream() |
270 | .map(item -> item.getDTO(TkDeviceScriptDTO.class)) | 322 | .map(item -> item.getDTO(TkDeviceScriptDTO.class)) |
271 | .collect(Collectors.toList()); | 323 | .collect(Collectors.toList()); |
@@ -289,15 +341,19 @@ public class TkDeviceScriptServiceImpl | @@ -289,15 +341,19 @@ public class TkDeviceScriptServiceImpl | ||
289 | .map(DeviceDTO::getDeviceProfileId) | 341 | .map(DeviceDTO::getDeviceProfileId) |
290 | .collect(Collectors.toList()); | 342 | .collect(Collectors.toList()); |
291 | List<DeviceProfileDTO> deviceProfileDTOList = | 343 | List<DeviceProfileDTO> deviceProfileDTOList = |
292 | - tkDeviceProfileService.findDeviceProfileByIds(tenantId, deviceProfiles, TransportTypeEnum.TCP); | 344 | + tkDeviceProfileService.findDeviceProfileByIds( |
345 | + tenantId, deviceProfiles, TransportTypeEnum.TCP); | ||
293 | return Optional.ofNullable(deviceProfileDTOList) | 346 | return Optional.ofNullable(deviceProfileDTOList) |
294 | .map( | 347 | .map( |
295 | - deviceProfileDTOS ->{ | 348 | + deviceProfileDTOS -> { |
296 | Set<String> tcpScriptes = new HashSet<>(); | 349 | Set<String> tcpScriptes = new HashSet<>(); |
297 | - deviceProfileDTOS.forEach(p->{ | ||
298 | - TkTcpDeviceProfileTransportConfiguration config = (TkTcpDeviceProfileTransportConfiguration) p.getProfileData().getTransportConfiguration(); | ||
299 | - tcpScriptes.add(config.getUpScriptId()); | ||
300 | - }); | 350 | + deviceProfileDTOS.forEach( |
351 | + p -> { | ||
352 | + TkTcpDeviceProfileTransportConfiguration config = | ||
353 | + (TkTcpDeviceProfileTransportConfiguration) | ||
354 | + p.getProfileData().getTransportConfiguration(); | ||
355 | + tcpScriptes.add(config.getUpScriptId()); | ||
356 | + }); | ||
301 | return tcpScriptes; | 357 | return tcpScriptes; |
302 | }) | 358 | }) |
303 | .orElse(null); | 359 | .orElse(null); |
@@ -315,113 +371,154 @@ public class TkDeviceScriptServiceImpl | @@ -315,113 +371,154 @@ public class TkDeviceScriptServiceImpl | ||
315 | String functionCode = config.getMethod(); | 371 | String functionCode = config.getMethod(); |
316 | result.append(functionCode); | 372 | result.append(functionCode); |
317 | String addrStr = ByteUtils.integerToHex(config.getRegisterAddress()); | 373 | String addrStr = ByteUtils.integerToHex(config.getRegisterAddress()); |
318 | - result.append(addrStr.substring(addrStr.length()-4)); | 374 | + result.append(addrStr.substring(addrStr.length() - 4)); |
319 | 375 | ||
320 | List<Integer> values = config.getRegisterValues(); | 376 | List<Integer> values = config.getRegisterValues(); |
321 | - Integer registerNum = config.getRegisterNumber()==null?1:config.getRegisterNumber(); | ||
322 | - if(values ==null || values.isEmpty()){ | ||
323 | - //读寄存器数据 | 377 | + Integer registerNum = config.getRegisterNumber() == null ? 1 : config.getRegisterNumber(); |
378 | + if (values == null || values.isEmpty()) { | ||
379 | + // 读寄存器数据 | ||
324 | result.append(modelHex(registerNum)); | 380 | result.append(modelHex(registerNum)); |
325 | - }else if(values.size() == 1 &&(TkModBusFunctionCode.WRITE_ONE_COIL.getCode().equals(functionCode) || TkModBusFunctionCode.WRITE_ONE_REGISTER.getCode().equals(functionCode) )){ | ||
326 | - //单个写入 | 381 | + } else if (values.size() == 1 |
382 | + && (TkModBusFunctionCode.WRITE_ONE_COIL.getCode().equals(functionCode) | ||
383 | + || TkModBusFunctionCode.WRITE_ONE_REGISTER.getCode().equals(functionCode))) { | ||
384 | + // 单个写入 | ||
327 | result.append(modelHex(values.get(0))); | 385 | result.append(modelHex(values.get(0))); |
328 | - }else{ | ||
329 | - //多个写入 | 386 | + } else { |
387 | + // 多个写入 | ||
330 | result.append(modelHex(registerNum)); | 388 | result.append(modelHex(registerNum)); |
331 | - result.append(multData(functionCode,values)); | 389 | + result.append(multData(functionCode, values)); |
332 | } | 390 | } |
333 | - result.append(CrcUtils.getSendBuf(config.getCrc(),result.toString())); | ||
334 | - | 391 | + result.append(CrcUtils.getSendBuf(config.getCrc(), result.toString())); |
335 | 392 | ||
336 | return result.toString(); | 393 | return result.toString(); |
337 | } | 394 | } |
338 | 395 | ||
339 | @Override | 396 | @Override |
340 | - public void eval(String tenantId, String scriptId) throws ExecutionException, InterruptedException { | ||
341 | - TkDeviceScriptEntity entity = baseMapper.selectOne(new LambdaQueryWrapper<TkDeviceScriptEntity>() | ||
342 | - .eq(TkDeviceScriptEntity::getId,scriptId)); | ||
343 | - if(null == entity){ | 397 | + public void eval(String tenantId, String scriptId) |
398 | + throws ExecutionException, InterruptedException { | ||
399 | + TkDeviceScriptEntity entity = | ||
400 | + baseMapper.selectOne( | ||
401 | + new LambdaQueryWrapper<TkDeviceScriptEntity>() | ||
402 | + .eq(TkDeviceScriptEntity::getId, scriptId)); | ||
403 | + if (null == entity) { | ||
344 | throw new TkDataValidationException("脚本不存在"); | 404 | throw new TkDataValidationException("脚本不存在"); |
345 | } | 405 | } |
346 | TenantId tbTenantId = new TenantId(UUID.fromString(tenantId)); | 406 | TenantId tbTenantId = new TenantId(UUID.fromString(tenantId)); |
347 | UUID scriptUUID = null; | 407 | UUID scriptUUID = null; |
348 | - String[] argNames = new String[]{"msg", "metadata", "msgType"}; | ||
349 | - if(Objects.equals(entity.getScriptLanguage(),ScriptLanguage.JS)){ | ||
350 | - scriptUUID= jsInvokeService.eval(tbTenantId,UUID.fromString(scriptId),entity.getScriptType(), | ||
351 | - entity.getConvertJs(),argNames).get(); | 408 | + String[] argNames = new String[] {"msg", "metadata", "msgType"}; |
409 | + if (Objects.equals(entity.getScriptLanguage(), ScriptLanguage.JS)) { | ||
410 | + scriptUUID = | ||
411 | + jsInvokeService | ||
412 | + .eval( | ||
413 | + tbTenantId, | ||
414 | + UUID.fromString(scriptId), | ||
415 | + entity.getScriptType(), | ||
416 | + entity.getConvertJs(), | ||
417 | + argNames) | ||
418 | + .get(); | ||
352 | } | 419 | } |
353 | - if(Objects.equals(entity.getScriptLanguage(),ScriptLanguage.TBEL)){ | ||
354 | - scriptUUID = tbelInvokeService.eval(tbTenantId,UUID.fromString(scriptId),entity.getScriptType(), | ||
355 | - entity.getConvertTbel(),argNames).get(); | 420 | + if (Objects.equals(entity.getScriptLanguage(), ScriptLanguage.TBEL)) { |
421 | + scriptUUID = | ||
422 | + tbelInvokeService | ||
423 | + .eval( | ||
424 | + tbTenantId, | ||
425 | + UUID.fromString(scriptId), | ||
426 | + entity.getScriptType(), | ||
427 | + entity.getConvertTbel(), | ||
428 | + argNames) | ||
429 | + .get(); | ||
356 | } | 430 | } |
357 | System.out.printf("UUID:" + scriptUUID.toString()); | 431 | System.out.printf("UUID:" + scriptUUID.toString()); |
358 | } | 432 | } |
359 | 433 | ||
360 | @Override | 434 | @Override |
361 | public void release(String tenantId, String scriptId) { | 435 | public void release(String tenantId, String scriptId) { |
362 | - TkDeviceScriptEntity entity = baseMapper.selectOne(new LambdaQueryWrapper<TkDeviceScriptEntity>() | ||
363 | - .eq(TkDeviceScriptEntity::getId,scriptId)); | ||
364 | - if(null == entity){ | 436 | + TkDeviceScriptEntity entity = |
437 | + baseMapper.selectOne( | ||
438 | + new LambdaQueryWrapper<TkDeviceScriptEntity>() | ||
439 | + .eq(TkDeviceScriptEntity::getId, scriptId)); | ||
440 | + if (null == entity) { | ||
365 | throw new TkDataValidationException("脚本不存在"); | 441 | throw new TkDataValidationException("脚本不存在"); |
366 | } | 442 | } |
367 | - if(Objects.equals(entity.getScriptLanguage(),ScriptLanguage.JS)){ | 443 | + if (Objects.equals(entity.getScriptLanguage(), ScriptLanguage.JS)) { |
368 | jsInvokeService.release(UUID.fromString(scriptId)); | 444 | jsInvokeService.release(UUID.fromString(scriptId)); |
369 | } | 445 | } |
370 | - if(Objects.equals(entity.getScriptLanguage(),ScriptLanguage.TBEL)){ | 446 | + if (Objects.equals(entity.getScriptLanguage(), ScriptLanguage.TBEL)) { |
371 | tbelInvokeService.release(UUID.fromString(scriptId)); | 447 | tbelInvokeService.release(UUID.fromString(scriptId)); |
372 | } | 448 | } |
373 | } | 449 | } |
374 | 450 | ||
375 | @Override | 451 | @Override |
376 | public ScriptLanguage findScriptLanguageById(String scriptId) { | 452 | public ScriptLanguage findScriptLanguageById(String scriptId) { |
377 | - return Optional.ofNullable(baseMapper.selectById(scriptId)).map(entity->entity.getScriptLanguage()).orElse(null); | 453 | + return Optional.ofNullable(baseMapper.selectById(scriptId)) |
454 | + .map(entity -> entity.getScriptLanguage()) | ||
455 | + .orElse(null); | ||
378 | } | 456 | } |
379 | 457 | ||
380 | @Override | 458 | @Override |
381 | public List<TkDeviceScriptDTO> findAllEnabledScript() { | 459 | public List<TkDeviceScriptDTO> findAllEnabledScript() { |
382 | - List<TkDeviceScriptEntity> entities = baseMapper.selectList(new LambdaQueryWrapper<TkDeviceScriptEntity>(). | ||
383 | - eq(TkDeviceScriptEntity::getStatus,StatusEnum.ENABLE.getIndex()) | ||
384 | - .ne(TkDeviceScriptEntity::getTenantId,EntityId.NULL_UUID.toString())); | ||
385 | - return Optional.ofNullable(entities).map(objects-> objects.stream().map(entity->entity.getDTO(TkDeviceScriptDTO.class)) | ||
386 | - .collect(Collectors.toList())).orElse(null); | 460 | + //找到所有的租户 |
461 | + List<TenantDTO> tenants = tenantService.getAllTenant(); | ||
462 | + if(null == tenants || tenants.isEmpty()){ | ||
463 | + return null; | ||
464 | + } | ||
465 | + List<String> tenantIds = tenants.stream().map(entity->entity.getTenantId()).collect(Collectors.toList()); | ||
466 | + List<TkDeviceScriptEntity> entities = | ||
467 | + baseMapper.selectList( | ||
468 | + new LambdaQueryWrapper<TkDeviceScriptEntity>() | ||
469 | + .eq(TkDeviceScriptEntity::getStatus, StatusEnum.ENABLE.getIndex()) | ||
470 | + .in(TkDeviceScriptEntity::getTenantId, tenantIds)); | ||
471 | + return Optional.ofNullable(entities) | ||
472 | + .map( | ||
473 | + objects -> | ||
474 | + objects.stream() | ||
475 | + .map( | ||
476 | + entity -> { | ||
477 | + TkDeviceScriptDTO scriptDTO = entity.getDTO(TkDeviceScriptDTO.class); | ||
478 | + scriptDTO.setScriptType(entity.getScriptType().name()); | ||
479 | + return scriptDTO; | ||
480 | + }) | ||
481 | + .collect(Collectors.toList())) | ||
482 | + .orElse(null); | ||
387 | } | 483 | } |
388 | 484 | ||
389 | - private String modelHex(Integer max){ | 485 | + private String modelHex(Integer max) { |
390 | String addrStr = ByteUtils.integerToHex(max); | 486 | String addrStr = ByteUtils.integerToHex(max); |
391 | - return addrStr.substring(addrStr.length()-4); | 487 | + return addrStr.substring(addrStr.length() - 4); |
392 | } | 488 | } |
393 | 489 | ||
394 | - private String dataLength(Integer max){ | 490 | + private String dataLength(Integer max) { |
395 | String addrStr = ByteUtils.integerToHex(max); | 491 | String addrStr = ByteUtils.integerToHex(max); |
396 | - return addrStr.substring(addrStr.length()-2); | 492 | + return addrStr.substring(addrStr.length() - 2); |
397 | } | 493 | } |
398 | - private String multData(String functionCode,List<Integer>datas){ | 494 | + |
495 | + private String multData(String functionCode, List<Integer> datas) { | ||
399 | StringBuilder dataStr = new StringBuilder(); | 496 | StringBuilder dataStr = new StringBuilder(); |
400 | int dataLength = datas.size(); | 497 | int dataLength = datas.size(); |
401 | - if(TkModBusFunctionCode.WRITE_MANY_REGISTER.getCode().equals(functionCode)){ | ||
402 | - dataStr.append(dataLength(dataLength*2)); | ||
403 | - for(Integer item: datas){ | 498 | + if (TkModBusFunctionCode.WRITE_MANY_REGISTER.getCode().equals(functionCode)) { |
499 | + dataStr.append(dataLength(dataLength * 2)); | ||
500 | + for (Integer item : datas) { | ||
404 | dataStr.append(modelHex(item)); | 501 | dataStr.append(modelHex(item)); |
405 | } | 502 | } |
406 | - }else{ | 503 | + } else { |
407 | 504 | ||
408 | - int residue = dataLength%8; | ||
409 | - int num = dataLength/8; | ||
410 | - dataStr.append(dataLength(residue == 0 ?num:num+1)); | 505 | + int residue = dataLength % 8; |
506 | + int num = dataLength / 8; | ||
507 | + dataStr.append(dataLength(residue == 0 ? num : num + 1)); | ||
411 | 508 | ||
412 | - Integer wordVal=0; | ||
413 | - for(int dataIndex=0,wordIndex=0;dataIndex<dataLength;dataIndex++){ | 509 | + Integer wordVal = 0; |
510 | + for (int dataIndex = 0, wordIndex = 0; dataIndex < dataLength; dataIndex++) { | ||
414 | Integer itemVal = datas.get(dataIndex); | 511 | Integer itemVal = datas.get(dataIndex); |
415 | - if(itemVal == 1){ | 512 | + if (itemVal == 1) { |
416 | byte one = 1; | 513 | byte one = 1; |
417 | - one<<=wordIndex; | ||
418 | - wordVal+=one; | 514 | + one <<= wordIndex; |
515 | + wordVal += one; | ||
419 | } | 516 | } |
420 | - if(dataIndex%8==7 || dataLength == dataIndex+1){ | 517 | + if (dataIndex % 8 == 7 || dataLength == dataIndex + 1) { |
421 | dataStr.append(ByteUtils.byteToHex(wordVal.byteValue())); | 518 | dataStr.append(ByteUtils.byteToHex(wordVal.byteValue())); |
422 | - wordVal=0; | ||
423 | - wordIndex=0; | ||
424 | - }else{ | 519 | + wordVal = 0; |
520 | + wordIndex = 0; | ||
521 | + } else { | ||
425 | wordIndex++; | 522 | wordIndex++; |
426 | } | 523 | } |
427 | } | 524 | } |
@@ -24,6 +24,7 @@ | @@ -24,6 +24,7 @@ | ||
24 | 24 | ||
25 | <resultMap id="dataViewInfoMap" | 25 | <resultMap id="dataViewInfoMap" |
26 | type="org.thingsboard.server.common.data.yunteng.dto.request.TkDataViewContentInfoDTO"> | 26 | type="org.thingsboard.server.common.data.yunteng.dto.request.TkDataViewContentInfoDTO"> |
27 | + <result property="thumbnail" column="thumbnail"/> | ||
27 | <result property="dataViewId" column="id"/> | 28 | <result property="dataViewId" column="id"/> |
28 | <result property="dataViewName" column="name"/> | 29 | <result property="dataViewName" column="name"/> |
29 | <result property="state" column="state"/> | 30 | <result property="state" column="state"/> |
@@ -61,7 +62,7 @@ | @@ -61,7 +62,7 @@ | ||
61 | </select> | 62 | </select> |
62 | 63 | ||
63 | <select id="getDataViewInfoById" resultMap="dataViewInfoMap"> | 64 | <select id="getDataViewInfoById" resultMap="dataViewInfoMap"> |
64 | - SELECT icc.id,icc.name,icc.state,icc.organization_id,icc.thumbnail,icct.id AS content_id,icct.content FROM tk_data_view icc LEFT JOIN | 65 | + SELECT icc.id,icc.thumbnail,icc.name,icc.state,icc.organization_id,icc.thumbnail,icct.id AS content_id,icct.content FROM tk_data_view icc LEFT JOIN |
65 | tk_data_view_content icct ON icc.id = icct.view_id | 66 | tk_data_view_content icct ON icc.id = icct.view_id |
66 | WHERE icc.id = #{id} AND icc.tenant_id = #{tenantId} | 67 | WHERE icc.id = #{id} AND icc.tenant_id = #{tenantId} |
67 | </select> | 68 | </select> |
@@ -17,6 +17,7 @@ package org.thingsboard.server.gbt28181; | @@ -17,6 +17,7 @@ package org.thingsboard.server.gbt28181; | ||
17 | 17 | ||
18 | import org.springframework.boot.SpringApplication; | 18 | import org.springframework.boot.SpringApplication; |
19 | import org.springframework.boot.SpringBootConfiguration; | 19 | import org.springframework.boot.SpringBootConfiguration; |
20 | +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
20 | import org.springframework.context.annotation.ComponentScan; | 21 | import org.springframework.context.annotation.ComponentScan; |
21 | import org.springframework.scheduling.annotation.EnableAsync; | 22 | import org.springframework.scheduling.annotation.EnableAsync; |
22 | import org.springframework.scheduling.annotation.EnableScheduling; | 23 | import org.springframework.scheduling.annotation.EnableScheduling; |
@@ -26,6 +27,7 @@ import java.util.Arrays; | @@ -26,6 +27,7 @@ import java.util.Arrays; | ||
26 | @SpringBootConfiguration | 27 | @SpringBootConfiguration |
27 | @EnableAsync | 28 | @EnableAsync |
28 | @EnableScheduling | 29 | @EnableScheduling |
30 | +@EnableAutoConfiguration | ||
29 | @ComponentScan({"org.thingsboard.server.gbt28181", "org.thingsboard.server.common", "org.thingsboard.server.transport.gbt28181", "org.thingsboard.server.queue", "org.thingsboard.server.cache"}) | 31 | @ComponentScan({"org.thingsboard.server.gbt28181", "org.thingsboard.server.common", "org.thingsboard.server.transport.gbt28181", "org.thingsboard.server.queue", "org.thingsboard.server.cache"}) |
30 | public class ThingsboardGBT28181TransportApplication { | 32 | public class ThingsboardGBT28181TransportApplication { |
31 | 33 |
@@ -17,6 +17,7 @@ package org.thingsboard.server.tcp; | @@ -17,6 +17,7 @@ package org.thingsboard.server.tcp; | ||
17 | 17 | ||
18 | import org.springframework.boot.SpringApplication; | 18 | import org.springframework.boot.SpringApplication; |
19 | import org.springframework.boot.SpringBootConfiguration; | 19 | import org.springframework.boot.SpringBootConfiguration; |
20 | +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
20 | import org.springframework.context.annotation.ComponentScan; | 21 | import org.springframework.context.annotation.ComponentScan; |
21 | import org.springframework.scheduling.annotation.EnableAsync; | 22 | import org.springframework.scheduling.annotation.EnableAsync; |
22 | import org.springframework.scheduling.annotation.EnableScheduling; | 23 | import org.springframework.scheduling.annotation.EnableScheduling; |
@@ -26,7 +27,8 @@ import java.util.Arrays; | @@ -26,7 +27,8 @@ import java.util.Arrays; | ||
26 | @SpringBootConfiguration | 27 | @SpringBootConfiguration |
27 | @EnableAsync | 28 | @EnableAsync |
28 | @EnableScheduling | 29 | @EnableScheduling |
29 | -@ComponentScan({"org.thingsboard.server.tcp", "org.thingsboard.server.common", "org.thingsboard.server.transport.tcp", "org.thingsboard.server.transport.udp", "org.thingsboard.server.queue", "org.thingsboard.server.cache"}) | 30 | +@EnableAutoConfiguration |
31 | +@ComponentScan({"org.thingsboard.server.tcp", "org.thingsboard.server.common", "org.thingsboard.server.transport.tcp", "org.thingsboard.server.queue", "org.thingsboard.server.cache","org.thingsboard.script.api"}) | ||
30 | public class ThingsboardTcpTransportApplication { | 32 | public class ThingsboardTcpTransportApplication { |
31 | 33 | ||
32 | private static final String SPRING_CONFIG_NAME_KEY = "--spring.config.name"; | 34 | private static final String SPRING_CONFIG_NAME_KEY = "--spring.config.name"; |