若依微服务1.9

business:
1、电子围栏编辑时:
   1)、如果有关联报警信息,则不能修改和删除区域信息
   2)、在保存区域信息fencearea时,需要将之前的fenceareaid返回保存,以免修改了fenceareaId
   3)、删除时为逻辑删除
2、设备报警规则
   1)、编辑时判断是否有报警信息关联,如果有关联则不能修改设备、设备属性、条件、A值和B值。
   2)、编辑时不能修改场景
   3)、删除时为逻辑删除
dataprocess:
处理设备报警规则
dev 1.9
xins 1 year ago
parent 15a5c13d70
commit 08032a81eb

@ -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";//无关联报警信息;
}

@ -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<String> findSymbolInText(String content){
Matcher matcher = P_SYMBOL.matcher(content);
List<String> numbers = new ArrayList<String>();
while (matcher.find()) {
String match = matcher.group();
numbers.add(match);
}
return numbers;
}
public static final List<String> findNumberInText(String content){
Matcher matcher = P_NUMBER.matcher(content);
List<String> numbers = new ArrayList<String>();

@ -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)

@ -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)

@ -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<HwElectronicFence> selectHwElectronicFenceJoinList(HwElectronicFence hwElectronicFence);
/**
*
*
* @param hwFenceAreaList
* @return
*/
public int batchHwFenceArea(List<HwFenceArea> hwFenceAreaList);
/**
*
*
* @param electronicFenceId ID
* @return
*/
public int deleteHwFenceAreaByElectronicFenceId(Long electronicFenceId);
}

