package com.gunshi.project.xyt.service; 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 org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; /** * TODO * * @ClassName ReservoirLevelService * @Author Huang Qianxiang * @Date 2024/2/1 15:37 */ @Service @Slf4j @Transactional(rollbackFor = Exception.class) 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); } }