浸润线查询
parent
70846b4377
commit
a34009ac69
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.xyt.controller;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.entity.so.InfiltraLineSo;
|
||||
import com.gunshi.project.xyt.entity.so.OsmoticQueryPageSo;
|
||||
import com.gunshi.project.xyt.entity.so.OsmoticQuerySo;
|
||||
import com.gunshi.project.xyt.entity.vo.OsmoticChartVo;
|
||||
|
|
@ -77,4 +78,10 @@ public class OsmoticPressRController {
|
|||
return R.ok(service.queryChart(osmoticQuerySo));
|
||||
}
|
||||
|
||||
@Operation(summary = "浸润线查询")
|
||||
@PostMapping("/infiltra/line")
|
||||
public R<List<OsmoticStationVo>> infiltraLine(@RequestBody InfiltraLineSo infiltraLineSo) {
|
||||
return R.ok(service.infiltraLine(infiltraLineSo));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.gunshi.project.xyt.entity.so;
|
||||
|
||||
import com.gunshi.db.dto.DateTimeRangeSo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Created by wanyan on 2024/7/11
|
||||
*
|
||||
* @author wanyan
|
||||
* @version 1.0
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "浸润线查询对象")
|
||||
public class InfiltraLineSo {
|
||||
|
||||
@Schema(description = "上报时间")
|
||||
private DateTimeRangeSo dateTimeRangeSo;
|
||||
|
||||
@Schema(description = "监测断面")
|
||||
private String profileCode;
|
||||
|
||||
}
|
||||
|
|
@ -15,6 +15,9 @@ import java.util.List;
|
|||
@Data
|
||||
public class OsmoticStationVo extends StRzVo{
|
||||
|
||||
@Schema(description = "结果分析(0异常 1正常)")
|
||||
private Integer status = 1;
|
||||
|
||||
@Schema(description="测值")
|
||||
private List<OsmoticValueVo> list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,4 +33,6 @@ public class OsmoticValueVo {
|
|||
@Schema(description="管水位")
|
||||
private BigDecimal value;
|
||||
|
||||
@Schema(description = "结果分析(0异常 1正常)")
|
||||
private Integer status = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.gunshi.project.xyt.mapper;
|
|||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.project.xyt.entity.so.InfiltraLineSo;
|
||||
import com.gunshi.project.xyt.entity.so.OsmoticQueryPageSo;
|
||||
import com.gunshi.project.xyt.entity.so.OsmoticQuerySo;
|
||||
import com.gunshi.project.xyt.entity.vo.OsmoticValueVo;
|
||||
|
|
@ -81,4 +82,58 @@ public interface OsmoticPressRMapper extends BaseMapper<OsmoticPressR> {
|
|||
""")
|
||||
List<OsmoticValueVo> queryValue(@Param("obj") OsmoticQuerySo osmoticQuerySo);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select to_char(t.tm,'YYYY-MM-DD HH24:MI:SS') as tm,t.rz
|
||||
from public.st_rsvr_r t
|
||||
<where>
|
||||
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
|
||||
t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
|
||||
</if>
|
||||
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
|
||||
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
|
||||
</if>
|
||||
</where>
|
||||
order by t.tm desc
|
||||
</script>
|
||||
""")
|
||||
List<StRzVo> queryLineRz(@Param("obj") InfiltraLineSo infiltraLineSo);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select t.station_code as stationCode,to_char(t.tm,'YYYY-MM-DD HH24:MI:SS') as tm,t.value
|
||||
from public.osmotic_press_r t
|
||||
where station_code in
|
||||
<foreach collection="list" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
|
||||
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
|
||||
</if>
|
||||
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
|
||||
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
|
||||
</if>
|
||||
order by t.tm desc
|
||||
</script>
|
||||
""")
|
||||
List<OsmoticValueVo> queryLineValue(@Param("obj") InfiltraLineSo infiltraLineSo,@Param("list") List<String> stationCodes);
|
||||
|
||||
@Select("""
|
||||
<script>
|
||||
select t.station_code as stationCode,to_char(t.tm,'YYYY-MM-DD HH24:MI:SS') as tm
|
||||
from public.osmotic_warn_r t
|
||||
where station_code in
|
||||
<foreach collection="list" item="code" separator="," open="(" close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
|
||||
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
|
||||
</if>
|
||||
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
|
||||
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
|
||||
</if>
|
||||
order by t.tm desc
|
||||
</script>
|
||||
""")
|
||||
List<OsmoticValueVo> queryWarn(@Param("obj") InfiltraLineSo infiltraLineSo,@Param("list") List<String> stationCodes);
|
||||
}
|
||||
|
|
@ -1,11 +1,16 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.entity.so.InfiltraLineSo;
|
||||
import com.gunshi.project.xyt.entity.so.OsmoticQueryPageSo;
|
||||
import com.gunshi.project.xyt.entity.so.OsmoticQuerySo;
|
||||
import com.gunshi.project.xyt.entity.vo.*;
|
||||
import com.gunshi.project.xyt.mapper.OsmoticPressRMapper;
|
||||
import com.gunshi.project.xyt.model.OsmoticPressDevice;
|
||||
import com.gunshi.project.xyt.model.OsmoticPressDeviceAutoDao;
|
||||
import com.gunshi.project.xyt.model.OsmoticPressR;
|
||||
import com.gunshi.project.xyt.util.DateUtil;
|
||||
import com.gunshi.project.xyt.util.MyBeanUtil;
|
||||
|
|
@ -31,6 +36,9 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
@Resource
|
||||
private OsmoticPressRMapper mapper;
|
||||
|
||||
@Resource
|
||||
private OsmoticPressDeviceAutoDao pressDeviceAutoDao;
|
||||
|
||||
public Page<OsmoticPressR> queryPage(OsmoticQueryPageSo osmoticQueryPageSo) {
|
||||
return mapper.queryPage(osmoticQueryPageSo.getPageSo().toPage(),osmoticQueryPageSo);
|
||||
}
|
||||
|
|
@ -108,6 +116,46 @@ public class OsmoticPressRService extends ServiceImpl<OsmoticPressRMapper, Osmot
|
|||
}).collect(Collectors.toList());
|
||||
return list.stream().sorted(Comparator.comparing(OsmoticChartDetailVo::getTm)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<OsmoticStationVo> infiltraLine(InfiltraLineSo infiltraLineSo) {
|
||||
List<OsmoticStationVo> resList = new ArrayList<>();
|
||||
String profileCode = infiltraLineSo.getProfileCode();
|
||||
//通过断面查询渗压
|
||||
List<OsmoticPressDevice> pressList = pressDeviceAutoDao.list(new QueryWrapper<OsmoticPressDevice>().eq("profile_code", profileCode));
|
||||
if(CollectionUtils.isEmpty(pressList)){
|
||||
return resList;
|
||||
}
|
||||
List<String> stationCodes = pressList.stream().map(OsmoticPressDevice::getStationCode).collect(Collectors.toList());
|
||||
//查询库水位
|
||||
List<StRzVo> list = mapper.queryLineRz(infiltraLineSo);
|
||||
Map<String, BigDecimal> rzMap = list.stream().collect(Collectors.toMap(StRzVo::getTm, StRzVo::getRz));
|
||||
//查询测站管水位
|
||||
List<OsmoticValueVo> valueList = mapper.queryLineValue(infiltraLineSo,stationCodes);
|
||||
//查询测站预警信息
|
||||
List<OsmoticValueVo> warnList = mapper.queryWarn(infiltraLineSo,stationCodes);
|
||||
valueList.stream().map(vo->{
|
||||
Boolean b = warnList.stream().filter(o->o.getStationCode().equals(vo.getStationCode()) && o.getTm().equals(vo.getTm())).findAny().isPresent();
|
||||
if(b){
|
||||
vo.setStatus(0);
|
||||
}
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
HashSet<String> dateList = new HashSet<>();
|
||||
list.stream().forEach(v1 -> dateList.add(v1.getTm()));
|
||||
valueList.stream().forEach(v1 -> dateList.add(v1.getTm()));
|
||||
for(String str : dateList){
|
||||
OsmoticStationVo vo = new OsmoticStationVo();
|
||||
vo.setTm(str);
|
||||
vo.setRz(rzMap.get(str));
|
||||
List<OsmoticValueVo> newList = valueList.stream().filter(o->str.equals(o.getTm())).collect(Collectors.toList());
|
||||
vo.setList(newList);
|
||||
if(CollectionUtils.isNotEmpty(newList) && newList.stream().filter(o->o.getStatus() == 0).findAny().isPresent()){
|
||||
vo.setStatus(0);
|
||||
}
|
||||
resList.add(vo);
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue