From 29edabb1997d6eb1c9c4ed7ca93ccea7175b8222 Mon Sep 17 00:00:00 2001 From: yangzhe123 <2824096059@qq.com> Date: Thu, 29 Jan 2026 17:12:39 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../project/ss/entity/vo/ScreenRsvrVo.java | 3 ++ .../ss/service/ScreenMoniotrService.java | 29 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/src/main/java/com/gunshi/project/ss/entity/vo/ScreenRsvrVo.java b/src/main/java/com/gunshi/project/ss/entity/vo/ScreenRsvrVo.java index 31984a6..2948d92 100644 --- a/src/main/java/com/gunshi/project/ss/entity/vo/ScreenRsvrVo.java +++ b/src/main/java/com/gunshi/project/ss/entity/vo/ScreenRsvrVo.java @@ -34,4 +34,7 @@ public class ScreenRsvrVo { //有效库容 private BigDecimal effectiveCap; + // 0 不变 1上升 2下降 + private Integer status; + } diff --git a/src/main/java/com/gunshi/project/ss/service/ScreenMoniotrService.java b/src/main/java/com/gunshi/project/ss/service/ScreenMoniotrService.java index 1fd48fe..fcf1cd1 100644 --- a/src/main/java/com/gunshi/project/ss/service/ScreenMoniotrService.java +++ b/src/main/java/com/gunshi/project/ss/service/ScreenMoniotrService.java @@ -1,6 +1,7 @@ package com.gunshi.project.ss.service; +import com.gunshi.project.ss.common.model.StRsvrR; import com.gunshi.project.ss.common.model.StStbprpB; import com.gunshi.project.ss.entity.vo.AttResBaseVo; import com.gunshi.project.ss.entity.vo.ScreenRsvrVo; @@ -11,6 +12,7 @@ import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Date; import java.util.List; @Service @@ -26,6 +28,9 @@ public class ScreenMoniotrService { @Autowired private ReservoirWaterService reservoirWaterService; + @Autowired + private StRsvrRService stRsvrRService; + public List getScreenRsvr() { //查询所有的水库水情站点 List res = new ArrayList<>(); @@ -49,6 +54,30 @@ public class ScreenMoniotrService { if(rz != null && flLowLimLev != null){ entity.setGapFlLowLimLev(rz.subtract(flLowLimLev)); } + + Date tm = rsvrStation.getTm(); + if(tm == null){ + entity.setStatus(0); + }else{ + StRsvrR one = stRsvrRService.lambdaQuery() + .eq(StRsvrR::getStcd, rsvrStation.getStcd()) + .lt(StRsvrR::getTm, tm).orderByDesc(StRsvrR::getTm) + .last("limit 1").one(); + if(one == null){ + entity.setStatus(0); + }else{ + //如果过去时刻水位高于当前水位 ->表示下降 + String lastRz = one.getRz(); + BigDecimal decimalRz = new BigDecimal(lastRz); + if(rz.compareTo(decimalRz) < 0){ + entity.setStatus(2); + }else if(rz.compareTo(decimalRz) > 0){ + entity.setStatus(1); + }else{ + entity.setStatus(0); + } + } + } res.add(entity); } return res;