From fd35f223b7f40ee9ee4a9307384b54a96d7956a2 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 31 十月 2024 09:35:12 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java |   38 ++++++++++++++++++++++++++++++++------
 1 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java
index a663380..8c9284b 100644
--- a/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java
+++ b/ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java
@@ -63,15 +63,13 @@
     @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "列表")
     @PostMapping(value = "/page")
     public R<Page<TParkingRecord>> page(@RequestBody ParkingRecordPageQuery query) {
-        Page<TParkingRecord> page = parkingRecordService.lambdaQuery().ge(query.getStart() != null, TParkingRecord::getCreateTime, query.getStart())
-                .le(query.getEnd() != null, TParkingRecord::getCreateTime, query.getEnd())
+        Page<TParkingRecord> page = parkingRecordService.lambdaQuery()
                 .like(query.getLicensePlate() != null, TParkingRecord::getLicensePlate, query.getLicensePlate())
                 .eq(query.getStatus() != null, TParkingRecord::getStatus, query.getStatus())
                 .eq(query.getOutParkingType() != null, TParkingRecord::getOutParkingType, query.getOutParkingType())
                 .page(Page.of(query.getPageCurr(), query.getPageSize()));
 
         for (TParkingRecord record : page.getRecords()) {
-            record.setName(parkingLotService.getById(record.getParkingLotId()).getName());
             record.setUid(record.getId().toString());
         }
         return R.ok(page);
@@ -295,11 +293,39 @@
     @ApiOperation(value = "停车订单统计", tags = {"管理后台-工作台"})
     public R<TParkLotRecordCountVo> work(@RequestBody ParkingRecordQueryDto parkingRecordQueryDto){
         List<TParkingRecord> list = parkingRecordService.lambdaQuery().eq(parkingRecordQueryDto.getParkingLotId() != null, TParkingRecord::getParkingLotId, parkingRecordQueryDto.getParkingLotId())
-                .between(TParkingRecord::getCreateTime, parkingRecordQueryDto.getStartTime(), parkingRecordQueryDto.getEndTime()).list();
+                .ge(parkingRecordQueryDto.getStartTime()!=null,TParkingRecord::getCreateTime, parkingRecordQueryDto.getStartTime())
+                .le(parkingRecordQueryDto.getEndTime()!=null,TParkingRecord::getCreateTime, parkingRecordQueryDto.getEndTime().plusDays(1)).list();
         int count1 = list.size();
         //统计出list中chargingOrderId为null的数据个数
-        int count2 = list.stream().filter(item -> item.getChargingOrderId() == null).collect(Collectors.toList()).size();
-        int count3 = count1-count2;
+        int count2 = list.stream().filter(item -> item.getChargingOrderId() != null).collect(Collectors.toList()).size();
+        int count3 = list.stream().filter(item -> item.getOutParkingType() == 2).collect(Collectors.toList()).size();
+        //计算出list中parkingDuration的总和
+        int count4 = 0;
+        for (TParkingRecord tParkingRecord : list) {
+            count4 = count4+tParkingRecord.getParkingDuration();
+        }
+        //计算出list中orderAmount的总和
+        BigDecimal count5 = list.stream().map(TParkingRecord::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+
+        TParkLotRecordCountVo tParkLotRecordCountVo = new TParkLotRecordCountVo();
+        tParkLotRecordCountVo.setCount1(count1);
+        tParkLotRecordCountVo.setCount2(count2);
+        tParkLotRecordCountVo.setCount3(count3);
+        tParkLotRecordCountVo.setCount4(count4);
+        tParkLotRecordCountVo.setCount5(count5);
+
+        return R.ok(tParkLotRecordCountVo);
+
+    }
+    @ResponseBody
+    @PostMapping(value = "/parking/work1")
+    @ApiOperation(value = "停车订单统计", tags = {"管理后台-工作台"})
+    public R<TParkLotRecordCountVo> work1(@RequestBody ParkingRecordQueryDto parkingRecordQueryDto){
+        List<TParkingRecord> list = parkingRecordService.lambdaQuery().eq(parkingRecordQueryDto.getParkingLotId() != null, TParkingRecord::getParkingLotId, parkingRecordQueryDto.getParkingLotId()).list();
+        int count1 = list.size();
+        //统计出list中chargingOrderId为null的数据个数
+        int count2 = list.stream().filter(item -> item.getChargingOrderId() != null).collect(Collectors.toList()).size();
+        int count3 = list.stream().filter(item -> item.getOutParkingType() == 2).collect(Collectors.toList()).size();
         //计算出list中parkingDuration的总和
         int count4 = 0;
         for (TParkingRecord tParkingRecord : list) {

--
Gitblit v1.7.1