From e021502051079ac2b2c2adcea60b9ec01556b7fe Mon Sep 17 00:00:00 2001
From: liurunyu <lry9898@163.com>
Date: 星期一, 02 九月 2024 11:34:41 +0800
Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV

---
 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/intake/IntakeSv.java |  154 ++++++++++++++++++++++++++++++---------------------
 1 files changed, 90 insertions(+), 64 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 5d50de4..77e36a9 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,6 +12,7 @@
 
 import java.text.DecimalFormat;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.util.Calendar;
 import java.util.List;
@@ -63,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);
@@ -305,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 = "涓嶇煡閬撴偍瑕佹煡閭g寮�闃�绫诲瀷";
+        }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 = "涓嶇煡閬撴偍瑕佹煡閭g寮�闃�绫诲瀷";
+            }
         }
 
         // 鐢熸垚鏌ヨ鍙傛暟
@@ -362,52 +374,59 @@
          */
         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 closeType = qo.getCloseType();
         String closeTypeName = "";
-        switch (closeType) {
-            case 2:
-                closeTypeName = "鍒峰崱鍏抽榾";
-                break;
-            case 4:
-                closeTypeName = "涓績绔欏叧闃�";
-                break;
-            case 5:
-                closeTypeName = "娆犺垂鍏抽榾";
-                break;
-            case 6:
-                closeTypeName = "娴侀噺璁℃晠闅滃叧闃�";
-                break;
-            case 7:
-                closeTypeName = "绱ф�ュ叧闃�";
-                break;
-            case 9:
-                closeTypeName = "鐢ㄦ埛杩滅▼鍏抽榾";
-                break;
-            case 10:
-                closeTypeName = "寮�鍏抽榾鍗″叧闃�";
-                break;
-            case 12:
-                closeTypeName = "榛戝悕鍗曞懡浠ゅ叧闃�";
-                break;
-            case 13:
-                closeTypeName = "杩滅▼瀹氭椂鍏抽榾";
-                break;
-            case 14:
-                closeTypeName = "杩滅▼瀹氶噺鍏抽榾";
-                break;
+        if (closeType == null){
+            closeTypeName = "涓嶇煡閬撴偍瑕佹煡閭g鍏抽榾绫诲瀷";
+        }else {
+            switch (closeType) {
+                case 2:
+                    closeTypeName = "鍒峰崱鍏抽榾";
+                    break;
+                case 4:
+                    closeTypeName = "涓績绔欏叧闃�";
+                    break;
+                case 5:
+                    closeTypeName = "娆犺垂鍏抽榾";
+                    break;
+                case 6:
+                    closeTypeName = "娴侀噺璁℃晠闅滃叧闃�";
+                    break;
+                case 7:
+                    closeTypeName = "绱ф�ュ叧闃�";
+                    break;
+                case 9:
+                    closeTypeName = "鐢ㄦ埛杩滅▼鍏抽榾";
+                    break;
+                case 10:
+                    closeTypeName = "寮�鍏抽榾鍗″叧闃�";
+                    break;
+                case 12:
+                    closeTypeName = "榛戝悕鍗曞懡浠ゅ叧闃�";
+                    break;
+                case 13:
+                    closeTypeName = "杩滅▼瀹氭椂鍏抽榾";
+                    break;
+                case 14:
+                    closeTypeName = "杩滅▼瀹氶噺鍏抽榾";
+                    break;
+                default:
+                    closeTypeName = "涓嶇煡閬撴偍瑕佹煡閭g鍏抽榾绫诲瀷";
+            }
         }
-
         // 鐢熸垚鏌ヨ鍙傛暟
         Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ;
         Integer closeTypeCount = Optional.ofNullable(rmOpenCloseValveLastMapper.getCountByCloseType(params)).orElse(0);
@@ -644,7 +663,11 @@
      * @return
      */
     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);
@@ -698,7 +721,10 @@
      * @return
      */
     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);

--
Gitblit v1.8.0