zhubaomin
18 小时以前 cd7fd2ea35de966cfd1c6f3038e593097d7a6dec
pipIrr-platform/pipIrr-web/pipIrr-web-irrigate/src/main/java/com/dy/pipIrrIrrigate/irrigatePlan/IrrigatePlanCtrl.java
@@ -3,6 +3,10 @@
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
import com.dy.common.webUtil.QueryConditionVo;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.voIr.VoPlanDetails;
import com.dy.pipIrrGlobal.voIr.VoPlans;
import com.dy.pipIrrIrrigate.irrigatePlan.dto.IrrigatePlan;
import com.dy.pipIrrIrrigate.irrigatePlan.dto.PlanSimple;
import jakarta.validation.Valid;
@@ -10,11 +14,9 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -114,4 +116,97 @@
        }
        return BaseResponseUtils.buildSuccess() ;
    }
    /**
     * 获取未完成的计划列表,灌溉模块计划列表页使用
     * @return
     */
    @GetMapping(path = "/getNotCompletePlans")
    @SsoAop()
    public BaseResponse<List<VoPlans>> getNotCompletePlans() {
        try {
            List<VoPlans> res = irrigatePlanSv.getNotCompletePlans();
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("获取未完的计划异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 获取已完成的计划列表,灌溉模块计划列表页使用
     * @return
     */
    @GetMapping(path = "/getCompletedPlans")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoPlans>>> getCompletedPlans(QueryConditionVo qo) {
        try {
            return BaseResponseUtils.buildSuccess(irrigatePlanSv.getCompletedPlans(qo));
        } catch (Exception e) {
            log.error("获取项目记录异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 根据计划ID获取计划发布结果
     * @param planId
     * @return
     */
    @GetMapping(path = "/getPublishResults")
    @SsoAop()
    public BaseResponse<VoPlanDetails> getPublishResults(@RequestParam Long planId) {
        if(planId == null) {
            return BaseResponseUtils.buildErrorMsg("计划ID不能为空");
        }
        try {
            VoPlanDetails res = irrigatePlanSv.getPublishResults(planId);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("获取计划发布结果异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 根据计划ID获取计划终止操作结果
     * @param planId
     * @return
     */
    @GetMapping(path = "/getTerminateResults")
    @SsoAop()
    public BaseResponse<VoPlanDetails> getTerminateResults(@RequestParam Long planId) {
        if(planId == null) {
            return BaseResponseUtils.buildErrorMsg("计划ID不能为空");
        }
        try {
            VoPlanDetails res = irrigatePlanSv.getTerminateResults(planId);
            return BaseResponseUtils.buildSuccess(res);
        } catch (Exception e) {
            log.error("获取计划发布结果异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 根据计划ID获取计划最新状态
     * @param planId
     * @return
     */
    @GetMapping(path = "/getPlanLatestState")
    @SsoAop()
    public BaseResponse<Integer> getPlanLatestState(@RequestParam Long planId) {
        if(planId == null) {
            return BaseResponseUtils.buildErrorMsg("计划ID不能为空");
        }
        try {
            return BaseResponseUtils.buildSuccess(irrigatePlanSv.getPlanLatestState(planId));
        } catch (Exception e) {
            log.error("获取未完的计划异常", e);
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
}