同样由于时间差-去掉分秒的限制(反正一小时只有一条数据)

master
yangzhe123 2025-11-04 15:22:31 +08:00
parent f5e3755e38
commit 834f17659b
3 changed files with 7 additions and 6 deletions

View File

@ -181,7 +181,7 @@ public class StStbprpBService extends ServiceImpl<StStbprpBMapper, StStbprpB> {
//累计溢洪量 = 上一条数据累计溢洪量 + 本条溢洪流量 * 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<StStbprpBMapper, StStbprpB> {
.between(StRsvrR::getTm, yearStart, now)
.orderByAsc(true, StRsvrR::getTm)
.list();
if(rsvrList.isEmpty()){
return vo;
}
//获取水位流量关系
List<StZqrlB> zqrlList = stZqrlBService.list();
zqrlList.sort(Comparator.comparing(StZqrlB::getZ));

View File

@ -155,8 +155,8 @@ public class StZvarlBService extends ServiceImpl<StZvarlBMapper, StZvarlB> {
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);
}
}

View File

@ -10,7 +10,6 @@
<select id="queryRzList" resultType="com.gunshi.project.hsz.entity.vo.StRzVo">
select tm,rz from public.st_rsvr_r where tm <![CDATA[>=]]> #{start} and tm <![CDATA[<]]> #{end}
and TRIM(TO_CHAR(tm, 'MI:SS')) = '00:00'
and stcd = (select stcd from public.att_res_base where res_code = '42118130001')
order by tm asc
</select>
@ -43,7 +42,7 @@
<select id="queryDayRz" resultType="com.gunshi.project.hsz.model.StPptnRD">
select tm,rz as drp,TO_CHAR(tm, 'DD') as day,TO_CHAR(tm, 'MM') as month from public.st_rsvr_r where TO_CHAR(tm, 'YYYY') = #{year}
and TRIM(TO_CHAR(tm, 'HH24:MI')) = '08:00'
and TRIM(TO_CHAR(tm, 'HH24')) = '08'
and stcd = (select stcd from public.att_res_base where res_code = '42118130001')
order by tm asc
</select>