From ba55749a30a2a2a09a2c64669d6b344a5d8ddb53 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期五, 18 十月 2024 14:08:09 +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/ClientSv.java | 303 +++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 271 insertions(+), 32 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java index 3314c6b..334c320 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/client/ClientSv.java @@ -3,13 +3,10 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoRm.RmClientAmountDayLastMapper; import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveHistoryMapper; -import com.dy.pipIrrGlobal.voSt.VoClient; -import com.dy.pipIrrGlobal.voSt.VoDayClient; -import com.dy.pipIrrGlobal.voSt.VoMonthClient; -import com.dy.pipIrrStatistics.client.qo.AmountSpentQO; -import com.dy.pipIrrStatistics.client.qo.OpenCountQO; -import com.dy.pipIrrStatistics.client.qo.WaterConsumptionQO; -import com.dy.pipIrrStatistics.client.qo.WaterDurationQO; +import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper; +import com.dy.pipIrrGlobal.voSt.*; +import com.dy.pipIrrStatistics.card.IcCardqo.CommonQO; +import com.dy.pipIrrStatistics.client.qo.*; import com.dy.pipIrrStatistics.intake.qo.ClientAmountQO; import lombok.extern.slf4j.Slf4j; import org.apache.dubbo.common.utils.PojoUtils; @@ -17,7 +14,9 @@ import org.springframework.stereotype.Service; import java.text.ParseException; +import java.text.SimpleDateFormat; import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.Calendar; import java.util.List; import java.util.Map; @@ -35,6 +34,8 @@ public class ClientSv { @Autowired private RmOpenCloseValveHistoryMapper rmOpenCloseValveHistoryMapper; + @Autowired + private SeCardOperateMapper seCardOperateMapper; @Autowired private RmClientAmountDayLastMapper rmClientAmountDayLastMapper; @@ -46,16 +47,14 @@ */ public QueryResultVo<List<VoClient>> getLargeOpenCountClients(OpenCountQO qo) { /** - * 琛ラ綈璧锋鏃堕棿锛屽鏋滃紑濮嬫椂闂翠负绌猴紝鍒欓粯璁や负褰撳墠鏃ユ湡 + * 琛ラ綈璧锋鏃堕棿 */ String timeStart = qo.getTimeStart(); String timeStop = qo.getTimeStop(); - if(timeStart != null) { + if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; - }else { - timeStart = LocalDate.now() + " 00:00:00"; } - if(timeStop != null) { + if(timeStop != null && timeStop != "") { timeStop = timeStop + " 23:59:59"; } qo.setTimeStart(timeStart); @@ -84,16 +83,14 @@ */ public QueryResultVo<List<VoClient>> getSmallOpenCountClients(OpenCountQO qo) { /** - * 琛ラ綈璧锋鏃堕棿锛屽鏋滃紑濮嬫椂闂翠负绌猴紝鍒欓粯璁や负褰撳墠鏃ユ湡 + * 琛ラ綈璧锋鏃堕棿 */ String timeStart = qo.getTimeStart(); String timeStop = qo.getTimeStop(); - if(timeStart != null) { + if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; - }else { - timeStart = LocalDate.now() + " 00:00:00"; } - if(timeStop != null) { + if(timeStop != null && timeStop != "") { timeStop = timeStop + " 23:59:59"; } qo.setTimeStart(timeStart); @@ -122,16 +119,14 @@ */ public QueryResultVo<List<VoClient>> getLargeWaterConsumptionClients(WaterConsumptionQO qo) { /** - * 琛ラ綈璧锋鏃堕棿锛屽鏋滃紑濮嬫椂闂翠负绌猴紝鍒欓粯璁や负褰撳墠鏃ユ湡 + * 琛ラ綈璧锋鏃堕棿 */ String timeStart = qo.getTimeStart(); String timeStop = qo.getTimeStop(); - if(timeStart != null) { + if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; - }else { - timeStart = LocalDate.now() + " 00:00:00"; } - if(timeStop != null) { + if(timeStop != null && timeStop != "") { timeStop = timeStop + " 23:59:59"; } qo.setTimeStart(timeStart); @@ -154,6 +149,42 @@ } /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按閲忎綆浜庢寚瀹氬�肩殑鍐滄埛 + * @param qo + * @return + */ + public QueryResultVo<List<VoClient>> getSmallWaterConsumptionClients(WaterConsumptionQO qo) { + /** + * 琛ラ綈璧锋鏃堕棿 + */ + String timeStart = qo.getTimeStart(); + String timeStop = qo.getTimeStop(); + if(timeStart != null && timeStart != "") { + timeStart = timeStart + " 00:00:00"; + } + if(timeStop != null && timeStop != "") { + timeStop = timeStop + " 23:59:59"; + } + qo.setTimeStart(timeStart); + qo.setTimeStop(timeStop); + + // 鐢熸垚鏌ヨ鍙傛暟 + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; + + // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟 + Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getSmallWaterConsumptionClientsCount(params)).orElse(0L); + + QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmOpenCloseValveHistoryMapper.getSmallWaterConsumptionClients(params); + return rsVo ; + } + + /** * 鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦瓒呰繃鎸囧畾鍊肩殑鍐滄埛 * @param qo * @return @@ -164,12 +195,10 @@ */ String timeStart = qo.getTimeStart(); String timeStop = qo.getTimeStop(); - if(timeStart != null) { + if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; - }else { - timeStart = LocalDate.now() + " 00:00:00"; } - if(timeStop != null) { + if(timeStop != null && timeStop != "") { timeStop = timeStop + " 23:59:59"; } qo.setTimeStart(timeStart); @@ -192,6 +221,42 @@ } /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴娑堣垂閲戦浣庝簬鎸囧畾鍊肩殑鍐滄埛 + * @param qo + * @return + */ + public QueryResultVo<List<VoClient>> getSmallAmountSpentClients(AmountSpentQO qo) { + /** + * 琛ラ綈璧锋鏃堕棿锛屽鏋滃紑濮嬫椂闂翠负绌猴紝鍒欓粯璁や负褰撳墠鏃ユ湡 + */ + String timeStart = qo.getTimeStart(); + String timeStop = qo.getTimeStop(); + if(timeStart != null && timeStart != "") { + timeStart = timeStart + " 00:00:00"; + } + if(timeStop != null && timeStop != "") { + timeStop = timeStop + " 23:59:59"; + } + qo.setTimeStart(timeStart); + qo.setTimeStop(timeStop); + + // 鐢熸垚鏌ヨ鍙傛暟 + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; + + // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟 + Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getSmallAmountSpentClientsCount(params)).orElse(0L); + + QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmOpenCloseValveHistoryMapper.getSmallAmountSpentClients(params); + return rsVo ; + } + + /** * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱瓒呰繃鎸囧畾鍊肩殑鍐滄埛 * @param qo * @return @@ -202,12 +267,10 @@ */ String timeStart = qo.getTimeStart(); String timeStop = qo.getTimeStop(); - if(timeStart != null) { + if(timeStart != null && timeStart != "") { timeStart = timeStart + " 00:00:00"; - }else { - timeStart = LocalDate.now() + " 00:00:00"; } - if(timeStop != null) { + if(timeStop != null && timeStop != "") { timeStop = timeStop + " 23:59:59"; } qo.setTimeStart(timeStart); @@ -230,13 +293,162 @@ } /** + * 鑾峰彇鎸囧畾鏃堕棿娈靛唴鐢ㄦ按鏃堕暱浣庝簬鎸囧畾鍊肩殑鍐滄埛 + * @param qo + * @return + */ + public QueryResultVo<List<VoClient>> getSmallWaterDurationClients(WaterDurationQO qo) { + /** + * 琛ラ綈璧锋鏃堕棿锛屽鏋滃紑濮嬫椂闂翠负绌猴紝鍒欓粯璁や负褰撳墠鏃ユ湡 + */ + String timeStart = qo.getTimeStart(); + String timeStop = qo.getTimeStop(); + if(timeStart != null && timeStart != "") { + timeStart = timeStart + " 00:00:00"; + } + if(timeStop != null && timeStop != "") { + timeStop = timeStop + " 23:59:59"; + } + qo.setTimeStart(timeStart); + qo.setTimeStop(timeStop); + + // 鐢熸垚鏌ヨ鍙傛暟 + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; + + // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟 + Long itemTotal = Optional.ofNullable(rmOpenCloseValveHistoryMapper.getSmallWaterDurationClientsCount(params)).orElse(0L); + + QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmOpenCloseValveHistoryMapper.getSmallWaterDurationClients(params); + return rsVo ; + } + + /** + * 鎸囧畾鏃堕棿娈靛唴寮�鐗╃悊鍗″啘鎴� + * @param qo + * @return + */ + public QueryResultVo<List<VoClientOpenCardCount>> getOpenIcCardClients(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"; + } + if (timeStop != null && timeStop != ""){ + timeStop = timeStop + " 23:59:59"; + }else { + timeStop = LocalDateTime.now().toString(); + } + qo.setTimeStart(timeStart); + qo.setTimeStop(timeStop); + + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); + Long itemTotal = seCardOperateMapper.getOpenIcCardClientsCount(params); + + QueryResultVo<List<VoClientOpenCardCount>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = seCardOperateMapper.getOpenIcCardClients(params); + return rsVo ; + } + + /** + * 鎸囧畾鏃堕棿娈靛唴姣忎釜鍐滄埛鍏呭�煎悎璁★紙鐗╃悊鍗★級 + * @param qo + * @return + */ + public QueryResultVo<List<VoClientRechargeTotal>> getRechargeTotalClients(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"; + } + if (timeStop != null && timeStop != ""){ + timeStop = timeStop + " 23:59:59"; + }else { + timeStop = LocalDateTime.now().toString(); + } + qo.setTimeStart(timeStart); + qo.setTimeStop(timeStop); + + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); + Long itemTotal = seCardOperateMapper.getRechargeTotalClientsCount(params); + + QueryResultVo<List<VoClientRechargeTotal>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = seCardOperateMapper.getRechargeTotalClients(params); + return rsVo ; + } + + /** + * 鎸囧畾鏃堕棿娈靛唴鐗╃悊鍗″厖鍊奸噾棰濊秴杩囨寚瀹氬�肩殑鍐滄埛 + * @param qo + * @return + */ + public QueryResultVo<List<VoClientRechargeTotal>> getRechargeTotalGtValueClients(RechargeTotalGtValueQo 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"; + } + if (timeStop != null && timeStop != ""){ + timeStop = timeStop + " 23:59:59"; + }else { + timeStop = LocalDateTime.now().toString(); + } + qo.setTimeStart(timeStart); + qo.setTimeStop(timeStop); + + if (qo.getValue() == null || qo.getValue() < 0){ + qo.setValue(0.0); + } + + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo); + Long itemTotal = seCardOperateMapper.getRechargeTotalGtValueClientsCount(params); + + QueryResultVo<List<VoClientRechargeTotal>> rsVo = new QueryResultVo<>() ; + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = seCardOperateMapper.getRechargeTotalGtValueClients(params); + return rsVo ; + } + + /** * 缁熻鎸囧畾鏈堜唤鍚勫啘鎴峰悇澶╃敤姘撮噺鍙婃秷璐归噾棰� * @param qo * @return */ public QueryResultVo<List<VoDayClient>> getDayAmountAndMoney(ClientAmountQO qo) throws ParseException { - Integer year = qo.getYearMonth().getYear(); - Integer month = qo.getYearMonth().getMonthValue(); + 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); qo.setMonth(month); @@ -281,4 +493,31 @@ rsVo.obj = rmClientAmountDayLastMapper.getMonthAmountAndMoney(params); return rsVo ; } + + /** + * 鏈�杩戞湭鍏呭�肩殑鍐滄埛 + * @param qo + * @return + */ + public QueryResultVo<List<VoClient>> getNotRechargeLastClients(CommonQO qo) { + String timeStart = qo.getTimeStart(); + if (timeStart != null && timeStart != ""){ + timeStart = timeStart + " 00:00:00"; + qo.setTimeStart(timeStart); + } + // 鐢熸垚鏌ヨ鍙傛暟 + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(qo) ; + + // 鑾峰彇绗﹀悎鏉′欢鐨勮褰曟暟 + Long itemTotal = Optional.ofNullable(rmClientAmountDayLastMapper.getNotRechargeLastClientsCount(params)).orElse(0L); + + QueryResultVo<List<VoClient>> rsVo = new QueryResultVo<>() ; + + rsVo.pageSize = qo.pageSize ; + rsVo.pageCurr = qo.pageCurr ; + + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = rmClientAmountDayLastMapper.getNotRechargeLastClients(params); + return rsVo ; + } } -- Gitblit v1.8.0