|
@ -10,8 +10,10 @@ import com.ruoyi.system.service.ISysConfigService; |
|
|
import com.zc.business.domain.DcNoStakeWarningTable; |
|
|
import com.zc.business.domain.DcNoStakeWarningTable; |
|
|
import com.zc.business.domain.DcRegion; |
|
|
import com.zc.business.domain.DcRegion; |
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
|
|
|
import com.zc.business.service.IDcWarningService; |
|
|
import com.zc.business.service.impl.DcNoStakeWarningTableServiceImpl; |
|
|
import com.zc.business.service.impl.DcNoStakeWarningTableServiceImpl; |
|
|
import com.zc.business.service.impl.DcRegionServiceImpl; |
|
|
import com.zc.business.service.impl.DcRegionServiceImpl; |
|
|
|
|
|
import com.zc.business.utils.WeatherTrafficProposeUtil; |
|
|
import com.zc.common.core.httpclient.OkHttp; |
|
|
import com.zc.common.core.httpclient.OkHttp; |
|
|
import com.zc.common.core.httpclient.exception.HttpException; |
|
|
import com.zc.common.core.httpclient.exception.HttpException; |
|
|
import com.zc.common.core.httpclient.request.RequestParams; |
|
|
import com.zc.common.core.httpclient.request.RequestParams; |
|
@ -62,6 +64,9 @@ public class WeatherForecastController extends BaseController { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private DcNoStakeWarningTableServiceImpl noStakeWarningTableService; |
|
|
private DcNoStakeWarningTableServiceImpl noStakeWarningTableService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private IDcWarningService dcWarningService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** |
|
|
/*** |
|
|
* 定时查询气象预警信息并上报 |
|
|
* 定时查询气象预警信息并上报 |
|
@ -73,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())) { |
|
@ -87,9 +92,9 @@ public class WeatherForecastController extends BaseController { |
|
|
data.forEach(item -> { |
|
|
data.forEach(item -> { |
|
|
JSONObject jsonObject = (JSONObject) JSON.toJSON(item); |
|
|
JSONObject jsonObject = (JSONObject) JSON.toJSON(item); |
|
|
String earlyWorningSignal = jsonObject.getString("earlyWorningSignal"); |
|
|
String earlyWorningSignal = jsonObject.getString("earlyWorningSignal"); |
|
|
String[] split = earlyWorningSignal.split(UniversalEnum.EMPTY_STRING.getValue()); |
|
|
String[] split = earlyWorningSignal.split(UniversalEnum.YJ_STRING.getValue()); |
|
|
String earlyWarningType = split[UniversalEnum.ZERO.getNumber()]; |
|
|
String earlyWarningType = split[UniversalEnum.ZERO.getNumber()]; |
|
|
String warningLevel = split[UniversalEnum.THREE.getNumber()]; |
|
|
String warningLevel = split[UniversalEnum.ONE.getNumber()]; |
|
|
|
|
|
|
|
|
switch (warningLevel) { |
|
|
switch (warningLevel) { |
|
|
case "0": |
|
|
case "0": |
|
@ -186,18 +191,14 @@ public class WeatherForecastController extends BaseController { |
|
|
jsonObject.put("earlyWarningTypeString", UniversalEnum.ICY_ROADS.toString()); |
|
|
jsonObject.put("earlyWarningTypeString", UniversalEnum.ICY_ROADS.toString()); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//List<JSONObject> currentWeatherAndForecastInformation = redisCache.getCacheList(UniversalEnum.CURRENT_WEATHER_AND_FORECAST_INFORMATION.getValue());
|
|
|
|
|
|
//List<JSONObject> collect = currentWeatherAndForecastInformation.stream().filter(ite ->
|
|
|
|
|
|
// !Objects.equals(ite.getString("earlyWorningIssueDate"), jsonObject.getString("earlyWorningIssueDate"))
|
|
|
|
|
|
// && !Objects.equals(ite.getString("earlyWorningTitle"), jsonObject.getString("earlyWorningTitle"))
|
|
|
|
|
|
// && !Objects.equals(ite.getString("stationName"), jsonObject.getString("stationName"))).collect(Collectors.toList());
|
|
|
|
|
|
List<DcNoStakeWarningTable> dcNoStakeWarningTables = noStakeWarningTableService.listDcNoStakeWarningTable(noStakeWarningTable, null, null); |
|
|
List<DcNoStakeWarningTable> dcNoStakeWarningTables = noStakeWarningTableService.listDcNoStakeWarningTable(noStakeWarningTable, null, null); |
|
|
List<DcNoStakeWarningTable> collect = dcNoStakeWarningTables.stream().filter(ite -> |
|
|
List<DcNoStakeWarningTable> collect = dcNoStakeWarningTables.stream().filter(ite -> |
|
|
Objects.equals(ite.getWarningTime(), jsonObject.getDate("earlyWorningIssueDate")) |
|
|
Objects.equals(ite.getWarningTime(), jsonObject.getDate("earlyWorningIssueDate")) |
|
|
&& 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); //推送事件消息 不是感知事件
|
|
|
WebSocketService.broadcast(UniversalEnum.THREE.getValue(), jsonObject); //推送事件消息 不是感知事件
|
|
|
DcNoStakeWarningTable dcNoStakeWarningTable = new DcNoStakeWarningTable(); |
|
|
DcNoStakeWarningTable dcNoStakeWarningTable = new DcNoStakeWarningTable(); |
|
|
dcNoStakeWarningTable.setWarningDescription(jsonObject.getString("earlyWorningContent")); |
|
|
dcNoStakeWarningTable.setWarningDescription(jsonObject.getString("earlyWorningContent")); |
|
@ -594,6 +595,63 @@ public class WeatherForecastController extends BaseController { |
|
|
@ApiOperation("当前气象预警信息查询") |
|
|
@ApiOperation("当前气象预警信息查询") |
|
|
@PostMapping(value = "/currentWeatherWarningInformationQuery") |
|
|
@PostMapping(value = "/currentWeatherWarningInformationQuery") |
|
|
public AjaxResult currentWeatherWarningInformationQuery(@RequestBody HashMap<String, Object> parameter) { |
|
|
public AjaxResult currentWeatherWarningInformationQuery(@RequestBody HashMap<String, Object> parameter) { |
|
|
|
|
|
List<DcNoStakeWarningTable> list = dcWarningService.selectStakeWarningTable(); |
|
|
|
|
|
|
|
|
|
|
|
List<JSONObject> result = list.stream() |
|
|
|
|
|
.map(table -> { |
|
|
|
|
|
JSONObject otherConfig = JSONObject.parseObject(table.getOtherConfig()); |
|
|
|
|
|
String earlyWorningSignal = otherConfig.getString("earlyWorningSignal"); |
|
|
|
|
|
String[] split = earlyWorningSignal.split(UniversalEnum.YJ_STRING.getValue()); |
|
|
|
|
|
String content = WeatherTrafficProposeUtil.content( |
|
|
|
|
|
Integer.parseInt(split[UniversalEnum.ONE.getNumber()]), |
|
|
|
|
|
split[UniversalEnum.ZERO.getNumber()] |
|
|
|
|
|
); |
|
|
|
|
|
otherConfig.put("earlyWorningContent", table.getWarningDescription() + "\n" +content); |
|
|
|
|
|
return otherConfig; |
|
|
|
|
|
}) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
return AjaxResult.success(result); |
|
|
|
|
|
|
|
|
|
|
|
// 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<>());
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public AjaxResult currentWeatherWarningInformationQuerys(@RequestBody HashMap<String, Object> parameter) { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
|
|
|
|
|
@ -604,7 +662,6 @@ public class WeatherForecastController extends BaseController { |
|
|
= okHttp |
|
|
= okHttp |
|
|
.headers(new HashMap<>()) |
|
|
.headers(new HashMap<>()) |
|
|
.url(UniversalEnum.CURRENT_WEATHER_WARNING_INFORMATION_QUERY.getValue()) // 请求地址
|
|
|
.url(UniversalEnum.CURRENT_WEATHER_WARNING_INFORMATION_QUERY.getValue()) // 请求地址
|
|
|
//.url("http://10.166.133.9:38999/api/weather_service/get_earlyworning_info_jh") // 请求地址
|
|
|
|
|
|
.data(requestParams) |
|
|
.data(requestParams) |
|
|
.post(); // 请求方法
|
|
|
.post(); // 请求方法
|
|
|
|
|
|
|
|
@ -613,32 +670,6 @@ public class WeatherForecastController extends BaseController { |
|
|
JSONObject jsonResult = JSONObject.parseObject(response.body().string()); |
|
|
JSONObject jsonResult = JSONObject.parseObject(response.body().string()); |
|
|
if (jsonResult.getInteger("code") == UniversalEnum.TWO_HUNDRED.getNumber()) { |
|
|
if (jsonResult.getInteger("code") == UniversalEnum.TWO_HUNDRED.getNumber()) { |
|
|
JSONArray jsonArray = jsonResult.getJSONArray("data"); |
|
|
JSONArray jsonArray = jsonResult.getJSONArray("data"); |
|
|
//List<Object> collect = 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());
|
|
|
|
|
|
// //if (Objects.equals(jsonObject.getString("stationName"), "长清")
|
|
|
|
|
|
// // || Objects.equals(jsonObject.getString("stationName"), "平阴")
|
|
|
|
|
|
// // || Objects.equals(jsonObject.getString("stationName"), "东平")
|
|
|
|
|
|
// // || Objects.equals(jsonObject.getString("stationName"), "汶上")
|
|
|
|
|
|
// // || Objects.equals(jsonObject.getString("stationName"), "梁山")
|
|
|
|
|
|
// // || Objects.equals(jsonObject.getString("stationName"), "嘉祥")
|
|
|
|
|
|
// // || Objects.equals(jsonObject.getString("stationName"), "巨野")
|
|
|
|
|
|
// // || Objects.equals(jsonObject.getString("stationName"), "郓城")) {
|
|
|
|
|
|
// // return true;
|
|
|
|
|
|
// //} else {
|
|
|
|
|
|
// // return false;
|
|
|
|
|
|
// //}
|
|
|
|
|
|
//}).collect(Collectors.toList());
|
|
|
|
|
|
//if (collect.size() != UniversalEnum.ZERO.getNumber()) {
|
|
|
|
|
|
// redisCache.deleteObject("currentWeatherWarningInformationQuery");
|
|
|
|
|
|
// redisCache.setCacheList("currentWeatherWarningInformationQuery", collect);
|
|
|
|
|
|
return AjaxResult.success(jsonArray.stream().filter(item -> { |
|
|
return AjaxResult.success(jsonArray.stream().filter(item -> { |
|
|
JSONObject jsonObject = (JSONObject) JSON.toJSON(item); |
|
|
JSONObject jsonObject = (JSONObject) JSON.toJSON(item); |
|
|
return Objects.equals(jsonObject.getString("stationName"), UniversalEnum.CHANGQING_COUNTY.getValue()) |
|
|
return Objects.equals(jsonObject.getString("stationName"), UniversalEnum.CHANGQING_COUNTY.getValue()) |
|
@ -649,29 +680,13 @@ public class WeatherForecastController extends BaseController { |
|
|
|| Objects.equals(jsonObject.getString("stationName"), UniversalEnum.JIA_XIANG.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.JU_YE.getValue()) |
|
|
|| Objects.equals(jsonObject.getString("stationName"), UniversalEnum.YUNCHENG_A_COUNTY_IN_SHANDONG_PROVINCE.getValue()); |
|
|
|| Objects.equals(jsonObject.getString("stationName"), UniversalEnum.YUNCHENG_A_COUNTY_IN_SHANDONG_PROVINCE.getValue()); |
|
|
//if (Objects.equals(jsonObject.getString("stationName"), "长清")
|
|
|
|
|
|
// || Objects.equals(jsonObject.getString("stationName"), "平阴")
|
|
|
|
|
|
// || Objects.equals(jsonObject.getString("stationName"), "东平")
|
|
|
|
|
|
// || Objects.equals(jsonObject.getString("stationName"), "汶上")
|
|
|
|
|
|
// || Objects.equals(jsonObject.getString("stationName"), "梁山")
|
|
|
|
|
|
// || Objects.equals(jsonObject.getString("stationName"), "嘉祥")
|
|
|
|
|
|
// || Objects.equals(jsonObject.getString("stationName"), "巨野")
|
|
|
|
|
|
// || Objects.equals(jsonObject.getString("stationName"), "郓城")) {
|
|
|
|
|
|
// return true;
|
|
|
|
|
|
//} else {
|
|
|
|
|
|
// return false;
|
|
|
|
|
|
//}
|
|
|
|
|
|
}).collect(Collectors.toList())); |
|
|
}).collect(Collectors.toList())); |
|
|
//} else {
|
|
|
|
|
|
// return AjaxResult.success(redisCache.getCacheList("currentWeatherWarningInformationQuery"));
|
|
|
|
|
|
//}
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
return AjaxResult.success(new ArrayList<>()); |
|
|
return AjaxResult.success(new ArrayList<>()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} catch (Exception ignored) { |
|
|
} catch (Exception ignored) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
return AjaxResult.success(new ArrayList<>()); |
|
|
return AjaxResult.success(new ArrayList<>()); |
|
|
} |
|
|
} |
|
|