136 lines
3.8 KiB
Java
136 lines
3.8 KiB
Java
package com.gunshi.project.xyt.service;
|
|
|
|
import com.gunshi.project.xyt.entity.vo.ReservoirLevelVo;
|
|
import com.gunshi.project.xyt.mapper.StResStcdRefMapper;
|
|
import com.gunshi.project.xyt.model.StResB;
|
|
import com.gunshi.project.xyt.model.StResBAutoDao;
|
|
import jakarta.annotation.Resource;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* TODO
|
|
*
|
|
* @ClassName ReservoirLevelService
|
|
* @Author Huang Qianxiang
|
|
* @Date 2024/2/1 15:37
|
|
*/
|
|
@Service
|
|
@Slf4j
|
|
public class ReservoirLevelService {
|
|
|
|
@Resource
|
|
private StResBAutoDao stResBAutoDao;
|
|
@Resource
|
|
private StResStcdRefMapper stResStcdRefMapper;
|
|
|
|
/**
|
|
* 根据水库ID查询校核洪水位
|
|
* @param resId 水库ID
|
|
* @return 校核洪水位
|
|
*/
|
|
public BigDecimal queryChfllvByResId(String resId){
|
|
StResB stResB = stResBAutoDao.getById(resId);
|
|
if (stResB == null){
|
|
throw new IllegalArgumentException("该水库ID不存在");
|
|
}
|
|
return stResB.getChfllv();
|
|
}
|
|
|
|
/**
|
|
* 根据水库ID查询汛限水位
|
|
* @param resId 水库ID
|
|
* @return 汛限水位
|
|
*/
|
|
public BigDecimal queryFlLowLimLevByResId(String resId){
|
|
StResB stResB = stResBAutoDao.getById(resId);
|
|
if (stResB == null){
|
|
throw new IllegalArgumentException("该水库ID不存在");
|
|
}
|
|
return stResB.getFlLowLimLev();
|
|
}
|
|
|
|
/**
|
|
* 根据水库ID查询总库容
|
|
* @param resId 水库ID
|
|
* @return 总库容
|
|
*/
|
|
public BigDecimal queryTotCapByResId(String resId){
|
|
StResB stResB = stResBAutoDao.getById(resId);
|
|
if (stResB == null){
|
|
throw new IllegalArgumentException("该水库ID不存在");
|
|
}
|
|
return stResB.getTotCap();
|
|
}
|
|
|
|
/**
|
|
* 根据水库ID查询死水位
|
|
* @param resId 水库ID
|
|
* @return 死水位
|
|
*/
|
|
public BigDecimal queryDeadLevByResId(String resId){
|
|
StResB stResB = stResBAutoDao.getById(resId);
|
|
if (stResB == null){
|
|
throw new IllegalArgumentException("该水库ID不存在");
|
|
}
|
|
return stResB.getDeadLev();
|
|
}
|
|
|
|
/**
|
|
* 根据水库ID查询实时水位
|
|
* @param resId 水库ID
|
|
* @return 实时水位
|
|
*/
|
|
public BigDecimal queryRzByResId(String resId){
|
|
StResB stResB = stResBAutoDao.getById(resId);
|
|
if (stResB == null){
|
|
throw new IllegalArgumentException("该水库ID不存在");
|
|
}
|
|
return stResStcdRefMapper.queryRzByResId(resId);
|
|
}
|
|
|
|
/**
|
|
* 根据水库ID查询七日内每小时平均水库水位
|
|
* @param resId 水库ID
|
|
* @return
|
|
*/
|
|
public List<ReservoirLevelVo> queryRzSevenDayByResId(String resId){
|
|
StResB stResB = stResBAutoDao.getById(resId);
|
|
if (stResB == null){
|
|
throw new IllegalArgumentException("该水库ID不存在");
|
|
}
|
|
return stResStcdRefMapper.queryRzSevenDayByResId(resId);
|
|
}
|
|
|
|
/**
|
|
* 根据水库ID查询一个月内每天八点水库水位
|
|
* @param resId 水库ID
|
|
* @return
|
|
*/
|
|
public List<ReservoirLevelVo> queryRzMonthByResId(String resId){
|
|
StResB stResB = stResBAutoDao.getById(resId);
|
|
if (stResB == null){
|
|
throw new IllegalArgumentException("该水库ID不存在");
|
|
}
|
|
return stResStcdRefMapper.queryRzMonthByResId(resId);
|
|
}
|
|
|
|
|
|
/**
|
|
* 根据水库ID查询半年每天八点水库水位
|
|
* @param resId 水库ID
|
|
* @return
|
|
*/
|
|
public List<ReservoirLevelVo> queryRzHalfYearByResId(String resId){
|
|
StResB stResB = stResBAutoDao.getById(resId);
|
|
if (stResB == null){
|
|
throw new IllegalArgumentException("该水库ID不存在");
|
|
}
|
|
return stResStcdRefMapper.queryRzHalfYearByResId(resId);
|
|
}
|
|
|
|
}
|