zhubaomin
2025-02-21 f4d1e8f5e01e12a90050d94e50571b9cb1ebe109
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
package com.dy.pipIrrWechat.irrigation;
 
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.voIr.VoGroupSimple;
import com.dy.pipIrrGlobal.voIr.VoUnitSimple;
import com.dy.pipIrrWechat.irrigation.qo.QoClient;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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 ZhuBaoMin
 * @date 2025-02-20 8:59
 * @LastEditTime 2025-02-20 8:59
 * @Description
 */
 
@Slf4j
@RestController
@RequestMapping(path = "irrigation")
@RequiredArgsConstructor
public class IrrigationCtrl {
    private final IrrigationSv irrigationSv;
 
    /**
     * 根据农户编号获取轮灌组列表
     * @param vo
     * @return
     */
    @GetMapping(path = "/getGroups")
    public BaseResponse<QueryResultVo<List<VoGroupSimple>>> getGroups(QoClient vo) {
        try {
            QueryResultVo<List<VoGroupSimple>> res = irrigationSv.getGroupsByClientId(vo);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("获取轮灌组记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
 
    /**
     * 根据农户编号获取灌溉单元列表
     * @param vo
     * @return
     */
    @GetMapping(path = "/getUnits")
    public BaseResponse<QueryResultVo<List<VoUnitSimple>>> getUnits(QoClient vo) {
        try {
            QueryResultVo<List<VoUnitSimple>> res = irrigationSv.getUnitsByClientId(vo);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("获取灌溉单元记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
}