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
package com.dy.pipIrrRemote.mqttSd1.weather;
 
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.voRm.VoWeather;
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:33
 * @Description
 */
@Slf4j
@Tag(name = "气象数据查询", description = "气象数据查询")
@RestController("rmWeatherCtrl")
@RequestMapping(path = "weather")
@RequiredArgsConstructor
public class WeatherCtrl {
 
    private WeatherSv sv;
 
    @Autowired
    public void setSv(WeatherSv sv){
        this.sv = sv ;
    }
 
    /**
     * 根据指定条件查询最新记录
     * @param weatherId
     * @return
     */
    @GetMapping(path = "oneLast")
    @SsoAop()
    public BaseResponse<VoWeather> oneLast(Long weatherId){
        try {
            if(weatherId == null){
                return BaseResponseUtils.buildFail("气象站id不能为空") ;
            }
            return BaseResponseUtils.buildSuccess(sv.oneLast(weatherId));
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
 
    /**
     * 根据指定条件查询历史记录
     * @param weatherId
     * @return
     */
    @GetMapping(path = "oneHistory")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoWeather>>> oneHistory(Long weatherId){
        try {
            if(weatherId == null){
                return BaseResponseUtils.buildFail("气象站id不能为空") ;
            }
           return BaseResponseUtils.buildSuccess(sv.oneHistory(weatherId));
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
 
    /**
     * 根据指定条件查询最新记录
     * @param qo
     * @return
     */
    @GetMapping(path = "someLast")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoWeather>>> someLast(WeatherQo 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<VoWeather>>> someHistory(WeatherQo qo){
        try {
            return BaseResponseUtils.buildSuccess(sv.someHistory(qo));
        } catch (Exception e) {
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
}