|
|
@ -6,6 +6,7 @@ import com.hnac.hzims.equipment.entity.PlanGenerationEntity; |
|
|
|
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; |
|
|
|
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; |
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; |
|
|
|
|
|
|
|
import com.hnac.hzims.hzimsweather.feign.IRainfallClient; |
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; |
|
|
|
import com.hnac.hzims.hzimsweather.response.weather.HeWeatherWeatherDailyResponse; |
|
|
|
import com.hnac.hzims.operational.data.service.HzimsDataService; |
|
|
|
import com.hnac.hzims.operational.data.service.HzimsDataService; |
|
|
|
import com.hnac.hzims.operational.data.vo.AreaVo; |
|
|
|
import com.hnac.hzims.operational.data.vo.AreaVo; |
|
|
@ -78,6 +79,8 @@ public class HzimsDataServiceImpl implements HzimsDataService { |
|
|
|
|
|
|
|
|
|
|
|
private final IEmInfoClient deviceClient; |
|
|
|
private final IEmInfoClient deviceClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IRainfallClient rainfallClient; |
|
|
|
|
|
|
|
|
|
|
|
private final IPlanGenertionClient planGenertionClient; |
|
|
|
private final IPlanGenertionClient planGenertionClient; |
|
|
|
|
|
|
|
|
|
|
|
private final RedisTemplate redisTemplate; |
|
|
|
private final RedisTemplate redisTemplate; |
|
|
@ -284,6 +287,7 @@ public class HzimsDataServiceImpl implements HzimsDataService { |
|
|
|
weatherWater.setDailys(week.getDaily()); |
|
|
|
weatherWater.setDailys(week.getDaily()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 水位、降雨
|
|
|
|
weatherWater.setWeatherRains(this.waterRain(stationCode)); |
|
|
|
weatherWater.setWeatherRains(this.waterRain(stationCode)); |
|
|
|
redisTemplate.opsForValue().set(conver_weather_key + stationCode,weatherWater); |
|
|
|
redisTemplate.opsForValue().set(conver_weather_key + stationCode,weatherWater); |
|
|
|
redisTemplate.expire(conver_weather_key + stationCode,30, TimeUnit.MINUTES); |
|
|
|
redisTemplate.expire(conver_weather_key + stationCode,30, TimeUnit.MINUTES); |
|
|
@ -340,14 +344,17 @@ public class HzimsDataServiceImpl implements HzimsDataService { |
|
|
|
private List<WeatherRainVo> waterRain(String stationCode) { |
|
|
|
private List<WeatherRainVo> waterRain(String stationCode) { |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
String endTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
String endTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
String rainEnd = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); |
|
|
|
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
calendar.add(Calendar.HOUR_OF_DAY,-calendar.get(Calendar.HOUR_OF_DAY)); |
|
|
|
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.MINUTE,-calendar.get(Calendar.MINUTE)); |
|
|
|
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND)); |
|
|
|
calendar.add(Calendar.SECOND,-calendar.get(Calendar.SECOND)); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-29); |
|
|
|
calendar.add(Calendar.DAY_OF_MONTH,-29); |
|
|
|
String startTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
String startTime = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATETIME); |
|
|
|
|
|
|
|
String rainStart = DateUtil.format(calendar.getTime(),DateUtil.PATTERN_DATE); |
|
|
|
// 查询水位数据
|
|
|
|
// 查询水位数据
|
|
|
|
List<AnalyseDataTaosVO> waters = this.water(startTime,endTime,stationCode,3); |
|
|
|
List<AnalyseDataTaosVO> waters = this.water(startTime,endTime,stationCode,3); |
|
|
|
// TODO 查询降雨数据
|
|
|
|
// 查询降雨数据
|
|
|
|
|
|
|
|
R<List<Map<String, Object>>> rains = rainfallClient.getDurationRainFall(stationCode,rainStart,rainEnd); |
|
|
|
// 近30天水位、降雨量
|
|
|
|
// 近30天水位、降雨量
|
|
|
|
List<String> days = this.get30Day(); |
|
|
|
List<String> days = this.get30Day(); |
|
|
|
return days.stream().map(day->{ |
|
|
|
return days.stream().map(day->{ |
|
|
@ -365,8 +372,22 @@ public class HzimsDataServiceImpl implements HzimsDataService { |
|
|
|
} |
|
|
|
} |
|
|
|
}).sum()); |
|
|
|
}).sum()); |
|
|
|
} |
|
|
|
} |
|
|
|
// TODO 降雨量数据
|
|
|
|
// 降雨
|
|
|
|
|
|
|
|
if(!rains.isSuccess() || CollectionUtil.isEmpty(rains.getData())){ |
|
|
|
weatherRain.setRain(0.0); |
|
|
|
weatherRain.setRain(0.0); |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
weatherRain.setRain(rains.getData().stream().mapToDouble(map->{ |
|
|
|
|
|
|
|
if (map.get("fx_date").equals(day)) { |
|
|
|
|
|
|
|
Object object = map.get("precip"); |
|
|
|
|
|
|
|
if(ObjectUtil.isEmpty(object)){ |
|
|
|
|
|
|
|
return 0.0; |
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
return Double.parseDouble(object.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return 0.0; |
|
|
|
|
|
|
|
}).sum()); |
|
|
|
|
|
|
|
} |
|
|
|
return weatherRain; |
|
|
|
return weatherRain; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
} |
|
|
|