From c564930d687e421e4e35d7fcafadc6d11ff23b9c Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期二, 05 十一月 2024 19:07:44 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/controller/TParkingRecordController.java | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 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 8c9284b..b071b25 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 @@ -37,6 +37,7 @@ import java.math.BigDecimal; import java.net.URLEncoder; import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.HashMap; @@ -63,14 +64,28 @@ @ApiOperation(tags = {"后台-订单管理-停车记录"},value = "列表") @PostMapping(value = "/page") public R<Page<TParkingRecord>> page(@RequestBody ParkingRecordPageQuery query) { + String s1 = ""; + String s2 = ""; + if (query.getTimePeriod()!=null){ + s1 = query.getTimePeriod().split(" - ")[0]; + s2 = query.getTimePeriod().split(" - ")[1]; + } 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()) + .between(query.getTimePeriod()!=null,TParkingRecord::getInParkingTime,s1,s2) + .or() + .between(query.getTimePeriod()!=null,TParkingRecord::getOutParkingTime,s1,s2) + .orderByDesc(TParkingRecord::getCreateTime) .page(Page.of(query.getPageCurr(), query.getPageSize())); for (TParkingRecord record : page.getRecords()) { + TParkingLot byId = parkingLotService.getById(record.getParkingLotId()); record.setUid(record.getId().toString()); + if (byId!=null) { + record.setParkName(byId.getName()); + } } return R.ok(page); } @@ -137,6 +152,7 @@ public R out(Long id) { TParkingRecord byId = parkingRecordService.getById(id); byId.setStatus(2); + byId.setOutParkingTime(LocalDateTime.now()); parkingRecordService.updateById(byId); return R.ok(); @@ -199,7 +215,7 @@ List<Map<String, Object>> charMap = new ArrayList<>(); - // 生成从 "00:00" 到 "23:00" 的时间数据 + // 生成从 "00:00" 到 "23:00" 的时间数据------- for (int hour = 0; hour < 24; hour++) { String time = String.format("%02d:00", hour); Map<String, Object> mapWithTimeValue = findMapWithTimeValue(maps, time); @@ -292,7 +308,7 @@ @PostMapping(value = "/parking/work") @ApiOperation(value = "停车订单统计", tags = {"管理后台-工作台"}) public R<TParkLotRecordCountVo> work(@RequestBody ParkingRecordQueryDto parkingRecordQueryDto){ - List<TParkingRecord> list = parkingRecordService.lambdaQuery().eq(parkingRecordQueryDto.getParkingLotId() != null, TParkingRecord::getParkingLotId, parkingRecordQueryDto.getParkingLotId()) + List<TParkingRecord> list = parkingRecordService.lambdaQuery().isNotNull(TParkingRecord::getOutParkingType).eq(parkingRecordQueryDto.getParkingLotId() != null, TParkingRecord::getParkingLotId, parkingRecordQueryDto.getParkingLotId()) .ge(parkingRecordQueryDto.getStartTime()!=null,TParkingRecord::getCreateTime, parkingRecordQueryDto.getStartTime()) .le(parkingRecordQueryDto.getEndTime()!=null,TParkingRecord::getCreateTime, parkingRecordQueryDto.getEndTime().plusDays(1)).list(); int count1 = list.size(); @@ -321,7 +337,7 @@ @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(); + List<TParkingRecord> list = parkingRecordService.lambdaQuery().isNotNull(TParkingRecord::getOutParkingType).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(); -- Gitblit v1.7.1