liujie
2026-06-09 c96fbe6b0aeb413a17c429133ee6d81d138144b9
xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/service/serviceimpl/XpPointServiceImpl.java
@@ -43,6 +43,7 @@
import com.xiaopeng.map.service.XpElectronicFenceService;
import com.xiaopeng.map.service.XpPointService;
import com.xiaopeng.map.service.XpStationService;
import com.xiaopeng.map.utils.GDMapGeocodingUtil;
import com.xiaopeng.map.utils.holiday.HolidayUtil;
import com.xiaopeng.map.utils.map.map.FastDistanceCalculator;
import com.xiaopeng.map.vo.*;
@@ -122,6 +123,8 @@
    @Lazy
    @Resource
    private XpElectronicFenceService xpElectronicFenceService;
    @Resource
    private GDMapGeocodingUtil gdMapGeocodingUtil;
@@ -186,6 +189,12 @@
        xpPoint.setFpElectronicAreaId(pointAddDto.getElectronicAreaId());
        xpPoint.setPointNumber(pointNumber);
        xpPoint.setStationSortNo(0);
        Map<String, String> geocode = gdMapGeocodingUtil.geocode(xpPoint.getPointLon().toString(), xpPoint.getPointLat().toString());
        if(null == geocode){
            throw new ServiceException("点位定位解析失败");
        }
        xpPoint.setCityCode(geocode.get("cityCode"));
        xpPoint.setCityName(geocode.get("address"));
        this.save(xpPoint);
        //场站点位排序 后添加的点位 排第一个。
@@ -231,7 +240,7 @@
            if (!locked) {
                throw new ServiceException("点位编号生成繁忙,请稍后重试", I18nKeyConstant.POINT_NUMBER_LOCK_FAIL);
            }
            validateFencePointCountLimit(pointAddDto.getElectronicAreaId());
