diff --git a/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java b/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java index 228f01479..cf0430531 100644 --- a/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java +++ b/src/main/java/com/zhgd/xmgl/call/HikvisionCall.java @@ -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); } } } diff --git a/src/main/java/com/zhgd/xmgl/modules/frontierprotectionnonet/service/impl/FrontierProtectionNoNetDataServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/frontierprotectionnonet/service/impl/FrontierProtectionNoNetDataServiceImpl.java index 8edc620b1..470be1121 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontierprotectionnonet/service/impl/FrontierProtectionNoNetDataServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/frontierprotectionnonet/service/impl/FrontierProtectionNoNetDataServiceImpl.java @@ -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() + .eq(FrontierProtectionNoNetDev::getDevSn, frontierProtectionNoNetData.getDevSn())); + if (dev == null) { + throw new OpenAlertException("设备编号不正确"); + } + /* + 只有设备状态变化(在线/离线)时才会推送数据,推送失败不会重试。 + 布防(在线):alarm=0,state=布防 + 离线:alarm=0,state=故障 + */ + if (Objects.equals(dev.getOnLine(), 0)) { + //在线 + frontierProtectionNoNetDevMapper.update(null, new LambdaUpdateWrapper() + .eq(FrontierProtectionNoNetDev::getDevSn, dev.getDevSn()) + .set(FrontierProtectionNoNetDev::getOnLine, 1) + ); + } + frontierProtectionNoNetData.setDevSn(dev.getDevSn()); + frontierProtectionNoNetData.setProjectSn(dev.getProjectSn()); baseMapper.insert(frontierProtectionNoNetData); }