@ -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<HwAlarmInfo> 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<HwAlarmInfo> 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
}
/**

@ -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<HwFenceArea> 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<HwAlarmInfo> 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<HwFenceArea> fenceAreaList = new ArrayList<>();
if (polygonAreaListStr != null) {
JSONArray polygonAreaJsonArray = JSON.parseArray(polygonAreaListStr);
Map<Integer, JSONArray> 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<Integer, JSONArray> entry : polygonAreaJsonMap.entrySet()) {
JSONArray polygonPointList = entry.getValue();
List<HwFenceArea> fenceAreaList = new ArrayList<>();//所有需要插入的fencearea数据包含有fenceareaid的
List<HwFenceArea> 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<Integer, JSONArray> 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<Integer, JSONArray> 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<HwFenceArea> 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<HwAlarmInfo> 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;
}

@ -43,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectHwElectronicFenceList" parameterType="HwElectronicFence" resultMap="HwElectronicFenceResult">
<include refid="selectHwElectronicFenceVo"/>
<where>
trigger_status !='9'
<if test="electronicFenceName != null and electronicFenceName != ''"> and electronic_fence_name like concat('%', #{electronicFenceName}, '%')</if>
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
@ -137,7 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteHwElectronicFenceByElectronicFenceIds" parameterType="String">
delete from hw_electronic_fence where electronic_fence_id in
update hw_electronic_fence set trigger_status='9' where electronic_fence_id in
<foreach item="electronicFenceId" collection="array" open="(" separator="," close=")">
#{electronicFenceId}
</foreach>
@ -193,6 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from hw_electronic_fence hef
left join hw_scene hs on hef.scene_id = hs.scene_id
<where>
hef.trigger_status !='9'
<if test="electronicFenceName != null and electronicFenceName != ''"> and hef.electronic_fence_name like concat('%', #{electronicFenceName}, '%')</if>
<if test="tenantId != null "> and hef.tenant_id = #{tenantId}</if>
<if test="sceneId != null "> and hef.scene_id = #{sceneId}</if>
@ -211,4 +213,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by hef.electronic_fence_id desc
</select>
<insert id="batchHwFenceArea">
insert into hw_fence_area( fence_area_id, electronic_fence_id, area_shape_flag, area_range) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.fenceAreaId}, #{item.electronicFenceId}, #{item.areaShapeFlag}, #{item.areaRange})
</foreach>
</insert>
<delete id="deleteHwFenceAreaByElectronicFenceId" parameterType="Long">
delete from hw_fence_area where electronic_fence_id = #{electronicFenceId}
</delete>
</mapper>

@ -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();
}
}

@ -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<HwAlarmDetail> hwAlarmDetailList;
public void setAlarmInfoId(Long alarmInfoId)
{
this.alarmInfoId = alarmInfoId;
@ -252,6 +257,14 @@ public class HwAlarmInfo extends BaseEntity
return alarmInfoField;
}
public List<HwAlarmDetail> getHwAlarmDetailList() {
return hwAlarmDetailList;
}
public void setHwAlarmDetailList(List<HwAlarmDetail> hwAlarmDetailList) {
this.hwAlarmDetailList = hwAlarmDetailList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -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;
/** 1hw_device_modedevice_mode_id
2hw_devicedevice_id */
@Excel(name = "设备或设备模型ID")
private Long ruleDeviceId;
/** 一共有几个属性规则 */
private Long ruleFunctionTotal;
/** 表达式,例如:{}&gt;60 or {}&lt;-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<HwAlarmRuleLink> 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<HwAlarmRuleLink> getHwAlarmRuleLinkList()
{
return hwAlarmRuleLinkList;
}
public void setHwAlarmRuleLinkList(List<HwAlarmRuleLink> 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();
}
}

@ -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();
}
}

@ -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<HwAlarmDetail> hwAlarmDetailList);
}

@ -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<HwAlarmRule> selectHwAlarmRulesWithLink(HwAlarmRule hwAlarmRule);
}

@ -8,12 +8,13 @@ public interface IDataProcessService {
* @param: imagePatterns
* @param: imageDomain ruoyifiledomain
* @param: imagePrefix ruoyifileprefix
* @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);

@ -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 ruoyifiledomain
* @param: imagePrefix ruoyifileprefix
* @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<TdField> schemaFields = new ArrayList<>();
List<TdField> 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<TdField> 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<HwAlarmRule> 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<HwAlarmDetail> alarmDetails = new ArrayList<HwAlarmDetail>();
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<HwAlarmDetail> hwAlarmDetailList = hwAlarmInfo.getHwAlarmDetailList();
Long alarmInfoId = hwAlarmInfo.getAlarmInfoId();
if (StringUtils.isNotNull(hwAlarmDetailList)) {
List<HwAlarmDetail> list = new ArrayList<HwAlarmDetail>();
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<HwAlarmRuleLink> 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");

@ -77,4 +77,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<insert id="batchHwAlarmDetail">
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
<foreach item="item" index="index" collection="list" separator=",">
( #{item.alarmDetailId}, #{item.alarmInfoId}, #{item.deviceId}, #{item.modeFunctionId}, #{item.functionName}, #{item.functionIdentifier}, #{item.functionValue}, #{item.monitorTime})
</foreach>
</insert>
</mapper>

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.dataprocess.mapper.HwAlarmRuleMapper">
<resultMap type="HwAlarmRule" id="HwAlarmRuleResult">
<result property="alarmRuleId" column="alarm_rule_id" />
<result property="alarmRuleName" column="alarm_rule_name" />
<result property="tenantId" column="tenant_id" />
<result property="sceneId" column="scene_id" />
<result property="languageCode" column="language_code" />
<result property="alarmLevelId" column="alarm_level_id" />
<result property="alarmTypeId" column="alarm_type_id" />
<result property="ruleType" column="rule_type" />
<result property="ruleDeviceId" column="rule_device_id" />
<result property="ruleFunctionTotal" column="rule_function_total" />
<result property="triggerExpression" column="trigger_expression" />
<result property="linkFlag" column="link_flag" />
<result property="alarmRuleStatus" column="alarm_rule_status" />
<result property="alarmPushFlag" column="alarm_push_flag" />
<result property="alarmPushContent" column="alarm_push_content" />
<result property="alarmRecoverContent" column="alarm_recover_content" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="alarmRuleField" column="alarm_rule_field" />
<result property="tenantName" column="tenant_name" />
<result property="sceneName" column="scene_name" />
<result property="alarmTypeName" column="alarm_type_name" />
<result property="alarmLevelName" column="alarm_level_name" />
<result property="ruleDeviceName" column="device_name" />
</resultMap>
<resultMap id="HwAlarmRuleHwAlarmRuleLinkResult" type="HwAlarmRule" extends="HwAlarmRuleResult">
<collection property="hwAlarmRuleLinkList" notNullColumn="sub_rule_link_id" javaType="java.util.List" resultMap="HwAlarmRuleLinkResult" />
</resultMap>
<resultMap type="HwAlarmRuleLink" id="HwAlarmRuleLinkResult">
<result property="ruleLinkId" column="sub_rule_link_id" />
<result property="alarmRuleId" column="sub_alarm_rule_id" />
<result property="linkType" column="sub_link_type" />
<result property="linkDeviceId" column="sub_link_device_id" />
<result property="linkDeviceFunctionId" column="sub_link_device_function_id" />
<result property="linkDeviceFunctionIdentifier" column="sub_link_device_function_identifier" />
<result property="linkDeviceFunctionData" column="sub_link_device_function_data" />
<result property="linkDeviceName" column="sub_link_device_name" />
<result property="linkDeviceModeFunctionName" column="sub_link_device_mode_function_name" />
</resultMap>
<sql id="selectHwAlarmRuleVo">
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
</sql>
<select id="selectHwAlarmRulesWithLink" parameterType="HwAlarmRule" resultMap="HwAlarmRuleHwAlarmRuleLinkResult">
select a.alarm_rule_id, a.alarm_rule_name, a.tenant_id, a.scene_id, a.language_code, a.alarm_level_id, a.alarm_type_id, a.rule_type, a.rule_device_id, a.rule_function_total, a.trigger_expression, a.link_flag, a.alarm_rule_status, a.alarm_push_flag, a.alarm_push_content, a.alarm_recover_content, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.alarm_rule_field,
b.rule_link_id as sub_rule_link_id, b.alarm_rule_id as sub_alarm_rule_id, b.link_type as sub_link_type, b.link_device_id as sub_link_device_id, b.link_device_function_id as sub_link_device_function_id, b.link_device_function_identifier as sub_link_device_function_identifier, b.link_device_function_data as sub_link_device_function_data
from hw_alarm_rule a
left join hw_alarm_rule_link b on b.alarm_rule_id = a.alarm_rule_id
<where>
<if test="alarmRuleName != null and alarmRuleName != ''"> and a.alarm_rule_name like concat('%', #{alarmRuleName}, '%')</if>
<if test="tenantId != null "> and a.tenant_id = #{tenantId}</if>
<if test="sceneId != null "> and a.scene_id = #{sceneId}</if>
<if test="alarmLevelId != null "> and a.alarm_level_id = #{alarmLevelId}</if>
<if test="alarmTypeId != null "> and a.alarm_type_id = #{alarmTypeId}</if>
<if test="ruleType != null and ruleType != ''"> and a.rule_type = #{ruleType}</if>
<if test="ruleDeviceId != null "> and a.rule_device_id = #{ruleDeviceId}</if>
<if test="ruleFunctionTotal != null "> and a.rule_function_total = #{ruleFunctionTotal}</if>
<if test="linkFlag != null and linkFlag != ''"> and a.link_flag = #{linkFlag}</if>
<if test="alarmRuleStatus != null and alarmRuleStatus != ''"> and a.alarm_rule_status = #{alarmRuleStatus}</if>
<if test="alarmPushFlag != null and alarmPushFlag != ''"> and a.alarm_push_flag = #{alarmPushFlag}</if>
</where>
order by a.alarm_rule_id desc
</select>
</mapper>

@ -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'
})
}

@ -192,7 +192,7 @@
<el-form-item label="所属场景" prop="sceneId">
<el-select v-model="form.sceneId" placeholder="请选择所属场景" @input="editedSceneChange"
:disabled="sceneDisabled">
:disabled="sceneDisabled">j
<el-option
v-for="(scene, index) in editedScenes"
:key="index"
@ -206,7 +206,7 @@
<el-form-item label="报警级别" prop="alarmLevelId">
<el-select v-model="form.alarmLevelId" placeholder="请选择报警级别" :disabled="sceneDisabled">
<el-select v-model="form.alarmLevelId" placeholder="请选择报警级别">
<el-option
v-for="(alarmLevel, index) in editedAlarmLevels"
:key="index"
@ -217,7 +217,7 @@
</el-form-item>
<el-form-item label="报警类型" prop="alarmTypeId">
<el-select v-model="form.alarmTypeId" placeholder="请选择报警类型" :disabled="sceneDisabled">
<el-select v-model="form.alarmTypeId" placeholder="请选择报警类型">
<el-option
v-for="(alarmType, index) in editedAlarmTypes"
:key="index"
@ -230,7 +230,7 @@
<el-row>
<el-col :span="12">
<el-form-item label="设备" prop="ruleDeviceId">
<el-select v-model="form.ruleDeviceId" placeholder="请选择设备" :disabled="sceneDisabled"
<el-select v-model="form.ruleDeviceId" placeholder="请选择设备" :disabled="editedDisabled"
@input="editedDeviceChange">
<el-option
v-for="(device, index) in editedDevices"
@ -245,7 +245,7 @@
<el-col :span="12">
<el-form-item label="设备属性" prop="ruleModeFunctionIdentifier">
<el-select v-model="form.ruleModeFunctionIdentifier" placeholder="请选择设备属性"
:disabled="sceneDisabled">
:disabled="editedDisabled">
<el-option
v-for="(deviceModeFunction, index) in editedDeviceModeAttributes"
:key="index"
@ -260,7 +260,8 @@
<el-form-item label="触发条件" prop="triggerCondition">
<el-select v-model="form.triggerCondition" placeholder="请选择触发条件" @input="triggerConditionChange">
<el-select v-model="form.triggerCondition" placeholder="请选择触发条件" @input="triggerConditionChange"
:disabled="editedDisabled">
<el-option
v-for="dict in dict.type.hw_alarm_rule_trigger_condition"
:key="dict.value"
@ -273,12 +274,12 @@
<el-row>
<el-col :span="12">
<el-form-item label="A值" prop="triggerDataA">
<el-input v-model="form.triggerDataA" placeholder="请输入A值"/>
<el-input v-model="form.triggerDataA" placeholder="请输入A值" :disabled="editedDisabled"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="B值" prop="triggerDataB" v-if="triggerDataBVisible">
<el-input v-model="form.triggerDataB" placeholder="请输入B值"/>
<el-input v-model="form.triggerDataB" placeholder="请输入B值" :disabled="editedDisabled"/>
</el-form-item>
</el-col>
</el-row>
@ -393,7 +394,7 @@
<el-row>
<el-col span="12">
<el-form-item label="设备" prop="linkDeviceId">
<el-select v-model="alarmRuleLinkForm.linkDeviceId" placeholder="请选择设备" :disabled="sceneDisabled"
<el-select v-model="alarmRuleLinkForm.linkDeviceId" placeholder="请选择设备"
@input="editedLinkDeviceChange">
<el-option
v-for="(device, index) in editedDevices"
@ -408,7 +409,7 @@
<el-col span="12">
<el-form-item label="设备服务" prop="linkDeviceFunctionId">
<el-select v-model="alarmRuleLinkForm.linkDeviceFunctionId" placeholder="请选择设备服务"
:disabled="sceneDisabled" @input="editedLinkDeviceModeServiceChange">
@input="editedLinkDeviceModeServiceChange">
<el-option
v-for="(deviceModeFunction, index) in editedDeviceModeServices"
:key="index"
@ -581,8 +582,10 @@ export default {
],
},
alarmRuleFlag: "1",
editedScenes: [],
sceneDisabled: false,
editedDisabled: true,
sceneDisabled: true,
editedAlarmLevels: [],
editedAlarmTypes: [],
editedDevices: [],
@ -710,6 +713,8 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
this.editedDisabled = false;
this.sceneDisabled = false;
this.reset();
this.getEditedScenes();
this.open = true;
@ -718,11 +723,13 @@ export default {
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.sceneDisabled = true;
const alarmRuleId = row.alarmRuleId || this.ids
this.getEditedScenes();
getAlarmRule(alarmRuleId).then(response => {
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);

@ -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";
}
},

@ -60,6 +60,18 @@
v-hasPermi="['business:electronicFence:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['business:electronicFence:remove']"
>删除
</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -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);
},
/** 删除按钮操作 */

Loading…
Cancel
Save