wuzeyu
2024-08-28 685f5f2f1855d27bf8ee6304da184ef2e2d2907a
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
@@ -11,6 +11,8 @@
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.Calendar;
import java.util.List;
@@ -62,13 +64,16 @@
         */
        String timeStart = qo.getTimeStart();
        String timeStop = qo.getTimeStop();
        if(timeStart != null) {
            timeStart = timeStart + " 00:00:00";
        }else {
            timeStart = LocalDate.now() + " 00:00:00";
        }
        if(timeStop != null) {
            timeStop = timeStop + " 23:59:59";
            if(timeStart != null) {
                timeStart = timeStart + " 00:00:00";
            }else {
                timeStart = LocalDate.now() + " 00:00:00";
            }
        }else {
            timeStart = null;
        }
        qo.setTimeStart(timeStart);
        qo.setTimeStop(timeStop);
@@ -304,39 +309,47 @@
     */
    public VoCountOfOpenType getCountByOpenType(OpenTypeQO qo) {
        /**
         * 补齐起止时间,如果开始时间为空,则默认为当前日期
         * 补齐起止时间,如果开始时间为空,则默认为当前日期,如果结束时间为空,则查询时间为空
         */
        String timeStart = qo.getTimeStart();
        String timeStop = qo.getTimeStop();
        if(timeStart != null) {
            timeStart = timeStart + " 00:00:00";
        }else {
            timeStart = LocalDate.now() + " 00:00:00";
        }
        if(timeStop != null) {
            timeStop = timeStop + " 23:59:59";
            if(timeStart != null) {
                timeStart = timeStart + " 00:00:00";
            }else {
                timeStart = LocalDate.now() + " 00:00:00";
            }
        }else {
            timeStart = null;
        }
        qo.setTimeStart(timeStart);
        qo.setTimeStop(timeStop);
        Integer openType = qo.getOpenType();
        String openTypeName = "";
        switch (openType) {
            case 1:
                openTypeName = "刷卡开阀";
                break;
            case 3:
                openTypeName = "中心站开阀";
                break;
            case 8:
                openTypeName = "用户远程开阀";
                break;
            case 11:
                openTypeName = "开关阀卡开阀";
                break;
            case 13:
                openTypeName = "开关阀卡开阀";
                break;
        if (openType == null){
            openTypeName = "未知";
        }else {
            switch (openType) {
                case 1:
                    openTypeName = "刷卡开阀";
                    break;
                case 3:
                    openTypeName = "中心站开阀";
                    break;
                case 8:
                    openTypeName = "用户远程开阀";
                    break;
                case 11:
                    openTypeName = "开关阀卡开阀";
                    break;
                case 13:
                    openTypeName = "开关阀卡开阀";
                    break;
                default:
                    openTypeName = "未知";
            }
        }
        // 生成查询参数
@@ -456,7 +469,6 @@
        return rsVo ;
    }
    /**
     * 指定时间段内用水量超过指定值的取水口
     * @param qo
@@ -483,7 +495,6 @@
            qo.setValue(0.0);
        }
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo);
        Long itemTotal = rmOpenCloseValveHistoryMapper.getUseWaterGtValueIntakesCount(params);
@@ -495,8 +506,6 @@
        rsVo.obj = rmOpenCloseValveHistoryMapper.getUseWaterGtValueIntakes(params);
        return rsVo ;
    }
    /**
     * 指定时间段内消费金额超过指定值的取水口
@@ -535,7 +544,6 @@
        rsVo.obj = rmOpenCloseValveHistoryMapper.getExpenseGtValueIntakes(params);
        return rsVo ;
    }
    /**
     * 指定时间段内用水时长超过指定值的取水口
@@ -647,10 +655,14 @@
     * @param qo
     * @return
     */
    public QueryResultVo<List<VoDayIntakeAmount>> getDayIntakeAmount(IntakeAmountQO qo) {
        Calendar calendar = Calendar.getInstance();
        Integer year = Optional.ofNullable(qo.getYear()).orElse(calendar.get(Calendar.YEAR));
        Integer month = Optional.ofNullable(qo.getMonth()).orElse(calendar.get(Calendar.MONTH));
    public QueryResultVo<List<VoDayIntakeAmount>> getDayIntakeAmount(IntakeAmountQO qo) throws ParseException {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String yearMonth = qo.getYearMonth();
        yearMonth = yearMonth + "-01";
        yearMonth = dateFormat.format(dateFormat.parse(yearMonth));
        Integer year = Integer.parseInt(yearMonth.substring(0,4));
        Integer month = Integer.parseInt(yearMonth.substring(5,7));
        qo.setYear(year);
        qo.setMonth(month);
@@ -701,10 +713,13 @@
     * @param qo
     * @return
     */
    public QueryResultVo<List<VoDayLoss>> getDayLossAmount(IntakeAmountQO qo) {
        Calendar calendar = Calendar.getInstance();
        Integer year = Optional.ofNullable(qo.getYear()).orElse(calendar.get(Calendar.YEAR));
        Integer month = Optional.ofNullable(qo.getMonth()).orElse(calendar.get(Calendar.MONTH));
    public QueryResultVo<List<VoDayLoss>> getDayLossAmount(IntakeAmountQO qo) throws ParseException {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String yearMonth = qo.getYearMonth();
        yearMonth = yearMonth + "-01";
        yearMonth = dateFormat.format(dateFormat.parse(yearMonth));
        Integer year = Integer.parseInt(yearMonth.substring(0,4));
        Integer month = Integer.parseInt(yearMonth.substring(5,7));
        qo.setYear(year);
        qo.setMonth(month);