diff --git a/src/main/java/com/gunshi/project/hsz/service/StStbprpBService.java b/src/main/java/com/gunshi/project/hsz/service/StStbprpBService.java index dc63594..2dd29ef 100644 --- a/src/main/java/com/gunshi/project/hsz/service/StStbprpBService.java +++ b/src/main/java/com/gunshi/project/hsz/service/StStbprpBService.java @@ -181,7 +181,7 @@ public class StStbprpBService extends ServiceImpl { //累计溢洪量 = 上一条数据累计溢洪量 + 本条溢洪流量 * 2条数据之间的间隔 Instant curInstant = vo.getTm().toInstant(); Instant preInstant = voPrev.getTm().toInstant(); - long timeDiffSeconds = Duration.between(curInstant, preInstant).getSeconds(); + long timeDiffSeconds = Duration.between(preInstant, curInstant).getSeconds(); //TODO 或者改成60 * 60 .multiply(BigDecimal.valueOf(60 * 60)) BigDecimal qTotal = voPrev.getQtotal().add(vo.getFlowNum().multiply(BigDecimal.valueOf(timeDiffSeconds))); vo.setQtotal(qTotal); @@ -231,7 +231,9 @@ public class StStbprpBService extends ServiceImpl { .between(StRsvrR::getTm, yearStart, now) .orderByAsc(true, StRsvrR::getTm) .list(); - + if(rsvrList.isEmpty()){ + return vo; + } //获取水位流量关系 List zqrlList = stZqrlBService.list(); zqrlList.sort(Comparator.comparing(StZqrlB::getZ)); diff --git a/src/main/java/com/gunshi/project/hsz/service/StZvarlBService.java b/src/main/java/com/gunshi/project/hsz/service/StZvarlBService.java index 2943804..e9c79d9 100644 --- a/src/main/java/com/gunshi/project/hsz/service/StZvarlBService.java +++ b/src/main/java/com/gunshi/project/hsz/service/StZvarlBService.java @@ -155,8 +155,8 @@ public class StZvarlBService extends ServiceImpl { BigDecimal xDiff = x.subtract(x1); BigDecimal product = slope.multiply(xDiff); - // 计算最终结果: y1 + product - return y1.add(product); + // 计算最终结果: y1 + product,并设置小数位数和舍入模式 + return y1.add(product).setScale(3, RoundingMode.HALF_UP); } } diff --git a/src/main/resources/mapper/StPptnRHMapper.xml b/src/main/resources/mapper/StPptnRHMapper.xml index 90ee009..ac6fee2 100644 --- a/src/main/resources/mapper/StPptnRHMapper.xml +++ b/src/main/resources/mapper/StPptnRHMapper.xml @@ -10,7 +10,6 @@ @@ -43,7 +42,7 @@