From d16984b80d2b8bebc5038a6f70990f7443d8d4a0 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期六, 10 八月 2024 11:02:27 +0800
Subject: [PATCH] 2024-08-10 朱宝民 注册虚拟卡、虚拟卡充值添加操作记录(新加操作记录表)

---
 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java |  303 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 276 insertions(+), 27 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 d137d90..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
@@ -1,22 +1,9 @@
 package com.dy.pipIrrStatistics.intake;
 
 import com.dy.common.webUtil.QueryResultVo;
-import com.dy.pipIrrGlobal.daoRm.RmOnHourReportHistoryMapper;
-import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper;
-import com.dy.pipIrrGlobal.daoRm.RmOnHourReportLastMapper;
-import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveLastMapper;
+import com.dy.pipIrrGlobal.daoRm.*;
 import com.dy.pipIrrGlobal.voSt.*;
 import com.dy.pipIrrStatistics.intake.qo.*;
-import com.dy.pipIrrGlobal.voSt.VoBatteryVolt;
-import com.dy.pipIrrGlobal.voSt.VoCumulativeFlow;
-import com.dy.pipIrrGlobal.voSt.VoIntake;
-import com.dy.pipIrrGlobal.voSt.VoIntakeOpenCount;
-import com.dy.pipIrrGlobal.voSt.VoSignalIntensity;
-import com.dy.pipIrrStatistics.intake.qo.BatteryVoltQO;
-import com.dy.pipIrrStatistics.intake.qo.CumulativeFlowQO;
-import com.dy.pipIrrStatistics.intake.qo.IntakeCountValueQO;
-import com.dy.pipIrrStatistics.intake.qo.CommonQO;
-import com.dy.pipIrrStatistics.intake.qo.SignalIntensityQO;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.common.utils.PojoUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -25,7 +12,7 @@
 
 import java.text.DecimalFormat;
 import java.time.LocalDate;
-import java.time.LocalDateTime;
+import java.util.Calendar;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -46,9 +33,13 @@
     private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper;
     @Autowired
     private RmOnHourReportLastMapper rmOnHourReportLastMapper;
-
     @Autowired
     private RmOpenCloseValveLastMapper rmOpenCloseValveLastMapper;
+
+    @Autowired
+    private RmIntakeAmountDayMapper rmIntakeAmountDayMapper;
+    @Autowired
+    private RmLossDayLastMapper rmLossDayLastMapper;
 
     @Value("${rtu.batteryVolt}")
     private Double batteryVolt;
@@ -198,13 +189,14 @@
 
         String timeStart = qo.getTimeStart();
         String timeStop = qo.getTimeStop();
