puzhibing
2024-11-11 ae84ae528290f44c66ef14c92f4a68bd3c1ce617
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TParkingRecordServiceImpl.java
@@ -59,13 +59,27 @@
                        .eq(TParkingLot::getSiteId, site.getId()));
                List<Integer> lotIds = tParkingLots.stream().map(TParkingLot::getId).collect(Collectors.toList());
                if(CollectionUtils.isEmpty(lotIds)){
                    return new TParkingRecordPageInfoVO();
                    TParkingRecordPageInfoVO tParkingRecordPageInfoVO = new TParkingRecordPageInfoVO();
                    tParkingRecordPageInfoVO.setParkingRecordVOS(new PageInfo<TParkingRecordVO>());
                    return tParkingRecordPageInfoVO;
                }
                query.setLotIds(lotIds);
            }
        }
        List<TParkingRecordVO> list = this.baseMapper.pageList(query,pageInfo);
        for (TParkingRecordVO tParkingRecordVO : list) {
            if (tParkingRecordVO.getParkingDuration()==null){
                tParkingRecordVO.setFeeDuration(0);
            }else if(tParkingRecordVO.getFreeDuration()==null){
                tParkingRecordVO.setFeeDuration(tParkingRecordVO.getParkingDuration());
            }else{
                tParkingRecordVO.setFeeDuration(tParkingRecordVO.getParkingDuration()-tParkingRecordVO.getFreeDuration());
            }
            tParkingRecordVO.setOrderAmount(tParkingRecordVO.getOrderAmount()!=null?tParkingRecordVO.getOrderAmount():new BigDecimal("0")
                    .add(tParkingRecordVO.getTimeoutAmount()!=null?tParkingRecordVO.getTimeoutAmount():new BigDecimal("0")));
            tParkingRecordVO.setParkingFee(tParkingRecordVO.getOrderAmount());
        }
        pageInfo.setRecords(list);
        // 查询总数
        TParkingRecordPageInfoVO infoVO = this.baseMapper.getParkingRecordCount(query);