liurunyu
5 天以前 aa36d81e83b27c52d126af07a186bf8a9cc9a4f6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
/**
 * @Author: liurunyu
 * @Date: 2025/6/26 09:31
 * @Description
 */
@Slf4j
@Tag(name = "墒情数据查询", description = "墒情数据查询")
@RestController("rmSoilCtrl")
@RequestMapping(path = "soil")
@RequiredArgsConstructor
public class SoilCtrl {
 
    private SoilSv sv;
 
    @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 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 soilId
     * @return
     */
    @GetMapping(path = "oneLast")
    @SsoAop()
    public BaseResponse<VoSoil> oneLast(Long soilId){
        try {
            return BaseResponseUtils.buildSuccess(sv.oneLast(soilId));
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
 
    /**
     * 根据指定条件查询历史记录
     * @param soilId
     * @return
     */
    @GetMapping(path = "oneHistory")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoSoil>>> oneHistory(Long soilId){
        try {
 
            return BaseResponseUtils.buildSuccess(sv.oneHistory(soilId));
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
 
 
    /**
     * 根据指定条件查询最新记录
     * @param qo
     * @return
     */
    @GetMapping(path = "someLast")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoSoil>>> someLast(SoilQo qo){
        try {
            return BaseResponseUtils.buildSuccess(sv.someLast(qo));
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
 
    /**
     * 根据指定条件查询历史记录
     * @param qo
     * @return
     */
    @GetMapping(path = "someHistory")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoSoil>>> someHistory(SoilQo qo){
        try {
            return BaseResponseUtils.buildSuccess(sv.someHistory(qo));
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
}