-        if(timeStart != null) {
+        if(timeStart != null && timeStart != "") {
             timeStart = timeStart + " 00:00:00";
-        }else {
+        } else {
             timeStart = LocalDate.now() + " 00:00:00";
         }
         qo.setTimeStart(timeStart);
-        if(timeStop != null) {
+
+        if(timeStop != null && timeStop != "") {
             timeStop = timeStop + " 23:59:59";
         }else {
             timeStop = LocalDate.now() + " 23:59:59";
@@ -236,13 +228,14 @@
 
         String timeStart = qo.getTimeStart();
         String timeStop = qo.getTimeStop();
-        if(timeStart != null) {
+        if(timeStart != null && timeStart != "") {
             timeStart = timeStart + " 00:00:00";
-        }else {
+        } else {
             timeStart = LocalDate.now() + " 00:00:00";
         }
         qo.setTimeStart(timeStart);
-        if(timeStop != null) {
+
+        if(timeStop != null && timeStop != "") {
             timeStop = timeStop + " 23:59:59";
         }else {
             timeStop = LocalDate.now() + " 23:59:59";
@@ -274,13 +267,14 @@
 
         String timeStart = qo.getTimeStart();
         String timeStop = qo.getTimeStop();
-        if(timeStart != null) {
+        if(timeStart != null && timeStart != "") {
             timeStart = timeStart + " 00:00:00";
-        }else {
+        } else {
             timeStart = LocalDate.now() + " 00:00:00";
         }
         qo.setTimeStart(timeStart);
-        if(timeStop != null) {
+
+        if(timeStop != null && timeStop != "") {
             timeStop = timeStop + " 23:59:59";
         }else {
             timeStop = LocalDate.now() + " 23:59:59";
@@ -434,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);
 
@@ -474,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);
 
@@ -501,4 +495,259 @@
         rsVo.obj = rmOpenCloseValveHistoryMapper.getUseWaterGtValueIntakes(params);
         return rsVo ;
     }
+
+
+
+    /**
+     * 鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�
+     * @param qo
+     * @return
+     */
+    public QueryResultVo<List<VoIntakeAccumulateAmount>> getExpenseGtValueIntakes(IntakeAmountValueQO qo) {
+        String timeStart = qo.getTimeStart();
+        String timeStop = qo.getTimeStop();
+        if(timeStart != null && timeStart != "") {
+            timeStart = timeStart + " 00:00:00";
+        } else {
+            timeStart = LocalDate.now() + " 00:00:00";
+        }
+        qo.setTimeStart(timeStart);
+
+        if(timeStop != null && timeStop != "") {
+            timeStop = timeStop + " 23:59:59";
+        }else {
+            timeStop = LocalDate.now() + " 23:59:59";
+        }
+        qo.setTimeStop(timeStop);
+
+        if (qo.getValue() == null){
+            qo.setValue(0.0);
+        }
+
+        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo);
+        Long itemTotal = rmOpenCloseValveHistoryMapper.getExpenseGtValueIntakesCount(params);
+
+        QueryResultVo<List<VoIntakeAccumulateAmount>> rsVo = new QueryResultVo<>() ;
+        rsVo.pageSize = qo.pageSize ;
+        rsVo.pageCurr = qo.pageCurr ;
+
+        rsVo.calculateAndSet(itemTotal, params);
+        rsVo.obj = rmOpenCloseValveHistoryMapper.getExpenseGtValueIntakes(params);
+        return rsVo ;
+    }
+
+
+    /**
+     * 鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍙栨按鍙�
+     * @param qo
+     * @return
+     */
+    public QueryResultVo<List<VoIntakeOpenCount>> getUseWaterDurationGtValueIntakes(IntakeCountValueQO qo) {
+        String timeStart = qo.getTimeStart();
+        String timeStop = qo.getTimeStop();
+        if(timeStart != null && timeStart != "") {
+            timeStart = timeStart + " 00:00:00";
+        } else {
+            timeStart = LocalDate.now() + " 00:00:00";
+        }
+        qo.setTimeStart(timeStart);
+
+        if(timeStop != null && timeStop != "") {
+            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 = rmOpenCloseValveHistoryMapper.getUseWaterDurationGtValueIntakesCount(params);
+
+        QueryResultVo<List<VoIntakeOpenCount>> rsVo = new QueryResultVo<>() ;
+        rsVo.pageSize = qo.pageSize ;
+        rsVo.pageCurr = qo.pageCurr ;
+
+        rsVo.calculateAndSet(itemTotal, params);
+        rsVo.obj = rmOpenCloseValveHistoryMapper.getUseWaterDurationGtValueIntakes(params);
+        return rsVo ;
+    }
+
+    /**
+     * 鎸囧畾鏃堕棿娈� 鏈夊紑闃� 鏃犲叧闃�鐨勫彇姘村彛
+     * @param qo
+     * @return
+     */
+    public QueryResultVo<List<VoIntake>> getHaveOpenNoCloseIntakes(CommonQO qo) {
+        String timeStart = qo.getTimeStart();
+        String timeStop = qo.getTimeStop();
+        if(timeStart != null && timeStart != "") {
+            timeStart = timeStart + " 00:00:00";
+        } else {
+            timeStart = LocalDate.now() + " 00:00:00";
+        }
+        qo.setTimeStart(timeStart);
+
+        if(timeStop != null && timeStop != "") {
+            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 = rmOpenCloseValveHistoryMapper.getHaveOpenNoCloseIntakesCount(params);
+
+        QueryResultVo<List<VoIntake>> rsVo = new QueryResultVo<>() ;
+        rsVo.pageSize = qo.pageSize ;
+        rsVo.pageCurr = qo.pageCurr ;
+
+        rsVo.calculateAndSet(itemTotal, params);
+        rsVo.obj = rmOpenCloseValveHistoryMapper.getHaveOpenNoCloseIntakes(params);
+        return rsVo ;
+    }
+
+    /**
+     * 鎸囧畾鏃堕棿娈� 鏃犲紑闃� 鏈夊叧闃�鐨勫彇姘村彛
+     * @param qo
+     * @return
+     */
+    public QueryResultVo<List<VoIntake>> getNoOpenHaveCloseIntakes(CommonQO qo) {
+        String timeStart = qo.getTimeStart();
+        String timeStop = qo.getTimeStop();
+        if(timeStart != null && timeStart != "") {
+            timeStart = timeStart + " 00:00:00";
+        } else {
+            timeStart = LocalDate.now() + " 00:00:00";
+        }
+        qo.setTimeStart(timeStart);
+
+        if(timeStop != null && timeStop != "") {
+            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 = rmOpenCloseValveHistoryMapper.getNoOpenHaveCloseIntakesCount(params);
+
+        QueryResultVo<List<VoIntake>> rsVo = new QueryResultVo<>() ;
+        rsVo.pageSize = qo.pageSize ;
+        rsVo.pageCurr = qo.pageCurr ;
+
+        rsVo.calculateAndSet(itemTotal, params);
+        rsVo.obj = rmOpenCloseValveHistoryMapper.getNoOpenHaveCloseIntakes(params);
+        return rsVo ;
+    }
+
+    /**
+     * 缁熻鎸囧畾鏈堜唤鍚勫ぉ鐢ㄦ按閲�
+     * @param qo
+     * @return
+     */
+    public QueryResultVo<List<VoDayIntakeAmount>> getDayIntakeAmount(IntakeAmountQO qo) {
+        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(rmIntakeAmountDayMapper.getDayIntakeAmountCount(params)).orElse(0L);
+
+        QueryResultVo<List<VoDayIntakeAmount>> rsVo = new QueryResultVo<>() ;
+
+        rsVo.pageSize = qo.pageSize ;
+        rsVo.pageCurr = qo.pageCurr ;
+
+        rsVo.calculateAndSet(itemTotal, params);
+        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));
+        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