| | |
| | | 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()) |
| | | .between(TParkingRecord::getCreateTime, parkingRecordQueryDto.getStartTime(), parkingRecordQueryDto.getEndTime()).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; |
| | | //计算出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/income") |