|  |  |  | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoIr.IrPlanSchedule; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoIrrigateSchedule; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoPlanSimple; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voIr.VoPlans; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IrGroupIntakeMapper irGroupIntakeMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IrIntakeOperateMapper irIntakeOperateMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 添加灌溉计划 | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | 
|---|
|  |  |  | public Long addIrrigatePlan(IrIrrigatePlan po) { | 
|---|
|  |  |  | irrigatePlanMapper.insert(po); | 
|---|
|  |  |  | return po.getId(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据计划ID获取待终止计划的结束时间:未删除、未终止、已发布、当前时间小于计划结束时间 | 
|---|
|  |  |  | * @param planId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Date getToTerminatePlan(Long planId) { | 
|---|
|  |  |  | return irrigatePlanMapper.getToTerminatePlan(planId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据计划ID获取待终止的取水口ID(已发布开发命令,无论是否成功) | 
|---|
|  |  |  | * @param planId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Long> getToTerminateIntakeIds(Long planId) { | 
|---|
|  |  |  | return irIntakeOperateMapper.getToTerminateIntakeIds(planId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据计划ID获取待终止的命令ID | 
|---|
|  |  |  | * @param planId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<Long> getTerminateCommandIds(Long planId) { | 
|---|
|  |  |  | return irIntakeOperateMapper.getTerminateCommandIds(planId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 修改灌溉计划 | 
|---|
|  |  |  | * @param po | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Integer updatePlan(IrIrrigatePlan po) { | 
|---|
|  |  |  | return irrigatePlanMapper.updateByPrimaryKeySelective(po); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取未完成的计划列表,小程序计划列表页使用 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<VoPlans> getNotCompletePlans() { | 
|---|
|  |  |  | return irrigatePlanMapper.getNotCompletePlans(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 获取已完成的计划列表,小程序计划列表页使用 | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public List<VoPlans> getCompletedPlans() { | 
|---|
|  |  |  | return irrigatePlanMapper.getCompletedPlans(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据计划ID终止灌溉次序,将灌溉次序的当前状态改为已终止 | 
|---|
|  |  |  | * @param planId | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public Integer terminateSchedule(Long planId) { | 
|---|
|  |  |  | return irIrrigateScheduleMapper.terminateSchedule(planId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 根据计划ID获取灌溉次序记录 | 
|---|
|  |  |  | * @param planId | 
|---|
|  |  |  | * @return | 
|---|