| | |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | |
| | | @Autowired |
| | | private RmIntakeAmountDayMapper rmIntakeAmountDayMapper; |
| | | @Autowired |
| | | private RmLossDayLastMapper rmLossDayLastMapper; |
| | | |
| | | @Value("${rtu.batteryVolt}") |
| | | private Double batteryVolt; |
| | |
| | | if(timeStart != null && timeStart != "") { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | } else { |
| | | timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); |
| | | timeStart = LocalDate.now() + " 00:00:00"; |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | |
| | |
| | | if(timeStart != null && timeStart != "") { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | } else { |
| | | timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); |
| | | timeStart = LocalDate.now() + " 00:00:00"; |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | |
| | |
| | | if(timeStart != null && timeStart != "") { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | } else { |
| | | timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); |
| | | timeStart = LocalDate.now() + " 00:00:00"; |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | |
| | |
| | | if(timeStart != null && timeStart != "") { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | } else { |
| | | timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); |
| | | timeStart = LocalDate.now() + " 00:00:00"; |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | |
| | |
| | | if(timeStart != null && timeStart != "") { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | } else { |
| | | timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); |
| | | timeStart = LocalDate.now() + " 00:00:00"; |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | |
| | |
| | | if(timeStart != null && timeStart != "") { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | } else { |
| | | timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); |
| | | timeStart = LocalDate.now() + " 00:00:00"; |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | |
| | |
| | | if(timeStart != null && timeStart != "") { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | } else { |
| | | timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); |
| | | timeStart = LocalDate.now() + " 00:00:00"; |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | |
| | |
| | | if(timeStart != null && timeStart != "") { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | } else { |
| | | timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); |
| | | timeStart = LocalDate.now() + " 00:00:00"; |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | |
| | |
| | | if(timeStart != null && timeStart != "") { |
| | | timeStart = timeStart + " 00:00:00"; |
| | | } else { |
| | | timeStart = LocalDateTime.of(2024, 1, 1, 0, 0, 0).toString(); |
| | | timeStart = LocalDate.now() + " 00:00:00"; |
| | | } |
| | | qo.setTimeStart(timeStart); |
| | | |
| | |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoDayIntakeAmount>> getDayIntakeAmount(DayIntakeAmountQO qo) { |
| | | 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)); |
| | |
| | | rsVo.obj = rmIntakeAmountDayMapper.getDayIntakeAmount(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 统计指定年份各月用水量 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoMonthAmount>> getMonthIntakeAmount(IntakeAmountQO qo) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | Integer year = Optional.ofNullable(qo.getYear()).orElse(calendar.get(Calendar.YEAR)); |
| | | qo.setYear(year); |
| | | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = Optional.ofNullable(rmIntakeAmountDayMapper.getMonthIntakeAmountCount(params)).orElse(0L); |
| | | |
| | | QueryResultVo<List<VoMonthAmount>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | rsVo.pageSize = qo.pageSize ; |
| | | rsVo.pageCurr = qo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmIntakeAmountDayMapper.getMonthIntakeAmount(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 统计指定月份各天漏损量 |
| | | * @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)); |
| | | qo.setYear(year); |
| | | qo.setMonth(month); |
| | | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = Optional.ofNullable(rmLossDayLastMapper.getDayLossAmountCount(params)).orElse(0L); |
| | | |
| | | QueryResultVo<List<VoDayLoss>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | rsVo.pageSize = qo.pageSize ; |
| | | rsVo.pageCurr = qo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmLossDayLastMapper.getDayLossAmount(params); |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * 统计指定年份各月漏损量 |
| | | * @param qo |
| | | * @return |
| | | */ |
| | | public QueryResultVo<List<VoMonthAmount>> getMonthLossAmount(IntakeAmountQO qo) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | Integer year = Optional.ofNullable(qo.getYear()).orElse(calendar.get(Calendar.YEAR)); |
| | | qo.setYear(year); |
| | | |
| | | // 生成查询参数 |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; |
| | | |
| | | // 获取符合条件的记录数 |
| | | Long itemTotal = Optional.ofNullable(rmLossDayLastMapper.getMonthLossAmountCount(params)).orElse(0L); |
| | | |
| | | QueryResultVo<List<VoMonthAmount>> rsVo = new QueryResultVo<>() ; |
| | | |
| | | rsVo.pageSize = qo.pageSize ; |
| | | rsVo.pageCurr = qo.pageCurr ; |
| | | |
| | | rsVo.calculateAndSet(itemTotal, params); |
| | | rsVo.obj = rmLossDayLastMapper.getMonthLossAmount(params); |
| | | return rsVo ; |
| | | } |
| | | } |