Browse Source

1.获取附近上下行摄像头

2.感知事件批量操作
develop
lau572 8 months ago
parent
commit
f8e04c8925
  1. 51
      zc-business/src/main/java/com/zc/business/controller/VideoController.java
  2. 66
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  3. 158
      zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

51
zc-business/src/main/java/com/zc/business/controller/VideoController.java

@ -26,8 +26,10 @@ import javax.annotation.Resource;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import static com.ruoyi.common.constant.Constants.HTTP;
import static java.util.Comparator.comparing;
/**
@ -312,6 +314,55 @@ public class VideoController extends BaseController {
return AjaxResult.success(resultList);
}
/**
* 根据桩号查询上下行相机
*/
@ApiOperation("根据桩号查询上下行相机")
@GetMapping(value = "/nearCamPileNum")
public Object nearCamPileNum(@ApiParam(value = "桩号", name = "pileNum", required = true) String pileNum) throws HttpException, IOException {
// 获取济菏运管中心相机信息
JSONObject camInfo = getCamByDept("1301730");
if (!camInfo.containsKey("data")) {
return camInfo;
}
List<Map<String,Object>> datalist = (List<Map<String, Object>>) camInfo.get("data");
Integer pileNumDistance = pileNumTransformMetre(pileNum);
Map<String,Object> result = new HashMap<>();
//上行列表
List<Map<String,Object>> upCameraList = datalist.stream()
.filter(item -> "0".equals(item.get("camOrientation")))
.map(item->{
item.put("pileNumDistance",pileNumTransformMetre(item.get("pileNum").toString()));
return item;
})
.sorted(comparing(item -> Math.abs(Integer.parseInt(item.get("pileNumDistance").toString()) - pileNumDistance)))
.collect(Collectors.toList());
if (upCameraList.size() > 0){
result.put("upCamera",upCameraList.get(0));
}
//下行列表
List<Map<String,Object>> downCameraList = datalist.stream()
.filter(item -> "1".equals(item.get("camOrientation")))
.map(item->{
item.put("pileNumDistance",pileNumTransformMetre(item.get("pileNum").toString()));
return item;
})
.sorted(comparing(item -> Math.abs(Integer.parseInt(item.get("pileNumDistance").toString()) - pileNumDistance)))
.collect(Collectors.toList());
if (downCameraList.size() > 0){
result.put("downCamera",downCameraList.get(0));
}
return AjaxResult.success(result);
}
/**
* 获取视频流信息
*/

66
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -367,6 +367,72 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
for (DcEvent dcEvent : dcEventList) {
MdEvent mdEvent = new MdEvent(dcEvent);
mdEventList.add(mdEvent);
int eventType = Math.toIntExact(dcEvent.getEventType());
switch (eventType) {
//交通事故
case 1:
if (dcEvent.getDcEventAccident() != null) {
dcEventAccidentMapper.insertDcEventAccident(dcEvent.getDcEventAccident());
}
break;
//车辆事故
case 2:
if (dcEvent.getDcEventVehicleAccident() != null) {
dcEventVehicleAccidentMapper.insertDcEventVehicleAccident(dcEvent.getDcEventVehicleAccident());
}
break;
//交通管制
case 3:
if (dcEvent.getDcEventTrafficControl() != null) {
dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());
}
break;
//交通拥堵
case 4:
if (dcEvent.getDcEventTrafficCongestion() != null) {
dcEventTrafficCongestionMapper.insertDcEventTrafficCongestion(dcEvent.getDcEventTrafficCongestion());
}
break;
//非法上路
case 5:
break;
//路障清除
case 6:
break;
//施工建设
case 7:
if (dcEvent.getDcEventConstruction() != null) {
dcEventConstructionMapper.insertDcEventConstruction(dcEvent.getDcEventConstruction());
}
break;
//服务区异常
case 8:
if (dcEvent.getDcEventServiceArea() != null) {
dcEventServiceAreaMapper.insertDcEventServiceArea(dcEvent.getDcEventServiceArea());
}
break;
//设施设备隐患
case 9:
break;
//异常天气
case 10:
if (dcEvent.getDcEventAbnormalWeather() != null) {
dcEventAbnormalWeatherMapper.insertDcEventAbnormalWeather(dcEvent.getDcEventAbnormalWeather());
}
break;
//其他事件
case 11:
break;
//
default:
break;
}
}
middleDatabaseService.batchInsertMiddleDatabaseEvent(mdEventList);
}

