Browse Source

修改气象检测器推送

develop
王兴琳 5 months ago
parent
commit
df4c8aa44f
  1. 12
      zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java
  2. 6
      zc-business/src/main/java/com/zc/business/domain/DcTrafficPolice.java
  3. 49
      zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java
  4. 1
      zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java
  5. 6
      zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java

12
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);
}
}

6
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)

49
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<String,Object> 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<String,Object> 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);
//待确认数量

1
zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java

@ -53,5 +53,6 @@ public interface IDcTrafficStatisticsService {
List<Map<String, Object>> realTimeTrafficFlowHour(String startDate,Long direction) throws HttpException, IOException;
JSONArray realTimeTrafficFlowHour2(String startDate,Long direction) throws HttpException, IOException;
}

6
zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java

@ -800,7 +800,7 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi
}
return "";
}
public List<Map<String, Object>> 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;
}
}

Loading…
Cancel
Save