From 471cf8ec2f209183fe3b98499b3d32fb19ac927e Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期五, 09 八月 2024 15:35:45 +0800
Subject: [PATCH] 2024-08-09 朱宝民 统计指定月份各农户各天用水量及消费金额、统计指定年份各农户各月用水量及消费金额
---
pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java | 86 +++++++++++++++++++++++++++++++++++-------
1 files changed, 71 insertions(+), 15 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
index 515bfda..f92bb82 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java
@@ -12,7 +12,6 @@
import java.text.DecimalFormat;
import java.time.LocalDate;
-import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
@@ -39,6 +38,8 @@
@Autowired
private RmIntakeAmountDayMapper rmIntakeAmountDayMapper;
+ @Autowired
+ private RmLossDayLastMapper rmLossDayLastMapper;
@Value("${rtu.batteryVolt}")
private Double batteryVolt;
@@ -191,7 +192,7 @@
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);
@@ -230,7 +231,7 @@
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);
@@ -269,7 +270,7 @@
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);
@@ -427,7 +428,7 @@
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);
@@ -467,7 +468,7 @@
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);
@@ -508,7 +509,7 @@
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);
@@ -547,7 +548,7 @@
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);
@@ -582,7 +583,7 @@
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);
@@ -617,7 +618,7 @@
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);
@@ -647,9 +648,8 @@
* @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));
+ Integer year = qo.getYearMonth().getYear();
+ Integer month = qo.getYearMonth().getMonthValue();
qo.setYear(year);
qo.setMonth(month);
@@ -674,7 +674,7 @@
* @param qo
* @return
*/
- public QueryResultVo<List<VoMonthIntakeAmount>> getMonthIntakeAmount(IntakeAmountQO qo) {
+ 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);
@@ -685,7 +685,7 @@
// 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟
Long itemTotal = Optional.ofNullable(rmIntakeAmountDayMapper.getMonthIntakeAmountCount(params)).orElse(0L);
- QueryResultVo<List<VoMonthIntakeAmount>> rsVo = new QueryResultVo<>() ;
+ QueryResultVo<List<VoMonthAmount>> rsVo = new QueryResultVo<>() ;
rsVo.pageSize = qo.pageSize ;
rsVo.pageCurr = qo.pageCurr ;
@@ -694,4 +694,60 @@
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));
+ Integer year = qo.getYearMonth().getYear();
+ Integer month = qo.getYearMonth().getMonthValue();
+ 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 ;
+ }
}
--
Gitblit v1.8.0