洪水-调度演算

master
yangzhe123 2026-01-22 16:55:35 +08:00
parent c43f3f16af
commit 2a5305bd2d
3 changed files with 36 additions and 6 deletions

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.core.result.R;
import com.gunshi.project.ss.entity.dto.DispatchResultDto;
import com.gunshi.project.ss.entity.vo.ForecastDispatchCommandAndResultVo;
import com.gunshi.project.ss.entity.vo.ForecastResultVo;
import com.gunshi.project.ss.model.*;
import com.gunshi.project.ss.service.ForecastProjectService;
@ -148,8 +149,8 @@ public class ForecastProjectController {
@Operation(summary = "调度计算-闸门开放关闭时间")
@GetMapping("/caculate/{id}/{waterLevel}")
public R<List<ForecastDispatchCommand>> caculate(@PathVariable("id") String id,@PathVariable("waterLevel") String waterLevel) {
List<ForecastDispatchCommand> res = service.caculate(id,waterLevel);
public R<ForecastDispatchCommandAndResultVo> caculate(@PathVariable("id") String id, @PathVariable("waterLevel") String waterLevel) {
ForecastDispatchCommandAndResultVo res = service.caculate(id,waterLevel);
return R.ok(res);
}

View File

@ -0,0 +1,16 @@
package com.gunshi.project.ss.entity.vo;
import com.gunshi.project.ss.model.ForecastDispatchCommand;
import com.gunshi.project.ss.model.ForecastDispatchResult;
import lombok.Data;
import java.util.List;
@Data
public class ForecastDispatchCommandAndResultVo {
private List<ForecastDispatchCommand> forecastDispatchCommands;
private ForecastDispatchResult forecastDispatchResult;
}

View File

@ -9,6 +9,7 @@ import com.gunshi.project.ss.common.util.LocalDateTimeConverter;
import com.gunshi.project.ss.entity.TimeCapacity;
import com.gunshi.project.ss.entity.TimeNetWater;
import com.gunshi.project.ss.entity.dto.DispatchResultDto;
import com.gunshi.project.ss.entity.vo.ForecastDispatchCommandAndResultVo;
import com.gunshi.project.ss.entity.vo.ForecastResultVo;
import com.gunshi.project.ss.mapper.ForecastProjectMapper;
import com.gunshi.project.ss.model.*;
@ -173,7 +174,8 @@ public class ForecastProjectService extends ServiceImpl<ForecastProjectMapper, F
}
}
public List<ForecastDispatchCommand> caculate(String id, String rz) {
public ForecastDispatchCommandAndResultVo caculate(String id, String rz) {
ForecastDispatchCommandAndResultVo result = new ForecastDispatchCommandAndResultVo();
BigDecimal openDoorFlow = new BigDecimal("5");//开闸门放水流量 5立方米/秒
ForecastProject forecastProjectResults = getForecastProjectResults(id);
List<ForecastResultVo> humanForecastResult = forecastProjectResults.getVoList();
@ -910,8 +912,14 @@ public class ForecastProjectService extends ServiceImpl<ForecastProjectMapper, F
}
}
}
List<ForecastDispatchCommand> res = new ArrayList<>();
result.setForecastDispatchCommands(res);
DispatchResultDto dto = new DispatchResultDto();
dto.setProjectId(id);
if(start == null || end == null){
return new ArrayList<>();
ForecastDispatchResult dispatchResult = getDispatchResult(dto);
result.setForecastDispatchResult(dispatchResult);
return result;
}
ForecastDispatchCommand open = new ForecastDispatchCommand();
open.setCommandTime(start);
@ -921,10 +929,15 @@ public class ForecastProjectService extends ServiceImpl<ForecastProjectMapper, F
close.setCommandTime(end);
close.setIrrigationGate(0);
close.setFloodGate(0);
List<ForecastDispatchCommand> res = new ArrayList<>();
res.add(open);
res.add(close);
return res;
DateTimeRangeSo dateTimeRangeSo = new DateTimeRangeSo();
dateTimeRangeSo.setStart(LocalDateTimeConverter.toDate(start));
dateTimeRangeSo.setEnd(LocalDateTimeConverter.toDate(end));
dto.setDateTimeRangeSo(dateTimeRangeSo);
ForecastDispatchResult dispatchResult = getDispatchResult(dto);
result.setForecastDispatchResult(dispatchResult);
return result;
}
@Autowired