zhubaomin
2025-04-14 b3b17b231e2f2840332ce6eb96f791865fdec6d5
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigation/IrrigationCtrl.java
@@ -4,8 +4,9 @@
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 com.dy.pipIrrGlobal.voIr.VoProjectSimple;
import com.dy.pipIrrWechat.irrigation.qo.QoGroup;
import com.dy.pipIrrWechat.irrigation.qo.QoProject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
@@ -28,34 +29,33 @@
public class IrrigationCtrl {
    private final IrrigationSv irrigationSv;
    /**
     * 根据农户编号获取轮灌组列表
     * @param vo
     * 根据农户编号获取灌溉单元列表
     * @param qo
     * @return
     */
    @GetMapping(path = "/getGroups")
    public BaseResponse<QueryResultVo<List<VoGroupSimple>>> getGroups(QoClient vo) {
    @GetMapping(path = "/getSimpleProjects")
    public BaseResponse<List<VoProjectSimple>> getSimpleProjects(QoProject qo) {
        try {
            QueryResultVo<List<VoGroupSimple>> res = irrigationSv.getGroupsByClientId(vo);
            return BaseResponseUtils.buildSuccess(res);
            return BaseResponseUtils.buildSuccess(irrigationSv.getSimpleProjects(qo));
        } catch (Exception e) {
            log.error("获取轮灌组记录异常", e);
            log.error("获取项目记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 根据农户编号获取灌溉单元列表
     * @param vo
     * @return
     */
    @GetMapping(path = "/getUnits")
    public BaseResponse<QueryResultVo<List<VoUnitSimple>>> getUnits(QoClient vo) {
    @GetMapping(path = "/getSimpleGroups")
    public BaseResponse<QueryResultVo<List<VoGroupSimple>>> getSimpleGroups(QoGroup qo) {
        if(qo.getProjectId() == null) {
            return BaseResponseUtils.buildErrorMsg("请选择项目");
        }
        try {
            QueryResultVo<List<VoUnitSimple>> res = irrigationSv.getUnitsByClientId(vo);
            QueryResultVo<List<VoGroupSimple>> res = irrigationSv.getSimpleGroups(qo);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("获取灌溉单元记录异常", e);
            log.error("获取轮灌组记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }