| | |
| | | package com.dy.pipIrrWechat.irrigatePlan; |
| | | |
| | | 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.pojoIr.IrPlanSchedule; |
| | | import com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule; |
| | | import com.dy.pipIrrWechat.irrigatePlan.qo.QoIrrigatePlan; |
| | | import com.dy.pipIrrGlobal.voIr.VoPlanSimple; |
| | | 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.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | @Autowired |
| | | private IrIrrigateUnitMapper irIrrigateUnitMapper; |
| | | |
| | | @Autowired |
| | | private IrPlanScheduleMapper irPlanScheduleMapper; |
| | | |
| | | @Autowired |
| | | private IrGroupIntakeMapper irGroupIntakeMapper; |
| | | |
| | | /** |
| | | * 添加灌溉计划 |
| | | * @param po |
| | |
| | | * @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); |
| | | } |
| | | //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获取灌溉次序 |
| | | * 根据计划ID获取灌溉次序记录 |
| | | * @param planId |
| | | * @return |
| | | */ |
| | | public List<VoIrrigateSchedule> getIrrigateSchedules(Byte startupMode, Long planId) { |
| | | return irIrrigateScheduleMapper.getIrrigateSchedules(startupMode, planId); |
| | | public List<VoIrrigateSchedule> getSchedulesByPlanId(Long planId) { |
| | | return irIrrigateScheduleMapper.getSchedulesByPlanId(planId); |
| | | } |
| | | |
| | | /** |
| | | * 添加开阀计划 |
| | | * 根据组ID获取取水口ID集合 |
| | | * @param groupId |
| | | * @return |
| | | */ |
| | | public List<Long> getIntakeIdsByGroupId(Long groupId) { |
| | | return irGroupIntakeMapper.getIntakeIdsByGroupId(groupId); |
| | | } |
| | | |
| | | /** |
| | | * 添加计划次序关联记录 |
| | | * @param po |
| | | * @return |
| | | */ |
| | | public Long addOpeningSchedule(IrOpeningSchedule po) { |
| | | irOpeningScheduleMapper.insert(po); |
| | | public Long addPlanSchedule(IrPlanSchedule po) { |
| | | irPlanScheduleMapper.insert(po); |
| | | return po.getId(); |
| | | } |
| | | |
| | | /** |
| | | * 根据轮灌组ID获取取水口ID列表 |
| | | * @param groupId |
| | | * 根据计划ID获取计划简单信息列表 |
| | | * @param planId |
| | | * @return |
| | | */ |
| | | public List<Long> getIntakesByGroupId(Long groupId) { |
| | | return irIrrigateGroupMapper.getIntakesByGroupId(groupId); |
| | | public VoPlanSimple getPlanSimple(Long planId) { |
| | | return irrigatePlanMapper.getPlanSimple(planId); |
| | | } |
| | | |
| | | /** |
| | | * 根据计划ID更新计划信息(起止时间、计划状态) |
| | | * @param planStartTime |
| | | * @param planEndTime |
| | | * @param planId |
| | | * @return |
| | | */ |
| | | public Integer updatePlanTimes(Date planStartTime, Date planEndTime, Long planId) { |
| | | return irrigatePlanMapper.updatePlanTimes(planStartTime, planEndTime, planId); |
| | | } |
| | | |
| | | /** |
| | | * 根据灌溉次序ID更新次序开始时间 |
| | | * @param scheduleId |
| | | * @param startTime |
| | | * @return |
| | | */ |
| | | public Integer updateScheduleStartTime(Long scheduleId, Date startTime) { |
| | | return irIrrigateScheduleMapper.updateScheduleStartTime(scheduleId, startTime); |
| | | } |
| | | |
| | | ///** |
| | | // * 添加开阀计划 |
| | | // * @param po |
| | | // * @return |
| | | // */ |
| | | //public Long addOpeningSchedule(IrOpeningSchedule po) { |
| | | // irOpeningScheduleMapper.insert(po); |
| | | // return po.getId(); |
| | | //} |
| | | |
| | | /** |
| | | * 根据灌溉单元ID获取取水口ID |
| | | * @param unitId |
| | | * @return |