预测来水量

master
wany 2024-10-09 13:52:01 +08:00
parent a8f38885f1
commit 0653c3ad63
2 changed files with 14 additions and 1 deletions

View File

@ -94,4 +94,10 @@ public class GateValveRealController {
public R<Map<BigDecimal, String>> supplyTime(@RequestParam(value = "year",required = false) @Parameter(description = "年份") Integer year,@RequestParam(value = "month",required = false) @Parameter(description = "月份") Integer month) {
return R.ok(service.supplyTime(year,month));
}
@Operation(summary = "预测来水量")
@GetMapping("/predict/water")
public R<BigDecimal> predictWater(@RequestParam(value = "year") @Parameter(description = "年份") Integer year, @RequestParam(value = "month") @Parameter(description = "月份") Integer month) {
return R.ok(service.predictWater(year,month));
}
}

View File

@ -126,7 +126,7 @@ public class GateValveRealService extends ServiceImpl<GateValveRealMapper, GateV
}
AttResBaseVo attResBaseVo = list.get(0);
BigDecimal nowCap = attResBaseVo.getNowCap() == null ? new BigDecimal(0) : attResBaseVo.getNowCap();
BigDecimal deadCap = attResBaseVo.getDeadCap();
BigDecimal deadCap = attResBaseVo.getDeadCap() == null ? new BigDecimal(0) : attResBaseVo.getDeadCap();
BigDecimal supplyV = nowCap.subtract(deadCap);
if(year != null){
@ -170,6 +170,13 @@ public class GateValveRealService extends ServiceImpl<GateValveRealMapper, GateV
return sum.multiply(watShedArea);
}
public BigDecimal predictWater(Integer year, Integer month) {
List<AttResBaseVo> list = reservoirWaterService.list();
if(CollectionUtils.isEmpty(list)){
return new BigDecimal(0);
}
return calcPredictV(year,month,list.get(0).getWatShedArea());
}
}