xp-robotaxi-api/src/main/java/com/xiaopeng/api/vo/order/XpHistoryEndPointsVo.java
@@ -30,8 +30,8 @@ private Integer time; @ApiModelProperty("operation_status 运营状态 1=待启用 2=启用中 3=已停用 4=已失效") private Integer operationStatus; @ApiModelProperty("operation_status 运营状态 1=展示 2置灰") private Integer operationStatus=2; private Long electronicAreaId; xp-robotaxi-api/src/main/java/com/xiaopeng/api/vo/order/XpHistoryStartPointsVo.java
@@ -30,8 +30,8 @@ private Integer time; @ApiModelProperty("operation_status 运营状态 1=待启用 2=启用中 3=已停用 4=已失效") private Integer operationStatus; @ApiModelProperty("operation_status 运营状态 1=展示 2置灰") private Integer operationStatus=2; private Long electronicAreaId; xp-robotaxi-itinerary-boot/src/main/java/com/xiaopeng/itinerary/service/impl/XpPricingServiceImpl.java
@@ -199,12 +199,12 @@ if(null == geocode){ throw new ServiceException("获取城市信息失败", I18nKeyConstant.CITY_NOT_FOUND); } String cityCode = geocode.get("cityCode"); List<XpOpenCity> openCities = xpOpenCityMapper.selectList(new LambdaQueryWrapper<XpOpenCity>().eq(XpOpenCity::getCityCode, cityCode)); if (openCities == null || openCities.isEmpty()) { Long cityCode = routeAndFareDto.getOpenCityId(); XpOpenCity openCities = xpOpenCityMapper.selectById(cityCode); if (openCities == null ) { throw new ServiceException("获取城市信息失败", I18nKeyConstant.CITY_NOT_FOUND); } XpOpenCity xpOpenCity = openCities.get(0); XpOpenCity xpOpenCity = openCities; routeAndFareDto.setOpenCityId(xpOpenCity.getId()); XpRoutePlan xpRoutePlan = xpRoutePlanMapper.selectOne(new LambdaQueryWrapper<XpRoutePlan>().eq(XpRoutePlan::getAuditStatus, 2).eq(XpRoutePlan::getCityCode, cityCode)); if (xpRoutePlan != null) { @@ -582,11 +582,11 @@ throw new ServiceException("获取城市信息失败", I18nKeyConstant.CITY_NOT_FOUND); } String cityCode = geocode.get("cityCode"); List<XpOpenCity> openCities = xpOpenCityMapper.selectList(new LambdaQueryWrapper<XpOpenCity>().eq(XpOpenCity::getCityCode, cityCode)); if (openCities == null || openCities.isEmpty()) { XpOpenCity openCities = xpOpenCityMapper.selectById(dto.getOpenCityId()); if (openCities == null) { throw new ServiceException("获取城市信息失败", I18nKeyConstant.CITY_NOT_FOUND); } XpOpenCity xpOpenCity = openCities.get(0); XpOpenCity xpOpenCity = openCities; dto.setOpenCityId(xpOpenCity.getId()); xpOrder.setCityCode(xpOpenCity.getCityCode()); XpRoutePlan xpRoutePlan = xpRoutePlanMapper.selectOne(new LambdaQueryWrapper<XpRoutePlan>().eq(XpRoutePlan::getAuditStatus, 2).eq(XpRoutePlan::getCityCode, xpOpenCity.getCityCode())); xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpChargingRecordController.java
@@ -67,7 +67,7 @@ Long id = tokenService.getLoginOperationUser().getId(); xpChargingRecordService.stopCharging(dto, id); //更新任务状态 xpTaskService.updateTaskStatus(dto.getTaskId(), 2); xpTaskService.updateTaskStatus(dto.getTaskId(), 2, id); return R.ok(); } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpVehicleCleanController.java
@@ -3,29 +3,20 @@ import com.xiaopeng.api.feignClient.account.XpOperationUserClient; import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; import com.xiaopeng.api.model.account.XpOperationsUser; import com.xiaopeng.api.model.maintenance.XpChargingRecord; import com.xiaopeng.api.model.maintenance.XpVehicleClean; import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; import com.xiaopeng.common.core.domain.R; import com.xiaopeng.common.security.service.TokenService; import com.xiaopeng.maintenance.dto.XpVehicleCleanDTO; import com.xiaopeng.maintenance.model.vo.XpChargingRecordVO; import com.xiaopeng.maintenance.model.vo.XpVehicleCleanVO; import com.xiaopeng.maintenance.service.IXpTaskService; import com.xiaopeng.maintenance.service.IXpVehicleCleanService; import com.xiaopeng.maintenance.service.XpTaskService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.shardingsphere.transaction.annotation.ShardingSphereTransactionType; import org.apache.shardingsphere.transaction.core.TransactionType; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import java.util.Objects; /** * <p> @@ -66,7 +57,7 @@ dto.setOperationsUserId(id); xpVehicleCleanService.save(dto); // 处理任务状态 xpTaskService.updateTaskStatus(dto.getTaskId(), 2); xpTaskService.updateTaskStatus(dto.getTaskId(), 2, id); return R.ok(); } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpVehicleDetectionController.java
@@ -3,14 +3,12 @@ import com.xiaopeng.api.feignClient.account.XpOperationUserClient; import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; import com.xiaopeng.api.model.maintenance.XpTask; import com.xiaopeng.common.core.domain.R; import com.xiaopeng.common.core.web.page.PageInfo; import com.xiaopeng.common.security.service.TokenService; import com.xiaopeng.maintenance.dto.XpVehicleDetectionDTO; import com.xiaopeng.maintenance.model.query.XpVehicleDetectionPageQuery; import com.xiaopeng.maintenance.model.vo.XpVehicleDetectionVO; import com.xiaopeng.maintenance.service.IXpTaskService; import com.xiaopeng.maintenance.service.IXpVehicleDetectionService; import com.xiaopeng.maintenance.service.XpTaskService; import io.swagger.annotations.Api; @@ -25,7 +23,6 @@ import java.time.LocalDateTime; import java.util.HashMap; import java.util.Map; import java.util.Objects; /** * <p> @@ -84,7 +81,7 @@ dto.setCheckTime(LocalDateTime.now()); xpVehicleDetectionService.save(dto); //更新任务状态 xpTaskService.updateTaskStatus(dto.getTaskId(), 2); xpTaskService.updateTaskStatus(dto.getTaskId(), 2, id); return R.ok(); } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/controller/XpVehiclePreparationController.java
@@ -57,7 +57,7 @@ dto.setOperationsUserId(id); xpVehiclePreparationService.save(dto); //更新任务状态 xpTaskService.updateTaskStatus(dto.getTaskId(), 2); xpTaskService.updateTaskStatus(dto.getTaskId(), 2, id); return R.ok(); } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskManagementChargingDetailVO.java
@@ -45,12 +45,14 @@ @ApiModelProperty(value = "开始充电图片") private String startChargingPicture; @ApiModelProperty(value = "开始充电时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime startTime; @ApiModelProperty(value = "结束剩余电量") private Integer endRemainingBattery; @ApiModelProperty(value = "结束充电图片") private String endChargingPicture; @ApiModelProperty(value = "结束充电时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime endTime; @ApiModelProperty(value = "开始充电操作人") private Long startOperationsUserId; xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskManagementPreparationDetailVO.java
@@ -78,6 +78,7 @@ @ApiModelProperty(value = "操作人名称") private String operationsUserName; @ApiModelProperty(value = "操作时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime operationsTime; xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskManagementRepairDetailVO.java
@@ -68,6 +68,7 @@ private String sendUserName; @ApiModelProperty(value = "送修时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime sendTime; @ApiModelProperty(value = "取回人") @@ -76,6 +77,7 @@ private String returnUserName; @ApiModelProperty(value = "取回时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime returnTime; } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskPreparationDetailVO.java
@@ -1,4 +1,4 @@ package com.xiaopeng.maintenance.vo; package com.xiaopeng.maintenance.model.vo; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; @@ -88,6 +88,7 @@ @ApiModelProperty(value = "操作人名称") private String operationsUserName; @ApiModelProperty(value = "操作时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime operationsTime; } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/model/vo/TaskRepairDetailVO.java
@@ -75,6 +75,7 @@ private String sendUserName; @ApiModelProperty(value = "送修时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime sendTime; @ApiModelProperty(value = "取回人") @@ -84,5 +85,6 @@ @ApiModelProperty(value = "取回时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime returnTime; } xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/XpTaskService.java
@@ -69,10 +69,12 @@ /** * 更新任务状态 * * @param taskId * @param status * @param id */ void updateTaskStatus(Long taskId, Integer status); void updateTaskStatus(Long taskId, Integer status, Long id); PageInfo<TaskManagementPageListVO> pageListManagement(TaskManagementPageListQuery query); xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpTaskServiceImpl.java
@@ -1,12 +1,10 @@ package com.xiaopeng.maintenance.service.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.xiaopeng.api.dto.account.XpOperationsUserQueryDTO; import com.xiaopeng.api.dto.pushMessage.AliPushMessageDTO; import com.xiaopeng.api.feignClient.account.SysUserClient; import com.xiaopeng.api.feignClient.account.XpOperationUserClient; @@ -15,13 +13,11 @@ import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetOperationsClient; import com.xiaopeng.api.feignClient.vehicleConvoy.XpFleetVehicleClient; import com.xiaopeng.api.feignClient.vehicleConvoy.XpVehicleClient; import com.xiaopeng.api.model.account.SysUser; import com.xiaopeng.api.model.account.XpOperationsRole; import com.xiaopeng.api.model.account.XpOperationsUser; import com.xiaopeng.api.model.account.XpOperationsUserNotification; import com.xiaopeng.api.model.maintenance.*; import com.xiaopeng.api.model.vehicleConvoy.XpVehicle; import com.xiaopeng.api.vo.account.XpOperationsUserWithRoleVO; import com.xiaopeng.api.vo.automaticPilot.VehiclePosition; import com.xiaopeng.api.vo.maintenance.TaskScheduleConstants; import com.xiaopeng.common.core.constant.AliPushTypeConstant; @@ -955,11 +951,14 @@ } @Override public void updateTaskStatus(Long taskId, Integer status) { public void updateTaskStatus(Long taskId, Integer status, Long operationUserId) { if (Objects.nonNull(taskId)) { XpTask task = this.getById(taskId); if (Objects.nonNull(task)) { this.lambdaUpdate().set(XpTask::getStatus, status).eq(XpTask::getId, taskId).update(); this.lambdaUpdate().set(XpTask::getStatus, status).eq(XpTask::getId, taskId) .set(XpTask::getHandleUserId, operationUserId) .set(XpTask::getHandleTime, LocalDateTime.now()) .update(); } } } xp-robotaxi-map-boot/src/main/java/com/xiaopeng/map/utils/GDMapGeocodingUtil.java
@@ -14,7 +14,10 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; /** * 高德地图的地理编码工具类 @@ -29,7 +32,200 @@ @Autowired private XpGeoFencingPolygonService xpGeoFencingPolygonService; // 自定义线程池配置 private static final int CORE_POOL_SIZE = 5; // 核心线程数 private static final int MAX_POOL_SIZE = 10; // 最大线程数 private static final long KEEP_ALIVE_TIME = 60L; // 线程空闲存活时间 private static final int QUEUE_CAPACITY = 100; // 阻塞队列容量 // 创建自定义线程池 private final ExecutorService customThreadPool = new ThreadPoolExecutor( CORE_POOL_SIZE, MAX_POOL_SIZE, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue<>(QUEUE_CAPACITY), new ThreadFactory() { private final AtomicInteger threadNumber = new AtomicInteger(1); @Override public Thread newThread(Runnable r) { Thread t = new Thread(r, "route-check-thread-" + threadNumber.getAndIncrement()); t.setDaemon(true); // 设置为守护线程,避免应用关闭时线程未停止 return t; } }, new ThreadPoolExecutor.CallerRunsPolicy() // 拒绝策略:调用线程执行 ); // public RouteVo getDistanceAndTime(LonLatDto start, LonLatDto end, String avoidRoads, String fenceId, Integer routePlanRule) { // RouteVo routeVo = new RouteVo(); // // String url = "https://tsapi.amap.com/v1/route/price?key=" + key + "&extensions=all&start=" + start.getLongitude() + "," + start.getLatitude(); // HashMap<String, Object> params = new HashMap<>(); // params.put("extensions", "all"); // params.put("start", start.getLongitude() + "," + start.getLatitude()); // params.put("end", end.getLongitude() + "," + end.getLatitude()); // params.put("routeUserType", 2); // if (avoidRoads != null && !avoidRoads.isEmpty()) { // params.put("voidPolygons", avoidRoads); // } // if (routePlanRule != null) { // params.put("strategy", routePlanRule); // } // // String post = HttpUtils.post(url, JSON.toJSONString(params)); // System.out.println("高德地图返回结果:" + post); // // JSONObject jsonObject = JSON.parseObject(post); // String data = jsonObject.getString("data"); // JSONObject jsonObject1 = JSON.parseObject(data); // JSONArray path = jsonObject1.getJSONArray("paths"); // // if (path == null || path.isEmpty()) { // return null; // } // // // 使用自定义线程池并行处理每个路径的围栏检查 // List<Future<PathCheckResult>> futures = new ArrayList<>(); // CountDownLatch latch = new CountDownLatch(path.size()); // 用于等待所有任务完成 // // // 提交每个路径的处理任务 // for (int j = 0; j < path.size(); j++) { // final int index = j; // JSONObject pathObject = path.getJSONObject(index); // // Future<PathCheckResult> future = customThreadPool.submit(() -> { // try { // PathCheckResult result = new PathCheckResult(); // result.setIndex(index); // result.setPathObject(pathObject); // // String points = pathObject.getString("points"); // String[] split = points.split(";"); // // // 检查点位是否在围栏内 // boolean inFence = checkPointsInFence(split, fenceId); // result.setInFence(inFence); // // return result; // } finally { // latch.countDown(); // 任务完成,计数器减1 // } // }); // // futures.add(future); // } // // try { // // 等待所有任务完成,设置超时时间 // if (!latch.await(10, TimeUnit.SECONDS)) { // System.out.println("路径检查任务超时"); // // 取消所有未完成的任务 // for (Future<PathCheckResult> future : futures) { // if (!future.isDone()) { // future.cancel(true); // } // } // } // } catch (InterruptedException e) { // Thread.currentThread().interrupt(); // System.out.println("路径检查任务被中断"); // return null; // } // // // 收集处理结果,找到第一个不在围栏内的路径 // PathCheckResult validPathResult = null; // // for (Future<PathCheckResult> future : futures) { // try { // if (future.isDone() && !future.isCancelled()) { // PathCheckResult result = future.get(); // if (!result.isInFence()) { // validPathResult = result; // break; // 找到有效的就停止 // } // } // } catch (InterruptedException | ExecutionException e) { // System.out.println("获取路径检查结果失败: " + e.getMessage()); // e.printStackTrace(); // } // } // // // 如果找到了有效路径,处理该路径数据 // if (validPathResult != null) { // JSONObject validPath = validPathResult.getPathObject(); // String routeID = validPath.getString("routeID"); // String points = validPath.getString("points"); // String[] split = points.split(";"); // // Integer costTime = validPath.getInteger("costTime"); // Integer distance = validPath.getInteger("distance"); // // routeVo.setDistance(distance); // routeVo.setDuration(costTime); // // ArrayList<LonLatDto> lonLatDtos = new ArrayList<>(split.length); // for (String s : split) { // String[] split1 = s.split(","); // LonLatDto lonLatDto = new LonLatDto(Double.parseDouble(split1[0]), Double.parseDouble(split1[1])); // lonLatDtos.add(lonLatDto); // } // routeVo.setPolyline(lonLatDtos); // routeVo.setRouteID(routeID); // // return routeVo; // } // // return null; // } /** * 路径检查结果内部类 */ private static class PathCheckResult { private int index; private JSONObject pathObject; private boolean inFence; // true: 所有点都在围栏内, false: 有点不在围栏内 public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } public JSONObject getPathObject() { return pathObject; } public void setPathObject(JSONObject pathObject) { this.pathObject = pathObject; } public boolean isInFence() { return inFence; } public void setInFence(boolean inFence) { this.inFence = inFence; } } /** * 检查路径点位是否在围栏内 */ private boolean checkPointsInFence(String[] points, String fenceId) { // 取5分之一的点位进行检查 for (int i = 0; i < points.length; i++) { if (i % 5 == 0) { String[] split1 = points[i].split(","); LonLatDto lonLatDto = new LonLatDto(Double.parseDouble(split1[0]), Double.parseDouble(split1[1])); if (!xpGeoFencingPolygonService.isInFence(lonLatDto.getLongitude(), lonLatDto.getLatitude(), fenceId, "operating_area")) { return false; // 有点位不在围栏内 } } } return true; // 所有检查的点都在围栏内 } /** * 根据起始点获取驾车距离 和 时间 以及避让区域 @@ -75,7 +271,7 @@ int temp=0; // 取5分之一的点位 for (int i = 0; i < split.length; i++) { if (i % 5 == 0) { if (i % 10 == 0) { String[] split1 = split[i].split(","); LonLatDto lonLatDto = new LonLatDto(Double.parseDouble(split1[0]), Double.parseDouble(split1[1])); if (!xpGeoFencingPolygonService.isInFence(lonLatDto.getLongitude(), lonLatDto.getLatitude(), fenceId, "operating_area")) { xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpInvitationCodeController.java
@@ -347,14 +347,12 @@ } @ApiOperation(value = "校验生成邀请码的手机号是否合法") @PostMapping("/api/v1/invitation/validateCode") public R<Boolean> validateCode(@RequestParam String phone){ if (!PhoneUtil.isMobile(phone)){ return R.ok(false); } List<XpInvitationCode> existsList = xpInvitationCodeService.lambdaQuery() .in(XpInvitationCode::getBindAccount, phone) .list(); return R.ok(CollUtil.isEmpty(existsList)); @GetMapping("/api/v1/invitation/validateCode") public R<List<String>> validateCode(@RequestParam String phone){ List<String> phoneList = Arrays.asList(phone.split(",")); List<String> existPhones = phoneList.stream().filter(item -> xpInvitationCodeService.lambdaQuery() .in(XpInvitationCode::getBindAccount, item) .count() > 0).collect(Collectors.toList()); return R.ok(existPhones); } } xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpPointServiceImpl.java
@@ -225,7 +225,57 @@ public List<XpHistoryStartPointsVo> getHistoryStartPoints(HistoryStartPointsDto historyStartPointsDto) { List<XpPoint> xpPoints = this.baseMapper.selectBatchIds(historyStartPointsDto.getPointIds()); ArrayList<XpHistoryStartPointsVo> resultList = new ArrayList<>(10); LocalTime now = LocalTime.now(); List<Long> areaIds = xpPoints.stream().map(XpPoint::getElectronicAreaId).collect(Collectors.toList()); List<XpElectronicFenceArea> xpElectronicFenceAreas = xpElectronicFenceAreaService.listByIds(areaIds); List<Long> fenceIds = xpElectronicFenceAreas.stream().map(XpElectronicFenceArea::getElectronicId).collect(Collectors.toList()); List<XpElectronicFence> xpElectronicFences = new ArrayList<>(); if (CollUtil.isNotEmpty(fenceIds)) { xpElectronicFences = xpElectronicFenceService.listByIds(fenceIds); } for (XpPoint xpPoint : xpPoints) { if(xpPoint.getOperationStatus()!=2){ continue; } Integer operationType = xpPoint.getOperationType(); if(1 == operationType){ //与运营区同步 XpElectronicFenceArea xpElectronicFenceArea = xpElectronicFenceAreas.stream().filter(s -> s.getId().equals(xpPoint.getElectronicAreaId())).findFirst().orElse(null); if(null == xpElectronicFenceArea){ // 不在运营段 continue; } XpElectronicFence xpElectronicFence = xpElectronicFences.stream().filter(s -> s.getId().equals(xpElectronicFenceArea.getElectronicId())).findFirst().orElse(null); if(null == xpElectronicFence){ // 不在运营段 continue; } //失效类型 1=永不失效 2=定时失效 Integer failureType = xpElectronicFence.getFailureType(); //永不失效,但是还未到开始时间 if(1 == failureType && LocalDateTime.now().isBefore(xpElectronicFence.getEffectTime())){ continue; }else if(2 == failureType && (LocalDateTime.now().isBefore(xpElectronicFence.getEffectTime()) || LocalDateTime.now().isAfter(xpElectronicFence.getFailureTime()))){ //定时失效,但是当前时间不在时间范围内 continue; } }else{ //自定义时间段 // 判断是否在时间段内 boolean intime = getInTime(now, xpPoint.getEffectivePeriod(), xpPoint.getEffectiveTimePeriod()); if (!intime) { // 不在运营段 continue; } } XpHistoryStartPointsVo xpHistoryStartPointsVo = new XpHistoryStartPointsVo(); xpHistoryStartPointsVo.setOperationStatus(xpPoint.getOperationStatus()); xpHistoryStartPointsVo.setName(xpPoint.getPointName()); @@ -248,7 +298,57 @@ public List<XpHistoryEndPointsVo> getHistoryEndPoints(HistoryEndPointsDto historyEndPointsDto) { List<XpPoint> xpPoints = this.baseMapper.selectBatchIds(historyEndPointsDto.getPointIds()); ArrayList<XpHistoryEndPointsVo> resultList = new ArrayList<>(10); LocalTime now = LocalTime.now(); List<Long> areaIds = xpPoints.stream().map(XpPoint::getElectronicAreaId).collect(Collectors.toList()); List<XpElectronicFenceArea> xpElectronicFenceAreas = xpElectronicFenceAreaService.listByIds(areaIds); List<Long> fenceIds = xpElectronicFenceAreas.stream().map(XpElectronicFenceArea::getElectronicId).collect(Collectors.toList()); List<XpElectronicFence> xpElectronicFences = new ArrayList<>(); if (CollUtil.isNotEmpty(fenceIds)) { xpElectronicFences = xpElectronicFenceService.listByIds(fenceIds); } for (XpPoint xpPoint : xpPoints) { if(xpPoint.getOperationStatus()!=2){ continue; } Integer operationType = xpPoint.getOperationType(); if(1 == operationType){ //与运营区同步 XpElectronicFenceArea xpElectronicFenceArea = xpElectronicFenceAreas.stream().filter(s -> s.getId().equals(xpPoint.getElectronicAreaId())).findFirst().orElse(null); if(null == xpElectronicFenceArea){ // 不在运营段 continue; } XpElectronicFence xpElectronicFence = xpElectronicFences.stream().filter(s -> s.getId().equals(xpElectronicFenceArea.getElectronicId())).findFirst().orElse(null); if(null == xpElectronicFence){ // 不在运营段 continue; } //失效类型 1=永不失效 2=定时失效 Integer failureType = xpElectronicFence.getFailureType(); //永不失效,但是还未到开始时间 if(1 == failureType && LocalDateTime.now().isBefore(xpElectronicFence.getEffectTime())){ continue; }else if(2 == failureType && (LocalDateTime.now().isBefore(xpElectronicFence.getEffectTime()) || LocalDateTime.now().isAfter(xpElectronicFence.getFailureTime()))){ //定时失效,但是当前时间不在时间范围内 continue; } }else{ //自定义时间段 // 判断是否在时间段内 boolean intime = getInTime(now, xpPoint.getEffectivePeriod(), xpPoint.getEffectiveTimePeriod()); if (!intime) { // 不在运营段 continue; } } XpHistoryEndPointsVo xpHistoryEndPointsVo = new XpHistoryEndPointsVo(); xpHistoryEndPointsVo.setOperationStatus(xpPoint.getOperationStatus()); xpHistoryEndPointsVo.setName(xpPoint.getPointName()); xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/service/impl/XpOrderServiceImpl.java
@@ -530,7 +530,7 @@ //取消订单:在未接到乘客前都可以,关闭订单,在送达目的地可以操作关闭 if (type == 1) { // 取消订单:只有待接单(1)、待出发(2)、接驾中(3)状态可以取消 if (currentStatus != 1 && currentStatus != 2 && currentStatus != 3) { if (currentStatus != 1 && currentStatus != 2 && currentStatus != 3 && currentStatus != 4) { throw new ServiceException("当前订单状态不允许取消,只有待接单、待出发、接驾中状态的订单可以取消", I18nKeyConstant.ORDER_CANCEL_FAILED); } } else { @@ -1017,6 +1017,14 @@ List<XpHistoryStartPointsVo> data = r.getData(); for (XpHistoryStartPointsVo datum : data) { if(datum.getOperationStatus()==2){ datum.setOperationStatus(1); } // 保留2位数小数 Double distance = datum.getDistance(); datum.setDistance(BigDecimal.valueOf(distance).setScale(2, RoundingMode.HALF_UP).doubleValue()); xp-robotaxi-order-boot/src/main/java/com/xiaopeng/order/utils/TaxiPricingDemoService.java
@@ -21,7 +21,9 @@ // // 模拟总里程 25.0 km,以触发多级远途加价 double totalMillige = 2.984; Calendar cal = Calendar.getInstance(); cal.set(2026, Calendar.APRIL, 11, 15, 58, 15); orderTime = cal.getTime(); // 模拟 GPS 轨迹点 List<GpsPoint> points = createMockGpsPoints(orderTime); @@ -121,7 +123,7 @@ if(ruleName.endsWith("_Ml")){ BigDecimal exceedValue = bill.get(ruleName); if(Objects.nonNull(exceedValue)){ // result.put("distance"+split[0], result.getOrDefault(split[0], BigDecimal.ZERO).add(exceedValue)); result.put("distance"+split[0], result.getOrDefault(split[0], BigDecimal.ZERO).add(exceedValue)); exceedValue = exceedValue.divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP); }else{ exceedValue = BigDecimal.ZERO; xp-robotaxi-order-boot/src/main/resources/mapper/order/XpOrderMapper.xml
@@ -61,7 +61,6 @@ FROM xp_order where app_user_id = #{uid} GROUP BY start_point_id ORDER BY num DESC,create_time desc LIMIT 10; </select> <select id="getHistoryEndPoints" resultType="com.xiaopeng.api.model.order.XpOrder" parameterType="java.lang.Long"> @@ -71,7 +70,6 @@ FROM xp_order where app_user_id = #{uid} GROUP BY end_point_id ORDER BY num DESC,create_time desc LIMIT 10; </select> </mapper>