|
|
@ -7,6 +7,7 @@ import com.ruoyi.common.utils.StakeMarkUtils; |
|
|
|
import com.ruoyi.common.utils.StringUtils; |
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil; |
|
|
|
import com.zc.business.constant.RedisKeyConstants; |
|
|
|
import com.zc.business.controller.WeatherForecastController; |
|
|
|
import com.zc.business.domain.DcSdhsEvent; |
|
|
|
import com.zc.business.domain.DcSdhsEventQuery; |
|
|
|
import com.zc.business.enums.UniversalEnum; |
|
|
@ -48,6 +49,8 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private RedisCache redisCache; |
|
|
|
@Autowired |
|
|
|
private WeatherForecastController weatherForecastController; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -742,4 +745,126 @@ public class DcSdhsEventServiceImpl implements IDcSdhsEventService { |
|
|
|
addDescription(doc,UniversalEnum.NO_DATA_AVAILABLE.getValue()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 查询天气情况统计 |
|
|
|
* |
|
|
|
* @author liuwenge |
|
|
|
* @date 2024/8/21 17:14 |
|
|
|
* @param |
|
|
|
* @return com.ruoyi.common.core.domain.AjaxResult |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public AjaxResult selectWeather(){ |
|
|
|
HashMap<String,Object> params = new HashMap<>(); |
|
|
|
params.put("roadId",UniversalEnum.ROAD_ID.getValue()); |
|
|
|
params.put("stakeNum",UniversalEnum.STAKE_NUM.getValue()); |
|
|
|
params.put("forecastHour",UniversalEnum.TWENTY_FOUR.getValue()); |
|
|
|
AjaxResult ajaxResult = weatherForecastController.currentWeatherAndForecastInformation(params); |
|
|
|
|
|
|
|
Map<String,Object> result = new HashMap<>(); |
|
|
|
Map<String,Object> column = new HashMap<>(); |
|
|
|
List<Map<String,Object>> dataList = new ArrayList<>(); |
|
|
|
if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { |
|
|
|
|
|
|
|
List<Map<String,Object>> data = (List<Map<String,Object>>) ajaxResult.get("data"); |
|
|
|
if (data != null && data.size() != UniversalEnum.ZERO.getNumber()){ |
|
|
|
|
|
|
|
DateTimeFormatter parseFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; |
|
|
|
|
|
|
|
data.forEach(dataItem ->{ |
|
|
|
|
|
|
|
Map<String,Object> regionMap = new HashMap<>(); |
|
|
|
if (UniversalEnum.STAKE_NUM_K60.getValue().equals(dataItem.get("stakeNum"))){ |
|
|
|
regionMap.put("regionName","长清区"); |
|
|
|
List<Map<String,Object>> weatherList = (List<Map<String,Object>>) dataItem.get("forecastList"); |
|
|
|
weatherList = weatherList.stream() |
|
|
|
.sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < weatherList.size(); i++) { |
|
|
|
//第一行 格式化时间
|
|
|
|
LocalDateTime localDateTime = LocalDateTime.parse(weatherList.get(i).get("weatherTime").toString(), parseFormatter); |
|
|
|
DateTimeFormatter formatFormatter = DateTimeFormatter.ofPattern("dd日HH时"); |
|
|
|
|
|
|
|
column.put("time"+(i+1),localDateTime.format(formatFormatter)); |
|
|
|
regionMap.put("time"+(i+1),weatherList.get(i).get("weatherDescription").toString()); |
|
|
|
} |
|
|
|
} else if (UniversalEnum.STAKE_NUM_K105.getValue().equals(dataItem.get("stakeNum"))){ |
|
|
|
regionMap.put("regionName","平阴县"); |
|
|
|
List<Map<String,Object>> weatherList = (List<Map<String,Object>>) dataItem.get("forecastList"); |
|
|
|
weatherList = weatherList.stream() |
|
|
|
.sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < weatherList.size(); i++) { |
|
|
|
regionMap.put("time"+(i+1),weatherList.get(i).get("weatherDescription").toString()); |
|
|
|
} |
|
|
|
} else if (UniversalEnum.STAKE_NUM_K145.getValue().equals(dataItem.get("stakeNum"))){ |
|
|
|
regionMap.put("regionName","东平县"); |
|
|
|
List<Map<String,Object>> weatherList = (List<Map<String,Object>>) dataItem.get("forecastList"); |
|
|
|
weatherList = weatherList.stream() |
|
|
|
.sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < weatherList.size(); i++) { |
|
|
|
regionMap.put("time"+(i+1),weatherList.get(i).get("weatherDescription").toString()); |
|
|
|
} |
|
|
|
|
|
|
|
} else if (UniversalEnum.STAKE_NUM_K165.getValue().equals(dataItem.get("stakeNum"))){ |
|
|
|
regionMap.put("regionName","汶上县"); |
|
|
|
List<Map<String,Object>> weatherList = (List<Map<String,Object>>) dataItem.get("forecastList"); |
|
|
|
weatherList = weatherList.stream() |
|
|
|
.sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < weatherList.size(); i++) { |
|
|
|
regionMap.put("time"+(i+1),weatherList.get(i).get("weatherDescription").toString()); |
|
|
|
} |
|
|
|
} else if (UniversalEnum.STAKE_NUM_K175.getValue().equals(dataItem.get("stakeNum"))){ |
|
|
|
regionMap.put("regionName","梁山县"); |
|
|
|
List<Map<String,Object>> weatherList = (List<Map<String,Object>>) dataItem.get("forecastList"); |
|
|
|
weatherList = weatherList.stream() |
|
|
|
.sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < weatherList.size(); i++) { |
|
|
|
regionMap.put("time"+(i+1),weatherList.get(i).get("weatherDescription").toString()); |
|
|
|
} |
|
|
|
} else if (UniversalEnum.STAKE_NUM_K190.getValue().equals(dataItem.get("stakeNum"))){ |
|
|
|
regionMap.put("regionName","嘉祥县"); |
|
|
|
List<Map<String,Object>> weatherList = (List<Map<String,Object>>) dataItem.get("forecastList"); |
|
|
|
weatherList = weatherList.stream() |
|
|
|
.sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < weatherList.size(); i++) { |
|
|
|
regionMap.put("time"+(i+1),weatherList.get(i).get("weatherDescription").toString()); |
|
|
|
} |
|
|
|
} else if (UniversalEnum.STAKE_NUM_K200.getValue().equals(dataItem.get("stakeNum"))){ |
|
|
|
regionMap.put("regionName","巨野县"); |
|
|
|
List<Map<String,Object>> weatherList = (List<Map<String,Object>>) dataItem.get("forecastList"); |
|
|
|
weatherList = weatherList.stream() |
|
|
|
.sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < weatherList.size(); i++) { |
|
|
|
regionMap.put("time"+(i+1),weatherList.get(i).get("weatherDescription").toString()); |
|
|
|
} |
|
|
|
} else if (UniversalEnum.STAKE_NUM_K205.getValue().equals(dataItem.get("stakeNum"))){ |
|
|
|
regionMap.put("regionName","郓城县"); |
|
|
|
List<Map<String,Object>> weatherList = (List<Map<String,Object>>) dataItem.get("forecastList"); |
|
|
|
weatherList = weatherList.stream() |
|
|
|
.sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
for (int i = UniversalEnum.ZERO.getNumber(); i < weatherList.size(); i++) { |
|
|
|
regionMap.put("time"+(i+1),weatherList.get(i).get("weatherDescription").toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
dataList.add(regionMap); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
return AjaxResult.error("暂无数据"); |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
return AjaxResult.error("查询失败"); |
|
|
|
} |
|
|
|
result.put("column",column); |
|
|
|
result.put("dataList",dataList); |
|
|
|
return AjaxResult.success(result); |
|
|
|
} |
|
|
|
} |
|
|
|