diff --git a/src/main/java/com/gunshi/project/xyt/controller/OsmoticPressRController.java b/src/main/java/com/gunshi/project/xyt/controller/OsmoticPressRController.java index f0b7cb4..6f2b98d 100644 --- a/src/main/java/com/gunshi/project/xyt/controller/OsmoticPressRController.java +++ b/src/main/java/com/gunshi/project/xyt/controller/OsmoticPressRController.java @@ -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> infiltraLine(@RequestBody InfiltraLineSo infiltraLineSo) { + return R.ok(service.infiltraLine(infiltraLineSo)); + } + } \ No newline at end of file diff --git a/src/main/java/com/gunshi/project/xyt/entity/so/InfiltraLineSo.java b/src/main/java/com/gunshi/project/xyt/entity/so/InfiltraLineSo.java new file mode 100644 index 0000000..8e641c9 --- /dev/null +++ b/src/main/java/com/gunshi/project/xyt/entity/so/InfiltraLineSo.java @@ -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; + +} diff --git a/src/main/java/com/gunshi/project/xyt/entity/vo/OsmoticStationVo.java b/src/main/java/com/gunshi/project/xyt/entity/vo/OsmoticStationVo.java index c960153..90eb556 100644 --- a/src/main/java/com/gunshi/project/xyt/entity/vo/OsmoticStationVo.java +++ b/src/main/java/com/gunshi/project/xyt/entity/vo/OsmoticStationVo.java @@ -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 list; } diff --git a/src/main/java/com/gunshi/project/xyt/entity/vo/OsmoticValueVo.java b/src/main/java/com/gunshi/project/xyt/entity/vo/OsmoticValueVo.java index 0205cfd..5cad3cb 100644 --- a/src/main/java/com/gunshi/project/xyt/entity/vo/OsmoticValueVo.java +++ b/src/main/java/com/gunshi/project/xyt/entity/vo/OsmoticValueVo.java @@ -33,4 +33,6 @@ public class OsmoticValueVo { @Schema(description="管水位") private BigDecimal value; + @Schema(description = "结果分析(0异常 1正常)") + private Integer status = 1; } diff --git a/src/main/java/com/gunshi/project/xyt/mapper/OsmoticPressRMapper.java b/src/main/java/com/gunshi/project/xyt/mapper/OsmoticPressRMapper.java index 3b9882c..63c0c74 100644 --- a/src/main/java/com/gunshi/project/xyt/mapper/OsmoticPressRMapper.java +++ b/src/main/java/com/gunshi/project/xyt/mapper/OsmoticPressRMapper.java @@ -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 { """) List queryValue(@Param("obj") OsmoticQuerySo osmoticQuerySo); + @Select(""" + + """) + List queryLineRz(@Param("obj") InfiltraLineSo infiltraLineSo); + + @Select(""" + + """) + List queryLineValue(@Param("obj") InfiltraLineSo infiltraLineSo,@Param("list") List stationCodes); + + @Select(""" + + """) + List queryWarn(@Param("obj") InfiltraLineSo infiltraLineSo,@Param("list") List stationCodes); } \ No newline at end of file diff --git a/src/main/java/com/gunshi/project/xyt/service/OsmoticPressRService.java b/src/main/java/com/gunshi/project/xyt/service/OsmoticPressRService.java index 3282903..b631c0d 100644 --- a/src/main/java/com/gunshi/project/xyt/service/OsmoticPressRService.java +++ b/src/main/java/com/gunshi/project/xyt/service/OsmoticPressRService.java @@ -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 queryPage(OsmoticQueryPageSo osmoticQueryPageSo) { return mapper.queryPage(osmoticQueryPageSo.getPageSo().toPage(),osmoticQueryPageSo); } @@ -108,6 +116,46 @@ public class OsmoticPressRService extends ServiceImpl infiltraLine(InfiltraLineSo infiltraLineSo) { + List resList = new ArrayList<>(); + String profileCode = infiltraLineSo.getProfileCode(); + //通过断面查询渗压 + List pressList = pressDeviceAutoDao.list(new QueryWrapper().eq("profile_code", profileCode)); + if(CollectionUtils.isEmpty(pressList)){ + return resList; + } + List stationCodes = pressList.stream().map(OsmoticPressDevice::getStationCode).collect(Collectors.toList()); + //查询库水位 + List list = mapper.queryLineRz(infiltraLineSo); + Map rzMap = list.stream().collect(Collectors.toMap(StRzVo::getTm, StRzVo::getRz)); + //查询测站管水位 + List valueList = mapper.queryLineValue(infiltraLineSo,stationCodes); + //查询测站预警信息 + List 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 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 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; + } }