diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java index 182366e..9e7fb90 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/constant/HwDictConstants.java @@ -50,6 +50,9 @@ public class HwDictConstants { public static final String FENCE_TYPE_MONITOR_UNIT = "2";//电子围栏规则类型,监控单元 public static final String FENCE_TYPE_SCENE = "3";//电子围栏规则类型,场景 + public static final String FENCE_PUSH_FLAG_YES = "1";//报警推送标识:是 + public static final String FENCE_PUSH_FLAG_NO = "0";//报警推送标识:否 + public static final String CONTROL_DEVICE = "1";//监控型设备 public static final String ACQUISITION_DEVICE = "2";//采集型设备 @@ -106,6 +109,10 @@ public class HwDictConstants { public static final String CONTROL_COMMAND_PAYLOAD_TYPE_KEY = "type"; public static final String CONTROL_COMMAND_PAYLOAD_PARAM_KEY = "param"; + public static final String TOPIC_TYPE_DATA_POSTFIX = "data"; //上报数据topic后缀 + public static final String TOPIC_TYPE_COMMAND_POSTFIX = "command";//下发指令topic后缀 + public static final String TOPIC_TYPE_REPLY_POSTFIX = "reply";//响应指令topic后缀 + public static final String DEVICEMODE_GPS_FLAG_NO = "0";//设备模型,非定位模型 public static final String TENANT_STATUS_NORMAL = "1";//租户状态:正常 @@ -145,6 +152,13 @@ public class HwDictConstants { public static final String ALARM_RULE_LINK_FLAG_NO = "0";//报警联动标识:否 public static final String ALARM_RULE_LINK_FLAG_YES = "1";//报警联动标识:是 - public static final String ALARM_RULE_RULE_TYPE_DEVICEMODE="1";//报警规则规则类型:设备模型 - public static final String ALARM_RULE_RULE_TYPE_DEVICE="2";//报警规则规则类型:设备 + public static final String ALARM_RULE_RULE_TYPE_DEVICEMODE = "1";//报警规则规则类型:设备模型 + public static final String ALARM_RULE_RULE_TYPE_DEVICE = "2";//报警规则规则类型:设备 + + public static final String ALARM_RULE_STATUS_ENABLE = "1";//;报警规则状态:启用 + public static final String ALARM_RULE_STATUS_DISABLE = "0";//报警规则状态:禁用 + public static final String ALARM_RULE_STATUS_DELETED = "9";//报警规则状态:删除 + + public static final String ALARM_INFO_FLAG_YES = "1";//有关联报警信息; + public static final String ALARM_INFO_FLAG_NO = "0";//无关联报警信息; } diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/RegexUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/RegexUtils.java index a5c7fb6..d6b9490 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/RegexUtils.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/RegexUtils.java @@ -17,6 +17,8 @@ public class RegexUtils { private static final Pattern P_BRACE = Pattern.compile("\\{(.*?)\\}"); private static final Pattern P_NUMBER = Pattern.compile("[-+]?\\d*\\.?\\d+"); + private static final Pattern P_SYMBOL = Pattern.compile("[<>=]"); + public static final String findContentInBrace(String content){ Matcher matcher = P_BRACE.matcher(content); @@ -27,6 +29,16 @@ public class RegexUtils { return ""; } + public static final List findSymbolInText(String content){ + Matcher matcher = P_SYMBOL.matcher(content); + List numbers = new ArrayList(); + while (matcher.find()) { + String match = matcher.group(); + numbers.add(match); + } + return numbers; + } + public static final List findNumberInText(String content){ Matcher matcher = P_NUMBER.matcher(content); List numbers = new ArrayList(); diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmRule.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmRule.java index f6ca2fe..2948b84 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmRule.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwAlarmRule.java @@ -108,6 +108,8 @@ public class HwAlarmRule extends BaseEntity @Excel(name = "设备") private String ruleDeviceName; + private String alarmInfoFlag; + public void setAlarmRuleId(Long alarmRuleId) { this.alarmRuleId = alarmRuleId; @@ -344,6 +346,14 @@ public class HwAlarmRule extends BaseEntity this.ruleDeviceName = ruleDeviceName; } + public String getAlarmInfoFlag() { + return alarmInfoFlag; + } + + public void setAlarmInfoFlag(String alarmInfoFlag) { + this.alarmInfoFlag = alarmInfoFlag; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java index 0e4cb62..b1b07ef 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/domain/HwElectronicFence.java @@ -75,7 +75,7 @@ public class HwElectronicFence extends BaseEntity private String polygonAreaListStr; private String circleAreaListStr; - + private String alarmInfoFlag;//是否有报警信息关联标识 public void setElectronicFenceId(Long electronicFenceId) { @@ -229,6 +229,14 @@ public class HwElectronicFence extends BaseEntity this.circleAreaListStr = circleAreaListStr; } + public String getAlarmInfoFlag() { + return alarmInfoFlag; + } + + public void setAlarmInfoFlag(String alarmInfoFlag) { + this.alarmInfoFlag = alarmInfoFlag; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java index 2e504fa..dcde8cf 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/mapper/HwElectronicFenceMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.business.mapper; import java.util.List; import com.ruoyi.business.domain.HwElectronicFence; +import com.ruoyi.business.domain.HwFenceArea; import com.ruoyi.business.domain.VO.EleMonitorDeviceSumVo; @@ -97,4 +98,20 @@ public interface HwElectronicFenceMapper * @return 电子围栏集合 */ public List selectHwElectronicFenceJoinList(HwElectronicFence hwElectronicFence); + + /** + * 批量新增电子围栏区域 + * + * @param hwFenceAreaList 电子围栏区域列表 + * @return 结果 + */ + public int batchHwFenceArea(List hwFenceAreaList); + + /** + * 通过电子围栏主键删除电子围栏区域信息 + * + * @param electronicFenceId 电子围栏ID + * @return 结果 + */ + public int deleteHwFenceAreaByElectronicFenceId(Long electronicFenceId); } 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 8afeeed..a12ebb9 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 @@ -1,7 +1,9 @@ package com.ruoyi.business.service.impl; +import com.ruoyi.business.domain.HwAlarmInfo; import com.ruoyi.business.domain.HwAlarmRule; import com.ruoyi.business.domain.HwAlarmRuleLink; +import com.ruoyi.business.mapper.HwAlarmInfoMapper; import com.ruoyi.business.mapper.HwAlarmRuleMapper; import com.ruoyi.business.service.IHwAlarmRuleService; import com.ruoyi.common.core.constant.HwDictConstants; @@ -27,6 +29,8 @@ import java.util.List; public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { @Autowired private HwAlarmRuleMapper hwAlarmRuleMapper; + @Autowired + private HwAlarmInfoMapper hwAlarmInfoMapper; /** * 查询报警规则 @@ -63,6 +67,18 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { alarmRule.setTriggerDataB(Double.valueOf(triggerDataList.get(1))); } + alarmRule.setAlarmInfoFlag(HwDictConstants.ALARM_INFO_FLAG_NO); + if (alarmRule.getRuleType().equals(HwDictConstants.ALARM_RULE_RULE_TYPE_DEVICE)) { + HwAlarmInfo queryAlarmInfo = new HwAlarmInfo(); + queryAlarmInfo.setAlarmInfoType(HwDictConstants.ALARM_INFO_TYPE_DEVICE); + queryAlarmInfo.setAlarmReleatedId(alarmRule.getAlarmRuleId()); + List alarmInfos = hwAlarmInfoMapper.selectHwAlarmInfoList(queryAlarmInfo); + + if (alarmInfos != null && !alarmInfos.isEmpty()) { + alarmRule.setAlarmInfoFlag(HwDictConstants.ALARM_INFO_FLAG_YES); + } + } + return alarmRule; } @@ -111,8 +127,18 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { public int updateHwAlarmRule(HwAlarmRule hwAlarmRule) { hwAlarmRule.setUpdateTime(DateUtils.getNowDate()); hwAlarmRule.setUpdateBy(SecurityUtils.getUsername()); - String triggerExpression = this.getTriggerExpression(hwAlarmRule); - hwAlarmRule.setTriggerExpression(triggerExpression); + + HwAlarmInfo queryAlarmInfo = new HwAlarmInfo(); + queryAlarmInfo.setAlarmInfoType(HwDictConstants.ALARM_INFO_TYPE_DEVICE); + queryAlarmInfo.setAlarmReleatedId(hwAlarmRule.getAlarmRuleId()); + List alarmInfos = hwAlarmInfoMapper.selectHwAlarmInfoList(queryAlarmInfo); + if (alarmInfos == null || alarmInfos.isEmpty()) {//没有关联报警信息,才能修改表达式 + String triggerExpression = this.getTriggerExpression(hwAlarmRule); + hwAlarmRule.setTriggerExpression(triggerExpression); + } else { + hwAlarmRule.setTriggerExpression(null); + } + hwAlarmRuleMapper.deleteHwAlarmRuleLinkByAlarmRuleId(hwAlarmRule.getAlarmRuleId()); if (hwAlarmRule.getLinkFlag().equals(HwDictConstants.ALARM_RULE_LINK_FLAG_YES)) { insertHwAlarmRuleLink(hwAlarmRule); @@ -130,7 +156,7 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { @Override public int deleteHwAlarmRuleByAlarmRuleIds(Long[] alarmRuleIds) { // hwAlarmRuleMapper.deleteHwAlarmRuleLinkByAlarmRuleIds(alarmRuleIds); - return hwAlarmRuleMapper.deleteHwAlarmRuleByAlarmRuleIds(alarmRuleIds); + return hwAlarmRuleMapper.deleteHwAlarmRuleByAlarmRuleIds(alarmRuleIds);//逻辑删除,更新状态为9 } /** diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java index 2a83f04..c32db98 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwElectronicFenceServiceImpl.java @@ -1,32 +1,30 @@ package com.ruoyi.business.service.impl; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.ruoyi.business.domain.HwAlarmInfo; +import com.ruoyi.business.domain.HwElectronicFence; import com.ruoyi.business.domain.HwFenceArea; -import com.ruoyi.business.domain.HwFenceTarget; import com.ruoyi.business.domain.VO.AlarmInfoVo; -import com.ruoyi.business.domain.VO.EleMonitorDeviceSumVo; import com.ruoyi.business.domain.VO.ElectronicFenceVo; import com.ruoyi.business.mapper.HwAlarmInfoMapper; +import com.ruoyi.business.mapper.HwElectronicFenceMapper; import com.ruoyi.business.mapper.HwFenceAreaMapper; import com.ruoyi.business.mapper.HwFenceTargetMapper; +import com.ruoyi.business.service.IHwElectronicFenceService; import com.ruoyi.common.core.constant.HwDictConstants; import com.ruoyi.common.core.utils.DateUtils; import com.ruoyi.common.datascope.annotation.DataScope; +import com.ruoyi.common.security.utils.SecurityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.ruoyi.business.mapper.HwElectronicFenceMapper; -import com.ruoyi.business.domain.HwElectronicFence; -import com.ruoyi.business.service.IHwElectronicFenceService; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + /** * 电子围栏Service业务层处理 * @@ -47,6 +45,15 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { @Autowired private HwAlarmInfoMapper hwAlarmInfoMapper; + public static final String SEPARATOR_UNDERLINE = "_"; + public static final String SEPARATOR_COMMA = ","; + public static final String KEY_FENCE_AREA_ID = "fenceAreaId"; + public static final String KEY_COORDINATES = "coordinates"; + public static final String KEY_LONGITUDE = "longitude"; + public static final String KEY_LATITUDE = "latitude"; + public static final String KEY_CENTER = "center"; + public static final String KEY_RADIUS = "radius"; + /** * 查询电子围栏 * @@ -59,8 +66,8 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { HwFenceArea queryFenceArea = new HwFenceArea(); queryFenceArea.setElectronicFenceId(electronicFence.getElectronicFenceId()); List fenceAreas = hwFenceAreaMapper.selectHwFenceAreaList(queryFenceArea); - JSONArray polygonJsonArr = new JSONArray(); - JSONArray circleJsonArr = new JSONArray(); + JSONArray polygonJsonListArr = new JSONArray(); + JSONArray circleJsonListArr = new JSONArray(); if (fenceAreas != null && !fenceAreas.isEmpty()) { int polygonIndex = 0; int circleIndex = 0; @@ -69,6 +76,8 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { String areaRange = fenceArea.getAreaRange(); if (areaShapeFlag.equals(HwDictConstants.AREA_SHAPE_FLAG_POLYGN)) { String[] polygonRangePointsArr = areaRange.split("_"); + JSONArray polygonJsonArr = new JSONArray(); + JSONObject polyJsonObject = new JSONObject(); for (String polygonRangePoint : polygonRangePointsArr) { JSONObject polygonJson = new JSONObject(); polygonJson.put("longitude", new BigDecimal(polygonRangePoint.split(",")[0])); @@ -76,10 +85,14 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { polygonJson.put("index", polygonIndex); polygonJsonArr.add(polygonJson); } + polyJsonObject.put("fenceAreaId", fenceArea.getFenceAreaId()); + polyJsonObject.put("polyJsonArr", polygonJsonArr.toString()); + polygonJsonListArr.add(polyJsonObject.toJSONString()); polygonIndex++; } else if (areaShapeFlag.equals(HwDictConstants.AREA_SHAPE_FLAG_CIRCULA)) { String[] circleRangePointsArr = areaRange.split(","); + JSONObject circleJson = new JSONObject(); JSONArray centerPointJsonArr = new JSONArray(); centerPointJsonArr.add(new BigDecimal(circleRangePointsArr[0])); @@ -87,15 +100,27 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { circleJson.put("center", centerPointJsonArr.toString()); circleJson.put("radius", new BigDecimal(circleRangePointsArr[2])); circleJson.put("index", circleIndex); - circleJsonArr.add(circleJson); + circleJson.put("fenceAreaId", fenceArea.getFenceAreaId()); + circleJsonListArr.add(circleJson); circleIndex++; } } } - electronicFence.setCircleAreaListStr(circleJsonArr.toString()); - electronicFence.setPolygonAreaListStr(polygonJsonArr.toString()); + electronicFence.setCircleAreaListStr(circleJsonListArr.toString()); + electronicFence.setPolygonAreaListStr(polygonJsonListArr.toString()); + + HwAlarmInfo queryAlarmInfo = new HwAlarmInfo(); + queryAlarmInfo.setAlarmInfoType(HwDictConstants.ALARM_INFO_TYPE_ELECTRONIC_FENCE); + queryAlarmInfo.setAlarmReleatedId(electronicFenceId); + List alarmInfos = hwAlarmInfoMapper.selectHwAlarmInfoList(queryAlarmInfo); + if (alarmInfos == null || alarmInfos.isEmpty()) { + electronicFence.setAlarmInfoFlag("0"); + } else { + electronicFence.setAlarmInfoFlag("1"); + } + return electronicFence; } @@ -185,8 +210,8 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { @Override @Transactional public int insertHwElectronicFence(HwElectronicFence hwElectronicFence) { - hwElectronicFence.setFencePushFlag("0"); - hwElectronicFence.setFenceType("3"); + hwElectronicFence.setFencePushFlag(HwDictConstants.FENCE_PUSH_FLAG_NO); + hwElectronicFence.setFenceType(HwDictConstants.FENCE_TYPE_SCENE); hwElectronicFence.setCreateTime(DateUtils.getNowDate()); int rows = hwElectronicFenceMapper.insertHwElectronicFence(hwElectronicFence); this.batchInsertFenceArea(hwElectronicFence); @@ -197,91 +222,72 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { Long electronicFenceId = hwElectronicFence.getElectronicFenceId(); String polygonAreaListStr = hwElectronicFence.getPolygonAreaListStr(); String circleAreaListStr = hwElectronicFence.getCircleAreaListStr(); - List fenceAreaList = new ArrayList<>(); - if (polygonAreaListStr != null) { - JSONArray polygonAreaJsonArray = JSON.parseArray(polygonAreaListStr); - Map polygonAreaJsonMap = new HashMap<>(); - for (Object polygonAreaObj : polygonAreaJsonArray) { - JSONObject polygonAreaJson = (JSONObject) polygonAreaObj; - Integer polygonAreaIndex = polygonAreaJson.getInteger("index"); - JSONArray polygonAreaArr = polygonAreaJsonMap.get(polygonAreaIndex); - if (polygonAreaArr == null) { - polygonAreaArr = new JSONArray(); - polygonAreaArr.add(polygonAreaJson); - polygonAreaJsonMap.put(polygonAreaIndex, polygonAreaArr); - } else { - polygonAreaArr.add(polygonAreaJson); - } - } - - //每个key有一个区域,多个点 - for (Map.Entry entry : polygonAreaJsonMap.entrySet()) { - JSONArray polygonPointList = entry.getValue(); + List fenceAreaList = new ArrayList<>();//所有需要插入的fencearea数据(包含有fenceareaid的) + List toInsertedFenceAreaList = new ArrayList<>();//只有需要insert的数据(没有fenceareaid待插入的数据) + if (polygonAreaListStr != null) {//多个多边形 + JSONArray polygonAreasJsonArray = JSON.parseArray(polygonAreaListStr); + polygonAreasJsonArray.forEach(polygonAreaJsonStr -> {//遍历多个多边形 + JSONObject polygonAreaJsonObj = (JSONObject) polygonAreaJsonStr; + Object fenceAreaId = polygonAreaJsonObj.get(KEY_FENCE_AREA_ID); StringBuilder areaRange = new StringBuilder(); - int i = 0; - for (Object polygonPointObj : polygonPointList) { - JSONObject polygonPointJson = (JSONObject) polygonPointObj; - if (i > 0) { - areaRange.append("_"); - } else { - i++; - } - areaRange.append(polygonPointJson.getString("longitude")).append(",").append(polygonPointJson.getString("latitude")); - } + + polygonAreaJsonObj.getJSONArray(KEY_COORDINATES).forEach(polyJsonPointStr -> {//遍历每个多边形的多个点 + JSONObject polyJsonPointJson = (JSONObject) polyJsonPointStr; + areaRange.append(SEPARATOR_UNDERLINE); + areaRange.append(polyJsonPointJson.getString(KEY_LONGITUDE)).append(SEPARATOR_COMMA) + .append(polyJsonPointJson.getString(KEY_LATITUDE)); + + }); + HwFenceArea polygonArea = new HwFenceArea(); polygonArea.setElectronicFenceId(electronicFenceId); polygonArea.setAreaShapeFlag(HwDictConstants.AREA_SHAPE_FLAG_POLYGN); - polygonArea.setAreaRange(areaRange.toString()); + polygonArea.setAreaRange(areaRange.toString().replaceFirst(SEPARATOR_UNDERLINE, "")); + if (fenceAreaId != null && !"".equals(fenceAreaId)) { + polygonArea.setFenceAreaId(Long.valueOf(String.valueOf(fenceAreaId))); + } else { + toInsertedFenceAreaList.add(polygonArea); + } fenceAreaList.add(polygonArea); - } + + }); + } if (circleAreaListStr != null) { JSONArray circleAreaJsonArray = JSON.parseArray(circleAreaListStr); - Map circleAreaJsonMap = new HashMap<>(); for (Object circleAreaObj : circleAreaJsonArray) { - JSONObject circleAreaJson = (JSONObject) circleAreaObj; - Integer circleAreaIndex = circleAreaJson.getInteger("index"); - JSONArray circleAreaArr = circleAreaJsonMap.get(circleAreaIndex); - if (circleAreaArr == null) { - circleAreaArr = new JSONArray(); - circleAreaArr.add(circleAreaJson); - circleAreaJsonMap.put(circleAreaIndex, circleAreaArr); - } else { - circleAreaArr.add(circleAreaJson); - } - } - - //每个key有一个区域,多个点 - for (Map.Entry entry : circleAreaJsonMap.entrySet()) { - JSONArray circlePointList = entry.getValue(); StringBuilder areaRange = new StringBuilder(); - int j = 0; - for (Object circlePointObj : circlePointList) { - JSONObject circlePointJson = (JSONObject) circlePointObj; - if (j > 0) { - areaRange.append(","); - } else { - j++; - } - JSONArray centerPointArr = circlePointJson.getJSONArray("center"); - BigDecimal longitude = (BigDecimal) centerPointArr.get(0); - BigDecimal latitude = (BigDecimal) centerPointArr.get(1); - areaRange.append(longitude).append(",") - .append(latitude).append(",") - .append(circlePointJson.getString("radius")); - } + JSONObject circleAreaJson = (JSONObject) circleAreaObj; + JSONArray centerPointArr = circleAreaJson.getJSONArray(KEY_CENTER); + String radius = circleAreaJson.getString(KEY_RADIUS); + Object fenceAreaId = circleAreaJson.get(KEY_FENCE_AREA_ID); + BigDecimal longitude = (BigDecimal) centerPointArr.get(0); + BigDecimal latitude = (BigDecimal) centerPointArr.get(1); + areaRange.append(longitude).append(SEPARATOR_COMMA) + .append(latitude).append(SEPARATOR_COMMA) + .append(radius); HwFenceArea polygonArea = new HwFenceArea(); polygonArea.setElectronicFenceId(electronicFenceId); polygonArea.setAreaShapeFlag(HwDictConstants.AREA_SHAPE_FLAG_CIRCULA); polygonArea.setAreaRange(areaRange.toString()); + if (fenceAreaId != null && !"".equals(fenceAreaId)) { + polygonArea.setFenceAreaId(Long.valueOf(String.valueOf(fenceAreaId))); + } else { + toInsertedFenceAreaList.add(polygonArea); + } fenceAreaList.add(polygonArea); } - } - - if (!fenceAreaList.isEmpty()) { - for (HwFenceArea area : fenceAreaList) { - hwFenceAreaMapper.insertHwFenceArea(area); + if (hwElectronicFence.getAlarmInfoFlag() == null || + HwDictConstants.ALARM_INFO_FLAG_NO.equals(hwElectronicFence.getAlarmInfoFlag())) { + //如果没有关联报警信息,则全量插入 + hwElectronicFenceMapper.deleteHwFenceAreaByElectronicFenceId(hwElectronicFence.getElectronicFenceId()); + if (!fenceAreaList.isEmpty()) { + hwElectronicFenceMapper.batchHwFenceArea(fenceAreaList); + } + } else {//如果有报警信息,则只插入新增的fencearea + if (!toInsertedFenceAreaList.isEmpty()) { + hwElectronicFenceMapper.batchHwFenceArea(toInsertedFenceAreaList); } } } @@ -294,14 +300,18 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { */ @Override public int updateHwElectronicFence(HwElectronicFence hwElectronicFence) { - HwFenceArea queryFenceArea = new HwFenceArea(); - queryFenceArea.setElectronicFenceId(hwElectronicFence.getElectronicFenceId()); - List dbFenceAreaList = hwFenceAreaMapper.selectHwFenceAreaList(queryFenceArea); - for (HwFenceArea dbFenceArea : dbFenceAreaList) { - hwFenceAreaMapper.deleteHwFenceAreaByFenceAreaId(dbFenceArea.getFenceAreaId()); + HwAlarmInfo queryAlarmInfo = new HwAlarmInfo(); + queryAlarmInfo.setAlarmInfoType(HwDictConstants.ALARM_INFO_TYPE_ELECTRONIC_FENCE); + queryAlarmInfo.setAlarmReleatedId(hwElectronicFence.getElectronicFenceId()); + List alarmInfos = hwAlarmInfoMapper.selectHwAlarmInfoList(queryAlarmInfo); + hwElectronicFence.setAlarmInfoFlag(HwDictConstants.ALARM_INFO_FLAG_YES); + if (alarmInfos == null || alarmInfos.isEmpty()) { + hwElectronicFence.setAlarmInfoFlag(HwDictConstants.ALARM_INFO_FLAG_NO); } + this.batchInsertFenceArea(hwElectronicFence); hwElectronicFence.setUpdateTime(DateUtils.getNowDate()); + hwElectronicFence.setUpdateBy(SecurityUtils.getUsername()); return hwElectronicFenceMapper.updateHwElectronicFence(hwElectronicFence); } @@ -314,8 +324,9 @@ public class HwElectronicFenceServiceImpl implements IHwElectronicFenceService { @Override @Transactional public int deleteHwElectronicFenceByElectronicFenceIds(Long[] electronicFenceIds) { + //逻辑删除,修改触发状态为9 int rows = hwElectronicFenceMapper.deleteHwElectronicFenceByElectronicFenceIds(electronicFenceIds); - hwElectronicFenceMapper.deleteHwFenceAreaByElectronicFenceIds(electronicFenceIds); + // hwElectronicFenceMapper.deleteHwFenceAreaByElectronicFenceIds(electronicFenceIds); return rows; } diff --git a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml index da75e1b..c1b064c 100644 --- a/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml +++ b/ruoyi-modules/hw-business/src/main/resources/mapper/business/HwElectronicFenceMapper.xml @@ -42,7 +42,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + insert into hw_fence_area( fence_area_id, electronic_fence_id, area_shape_flag, area_range) values + + ( #{item.fenceAreaId}, #{item.electronicFenceId}, #{item.areaShapeFlag}, #{item.areaRange}) + + + + + delete from hw_fence_area where electronic_fence_id = #{electronicFenceId} + + \ No newline at end of file diff --git a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmDetail.java b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmDetail.java new file mode 100644 index 0000000..a3334a7 --- /dev/null +++ b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmDetail.java @@ -0,0 +1,138 @@ +package com.ruoyi.dataprocess.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; + +/** + * 报警详情信息对象 hw_alarm_detail + * + * @author xins + * @date 2023-11-07 + */ +public class HwAlarmDetail extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 报警详细信息ID */ + private Long alarmDetailId; + + /** 关联hw_alarm_info的alarm_info_id */ + @Excel(name = "关联hw_alarm_info的alarm_info_id") + private Long alarmInfoId; + + /** 报警设备ID,关联hw_device表的device_id字段 */ + @Excel(name = "报警设备ID,关联hw_device表的device_id字段") + private Long deviceId; + + /** 设备模型功能ID */ + @Excel(name = "设备模型功能ID") + private Long modeFunctionId; + + /** 功能名称 */ + @Excel(name = "功能名称") + private String functionName; + + /** 标识符 */ + @Excel(name = "标识符") + private String functionIdentifier; + + /** 值 */ + @Excel(name = "值") + private String functionValue; + + /** 监测时间 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "监测时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date monitorTime; + + public void setAlarmDetailId(Long alarmDetailId) + { + this.alarmDetailId = alarmDetailId; + } + + public Long getAlarmDetailId() + { + return alarmDetailId; + } + public void setAlarmInfoId(Long alarmInfoId) + { + this.alarmInfoId = alarmInfoId; + } + + public Long getAlarmInfoId() + { + return alarmInfoId; + } + public void setDeviceId(Long deviceId) + { + this.deviceId = deviceId; + } + + public Long getDeviceId() + { + return deviceId; + } + public void setModeFunctionId(Long modeFunctionId) + { + this.modeFunctionId = modeFunctionId; + } + + public Long getModeFunctionId() + { + return modeFunctionId; + } + public void setFunctionName(String functionName) + { + this.functionName = functionName; + } + + public String getFunctionName() + { + return functionName; + } + public void setFunctionIdentifier(String functionIdentifier) + { + this.functionIdentifier = functionIdentifier; + } + + public String getFunctionIdentifier() + { + return functionIdentifier; + } + public void setFunctionValue(String functionValue) + { + this.functionValue = functionValue; + } + + public String getFunctionValue() + { + return functionValue; + } + public void setMonitorTime(Date monitorTime) + { + this.monitorTime = monitorTime; + } + + public Date getMonitorTime() + { + return monitorTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("alarmDetailId", getAlarmDetailId()) + .append("alarmInfoId", getAlarmInfoId()) + .append("deviceId", getDeviceId()) + .append("modeFunctionId", getModeFunctionId()) + .append("functionName", getFunctionName()) + .append("functionIdentifier", getFunctionIdentifier()) + .append("functionValue", getFunctionValue()) + .append("monitorTime", getMonitorTime()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmInfo.java b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmInfo.java index eee9846..8d6d8fb 100644 --- a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmInfo.java +++ b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmInfo.java @@ -1,6 +1,8 @@ package com.ruoyi.dataprocess.domain; import java.util.Date; +import java.util.List; + import com.fasterxml.jackson.annotation.JsonFormat; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -89,6 +91,9 @@ public class HwAlarmInfo extends BaseEntity @Excel(name = "预留字段") private String alarmInfoField; + /** 报警详情信息信息 */ + private List hwAlarmDetailList; + public void setAlarmInfoId(Long alarmInfoId) { this.alarmInfoId = alarmInfoId; @@ -252,6 +257,14 @@ public class HwAlarmInfo extends BaseEntity return alarmInfoField; } + public List getHwAlarmDetailList() { + return hwAlarmDetailList; + } + + public void setHwAlarmDetailList(List hwAlarmDetailList) { + this.hwAlarmDetailList = hwAlarmDetailList; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmRule.java b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmRule.java new file mode 100644 index 0000000..60bfc3e --- /dev/null +++ b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmRule.java @@ -0,0 +1,376 @@ +package com.ruoyi.dataprocess.domain; + +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.List; + +/** + * 报警规则对象 hw_alarm_rule + * + * @author xins + * @date 2023-11-03 + */ +public class HwAlarmRule extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 报警规则ID,主键 */ + @Excel(name = "规则ID") + private Long alarmRuleId; + + /** 规则名称 */ + @Excel(name = "规则名称") + private String alarmRuleName; + + /** 租户ID,关联hw_tenant的tenant_id */ + @Excel(name = "租户ID") + private Long tenantId; + + /** 所属场景,关联hw_scene表的scene_id字段 */ + @Excel(name = "场景ID") + private Long sceneId; + + /** 语言code,关联表hw_language的language_code字段 */ + @Excel(name = "语言code") + private String languageCode; + + /** 报警级别,关联表hw_alarm_level字段alarm_level_id */ + @Excel(name = "报警级别ID") + private Long alarmLevelId; + + /** 报警类型,关联表hw_alarm_type字段alarm_type_id */ + @Excel(name = "报警类型ID") + private Long alarmTypeId; + + /** 规则类型(1、设备模型,2、设备) */ + @Excel(name = "规则类型", readConverterExp = "1=设备模型,2=设备") + private String ruleType; + + /** 规则类型为1设备模型,关联表hw_device_mode字段device_mode_id; + 规则类型为2设备,关联表hw_device字段device_id。 */ + @Excel(name = "设备或设备模型ID") + private Long ruleDeviceId; + + /** 一共有几个属性规则 */ + private Long ruleFunctionTotal; + + /** 表达式,例如:{}>60 or {}<-88 */ + @Excel(name = "触发规则") + private String triggerExpression; + + /** 联动标识(1、是,0、否) */ + @Excel(name = "联动标识", readConverterExp = "1=是,0=否") + private String linkFlag; + + /** 报警启用状态(1、是,0、否) */ + @Excel(name = "状态", readConverterExp = "1=启用,0=停用") + private String alarmRuleStatus; + + /** 报警推送标识(1、是,0、否) */ + @Excel(name = "报警推送标识", readConverterExp = "1=是,0=否") + private String alarmPushFlag; + + /** 报警推送内容 */ + private String alarmPushContent; + + /** 恢复正常推送内容 */ + private String alarmRecoverContent; + + /** 预留字段 */ + private String alarmRuleField; + + /** 报警规则联动信息信息 */ + private List hwAlarmRuleLinkList; + + + public String ruleModeFunctionIdentifier; + + private String triggerCondition; + + private Double triggerDataA; + + private Double triggerDataB; + + @Excel(name = "所属租户") + private String tenantName; + + @Excel(name = "所属场景") + private String sceneName; + + @Excel(name = "报警类型") + private String alarmTypeName; + + @Excel(name = "报警级别") + private String alarmLevelName; + + @Excel(name = "设备") + private String ruleDeviceName; + + public void setAlarmRuleId(Long alarmRuleId) + { + this.alarmRuleId = alarmRuleId; + } + + public Long getAlarmRuleId() + { + return alarmRuleId; + } + public void setAlarmRuleName(String alarmRuleName) + { + this.alarmRuleName = alarmRuleName; + } + + public String getAlarmRuleName() + { + return alarmRuleName; + } + public void setTenantId(Long tenantId) + { + this.tenantId = tenantId; + } + + public Long getTenantId() + { + return tenantId; + } + public void setSceneId(Long sceneId) + { + this.sceneId = sceneId; + } + + public Long getSceneId() + { + return sceneId; + } + public void setLanguageCode(String languageCode) + { + this.languageCode = languageCode; + } + + public String getLanguageCode() + { + return languageCode; + } + public void setAlarmLevelId(Long alarmLevelId) + { + this.alarmLevelId = alarmLevelId; + } + + public Long getAlarmLevelId() + { + return alarmLevelId; + } + public void setAlarmTypeId(Long alarmTypeId) + { + this.alarmTypeId = alarmTypeId; + } + + public Long getAlarmTypeId() + { + return alarmTypeId; + } + public void setRuleType(String ruleType) + { + this.ruleType = ruleType; + } + + public String getRuleType() + { + return ruleType; + } + public void setRuleDeviceId(Long ruleDeviceId) + { + this.ruleDeviceId = ruleDeviceId; + } + + public Long getRuleDeviceId() + { + return ruleDeviceId; + } + public void setRuleFunctionTotal(Long ruleFunctionTotal) + { + this.ruleFunctionTotal = ruleFunctionTotal; + } + + public Long getRuleFunctionTotal() + { + return ruleFunctionTotal; + } + public void setTriggerExpression(String triggerExpression) + { + this.triggerExpression = triggerExpression; + } + + public String getTriggerExpression() + { + return triggerExpression; + } + public void setLinkFlag(String linkFlag) + { + this.linkFlag = linkFlag; + } + + public String getLinkFlag() + { + return linkFlag; + } + public void setAlarmRuleStatus(String alarmRuleStatus) + { + this.alarmRuleStatus = alarmRuleStatus; + } + + public String getAlarmRuleStatus() + { + return alarmRuleStatus; + } + public void setAlarmPushFlag(String alarmPushFlag) + { + this.alarmPushFlag = alarmPushFlag; + } + + public String getAlarmPushFlag() + { + return alarmPushFlag; + } + public void setAlarmPushContent(String alarmPushContent) + { + this.alarmPushContent = alarmPushContent; + } + + public String getAlarmPushContent() + { + return alarmPushContent; + } + public void setAlarmRecoverContent(String alarmRecoverContent) + { + this.alarmRecoverContent = alarmRecoverContent; + } + + public String getAlarmRecoverContent() + { + return alarmRecoverContent; + } + public void setAlarmRuleField(String alarmRuleField) + { + this.alarmRuleField = alarmRuleField; + } + + public String getAlarmRuleField() + { + return alarmRuleField; + } + + public List getHwAlarmRuleLinkList() + { + return hwAlarmRuleLinkList; + } + + public void setHwAlarmRuleLinkList(List hwAlarmRuleLinkList) + { + this.hwAlarmRuleLinkList = hwAlarmRuleLinkList; + } + + public String getRuleModeFunctionIdentifier() { + return ruleModeFunctionIdentifier; + } + + public void setRuleModeFunctionIdentifier(String ruleModeFunctionIdentifier) { + this.ruleModeFunctionIdentifier = ruleModeFunctionIdentifier; + } + + public String getTriggerCondition() { + return triggerCondition; + } + + public void setTriggerCondition(String triggerCondition) { + this.triggerCondition = triggerCondition; + } + + public Double getTriggerDataA() { + return triggerDataA; + } + + public void setTriggerDataA(Double triggerDataA) { + this.triggerDataA = triggerDataA; + } + + public Double getTriggerDataB() { + return triggerDataB; + } + + public void setTriggerDataB(Double triggerDataB) { + this.triggerDataB = triggerDataB; + } + + public String getTenantName() { + return tenantName; + } + + public void setTenantName(String tenantName) { + this.tenantName = tenantName; + } + + public String getSceneName() { + return sceneName; + } + + public void setSceneName(String sceneName) { + this.sceneName = sceneName; + } + + public String getAlarmTypeName() { + return alarmTypeName; + } + + public void setAlarmTypeName(String alarmTypeName) { + this.alarmTypeName = alarmTypeName; + } + + public String getAlarmLevelName() { + return alarmLevelName; + } + + public void setAlarmLevelName(String alarmLevelName) { + this.alarmLevelName = alarmLevelName; + } + + public String getRuleDeviceName() { + return ruleDeviceName; + } + + public void setRuleDeviceName(String ruleDeviceName) { + this.ruleDeviceName = ruleDeviceName; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("alarmRuleId", getAlarmRuleId()) + .append("alarmRuleName", getAlarmRuleName()) + .append("tenantId", getTenantId()) + .append("sceneId", getSceneId()) + .append("languageCode", getLanguageCode()) + .append("alarmLevelId", getAlarmLevelId()) + .append("alarmTypeId", getAlarmTypeId()) + .append("ruleType", getRuleType()) + .append("ruleDeviceId", getRuleDeviceId()) + .append("ruleFunctionTotal", getRuleFunctionTotal()) + .append("triggerExpression", getTriggerExpression()) + .append("linkFlag", getLinkFlag()) + .append("alarmRuleStatus", getAlarmRuleStatus()) + .append("alarmPushFlag", getAlarmPushFlag()) + .append("alarmPushContent", getAlarmPushContent()) + .append("alarmRecoverContent", getAlarmRecoverContent()) + .append("remark", getRemark()) + .append("createBy", getCreateBy()) + .append("createTime", getCreateTime()) + .append("updateBy", getUpdateBy()) + .append("updateTime", getUpdateTime()) + .append("alarmRuleField", getAlarmRuleField()) + .append("hwAlarmRuleLinkList", getHwAlarmRuleLinkList()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmRuleLink.java b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmRuleLink.java new file mode 100644 index 0000000..9f08cfa --- /dev/null +++ b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/domain/HwAlarmRuleLink.java @@ -0,0 +1,142 @@ +package com.ruoyi.dataprocess.domain; + +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 报警规则联动信息对象 hw_alarm_rule_link + * + * @author xins + * @date 2023-11-03 + */ +public class HwAlarmRuleLink extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 报警规则关联ID,主键 */ + private Long ruleLinkId; + + /** 报警规则ID,关联hw_alarm_rule的alarm_rule_id */ + @Excel(name = "报警规则ID,关联hw_alarm_rule的alarm_rule_id") + private Long alarmRuleId; + + /** 联动类型(1、控制,2、采集) */ + @Excel(name = "联动类型", readConverterExp = "1=、控制,2、采集") + private String linkType; + + /** 联动设备,关联表hw_device字段device_id */ + @Excel(name = "联动设备,关联表hw_device字段device_id") + private Long linkDeviceId; + + /** 联动设备功能,关联表hw_device_mode_function字段mode_function_id */ + @Excel(name = "联动设备功能,关联表hw_device_mode_function字段mode_function_id") + private Long linkDeviceFunctionId; + + /** 标识符(支持大小写字母、数字和下划线,对外暂时不超过30个字符) */ + @Excel(name = "标识符", readConverterExp = "支=持大小写字母、数字和下划线,对外暂时不超过30个字符") + private String linkDeviceFunctionIdentifier; + + /** 联动设备服务的参数值,json格式保存 */ + @Excel(name = "联动设备服务的参数值,json格式保存") + private String linkDeviceFunctionData; + + private String linkDeviceName; + + private String linkDeviceModeFunctionName; + + + public void setRuleLinkId(Long ruleLinkId) + { + this.ruleLinkId = ruleLinkId; + } + + public Long getRuleLinkId() + { + return ruleLinkId; + } + public void setAlarmRuleId(Long alarmRuleId) + { + this.alarmRuleId = alarmRuleId; + } + + public Long getAlarmRuleId() + { + return alarmRuleId; + } + public void setLinkType(String linkType) + { + this.linkType = linkType; + } + + public String getLinkType() + { + return linkType; + } + public void setLinkDeviceId(Long linkDeviceId) + { + this.linkDeviceId = linkDeviceId; + } + + public Long getLinkDeviceId() + { + return linkDeviceId; + } + public void setLinkDeviceFunctionId(Long linkDeviceFunctionId) + { + this.linkDeviceFunctionId = linkDeviceFunctionId; + } + + public Long getLinkDeviceFunctionId() + { + return linkDeviceFunctionId; + } + public void setLinkDeviceFunctionIdentifier(String linkDeviceFunctionIdentifier) + { + this.linkDeviceFunctionIdentifier = linkDeviceFunctionIdentifier; + } + + public String getLinkDeviceFunctionIdentifier() + { + return linkDeviceFunctionIdentifier; + } + public void setLinkDeviceFunctionData(String linkDeviceFunctionData) + { + this.linkDeviceFunctionData = linkDeviceFunctionData; + } + + public String getLinkDeviceFunctionData() + { + return linkDeviceFunctionData; + } + + public String getLinkDeviceName() { + return linkDeviceName; + } + + public void setLinkDeviceName(String linkDeviceName) { + this.linkDeviceName = linkDeviceName; + } + + public String getLinkDeviceModeFunctionName() { + return linkDeviceModeFunctionName; + } + + public void setLinkDeviceModeFunctionName(String linkDeviceModeFunctionName) { + this.linkDeviceModeFunctionName = linkDeviceModeFunctionName; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("ruleLinkId", getRuleLinkId()) + .append("alarmRuleId", getAlarmRuleId()) + .append("linkType", getLinkType()) + .append("linkDeviceId", getLinkDeviceId()) + .append("linkDeviceFunctionId", getLinkDeviceFunctionId()) + .append("linkDeviceFunctionIdentifier", getLinkDeviceFunctionIdentifier()) + .append("linkDeviceFunctionData", getLinkDeviceFunctionData()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/mapper/HwAlarmInfoMapper.java b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/mapper/HwAlarmInfoMapper.java index 9c8c387..cda6958 100644 --- a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/mapper/HwAlarmInfoMapper.java +++ b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/mapper/HwAlarmInfoMapper.java @@ -1,7 +1,10 @@ package com.ruoyi.dataprocess.mapper; +import com.ruoyi.dataprocess.domain.HwAlarmDetail; import com.ruoyi.dataprocess.domain.HwAlarmInfo; +import java.util.List; + /** * 报警信息Mapper接口 * @@ -17,4 +20,12 @@ public interface HwAlarmInfoMapper { */ public int insertHwAlarmInfo(HwAlarmInfo hwAlarmInfo); + /** + * 批量新增报警详情信息 + * + * @param hwAlarmDetailList 报警详情信息列表 + * @return 结果 + */ + public int batchHwAlarmDetail(List hwAlarmDetailList); + } diff --git a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/mapper/HwAlarmRuleMapper.java b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/mapper/HwAlarmRuleMapper.java new file mode 100644 index 0000000..5d93bc8 --- /dev/null +++ b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/mapper/HwAlarmRuleMapper.java @@ -0,0 +1,23 @@ +package com.ruoyi.dataprocess.mapper; + + +import com.ruoyi.dataprocess.domain.HwAlarmRule; + +import java.util.List; + +/** + * 报警规则Mapper接口 + * + * @author xins + * @date 2023-11-03 + */ +public interface HwAlarmRuleMapper { + /** + * 查询报警规则列表with联动列表 + * + * @param hwAlarmRule 报警规则 + * @return 报警规则集合 + */ + public List selectHwAlarmRulesWithLink(HwAlarmRule hwAlarmRule); + +} diff --git a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/IDataProcessService.java b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/IDataProcessService.java index 6a67c02..9de99fd 100644 --- a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/IDataProcessService.java +++ b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/IDataProcessService.java @@ -8,12 +8,13 @@ public interface IDataProcessService { * @param: imagePatterns * @param: imageDomain ruoyifile的domain * @param: imagePrefix ruoyifile的prefix + * @param: topic 发布主题,用来获取网关设备devicecode * @description * @author xins * @date 2023-08-31 16:16 */ public int processBusinessData(String jsonData, String imagePath, - String imagePatterns,String imageDomain,String imagePrefix); + String imagePatterns, String imageDomain, String imagePrefix,String topic); public void testBase64(String jsonData,String imagePath, String imagePatterns,String imageDomain,String imagePrefix); diff --git a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/impl/DataProcessServiceImpl.java b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/impl/DataProcessServiceImpl.java index 793c01b..fa93936 100644 --- a/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/impl/DataProcessServiceImpl.java +++ b/ruoyi-modules/hw-data-process/src/main/java/com/ruoyi/dataprocess/service/impl/DataProcessServiceImpl.java @@ -8,30 +8,30 @@ import com.ruoyi.common.core.constant.SecurityConstants; import com.ruoyi.common.core.constant.TdEngineConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.enums.ResultEnums; +import com.ruoyi.common.core.utils.RegexUtils; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.dataprocess.amap.LocationVo; import com.ruoyi.dataprocess.amap.PositionUtils; import com.ruoyi.dataprocess.amap.PositionVo; import com.ruoyi.dataprocess.common.ImageUtils; -import com.ruoyi.dataprocess.domain.HwAlarmInfo; -import com.ruoyi.dataprocess.domain.HwDevice; -import com.ruoyi.dataprocess.domain.HwElectronicFence; -import com.ruoyi.dataprocess.domain.HwFenceArea; -import com.ruoyi.dataprocess.mapper.HwAlarmInfoMapper; -import com.ruoyi.dataprocess.mapper.HwDeviceMapper; -import com.ruoyi.dataprocess.mapper.HwElectronicFenceMapper; -import com.ruoyi.dataprocess.mapper.HwFenceAreaMapper; +import com.ruoyi.dataprocess.domain.*; +import com.ruoyi.dataprocess.mapper.*; import com.ruoyi.dataprocess.service.IDataProcessService; import com.ruoyi.tdengine.api.RemoteTdEngineService; import com.ruoyi.tdengine.api.domain.TdField; import com.ruoyi.tdengine.api.domain.TdTableVo; +import com.sun.org.apache.xpath.internal.operations.Bool; import org.apache.commons.codec.binary.Base64; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import javax.script.ScriptEngine; +import javax.script.ScriptEngineManager; +import javax.script.ScriptException; import java.io.IOException; import java.math.BigDecimal; import java.text.SimpleDateFormat; @@ -39,6 +39,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; /** * @Description: 数据处理业务类 @@ -66,19 +67,26 @@ public class DataProcessServiceImpl implements IDataProcessService { @Autowired private HwAlarmInfoMapper hwAlarmInfoMapper; + @Autowired + private HwAlarmRuleMapper hwAlarmRuleMapper; + + @Autowired + private StringRedisTemplate redisTemplate; + /** * @param: jsonData * @param: imagePath ruoyifile的上传地址 * @param: imagePatterns * @param: imageDomain ruoyifile的domain * @param: imagePrefix ruoyifile的prefix + * @param: topic 发布主题,用来获取网关设备devicecode * @description * @author xins * @date 2023-08-31 16:16 */ @Override public int processBusinessData(String jsonData, String imagePath, - String imagePatterns, String imageDomain, String imagePrefix) { + String imagePatterns, String imageDomain, String imagePrefix, String topic) { JSONObject json = JSON.parseObject(jsonData); Long ts = json.getLong(TdEngineConstants.PAYLOAD_TS); String tsStr = String.valueOf(ts); @@ -115,6 +123,7 @@ public class DataProcessServiceImpl implements IDataProcessService { dataValueJson.remove(TdEngineConstants.PAYLOAD_DEVICE_CODE); TdTableVo tdTableVo = new TdTableVo(); List schemaFields = new ArrayList<>(); + List alarmSchemaFields = new ArrayList<>(); //添加timestamp字段,默认字段名称是ts,协议上传的key是timestamp TdField firstTdField = new TdField(); @@ -139,6 +148,7 @@ public class DataProcessServiceImpl implements IDataProcessService { continue; } + if (value instanceof String) { String valueStr = (String) value; if (StringUtils.isNotBlank(valueStr)) { @@ -183,6 +193,8 @@ public class DataProcessServiceImpl implements IDataProcessService { longitude = value; } else if (key.equalsIgnoreCase(HwDictConstants.DEFAULT_FUNCTION_LATITUDE_IDENTIFIER)) { latitude = value; + } else { + alarmSchemaFields.add(tdField); } } } @@ -198,11 +210,16 @@ public class DataProcessServiceImpl implements IDataProcessService { logger.error("Insert data Exception: {},data:{}", insertResult.getMsg(), jsonData); } + //校验电子围栏 if (longitude != null && latitude != null) { checkElectronicFence(deviceId, tenantId, monitorUnitId, sceneId, longitude, latitude, ts); } + //校验设备报警信息 + checkAlarm(deviceId, alarmSchemaFields, tenantId, sceneId, monitorUnitId, topic, deviceCode); + } catch (Exception e) { + e.printStackTrace(); logger.error("deviceCode:{},errorMsg:{},data:{}", deviceCode, e.getMessage(), jsonData); } } @@ -321,6 +338,143 @@ public class DataProcessServiceImpl implements IDataProcessService { } } + + /** + * @param: deviceId + * @param: alarmFields + * @description 校验报警 + * @author xins + * @date 2023-11-07 10:15 + */ + private void checkAlarm(Long deviceId, List alarmFields, + Long tenantId, Long sceneId, Long monitorUnitId, String topic, String subDeviceCode) { + HwAlarmRule queryAlarmRule = new HwAlarmRule(); + queryAlarmRule.setRuleDeviceId(deviceId); + queryAlarmRule.setRuleType(HwDictConstants.ALARM_RULE_RULE_TYPE_DEVICE); + queryAlarmRule.setAlarmRuleStatus(HwDictConstants.ALARM_RULE_STATUS_ENABLE); + List alarmRules = hwAlarmRuleMapper.selectHwAlarmRulesWithLink(queryAlarmRule); + + ScriptEngineManager manager = new ScriptEngineManager(); + ScriptEngine engine = manager.getEngineByName("js"); + + if (alarmRules != null) { + Date currentDate = new Date(); + for (HwAlarmRule alarmRule : alarmRules) { + String triggerExpression = alarmRule.getTriggerExpression() + .replaceAll("and", "&&") + .replaceAll("or", "||"); + AtomicBoolean isAlarmed = new AtomicBoolean(false); + List alarmDetails = new ArrayList(); + + for (TdField alarmField : alarmFields) { + String fieldName = alarmField.getFieldName(); + Object filedValue = alarmField.getFieldValue(); + if (triggerExpression.contains("{" + fieldName + "}")) { + isAlarmed.set(true); + triggerExpression = triggerExpression.replaceAll("\\{" + fieldName + "\\}", String.valueOf(filedValue)); + HwAlarmDetail alarmDetail = new HwAlarmDetail(); + alarmDetail.setDeviceId(deviceId); + alarmDetail.setFunctionIdentifier(fieldName); + alarmDetail.setFunctionValue(String.valueOf(filedValue)); + alarmDetail.setMonitorTime(currentDate); + alarmDetails.add(alarmDetail); + } + } + + if (isAlarmed.get() && !triggerExpression.contains("{") + && RegexUtils.findSymbolInText(triggerExpression).size() > 0 + && RegexUtils.findNumberInText(triggerExpression).size() > 0) { + + Boolean triggerExpressionBool = null; + try { + triggerExpressionBool = (Boolean) engine.eval(triggerExpression); + } catch (ScriptException e) { + throw new RuntimeException(e); + } + if (triggerExpressionBool) { + HwAlarmInfo alarmInfo = new HwAlarmInfo(); + alarmInfo.setAlarmInfoType(HwDictConstants.ALARM_INFO_TYPE_DEVICE); + alarmInfo.setAlarmReleatedId(alarmRule.getAlarmRuleId()); + alarmInfo.setDeviceId(deviceId); + alarmInfo.setMonitorUnitId(monitorUnitId); + alarmInfo.setTenantId(tenantId); + alarmInfo.setSceneId(sceneId); + alarmInfo.setAlarmLevelId(alarmRule.getAlarmLevelId()); + alarmInfo.setAlarmTypeId(alarmRule.getAlarmTypeId()); + alarmInfo.setHwAlarmDetailList(alarmDetails); + alarmInfo.setHandleStatus(HwDictConstants.ALARM_HANDLE_STATUS_NO); + alarmInfo.setCreateTime(currentDate); + alarmInfo.setAlarmTime(currentDate); + hwAlarmInfoMapper.insertHwAlarmInfo(alarmInfo); + this.insertHwAlarmDetail(alarmInfo); + this.handleAlarmLink(alarmRule, topic, subDeviceCode); + } + } + } + } + } + + /** + * 新增报警详情信息信息 + * + * @param hwAlarmInfo 报警信息对象 + */ + private void insertHwAlarmDetail(HwAlarmInfo hwAlarmInfo) { + List hwAlarmDetailList = hwAlarmInfo.getHwAlarmDetailList(); + Long alarmInfoId = hwAlarmInfo.getAlarmInfoId(); + if (StringUtils.isNotNull(hwAlarmDetailList)) { + List list = new ArrayList(); + for (HwAlarmDetail hwAlarmDetail : hwAlarmDetailList) { + hwAlarmDetail.setAlarmInfoId(alarmInfoId); + list.add(hwAlarmDetail); + } + if (list.size() > 0) { + hwAlarmInfoMapper.batchHwAlarmDetail(list); + } + } + } + + /** + * @param: alarmRule + * @param: topic + * @param: subDeviceCode + * @description 处理报警规则联动设备 + * @author xins + * @date 2023-11-07 16:39 + */ + private void handleAlarmLink(HwAlarmRule alarmRule, String topic, String subDeviceCode) { + if (alarmRule.getLinkFlag().equals(HwDictConstants.ALARM_RULE_LINK_FLAG_YES)) { + List alarmRuleLinks = alarmRule.getHwAlarmRuleLinkList(); + alarmRuleLinks.forEach(alarmRuleLink -> { + this.publishControlCommand(topic, subDeviceCode, alarmRuleLink.getLinkDeviceFunctionIdentifier()); + }); + } + } + + /** + * @param: topic 上报数据的主题 + * @param: subDeviceCode 子设备或直连设备设备编号 + * @param: serviceFunctionIdentifier + * @description 联动设备发送指令 + * @author xins + * @date 2023-11-07 16:28 + */ + private void publishControlCommand(String topic, String subDeviceCode, String serviceFunctionIdentifier) { + JSONObject controlCommandJson = new JSONObject(); + String controlCommandTopic = topic.replace(HwDictConstants.TOPIC_TYPE_DATA_POSTFIX, HwDictConstants.TOPIC_TYPE_COMMAND_POSTFIX); + JSONObject payloadJson = new JSONObject(); + JSONObject paramJson = new JSONObject(); + payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_MID_KEY, subDeviceCode); + payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_TIMESTAMP_KEY, System.currentTimeMillis() / 1000);//单位:s + payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_TYPE_KEY, serviceFunctionIdentifier); + payloadJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_PARAM_KEY, paramJson); + + controlCommandJson.put(HwDictConstants.CONTROL_COMMAND_TOPIC_KEY, controlCommandTopic); + controlCommandJson.put(HwDictConstants.CONTROL_COMMAND_PAYLOAD_KEY, payloadJson.toString()); + + redisTemplate.convertAndSend(HwDictConstants.CONTROL_COMMAND_REDIS_KEY, controlCommandJson.toString()); + } + @Override public void testBase64(String jsonData, String imagePath, String imagePatterns, String imageDomain, String imagePrefix) { JSONObject json = JSON.parseObject(jsonData); @@ -355,6 +509,7 @@ public class DataProcessServiceImpl implements IDataProcessService { } } + public static void main(String[] args) { System.out.println(System.currentTimeMillis()); SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); diff --git a/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwAlarmInfoMapper.xml b/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwAlarmInfoMapper.xml index 6d8ca2a..5042486 100644 --- a/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwAlarmInfoMapper.xml +++ b/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwAlarmInfoMapper.xml @@ -77,4 +77,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + insert into hw_alarm_detail( alarm_detail_id, alarm_info_id, device_id, mode_function_id, function_name, function_identifier, function_value, monitor_time) values + + ( #{item.alarmDetailId}, #{item.alarmInfoId}, #{item.deviceId}, #{item.modeFunctionId}, #{item.functionName}, #{item.functionIdentifier}, #{item.functionValue}, #{item.monitorTime}) + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwAlarmRuleMapper.xml b/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwAlarmRuleMapper.xml new file mode 100644 index 0000000..10ed624 --- /dev/null +++ b/ruoyi-modules/hw-data-process/src/main/resources/mapper/dataprocess/HwAlarmRuleMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select alarm_rule_id, alarm_rule_name, tenant_id, scene_id, language_code, alarm_level_id, alarm_type_id, rule_type, rule_device_id, rule_function_total, trigger_expression, link_flag, alarm_rule_status, alarm_push_flag, alarm_push_content, alarm_recover_content, remark, create_by, create_time, update_by, update_time, alarm_rule_field from hw_alarm_rule + + + + + + + \ No newline at end of file diff --git a/ruoyi-ui/src/api/business/alarmRule.js b/ruoyi-ui/src/api/business/alarmRule.js index d7c64b1..e6108c2 100644 --- a/ruoyi-ui/src/api/business/alarmRule.js +++ b/ruoyi-ui/src/api/business/alarmRule.js @@ -42,3 +42,44 @@ export function delAlarmRule(alarmRuleId) { method: 'delete' }) } + + +// 查询场景信息列表供查询页面选择使用(例如下拉列表) +export function getScenes(query) { + return request({ + url: '/business/alarmRule/getScenes', + method: 'get', + params: query + }) +} + +// 查询场景信息列表供编辑页面选择使用(例如下拉列表) +export function getEditedScenes(query) { + return request({ + url: '/business/alarmRule/getEditedScenes', + method: 'get', + params: query + }) +} + +export function getSelectListBySceneId(sceneId) { + return request({ + url: '/business/alarmRule/getSelectListBySceneId/' + sceneId, + method: 'get' + }) +} + +export function getDeviceModeByDeviceId(deviceId) { + return request({ + url: '/business/alarmRule/getDeviceModeByDeviceId/' + deviceId, + method: 'get' + }) +} + +export function getModeFunctionParametersByModeFunctionId(modeFunctionId) { + return request({ + url: '/business/alarmRule/getModeFunctionParametersByModeFunctionId/' + modeFunctionId, + method: 'get' + }) +} + diff --git a/ruoyi-ui/src/views/business/alarmRule/index.vue b/ruoyi-ui/src/views/business/alarmRule/index.vue index 5a02191..412fc97 100644 --- a/ruoyi-ui/src/views/business/alarmRule/index.vue +++ b/ruoyi-ui/src/views/business/alarmRule/index.vue @@ -192,7 +192,7 @@ + :disabled="sceneDisabled">j - + - + - + :disabled="editedDisabled"> - + - + - + @@ -393,7 +394,7 @@ - + @input="editedLinkDeviceModeServiceChange"> { this.form = response.data; + this.editedDisabled = response.data.alarmInfoFlag === "1"; this.getEditedSelectListBySceneId(this.form.sceneId); this.getDeviceModeByDeviceId(this.form.ruleDeviceId); this.triggerDataBVisibleJudge(this.form.triggerCondition); diff --git a/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue b/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue index 722e8b0..f573063 100644 --- a/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue +++ b/ruoyi-ui/src/views/business/electronicFence/editElectronicFence.vue @@ -72,13 +72,14 @@ export default { //编辑页面场景列表 editedScenes: [], sceneDisable: true, + alarmInfoFlag: '1',//是否关联报警信息 // 表单校验 rules: { electronicFenceName: [ {required: true, message: "电子围栏名称不能为空", trigger: "blur"} ], sceneId: [ - {required: true, message: "所属场景,关联hw_scene表的scene_id字段不能为空", trigger: "blur"} + {required: true, message: "所属场景不能为空", trigger: "blur"} ], fenceType: [ {required: true, message: "规则类型不能为空", trigger: "change"} @@ -96,7 +97,7 @@ export default { {required: true, message: "区域形状不能为空", trigger: "blur"} ], fencePushFlag: [ - {required: true, message: "报警推送标识(1、是,0、否)不能为空", trigger: "blur"} + {required: true, message: "报警推送标识不能为空", trigger: "blur"} ], } } @@ -201,10 +202,18 @@ export default { }) let thisPolygon = new AMap.Polygon({path: e, extData: {id: id}}); thisPolygon.on('dblclick', () => { + if(this.alarmInfoFlag === "1"){ + this.$modal.msgWarning("电子围栏已经有报警信息,不能修改电子围栏区域") + return; + } polyEditor.setTarget(thisPolygon); polyEditor.open(); }) thisPolygon.on('rightclick', () => { + if(this.alarmInfoFlag === "1"){ + this.$modal.msgWarning("电子围栏已经有报警信息,不能删除电子围栏区域") + return; + } polyEditor.close(); map.remove(thisPolygon); }) @@ -217,10 +226,18 @@ export default { e.center = [lng, lat] let thisCircle = new AMap.Circle({center: e.center, radius: e.radius, extData: {id: id}}); thisCircle.on('dblclick', () => { + if(this.alarmInfoFlag === "1"){ + this.$modal.msgWarning("电子围栏已经有报警信息,不能修改电子围栏区域") + return; + } CircleEditor.setTarget(thisCircle); CircleEditor.open(); }) thisCircle.on('rightclick', () => { + if(this.alarmInfoFlag === "1"){ + this.$modal.msgWarning("电子围栏已经有报警信息,不能删除电子围栏区域") + return; + } CircleEditor.close(); map.remove(thisCircle); }) @@ -274,15 +291,14 @@ export default { getEditedElectronicFence() { const electronicFenceId = this.$route.params && this.$route.params.electronicFenceId; - if (electronicFenceId != undefined) { + if (electronicFenceId !== undefined) { this.sceneDisable = true; getElectronicFence(electronicFenceId).then(response => { this.form = response.data; + this.alarmInfoFlag = response.data.alarmInfoFlag; let circleAreaList = JSON.parse(response.data.circleAreaListStr) let polygonAreaListArr = JSON.parse(response.data.polygonAreaListStr) - let polygonData1 = {} - let polygonData = [] polygonAreaListArr.forEach(e1 => { let polygonAreaListJson = JSON.parse(e1); let polyJsonArr = JSON.parse(polygonAreaListJson["polyJsonArr"]); @@ -302,6 +318,7 @@ export default { }); } else { this.sceneDisable = false; + this.alarmInfoFlag = "0"; } }, diff --git a/ruoyi-ui/src/views/business/electronicFence/index.vue b/ruoyi-ui/src/views/business/electronicFence/index.vue index 2f9506e..7375cb0 100644 --- a/ruoyi-ui/src/views/business/electronicFence/index.vue +++ b/ruoyi-ui/src/views/business/electronicFence/index.vue @@ -60,6 +60,18 @@ v-hasPermi="['business:electronicFence:edit']" >修改 + + 删除 + + @@ -246,7 +258,8 @@ export default { handleUpdate(row) { const electronicFenceId = row.electronicFenceId || this.ids let electronicFenceName = row.electronicFenceName; - this.$tab.openPage("修改电子围栏[" + electronicFenceName + "]", '/electronicFence/fence-edit/index/' + electronicFenceId); + const params = {pageNum: this.queryParams.pageNum}; + this.$tab.openPage("修改电子围栏[" + electronicFenceName + "]", '/electronicFence/fence-edit/index/' + electronicFenceId,params); }, /** 删除按钮操作 */