//            validateFencePointCountLimit(electronicAreaId);
            String maxPointNumber = this.baseMapper.selectMaxPointNumber(cityPrefix, POINT_BIZ_TYPE);
            int nextSerial = 1;
            if (StringUtils.hasText(maxPointNumber)) {
@@ -302,6 +311,12 @@
            if (!intime) {
                continue;
            }
            Integer parkingTimeLimit = xpPoint.getParkingTimeLimit();
            //如果点位位于场站内,则使用场站的限停时间
            if(null != xpPoint.getStationId()){
                XpStation xpStation = xpStationService.getById(xpPoint.getStationId());
                parkingTimeLimit = xpStation.getParkingTimeLimit();
            }
            // 计算距离 小于的站点
            double v = FastDistanceCalculator.distanceFast(dto.getLatitude(), dto.getLongitude(), xpPoint.getPointLat(), xpPoint.getPointLon());
            if (v < orderDistance) {
@@ -312,7 +327,7 @@
                nearestNextVo.setLongitude(xpPoint.getPointLon());
                nearestNextVo.setDistance(v);
                nearestNextVo.setAddress(xpPoint.getPointAddress());
                nearestNextVo.setTime(xpPoint.getParkingTimeLimit());
                nearestNextVo.setTime(parkingTimeLimit);
                nearestNextVo.setElectronicAreaId(xpPoint.getElectronicAreaId());
@@ -433,36 +448,7 @@
    @Override
    public List<XpPoint> listAll(PointListQuery query) {
        List<XpPoint> list = this.baseMapper.listAll(query);
        for (XpPoint xpPoint : list) {
            String pointPictures = xpPoint.getPointPictures();
            log.info("pointPictures:{}", pointPictures);
            if (StringUtils.isNotBlank(pointPictures)) {
                log.info("pointPictures进入处理:{}", pointPictures);
                JSONArray jsonArray = JSONArray.parseArray(pointPictures);
                for (int i = 0; i < jsonArray.size(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);
                    if (Objects.isNull(jsonObject)) {
                        continue;
                    }
                    String downloadUrl ="";
//                    try { todo 20260422 yyy暂时注释
//                        downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
//                        log.info("downloadUrl:{}", downloadUrl);
//                    } catch (UnsupportedEncodingException e) {
//                        log.error("获取图片下载地址失败", e);
//                    }
                    jsonObject.put("url", downloadUrl);
                }
                log.info("jsonArray:{}", jsonArray);
                xpPoint.setPointPictures(JSONArray.toJSONString(jsonArray));
                log.info("xpPoint:{}", xpPoint.getPointPictures());
            }
        }
        return list;
        return this.baseMapper.listAll(query);
    }
    @Override
@@ -470,6 +456,12 @@
        List<XpPoint> xpPoints = this.baseMapper.selectBatchIds(historyStartPointsDto.getPointIds());
        ArrayList<XpHistoryStartPointsVo> resultList = new ArrayList<>(10);
        for (XpPoint xpPoint : xpPoints) {
            Integer parkingTimeLimit = xpPoint.getParkingTimeLimit();
            //如果点位位于场站内,则使用场站的限停时间
            if(null != xpPoint.getStationId()){
                XpStation xpStation = xpStationService.getById(xpPoint.getStationId());
                parkingTimeLimit = xpStation.getParkingTimeLimit();
            }
            XpHistoryStartPointsVo xpHistoryStartPointsVo = new XpHistoryStartPointsVo();
            xpHistoryStartPointsVo.setName(xpPoint.getPointName());
            xpHistoryStartPointsVo.setAddress(xpPoint.getPointAddress());
@@ -478,7 +470,7 @@
            xpHistoryStartPointsVo.setId(xpPoint.getId());
            double distanced = FastDistanceCalculator.distanceFastKm(historyStartPointsDto.getLat(), historyStartPointsDto.getLon(), xpPoint.getPointLat(), xpPoint.getPointLon());
            xpHistoryStartPointsVo.setDistance(distanced);
            xpHistoryStartPointsVo.setTime(xpPoint.getParkingTimeLimit());
            xpHistoryStartPointsVo.setTime(parkingTimeLimit);
            xpHistoryStartPointsVo.setElectronicAreaId(xpPoint.getElectronicAreaId());
            resultList.add(xpHistoryStartPointsVo);
@@ -492,6 +484,12 @@
        List<XpPoint> xpPoints = this.baseMapper.selectBatchIds(historyEndPointsDto.getPointIds());
        ArrayList<XpHistoryEndPointsVo> resultList = new ArrayList<>(10);
        for (XpPoint xpPoint : xpPoints) {
            Integer parkingTimeLimit = xpPoint.getParkingTimeLimit();
            //如果点位位于场站内,则使用场站的限停时间
            if(null != xpPoint.getStationId()){
                XpStation xpStation = xpStationService.getById(xpPoint.getStationId());
                parkingTimeLimit = xpStation.getParkingTimeLimit();
            }
            XpHistoryEndPointsVo xpHistoryEndPointsVo = new XpHistoryEndPointsVo();
            xpHistoryEndPointsVo.setName(xpPoint.getPointName());
            xpHistoryEndPointsVo.setAddress(xpPoint.getPointAddress());
@@ -500,7 +498,7 @@
            xpHistoryEndPointsVo.setId(xpPoint.getId());
            double distanced = FastDistanceCalculator.distanceFastKm(historyEndPointsDto.getLat(), historyEndPointsDto.getLon(), xpPoint.getPointLat(), xpPoint.getPointLon());
            xpHistoryEndPointsVo.setDistance(distanced);
            xpHistoryEndPointsVo.setTime(xpPoint.getParkingTimeLimit());
            xpHistoryEndPointsVo.setTime(parkingTimeLimit);
            xpHistoryEndPointsVo.setElectronicAreaId(xpPoint.getElectronicAreaId());
            resultList.add(xpHistoryEndPointsVo);
        }
@@ -702,7 +700,8 @@
                query.setPointLonAndLat(null);
            }
        }
        List<XpPoint> list = this.pageList(pageInfo,query);
        List<XpPoint> list = this.baseMapper.pageList(pageInfo,query);
        list.forEach(s->s.setStrId(s.getId().toString()));
        pageInfo.setRecords(list);
        return pageInfo;
    }
@@ -795,7 +794,7 @@
            return Collections.emptySet();
        }
    }
    @Override
    public List<XpPoint> listByStationId(Long stationId) {
        if (stationId == null) {
@@ -805,7 +804,7 @@
                .eq(XpPoint::getStationId, stationId)
                .list();
    }
    @Transactional(rollbackFor = Exception.class)
    @Override
    public void clearStationInfoByStationId(Long stationId) {