From d9218464ed6287a9953f1b1c1e080b21aa8c32d6 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期四, 25 一月 2024 09:18:07 +0800
Subject: [PATCH] 修改取水口是否绑定控制器查询
---
pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java | 251 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 247 insertions(+), 4 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
index f92a9f6..be26372 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sell/src/main/java/com/dy/pipIrrSell/cardOperate/CardOperateSv.java
@@ -1,25 +1,33 @@
package com.dy.pipIrrSell.cardOperate;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.QueryResultVo;
import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper;
import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper;
import com.dy.pipIrrGlobal.daoSe.SeClientMapper;
import com.dy.pipIrrGlobal.pojoSe.SeCardOperate;
import com.dy.pipIrrGlobal.pojoSe.SeClientCard;
+import com.dy.pipIrrGlobal.voSe.*;
import com.dy.pipIrrSell.cardOperate.dto.DtoRecharge;
import com.dy.pipIrrSell.cardOperate.enums.OperateTypeENUM;
+import com.dy.pipIrrSell.cardOperate.qo.QoActiveCard;
+import com.dy.pipIrrSell.cardOperate.qo.QoRecharge;
+import com.dy.pipIrrSell.cardOperate.qo.QoTransaction;
+import com.dy.pipIrrSell.cardOperate.qo.QoTransactionStatistics;
import com.dy.pipIrrSell.clientCard.ClientCardSv;
import com.dy.pipIrrSell.clientCard.LastOperateENUM;
import com.dy.pipIrrSell.result.SellResultCode;
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.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Optional;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
/**
* @author ZhuBaoMin
@@ -182,4 +190,239 @@
return BaseResponseUtils.buildSuccess(true) ;
}
+
+
+ /**
+ * 鏍规嵁鎸囧畾鏉′欢鑾峰彇鍏呭�艰褰�
+ * @param queryVo
+ * @return
+ */
+ public QueryResultVo<List<VoRecharge>> getRecharges(QoRecharge queryVo) {
+ //瀹屽杽鏌ヨ鍏呭�艰褰曠殑璧锋鏃堕棿
+ String rechargeTimeStart = queryVo.rechargeTimeStart;
+ String rechargeTimeStop = queryVo.rechargeTimeStop;
+ if(rechargeTimeStart != null) {
+ rechargeTimeStart = rechargeTimeStart + " 00:00:00";
+ queryVo.setRechargeTimeStart(rechargeTimeStart);
+ }
+ if(rechargeTimeStop != null) {
+ rechargeTimeStop = rechargeTimeStop + " 23:59:59";
+ queryVo.setRechargeTimeStop(rechargeTimeStop);
+ }
+
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+
+ Long itemTotal = seCardOperateMapper.getRecordCount(params);
+
+ QueryResultVo<List<VoRecharge>> rsVo = new QueryResultVo<>() ;
+ Integer pageCurr = 0;
+ Integer pageSize = 10000;
+ rsVo.pageCurr = 1;
+ rsVo.pageSize = 10000;
+ if(queryVo.pageSize != null && queryVo.pageCurr != null) {
+ rsVo.pageSize = queryVo.pageSize ;
+ rsVo.pageCurr = queryVo.pageCurr;
+ pageSize = queryVo.pageSize ;
+ pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString());
+ }
+ params.put("pageCurr", pageCurr);
+ params.put("pageSize", pageSize);
+
+ rsVo.calculateAndSet(itemTotal, params);
+ rsVo.obj = seCardOperateMapper.getRecharges(params);
+ return rsVo ;
+ }
+
+
+ /**
+ * 鏍规嵁鎸囧畾鏉′欢鑾峰彇浜ゆ槗璁板綍
+ * @param vo
+ * @return
+ */
+ public Map getTransactions(QoTransaction vo){
+ // 琛ラ綈鏌ヨ鏃堕棿
+ String operateTimeStart = vo.operateTimeStart;
+ String operateTimeStop = vo.operateTimeStop;
+ if(operateTimeStart != null) {
+ operateTimeStart = operateTimeStart + " 00:00:00";
+ vo.setOperateTimeStart(operateTimeStart);
+ }
+ if(operateTimeStop != null) {
+ operateTimeStop = operateTimeStop + " 23:59:59";
+ vo.setOperateTimeStop(operateTimeStop);
+ }
+
+ // 鐢熸垚鏌ヨ鍙傛暟
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ;
+
+ // 鑾峰彇姹囨�荤殑璐按閲戦銆佽喘鍗¢噾棰�
+ Float waterCost = 0f;
+ Float cardCost = 0f;
+ Map map_sum = Optional.ofNullable(seCardOperateMapper.getTransactionSums(params)).orElse(new HashMap());
+ if(map_sum.size() > 0) {
+ waterCost = Float.parseFloat(map_sum.get("waterCost").toString());
+ cardCost = Float.parseFloat(map_sum.get("cardCost").toString());
+ }
+
+ // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟
+ Long itemTotal = seCardOperateMapper.getTransactionRecordCount(params);
+
+ Integer pageSize = vo.getPageSize();
+ // 璁$畻鎬婚〉鏁�
+ Integer pageTotal ;
+ pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize);
+
+ // 鏍规嵁褰撳墠椤电爜鍙婃瘡椤垫暟閲忚绠楀亸绉婚噺
+ Integer pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString());
+ params.put("pageCurr", pageCurr);
+
+ List<VoTransaction> lit = seCardOperateMapper.getTransactions(params);
+ Map map_record = new HashMap();
+ map_record.put("itemTotal", itemTotal);
+ map_record.put("pageCurr", vo.pageCurr);
+ map_record.put("pageSize", pageSize);
+ map_record.put("pageTotal", pageTotal);
+ map_record.put("list", lit);
+
+ Map map_result = new HashMap();
+ map_result.put("waterCost", waterCost);
+ map_result.put("cardCost", cardCost);
+ map_result.put("records", map_record);
+
+ return map_result;
+ }
+
+ /**
+ * 鑾峰彇浜ゆ槗缁熻璁板綍
+ * 1.浜ゆ槗缁熻璁板綍
+ * 2.绗旀暟鍚堣銆佸疄鏀堕噾棰濆悎璁°�佽禒閫侀噾棰濆悎璁�
+ * 3.姣忎竴澶┿�佸悇绉嶆敮浠樻柟寮忓疄鏀堕噾棰濆悎璁�
+ * @param vo
+ * @return
+ */
+ public Map getTransactionStatistics(QoTransactionStatistics vo) throws ParseException {
+ /**
+ * 閬嶅巻鏌ヨ鏃ユ湡锛屽彇鍑烘瘡澶╀笁绉嶆敮浠樻柟寮忥紙鐜伴噾銆佹壂鐮併�佽浆璐︼級瀹炴敹閲戦
+ * 姣忓ぉ涓�涓璞�
+ * 瀵硅薄缁勬垚JSONArray娣诲姞鍒拌繑鍥炲璞′腑
+ */
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+ Date startDate = dateFormat.parse(vo.getOperateTimeStart());
+ Date stopDate = dateFormat.parse(vo.getOperateTimeStop());
+ Calendar calendar = Calendar.getInstance();
+ calendar.setTime(startDate);
+
+ JSONArray array_paymentSums = new JSONArray();
+ while (calendar.getTime().before(stopDate) || calendar.getTime().equals(stopDate)) {
+ String tradeDate = dateFormat.format(calendar.getTime()) ;
+ Float receivedCash = Optional.ofNullable(seCardOperateMapper.getPaymentSums(tradeDate ,1L)).orElse(0f);
+ Float receivedQRCode = Optional.ofNullable(seCardOperateMapper.getPaymentSums(tradeDate,2L)).orElse(0f);
+ Float receivedTransfer = Optional.ofNullable(seCardOperateMapper.getPaymentSums(tradeDate, 3L)).orElse(0f);
+ JSONObject job = new JSONObject();
+ job.put("tradeDate", tradeDate);
+ job.put("receivedCash", receivedCash);
+ job.put("receivedQRCode", receivedQRCode);
+ job.put("receivedTransfer", receivedTransfer);
+
+ array_paymentSums.add(job);
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
+ }
+
+
+ // 琛ラ綈鏌ヨ鏃堕棿
+ String operateTimeStart = vo.operateTimeStart;
+ String operateTimeStop = vo.operateTimeStop;
+ if(operateTimeStart != null) {
+ operateTimeStart = operateTimeStart + " 00:00:00";
+ vo.setOperateTimeStart(operateTimeStart);
+ }
+ if(operateTimeStop != null) {
+ operateTimeStop = operateTimeStop + " 23:59:59";
+ vo.setOperateTimeStop(operateTimeStop);
+ }
+
+ // 鐢熸垚鏌ヨ鍙傛暟
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(vo) ;
+
+ //鑾峰彇绗旀暟鍚堣銆佸疄鏀堕噾棰濆悎璁°�佽禒閫侀噾棰濆悎璁�
+ Integer totalCount = 0;
+ Float totalReceived = 0f;
+ Float totalGift = 0f;
+ Map map_sum = Optional.ofNullable(seCardOperateMapper.getTransactionStatisticsSums(params)).orElse(new HashMap());
+ if(map_sum.size() > 0) {
+ totalCount = Integer.parseInt(map_sum.get("totalCount").toString());
+ totalReceived = Float.parseFloat(map_sum.get("totalReceived").toString());
+ totalGift = Float.parseFloat(map_sum.get("totalGift").toString());
+ }
+
+ // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟
+ Long itemTotal = seCardOperateMapper.getTransactionStatisticsRecordCount(params);
+
+ Integer pageSize = vo.getPageSize();
+ // 璁$畻鎬婚〉鏁�
+ Integer pageTotal ;
+ pageTotal = (int)Math.ceil((itemTotal==null?0.0D:itemTotal.doubleValue())/pageSize);
+
+ // 鏍规嵁褰撳墠椤电爜鍙婃瘡椤垫暟閲忚绠楀亸绉婚噺
+ Integer pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString());
+ params.put("pageCurr", pageCurr);
+
+ List<VoTransactionStatistics> list = seCardOperateMapper.getTransactionStatistics(params);
+ Map map_record = new HashMap();
+ map_record.put("itemTotal", itemTotal);
+ map_record.put("pageCurr", vo.pageCurr);
+ map_record.put("pageSize", pageSize);
+ map_record.put("pageTotal", pageTotal);
+ map_record.put("list", list);
+
+ Map map_result = new HashMap();
+ map_result.put("totalCount", totalCount);
+ map_result.put("totalReceived", totalReceived);
+ map_result.put("totalGift", totalGift);
+ map_result.put("records", map_record);
+ map_result.put("paymentSums", array_paymentSums);
+
+ return map_result;
+ }
+
+ /**
+ * 鏍规嵁鎸囧畾鏉′欢鑾峰彇寮�鍗¤褰�
+ * @param queryVo
+ * @return
+ */
+ public QueryResultVo<List<VoActiveCardNew>> getActiveCards(QoActiveCard queryVo) {
+ //瀹屽杽鏌ヨ鍏呭�艰褰曠殑璧锋鏃堕棿
+ String activeTimeStart = queryVo.activeTimeStart;
+ String activeTimeStop = queryVo.activeTimeStop;
+ if(activeTimeStart != null) {
+ activeTimeStart = activeTimeStart + " 00:00:00";
+ queryVo.setActiveTimeStart(activeTimeStart);
+ }
+ if(activeTimeStop != null) {
+ activeTimeStop = activeTimeStop + " 23:59:59";
+ queryVo.setActiveTimeStop(activeTimeStop);
+ }
+
+ Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo);
+
+ Long itemTotal = seCardOperateMapper.getActiveCardRecordCount(params);
+
+ QueryResultVo<List<VoActiveCardNew>> rsVo = new QueryResultVo<>() ;
+ Integer pageCurr = 0;
+ Integer pageSize = 10000;
+ rsVo.pageCurr = 1;
+ rsVo.pageSize = 10000;
+ if(queryVo.pageSize != null && queryVo.pageCurr != null) {
+ rsVo.pageSize = queryVo.pageSize ;
+ rsVo.pageCurr = queryVo.pageCurr;
+ pageSize = queryVo.pageSize ;
+ pageCurr = (Integer.parseInt(params.get("pageCurr").toString()) - 1) * Integer.parseInt(params.get("pageSize").toString());
+ }
+ params.put("pageCurr", pageCurr);
+ params.put("pageSize", pageSize);
+
+ rsVo.calculateAndSet(itemTotal, params);
+ rsVo.obj = seCardOperateMapper.getActiveCards(params);
+ return rsVo ;
+ }
}
--
Gitblit v1.8.0