From 2e35eafb1061bded0d1171be0cbbabfbd739123a Mon Sep 17 00:00:00 2001 From: zhaoxianglong Date: Wed, 7 Feb 2024 10:40:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=9D=9E=E6=9C=BA=E9=A2=84?= =?UTF-8?q?=E8=AD=A6=E4=BA=8B=E4=BB=B6=E4=B8=8A=E6=8A=A5=E5=AD=98=E5=82=A8?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NonAutomaticWarningController.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java b/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java index 6aa9461d..af4fa94f 100644 --- a/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java @@ -7,7 +7,6 @@ import com.hikvision.artemis.sdk.ArtemisHttpUtil; import com.hikvision.artemis.sdk.config.ArtemisConfig; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.utils.uuid.IdUtils; import com.zc.business.domain.DcWarning; import com.zc.business.service.IDcWarningService; import io.swagger.annotations.Api; @@ -102,12 +101,7 @@ public class NonAutomaticWarningController extends BaseController { client.setCallback(new MqttCallback() { public void connectionLost(Throwable cause) { - System.out.println("断开连接"); - //try { - // eventSubscription(); - //} catch (Exception e) { - // throw new RuntimeException(e); - //} + System.out.println("断开连接.........."); } public void messageArrived(String topic, MqttMessage message) { @@ -122,16 +116,21 @@ public class NonAutomaticWarningController extends BaseController { events.forEach(item -> { JSONObject event = JSONObject.parseObject(String.valueOf(item)); JSONObject data = event.getJSONObject("data"); - String crossingIndexCode = event.getString("crossingIndexCode"); Date happenTime = event.getDate("happenTime"); String srcName = event.getString("srcName").split("收费站")[1]; String illegalTrafficEvent = data.getString("illegalTrafficEvent"); String directionName = data.getString("directionName"); String crossingName = data.getString("crossingName"); - String targetPicUrl = data.getString("targetPicUrl"); + String targetPicUrl = "https://10.0.81.28"+data.getString("targetPicUrl"); + String laneNo = data.getString("laneNo"); + ArrayList pictures = new ArrayList<>(); + pictures.add(targetPicUrl); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("pictures",pictures); DcWarning dcWarning = new DcWarning(); - dcWarning.setOtherConfig(jsonObjString); + dcWarning.setOtherConfig(String.valueOf(jsonObject)); + dcWarning.setLane(laneNo); switch (illegalTrafficEvent) { case "congestion"://拥堵 dcWarning.setWarningType(1); @@ -224,10 +223,10 @@ public class NonAutomaticWarningController extends BaseController { //System.out.println("开始监听" + topicName.getString("6274883585")); client.subscribe(topicName.getString("6274879489"), 1); System.out.println("开始监听" + topicName.getString("6274879489")); - client.subscribe(topicName.getString("7768236033"), 1); - System.out.println("开始监听" + topicName.getString("7768236033")); - client.subscribe(topicName.getString("7835340801"), 1); - System.out.println("开始监听" + topicName.getString("7835340801")); + //client.subscribe(topicName.getString("7768236033"), 1); + //System.out.println("开始监听" + topicName.getString("7768236033")); + //client.subscribe(topicName.getString("7835340801"), 1); + //System.out.println("开始监听" + topicName.getString("7835340801")); } catch (Exception e) { e.printStackTrace(); }