liurunyu
2025-03-21 fb50c6c8111fffd16091ce25d5d389ea3fcc560f
pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/irrigatePlan/IrrigatePlanSv.java
@@ -1,16 +1,21 @@
package com.dy.pipIrrWechat.irrigatePlan;
import com.dy.pipIrrGlobal.daoIr.IrIrrigateGroupMapper;
import com.dy.pipIrrGlobal.daoIr.IrIrrigatePlanMapper;
import com.dy.pipIrrGlobal.daoIr.IrIrrigateScheduleMapper;
import com.dy.pipIrrGlobal.daoIr.IrIrrigateUnitMapper;
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoIr.*;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigatePlan;
import com.dy.pipIrrGlobal.pojoIr.IrIrrigateSchedule;
import com.dy.pipIrrGlobal.pojoIr.IrOpeningSchedule;
import com.dy.pipIrrGlobal.pojoIr.IrPlanOperate;
import com.dy.pipIrrGlobal.voIr.VoIrrigatePlan;
import com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule;
import com.dy.pipIrrWechat.irrigatePlan.qo.QoIrrigatePlan;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * @author ZhuBaoMin
@@ -26,7 +31,13 @@
    private IrIrrigatePlanMapper irrigatePlanMapper;
    @Autowired
    private IrPlanOperateMapper irPlanOperateMapper;
    @Autowired
    private IrIrrigateScheduleMapper irIrrigateScheduleMapper;
    @Autowired
    private IrOpeningScheduleMapper irOpeningScheduleMapper;
    @Autowired
    private IrIrrigateGroupMapper irIrrigateGroupMapper;
@@ -35,12 +46,68 @@
    private IrIrrigateUnitMapper irIrrigateUnitMapper;
    /**
     * 添加灌溉计划记录
     * 添加灌溉计划
     * @param po
     * @return
     */
    public Long addIrrigatePlan(IrIrrigatePlan po) {
        irrigatePlanMapper.insert(po);
        return po.getId();
    }
    /**
     * 根据指定的计划ID获取启动模式
     * @param planId
     * @return
     */
    public Byte getStartupMode(Long planId) {
        return irrigatePlanMapper.getStartupMode(planId);
    }
    /**
     * 根据指定的条件获取计划列表
     * @param queryVo
     * @return
     */
    public QueryResultVo<List<VoIrrigatePlan>> getIrrigatePlans(QoIrrigatePlan queryVo) {
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
        Long itemTotal = irrigatePlanMapper.getIrrigatePlanCount(params);
        QueryResultVo<List<VoIrrigatePlan>> rsVo = new QueryResultVo<>();
        rsVo.pageSize = queryVo.pageSize;
        rsVo.pageCurr = queryVo.pageCurr;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = irrigatePlanMapper.getIrrigatePlans(params);
        return rsVo;
    }
    /**
     * 根据指定的计划ID获取已发布的灌溉计划数量
     * @param planId
     * @return
     */
    public Integer getPublishedCount(Long planId) {
        return irrigatePlanMapper.getPublishedCount(planId);
    }
    /**
     * 发布指定的灌溉计划
     * @param planId
     * @return
     */
    public Integer publishIrrigatePlan(Long planId) {
        return irrigatePlanMapper.publishIrrigatePlan(planId);
    }
    /**
     * 添加灌溉计划操作记录
     * @param po
     * @return
     */
    public Long addPlanOperate(IrPlanOperate po) {
        irPlanOperateMapper.insert(po);
        return po.getId();
    }
@@ -55,6 +122,25 @@
    }
    /**
     * 根据计划ID获取灌溉次序
     * @param planId
     * @return
     */
    public List<VoIrrigateSchedule> getIrrigateSchedules(Byte startupMode, Long planId) {
        return irIrrigateScheduleMapper.getIrrigateSchedules(startupMode, planId);
    }
    /**
     * 添加开阀计划
     * @param po
     * @return
     */
    public Long addOpeningSchedule(IrOpeningSchedule po) {
        irOpeningScheduleMapper.insert(po);
        return po.getId();
    }
    /**
     * 根据轮灌组ID获取取水口ID列表
     * @param groupId
     * @return