1:洪水预报-将查询的整点过五分的数据,改为整点数据

2:渗流同样将整点过五分数据改为整点(只改变时间)
不确定是否监测数据就为整点过五分数据还是别的
master
yangzhe123 2025-11-04 11:20:53 +08:00
parent de5eb202ae
commit d1d835ff02
6 changed files with 350 additions and 33 deletions

View File

@ -26,15 +26,16 @@ public interface AttResBaseMapper extends BaseMapper<AttResBase> {
select t.stcd,t.stnm,t.lgtd lgtd,t.lttd lttd,t.source,t.sttp,t.stlc,t.adcd,t.esstym,s.res_code,s.fl_low_lim_lev,
s.tot_cap,s.ben_res_cap,s.norm_wat_lev,s.crest_elev,s.des_flood_lev,s.dead_lev,s.cal_flood_lev,s.wat_shed_area,s.dead_cap,sad.adnm,
m.tm,m.rz,(m.rz-s.fl_low_lim_lev) as aFsltdz,sprr.tm as drpTm,sprr.h1,sprr.h3,sprr.h6,sprr.h12,sprr.h24,sprr.today,
case when s.cal_flood_lev is not null and m.rz-s.cal_flood_lev &gt; 0 then 1 else 0 end as calState,
case when s.des_flood_lev is not null and m.rz-s.des_flood_lev &gt; 0 then 1 else 0 end as desState,
case when s.fl_low_lim_lev is not null and m.rz-s.fl_low_lim_lev &gt; 0 then 1 else 0 end as flState
case when s.cal_flood_lev is not null and m.rz-s.cal_flood_lev >= 0 then 1 else 0 end as calState,
case when s.des_flood_lev is not null and m.rz-s.des_flood_lev >= 0 then 1 else 0 end as desState,
case when s.fl_low_lim_lev is not null and m.rz-s.fl_low_lim_lev >= 0 then 1 else 0 end as flState
from public.st_stbprp_b t
left join public.att_res_base s on 1=1
left join public.st_addvcd_d sad on t.adcd = sad.adcd
left join public.st_rsvr_r_real m on t.stcd = m.stcd
left join public.st_pptn_r_real sprr on t.stcd = sprr.stcd
where t.sttp = 'RR' and s.res_code = '42118130001' and t.stcd='232'
join public.st_stbprp_b_elem stbe on t.stcd = stbe.stcd
where stbe.elem ='rz' and s.res_code = '42118130001' and t.stcd='232'
order by aFsltdz desc nulls last
</script>
""")

View File

@ -101,9 +101,9 @@ public interface JcskSyRMapper extends BaseMapper<JcskSyR> {
@Select("""
<script>
select to_char(t.tm,'YYYY-MM-DD HH24:MI:SS') as tm,t.rz
select to_char((t.tm - INTERVAL '5 minutes'),'YYYY-MM-DD HH24:MI:SS') as tm,t.rz
from public.st_rsvr_r t
where t.stcd = #{stcd} and to_char(t.tm, 'MI:SS') = '00:00'
where t.stcd = #{stcd} and to_char(t.tm, 'MI:SS') = '05:00'
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
</if>

View File

@ -29,8 +29,8 @@ public class AttResBuilding implements Serializable {
@TableId(value = "id", type = IdType.INPUT)
private Integer id;
// 主坝字段 (prefix: main_)
private String mainType; // 主坝-坝型
// 主坝字段 (prefix: main_) 挡水建筑物(大坝)
private String mainType; // 主坝-坝型 建筑物型式
private String mainFoundation; //主坝-地基特性
private String mainBasicIntensityOfAnEarthQuake; //主坝-地震基本烈度
private BigDecimal mainCrestElevation; // 主坝-坝顶高程(m)
@ -47,7 +47,7 @@ public class AttResBuilding implements Serializable {
private BigDecimal auxCrestWidth; // 副坝-坝顶宽度(m)
private BigDecimal auxMaxHeight; // 副坝-最大坝高(m)
// 溢洪道字段 (prefix: spillway_)
// 溢洪道字段 (prefix: spillway_) 泄水建筑物
private String spillwayType; // 溢洪道-型式
private String spillwayCrestType; // 溢洪道-堰顶型式
private String spillwayFoundation; // 溢洪道-地基特性

View File

@ -8,25 +8,12 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gunshi.algorithm.RrainfallForecast;
import com.gunshi.algorithm.RunoffService;
import com.gunshi.model.vo.FloodAlgorithemVo;
import com.gunshi.project.hsz.service.*;
import com.gunshi.project.hsz.entity.vo.ForeRainStatVo;
import com.gunshi.project.hsz.entity.vo.ForeRainTimeVo;
import com.gunshi.project.hsz.entity.vo.ForecastResultVo;
import com.gunshi.project.hsz.grb.RainGrib2Layer;
import com.gunshi.project.hsz.mapper.ForecastResultsMapper;
import com.gunshi.project.hsz.model.AttResBase;
import com.gunshi.project.hsz.model.ForecastPa;
import com.gunshi.project.hsz.model.ForecastProject;
import com.gunshi.project.hsz.model.ForecastResults;
import com.gunshi.project.hsz.model.ForecastTask;
import com.gunshi.project.hsz.model.ForecastU;
import com.gunshi.project.hsz.model.ForecastUseparam;
import com.gunshi.project.hsz.model.StPptnR;
import com.gunshi.project.hsz.model.StPptnRAverage;
import com.gunshi.project.hsz.model.StRsvrR;
import com.gunshi.project.hsz.model.StStbprpB;
import com.gunshi.project.hsz.model.StZqrlB;
import com.gunshi.project.hsz.model.StZvarlB;
import com.gunshi.project.hsz.model.*;
import com.gunshi.project.hsz.util.DataHandleUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -45,7 +32,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -171,6 +157,28 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
List<StPptnR> pptnRFutureList = new ArrayList<>();
QueryWrapper<StPptnR> qwExisted = new QueryWrapper<>();
Boolean isHaveFuturePPtn = true;
// 檀树岗修改实测降雨查询表数据预测降雨使用geom参数。最后按时间算数平均
// for(StStbprpB b : stbs){
// String stcd = b.getStcd();
// // 如果结束时间在当前时间之前,降雨序列从历史降雨表获取
// if (endTime.compareTo(nowHourTime) <= 0) {
// qwExisted = new QueryWrapper<StPptnR>().eq("stcd", stcd).ge("tm", startTime).le("tm", endTime).orderBy(true, true, "tm");
// } else {
// qwExisted = new QueryWrapper<StPptnR>().eq("stcd", stcd).ge("tm", startTime).le("tm", nowHourTime).orderBy(true, true, "tm");
// try {
// // 获取预报数据
// pptnRFutureList = getForecastDrpData(nowHourTime, stcd);
// } catch (IllegalArgumentException e) {
// if(stcd.equals(attResBase.getStcd())){
// isHaveFuturePPtn = false;
// }
// log.error("该时间无预报数据");
// }
// }
// List<StPptnR> pptnRExistedList = stPptnRService.list(qwExisted);
// pptnRAllList.addAll(pptnRExistedList);
// pptnRAllList.addAll(pptnRFutureList);
// }
if (endTime.compareTo(nowHourTime) <= 0) {
qwExisted = new QueryWrapper<StPptnR>().in("stcd", stbs.stream().map(StStbprpB::getStcd).toArray(String[]::new)).ge("tm", startTime).le("tm", endTime).orderBy(true, true, "tm");
} else {
@ -271,7 +279,7 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
Date[] period = periods.get(k);
Calendar calNew = Calendar.getInstance();
calNew.setTime(period[0]);
// 根据每段时间的开始时间如果在08点05分则采用前一天的pa值计算
// 根据每段时间的开始时间如果在08点则采用前一天的pa值计算
if (isBeforeEightAM(period[0])) {
// 将日期往前推一天
calNew.add(Calendar.DATE, -1);
@ -406,7 +414,297 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
private List<Map<String, Object>> excuteForecastDebug(ForecastTask forecastTask) throws Exception {
List<ForecastResultVo> voList = new ArrayList<>();
// 获取配置参数
List<ForecastUseparam> paramList = forecastUseparamService.list(new QueryWrapper<ForecastUseparam>().isNotNull("param_code").isNotNull("param_value"));
if (CollectionUtils.isEmpty(paramList)) {
throw new IllegalArgumentException("温馨提示:当前洪水预报所依赖的数据尚不完整,请检查入参是否缺失。");
}
// 获取系统当前的水库站编码、汛限水位
AttResBase attResBase = attResBaseService.getOne(new QueryWrapper<>());
// 多站点水库面雨量
// List<StStbprpB> stbs = stStbprpBService.list(new QueryWrapper<StStbprpB>().eq("res_code", attResBase.getResCode()));
// 单站点
List<StStbprpB> stbs = stStbprpBService.list(new QueryWrapper<StStbprpB>().eq("stcd", attResBase.getStcd()));
if (CollectionUtils.isEmpty(stbs)) {
return null;
}
Date nowHourTime = forecastTask.getNowTime();
Date startTime = forecastTask.getStartTime();
Date endTime = forecastTask.getEndTime();
// 获取整个时间线的降雨数据
List<StPptnR> pptnRAllList = new ArrayList<>();
List<StPptnR> pptnRFutureList = new ArrayList<>();
QueryWrapper<StPptnR> qwExisted = new QueryWrapper<>();
Boolean isHaveFuturePPtn = true;
// 檀树岗修改实测降雨查询表数据预测降雨使用geom参数。最后按时间算数平均
// for(StStbprpB b : stbs){
// String stcd = b.getStcd();
// // 如果结束时间在当前时间之前,降雨序列从历史降雨表获取
// if (endTime.compareTo(nowHourTime) <= 0) {
// qwExisted = new QueryWrapper<StPptnR>().eq("stcd", stcd).ge("tm", startTime).le("tm", endTime).orderBy(true, true, "tm");
// } else {
// qwExisted = new QueryWrapper<StPptnR>().eq("stcd", stcd).ge("tm", startTime).le("tm", nowHourTime).orderBy(true, true, "tm");
// try {
// // 获取预报数据
// pptnRFutureList = getForecastDrpData(nowHourTime, stcd);
// } catch (IllegalArgumentException e) {
// if(stcd.equals(attResBase.getStcd())){
// isHaveFuturePPtn = false;
// }
// log.error("该时间无预报数据");
// }
// }
// List<StPptnR> pptnRExistedList = stPptnRService.list(qwExisted);
// pptnRAllList.addAll(pptnRExistedList);
// pptnRAllList.addAll(pptnRFutureList);
// }
if (endTime.compareTo(nowHourTime) <= 0) {
qwExisted = new QueryWrapper<StPptnR>().in("stcd", stbs.stream().map(StStbprpB::getStcd).toArray(String[]::new)).ge("tm", startTime).le("tm", endTime).orderBy(true, true, "tm");
} else {
qwExisted = new QueryWrapper<StPptnR>().in("stcd", stbs.stream().map(StStbprpB::getStcd).toArray(String[]::new)).ge("tm", startTime).le("tm", nowHourTime).orderBy(true, true, "tm");
// 获取预报数据
try {
pptnRFutureList = getForecastDrpData(nowHourTime, attResBase.getStcd());
if(CollectionUtils.isEmpty(pptnRFutureList)) {
isHaveFuturePPtn = false;
log.error("该时间无预报数据");
}
} catch (IllegalArgumentException e) {
isHaveFuturePPtn = false;
log.error("该时间无预报数据");
}
}
List<StPptnR> pptnRExistedList = stPptnRService.list(qwExisted);
pptnRAllList.addAll(pptnRExistedList);
pptnRAllList.addAll(pptnRFutureList);
if (CollectionUtils.isEmpty(pptnRAllList)) {
return null;
}
// 多站点面雨量结果list
List<StPptnR> polyPptnRList = pptnRAllList.stream()
.collect(Collectors.groupingBy(
StPptnR::getTm,
Collectors.mapping(
pptn -> Double.parseDouble(pptn.getDrp()), // 将String转换为double
Collectors.averagingDouble(d -> d) // 计算平均值
)
))
.entrySet().stream()
.map(entry -> new StPptnRAverage(entry.getKey(), String.valueOf(entry.getValue())))
.sorted(Comparator.comparing(StPptnRAverage::getTm))
.collect(Collectors.toList());
double dt = 0.0;
double Wm = 0.0;
double qOther = 0.0;
Map<String, String> paramMap = paramList.stream().collect(Collectors.toMap(ForecastUseparam::getParamCode, ForecastUseparam::getParamValue, (existing, replacement) -> existing));
if (paramMap.get("dt").isEmpty()) {
throw new IllegalArgumentException("温馨提示当前洪水预报所依赖的数据尚不完整请检查时间单元△T是否缺失。");
}
if (paramMap.get("Im").isEmpty()) {
throw new IllegalArgumentException("温馨提示当前洪水预报所依赖的数据尚不完整请检查最大初损值Im是否缺失。");
}
if (!paramMap.get("qOther").isEmpty()) {
qOther = Double.parseDouble(paramMap.get("qOther"));
}
dt = Double.parseDouble(paramMap.get("dt"));
// dt = Double.parseDouble("1.0");
Wm = Double.parseDouble(paramMap.get("Im"));
List<ForecastU> uList = forecastUService.list();
if (CollectionUtils.isEmpty(uList)) {
throw new IllegalArgumentException("温馨提示当前洪水预报所依赖的数据尚不完整请检查U(I)单位线是否缺失。");
}
// 每小时的单位径流量单位m³/s
double[] u = uList.stream().mapToDouble(forecastU -> forecastU.getUValue().doubleValue()).toArray();
// 根据开始结束时间查询pa
Calendar cal = Calendar.getInstance();
cal.setTime(startTime);
// 将日期往前推一天
cal.add(Calendar.DATE, -1);
List<ForecastPa> paList = forecastPaService.list(new QueryWrapper<ForecastPa>().eq("stcd", attResBase.getStcd()).ge("tm", sdfDay.format(cal.getTime())).le("tm", sdfDay.format(endTime)));
if (CollectionUtils.isEmpty(paList)) {
throw new IllegalArgumentException("温馨提示当前洪水预报所依赖的数据尚不完整请检查每日土壤含水量Pa是否缺失。");
}
Map<String, ForecastPa> paMap = paList.stream().collect(Collectors.toMap(ForecastPa::getTm, entity -> entity, (existing, replacement) -> existing));
// 获取预测开始时间前的最后水库水位
double H1 = 0.0;// 初始水库水位可以根据H1->V1,H1->q1得到初始的水库库容和下泄流量
StRsvrR rsvrR = stRsvrRService.getOne(new QueryWrapper<StRsvrR>().eq("stcd", attResBase.getStcd()).le("tm", startTime).orderBy(true, false, "tm").last("limit 1"));
if (ObjectUtils.isEmpty(rsvrR)) {
return null;
}
H1 = Double.parseDouble(rsvrR.getRz());
// 泄流量
List<StZqrlB> stZqrlBList = stZqrlBService.list(new QueryWrapper<StZqrlB>().eq("stcd", attResBase.getStcd()).orderBy(true, true, "z"));
// 库容曲线
List<StZvarlB> zvarlBS = stZvarlBService.list(new QueryWrapper<StZvarlB>().eq("stcd", attResBase.getStcd()).orderBy(true, true, "rz"));
// 水位历史数据
List<StRsvrR> rsvrRRealList = stRsvrRService.list(new QueryWrapper<StRsvrR>().eq("stcd", attResBase.getStcd()).ge("tm", startTime).le("tm", endTime));
List<StRsvrR> resultList = reorganizeRsvrRData(rsvrRRealList, dt);
List<Date[]> periods = splitByDay8To8(startTime, endTime);
// v累计降雨
BigDecimal vValue = BigDecimal.ZERO;
BigDecimal vSum = BigDecimal.ZERO;
// Rsum累计径流深
BigDecimal Rsum = BigDecimal.ZERO;
BigDecimal Psum = BigDecimal.ZERO;
List<Map<String, Object>> res = new ArrayList<>();
// 存储最后u的长度-1个r值
for (int k = 0; k < periods.size(); k++) {
Date[] period = periods.get(k);
Calendar calNew = Calendar.getInstance();
calNew.setTime(period[0]);
// 根据每段时间的开始时间如果在08点前则采用前一天的pa值计算
if (isBeforeEightAM(period[0])) {
// 将日期往前推一天
calNew.add(Calendar.DATE, -1);
}
ForecastPa forecastPa = paMap.get(sdfDay.format(calNew.getTime()));
if (ObjectUtils.isEmpty(forecastPa)) {
continue;
// throw new IllegalArgumentException("温馨提示当前洪水预报所依赖的数据尚不完整请检查每日土壤含水量Pa、K值是否缺失。");
}
// 根据降雨数据按照△t的颗粒度均分
// 筛选时间段内的降雨数据。不包前但包后
List<StPptnR> filterList = polyPptnRList.stream().filter(e -> e.getTm().compareTo(period[0]) >= 0).filter(e -> e.getTm().compareTo(period[1]) <= 0).collect(Collectors.toList());
Map<String, List<StPptnR>> retMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(filterList)) {
retMap = reorganizePptnRData(filterList, dt, period[0], period[1], nowHourTime, isHaveFuturePPtn);
}
if (ObjectUtils.isEmpty(retMap.get("listForForecast"))) {
continue;
}
List<String> pForecastList = retMap.get("listForForecast").stream().map(s -> s.getDrp()).collect(Collectors.toList());
if (pForecastList.size() == 0) {
continue;
}
if (ObjectUtils.isEmpty(retMap.get("listForReal"))) {
continue;
}
Map<String, String> pRealMap = retMap.get("listForReal").stream().collect(Collectors.toMap(pptnR -> sdfMinute.format(pptnR.getTm()), StPptnR::getDrp, (existing, replacement) -> existing));
double[] PList = pForecastList.stream().mapToDouble(Double::parseDouble).toArray();
vSum = vSum.add(vValue);
vValue = BigDecimal.ZERO;
for (double value : PList) {
BigDecimal bd = BigDecimal.valueOf(value);
// 累加到总和中
vValue = vValue.add(bd);
}
// 存储上一次的径流深r最开始默认全部为0
List<Double> lastRArr = new ArrayList<>();
for (int i = 0; i < u.length - 1; i++) {
lastRArr.add(0.0); // 填充初始值
}
// 从后往前遍历不定长的实体列表
for (int i = voList.size() - 1; i >= 0; i--) {
int index = lastRArr.size() - 1 - (voList.size() - 1 - i);
lastRArr.set(index, voList.get(i).getR().doubleValue());
if(index <= 0){
break;
}
}
// 预测执行
Map<String,Object> map = new HashMap<>();
map.put("in period" + k, sdf.format(period[0]));
map.put("in K" + k, forecastPa.getK().doubleValue());
map.put("in pa0" + k, forecastPa.getPa0().doubleValue());
map.put("in Wm" + k, Wm);
map.put("in pt0" + k, forecastPa.getPt0().doubleValue());
map.put("in H1" + k, H1);
map.put("in dt" + k, dt);
map.put("in pa" + k, forecastPa.getPa().doubleValue());
map.put("in PList" + k, PList);
map.put("in u" + k, u);
map.put("in stcd" + k, attResBase.getStcd());
map.put("in qOther" + k, qOther);
map.put("in vSum" + k, vSum.doubleValue());
map.put("in Rsum" + k, Rsum.doubleValue());
map.put("in lastRArr" + k, lastRArr);
List<FloodAlgorithemVo> forecastVoList = RrainfallForecast.getData(sdf.format(period[0]), forecastPa.getK().doubleValue(), forecastPa.getPa0().doubleValue(), Wm, forecastPa.getPt0().doubleValue(), H1, dt,
forecastPa.getPa().doubleValue(), PList, u, attResBase.getStcd(), qOther, vSum.doubleValue(), Rsum.doubleValue(), lastRArr);
map.put("out res" + k, forecastVoList);
res.add(map);
if (CollectionUtils.isNotEmpty(forecastVoList)) {
// 筛选同时段的真实水位数据
List<StRsvrR> realRsvrList = resultList.stream().filter(item -> item.getTm().compareTo(period[0]) >= 0 && item.getTm().compareTo(period[1]) <= 0).collect(Collectors.toList());
Map<String, String> realRsvrMap = realRsvrList.stream().collect(Collectors.toMap(rsvr -> sdfMinute.format(rsvr.getTm()), StRsvrR::getRz, (existing, replacement) -> existing));
forecastVoList = forecastVoList.subList(0, PList.length + 1);
// 去除预测出来的最后一条与第二次实际的相同时间的数据
if (voList.size() > 0 && voList.get(voList.size() - 1).getTm().equals(forecastVoList.get(0).getDateStr())) {
voList.remove(voList.size() - 1);
}
for (int j = 0; j < forecastVoList.size(); j++) {
FloodAlgorithemVo floodAlgorithemVo = forecastVoList.get(j);
// dt不同预测结果的条数不同跟new_q参数有关
if (floodAlgorithemVo.getDateStr().substring(0, 15).compareTo(sdfMinute.format(period[1])) > 0) {
break;
}
String dateStr = floodAlgorithemVo.getDateStr();
ForecastResultVo resultVo = new ForecastResultVo();
resultVo.setTm(dateStr);
resultVo.setYcRkQValue(floodAlgorithemVo.getRq());// 预测入库流量
// resultVo.setRealRkQValue();// 暂无真实入库流量
resultVo.setYcCkQValue(floodAlgorithemVo.getCq());// 预测出库流量
resultVo.setYcSwHValue(floodAlgorithemVo.getKh());// 预测水库水位
H1 = resultVo.getYcSwHValue().doubleValue();// 以预测水位作为下一次预测段起始值
String dateMinuteStr = dateStr.substring(0, dateStr.length() - 3);// 年月日 时分
if (realRsvrMap.containsKey(dateMinuteStr)) {
BigDecimal realSwHValue = new BigDecimal(realRsvrMap.get(dateMinuteStr));// 根据时间取更准确
resultVo.setRealSwHValue(realSwHValue);// 真实水库水位
calculateCap(zvarlBS, resultVo, realSwHValue);// 有真实水位就用真实水位算(作为实测库容)
resultVo.setSwHDValue(resultVo.getYcSwHValue().subtract(resultVo.getRealSwHValue()));// 预测与真实水位差
// 注释修复跨8点时的陡升陡降
// H1 = realSwHValue.doubleValue();// 如果有真实水位,将最后一条的真实水位作为下一次预测段的初始水位
// 真实出库流量=真实水库水位与泄流量曲线差值法
if (realSwHValue != null && CollectionUtils.isNotEmpty(stZqrlBList)) {
BigDecimal maxZ = stZqrlBList.stream().max(Comparator.comparing(StZqrlB::getZ)).get().getZ();
BigDecimal minZ = stZqrlBList.stream().min(Comparator.comparing(StZqrlB::getZ)).get().getZ();
if (realSwHValue.compareTo(minZ) < 0 || realSwHValue.compareTo(maxZ) > 0) {
resultVo.setRealCkQValue(BigDecimal.ZERO);// 真实出库流量
} else {
Map<BigDecimal, BigDecimal> stZvalMap = stZqrlBList.stream().collect(Collectors.toMap(StZqrlB::getZ, StZqrlB::getQ, (existing, replacement) -> existing));
List<BigDecimal> list = stZqrlBList.stream().map(StZqrlB::getZ).collect(Collectors.toList());
resultVo.setRealCkQValue(DataHandleUtil.calcData(realSwHValue, stZvalMap, list));// 真实出库流量
}
}
} else {
// 没有真实水位就用预测水位算(作为预测库容)
calculateCap(zvarlBS, resultVo, resultVo.getYcSwHValue());
}
String pRealDrp = "0.0";
if (pRealMap.containsKey(dateMinuteStr)) {
pRealDrp = pRealMap.get(dateMinuteStr);
}
BigDecimal drp = new BigDecimal(pRealDrp);// 根据时间取更准确
if (drp.compareTo(BigDecimal.ZERO) < 0) {
resultVo.setDrp(BigDecimal.ZERO);
} else {
resultVo.setDrp(drp);
}
Psum = Psum.add(resultVo.getDrp());
resultVo.setPSum(Psum);
Date dateTm = sdf.parse(floodAlgorithemVo.getDateStr());
resultVo.setIspreDrp(dateTm.compareTo(nowHourTime) <= 0 ? "0" : "1");// 0真实 1预测
resultVo.setR(floodAlgorithemVo.getR());
if (resultVo.getR() != null) {
Rsum = Rsum.add(resultVo.getR());
} else {
continue;
}
resultVo.setRSum(Rsum);
resultVo.setFlLowLimLev(attResBase.getFlLowLimLev());
resultVo.setCurrentYdgdyjz(MapUtil.get(paramMap, "ydgdyjz", BigDecimal.class, BigDecimal.ZERO));
resultVo.setPa(floodAlgorithemVo.getPa());
voList.add(resultVo);
}
}
}
return res;
}
/**
* @description:
@ -498,7 +796,7 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
* @auther: cxw
*/
private List<StRsvrR> reorganizeRsvrRData(List<StRsvrR> rsvrRRealList, double dt) {
//TODO 只保留整小时的数据(这里得看监测时间来分析檀树岗是整点记录目前我观测到的黑石咀的是每小时过5分钟记录一次 比如08:05:00 ~ 09:05:00
// 只保留整小时的数据
rsvrRRealList = rsvrRRealList.stream().filter(entity -> {
Date date = entity.getTm();
return date.getMinutes() == 0 && date.getSeconds() == 0;
@ -642,7 +940,7 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
}
/**
* @description:
* @description:
* @param startDate
* @param endDate
* @return: java.util.List<java.util.Date[]>
@ -675,7 +973,7 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
cal.add(Calendar.DAY_OF_MONTH, 1); // 移到下一天
}
cal.set(Calendar.HOUR_OF_DAY, 8);
cal.set(Calendar.MINUTE, 5);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
Date currentEnd = cal.getTime();
@ -816,4 +1114,21 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
return jsonBuilder.toString();
}
public List<Map<String, Object>> getHumanForecastResultDebug(ForecastTask forecastTask) {
// 当前时间整点,作为获取雨量数据历史、预测分隔点
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
Date nowHourTime = calendar.getTime();
forecastTask.setNowTime(nowHourTime);
List<Map<String, Object>> maps;
try {
maps = excuteForecastDebug(forecastTask);
} catch (Exception e) {
e.printStackTrace();
throw new IllegalArgumentException(e.getMessage());
}
return maps;
}
}

View File

@ -396,6 +396,7 @@ public class JcskSyRService extends ServiceImpl<JcskSyRMapper, JcskSyR> {
List<OsmoticStationVo2> resList = new ArrayList<>();
String stcd = jcskGnssRService.getStcd();
//查询库水位
//TODO 数据是每整点过五分监测一次(暂时修改,看后续实际数据来了之后会怎么样)
List<StRzVo> list = baseMapper.queryLineRz(osmoticQuerySo,stcd);
Map<String, BigDecimal> rzMap = list.stream().collect(Collectors.toMap(StRzVo::getTm, StRzVo::getRz));
//查询测站管水位

View File

@ -54,7 +54,7 @@ public class AlarmTask {
@Autowired
private StRiverRRealService stRiverRRealService;
//
// @Scheduled(fixedRate = 10, timeUnit = TimeUnit.SECONDS)
public void updateAlarmSet(){
//查询告警设置中所有的配置的站点