From d6cfbecac57cf88eb8f63bd9c260e41f49e1e381 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期三, 11 十二月 2024 14:10:31 +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/client/ClientCtrl.java |  116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 112 insertions(+), 4 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java
index 6b3e977..bd809b3 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientCtrl.java
@@ -6,6 +6,7 @@
 import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pipIrrGlobal.voSt.*;
 import com.dy.pipIrrStatistics.card.IcCardqo.CommonQO;
+import com.dy.pipIrrStatistics.card.qo.CardUsageQO;
 import com.dy.pipIrrStatistics.client.qo.*;
 import com.dy.pipIrrStatistics.intake.qo.ClientAmountQO;
 import com.dy.pipIrrStatistics.result.StatisticlResultCode;
@@ -17,6 +18,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;
 
@@ -94,6 +97,26 @@
     }
 
     /**
+     * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忎綆浜庢寚瀹氬�肩殑鍐滄埛
+     * @param qo
+     * @param bindingResult
+     * @return
+     */
+    @GetMapping(path = "/getSmallWaterConsumptionClients")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoClient>>> getSmallWaterConsumptionClients(@Valid WaterConsumptionQO qo, BindingResult bindingResult) {
+        if(bindingResult != null && bindingResult.hasErrors()){
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        try {
+            return BaseResponseUtils.buildSuccess(clientSv.getSmallWaterConsumptionClients(qo));
+        } catch (Exception e) {
+            log.error("鑾峰彇璁板綍寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
+
+    /**
      * 鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛
      * @param qo
      * @param bindingResult
@@ -109,6 +132,26 @@
             return BaseResponseUtils.buildSuccess(clientSv.getLargeAmountSpentClients(qo));
         } catch (Exception e) {
             log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
+
+    /**
+     * 鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦浣庝簬鎸囧畾鍊肩殑鍐滄埛
+     * @param qo
+     * @param bindingResult
+     * @return
+     */
+    @GetMapping(path = "/getSmallAmountSpentClients")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoClient>>> getSmallAmountSpentClients(@Valid AmountSpentQO qo, BindingResult bindingResult) {
+        if(bindingResult != null && bindingResult.hasErrors()){
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        try {
+            return BaseResponseUtils.buildSuccess(clientSv.getSmallAmountSpentClients(qo));
+        } catch (Exception e) {
+            log.error("鑾峰彇璁板綍寮傚父", e);
             return BaseResponseUtils.buildException(e.getMessage()) ;
         }
     }
@@ -134,6 +177,26 @@
     }
 
     /**
+     * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱浣庝簬鎸囧畾鍊肩殑鍐滄埛
+     * @param qo
+     * @param bindingResult
+     * @return
+     */
+    @GetMapping(path = "/getSmallWaterDurationClients")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoClient>>> getSmallWaterDurationClients(@Valid WaterDurationQO qo, BindingResult bindingResult) {
+        if(bindingResult != null && bindingResult.hasErrors()){
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+        try {
+            return BaseResponseUtils.buildSuccess(clientSv.getSmallWaterDurationClients(qo));
+        } catch (Exception e) {
+            log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
+
+    /**
      * 缁熻鎸囧畾鏈堜唤鍚勫啘鎴峰悇澶╃敤姘撮噺鍙婃秷璐归噾棰�
      * @param qo
      * @return
@@ -141,8 +204,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 +244,6 @@
         }
     }
 
-
     /**
      * 鎸囧畾鏃堕棿娈靛唴寮�鐗╃悊鍗″啘鎴�
      *
@@ -190,8 +261,6 @@
             return BaseResponseUtils.buildException(e.getMessage());
         }
     }
-
-
 
     /**
      * 鎸囧畾鏃堕棿娈靛唴姣忎釜鍐滄埛鍏呭�煎悎璁★紙鐗╃悊鍗★級
@@ -230,4 +299,43 @@
         }
     }
 
+
+    /**
+     * 鏈�杩戞湭鍏呭�肩殑鍐滄埛
+     *
+     * @param qo
+     * @return
+     */
+    @GetMapping(path = "/getNotRechargeLastClients")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoClient>>> getNotRechargeLastClients(CommonQO qo) {
+        try {
+            QueryResultVo<List<VoClient>> res = clientSv.getNotRechargeLastClients(qo);
+            return BaseResponseUtils.buildSuccess(res);
+        }catch (Exception e){
+            log.error("鑾峰彇璁板綍寮傚父", e);
+            return BaseResponseUtils.buildException(e.getMessage());
+        }
+    }
+
+    /**
+     * 鑾峰彇鎸囧畾鏃堕棿娈靛啘鎴凤細鍏呭�煎悎璁°�佹秷璐瑰悎璁°�佷綑棰�
+     * @param qo
+    //* @param bindingResult
+     * @return
+     */
+    @GetMapping(path = "/client_usage")
+    @SsoAop()
+    public BaseResponse<QueryResultVo<List<VoCardUsage>>> getClientUsages(@Valid CardUsageQO qo, BindingResult bindingResult) {
+        if(bindingResult != null && bindingResult.hasErrors()){
+            return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage());
+        }
+
+        try {
+            return BaseResponseUtils.buildSuccess(clientSv.getClientUsages(qo));
+        } catch (Exception e) {
+            log.error("鑾峰彇寮�鍗¤褰曞紓甯�", e);
+            return BaseResponseUtils.buildException(e.getMessage()) ;
+        }
+    }
 }

--
Gitblit v1.8.0