| | |
| | | package com.dy.pipIrrRemote.mqttSd1.soil; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.util.NumUtil; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.voRm.VoSoil; |
| | | import com.dy.pipIrrGlobal.voRm.VoSoilDay; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @Autowired |
| | | public void setSv(SoilSv sv){ |
| | | this.sv = sv ; |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件查询某气象站某一日记录 |
| | | * @param soilId |
| | | * @param yyyy_MM_dd |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "oneDay") |
| | | @SsoAop() |
| | | public BaseResponse<VoSoilDay> oneDay(Long soilId, String yyyy_MM_dd){ |
| | | try { |
| | | if(soilId == null){ |
| | | return BaseResponseUtils.buildFail("墒情站id不能为空") ; |
| | | } |
| | | if(yyyy_MM_dd == null || yyyy_MM_dd.trim().equals("")){ |
| | | return BaseResponseUtils.buildFail("查询日期不能为空") ; |
| | | } |
| | | String ymdStr = yyyy_MM_dd.replaceAll("-", "") ; |
| | | if(!NumUtil.isPlusIntNumber(ymdStr)){ |
| | | return BaseResponseUtils.buildFail("查询日期格式不正确,格式规定为yyyy-MM-dd") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(sv.oneDay(soilId, Integer.parseInt(ymdStr))); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件查询某气象站某一日记录 |
| | | * @param soilId |
| | | * @param yyyy_MM |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "oneDayByMonth") |
| | | @SsoAop() |
| | | public BaseResponse<List<VoSoilDay>> oneDayByMonth(Long soilId, String yyyy_MM){ |
| | | try { |
| | | if(soilId == null){ |
| | | return BaseResponseUtils.buildFail("墒情站id不能为空") ; |
| | | } |
| | | if(yyyy_MM == null || yyyy_MM.trim().equals("")){ |
| | | return BaseResponseUtils.buildFail("查询月份不能为空") ; |
| | | } |
| | | String ymdStr = yyyy_MM.replaceAll("-", "") ; |
| | | if(!NumUtil.isPlusIntNumber(ymdStr)){ |
| | | return BaseResponseUtils.buildFail("查询日期格式不正确,格式规定为yyyy-MM-dd") ; |
| | | } |
| | | Integer ymStart = Integer.parseInt(ymdStr) * 100; |
| | | Integer ymEnd = Integer.parseInt(ymdStr) * 100 + 31; |
| | | return BaseResponseUtils.buildSuccess(sv.oneDayByMonth(soilId, ymStart, ymEnd)); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件查询某气象站一些日记录 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "oneSomeDay") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoSoilDay>>> oneSomeDay(SoilQo qo){ |
| | | try { |
| | | if(qo.soilId == null){ |
| | | return BaseResponseUtils.buildFail("墒情站id不能为空") ; |
| | | } |
| | | return BaseResponseUtils.buildSuccess(sv.someDay(qo)); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据指定条件查询一些气象站日记录 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "someDay") |
| | | @SsoAop() |
| | | public BaseResponse<QueryResultVo<List<VoSoilDay>>> someDay(SoilQo qo){ |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(sv.someDay(qo)); |
| | | } catch (Exception e) { |
| | | return BaseResponseUtils.buildException(e.getMessage()) ; |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据指定条件查询最新记录 |
| | | * @param qo |