From df4c8aa44fbb1ce34e67f05ff6ce707d6d4ee639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Tue, 18 Jun 2024 09:24:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B0=94=E8=B1=A1=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E5=99=A8=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DcTrafficStatisticsController.java | 12 +++++ .../zc/business/domain/DcTrafficPolice.java | 6 +-- .../device/handler/DeviceMessageHandler.java | 49 +++++++++++++++++-- .../service/IDcTrafficStatisticsService.java | 1 + .../service/impl/DcEventServiceImpl.java | 2 +- .../impl/DcTrafficStatisticsServiceImpl.java | 6 +-- 6 files changed, 65 insertions(+), 11 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java b/zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java index 38c7f610..b5c6e7d0 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java @@ -399,5 +399,17 @@ public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endD // 将查询结果封装为成功响应并返回 return AjaxResult.success(mapList); } + /** + * 全路段双向实时车流量 + * @param startDate 时间 + * @param direction 方向 + */ + @ApiOperation("集团双向实时车流量") + @GetMapping("/history/realTimeTrafficFlowHour2") + public AjaxResult realTimeTrafficFlowHour2(String startDate,Long direction) throws HttpException, IOException{ + JSONArray mapList = dcTrafficStatisticsService.realTimeTrafficFlowHour2(startDate,direction); + // 将查询结果封装为成功响应并返回 + return AjaxResult.success(mapList); + } } \ No newline at end of file diff --git a/zc-business/src/main/java/com/zc/business/domain/DcTrafficPolice.java b/zc-business/src/main/java/com/zc/business/domain/DcTrafficPolice.java index 7ddef15d..9780e3b8 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcTrafficPolice.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcTrafficPolice.java @@ -24,7 +24,7 @@ public class DcTrafficPolice extends BaseEntity /** $column.columnComment */ @ApiModelProperty("名称") - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + @Excel(name = "名称") private String name; @ApiModelProperty("电话") /** 电话 */ @@ -32,12 +32,12 @@ public class DcTrafficPolice extends BaseEntity private String phone; @ApiModelProperty("开始桩号") /** $column.columnComment */ - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + @Excel(name = "起始桩号") private String stakeMake; /** $column.columnComment */ @ApiModelProperty("结束桩号") - @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + @Excel(name = "结束桩号") private String endMake; public void setId(Long id) diff --git a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java index 74913066..c8a93042 100644 --- a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java +++ b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java @@ -588,6 +588,7 @@ public class DeviceMessageHandler { String stakeMark = strings[1]; String direction = strings[2]; + //设备名称 meteorologicalDetectorData.setDeviceName(deviceName); //位置 @@ -595,25 +596,60 @@ public class DeviceMessageHandler { //方向 meteorologicalDetectorData.setDirection(direction); - //todo 首页推送事件消息 3气象检测器 + //todo 首页推送事件消息 气象检测器 if (!meteorologicalDetectorData.getPrecipitationType().equals("0")) {//降水类型 0=无降;1=雨;2=雪;3=毛毛雨;4=雨夹雪; - WebSocketService.broadcast(WebSocketEvent.WARNING, meteorologicalDetectorData); + String precipitationType =""; +if (meteorologicalDetectorData.getPrecipitationType().equals("1")){ + precipitationType="发生降雨异常天气事件"; +}if (meteorologicalDetectorData.getPrecipitationType().equals("2")){ + precipitationType="发生降雪异常天气事件"; +}if (meteorologicalDetectorData.getPrecipitationType().equals("3")){ + precipitationType="发生毛毛雨异常天气事件"; +}if (meteorologicalDetectorData.getPrecipitationType().equals("4")){ + precipitationType="发生雨夹雪异常天气事件"; +} + String content= direction+ stakeMark+precipitationType; + + Map contentMap = new HashMap<>(); + contentMap.put("content",content); + contentMap.put("event",meteorologicalDetectorData); + WebSocketService.broadcast(WebSocketEvent.WARNING, contentMap); JSONObject object = new JSONObject(); object.put("meteorologicalDetectorData", meteorologicalDetectorData); String string = object.toString(); + DcWarning dcWarning = new DcWarning(); dcWarning.setStakeMark(meteorologicalDetectorData.getStakeMark()); dcWarning.setWarningSource(7);//气象检测器 dcWarning.setOtherConfig(string); dcWarning.setWarningTitle("气象预警"); + if (direction.equals("菏泽方向")){ + dcWarning.setDirection("1"); + } + if (direction.equals("济南方向")){ + dcWarning.setDirection("3"); + } dcWarningService.insertDcWarning(dcWarning); //待确认数量 dcEventService.getCountNum(); } if (!meteorologicalDetectorData.getVisibilityType().equals("4")) {// 能见度类型,4 表示能见度良好3表示阴霾 2表示雾 1表示浓雾; - WebSocketService.broadcast(WebSocketEvent.WARNING, meteorologicalDetectorData); + String precipitationType =""; + if (meteorologicalDetectorData.getVisibilityType().equals("3")){ + precipitationType="发生阴霾异常天气事件"; + }if (meteorologicalDetectorData.getVisibilityType().equals("2")){ + precipitationType="发生雾异常天气事件"; + }if (meteorologicalDetectorData.getVisibilityType().equals("1")){ + precipitationType="发生浓雾异常天气事件"; + } + String content= direction+ stakeMark+precipitationType; + + Map contentMap = new HashMap<>(); + contentMap.put("content",content); + contentMap.put("event",meteorologicalDetectorData); + WebSocketService.broadcast(WebSocketEvent.WARNING, contentMap); JSONObject object = new JSONObject(); object.put("meteorologicalDetectorData", meteorologicalDetectorData); String string = object.toString(); @@ -622,7 +658,12 @@ public class DeviceMessageHandler { dcWarning.setWarningSource(7);//气象检测器 dcWarning.setOtherConfig(string); dcWarning.setWarningTitle("气象预警"); - + if (direction.equals("菏泽方向")){ + dcWarning.setDirection("1"); + } + if (direction.equals("济南方向")){ + dcWarning.setDirection("3"); + } dcWarningService.insertDcWarning(dcWarning); //待确认数量 diff --git a/zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java b/zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java index da1071d2..d9060922 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java @@ -53,5 +53,6 @@ public interface IDcTrafficStatisticsService { List> realTimeTrafficFlowHour(String startDate,Long direction) throws HttpException, IOException; + JSONArray realTimeTrafficFlowHour2(String startDate,Long direction) throws HttpException, IOException; } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index c9b95312..d2c50612 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -573,7 +573,7 @@ public class DcEventServiceImpl extends ServiceImpl impl contentMap.put("content", content); contentMap.put("event", dcEvent); - WebSocketService.broadcast(WebSocketEvent.EVENT, contentMap); //推送事件消息 0不是感知事件 + WebSocketService.broadcast(WebSocketEvent.EVENT, contentMap); //推送事件消息 0 不是感知事件 getCountNum(); diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java index 08f3c11d..04e6723d 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java @@ -800,7 +800,7 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi } return ""; } - public List> realTimeTrafficFlowHour2(String startDate,Long direction) throws HttpException, IOException { + public JSONArray realTimeTrafficFlowHour2(String startDate,Long direction) throws HttpException, IOException { OkHttp okHttp = new OkHttp(); RequestParams requestParams = new RequestParams(); @@ -859,10 +859,10 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi // 输出结果 - return list; + return jsonArray; } - return new ArrayList(); + return null; } }