zhubaomin
2024-08-12 628e79d294458459648235cd435bbf613b159dac
2024-08-12 朱宝民 代码优化(yearMonth参数类型)
7个文件已修改
88 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/ClientAmountQO.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeAmountQO.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/result/StatisticlResultCode.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java
@@ -17,6 +17,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -141,8 +143,17 @@
    @GetMapping(path = "/getDayAmountAndMoney")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoDayClient>>> getDayAmountAndMoney(ClientAmountQO qo) {
        if(qo.getYearMonth() == null) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String yearMonth = qo.getYearMonth();
        if(yearMonth == null) {
            return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.YEAR_AND_MONTH_CANNOT_BE_NULL.getMessage());
        }else {
            yearMonth = yearMonth + "-01";
            try {
                Date date = dateFormat.parse(yearMonth);
            } catch (Exception e) {
                return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.YEAR_OR_MONTH_IS_ERROR.getMessage());
            }
        }
        try {
@@ -172,7 +183,6 @@
        }
    }
    /**
     * 指定时间段内开物理卡农户
     *
@@ -190,8 +200,6 @@
            return BaseResponseUtils.buildException(e.getMessage());
        }
    }
    /**
     * 指定时间段内每个农户充值合计(物理卡)
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java
@@ -343,8 +343,9 @@
     * @return
     */
    public QueryResultVo<List<VoDayClient>> getDayAmountAndMoney(ClientAmountQO qo) {
        Integer year = qo.getYearMonth().getYear();
        Integer month = qo.getYearMonth().getMonthValue();
        String yearMonth = qo.getYearMonth();
        Integer year = Integer.parseInt(yearMonth.substring(0,4));
        Integer month = Integer.parseInt(yearMonth.substring(5,7));
        qo.setYear(year);
        qo.setMonth(month);
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
@@ -11,6 +11,7 @@
import org.springframework.stereotype.Service;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.time.LocalDate;
import java.util.Calendar;
import java.util.List;
@@ -456,7 +457,6 @@
        return rsVo ;
    }
    /**
     * 指定时间段内用水量超过指定值的取水口
     * @param qo
@@ -483,7 +483,6 @@
            qo.setValue(0.0);
        }
        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo);
        Long itemTotal = rmOpenCloseValveHistoryMapper.getUseWaterGtValueIntakesCount(params);
@@ -495,8 +494,6 @@
        rsVo.obj = rmOpenCloseValveHistoryMapper.getUseWaterGtValueIntakes(params);
        return rsVo ;
    }
    /**
     * 指定时间段内消费金额超过指定值的取水口
@@ -535,7 +532,6 @@
        rsVo.obj = rmOpenCloseValveHistoryMapper.getExpenseGtValueIntakes(params);
        return rsVo ;
    }
    /**
     * 指定时间段内用水时长超过指定值的取水口
@@ -647,9 +643,10 @@
     * @param qo
     * @return
     */
    public QueryResultVo<List<VoDayIntakeAmount>> getDayIntakeAmount(IntakeAmountQO qo) {
        Integer year = qo.getYearMonth().getYear();
        Integer month = qo.getYearMonth().getMonthValue();
    public QueryResultVo<List<VoDayIntakeAmount>> getDayIntakeAmount(IntakeAmountQO qo) throws ParseException {
        String yearMonth = qo.getYearMonth();
        Integer year = Integer.parseInt(yearMonth.substring(0,4));
        Integer month = Integer.parseInt(yearMonth.substring(5,7));
        qo.setYear(year);
        qo.setMonth(month);
@@ -700,12 +697,10 @@
     * @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));
        Integer year = qo.getYearMonth().getYear();
        Integer month = qo.getYearMonth().getMonthValue();
    public QueryResultVo<List<VoDayLoss>> getDayLossAmount(IntakeAmountQO qo) throws ParseException {
        String yearMonth = qo.getYearMonth();
        Integer year = Integer.parseInt(yearMonth.substring(0,4));
        Integer month = Integer.parseInt(yearMonth.substring(5,7));
        qo.setYear(year);
        qo.setMonth(month);
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntkeCtrl.java
@@ -16,6 +16,8 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@@ -167,7 +169,6 @@
        }
    }
    /**
     * 获取从未开过阀的取水口
     * @param
@@ -203,7 +204,6 @@
        }
    }
    /**
     * 获取指定时间段内开阀次数低于指定值的取水口
     * @param
@@ -220,7 +220,6 @@
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 指定时间段内累积流量(定时报里的累积流量)超过指定值的取水口
@@ -239,7 +238,6 @@
        }
    }
    /**
     * 指定时间段内用水量超过指定值的取水口
     * @param
@@ -256,7 +254,6 @@
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 指定时间段内消费金额超过指定值的取水口
@@ -276,7 +273,6 @@
    }
    /**
     * 指定时间段内用水时长超过指定值的取水口
     * @param
@@ -293,7 +289,6 @@
            return BaseResponseUtils.buildException(e.getMessage()) ;
        }
    }
    /**
     * 指定时间段 有开阀 无关阀的取水口
@@ -337,8 +332,17 @@
    @GetMapping(path = "/getDayIntakeAmount")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoDayIntakeAmount>>> getDayIntakeAmount(@NotNull IntakeAmountQO qo) {
        if(qo.getYearMonth() == null) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String yearMonth = qo.getYearMonth();
        if(yearMonth == null) {
            return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.YEAR_AND_MONTH_CANNOT_BE_NULL.getMessage());
        }else {
            yearMonth = yearMonth + "-01";
            try {
                Date date = dateFormat.parse(yearMonth);
            } catch (Exception e) {
                return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.YEAR_OR_MONTH_IS_ERROR.getMessage());
            }
        }
        try {
@@ -376,8 +380,17 @@
    @GetMapping(path = "/getDayLossAmount")
    @SsoAop()
    public BaseResponse<QueryResultVo<List<VoDayLoss>>> getDayLossAmount(IntakeAmountQO qo) {
        if(qo.getYearMonth() == null) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String yearMonth = qo.getYearMonth();
        if(yearMonth == null) {
            return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.YEAR_AND_MONTH_CANNOT_BE_NULL.getMessage());
        }else {
            yearMonth = yearMonth + "-01";
            try {
                Date date = dateFormat.parse(yearMonth);
            } catch (Exception e) {
                return BaseResponseUtils.buildErrorMsg(StatisticlResultCode.YEAR_OR_MONTH_IS_ERROR.getMessage());
            }
        }
        try {
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/ClientAmountQO.java
@@ -4,8 +4,6 @@
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDate;
/**
 * @author ZhuBaoMin
 * @date 2024-08-09 11:18
@@ -19,7 +17,7 @@
    /**
     * 统计年月
     */
    private LocalDate yearMonth;
    private String yearMonth;
    /**
     * 年
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/qo/IntakeAmountQO.java
@@ -1,11 +1,8 @@
package com.dy.pipIrrStatistics.intake.qo;
import com.dy.common.webUtil.QueryConditionVo;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDate;
/**
 * @author ZhuBaoMin
@@ -21,8 +18,7 @@
    /**
     * 统计年月
     */
    @NotNull(message = "统计年月不能为空")
    private LocalDate yearMonth;
    private String yearMonth;
    /**
     * 年
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/result/StatisticlResultCode.java
@@ -15,7 +15,8 @@
public enum StatisticlResultCode {
    NO_RECORDS(10001, "没有符合条件的记录"),
    YEAR_AND_MONTH_CANNOT_BE_NULL(10002, "年份和月份不能为空"),
    YEAR_CANNOT_BE_NULL(10003, "年份不能为空");
    YEAR_OR_MONTH_IS_ERROR(10003, "年份或月份错误"),
    YEAR_CANNOT_BE_NULL(10004, "年份不能为空");
    private final Integer code;
    private final String message;