临边防护告警

This commit is contained in:
guoshengxiong 2024-05-20 16:53:16 +08:00
parent 8f592a1a76
commit 800ebd011c
2 changed files with 45 additions and 1 deletions

View File

@ -28,6 +28,10 @@ import com.zhgd.xmgl.modules.car.mapper.CarTypeMapper;
import com.zhgd.xmgl.modules.car.service.impl.CarPassRecordServiceImpl;
import com.zhgd.xmgl.modules.frontier.service.FrontierProtectionDevService;
import com.zhgd.xmgl.modules.frontier.service.IFrontierProtectionDevAlarmService;
import com.zhgd.xmgl.modules.frontierprotectionnonet.entity.FrontierProtectionNoNetData;
import com.zhgd.xmgl.modules.frontierprotectionnonet.entity.FrontierProtectionNoNetDev;
import com.zhgd.xmgl.modules.frontierprotectionnonet.mapper.FrontierProtectionNoNetDevMapper;
import com.zhgd.xmgl.modules.frontierprotectionnonet.service.impl.FrontierProtectionNoNetDataServiceImpl;
import com.zhgd.xmgl.modules.project.entity.Project;
import com.zhgd.xmgl.modules.project.entity.ProjectVideoConfig;
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
@ -152,6 +156,13 @@ public class HikvisionCall {
@Lazy
@Autowired
private AiAnalyseHardWareRecordMapper aiAnalyseHardWareRecordMapper;
@Lazy
@Autowired
private FrontierProtectionNoNetDevMapper frontierProtectionNoNetDevMapper;
@Lazy
@Autowired
private FrontierProtectionNoNetDataServiceImpl frontierProtectionNoNetDataService;
/**
* 获取图片
@ -290,7 +301,7 @@ public class HikvisionCall {
// frontierProtectionDevAlarmService.saveBatch(frontierProtectionDevAlarmList);
} else if (Objects.equals(ability, "")) {
log.info("AI识别告警=======" + paramsJo);
log.info("告警=======" + paramsJo);
JSONArray eventsArray = paramsJo.getJSONArray("events");
if (eventsArray.size() > 0) {
JSONObject dataEvent = eventsArray.getJSONObject(0);
@ -311,6 +322,19 @@ public class HikvisionCall {
return null;
}
hikvisionCall.saveEventCallbackAiAsync(dataEvent, srcName, eventType, imageUrl, deviceID, dev);
} else if (Objects.equals(ability, "event_ias")) {
log.info("临边防护告警=======" + paramsJo);
String srcName = eventDetail.getString("srcName");//srcName
String srcParentIndex = dataEvent.getString("srcParentIndex");
String happenTime = dataEvent.getString("happenTime");
String ds = srcName + "报警";
FrontierProtectionNoNetData data1 = new FrontierProtectionNoNetData();
data1.setDevSn(srcParentIndex);
data1.setAlarmTime(DateUtil.parse(happenTime));
data1.setDeviceStatus(1);
data1.setDetailStatus(ds);
data1.setDescription(ds);
frontierProtectionNoNetDataService.add(data1);
}
}
}

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
import com.zhgd.xmgl.modules.ammeter.entity.AmmeterRecordDetail;
@ -72,6 +73,25 @@ public class FrontierProtectionNoNetDataServiceImpl extends ServiceImpl<Frontier
@Override
public void add(FrontierProtectionNoNetData frontierProtectionNoNetData) {
frontierProtectionNoNetData.setId(null);
FrontierProtectionNoNetDev dev = frontierProtectionNoNetDevMapper.selectOne(new LambdaQueryWrapper<FrontierProtectionNoNetDev>()
.eq(FrontierProtectionNoNetDev::getDevSn, frontierProtectionNoNetData.getDevSn()));
if (dev == null) {
throw new OpenAlertException("设备编号不正确");
}
/*
只有设备状态变化在线/离线时才会推送数据推送失败不会重试
布防在线alarm=0state=布防
离线alarm=0,state=故障
*/
if (Objects.equals(dev.getOnLine(), 0)) {
//在线
frontierProtectionNoNetDevMapper.update(null, new LambdaUpdateWrapper<FrontierProtectionNoNetDev>()
.eq(FrontierProtectionNoNetDev::getDevSn, dev.getDevSn())
.set(FrontierProtectionNoNetDev::getOnLine, 1)
);
}
frontierProtectionNoNetData.setDevSn(dev.getDevSn());
frontierProtectionNoNetData.setProjectSn(dev.getProjectSn());
baseMapper.insert(frontierProtectionNoNetData);
}