测值查询多图单表修改

master
wany 2024-07-12 11:29:02 +08:00
parent 62a2b2d4de
commit b2627616ff
1 changed files with 17 additions and 13 deletions

View File

@ -86,6 +86,7 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
public List<OsmoticChartVo> queryChart(OsmoticQuerySo osmoticQuerySo,Integer year) { public List<OsmoticChartVo> queryChart(OsmoticQuerySo osmoticQuerySo,Integer year) {
List<OsmoticChartVo> resList = new ArrayList<>(); List<OsmoticChartVo> resList = new ArrayList<>();
List<String> stationCodes = osmoticQuerySo.getStationCodes();
//查询库水位 //查询库水位
List<StRzVo> list = mapper.queryRz(osmoticQuerySo); List<StRzVo> list = mapper.queryRz(osmoticQuerySo);
//查询测站降雨量 //查询测站降雨量
@ -122,12 +123,14 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
List<OsmoticValueVo> valueList = mapper.queryValue(osmoticQuerySo); List<OsmoticValueVo> valueList = mapper.queryValue(osmoticQuerySo);
//按测站分组 //按测站分组
Map<String, List<OsmoticValueVo>> map = valueList.stream().collect(Collectors.groupingBy(OsmoticValueVo::getStationCode)); Map<String, List<OsmoticValueVo>> map = valueList.stream().collect(Collectors.groupingBy(OsmoticValueVo::getStationCode));
map.entrySet().forEach(o->{ for(String code : stationCodes){
OsmoticChartVo vo = new OsmoticChartVo(); OsmoticChartVo vo = new OsmoticChartVo();
List<OsmoticValueVo> voList = o.getValue(); vo.setStationCode(code);
if(map.containsKey(code)){
List<OsmoticValueVo> voList = map.get(code);
OsmoticValueVo max = voList.stream().max(Comparator.comparing(OsmoticValueVo::getValue)).get(); OsmoticValueVo max = voList.stream().max(Comparator.comparing(OsmoticValueVo::getValue)).get();
OsmoticValueVo min = voList.stream().min(Comparator.comparing(OsmoticValueVo::getValue)).get(); OsmoticValueVo min = voList.stream().min(Comparator.comparing(OsmoticValueVo::getValue)).get();
vo.setStationCode(o.getKey()); vo.setStationCode(code);
vo.setMaxValue(max.getValue()); vo.setMaxValue(max.getValue());
vo.setMaxTm(max.getTm()); vo.setMaxTm(max.getTm());
vo.setMinValue(min.getValue()); vo.setMinValue(min.getValue());
@ -136,8 +139,9 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
if(year == null){ if(year == null){
vo.setDetailVos(bindData(MyBeanUtil.collectionCopy(list,OsmoticChartDetailVo.class),MyBeanUtil.collectionCopy(voList,OsmoticChartDetailVo.class))); vo.setDetailVos(bindData(MyBeanUtil.collectionCopy(list,OsmoticChartDetailVo.class),MyBeanUtil.collectionCopy(voList,OsmoticChartDetailVo.class)));
} }
}
resList.add(vo); resList.add(vo);
}); }
return resList; return resList;
} }