优化洪水预报接口
parent
c2f25411bd
commit
6d5b4b2a34
|
|
@ -1,80 +0,0 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
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.xyt.model.ForecastHQ;
|
||||
import com.gunshi.project.xyt.service.ForecastHQService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 描述: 预报_水位-泄流量表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
*/
|
||||
@Tag(name = "预报_水位-泄流量表")
|
||||
@RestController
|
||||
@RequestMapping(value="/forecastHQ")
|
||||
public class ForecastHQController {
|
||||
|
||||
@Autowired
|
||||
private ForecastHQService service;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<ForecastHQ> insert(@Validated(Insert.class) @RequestBody ForecastHQ dto) {
|
||||
boolean result = service.save(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<ForecastHQ> update(@Validated(Update.class) @RequestBody ForecastHQ dto) {
|
||||
boolean result = service.updateById(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
return R.ok(service.removeById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "列表")
|
||||
@PostMapping("/list")
|
||||
public R<List<ForecastHQ>> list(@RequestBody @Validated ForecastHQ forecastHQ) {
|
||||
QueryWrapper<ForecastHQ> wrapper = new QueryWrapper<ForecastHQ>();
|
||||
if(StringUtils.isNotBlank(forecastHQ.getSortField())){
|
||||
wrapper.orderBy(true, ObjectUtils.isEmpty(forecastHQ.getIsAsc()) ? false : forecastHQ.getIsAsc(), forecastHQ.getSortField());
|
||||
}
|
||||
return R.ok(service.list(wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<Page<ForecastHQ>> page(@RequestBody @Validated ForecastHQ forecastHQ) {
|
||||
QueryWrapper<ForecastHQ> wrapper = new QueryWrapper<ForecastHQ>();
|
||||
if(StringUtils.isNotBlank(forecastHQ.getSortField())){
|
||||
wrapper.orderBy(true, ObjectUtils.isEmpty(forecastHQ.getIsAsc()) ? false : forecastHQ.getIsAsc(), forecastHQ.getSortField());
|
||||
}
|
||||
return R.ok(service.page(forecastHQ.getPageSo().toPage(), wrapper));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,80 +0,0 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
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.xyt.model.ForecastHV;
|
||||
import com.gunshi.project.xyt.service.ForecastHVService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 描述: 预报_水位-库容
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
*/
|
||||
@Tag(name = "预报_水位-库容")
|
||||
@RestController
|
||||
@RequestMapping(value="/forecastHV")
|
||||
public class ForecastHVController {
|
||||
|
||||
@Autowired
|
||||
private ForecastHVService service;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<ForecastHV> insert(@Validated(Insert.class) @RequestBody ForecastHV dto) {
|
||||
boolean result = service.save(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<ForecastHV> update(@Validated(Update.class) @RequestBody ForecastHV dto) {
|
||||
boolean result = service.updateById(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
return R.ok(service.removeById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "列表")
|
||||
@PostMapping("/list")
|
||||
public R<List<ForecastHV>> list(@RequestBody @Validated ForecastHV forecastHV) {
|
||||
QueryWrapper<ForecastHV> wrapper = new QueryWrapper<ForecastHV>();
|
||||
if(StringUtils.isNotBlank(forecastHV.getSortField())){
|
||||
wrapper.orderBy(true, ObjectUtils.isEmpty(forecastHV.getIsAsc()) ? false : forecastHV.getIsAsc(), forecastHV.getSortField());
|
||||
}
|
||||
return R.ok(service.list(wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<Page<ForecastHV>> page(@RequestBody @Validated ForecastHV forecastHV) {
|
||||
QueryWrapper<ForecastHV> wrapper = new QueryWrapper<ForecastHV>();
|
||||
if(StringUtils.isNotBlank(forecastHV.getSortField())){
|
||||
wrapper.orderBy(true, ObjectUtils.isEmpty(forecastHV.getIsAsc()) ? false : forecastHV.getIsAsc(), forecastHV.getSortField());
|
||||
}
|
||||
return R.ok(service.page(forecastHV.getPageSo().toPage(), wrapper));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.project.xyt.model.ForecastPa;
|
||||
import com.gunshi.project.xyt.service.ForecastPaService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 描述: 预报_土壤含水量表
|
||||
* author: cxw
|
||||
* date: 2024-08-02 12:23:07
|
||||
*/
|
||||
@Tag(name = "预报_土壤含水量表")
|
||||
@RestController
|
||||
@RequestMapping(value="/forecastPa")
|
||||
public class ForecastPaController {
|
||||
|
||||
@Autowired
|
||||
private ForecastPaService service;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<ForecastPa> insert(@Validated(Insert.class) @RequestBody ForecastPa dto) {
|
||||
boolean result = service.save(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<ForecastPa> update(@Validated(Update.class) @RequestBody ForecastPa dto) {
|
||||
boolean result = service.updateById(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
return R.ok(service.removeById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "列表")
|
||||
@PostMapping("/list")
|
||||
public R<List<ForecastPa>> list() {
|
||||
return R.ok(service.lambdaQuery().list());
|
||||
}
|
||||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<Page<ForecastPa>> page() {
|
||||
return R.ok(service.page(null,null));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,106 +0,0 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
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.xyt.model.ForecastPlan;
|
||||
import com.gunshi.project.xyt.schedule.TaskGroupHandler;
|
||||
import com.gunshi.project.xyt.service.ForecastPlanService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 描述: 预报_预测方案管理表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
*/
|
||||
@Tag(name = "预报_预测方案管理表")
|
||||
@RestController
|
||||
@RequestMapping(value="/forecastPlan")
|
||||
public class ForecastPlanController {
|
||||
|
||||
@Autowired
|
||||
private ForecastPlanService service;
|
||||
|
||||
@Autowired
|
||||
private TaskGroupHandler taskGroupHandler;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<ForecastPlan> insert(@Validated(Insert.class) @RequestBody ForecastPlan dto) {
|
||||
dto.setId(IdWorker.getId());
|
||||
boolean result = service.save(dto);
|
||||
// if(result){
|
||||
// taskGroupHandler.addCronJob(String.valueOf(dto.getId()), dto);
|
||||
// }
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<ForecastPlan> update(@Validated(Update.class) @RequestBody ForecastPlan dto) {
|
||||
boolean result = service.updateById(dto);
|
||||
// if(result){
|
||||
// // 先删除,再重新添加
|
||||
// taskGroupHandler.removeCronJob(String.valueOf(dto.getId()));
|
||||
// taskGroupHandler.addCronJob(String.valueOf(dto.getId()), dto);
|
||||
// }
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
boolean b = service.removeById(id);
|
||||
// if (b) {
|
||||
// taskGroupHandler.removeCronJob((String) id);
|
||||
// }
|
||||
return R.ok(b);
|
||||
}
|
||||
|
||||
@Operation(summary = "列表")
|
||||
@PostMapping("/list")
|
||||
public R<List<ForecastPlan>> list(@RequestBody @Validated ForecastPlan forecastPlan) {
|
||||
QueryWrapper<ForecastPlan> wrapper = new QueryWrapper<ForecastPlan>()
|
||||
.like(ObjectUtils.isNotNull(forecastPlan.getName()), "name", forecastPlan.getName())
|
||||
.ge(ObjectUtils.isNotNull(forecastPlan.getStartTime()), "forecast_tm", forecastPlan.getStartTime())
|
||||
.le(ObjectUtils.isNotNull(forecastPlan.getEndTime()), "forecast_tm", forecastPlan.getEndTime());
|
||||
if(StringUtils.isNotBlank(forecastPlan.getSortField())){
|
||||
wrapper.orderBy(true, ObjectUtils.isEmpty(forecastPlan.getIsAsc()) ? false : forecastPlan.getIsAsc(), forecastPlan.getSortField());
|
||||
}
|
||||
return R.ok(service.list(wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<Page<ForecastPlan>> page(@RequestBody @Validated ForecastPlan forecastPlan) {
|
||||
QueryWrapper<ForecastPlan> wrapper = new QueryWrapper<ForecastPlan>()
|
||||
.like(ObjectUtils.isNotNull(forecastPlan.getName()), "name", forecastPlan.getName())
|
||||
.ge(ObjectUtils.isNotNull(forecastPlan.getStartTime()), "forecast_tm", forecastPlan.getStartTime())
|
||||
.le(ObjectUtils.isNotNull(forecastPlan.getEndTime()), "forecast_tm", forecastPlan.getEndTime());
|
||||
if(StringUtils.isNotBlank(forecastPlan.getSortField())){
|
||||
wrapper.orderBy(true, ObjectUtils.isEmpty(forecastPlan.getIsAsc()) ? false : forecastPlan.getIsAsc(), forecastPlan.getSortField());
|
||||
}
|
||||
return R.ok(service.page(forecastPlan.getPageSo().toPage(), wrapper));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
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.xyt.model.ForecastProject;
|
||||
import com.gunshi.project.xyt.model.ForecastResults;
|
||||
import com.gunshi.project.xyt.model.ForecastTask;
|
||||
import com.gunshi.project.xyt.service.ForecastProjectService;
|
||||
import com.gunshi.project.xyt.service.ForecastResultsService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 描述: 预报_预测方案管理表
|
||||
* author: cxw
|
||||
* date: 2024-08-05 11:41:45
|
||||
*/
|
||||
@Tag(name = "预报_预测方案管理表")
|
||||
@RestController
|
||||
@RequestMapping(value="/forecastProject")
|
||||
public class ForecastProjectController {
|
||||
|
||||
@Autowired
|
||||
private ForecastProjectService service;
|
||||
|
||||
@Autowired
|
||||
private ForecastResultsService forecastResultsService;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<ForecastProject> insert(@Validated(Insert.class) @RequestBody ForecastProject dto) {
|
||||
dto.setId(IdWorker.getId());
|
||||
boolean result = service.save(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<ForecastProject> update(@Validated(Update.class) @RequestBody ForecastProject dto) {
|
||||
boolean result = service.updateById(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
boolean b = service.removeById(id);
|
||||
// 级联删除
|
||||
if(b){
|
||||
forecastResultsService.remove(new QueryWrapper<ForecastResults>().eq("project_id", id));
|
||||
}
|
||||
return R.ok(service.removeById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "列表")
|
||||
@PostMapping("/list")
|
||||
public R<List<ForecastProject>> list(@RequestBody @Validated ForecastProject forecastProject) {
|
||||
QueryWrapper<ForecastProject> wrapper = new QueryWrapper<ForecastProject>()
|
||||
.in("status", "0", "1")// 只返回启用和暂停的
|
||||
.like(ObjectUtils.isNotNull(forecastProject.getName()), "name", forecastProject.getName());
|
||||
if(StringUtils.isNotBlank(forecastProject.getSortField())){
|
||||
wrapper.orderBy(true, ObjectUtils.isEmpty(forecastProject.getIsAsc()) ? false : forecastProject.getIsAsc(), forecastProject.getSortField());
|
||||
}
|
||||
return R.ok(service.list(wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<Page<ForecastProject>> page(@RequestBody @Validated ForecastProject forecastProject) {
|
||||
QueryWrapper<ForecastProject> wrapper = new QueryWrapper<ForecastProject>()
|
||||
.in("status", "0", "1")// 只返回启用和暂停的
|
||||
.like(ObjectUtils.isNotNull(forecastProject.getName()), "name", forecastProject.getName());
|
||||
if(StringUtils.isNotBlank(forecastProject.getSortField())){
|
||||
wrapper.orderBy(true, ObjectUtils.isEmpty(forecastProject.getIsAsc()) ? false : forecastProject.getIsAsc(), forecastProject.getSortField());
|
||||
}
|
||||
return R.ok(service.page(forecastProject.getPageSo().toPage(), wrapper));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -8,9 +8,10 @@ import com.gunshi.algorithm.RrainfallForecast;
|
|||
import com.gunshi.core.result.R;
|
||||
import com.gunshi.model.vo.FloodAlgorithemVo;
|
||||
import com.gunshi.project.xyt.entity.vo.ForecastResultVo;
|
||||
import com.gunshi.project.xyt.model.ForecastPlan;
|
||||
import com.gunshi.project.xyt.model.ForecastTask;
|
||||
import com.gunshi.project.xyt.model.ForecastResults;
|
||||
import com.gunshi.project.xyt.service.ForecastPlanService;
|
||||
import com.gunshi.project.xyt.model.ForecastTask;
|
||||
import com.gunshi.project.xyt.service.ForecastTaskService;
|
||||
import com.gunshi.project.xyt.service.ForecastResultsService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
|
|
@ -47,7 +48,7 @@ public class ForecastResultsController {
|
|||
private ForecastResultsService service;
|
||||
|
||||
@Autowired
|
||||
private ForecastPlanService forecastPlanService;
|
||||
private ForecastTaskService forecastTaskService;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
|
|
@ -95,40 +96,40 @@ public class ForecastResultsController {
|
|||
public R<List<ForecastResultVo>> getHumanForecastResult(@Schema(name = "forecastTm", description = "预报时间") @RequestParam("forecastTm") String forecastTm,
|
||||
@Schema(name = "startTm", description = "开始时间") @RequestParam("startTm") String startTm,
|
||||
@Schema(name = "endTm", description = "结束时间") @RequestParam("endTm") String endTm) throws Exception {
|
||||
ForecastPlan forecastPlan = new ForecastPlan();
|
||||
forecastPlan.setForecastTm(dateFormat.parse(forecastTm));
|
||||
forecastPlan.setStartTm(dateFormat.parse(startTm));
|
||||
forecastPlan.setEndTm(dateFormat.parse(endTm));
|
||||
List<ForecastResultVo> voList = service.getHumanForecastResult(forecastPlan);
|
||||
ForecastTask forecastTask = new ForecastTask();
|
||||
forecastTask.setForecastTime(dateFormat.parse(forecastTm));
|
||||
forecastTask.setStartTime(dateFormat.parse(startTm));
|
||||
forecastTask.setEndTime(dateFormat.parse(endTm));
|
||||
List<ForecastResultVo> voList = service.getHumanForecastResult(forecastTask);
|
||||
return R.ok(voList);
|
||||
}
|
||||
|
||||
// @Operation(summary = "查看方案洪水预报结果")
|
||||
// @PostMapping("/getForecastPlanResult")
|
||||
// public R<List<ForecastResultVo>> getForecastPlanResult(@Schema(name = "planId", description = "预测方案id") @RequestParam("planId") String planId) throws Exception {
|
||||
// ForecastPlan forecastPlan = forecastPlanService.getById(planId);
|
||||
// List<ForecastResultVo> voList = service.getForecastPlanResult(forecastPlan);
|
||||
// @PostMapping("/getForecastTaskResult")
|
||||
// public R<List<ForecastResultVo>> getForecastTaskResult(@Schema(name = "taskId", description = "预测方案id") @RequestParam("taskId") String taskId) throws Exception {
|
||||
// ForecastTask forecastTask = forecastTaskService.getById(taskId);
|
||||
// List<ForecastResultVo> voList = service.getForecastTaskResult(forecastTask);
|
||||
// return R.ok(voList);
|
||||
// }
|
||||
|
||||
|
||||
@Operation(summary = "洪水预报测试")
|
||||
@PostMapping("/forecastTest")
|
||||
public R<List<FloodAlgorithemVo>> forecastTest() throws Exception {
|
||||
double[] PList = new double[] {6.5, 6.75, 7, 5.25, 3.5, 4, 4.5, 4, 3.5, 4.25, 5, 4, 3, 3, 3, 2.75, 2.5, 1.25, 0, 0.25, 0.5};
|
||||
double[] u = new double[]{1.27, 0.75, 0.45, 0.27, 0.16, 0.09, 0.07, 0.03, 0.02, 0.01, 0.01};
|
||||
return R.ok(RrainfallForecast.getData("2024-06-28 08:00:00", 0.93, 1.0, 120, 0.0, 675.94, 0.5, 100.0, PList, u));
|
||||
}
|
||||
// @Operation(summary = "洪水预报测试")
|
||||
// @PostMapping("/forecastTest")
|
||||
// public R<List<FloodAlgorithemVo>> forecastTest() throws Exception {
|
||||
// double[] PList = new double[] {6.5, 6.75, 7, 5.25, 3.5, 4, 4.5, 4, 3.5, 4.25, 5, 4, 3, 3, 3, 2.75, 2.5, 1.25, 0, 0.25, 0.5};
|
||||
// double[] u = new double[]{1.27, 0.75, 0.45, 0.27, 0.16, 0.09, 0.07, 0.03, 0.02, 0.01, 0.01};
|
||||
// return R.ok(RrainfallForecast.getData("2024-06-28 08:00:00", 0.93, 1.0, 120, 0.0, 675.94, 0.5, 100.0, PList, u, "", "716153201"));
|
||||
// }
|
||||
|
||||
@Operation(summary = "洪水预报测试2")
|
||||
@PostMapping("/forecastTest2")
|
||||
public R<List<FloodAlgorithemVo>> forecastTest2() throws Exception {
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
ForecastPlan forecastPlan = new ForecastPlan();
|
||||
forecastPlan.setForecastTm(dateFormat.parse("2024-07-01 22:00:00"));
|
||||
forecastPlan.setStartTm(dateFormat.parse("2024-07-01 16:00:00"));
|
||||
forecastPlan.setEndTm(dateFormat.parse("2024-07-02 03:00:00"));
|
||||
List<FloodAlgorithemVo> floodAlgorithemVos = service.floodForecast(forecastPlan);
|
||||
return R.ok(floodAlgorithemVos);
|
||||
}
|
||||
// @Operation(summary = "洪水预报测试2")
|
||||
// @PostMapping("/forecastTest2")
|
||||
// public R<List<ForecastResultVo>> forecastTest2() throws Exception {
|
||||
// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
// ForecastTask forecastTask = new ForecastTask();
|
||||
// forecastTask.setForecastTm(dateFormat.parse("2024-07-01 22:00:00"));
|
||||
// forecastTask.setStartTime(dateFormat.parse("2024-07-01 16:00:00"));
|
||||
// forecastTask.setEndTime(dateFormat.parse("2024-07-02 03:00:00"));
|
||||
// List<ForecastResultVo> forecastResultVos = service.humanFloodForecast(forecastTask);
|
||||
// return R.ok(forecastResultVos);
|
||||
// }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
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.xyt.model.ForecastTask;
|
||||
import com.gunshi.project.xyt.schedule.TaskGroupHandler;
|
||||
import com.gunshi.project.xyt.service.ForecastTaskService;
|
||||
import com.gunshi.project.xyt.validate.markers.Insert;
|
||||
import com.gunshi.project.xyt.validate.markers.Update;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 描述: 预报_预测自动任务管理表
|
||||
* author: cxw
|
||||
* date: 2024-08-05 11:41:45
|
||||
*/
|
||||
@Tag(name = "预报_预测自动任务管理表")
|
||||
@RestController
|
||||
@RequestMapping(value="/forecastTask")
|
||||
public class ForecastTaskController {
|
||||
|
||||
@Autowired
|
||||
private ForecastTaskService service;
|
||||
|
||||
@Autowired
|
||||
private TaskGroupHandler taskGroupHandler;
|
||||
|
||||
|
||||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<ForecastTask> insert(@Validated(Insert.class) @RequestBody ForecastTask dto) {
|
||||
dto.setId(IdWorker.getId());
|
||||
boolean result = service.save(dto);
|
||||
// if (result) {
|
||||
// taskGroupHandler.addCronJob(String.valueOf(dto.getId()), dto);
|
||||
// }
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<ForecastTask> update(@Validated(Update.class) @RequestBody ForecastTask dto) {
|
||||
ForecastTask oldTask = service.getById(dto.getId());
|
||||
if (Objects.isNull(oldTask)) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
dto.setChtm(oldTask.getChtm());
|
||||
dto.setUpdateTm(new Date());
|
||||
boolean result = service.updateById(dto);
|
||||
// if (result) {
|
||||
// // 先删除,再重新添加
|
||||
// taskGroupHandler.removeCronJob(String.valueOf(dto.getId()));
|
||||
// taskGroupHandler.addCronJob(String.valueOf(dto.getId()), dto);
|
||||
// }
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
||||
@Operation(summary = "删除")
|
||||
@GetMapping("/del/{id}")
|
||||
public R<Boolean> del(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
||||
boolean b = service.removeById(id);
|
||||
// if (b) {
|
||||
// taskGroupHandler.removeCronJob((String) id);
|
||||
// }
|
||||
return R.ok(service.removeById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "列表")
|
||||
@PostMapping("/list")
|
||||
public R<List<ForecastTask>> list(@RequestBody @Validated ForecastTask forecastTask) {
|
||||
QueryWrapper<ForecastTask> wrapper = new QueryWrapper<ForecastTask>()
|
||||
.in("status", "0", "1")// 只返回启用和暂停的
|
||||
.like(ObjectUtils.isNotNull(forecastTask.getName()), "name", forecastTask.getName());
|
||||
if(StringUtils.isNotBlank(forecastTask.getSortField())){
|
||||
wrapper.orderBy(true, ObjectUtils.isEmpty(forecastTask.getIsAsc()) ? false : forecastTask.getIsAsc(), forecastTask.getSortField());
|
||||
}
|
||||
return R.ok(service.list(wrapper));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页")
|
||||
@PostMapping("/page")
|
||||
public R<Page<ForecastTask>> page(@RequestBody @Validated ForecastTask forecastTask) {
|
||||
QueryWrapper<ForecastTask> wrapper = new QueryWrapper<ForecastTask>()
|
||||
.eq("type", "1")// 只返回自动类型的
|
||||
.in("status", "0", "1")// 只返回启用和暂停的
|
||||
.like(ObjectUtils.isNotNull(forecastTask.getName()), "name", forecastTask.getName())
|
||||
.ge(ObjectUtils.isNotNull(forecastTask.getStartTime()), "forecast_tm", forecastTask.getStartTime())
|
||||
.le(ObjectUtils.isNotNull(forecastTask.getEndTime()), "forecast_tm", forecastTask.getEndTime());
|
||||
if(StringUtils.isNotBlank(forecastTask.getSortField())){
|
||||
wrapper.orderBy(true, ObjectUtils.isEmpty(forecastTask.getIsAsc()) ? false : forecastTask.getIsAsc(), forecastTask.getSortField());
|
||||
}
|
||||
return R.ok(service.page(forecastTask.getPageSo().toPage(), wrapper));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
|
@ -40,6 +41,7 @@ public class ForecastUController {
|
|||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<ForecastU> insert(@Validated(Insert.class) @RequestBody ForecastU dto) {
|
||||
dto.setId(IdWorker.getId());
|
||||
boolean result = service.save(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.gunshi.project.xyt.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
|
@ -22,7 +23,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 描述: 预报_通用参数管理
|
||||
* author: cxw
|
||||
|
|
@ -40,6 +44,7 @@ public class ForecastUseparamController {
|
|||
@Operation(summary = "新增")
|
||||
@PostMapping("/insert")
|
||||
public R<ForecastUseparam> insert(@Validated(Insert.class) @RequestBody ForecastUseparam dto) {
|
||||
dto.setId(IdWorker.getId());
|
||||
boolean result = service.save(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
|
@ -47,6 +52,12 @@ public class ForecastUseparamController {
|
|||
@Operation(summary = "修改")
|
||||
@PostMapping("/update")
|
||||
public R<ForecastUseparam> update(@Validated(Update.class) @RequestBody ForecastUseparam dto) {
|
||||
ForecastUseparam oldData = service.getById(dto.getId());
|
||||
if (Objects.isNull(oldData)) {
|
||||
throw new IllegalArgumentException("当前数据不存在");
|
||||
}
|
||||
dto.setChtm(oldData.getChtm());
|
||||
dto.setUpdateTime(new Date());
|
||||
boolean result = service.updateById(dto);
|
||||
return R.ok(result ? dto : null);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,14 +59,20 @@ public class ForecastResultVo {
|
|||
private BigDecimal realSwHValue;
|
||||
|
||||
/**
|
||||
* 预测降雨
|
||||
* 降雨
|
||||
*/
|
||||
@Schema(description="预测降雨")
|
||||
private BigDecimal ycDrp;
|
||||
@Schema(description="降雨")
|
||||
private BigDecimal drp;
|
||||
|
||||
/**
|
||||
* 实际水库水位
|
||||
* 径流深
|
||||
*/
|
||||
@Schema(description="实际降雨")
|
||||
private BigDecimal realDrp;
|
||||
@Schema(description="径流深")
|
||||
private BigDecimal r;
|
||||
|
||||
/**
|
||||
* 主汛期防洪限制水位
|
||||
*/
|
||||
@Schema(description="主汛期防洪限制水位")
|
||||
private BigDecimal flLowLimLev;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastHQ;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 描述: 预报_水位-泄流量表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
*/
|
||||
@Mapper
|
||||
public interface ForecastHQMapper extends BaseMapper<ForecastHQ> {
|
||||
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ import com.gunshi.project.xyt.model.ForecastK;
|
|||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 描述: 前期影响雨量折减系数表
|
||||
* 描述: 预报_前期影响雨量折减系数表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastHV;
|
||||
import com.gunshi.project.xyt.model.ForecastPa;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 描述: 预报_水位-库容
|
||||
* 描述: 预报_土壤含水量表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
* date: 2024-08-02 12:23:07
|
||||
*/
|
||||
@Mapper
|
||||
public interface ForecastHVMapper extends BaseMapper<ForecastHV> {
|
||||
public interface ForecastPaMapper extends BaseMapper<ForecastPa> {
|
||||
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastPlan;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 描述: 预测方案管理表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
*/
|
||||
@Mapper
|
||||
public interface ForecastPlanMapper extends BaseMapper<ForecastPlan> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastProject;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 描述: 预报_预测方案管理表
|
||||
* author: cxw
|
||||
* date: 2024-08-05 11:41:45
|
||||
*/
|
||||
@Mapper
|
||||
public interface ForecastProjectMapper extends BaseMapper<ForecastProject> {
|
||||
|
||||
}
|
||||
|
|
@ -5,9 +5,9 @@ import com.gunshi.project.xyt.model.ForecastResults;
|
|||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 描述: 预测结果表
|
||||
* 描述: 预报_预测结果表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
* date: 2024-08-05 11:41:45
|
||||
*/
|
||||
@Mapper
|
||||
public interface ForecastResultsMapper extends BaseMapper<ForecastResults> {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
package com.gunshi.project.xyt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastTask;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 描述: 预报_预测自动任务管理表
|
||||
* author: cxw
|
||||
* date: 2024-08-05 11:41:45
|
||||
*/
|
||||
@Mapper
|
||||
public interface ForecastTaskMapper extends BaseMapper<ForecastTask> {
|
||||
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ import com.gunshi.project.xyt.model.ForecastU;
|
|||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 描述: 时段单位线表
|
||||
* 描述: 预报_时段单位线表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import org.apache.ibatis.annotations.Select;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 描述: 降水量表
|
||||
|
|
@ -30,4 +31,6 @@ public interface StPptnRMapper extends BaseMapper<StPptnR> {
|
|||
BigDecimal queryStPptnTimeQuantumByStcdAndTime(@Param("stcd") String stcd, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
|
||||
|
||||
List<StPptnR> getStcdLastPptnData();
|
||||
|
||||
List<Map<String, Object>> getPptnRDataList(@Param("stcd") String stcd, @Param("tm") String tm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +0,0 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gunshi.project.xyt.entity.page.GenericPageParams;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 描述: 预报_水位-泄流量表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:23
|
||||
*/
|
||||
@Schema(description="预报_水位-泄流量表")
|
||||
@Data
|
||||
@TableName("public.forecast_h_q")
|
||||
public class ForecastHQ extends GenericPageParams implements Serializable {
|
||||
|
||||
public final static String thisTableName = "ForecastHQ";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* h
|
||||
*/
|
||||
@TableField(value="h")
|
||||
@Schema(description="h")
|
||||
private BigDecimal h;
|
||||
|
||||
/**
|
||||
* q
|
||||
*/
|
||||
@TableField(value="q")
|
||||
@Schema(description="q")
|
||||
private BigDecimal q;
|
||||
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.gunshi.project.xyt.entity.page.GenericPageParams;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 描述: 预报_水位-库容
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
*/
|
||||
@Schema(description="预报_水位-库容")
|
||||
@Data
|
||||
@TableName("public.forecast_h_v")
|
||||
public class ForecastHV extends GenericPageParams implements Serializable {
|
||||
|
||||
public final static String thisTableName = "ForecastHV";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* h
|
||||
*/
|
||||
@TableField(value="h")
|
||||
@Schema(description="h")
|
||||
private BigDecimal h;
|
||||
|
||||
/**
|
||||
* v
|
||||
*/
|
||||
@TableField(value="v")
|
||||
@Schema(description="v")
|
||||
private BigDecimal v;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 描述: 预报_土壤含水量表
|
||||
* author: cxw
|
||||
* date: 2024-08-02 12:23:07
|
||||
*/
|
||||
@Schema(description="预报_土壤含水量表")
|
||||
@Data
|
||||
@TableName("public.forecast_pa")
|
||||
public class ForecastPa implements Serializable {
|
||||
|
||||
public final static String thisTableName = "ForecastPa";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 测站编码
|
||||
*/
|
||||
@TableId(value="stcd", type= IdType.AUTO)
|
||||
@Schema(description="测站编码")
|
||||
@Size(max = 255,message = "测站编码最大长度要小于 255")
|
||||
@NotBlank(message = "测站编码不能为空")
|
||||
@NotNull(message = "测站编码不能为空")
|
||||
private String stcd;
|
||||
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
@TableField(value="tm")
|
||||
@Schema(description="日期")
|
||||
@Size(max = 10,message = "日期最大长度要小于 10")
|
||||
@NotBlank(message = "日期不能为空")
|
||||
@NotNull(message = "日期不能为空")
|
||||
private String tm;
|
||||
|
||||
/**
|
||||
* 蒸发率
|
||||
*/
|
||||
@TableField(value="k")
|
||||
@Schema(description="蒸发率")
|
||||
private BigDecimal k;
|
||||
|
||||
/**
|
||||
* 昨天土壤含水量
|
||||
*/
|
||||
@TableField(value="pa0")
|
||||
@Schema(description="昨天土壤含水量")
|
||||
private BigDecimal pa0;
|
||||
|
||||
/**
|
||||
* 最大初损值
|
||||
*/
|
||||
@TableField(value="im")
|
||||
@Schema(description="最大初损值")
|
||||
private BigDecimal im;
|
||||
|
||||
/**
|
||||
* 昨天降雨值
|
||||
*/
|
||||
@TableField(value="pt0")
|
||||
@Schema(description="昨天降雨值")
|
||||
private BigDecimal pt0;
|
||||
|
||||
/**
|
||||
* 当天土壤含水量
|
||||
*/
|
||||
@TableField(value="pa")
|
||||
@Schema(description="当天土壤含水量")
|
||||
private BigDecimal pa;
|
||||
|
||||
/**
|
||||
* 入库时间
|
||||
*/
|
||||
@TableField(value="chtm")
|
||||
@Schema(description="入库时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date chtm;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,157 @@
|
|||
package com.gunshi.project.xyt.model;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import com.gunshi.project.xyt.entity.page.GenericPageParams;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 描述: 预报_预测方案管理表
|
||||
* author: cxw
|
||||
* date: 2024-08-05 11:41:45
|
||||
*/
|
||||
@Schema(description="预报_预测方案管理表")
|
||||
@Data
|
||||
@TableName("public.forecast_project")
|
||||
public class ForecastProject extends GenericPageParams implements Serializable {
|
||||
|
||||
public final static String thisTableName = "ForecastProject";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 预报任务名称
|
||||
*/
|
||||
@TableField(value="name")
|
||||
@Schema(description="预报任务名称")
|
||||
@Size(max = 255,message = "预报任务名称最大长度要小于 255")
|
||||
@NotBlank(message = "预报任务名称不能为空")
|
||||
@NotNull(message = "预报任务名称不能为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型(1:自动 2:手动)
|
||||
*/
|
||||
@TableField(value="type")
|
||||
@Schema(description="类型(1:自动 2:手动)")
|
||||
@Size(max = 1,message = "类型(1:自动 2:手动)最大长度要小于 1")
|
||||
@NotBlank(message = "类型(1:自动 2:手动)不能为空")
|
||||
@NotNull(message = "类型(1:自动 2:手动)不能为空")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 预报时间
|
||||
*/
|
||||
@TableField(value="forecast_tm")
|
||||
@Schema(description="预报时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date forecastTm;
|
||||
|
||||
/**
|
||||
* 方案执行的当前时间
|
||||
*/
|
||||
@TableField(value="project_tm")
|
||||
@Schema(description="方案执行的当前时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date projectTm;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@TableField(value="start_tm")
|
||||
@Schema(description="开始时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date startTm;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@TableField(value="end_tm")
|
||||
@Schema(description="结束时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date endTm;
|
||||
|
||||
/**
|
||||
* 操作人id
|
||||
*/
|
||||
@TableField(value="user_id")
|
||||
@Schema(description="操作人id")
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 预见期(小时)
|
||||
*/
|
||||
@TableField(value="forecast_period")
|
||||
@Schema(description="预见期(小时)")
|
||||
private Integer forecastPeriod;
|
||||
|
||||
/**
|
||||
* 预热期(天)
|
||||
*/
|
||||
@TableField(value="forecast_warm")
|
||||
@Schema(description="预热期(天)")
|
||||
private Integer forecastWarm;
|
||||
|
||||
/**
|
||||
* 方案制作时间
|
||||
*/
|
||||
@TableField(value="chtm")
|
||||
@Schema(description="方案制作时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date chtm;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@TableField(value="update_tm")
|
||||
@Schema(description="修改时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date updateTm;
|
||||
|
||||
/**
|
||||
* 任务状态(0:正常 1:暂停 2:删除)
|
||||
*/
|
||||
@TableField(value="status")
|
||||
@Schema(description="任务状态(0:正常 1:暂停 2:删除)")
|
||||
@Size(max = 1,message = "任务状态(0:正常 1:暂停 2:删除)最大长度要小于 1")
|
||||
@NotBlank(message = "任务状态(0:正常 1:暂停 2:删除)不能为空")
|
||||
@NotNull(message = "任务状态(0:正常 1:暂停 2:删除)不能为空")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 任务时间间隔(分钟)
|
||||
*/
|
||||
@TableField(value="time_interval")
|
||||
@Schema(description="任务时间间隔(分钟)")
|
||||
private Integer timeInterval;
|
||||
|
||||
/**
|
||||
* 自动任务id(type为1时有值)
|
||||
*/
|
||||
@TableField(value="task_id")
|
||||
@Schema(description="自动任务id(type为1时有值)")
|
||||
private Long taskId;
|
||||
|
||||
}
|
||||
|
|
@ -9,6 +9,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import com.gunshi.project.xyt.entity.page.GenericPageParams;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
|
@ -18,7 +20,7 @@ import java.util.Date;
|
|||
/**
|
||||
* 描述: 预报_预测结果表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
* date: 2024-08-05 11:41:45
|
||||
*/
|
||||
@Schema(description="预报_预测结果表")
|
||||
@Data
|
||||
|
|
@ -45,38 +47,73 @@ public class ForecastResults extends GenericPageParams implements Serializable {
|
|||
private Date tm;
|
||||
|
||||
/**
|
||||
* 入库流量
|
||||
* 预测入库流量
|
||||
*/
|
||||
@TableField(value="rk_q_value")
|
||||
@Schema(description="入库流量")
|
||||
private BigDecimal rkQValue;
|
||||
@TableField(value="yc_rk_q_value")
|
||||
@Schema(description="预测入库流量")
|
||||
private BigDecimal ycRkQValue;
|
||||
|
||||
/**
|
||||
* 出库流量
|
||||
* 实际入库流量
|
||||
*/
|
||||
@TableField(value="ck_q_value")
|
||||
@Schema(description="出库流量")
|
||||
private BigDecimal ckQValue;
|
||||
@TableField(value="real_rk_q_value")
|
||||
@Schema(description="实际入库流量")
|
||||
private BigDecimal realRkQValue;
|
||||
|
||||
/**
|
||||
* 水库水位
|
||||
* 预测出库流量
|
||||
*/
|
||||
@TableField(value="sw_h_value")
|
||||
@Schema(description="水库水位")
|
||||
private BigDecimal swHValue;
|
||||
@TableField(value="yc_ck_q_value")
|
||||
@Schema(description="预测出库流量")
|
||||
private BigDecimal ycCkQValue;
|
||||
|
||||
/**
|
||||
* 实际出库流量
|
||||
*/
|
||||
@TableField(value="real_ck_q_value")
|
||||
@Schema(description="实际出库流量")
|
||||
private BigDecimal realCkQValue;
|
||||
|
||||
/**
|
||||
* 预测水库水位
|
||||
*/
|
||||
@TableField(value="yc_sw_h_value")
|
||||
@Schema(description="预测水库水位")
|
||||
private BigDecimal ycSwHValue;
|
||||
|
||||
/**
|
||||
* 实际水库水位
|
||||
*/
|
||||
@TableField(value="real_sw_h_value")
|
||||
@Schema(description="实际水库水位")
|
||||
private BigDecimal realSwHValue;
|
||||
|
||||
/**
|
||||
* 降雨
|
||||
*/
|
||||
@TableField(value="drp_value")
|
||||
@TableField(value="drp")
|
||||
@Schema(description="降雨")
|
||||
private BigDecimal drpValue;
|
||||
private BigDecimal drp;
|
||||
|
||||
/**
|
||||
* 入库时间
|
||||
* 径流深
|
||||
*/
|
||||
@TableField(value="r")
|
||||
@Schema(description="径流深")
|
||||
private BigDecimal r;
|
||||
|
||||
/**
|
||||
* 方案id
|
||||
*/
|
||||
@TableField(value="project_id")
|
||||
@Schema(description="方案id")
|
||||
private Long projectId;
|
||||
|
||||
/**
|
||||
* 方案制作时间
|
||||
*/
|
||||
@TableField(value="chtm")
|
||||
@Schema(description="入库时间")
|
||||
@Schema(description="方案制作时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date chtm;
|
||||
|
||||
|
|
@ -89,17 +126,10 @@ public class ForecastResults extends GenericPageParams implements Serializable {
|
|||
private Date updateTm;
|
||||
|
||||
/**
|
||||
* 预测方案id
|
||||
* 主汛期防洪限制水位
|
||||
*/
|
||||
@TableField(value="plan_id")
|
||||
@Schema(description="预测方案id")
|
||||
private Integer planId;
|
||||
|
||||
/**
|
||||
* 数据生成时间戳
|
||||
*/
|
||||
@TableField(value="create_timestamp")
|
||||
@Schema(description="数据生成时间戳")
|
||||
private Integer createTimestamp;
|
||||
@TableField(value="fl_low_lim_lev")
|
||||
@Schema(description="主汛期防洪限制水位")
|
||||
private BigDecimal flLowLimLev;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,26 +6,30 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import com.gunshi.project.xyt.entity.page.GenericPageParams;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 描述: 预报_预测方案管理表
|
||||
* 描述: 预报_预测自动任务管理表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
* date: 2024-08-05 11:41:44
|
||||
*/
|
||||
@Schema(description="预报_预测方案管理表")
|
||||
@Schema(description="预报_预测自动任务管理表")
|
||||
@Data
|
||||
@TableName("public.forecast_plan")
|
||||
public class ForecastPlan extends GenericPageParams implements Serializable {
|
||||
@TableName("public.forecast_task")
|
||||
public class ForecastTask extends GenericPageParams implements Serializable {
|
||||
|
||||
public final static String thisTableName = "ForecastPlan";
|
||||
public final static String thisTableName = "ForecastTask";
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
|
@ -34,48 +38,17 @@ public class ForecastPlan extends GenericPageParams implements Serializable {
|
|||
*/
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 预报方案名称
|
||||
* 预报任务名称
|
||||
*/
|
||||
@TableField(value="name")
|
||||
@Schema(description="预报方案名称")
|
||||
@Size(max = 255,message = "预报方案名称最大长度要小于 255")
|
||||
@Schema(description="预报任务名称")
|
||||
@Size(max = 255,message = "预报任务名称最大长度要小于 255")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 类型(1:自动 2:人工)
|
||||
*/
|
||||
@TableField(value="type")
|
||||
@Schema(description="类型(1:自动 2:人工)")
|
||||
@Size(max = 1,message = "类型(1:自动 2:人工)最大长度要小于 1")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 预报时间
|
||||
*/
|
||||
@TableField(value="forecast_tm")
|
||||
@Schema(description="预报时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date forecastTm;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
@TableField(value="start_tm")
|
||||
@Schema(description="开始时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date startTm;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
@TableField(value="end_tm")
|
||||
@Schema(description="结束时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
private Date endTm;
|
||||
|
||||
/**
|
||||
* 操作人id
|
||||
*/
|
||||
|
|
@ -126,8 +99,15 @@ public class ForecastPlan extends GenericPageParams implements Serializable {
|
|||
*/
|
||||
@TableField(value="time_interval")
|
||||
@Schema(description="任务时间间隔(分钟)")
|
||||
private String timeInterval;
|
||||
private BigDecimal timeInterval;
|
||||
|
||||
/**
|
||||
* 选择的预报时间
|
||||
*/
|
||||
@Schema(description = "选择的预报时间")
|
||||
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
|
||||
@TableField(exist = false)
|
||||
private Date forecastTime;
|
||||
|
||||
/**
|
||||
* 选择的起始时间
|
||||
|
|
@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import com.gunshi.project.xyt.entity.page.GenericPageParams;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
@ -34,6 +36,7 @@ public class ForecastU extends GenericPageParams implements Serializable {
|
|||
*/
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.gunshi.core.dateformat.DateFormatString;
|
||||
import com.gunshi.project.xyt.entity.page.GenericPageParams;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
@ -36,6 +38,7 @@ public class ForecastUseparam extends GenericPageParams implements Serializable
|
|||
*/
|
||||
@TableId(value="id", type= IdType.AUTO)
|
||||
@Schema(description="主键")
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package com.gunshi.project.xyt.schedule;
|
||||
|
||||
import com.gunshi.project.xyt.model.ForecastPlan;
|
||||
import com.gunshi.project.xyt.model.ForecastTask;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.CronScheduleBuilder;
|
||||
|
|
@ -16,6 +16,8 @@ import org.quartz.TriggerKey;
|
|||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
||||
/**
|
||||
* @author cxw
|
||||
|
|
@ -34,7 +36,7 @@ public class TaskGroupHandler {
|
|||
* 新增定时任务
|
||||
* @param jobId
|
||||
*/
|
||||
public void addCronJob(String jobId, ForecastPlan forecastPlan) {
|
||||
public void addCronJob(String jobId, ForecastTask forecastTask) {
|
||||
try {
|
||||
TriggerKey triggerKey = TriggerKey.triggerKey(jobId, "FloodForecast");
|
||||
|
||||
|
|
@ -43,9 +45,15 @@ public class TaskGroupHandler {
|
|||
.withDescription("任务组编排").build();
|
||||
JobDataMap jobDataMap = job.getJobDataMap();
|
||||
jobDataMap.put("jobId", jobId);
|
||||
jobDataMap.put("forecastPlan", forecastPlan);
|
||||
jobDataMap.put("forecastTask", forecastTask);
|
||||
//CronScheduleBuilder cronScheduleBuilder = CronScheduleBuilder.cronSchedule("cron的表达式");
|
||||
String cronExpression = "0 0/" + forecastPlan.getTimeInterval() + " * * * ?";
|
||||
String cronExpression = "";
|
||||
// 小于1,就是0.5小时,转为分钟
|
||||
if(forecastTask.getTimeInterval().compareTo(BigDecimal.ONE) < 0){
|
||||
cronExpression = "0 0/" + forecastTask.getTimeInterval() + " * * * ?";
|
||||
} else {
|
||||
cronExpression = "0 0 */" + forecastTask.getTimeInterval() + " * * ?";
|
||||
}
|
||||
CronTrigger trigger = TriggerBuilder.newTrigger()
|
||||
.withIdentity(triggerKey)
|
||||
.startNow()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package com.gunshi.project.xyt.schedule;
|
||||
|
||||
import com.gunshi.model.vo.FloodAlgorithemVo;
|
||||
import com.gunshi.project.xyt.model.ForecastPlan;
|
||||
import com.gunshi.project.xyt.entity.vo.ForecastResultVo;
|
||||
import com.gunshi.project.xyt.model.ForecastTask;
|
||||
import com.gunshi.project.xyt.service.ForecastResultsService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.quartz.Job;
|
||||
|
|
@ -34,9 +34,15 @@ public class TaskGroupJob implements Job {
|
|||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
JobDataMap jdMap = context.getJobDetail().getJobDataMap();
|
||||
String jobId = (String) jdMap.get("jobId");
|
||||
ForecastPlan forecastPlan = (ForecastPlan) jdMap.get("forecastPlan");
|
||||
ForecastTask forecastTask = (ForecastTask) jdMap.get("forecastTask");
|
||||
log.info("{}----TaskGroupJob-计划执行开始===>jobId:{}", dtf.format(LocalDateTime.now()), jobId);
|
||||
List<FloodAlgorithemVo> floodAlgorithemVos = forecastResultsService.floodForecast(forecastPlan);
|
||||
// 根据执行时间、预热期、预见期获取对应的预报、开始、结束时间
|
||||
// todo
|
||||
try {
|
||||
List<ForecastResultVo> forecastResultVo = forecastResultsService.autoFloodForecast(forecastTask);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
log.info("{}----TaskGroupJob-计划执行结束===>jobId:{}", dtf.format(LocalDateTime.now()), jobId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@ package com.gunshi.project.xyt.schedule;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.gunshi.project.xyt.model.ForecastPlan;
|
||||
import com.gunshi.project.xyt.service.ForecastPlanService;
|
||||
import com.gunshi.project.xyt.model.ForecastTask;
|
||||
import com.gunshi.project.xyt.service.ForecastTaskService;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -31,16 +31,16 @@ public class TaskGroupJobRunner implements CommandLineRunner {
|
|||
private TaskGroupHandler taskGroupHandler;
|
||||
|
||||
@Autowired
|
||||
private ForecastPlanService forecastPlanService;
|
||||
private ForecastTaskService forecastTaskService;
|
||||
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
// 初始加载数据库里状态为自动、正常的定时任务
|
||||
List<ForecastPlan> planList = forecastPlanService.list(new QueryWrapper<ForecastPlan>().eq("type", "1").eq("status", "0"));
|
||||
if (CollectionUtils.isNotEmpty(planList)) {
|
||||
Map<Long, ForecastPlan> jobMap = planList.stream()
|
||||
.collect(Collectors.toMap(ForecastPlan::getId, Function.identity(), (key1, key2)->key2));
|
||||
for (Map.Entry<Long, ForecastPlan> entry : jobMap.entrySet()) {
|
||||
// 初始加载数据库里状态为正常的定时任务
|
||||
List<ForecastTask> TaskList = forecastTaskService.list(new QueryWrapper<ForecastTask>().eq("status", "0"));
|
||||
if (CollectionUtils.isNotEmpty(TaskList)) {
|
||||
Map<Long, ForecastTask> jobMap = TaskList.stream()
|
||||
.collect(Collectors.toMap(ForecastTask::getId, Function.identity(), (key1, key2)->key2));
|
||||
for (Map.Entry<Long, ForecastTask> entry : jobMap.entrySet()) {
|
||||
taskGroupHandler.addCronJob(String.valueOf(entry.getKey()), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 描述: 前期影响雨量折减系数表
|
||||
* 描述: 预报_前期影响雨量折减系数表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,21 +1,23 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.ForecastHVMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastHV;
|
||||
import com.gunshi.project.xyt.mapper.ForecastPaMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastPa;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 描述: 预报_水位-库容
|
||||
* 描述: 预报_土壤含水量表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
* date: 2024-08-02 12:23:07
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ForecastHVService extends ServiceImpl<ForecastHVMapper, ForecastHV>
|
||||
public class ForecastPaService extends ServiceImpl<ForecastPaMapper, ForecastPa>
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,21 +1,23 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.ForecastHQMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastHQ;
|
||||
import com.gunshi.project.xyt.mapper.ForecastProjectMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastProject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 描述: 预报_水位-泄流量表
|
||||
* 描述: 预报_预测方案管理表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
* date: 2024-08-05 11:41:45
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ForecastHQService extends ServiceImpl<ForecastHQMapper, ForecastHQ>
|
||||
public class ForecastProjectService extends ServiceImpl<ForecastProjectMapper, ForecastProject>
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -12,15 +12,17 @@ import com.gunshi.project.xyt.entity.vo.ForeRainVo;
|
|||
import com.gunshi.project.xyt.entity.vo.ForecastResultVo;
|
||||
import com.gunshi.project.xyt.grb.RainGrib2Layer;
|
||||
import com.gunshi.project.xyt.mapper.ForecastResultsMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastK;
|
||||
import com.gunshi.project.xyt.model.ForecastPlan;
|
||||
import com.gunshi.project.xyt.model.AttResBase;
|
||||
import com.gunshi.project.xyt.model.ForecastPa;
|
||||
import com.gunshi.project.xyt.model.ForecastTask;
|
||||
import com.gunshi.project.xyt.model.ForecastResults;
|
||||
import com.gunshi.project.xyt.model.ForecastU;
|
||||
import com.gunshi.project.xyt.model.ForecastUseparam;
|
||||
import com.gunshi.project.xyt.model.StPptnR;
|
||||
import com.gunshi.project.xyt.model.StRsvrR;
|
||||
import com.gunshi.project.xyt.model.StStbprpB;
|
||||
import com.gunshi.project.xyt.model.StWaterR;
|
||||
import com.gunshi.project.xyt.model.StZqrlB;
|
||||
import com.gunshi.project.xyt.util.DataHandleUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -31,14 +33,14 @@ import java.text.ParseException;
|
|||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 描述: 预测结果表
|
||||
* 描述: 预报_预测结果表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
*/
|
||||
|
|
@ -49,6 +51,7 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
|
|||
{
|
||||
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
private static SimpleDateFormat sdfDay = new SimpleDateFormat("yyyy-MM-dd");
|
||||
private static SimpleDateFormat eightSdf = new SimpleDateFormat("yyyy-MM-dd 08");
|
||||
private static SimpleDateFormat sixteenSdf = new SimpleDateFormat("yyyy-MM-dd 16");
|
||||
|
||||
|
|
@ -58,9 +61,6 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
|
|||
@Autowired
|
||||
private ForecastUService forecastUService;
|
||||
|
||||
@Autowired
|
||||
private ForecastKService forecastKService;
|
||||
|
||||
@Autowired
|
||||
private StPptnRService stPptnRService;
|
||||
|
||||
|
|
@ -74,104 +74,25 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
|
|||
private StStbprpBService stStbprpBService;
|
||||
|
||||
@Autowired
|
||||
private StWaterRService stWaterRService;
|
||||
private StZqrlBService stZqrlBService;
|
||||
|
||||
@Autowired
|
||||
private ForecastPaService forecastPaService;
|
||||
|
||||
@Autowired
|
||||
private AttResBaseService attResBaseService;
|
||||
|
||||
|
||||
/**
|
||||
* @description: 洪水预测
|
||||
* @param forecastPlan
|
||||
* @description: 自动洪水预测
|
||||
* @param forecastTask
|
||||
* @return: java.util.List<com.gunshi.model.vo.FloodAlgorithemVo>
|
||||
* @auther: cxw
|
||||
* @date: 2024-07-30, 周二, 14:40:45
|
||||
*/
|
||||
public List<FloodAlgorithemVo> floodForecast(ForecastPlan forecastPlan) {
|
||||
List<FloodAlgorithemVo> voList = new ArrayList<>();
|
||||
Date now = new Date();
|
||||
Date forecastTm = forecastPlan.getForecastTm();
|
||||
Date startTm = forecastPlan.getStartTm();
|
||||
Date endTm = forecastPlan.getEndTm();
|
||||
// 获取配置参数
|
||||
List<ForecastUseparam> paramList = forecastUseparamService.list();
|
||||
List<ForecastU> uList = forecastUService.list();
|
||||
List<ForecastK> kList = forecastKService.list();
|
||||
if (CollectionUtils.isNotEmpty(paramList) && CollectionUtils.isNotEmpty(uList) && CollectionUtils.isNotEmpty(kList)) {
|
||||
// 每小时的单位径流量,单位m³/s
|
||||
double[] u = uList.stream().mapToDouble(forecastU -> forecastU.getUValue().doubleValue()).toArray();
|
||||
// 蒸发率
|
||||
Map<Integer, BigDecimal> kMap = kList.stream().collect(Collectors.toMap(ForecastK::getMonth, ForecastK::getKValue));
|
||||
double k = kMap.get(Integer.valueOf(sdf.format(forecastTm).substring(5, 7))).doubleValue();
|
||||
// 其它配置参数
|
||||
Map<String, String> paramMap = paramList.stream().collect(Collectors.toMap(ForecastUseparam::getParamCode,
|
||||
ForecastUseparam::getParamValue));
|
||||
if (!paramMap.get("Im").isEmpty() && !paramMap.get("dt").isEmpty()) {
|
||||
double Wm = Double.parseDouble(paramMap.get("Im"));// 土壤含水量最大值(最大初损值)Im
|
||||
double dt = Double.parseDouble(paramMap.get("dt"));
|
||||
double PaT0 = 0.0;// 昨天的Pa值(一场降雨的初始值可以设为0)
|
||||
double pt = 0.0;// 昨天的降雨值
|
||||
double H1 = 0.0;// 初始水库水位,可以根据H1->V1,H1->q1得到初始的水库库容和下泄流量
|
||||
double PaT1 = 0.0;// 根据昨天的降雨值求今天早上的土壤含水量,这个每天早上8点,根据昨天的降雨值要重新计算。
|
||||
try {
|
||||
// 获取预测开始时间前的最后水库水位
|
||||
StRsvrR rsvrR = stRsvrRService.getOne(new QueryWrapper<StRsvrR>().eq("stcd", "716153201").le("tm", startTm).orderBy(true, false, "tm").last("limit 1"));
|
||||
if (ObjectUtils.isNotEmpty(rsvrR)) {
|
||||
H1 = Double.parseDouble(rsvrR.getRz());
|
||||
} else {
|
||||
return voList;
|
||||
}
|
||||
// 根据预测时间查询降雨序列值
|
||||
List<String> pResultList = new ArrayList<>();
|
||||
List<StPptnR> pptnRAllList = new ArrayList<>();
|
||||
List<StPptnR> pptnRExistedList = new ArrayList<>();
|
||||
List<StPptnR> pptnRFutureList = new ArrayList<>();
|
||||
QueryWrapper<StPptnR> qwExisted = new QueryWrapper<>();
|
||||
// 如果结束时间在当前时间之前,降雨序列从历史降雨表获取
|
||||
if (endTm.compareTo(now) <= 0) {
|
||||
qwExisted = new QueryWrapper<StPptnR>().eq("stcd", "716153201").ge("tm", startTm).le("tm", endTm).orderBy(true, true, "tm");
|
||||
} else {
|
||||
qwExisted = new QueryWrapper<StPptnR>().eq("stcd", "716153201").ge("tm", startTm).le("tm", now).orderBy(true, true, "tm");
|
||||
pptnRFutureList = getForecastDrpData(now, rsvrR.getStcd());
|
||||
}
|
||||
pptnRExistedList = stPptnRService.list(qwExisted);
|
||||
pptnRAllList.addAll(pptnRExistedList);
|
||||
pptnRAllList.addAll(pptnRFutureList);
|
||||
// 根据降雨数据,按照△t的颗粒度,均分
|
||||
if (CollectionUtils.isNotEmpty(pptnRAllList)) {
|
||||
for (int i = 0; i < pptnRAllList.size(); i++) {
|
||||
StPptnR stPptnR = pptnRAllList.get(i);
|
||||
String drp = stPptnR.getDrp();
|
||||
pResultList.add(drp);
|
||||
if (i + 1 == pptnRAllList.size()) {
|
||||
break;
|
||||
} else {
|
||||
StPptnR stPptnRNext = pptnRAllList.get(i + 1);
|
||||
// 两条数据的小时差
|
||||
double diffHours = dateHourDifference(stPptnR.getTm(), stPptnRNext.getTm());
|
||||
int floorNum = (int) Math.floor(diffHours / dt);
|
||||
BigDecimal meanDifference =
|
||||
new BigDecimal(stPptnRNext.getDrp()).subtract(new BigDecimal(drp)).divide(new BigDecimal(floorNum),
|
||||
BigDecimal.ROUND_HALF_UP, 2);
|
||||
for (int j = 1; j < floorNum; j++) {
|
||||
BigDecimal add = new BigDecimal(drp).add(meanDifference.multiply(new BigDecimal(j))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
pResultList.add(add.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
double[] PList = pResultList.stream().mapToDouble(Double::parseDouble).toArray();
|
||||
// 预测执行
|
||||
voList = RrainfallForecast.getData(sdf.format(startTm), k, PaT0, Wm, pt, H1, dt, PaT1, PList, u);
|
||||
// 预测程序返回的时间会比想要的长,截取
|
||||
if(CollectionUtils.isNotEmpty(voList)){
|
||||
voList = voList.subList(0, PList.length);
|
||||
for (int j = 0; j < voList.size(); j++){
|
||||
voList.get(j).setDrp(new BigDecimal(PList[j]));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
public List<ForecastResultVo> autoFloodForecast(ForecastTask forecastTask) throws Exception {
|
||||
// 获取预测数据
|
||||
List<ForecastResultVo> voList = new ArrayList<>();
|
||||
return voList;
|
||||
}
|
||||
|
||||
|
|
@ -216,6 +137,7 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
|
|||
// 只取当前时间之后的数据
|
||||
if(foreRainTimeVo.getTm().compareTo(now) > 0){
|
||||
StPptnR stPptnR = new StPptnR();
|
||||
stPptnR.setStcd(stcd);
|
||||
stPptnR.setTm(foreRainTimeVo.getTm());
|
||||
stPptnR.setDrp(foreRainTimeVo.getDrp().toString());
|
||||
pptnRFutureList.add(stPptnR);
|
||||
|
|
@ -225,133 +147,150 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
|
|||
return pptnRFutureList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断date是否在早八点后还是前(true:在8:00前)
|
||||
*/
|
||||
public static boolean isBeforeEightAM(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 8);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return date.before(calendar.getTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 获取人工交互洪水预报结果
|
||||
* @param forecastPlan
|
||||
* @param forecastTask
|
||||
* @return: java.util.List<com.gunshi.project.xyt.entity.vo.ForecastResultVo>
|
||||
* @auther: cxw
|
||||
* @date: 2024-07-31, 周三, 11:09:24
|
||||
*/
|
||||
public List<ForecastResultVo> getHumanForecastResult(ForecastPlan forecastPlan) {
|
||||
List<ForecastResultVo> resultList = new ArrayList<>();
|
||||
// 需要根据△T来整编实际降雨、水位数据
|
||||
List<ForecastUseparam> paramList = forecastUseparamService.list();
|
||||
Map<String, String> paramMap = paramList.stream().collect(Collectors.toMap(ForecastUseparam::getParamCode, ForecastUseparam::getParamValue));
|
||||
double dt = Double.parseDouble(paramMap.get("dt"));
|
||||
|
||||
// 获取时间范围内的真实降雨
|
||||
List<StPptnR> pptnRRealList = stPptnRService.list(new QueryWrapper<StPptnR>().eq("stcd", "716153201").ge("tm", forecastPlan.getStartTm()).le("tm", forecastPlan.getForecastTm()));
|
||||
// 获取时间范围内的真实水位
|
||||
List<StRsvrR> rsvrRRealList = stRsvrRService.list(new QueryWrapper<StRsvrR>().eq("stcd", "716153201").ge("tm", forecastPlan.getStartTm()).le("tm", forecastPlan.getForecastTm()));
|
||||
// 获取时间范围内的真实入库流量
|
||||
List<StWaterR> waterRkRealList = stWaterRService.list(new QueryWrapper<StWaterR>().eq("stcd", "1111111").ge("tm", forecastPlan.getStartTm()).le("tm", forecastPlan.getForecastTm()));
|
||||
// 获取时间范围内的真实出库流量
|
||||
List<StWaterR> waterCkRealList = stWaterRService.list(new QueryWrapper<StWaterR>().eq("stcd", "2222222").ge("tm", forecastPlan.getStartTm()).le("tm", forecastPlan.getForecastTm()));
|
||||
public List<ForecastResultVo> getHumanForecastResult(ForecastTask forecastTask) throws Exception {
|
||||
// 获取预测数据
|
||||
List<FloodAlgorithemVo> floodAlgorithemVos = floodForecast(forecastPlan);
|
||||
if (CollectionUtils.isNotEmpty(floodAlgorithemVos)) {
|
||||
Map<String, String> pptnRMap = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(pptnRRealList)) {
|
||||
pptnRRealList = reorganizePptnRData(pptnRRealList, dt);
|
||||
pptnRMap = pptnRRealList.stream().collect(Collectors.toMap(obj -> sdf.format(obj.getTm()), obj -> obj.getDrp()));
|
||||
}
|
||||
Map<String, String> rsvrRMap = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(rsvrRRealList)) {
|
||||
rsvrRRealList = reorganizeRsvrRData(rsvrRRealList, dt);
|
||||
rsvrRMap = rsvrRRealList.stream().collect(Collectors.toMap(obj -> sdf.format(obj.getTm()), obj -> obj.getRz()));
|
||||
}
|
||||
Map<String, String> waterRkMap = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(waterRkRealList)) {
|
||||
waterRkMap = waterRkRealList.stream().collect(Collectors.toMap(obj -> sdf.format(obj.getTm()), obj -> obj.getQ()));
|
||||
}
|
||||
Map<String, String> waterCkMap = new HashMap<>();
|
||||
if (CollectionUtils.isNotEmpty(waterCkRealList)) {
|
||||
waterCkMap = waterRkRealList.stream().collect(Collectors.toMap(obj -> sdf.format(obj.getTm()), obj -> obj.getQ()));
|
||||
}
|
||||
// 组装
|
||||
for (FloodAlgorithemVo floodVo : floodAlgorithemVos) {
|
||||
ForecastResultVo vo = new ForecastResultVo();
|
||||
vo.setTm(floodVo.getDateStr());
|
||||
vo.setYcRkQValue(floodVo.getRq());
|
||||
vo.setYcCkQValue(floodVo.getCq());
|
||||
vo.setYcSwHValue(floodVo.getKh());
|
||||
vo.setYcDrp(floodVo.getDrp());
|
||||
if (pptnRMap.containsKey(floodVo.getDateStr())) {
|
||||
vo.setRealDrp(new BigDecimal(pptnRMap.get(floodVo.getDateStr())));
|
||||
}
|
||||
if (rsvrRMap.containsKey(floodVo.getDateStr())) {
|
||||
vo.setRealSwHValue(new BigDecimal(rsvrRMap.get(floodVo.getDateStr())));
|
||||
}
|
||||
if (waterRkMap.containsKey(floodVo.getDateStr())) {
|
||||
vo.setRealRkQValue(new BigDecimal(waterRkMap.get(floodVo.getDateStr())));
|
||||
}
|
||||
if (waterCkMap.containsKey(floodVo.getDateStr())) {
|
||||
vo.setRealCkQValue(new BigDecimal(waterCkMap.get(floodVo.getDateStr())));
|
||||
}
|
||||
resultList.add(vo);
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 根据△T来整编实际降雨数据
|
||||
* @param pptnRRealList
|
||||
* @param dt
|
||||
* @return: java.util.List<com.gunshi.project.xyt.model.StPptnR>
|
||||
* @auther: cxw
|
||||
*/
|
||||
private List<StPptnR> reorganizePptnRData(List<StPptnR> pptnRRealList, double dt) {
|
||||
// 每次加0小时30分钟,根据dt设置,此时dt=0.5小时
|
||||
int totalMinutes = (int) Math.round(dt * 60);
|
||||
// 计算小时数
|
||||
int hours = totalMinutes / 60;
|
||||
// 计算剩余的分钟数(即不足一小时的部分)
|
||||
int minutes = totalMinutes % 60;
|
||||
List<StPptnR> resultList = new ArrayList<>();
|
||||
for (int i = 0; i < pptnRRealList.size(); i++) {
|
||||
StPptnR stPptnR = pptnRRealList.get(i);
|
||||
resultList.add(stPptnR);
|
||||
Date tm = stPptnR.getTm();
|
||||
String drp = stPptnR.getDrp();
|
||||
if (i + 1 == pptnRRealList.size()) {
|
||||
break;
|
||||
List<ForecastResultVo> voList = new ArrayList<>();
|
||||
// 当前时间整点,作为获取雨量数据历史、预测分隔点
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
Date nowHourTime = calendar.getTime();
|
||||
Date forecastTm = forecastTask.getForecastTime();
|
||||
Date startTm = forecastTask.getStartTime();
|
||||
Date endTm = forecastTask.getEndTime();
|
||||
// 获取整个时间线的降雨数据
|
||||
List<StPptnR> pptnRAllList = new ArrayList<>();
|
||||
List<StPptnR> pptnRFutureList = new ArrayList<>();
|
||||
QueryWrapper<StPptnR> qwExisted = new QueryWrapper<>();
|
||||
// 如果结束时间在当前时间之前,降雨序列从历史降雨表获取
|
||||
if (endTm.compareTo(nowHourTime) <= 0) {
|
||||
qwExisted = new QueryWrapper<StPptnR>().eq("stcd", "716153201").ge("tm", startTm).le("tm", endTm).orderBy(true, true, "tm");
|
||||
} else {
|
||||
StPptnR stPptnRNext = pptnRRealList.get(i + 1);
|
||||
qwExisted = new QueryWrapper<StPptnR>().eq("stcd", "716153201").ge("tm", startTm).le("tm", nowHourTime).orderBy(true, true, "tm");
|
||||
pptnRFutureList = getForecastDrpData(nowHourTime, "716153201");
|
||||
}
|
||||
List<StPptnR> pptnRExistedList = stPptnRService.list(qwExisted);
|
||||
pptnRAllList.addAll(pptnRExistedList);
|
||||
pptnRAllList.addAll(pptnRFutureList);
|
||||
// 获取配置参数
|
||||
List<ForecastUseparam> paramList = forecastUseparamService.list();
|
||||
List<ForecastU> uList = forecastUService.list();
|
||||
double dt = 0.0;
|
||||
double Wm = 0.0;
|
||||
// 泄流量
|
||||
List<StZqrlB> stZqrlBList = stZqrlBService.list(new QueryWrapper<StZqrlB>().eq("stcd", "716153201"));
|
||||
if (CollectionUtils.isEmpty(paramList) || CollectionUtils.isEmpty(uList) || CollectionUtils.isEmpty(pptnRAllList) || CollectionUtils.isEmpty(stZqrlBList)) {
|
||||
return voList;
|
||||
}
|
||||
// 每小时的单位径流量,单位m³/s
|
||||
double[] u = uList.stream().mapToDouble(forecastU -> forecastU.getUValue().doubleValue()).toArray();
|
||||
Map<String, String> paramMap = paramList.stream().collect(Collectors.toMap(ForecastUseparam::getParamCode, ForecastUseparam::getParamValue));
|
||||
if (paramMap.get("dt").isEmpty() || paramMap.get("Im").isEmpty()) {
|
||||
return voList;
|
||||
}
|
||||
dt = Double.parseDouble(paramMap.get("dt"));
|
||||
Wm = Double.parseDouble(paramMap.get("Im"));
|
||||
// 根据开始结束时间查询pa
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(startTm);
|
||||
// 将日期往前推一天
|
||||
cal.add(Calendar.DATE, -1);
|
||||
List<ForecastPa> paList = forecastPaService.list(new QueryWrapper<ForecastPa>().eq("stcd", "716153201").ge("tm",
|
||||
sdfDay.format(cal.getTime())).le("tm", sdfDay.format(endTm)));
|
||||
if (CollectionUtils.isEmpty(paList)) {
|
||||
return voList;
|
||||
}
|
||||
Map<String, ForecastPa> paMap = paList.stream().collect(Collectors.toMap(ForecastPa::getTm, entity -> entity));
|
||||
// 获取预测开始时间前的最后水库水位
|
||||
double H1 = 0.0;// 初始水库水位,可以根据H1->V1,H1->q1得到初始的水库库容和下泄流量
|
||||
StRsvrR rsvrR = stRsvrRService.getOne(new QueryWrapper<StRsvrR>().eq("stcd", "716153201").le("tm", startTm).orderBy(true, false, "tm").last("limit 1"));
|
||||
if (ObjectUtils.isEmpty(rsvrR)) {
|
||||
return voList;
|
||||
}
|
||||
H1 = Double.parseDouble(rsvrR.getRz());
|
||||
// 获取汛限水位
|
||||
AttResBase attResBase = attResBaseService.getOne(new QueryWrapper<>());
|
||||
List<Date[]> periods = splitByDay8To8(startTm, endTm);
|
||||
for (Date[] period : periods) {
|
||||
// 根据每段时间的开始时间,如果在08点前,则采用前一天的pa值计算
|
||||
if (isBeforeEightAM(period[0])) {
|
||||
cal.setTime(period[0]);
|
||||
// 将日期往前推一天
|
||||
cal.add(Calendar.DATE, -1);
|
||||
}
|
||||
ForecastPa forecastPa = paMap.get(sdfDay.format(cal.getTime()));
|
||||
// 根据降雨数据,按照△t的颗粒度,均分
|
||||
List<String> pResultList = new ArrayList<>();
|
||||
// 筛选时间段内的降雨数据。第一个条件:时间大于等于开始时间;第二个条件:时间小于等于结束时间(包前不包后,但是需要使用最后的tm计算间隔值)
|
||||
List<StPptnR> filterList = pptnRAllList.stream().filter(e -> e.getTm().compareTo(period[0]) >= 0).filter(e -> e.getTm().compareTo(period[1]) <= 0).collect(Collectors.toList());
|
||||
for (int i = 0; i < filterList.size(); i++) {
|
||||
// 到第二天早八,包前不包后,最后一条的第二天早八剔除
|
||||
if (i + 1 == filterList.size()) {
|
||||
break;
|
||||
}
|
||||
StPptnR stPptnR = filterList.get(i);
|
||||
String drp = stPptnR.getDrp();
|
||||
StPptnR stPptnRNext = filterList.get(i + 1);
|
||||
// 两条数据的小时差
|
||||
double diffHours = dateHourDifference(stPptnR.getTm(), stPptnRNext.getTm());
|
||||
// 两条数据间需要增补几条
|
||||
int floorNum = (int) Math.floor(diffHours / dt);
|
||||
BigDecimal meanDifference =
|
||||
new BigDecimal(stPptnRNext.getDrp()).subtract(new BigDecimal(drp)).divide(new BigDecimal(floorNum),
|
||||
BigDecimal.ROUND_HALF_UP, 2);
|
||||
for (int j = 1; j < floorNum; j++) {
|
||||
// 增补出的数据
|
||||
StPptnR suppleStPptnR = new StPptnR();
|
||||
BigDecimal add = new BigDecimal(drp).add(meanDifference.multiply(new BigDecimal(j))).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
try {
|
||||
suppleStPptnR.setTm(sdf.parse(RunoffService.calc(sdf.format(tm), hours, minutes, true)));
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
for (int j = 0; j < floorNum; j++) {
|
||||
BigDecimal add = new BigDecimal(drp).divide(BigDecimal.valueOf(floorNum)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
pResultList.add(add.toString());
|
||||
}
|
||||
suppleStPptnR.setDrp(add.toString());
|
||||
suppleStPptnR.setStcd(stPptnR.getStcd());
|
||||
resultList.add(suppleStPptnR);
|
||||
}
|
||||
double[] PList = pResultList.stream().mapToDouble(Double::parseDouble).toArray();
|
||||
List<StRsvrR> rsvrRRealList = stRsvrRService.list(new QueryWrapper<StRsvrR>().eq("stcd", "716153201").ge("tm", period[0]).le("tm", period[1]));
|
||||
rsvrRRealList = reorganizeRsvrRData(rsvrRRealList, dt);
|
||||
// 预测执行
|
||||
List<FloodAlgorithemVo> forecastVoList = RrainfallForecast.getData(sdf.format(period[0]), forecastPa.getK().doubleValue(), forecastPa.getPa0().doubleValue(), Wm, forecastPa.getPt0().doubleValue(), H1, dt,
|
||||
forecastPa.getPa().doubleValue(), PList, u, "716153201");
|
||||
if (CollectionUtils.isNotEmpty(forecastVoList)) {
|
||||
forecastVoList = forecastVoList.subList(0, PList.length);
|
||||
for (int j = 0; j < forecastVoList.size(); j++) {
|
||||
FloodAlgorithemVo floodAlgorithemVo = forecastVoList.get(j);
|
||||
ForecastResultVo resultVo = new ForecastResultVo();
|
||||
resultVo.setTm(floodAlgorithemVo.getDateStr());
|
||||
resultVo.setYcRkQValue(floodAlgorithemVo.getRq());// 预测入库流量
|
||||
// resultVo.setRealRkQValue();// 暂无真实入库流量
|
||||
resultVo.setYcCkQValue(floodAlgorithemVo.getCq());// 预测出库流量
|
||||
resultVo.setYcSwHValue(floodAlgorithemVo.getKh());// 预测水库水位
|
||||
H1 = resultVo.getYcSwHValue().doubleValue();// 先以预测水位作为下一次预测段起始值
|
||||
if (j < rsvrRRealList.size()) {
|
||||
BigDecimal realSwHValue = new BigDecimal(rsvrRRealList.get(j).getRz());
|
||||
resultVo.setRealSwHValue(realSwHValue);// 真实水库水位
|
||||
H1 = realSwHValue.doubleValue();// 如果有真实水位,将最后一条的真实水位作为下一次预测段的初始水位
|
||||
// 真实出库流量=真实水库水位与泄流量曲线差值法
|
||||
if (realSwHValue != null && CollectionUtils.isNotEmpty(stZqrlBList)) {
|
||||
BigDecimal maxZ = stZqrlBList.stream().max(Comparator.comparing(StZqrlB::getZ)).get().getZ();
|
||||
BigDecimal minZ = stZqrlBList.stream().min(Comparator.comparing(StZqrlB::getZ)).get().getZ();
|
||||
if (realSwHValue.compareTo(minZ) < 0 || realSwHValue.compareTo(maxZ) > 0) {
|
||||
resultVo.setRealCkQValue(BigDecimal.ZERO);// 真实出库流量
|
||||
} else {
|
||||
Map<BigDecimal, BigDecimal> stZvalMap = stZqrlBList.stream().collect(Collectors.toMap(StZqrlB::getZ, StZqrlB::getQ));
|
||||
List<BigDecimal> list = stZqrlBList.stream().map(StZqrlB::getZ).collect(Collectors.toList());
|
||||
resultVo.setRealCkQValue(DataHandleUtil.calcData(realSwHValue, stZvalMap, list));// 真实出库流量
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultList;
|
||||
resultVo.setDrp(floodAlgorithemVo.getDrp());
|
||||
resultVo.setR(floodAlgorithemVo.getR());
|
||||
resultVo.setFlLowLimLev(attResBase.getFlLowLimLev());
|
||||
voList.add(resultVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return voList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -401,4 +340,65 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
|
|||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description: 将两个时间按照早八点分割成多段
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return: java.util.List<java.util.Date[]>
|
||||
* @auther: cxw
|
||||
*/
|
||||
public static List<Date[]> splitByDay8To8(Date startDate, Date endDate) {
|
||||
List<Date[]> periods = new ArrayList<>();
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(startDate);
|
||||
|
||||
// 第一个时间段特殊处理:从startDate到第二天的8点(如果startDate晚于当天8点)
|
||||
// 或者如果startDate在当天8点之前,则直接包含在当前天的8点到下一个8点周期内
|
||||
if (cal.get(Calendar.HOUR_OF_DAY) >= 8) {
|
||||
// startDate晚于或等于当天8点,但我们需要到第二天的8点作为结束
|
||||
cal.add(Calendar.DAY_OF_MONTH, 1); // 跳到下一天
|
||||
cal.set(Calendar.HOUR_OF_DAY, 8);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
Date endOfDay = cal.getTime();
|
||||
periods.add(new Date[]{startDate, endOfDay});
|
||||
cal.setTime(endOfDay); // 准备下一个时间段的开始
|
||||
}
|
||||
|
||||
// 循环生成剩余的时间段
|
||||
while (!cal.getTime().after(endDate)) {
|
||||
Date currentStart = cal.getTime();
|
||||
if (cal.get(Calendar.HOUR_OF_DAY) >= 8) {
|
||||
cal.add(Calendar.DAY_OF_MONTH, 1); // 移到下一天
|
||||
}
|
||||
cal.set(Calendar.HOUR_OF_DAY, 8);
|
||||
cal.set(Calendar.MINUTE, 0);
|
||||
cal.set(Calendar.SECOND, 0);
|
||||
cal.set(Calendar.MILLISECOND, 0);
|
||||
Date currentEnd = cal.getTime();
|
||||
// 如果currentEnd超出了endDate,则调整currentEnd为endDate
|
||||
if (currentEnd.after(endDate)) {
|
||||
currentEnd = endDate;
|
||||
}
|
||||
periods.add(new Date[]{currentStart, currentEnd});
|
||||
// 准备下一个时间段的开始(但在这个循环中它不会被使用,因为循环会终止)
|
||||
}
|
||||
return periods;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断date是否在早八点后还是前(true:在8:00前)
|
||||
*/
|
||||
public static boolean isBeforeEightAM(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 8);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return date.before(calendar.getTime());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,23 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.gunshi.project.xyt.mapper.ForecastPlanMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastPlan;
|
||||
import com.gunshi.project.xyt.mapper.ForecastTaskMapper;
|
||||
import com.gunshi.project.xyt.model.ForecastTask;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 描述: 预测方案管理表
|
||||
* 描述: 预报_预测自动任务管理表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
* date: 2024-08-05 11:41:45
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ForecastPlanService extends ServiceImpl<ForecastPlanMapper, ForecastPlan>
|
||||
public class ForecastTaskService extends ServiceImpl<ForecastTaskMapper, ForecastTask>
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 描述: 时段单位线表
|
||||
* 描述: 预报_时段单位线表
|
||||
* author: cxw
|
||||
* date: 2024-07-30 10:02:24
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.gunshi.project.xyt.service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
|
@ -25,6 +26,10 @@ public class StPptnRService extends ServiceImpl<StPptnRMapper, StPptnR>
|
|||
public List<StPptnR> getStcdLastPptnData() {
|
||||
return baseMapper.getStcdLastPptnData();
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getPptnRDataList(String stcd, String tm) {
|
||||
return baseMapper.getPptnRDataList(stcd, tm);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,128 @@
|
|||
package com.gunshi.project.xyt.timetask;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.gunshi.algorithm.RunoffService;
|
||||
import com.gunshi.project.xyt.model.ForecastK;
|
||||
import com.gunshi.project.xyt.model.ForecastPa;
|
||||
import com.gunshi.project.xyt.model.ForecastUseparam;
|
||||
import com.gunshi.project.xyt.service.ForecastKService;
|
||||
import com.gunshi.project.xyt.service.ForecastPaService;
|
||||
import com.gunshi.project.xyt.service.ForecastUseparamService;
|
||||
import com.gunshi.project.xyt.service.StPptnRService;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author cxw
|
||||
* @description Pa降雨值定时任务计算
|
||||
* @classname PaDataTask.java
|
||||
* @create 2024-08-02, 星期五, 11:16:46
|
||||
*/
|
||||
@EnableScheduling//开启定时任务
|
||||
@Component
|
||||
@Slf4j
|
||||
@Profile("prod")
|
||||
public class PaDataTask {
|
||||
|
||||
private static SimpleDateFormat sdfDay = new SimpleDateFormat("yyyy-MM-dd");
|
||||
|
||||
@Autowired
|
||||
private ForecastUseparamService forecastUseparamService;
|
||||
|
||||
@Autowired
|
||||
private ForecastPaService forecastPaService;
|
||||
|
||||
@Autowired
|
||||
private ForecastKService forecastKService;
|
||||
|
||||
@Autowired
|
||||
private StPptnRService stPptnRService;
|
||||
|
||||
/**
|
||||
* @description: 每天8点30计算的Pa
|
||||
* @param
|
||||
* @return: void
|
||||
* @auther: cxw
|
||||
* @date: 2024-08-02, 周五, 11:21:00
|
||||
*/
|
||||
@Async
|
||||
@Scheduled(cron ="0 30 8 * * ?")
|
||||
// @PostConstruct
|
||||
public void PaDataCalc() throws ParseException {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(new Date());
|
||||
Date nowTime = calendar.getTime();
|
||||
// 获取配置参数
|
||||
List<ForecastUseparam> paramList = forecastUseparamService.list();
|
||||
List<ForecastK> kList = forecastKService.list();
|
||||
// 获取最新pa
|
||||
ForecastPa forecastPaLast = forecastPaService.getOne(new QueryWrapper<ForecastPa>().orderBy(true, false, "tm").last("limit 1"));
|
||||
if (CollectionUtils.isNotEmpty(paramList) && CollectionUtils.isNotEmpty(kList) && ObjectUtils.isNotEmpty(forecastPaLast) && !forecastPaLast.getTm().equals(sdfDay.format(nowTime))) {
|
||||
String lastTm = forecastPaLast.getTm();
|
||||
// 获取空缺时间的所有降雨,当天8点到第二天8点间的drp和
|
||||
List<Map<String, Object>> mapList = stPptnRService.getPptnRDataList("716153201", lastTm);
|
||||
Map<String, Object> pptnrMap;
|
||||
if (CollectionUtils.isNotEmpty(mapList)) {
|
||||
pptnrMap = mapList.stream().collect(Collectors.toMap(map -> (String) map.get("tm"), map -> map.get("drp")));
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
Map<Integer, BigDecimal> kMap = kList.stream().collect(Collectors.toMap(ForecastK::getMonth, ForecastK::getKValue));
|
||||
Map<String, String> paramMap = paramList.stream().collect(Collectors.toMap(ForecastUseparam::getParamCode, ForecastUseparam::getParamValue));
|
||||
double Im = Double.parseDouble(paramMap.get("Im"));// 土壤含水量最大值(最大初损值)Im
|
||||
// 第一次的pa0是最新一条的pa
|
||||
List<ForecastPa> list = new ArrayList<>();
|
||||
ForecastPa forecastPa = null;
|
||||
int i = 0;
|
||||
while (!lastTm.equals(sdfDay.format(nowTime))){
|
||||
double lastPa0 = forecastPaLast.getPa().doubleValue();
|
||||
double lastPt0;
|
||||
// 第一次使用最新一条的降雨
|
||||
if(i == 0){
|
||||
lastPt0 = forecastPaLast.getPt0().doubleValue();
|
||||
i ++;
|
||||
} else {
|
||||
lastPt0 = Double.valueOf(ObjectUtils.isEmpty(pptnrMap.get(lastTm)) ? "0.0" : pptnrMap.get(lastTm).toString());
|
||||
}
|
||||
forecastPa = new ForecastPa();
|
||||
// 最新加1天
|
||||
calendar.setTime(sdfDay.parse(lastTm));
|
||||
calendar.add(Calendar.DAY_OF_MONTH, 1);
|
||||
lastTm = sdfDay.format(calendar.getTime());
|
||||
double k = kMap.get(Integer.valueOf(lastTm.substring(5, 7))).doubleValue();
|
||||
double pa = RunoffService.PaCaculate(k, lastPa0, lastPt0, Im);
|
||||
forecastPa.setStcd("716153201");
|
||||
forecastPa.setTm(lastTm);
|
||||
forecastPa.setK(new BigDecimal(k).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
forecastPa.setPa0(new BigDecimal(lastPa0));
|
||||
forecastPa.setIm(new BigDecimal(Im));
|
||||
forecastPa.setPt0(new BigDecimal(lastPt0).setScale(2, BigDecimal.ROUND_HALF_UP));
|
||||
forecastPa.setPa(new BigDecimal(pa));
|
||||
list.add(forecastPa);
|
||||
forecastPaLast = forecastPa;
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(list)){
|
||||
forecastPaService.saveBatch(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gunshi.project.xyt.mapper.ForecastHVMapper">
|
||||
<mapper namespace="com.gunshi.project.xyt.mapper.ForecastPaMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gunshi.project.xyt.mapper.ForecastHQMapper">
|
||||
<mapper namespace="com.gunshi.project.xyt.mapper.ForecastProjectMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.gunshi.project.xyt.mapper.ForecastPlanMapper">
|
||||
<mapper namespace="com.gunshi.project.xyt.mapper.ForecastTaskMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -11,4 +11,24 @@
|
|||
WHERE subquery.rn = 1) r ON stb.stcd = r.stcd
|
||||
WHERE stb.source = 'SK'
|
||||
</select>
|
||||
|
||||
<select id="getPptnRDataList" resultType="java.util.Map">
|
||||
SELECT
|
||||
to_char( tm_start, 'YYYY-MM-DD' ) tm,
|
||||
drp
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
date_trunc( 'day', tm :: TIMESTAMP - INTERVAL '9 hours' ) + INTERVAL '9 hours' AS tm_start,
|
||||
SUM ( drp ) AS drp
|
||||
FROM
|
||||
st_pptn_r
|
||||
WHERE
|
||||
stcd = #{stcd} AND tm >= #{tm}
|
||||
GROUP BY
|
||||
date_trunc( 'day', tm :: TIMESTAMP - INTERVAL '9 hours' ) + INTERVAL '9 hours'
|
||||
ORDER BY
|
||||
tm_start ASC
|
||||
) t
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue