puzhibing
2026-03-24 faae742fccc00d629ede627819cdc9d8a4ec25d3
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpTestPlanServiceImpl.java
@@ -170,24 +170,35 @@
        }
        List<XpTestPlanPoint> planPoints = xpTestPlanPointService.lambdaQuery()
                .eq(XpTestPlanPoint::getTestPlanId, id)
                .orderByAsc(XpTestPlanPoint::getSortOrder)
                .list();
        List<Long> pointIds = planPoints.stream()
                .map(XpTestPlanPoint::getTestPointId)
                .map(XpTestPlanPoint::getStartTestPointId)
                .filter(Objects::nonNull)
                .collect(Collectors.toList());
        List<Long> pointIds1 = planPoints.stream()
                .map(XpTestPlanPoint::getEndTestPointId)
                .filter(Objects::nonNull)
                .collect(Collectors.toList());
        pointIds.addAll(pointIds1);
        Map<Long, XpTestPoint> pointMap = CollUtil.isNotEmpty(pointIds)
                ? xpTestPointService.listByIds(pointIds).stream()
                .collect(Collectors.toMap(XpTestPoint::getId, v -> v))
                : Collections.emptyMap();
        List<XpTestPlanPointVO> pointList = planPoints.stream().map(planPoint -> {
            XpTestPlanPointVO vo = new XpTestPlanPointVO();
            vo.setPointId(planPoint.getTestPointId());
            vo.setSortOrder(planPoint.getSortOrder());
            XpTestPoint point = pointMap.get(planPoint.getTestPointId() == null ? null : planPoint.getTestPointId().longValue());
            vo.setStartTestPointId(planPoint.getStartTestPointId());
            vo.setEndTestPointId(planPoint.getEndTestPointId());
            vo.setStopFlag(planPoint.getStopFlag());
            vo.setTestOrderType(planPoint.getTestOrderType());
            XpTestPoint point = pointMap.get(planPoint.getStartTestPointId() == null ? null : planPoint.getStartTestPointId().longValue());
            if (point != null) {
                vo.setPointName(point.getPointName());
                vo.setPointAddress(point.getPointAddress());
                vo.setStartTestPointName(point.getPointName());
                vo.setStartTestPointAddress(point.getPointAddress());
            }
            XpTestPoint point1 = pointMap.get(planPoint.getEndTestPointId() == null ? null : planPoint.getEndTestPointId().longValue());
            if (point != null) {
                vo.setEndTestPointName(point1.getPointName());
                vo.setEndTestPointAddress(point1.getPointAddress());
            }
            return vo;
        }).collect(Collectors.toList());
@@ -288,13 +299,10 @@
        }
        Set<Long> pointIdSet = new HashSet<>();
        for (XpTestPlanAddDTO.TestPlanPointDTO pointDTO : pointList) {
            if (pointDTO.getPointId() == null || pointDTO.getSortOrder() == null || pointDTO.getStopFlag() == null) {
            if (pointDTO.getStartTestPointId() == null || pointDTO.getEndTestPointId() == null) {
                throw new ServiceException("点位参数不完整", I18nKeyConstant.CRUISE_PLAN_POINT_INCOMPLETE);
            }
            if (pointDTO.getStopFlag() != 0 && pointDTO.getStopFlag() != 1) {
                throw new ServiceException("点位停车标识不合法", I18nKeyConstant.CRUISE_PLAN_STOP_FLAG_INVALID);
            }
            if (!pointIdSet.add(pointDTO.getPointId())) {
            if (!pointIdSet.add(pointDTO.getStartTestPointId()) || !pointIdSet.add(pointDTO.getEndTestPointId())) {
                throw new ServiceException("点位ID重复", I18nKeyConstant.CRUISE_PLAN_POINT_DUPLICATE);
            }
        }
@@ -353,9 +361,8 @@
        for (XpTestPlanAddDTO.TestPlanPointDTO pointDTO : pointList) {
            XpTestPlanPoint point = new XpTestPlanPoint();
            point.setTestPlanId(planId);
            point.setTestPlanId(pointDTO.getPointId());
            point.setSortOrder(pointDTO.getSortOrder());
            point.setStopFlag(pointDTO.getStopFlag());
            point.setStartTestPointId(pointDTO.getStartTestPointId());
            point.setEndTestPointId(pointDTO.getEndTestPointId());
            result.add(point);
        }
        return result;