Pu Zhibing
2024-12-11 dcd97d683792b5d47cc13966b24e3bbb92ee9854
ruoyi-service/ruoyi-chargingPile/src/main/java/com/ruoyi/chargingPile/service/impl/TParkingRecordServiceImpl.java
@@ -6,10 +6,8 @@
import com.ruoyi.chargingPile.api.model.TParkingLot;
import com.ruoyi.chargingPile.api.model.TParkingRecord;
import com.ruoyi.chargingPile.api.query.ParkingRecordQuery;
import com.ruoyi.chargingPile.api.vo.TParkingLotVO;
import com.ruoyi.chargingPile.api.vo.TParkingRecordPageInfoVO;
import com.ruoyi.chargingPile.api.vo.TParkingRecordVO;
import com.ruoyi.chargingPile.domain.SiteMenu;
import com.ruoyi.chargingPile.dto.ParkingRecordQueryDto;
import com.ruoyi.chargingPile.mapper.SiteMapper;
import com.ruoyi.chargingPile.mapper.TParkingLotMapper;
@@ -59,13 +57,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);