|
@ -78,7 +78,7 @@ public class WeatherForecastController extends BaseController { |
|
|
hashMap.put("roadId", UniversalEnum.ROAD_ID.getValue()); |
|
|
hashMap.put("roadId", UniversalEnum.ROAD_ID.getValue()); |
|
|
hashMap.put("earlyWorningLevel", UniversalEnum.EARLY_WORNING_LEVEL.getValue()); |
|
|
hashMap.put("earlyWorningLevel", UniversalEnum.EARLY_WORNING_LEVEL.getValue()); |
|
|
//hashMap.put("managerId", UniversalEnum.MANAGER_ID.getValue());
|
|
|
//hashMap.put("managerId", UniversalEnum.MANAGER_ID.getValue());
|
|
|
AjaxResult ajaxResult = currentWeatherWarningInformationQuery(hashMap); |
|
|
AjaxResult ajaxResult = currentWeatherWarningInformationQuerys(hashMap); |
|
|
|
|
|
|
|
|
String code = String.valueOf(ajaxResult.get("code")); |
|
|
String code = String.valueOf(ajaxResult.get("code")); |
|
|
if (!Objects.equals(code, UniversalEnum.TWO_HUNDRED.getValue())) { |
|
|
if (!Objects.equals(code, UniversalEnum.TWO_HUNDRED.getValue())) { |
|
@ -197,15 +197,15 @@ public class WeatherForecastController extends BaseController { |
|
|
&& Objects.equals(ite.getWarningDescription(), jsonObject.getString("earlyWorningContent")) |
|
|
&& Objects.equals(ite.getWarningDescription(), jsonObject.getString("earlyWorningContent")) |
|
|
&& Objects.equals(ite.getWarningType(), UniversalEnum.TWO.getValue())).collect(Collectors.toList()); |
|
|
&& Objects.equals(ite.getWarningType(), UniversalEnum.TWO.getValue())).collect(Collectors.toList()); |
|
|
if (collect.size() == UniversalEnum.ZERO.getNumber()) { |
|
|
if (collect.size() == UniversalEnum.ZERO.getNumber()) { |
|
|
|
|
|
String content= WeatherTrafficProposeUtil.content(Integer.parseInt(warningLevel), earlyWarningType); |
|
|
|
|
|
jsonObject.put("earlyWorningContent", jsonObject.getString("earlyWorningContent")+content); |
|
|
|
|
|
WebSocketService.broadcast(UniversalEnum.THREE.getValue(), jsonObject); //推送事件消息 不是感知事件
|
|
|
DcNoStakeWarningTable dcNoStakeWarningTable = new DcNoStakeWarningTable(); |
|
|
DcNoStakeWarningTable dcNoStakeWarningTable = new DcNoStakeWarningTable(); |
|
|
dcNoStakeWarningTable.setWarningDescription(jsonObject.getString("earlyWorningContent")); |
|
|
dcNoStakeWarningTable.setWarningDescription(jsonObject.getString("earlyWorningContent")); |
|
|
dcNoStakeWarningTable.setWarningType(UniversalEnum.TWO.getValue()); |
|
|
dcNoStakeWarningTable.setWarningType(UniversalEnum.TWO.getValue()); |
|
|
dcNoStakeWarningTable.setWarningTime(jsonObject.getDate("earlyWorningIssueDate")); |
|
|
dcNoStakeWarningTable.setWarningTime(jsonObject.getDate("earlyWorningIssueDate")); |
|
|
dcNoStakeWarningTable.setOtherConfig(String.valueOf(jsonObject)); |
|
|
dcNoStakeWarningTable.setOtherConfig(String.valueOf(jsonObject)); |
|
|
noStakeWarningTableService.addDcNoStakeWarningTable(dcNoStakeWarningTable); |
|
|
noStakeWarningTableService.addDcNoStakeWarningTable(dcNoStakeWarningTable); |
|
|
String content= WeatherTrafficProposeUtil.content(Integer.parseInt(warningLevel), earlyWarningType); |
|
|
|
|
|
jsonObject.put("earlyWorningContent", jsonObject.getString("earlyWorningContent")+content); |
|
|
|
|
|
WebSocketService.broadcast(UniversalEnum.THREE.getValue(), jsonObject); //推送事件消息 不是感知事件
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
@ -651,6 +651,47 @@ public class WeatherForecastController extends BaseController { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AjaxResult currentWeatherWarningInformationQuerys(@RequestBody HashMap<String, Object> parameter) { |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
|
|
OkHttp okHttp = new OkHttp(); |
|
|
|
|
|
|
|
|
|
|
|
RequestParams requestParams = new RequestParams(parameter); |
|
|
|
|
|
Response response // 请求响应
|
|
|
|
|
|
= okHttp |
|
|
|
|
|
.headers(new HashMap<>()) |
|
|
|
|
|
.url(UniversalEnum.CURRENT_WEATHER_WARNING_INFORMATION_QUERY.getValue()) // 请求地址
|
|
|
|
|
|
.data(requestParams) |
|
|
|
|
|
.post(); // 请求方法
|
|
|
|
|
|
|
|
|
|
|
|
if (response.body() != null) { |
|
|
|
|
|
|
|
|
|
|
|
JSONObject jsonResult = JSONObject.parseObject(response.body().string()); |
|
|
|
|
|
if (jsonResult.getInteger("code") == UniversalEnum.TWO_HUNDRED.getNumber()) { |
|
|
|
|
|
JSONArray jsonArray = jsonResult.getJSONArray("data"); |
|
|
|
|
|
return AjaxResult.success(jsonArray.stream().filter(item -> { |
|
|
|
|
|
JSONObject jsonObject = (JSONObject) JSON.toJSON(item); |
|
|
|
|
|
return Objects.equals(jsonObject.getString("stationName"), UniversalEnum.CHANGQING_COUNTY.getValue()) |
|
|
|
|
|
|| Objects.equals(jsonObject.getString("stationName"), UniversalEnum.PING_YIN.getValue()) |
|
|
|
|
|
|| Objects.equals(jsonObject.getString("stationName"), UniversalEnum.DONG_PING.getValue()) |
|
|
|
|
|
|| Objects.equals(jsonObject.getString("stationName"), UniversalEnum.MONKAMI.getValue()) |
|
|
|
|
|
|| Objects.equals(jsonObject.getString("stationName"), UniversalEnum.LIANG_SHAN.getValue()) |
|
|
|
|
|
|| Objects.equals(jsonObject.getString("stationName"), UniversalEnum.JIA_XIANG.getValue()) |
|
|
|
|
|
|| Objects.equals(jsonObject.getString("stationName"), UniversalEnum.JU_YE.getValue()) |
|
|
|
|
|
|| Objects.equals(jsonObject.getString("stationName"), UniversalEnum.YUNCHENG_A_COUNTY_IN_SHANDONG_PROVINCE.getValue()); |
|
|
|
|
|
}).collect(Collectors.toList())); |
|
|
|
|
|
} else { |
|
|
|
|
|
return AjaxResult.success(new ArrayList<>()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
return AjaxResult.success(new ArrayList<>()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
* 天气实况查询 |
|
|
* 天气实况查询 |
|
|
* */ |
|
|
* */ |
|
|