pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
@@ -2,10 +2,13 @@
import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoRm.RmOnHourReportHistoryMapper;
import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper;
import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow;
import com.dy.pipIrrGlobal.voSt.VoIntake;
import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount;
import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO;
import com.dy.pipIrrStatistics.intake.qo.IntakeQO;
import com.dy.pipIrrStatistics.intake.qo.IntakeValueQO;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.common.utils.PojoUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,6 +32,8 @@
public class IntakeSv {
    @Autowired
    private RmOnHourReportHistoryMapper rmOnHourReportHistoryMapper;
    @Autowired
    private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper;
    /**
     * 获取指定时间段内未上线的取水口
@@ -112,4 +117,117 @@
        rsVo.obj = rmOnHourReportHistoryMapper.getSmallFlowIntakes(params);
        return rsVo ;
    }
    /**
     * 获取从未开过阀的取水口
     * @return
     */
    public QueryResultVo<List<VoIntake>> getNeverOpenValveIntakes(IntakeQO qo) {
        String timeStart = qo.getTimeStart();
        String timeStop = qo.getTimeStop();
        if(timeStart != null) {
            timeStart = timeStart + " 00:00:00";
        }else {
            timeStart = LocalDate.now() + " 00:00:00";
        }
        qo.setTimeStart(timeStart);
        if(timeStop != null) {
            timeStop = timeStop + " 23:59:59";
        }else {
            timeStop = LocalDate.now() + " 23:59:59";
        }
        qo.setTimeStop(timeStop);
        // 生成查询参数
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
        // 获取符合条件的记录数
        Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getNeverOpenValveIntakesCount(params)).orElse(0L);
        QueryResultVo<List<VoIntake>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = qo.pageSize ;
        rsVo.pageCurr = qo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = rmOpenCloseValveHistoryMapper.getNeverOpenValveIntakes(params);
        return rsVo ;
    }
    /**
     * 获取指定时间段内开阀次数超过指定值的取水口
     * @param qo
     * @return
     */
    public QueryResultVo<List<VoIntakeOpenCount>> getOpenValveGtIntakes(IntakeValueQO qo) {
        String timeStart = qo.getTimeStart();
        String timeStop = qo.getTimeStop();
        if(timeStart != null) {
            timeStart = timeStart + " 00:00:00";
        }else {
            timeStart = LocalDate.now() + " 00:00:00";
        }
        qo.setTimeStart(timeStart);
        if(timeStop != null) {
            timeStop = timeStop + " 23:59:59";
        }else {
            timeStop = LocalDate.now() + " 23:59:59";
        }
        qo.setTimeStop(timeStop);
        // 生成查询参数
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
        // 获取符合条件的记录数
        Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getOpenValveGtIntakesCount(params)).orElse(0L);
        QueryResultVo<List<VoIntakeOpenCount>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = qo.pageSize ;
        rsVo.pageCurr = qo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = rmOpenCloseValveHistoryMapper.getOpenValveGtIntakes(params);
        return rsVo ;
    }
    /**
     * 获取指定时间段内开阀次数低于指定值的取水口
     * @param qo
     * @return
     */
    public QueryResultVo<List<VoIntakeOpenCount>> getOpenValveLtIntakes(IntakeValueQO qo) {
        String timeStart = qo.getTimeStart();
        String timeStop = qo.getTimeStop();
        if(timeStart != null) {
            timeStart = timeStart + " 00:00:00";
        }else {
            timeStart = LocalDate.now() + " 00:00:00";
        }
        qo.setTimeStart(timeStart);
        if(timeStop != null) {
            timeStop = timeStop + " 23:59:59";
        }else {
            timeStop = LocalDate.now() + " 23:59:59";
        }
        qo.setTimeStop(timeStop);
        // 生成查询参数
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
        // 获取符合条件的记录数
        Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getOpenValveLtIntakesCount(params)).orElse(0L);
        QueryResultVo<List<VoIntakeOpenCount>> rsVo = new QueryResultVo<>() ;
        rsVo.pageSize = qo.pageSize ;
        rsVo.pageCurr = qo.pageCurr ;
        rsVo.calculateAndSet(itemTotal, params);
        rsVo.obj = rmOpenCloseValveHistoryMapper.getOpenValveLtIntakes(params);
        return rsVo ;
    }
}