Commit 406fc840bfb2d68b47243d331bc8fd0e7deefdef
1 parent
fedbeba1
fix(DEFECT-1584): 场景联动相同的数据,触发多次执行动作的问题修复
Showing
1 changed file
with
6 additions
and
2 deletions
@@ -62,6 +62,7 @@ class ReactState { | @@ -62,6 +62,7 @@ class ReactState { | ||
62 | private final TkNoticeService noticeService; | 62 | private final TkNoticeService noticeService; |
63 | private TkDeviceService ytDeviceService; | 63 | private TkDeviceService ytDeviceService; |
64 | 64 | ||
65 | + private String actionData; | ||
65 | ReactState(String reactId, TbContext ctx, TbSceneReactNodeConfig config) { | 66 | ReactState(String reactId, TbContext ctx, TbSceneReactNodeConfig config) { |
66 | this.reactId = reactId; | 67 | this.reactId = reactId; |
67 | this.reactName = config.getNames().get(reactId); | 68 | this.reactName = config.getNames().get(reactId); |
@@ -82,6 +83,7 @@ class ReactState { | @@ -82,6 +83,7 @@ class ReactState { | ||
82 | } | 83 | } |
83 | this.noticeService = SpringBeanUtils.getBean(TkNoticeService.class); | 84 | this.noticeService = SpringBeanUtils.getBean(TkNoticeService.class); |
84 | this.ytDeviceService = SpringBeanUtils.getBean(TkDeviceService.class); | 85 | this.ytDeviceService = SpringBeanUtils.getBean(TkDeviceService.class); |
86 | + actionData =""; | ||
85 | } | 87 | } |
86 | 88 | ||
87 | /** | 89 | /** |
@@ -219,8 +221,10 @@ class ReactState { | @@ -219,8 +221,10 @@ class ReactState { | ||
219 | })); | 221 | })); |
220 | }); | 222 | }); |
221 | 223 | ||
222 | - if (triggerMatched.get() && conditionMatched.get()) { | ||
223 | - log.debug(String.format("设备【%s】的消息内容【%s】触发动作", deviceId, msg.getData())); | 224 | + String msgData = msg.getData(); |
225 | + if (triggerMatched.get() && conditionMatched.get() && !actionData.equals(msgData)) { | ||
226 | + actionData = msgData; | ||
227 | + log.debug(String.format("设备【%s】的消息内容【%s】触发动作", deviceId, msgData)); | ||
224 | for (TkDoActionEntity item : actions) { | 228 | for (TkDoActionEntity item : actions) { |
225 | if (ActionTypeEnum.MSG_NOTIFY.equals(item.getOutTarget())) { | 229 | if (ActionTypeEnum.MSG_NOTIFY.equals(item.getOutTarget())) { |
226 | noticeMsg(ctx, msg, item, deviceId, detail, msg.getTs()); | 230 | noticeMsg(ctx, msg, item, deviceId, detail, msg.getTs()); |