Browse Source

优化事件类型相关代码

装好范围查询设备新增按照方向查询
develop
zhaoxianglong 8 months ago
parent
commit
0de2ad7384
  1. 27
      zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java
  2. 43
      zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java
  3. 11
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  4. 4
      zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java

27
zc-business/src/main/java/com/zc/business/controller/CodeScanningAlarmController.java

@ -51,9 +51,30 @@ public class CodeScanningAlarmController extends BaseController {
dcWarning.setWarningTime(new Date());
}
dcWarning.setCreateTime(new Date());
int warningType = Integer.parseInt(String.valueOf(returnParameters.get("accidentType"))) >= 4 ? 10 : 11;
dcWarning.setWarningType(warningType);
String warningTitle = "济荷高速:" + (Objects.equals(roadCode, "1") ? "济南方向" : "菏泽方向") + "发生" + (warningType == 10 ? "交通事故事件" : "车辆故障事件");
String accidentType = String.valueOf(returnParameters.get("accidentType"));
switch (accidentType) {
case "1"://车辆炸胎(无备胎)
dcWarning.setWarningType(11);
dcWarning.setWarningSubclass("11-3");
break;
case "2"://车辆炸胎(有备胎)
dcWarning.setWarningType(11);
dcWarning.setWarningSubclass("11-2");
break;
case "3"://车辆抛锚
dcWarning.setWarningType(11);
dcWarning.setWarningSubclass("11-1");
break;
case "4"://单车事故
dcWarning.setWarningType(10);
dcWarning.setWarningSubclass("10-2");
break;
case "5"://多车事故
dcWarning.setWarningType(10);
dcWarning.setWarningSubclass("10-3");
break;
}
String warningTitle = "济荷高速:" + (Objects.equals(roadCode, "1") ? "济南方向" : "菏泽方向") + "发生" + (Integer.parseInt(accidentType) >= 4 ? "交通事故事件" : "车辆故障事件");
dcWarning.setWarningTitle(warningTitle);
dcWarning.setOtherConfig(returnParameters.toString());
dcWarning.setWarningSource(5);

43
zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java

@ -146,44 +146,55 @@ public class NonAutomaticWarningController extends BaseController {
case "congestion"://拥堵
warningType = "拥堵";
dcWarning.setWarningType(1);
dcWarning.setWarningSubclass("1-1");
break;
case "laneChange"://变道
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-6");
break;
//case "laneChange"://变道
// dcWarning.setWarningType();
// break;
//case "vehicleexist"://机占非
// dcWarning.setWarningType();
// break;
//case "roadBlock"://路障
// dcWarning.setWarningType();
// break;
//case "construction"://施工
// dcWarning.setWarningType();
// break;
case "roadBlock"://路障
dcWarning.setWarningType(6);
dcWarning.setWarningSubclass("6-3");
break;
case "construction"://施工
dcWarning.setWarningType(7);
dcWarning.setWarningSubclass("7-1");
break;
case "llegalParking"://停车
warningType = "停车";
dcWarning.setWarningType(4);
dcWarning.setWarningSubclass("4-10");
break;
case "crossLane"://压线
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-2");
break;
case "turnRound"://掉头
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-3");
break;
//case "crossLane"://压线
// dcWarning.setWarningType();
// break;
//case "turnRound"://掉头
// dcWarning.setWarningType();
// break;
case "wrongDirection"://逆行
warningType = "逆行";
dcWarning.setWarningType(5);
dcWarning.setWarningSubclass("5-1");
break;
case "pedestrian"://行人
warningType = "行人";
dcWarning.setWarningType(2);
dcWarning.setWarningSubclass("2-1");
break;
case "abandonedObject"://抛洒物
warningType = "抛洒物";
dcWarning.setWarningType(7);
dcWarning.setWarningType(6);
dcWarning.setWarningSubclass("6-4");
break;
default://其他
warningType = "其他";
dcWarning.setWarningType(99);
dcWarning.setWarningSubclass("99-1");
}
String direction = "";
if (Objects.equals(directionName, "上行")) {

11
zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java

@ -380,14 +380,24 @@ public class DeviceMessageHandler {
String eventType = "";
if (Objects.equals(alarmType, "1")) {
eventType = "碰撞";
dcWarning.setWarningType(9);
dcWarning.setWarningSubclass("9-1");
} else if (Objects.equals(alarmType, "2")) {
eventType = "只倾斜无碰撞";
dcWarning.setWarningType(9);
dcWarning.setWarningSubclass("9-2");
} else if (Objects.equals(alarmType, "3")) {
eventType = "碰撞后倾斜";
dcWarning.setWarningType(9);
dcWarning.setWarningSubclass("9-3");
} else if (Objects.equals(alarmType, "4")) {
eventType = "应急车道被占";
dcWarning.setWarningType(4);
dcWarning.setWarningSubclass("4-7");
} else if (Objects.equals(alarmType, "5")) {
eventType = "车离开应急车道";
dcWarning.setWarningType(4);
dcWarning.setWarningSubclass("4-8");
}
SimpleDateFormat sdf = new SimpleDateFormat("yy年MM月dd日HH时mm分");
@ -398,6 +408,7 @@ public class DeviceMessageHandler {
e.printStackTrace();
}
dcWarning.setStakeMark(dcDevices.get(0).getStakeMark());
dcWarning.setWarningType(9);
dcWarning.setCreateTime(new Date());
dcWarning.setWarningTitle("护栏碰撞上报事件:区域号为" + areaCode + "在" + timeOfFireAlarming + direction + "发生" + eventType + "事件");

4
zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java

@ -395,6 +395,7 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
String deviceType = String.valueOf(parameter.get("deviceType"));
String childType = String.valueOf(parameter.get("childType"));
String deviceState = String.valueOf(parameter.get("deviceState"));
String direction = String.valueOf(parameter.get("direction"));
DcDevice device = new DcDevice();
if (!Objects.equals(childType, "null")) {
device.setChildType(childType);
@ -405,6 +406,9 @@ public class DcDeviceServiceImpl extends ServiceImpl<DcDeviceMapper, DcDevice> i
if (!Objects.equals(deviceState, "null")) {
device.setDeviceState(deviceState);
}
if (!Objects.equals(direction, "null")) {
device.setDirection(direction);
}
List<DcDevice> list = listDevice(device);
if (startStakeMarks != null && endStakeMarks != null) {
Integer startStakeMark = Integer.parseInt(startStakeMarks.get(0) + startStakeMarks.get(1));

Loading…
Cancel
Save