Browse Source

优化非机预警事件上报存储格式

develop
zhaoxianglong 10 months ago
parent
commit
771351f156
  1. 18
      zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java

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

@ -117,22 +117,24 @@ public class NonAutomaticWarningController extends BaseController {
JSONObject event = JSONObject.parseObject(String.valueOf(item)); JSONObject event = JSONObject.parseObject(String.valueOf(item));
JSONObject data = event.getJSONObject("data"); JSONObject data = event.getJSONObject("data");
Date happenTime = event.getDate("happenTime"); Date happenTime = event.getDate("happenTime");
String srcName = event.getString("srcName").split("收费站")[1]; String srcName = event.getString("srcName").split("收费站")[0];
String illegalTrafficEvent = data.getString("illegalTrafficEvent"); String illegalTrafficEvent = data.getString("illegalTrafficEvent");
String directionName = data.getString("directionName"); String directionName = data.getString("directionName");
String crossingName = data.getString("crossingName"); String crossingName = data.getString("crossingName");
String targetPicUrl = "https://10.0.81.28"+data.getString("targetPicUrl"); String targetPicUrl = "https://10.0.81.28" + data.getString("targetPicUrl");
String laneNo = data.getString("laneNo"); String laneNo = data.getString("laneNo");
ArrayList<String> pictures = new ArrayList<>(); ArrayList<String> pictures = new ArrayList<>();
pictures.add(targetPicUrl); pictures.add(targetPicUrl);
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("pictures",pictures); jsonObject.put("pictures", pictures);
DcWarning dcWarning = new DcWarning(); DcWarning dcWarning = new DcWarning();
dcWarning.setOtherConfig(String.valueOf(jsonObject)); dcWarning.setOtherConfig(String.valueOf(jsonObject));
dcWarning.setLane(laneNo); dcWarning.setLane(laneNo);
String warningType = "";
switch (illegalTrafficEvent) { switch (illegalTrafficEvent) {
case "congestion"://拥堵 case "congestion"://拥堵
warningType = "拥堵";
dcWarning.setWarningType(1); dcWarning.setWarningType(1);
break; break;
//case "laneChange"://变道 //case "laneChange"://变道
@ -148,6 +150,7 @@ public class NonAutomaticWarningController extends BaseController {
// dcWarning.setWarningType(); // dcWarning.setWarningType();
// break; // break;
case "llegalParking"://停车 case "llegalParking"://停车
warningType = "停车";
dcWarning.setWarningType(4); dcWarning.setWarningType(4);
break; break;
//case "crossLane"://压线 //case "crossLane"://压线
@ -157,22 +160,29 @@ public class NonAutomaticWarningController extends BaseController {
// dcWarning.setWarningType(); // dcWarning.setWarningType();
// break; // break;
case "wrongDirection"://逆行 case "wrongDirection"://逆行
warningType = "逆行";
dcWarning.setWarningType(5); dcWarning.setWarningType(5);
break; break;
case "pedestrian"://行人 case "pedestrian"://行人
warningType = "行人";
dcWarning.setWarningType(2); dcWarning.setWarningType(2);
break; break;
case "abandonedObject"://抛洒物 case "abandonedObject"://抛洒物
warningType = "抛洒物";
dcWarning.setWarningType(7); dcWarning.setWarningType(7);
break; break;
default://其他 default://其他
warningType = "其他";
dcWarning.setWarningType(99); dcWarning.setWarningType(99);
} }
String direction = "";
if (Objects.equals(directionName, "上行")) { if (Objects.equals(directionName, "上行")) {
direction = "菏泽方向";
dcWarning.setDirection("1"); dcWarning.setDirection("1");
} else if (Objects.equals(directionName, "中")) { } else if (Objects.equals(directionName, "中")) {
dcWarning.setDirection("2"); dcWarning.setDirection("2");
} else if (Objects.equals(directionName, "下行")) { } else if (Objects.equals(directionName, "下行")) {
direction = "济南方向";
dcWarning.setDirection("3"); dcWarning.setDirection("3");
} }
dcWarning.setWarningTime(happenTime); dcWarning.setWarningTime(happenTime);
@ -198,7 +208,7 @@ public class NonAutomaticWarningController extends BaseController {
} else if (crossingName.startsWith("嘉祥")) { } else if (crossingName.startsWith("嘉祥")) {
dcWarning.setStakeMark("k190+495"); dcWarning.setStakeMark("k190+495");
} }
dcWarning.setWarningTitle(crossingName+srcName); dcWarning.setWarningTitle(srcName + "收费站" + direction + "发生" + warningType + "事件");
dcWarning.setWarningSource(6); dcWarning.setWarningSource(6);
dcWarning.setWarningState(1); dcWarning.setWarningState(1);
dcWarningService.insertDcWarning(dcWarning); dcWarningService.insertDcWarning(dcWarning);

Loading…
Cancel
Save