From 2a959177f1adcd36f790e14718bbd116752e5c64 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期六, 12 十月 2024 17:19:10 +0800
Subject: [PATCH] 2024-10-12 朱宝民 优化交易明细导出、取水口导出、阀控器导出

---
 pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java |  184 +++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 180 insertions(+), 4 deletions(-)

diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java
index 96f565e..c253f27 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/wallet/WalletSv.java
@@ -1,14 +1,29 @@
 package com.dy.pipIrrSell.wallet;
 
+import com.dy.common.webUtil.QueryResultVo;
 import com.dy.pipIrrGlobal.daoSe.SeConsumeMapper;
 import com.dy.pipIrrGlobal.daoSe.SeRefundMapper;
 import com.dy.pipIrrGlobal.daoSe.SeWalletMapper;
 import com.dy.pipIrrGlobal.daoSe.SeWalletRechargeMapper;
+import com.dy.pipIrrGlobal.pojoSe.SeConsume;
+import com.dy.pipIrrGlobal.pojoSe.SeRefund;
 import com.dy.pipIrrGlobal.pojoSe.SeWallet;
 import com.dy.pipIrrGlobal.pojoSe.SeWalletRecharge;
+import com.dy.pipIrrGlobal.voSe.VoWallet;
+import com.dy.pipIrrGlobal.voSe.VoWalletConsume;
+import com.dy.pipIrrGlobal.voSe.VoWalletRecharge;
+import com.dy.pipIrrGlobal.voSe.VoWalletRefund;
+import com.dy.pipIrrSell.wallet.qo.QoWalletRecharge;
+import com.dy.pipIrrSell.wallet.qo.QueryVo;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.common.utils.PojoUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 
 /**
  * @author ZhuBaoMin
@@ -51,10 +66,6 @@
         return po.getId();
     }
 
-    public Integer updateWallet(SeWallet po) {
-        return seWalletMapper.updateByPrimaryKeySelective(po);
-    }
-
     /**
      * 鐢靛瓙閽卞寘鍏呭��
      * @param po
@@ -65,4 +76,169 @@
         return po.getId();
     }
 
+    /**
+     * 鐢靛瓙閽卞寘娑堣垂
+     * @param po
+     * @return
+     */
+    public Long addConsume(SeConsume po) {
+        seConsumeMapper.insert(po);
+        return po.getId();
+    }
+
+    /**
+     * 娣诲姞閫�娆剧敵璇�
+     * @param po
+     * @return
+     */
+    public Long addRefund(SeRefund po) {
+        seRefundMapper.insert(po);
+        return po.getId();
+    }
+
+    /**
+     * 鏍规嵁閽卞寘ID鑾峰彇寰呭鏍哥殑閫�娆剧敵璇峰璞�
+     * @param walletId
+     * @return
+     */
+    public SeRefund getRefundByWallerId(Long walletId) {
+        return seRefundMapper.getRefundByWallerId(walletId);
+    }
+
+    /**
+     * 瀹℃牳閫�娆剧敵璇�
+     * @param po
+     * @return
+     */
+    public Integer auditRefund(SeRefund po) {
+        return seRefundMapper.updateByPrimaryKeySelective(po);
+    }
+
+    /**
+     * 淇敼鐢靛瓙閽卞寘
+     * 鍏呭�笺�佹秷璐广�佺敵璇烽��娆俱�佸鏍搁��娆炬椂闇�瑕佷慨鏀圭數瀛愰挶鍖呯殑锛氫綑棰濄�佹渶鍚庢搷浣溿�佹渶鍚庢搷浣滄椂闂�
+     * @param po
+     * @return
+     */
+    public Integer updateWallet(SeWallet po) {
+        return seWalletMapper.updateByPrimaryKeySelective(po);
+    }
+
+
+    /**
+     * 鏍规嵁鍐滄埛濮撳悕鑾峰彇鐢靛瓙閽卞寘璐︽埛璁板綍
+     * @param queryVo
+     * @return
+     */
+    public QueryResultVo<List<VoWallet>> getWallets(QueryVo queryVo) {
+        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+
+        Long itemTotal = seWalletMapper.getRecordCount(params);
+
+        QueryResultVo<List<VoWallet>> rsVo = new QueryResultVo<>() ;
+        rsVo.pageSize = queryVo.pageSize ;
+        rsVo.pageCurr = queryVo.pageCurr ;
+
+        rsVo.calculateAndSet(itemTotal, params);
+        rsVo.obj = seWalletMapper.getWallets(params);
+        return rsVo ;
+    }
+
+    /**
+     * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘鍏呭�艰褰�
+     * @param queryVo
+     * @return
+     */
+    public QueryResultVo<List<VoWalletRecharge>> getWalletRecharges(QoWalletRecharge queryVo) {
+        //瀹屽杽鏌ヨ鍏呭�艰褰曠殑璧锋鏃堕棿
+        String timeStart = queryVo.getTimeStart();
+        String timeStop = queryVo.getTimeStop();
+        if(timeStart != null) {
+            timeStart = timeStart + " 00:00:00";
+            queryVo.setTimeStart(timeStart);
+        }
+        if(timeStop != null) {
+            timeStop = timeStop + " 23:59:59";
+            queryVo.setTimeStop(timeStop);
+        }
+
+        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+
+        Long itemTotal = seWalletRechargeMapper.getRecordCount(params);
+
+        QueryResultVo<List<VoWalletRecharge>> rsVo = new QueryResultVo<>() ;
+        rsVo.pageSize = queryVo.pageSize ;
+        rsVo.pageCurr = queryVo.pageCurr ;
+
+        rsVo.calculateAndSet(itemTotal, params);
+        rsVo.obj = seWalletRechargeMapper.getWalletRecharges(params);
+        return rsVo ;
+    }
+
+    /**
+     * 鏍规嵁鍐滄埛ID鑾峰彇鐢靛瓙閽卞寘娑堣垂璁板綍
+     * @param queryVo
+     * @return
+     */
+    public Map getWalletConsumes(QueryVo queryVo) {
+        // 鑾峰彇鐢靛瓙閽卞寘娑堣垂姹囨�讳俊鎭�
+        String clientName = "";
+        String clientNum = "";
+        Double money = 0.0;
+        Double totalConsume = 0.0;
+        Long clientId = Optional.ofNullable(queryVo.getClientId()).orElse(0L);
+        Map map_consumeSum = Optional.ofNullable(seConsumeMapper.getWalletConsumeSum(clientId)).orElse(new HashMap());
+        if(map_consumeSum.size() > 0) {
+            clientName = map_consumeSum.get("clientName").toString();
+            clientNum = map_consumeSum.get("clientNum").toString();
+            money = Double.parseDouble(map_consumeSum.get("money").toString());
+            totalConsume = Double.parseDouble(map_consumeSum.get("totalConsume").toString());
+        }
+
+        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+        Long itemTotal = seConsumeMapper.getRecordCount(params);
+
+        QueryResultVo<List<VoWalletConsume>> rsVo = new QueryResultVo<>() ;
+        rsVo.pageSize = queryVo.pageSize ;
+        rsVo.pageCurr = queryVo.pageCurr ;
+
+        rsVo.calculateAndSet(itemTotal, params);
+        List<VoWalletConsume> list = seConsumeMapper.getWalletConsumes(params);
+
+
+        Map map_record = new HashMap();
+        map_record.put("itemTotal", rsVo.itemTotal);
+        map_record.put("pageCurr", rsVo.pageCurr);
+        map_record.put("pageSize", rsVo.pageSize);
+        map_record.put("pageTotal", rsVo.pageTotal);
+        map_record.put("list", list);
+
+        Map map_result = new HashMap();
+        map_result.put("clientName", clientName);
+        map_result.put("clientNum", clientNum);
+        map_result.put("money", money);
+        map_result.put("totalConsume", totalConsume);
+        map_result.put("records", map_record);
+
+        return map_result;
+    }
+
+    /**
+     * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鐢靛瓙閽卞寘閫�娆捐褰�
+     * @param queryVo
+     * @return
+     */
+    public QueryResultVo<List<VoWalletRefund>> getWalletRefunds(QueryVo queryVo) {
+        Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+
+        Long itemTotal = seRefundMapper.getRecordCount(params);
+
+        QueryResultVo<List<VoWalletRefund>> rsVo = new QueryResultVo<>() ;
+        rsVo.pageSize = queryVo.pageSize ;
+        rsVo.pageCurr = queryVo.pageCurr ;
+
+        rsVo.calculateAndSet(itemTotal, params);
+        rsVo.obj = seRefundMapper.getWalletRefunds(params);
+        return rsVo ;
+    }
 }

--
Gitblit v1.8.0