158
zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java

@ -1,13 +1,11 @@
package com.zc.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.zc.business.domain.DcDevice;
import com.zc.business.domain.DcEvent;
import com.zc.business.domain.DcWarning;
import com.zc.business.domain.DcWarningBatchConvert;
import com.zc.business.domain.*;
import com.zc.business.enums.ValueConverter;
import com.zc.business.mapper.DcEventMapper;
import com.zc.business.mapper.DcWarningMapper;
@ -19,6 +17,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
@ -239,6 +238,156 @@ public class DcWarningServiceImpl implements IDcWarningService
dcEvent.setCreateTime(DateUtils.getNowDate());//创建时间
dcEvent.setUserId(SecurityUtils.getUserId());//处置人员
Calendar cal = Calendar.getInstance();
cal.add(Calendar.HOUR,3);
dcEvent.setEstimatedEndTime(cal.getTime()); //预计解除时间
dcEvent.setRoadId(1L); //道路id
dcEvent.setRoadName("济菏高速"); //道路id
dcEvent.setInTunnel(0); //是否处在隧道
Integer warningType = dcWarning.getWarningType();
if (warningType == 1){
//交通拥堵
DcEventTrafficCongestion dcEventTrafficCongestion = new DcEventTrafficCongestion();
dcEventTrafficCongestion.setId(dcWarning.getId());
dcEventTrafficCongestion.setCongestionCause(5L);
dcEventTrafficCongestion.setCongestionMileage(0F);
dcEventTrafficCongestion.setMaxCongestionMileage(0F);
dcEvent.setDcEventTrafficCongestion(dcEventTrafficCongestion);
} else if (warningType == 4) {
//停车
DcEventVehicleAccident dcEventVehicleAccident = new DcEventVehicleAccident();
dcEventVehicleAccident.setId(dcWarning.getId());
if (dcWarning.getWarningSource() == 1) {
dcEventVehicleAccident.setReporterName("视频AI");
} else if (dcWarning.getWarningSource() == 2) {
dcEventVehicleAccident.setReporterName("雷达识别");
} else if (dcWarning.getWarningSource() == 3) {
dcEventVehicleAccident.setReporterName("智慧锥桶");
} else if (dcWarning.getWarningSource() == 4) {
dcEventVehicleAccident.setReporterName("护栏碰撞");
} else if (dcWarning.getWarningSource() == 6) {
dcEventVehicleAccident.setReporterName("非机预警");
}
dcEventVehicleAccident.setReporterPhoneNumber("96659");
dcEventVehicleAccident.setLocationType(1L);
dcEventVehicleAccident.setTrafficJam(0L);
dcEventVehicleAccident.setWeatherCondition(1L);
dcEventVehicleAccident.setCongestionAhead(1);
dcEventVehicleAccident.setAtIntersection(1);
dcEventVehicleAccident.setOnCurve(1);
dcEventVehicleAccident.setSmallCar(0L);
dcEventVehicleAccident.setTrucks(0L);
dcEventVehicleAccident.setBuses(0L);
dcEventVehicleAccident.setTankers(0L);
dcEventVehicleAccident.setMinorInjuries(0L);
dcEventVehicleAccident.setSeriousInjuries(0L);
dcEventVehicleAccident.setFatalities(0L);
dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident);
} else if (warningType == 7){
//道路施工
} else if (warningType == 8) {
//异常天气
DcEventAbnormalWeather dcEventAbnormalWeather = new DcEventAbnormalWeather();
dcEventAbnormalWeather.setId(dcWarning.getId());
dcEventAbnormalWeather.setEmergencyLevel(1L);
dcEvent.setDcEventAbnormalWeather(dcEventAbnormalWeather);
} else if (warningType == 9) {
//护栏碰撞
DcEventAccident dcEventAccident = new DcEventAccident();
dcEventAccident.setId(dcWarning.getId());
if (dcWarning.getWarningSource() == 1) {
dcEventAccident.setReporterName("视频AI");
dcEventAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 2) {
dcEventAccident.setReporterName("雷达识别");
dcEventAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 3) {
dcEventAccident.setReporterName("智慧锥桶");
dcEventAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 4) {
dcEventAccident.setReporterName("护栏碰撞");
dcEventAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 5) {
dcEventAccident.setReporterName("扫码报警");
JSONObject otherConfig = JSONObject.parseObject(dcWarning.getOtherConfig());
if (otherConfig != null && otherConfig.containsKey("phone")) {
dcEventAccident.setReporterPhoneNumber(otherConfig.getString("phone"));
dcEventAccident.setVehicleOwnerPhone(otherConfig.getString("phone"));
}
} else if (dcWarning.getWarningSource() == 6) {
dcEventAccident.setReporterName("非机预警");
dcEventAccident.setReporterPhoneNumber("96659");
}
dcEventAccident.setLocationType(1L);
dcEventAccident.setTrafficJam(0f);
dcEventAccident.setWeatherCondition(1L);
dcEventAccident.setImpactLevel(1L);
dcEventAccident.setIsReverseCargo(0);
dcEventAccident.setIsMaintenance(0);
dcEventAccident.setCongestionAhead(0);
dcEventAccident.setOnCurve(0);
dcEventAccident.setSmallCar(0L);
dcEventAccident.setTrucks(0L);
dcEventAccident.setBuses(0L);
dcEventAccident.setTankers(0L);
dcEventAccident.setMinorInjuries(0L);
dcEventAccident.setSeriousInjuries(0L);
dcEventAccident.setFatalities(0L);
dcEvent.setDcEventAccident(dcEventAccident);
} else if (warningType == 10) {
//交通事故
DcEventAccident dcEventAccident = new DcEventAccident();
} else if (warningType == 11) {
//车辆故障
DcEventVehicleAccident dcEventVehicleAccident = new DcEventVehicleAccident();
dcEventVehicleAccident.setId(dcWarning.getId());
if (dcWarning.getWarningSource() == 1) {
dcEventVehicleAccident.setReporterName("视频AI");
dcEventVehicleAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 2) {
dcEventVehicleAccident.setReporterName("雷达识别");
dcEventVehicleAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 3) {
dcEventVehicleAccident.setReporterName("智慧锥桶");
dcEventVehicleAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 4) {
dcEventVehicleAccident.setReporterName("护栏碰撞");
dcEventVehicleAccident.setReporterPhoneNumber("96659");
} else if (dcWarning.getWarningSource() == 5) {
dcEventVehicleAccident.setReporterName("扫码报警");
JSONObject otherConfig = JSONObject.parseObject(dcWarning.getOtherConfig());
if (otherConfig != null && otherConfig.containsKey("phone")) {
dcEventVehicleAccident.setReporterPhoneNumber(otherConfig.getString("phone"));
}
} else if (dcWarning.getWarningSource() == 6) {
dcEventVehicleAccident.setReporterName("非机预警");
dcEventVehicleAccident.setReporterPhoneNumber("96659");
}
dcEventVehicleAccident.setLocationType(1L);
dcEventVehicleAccident.setTrafficJam(0L);
dcEventVehicleAccident.setWeatherCondition(1L);
dcEventVehicleAccident.setCongestionAhead(1);
dcEventVehicleAccident.setAtIntersection(1);
dcEventVehicleAccident.setOnCurve(1);
dcEventVehicleAccident.setSmallCar(0L);
dcEventVehicleAccident.setTrucks(0L);
dcEventVehicleAccident.setBuses(0L);
dcEventVehicleAccident.setTankers(0L);
dcEventVehicleAccident.setMinorInjuries(0L);
dcEventVehicleAccident.setSeriousInjuries(0L);
dcEventVehicleAccident.setFatalities(0L);
dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident);
}
dcEventList.add(dcEvent);
}
@ -246,6 +395,7 @@ public class DcWarningServiceImpl implements IDcWarningService
dcWarningMapper.batchUpdateState(SecurityUtils.getUserId(),dcWarningList);
//批量插入事件表
dcEventService.batchInsertDcEventWarning(dcEventList);
}

Loading…
Cancel
Save