luodangjia
2024-12-06 7af1a7e0a64c3491ea8c4386cba7fae948dcd5f2
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TParkingRecordServiceImpl.java
@@ -59,13 +59,25 @@
                        .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());
            }
        }
        pageInfo.setRecords(list);
        // 查询总数
        TParkingRecordPageInfoVO infoVO = this.baseMapper.getParkingRecordCount(query);