From 04445e77ae2ebba5879e6e6e8c35e39a337aaf8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E9=9B=AA=E4=BC=9F?= Date: Fri, 30 Aug 2024 13:24:45 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=91=E6=B5=8B=E5=B9=B3=E5=8F=B0=E7=B3=BB?= =?UTF-8?q?=E7=BB=9Fbug=E4=BC=98=E5=8C=96=E5=A4=84=E7=90=86=E7=A6=BB?= =?UTF-8?q?=E7=BA=BF=E6=8A=A5=E8=AD=A6=E8=A7=84=E5=88=99=E6=89=93=E5=BC=80?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E8=A7=A3=E5=86=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/HwAlarmRuleServiceImpl.java | 23 ++++++++++++------- .../impl/HwOfflineRuleServiceImpl.java | 19 +++++++++++++++ 2 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwOfflineRuleServiceImpl.java diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java index 30be5cc..bf75ffc 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java @@ -117,14 +117,21 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { @Transactional @Override public int insertHwAlarmRule(HwAlarmRule hwAlarmRule) { - String triggerExpression = this.getTriggerExpression(hwAlarmRule); - hwAlarmRule.setTriggerExpression(triggerExpression); - hwAlarmRule.setAlarmPushFlag(HwDictConstants.ALARM_PUSH_FLAG_NO); - hwAlarmRule.setCreateTime(DateUtils.getNowDate()); - hwAlarmRule.setTenantId(SecurityUtils.getTenantId()); - hwAlarmRule.setCreateBy(SecurityUtils.getUsername()); - int rows = hwAlarmRuleMapper.insertHwAlarmRule(hwAlarmRule); - insertHwAlarmRuleLink(hwAlarmRule); + List ruleDeviceIds = hwAlarmRule.getRuleDeviceIds(); + int rows = 0; + for (Long ruleDeviceId : ruleDeviceIds) { + hwAlarmRule.setRuleDeviceId(ruleDeviceId); + String triggerExpression = this.getTriggerExpression(hwAlarmRule); + hwAlarmRule.setTriggerExpression(triggerExpression); + hwAlarmRule.setAlarmPushFlag(HwDictConstants.ALARM_PUSH_FLAG_NO); + hwAlarmRule.setCreateTime(DateUtils.getNowDate()); + hwAlarmRule.setTenantId(SecurityUtils.getTenantId()); + hwAlarmRule.setCreateBy(SecurityUtils.getUsername()); + int rowsAdd = hwAlarmRuleMapper.insertHwAlarmRule(hwAlarmRule); + insertHwAlarmRuleLink(hwAlarmRule); + rows += rowsAdd; + } + return rows; } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwOfflineRuleServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwOfflineRuleServiceImpl.java new file mode 100644 index 0000000..f9ffec5 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwOfflineRuleServiceImpl.java @@ -0,0 +1,19 @@ +package com.ruoyi.business.service.impl; + +import com.ruoyi.business.domain.HwOfflineRule; +import com.ruoyi.business.mapper.HwOfflineRuleMapper; +import com.ruoyi.business.service.HwOfflineRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +public class HwOfflineRuleServiceImpl implements HwOfflineRuleService { + @Autowired + private HwOfflineRuleMapper hwOfflineRuleMapper; + @Override + public List selectRuleList(HwOfflineRule hwOfflineRule) { + List hwOfflineRules = hwOfflineRuleMapper.selectHwOfflineRuleJoinList(hwOfflineRule); + return hwOfflineRules; + } +}