puzhibing
2026-03-10 52492c65b3229425f806e16faf4fe062b8dccfe2
合并代码
4个文件已修改
97 ■■■■■ 已修改文件
xp-robotaxi-api/src/main/java/com/xiaopeng/api/dto/pushMessage/PushOrderRouteDTO.java 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/controller/OrderMissionController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpSchedulingDetailServiceImpl.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/utils/TaskOrderUtil.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
xp-robotaxi-api/src/main/java/com/xiaopeng/api/dto/pushMessage/PushOrderRouteDTO.java
@@ -23,11 +23,11 @@
    @ApiModelProperty(value = "纬度")
    private Double latitude;
    @NotNull(message = "剩余距离不能为空")
//    @NotNull(message = "剩余距离不能为空")
    @ApiModelProperty(value = "剩余距离")
    private Integer distance;
    @NotNull(message = "剩余时间不能为空")
//    @NotNull(message = "剩余时间不能为空")
    @ApiModelProperty(value = "剩余时间")
    private Integer duration;
xp-robotaxi-automatic-pilot-boot/src/main/java/com/xiaopeng/automaticPilot/controller/OrderMissionController.java
@@ -159,6 +159,11 @@
        snowFlake.withStartTimestamp(1420041600000L);
        long sequence = snowFlake.nextId();
        MqttPublishDto mqttPublishDto = xpuUtil.cloudCreateOrder(taskListBuilder.build(), dto.getVin(),sequence);
        //先将车辆修改状态,防止在异步通知之前被其他订单选中
        if (!dto.getOrderId().contains("XU") && mqttPublishDto.getCode()== 200) {
            // 修改车子为接单状态
            xpVehicleClient.updateVehicleStatus(new UpdateVehicleStateDto(dto.getVin(), 1));
        }
        if(null != mqttPublishDto && mqttPublishDto.getCode() == 200){
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("event", SystemEventType.CREATE_ORDER);
@@ -167,11 +172,6 @@
            jsonObject.put("vin", dto.getVin());
            redisTemplate.opsForValue().set("CREATE_ORDER:" + dto.getOrderId().toString(), jsonObject.toJSONString(),30, TimeUnit.MINUTES);
            return R.ok(true);
        }
        //先将车辆修改状态,防止在异步通知之前被其他订单选中
        if (!dto.getOrderId().contains("XU") && mqttPublishDto.getCode()== 200) {
            // 修改车子为接单状态
            xpVehicleClient.updateVehicleStatus(new UpdateVehicleStateDto(dto.getVin(), 1));
        }
        return R.ok(false);
    }
xp-robotaxi-maintenance-boot/src/main/java/com/xiaopeng/maintenance/service/impl/XpSchedulingDetailServiceImpl.java
@@ -32,6 +32,9 @@
import com.xiaopeng.maintenance.service.IXpSchedulingService;
import com.xiaopeng.maintenance.service.IXpShiftService;
import com.xiaopeng.maintenance.vo.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -182,6 +185,7 @@
    /**
     * 给每天的字段赋值
     *
     * @param day
     * @param dto
     * @param map
@@ -286,6 +290,7 @@
    /**
     * 给每天的字段赋值
     *
     * @param day
     * @param dto
     * @param shiftName
@@ -401,7 +406,7 @@
        List<XpSchedulingDetail> list = this.list(new QueryWrapper<XpSchedulingDetail>().eq("is_deleted", 0).last(" and DATE_FORMAT(plan_time,'%Y-%m') = '" + month + "'"));
        //保存排班数据
        XpScheduling xpScheduling = xpSchedulingService.getOne(new QueryWrapper<XpScheduling>().eq("is_deleted", 0).last(" and DATE_FORMAT(scheduling_date,'%Y-%m') = '" + month + "'"));
        if(null == xpScheduling){
        if (null == xpScheduling) {
            xpScheduling = new XpScheduling();
            xpScheduling.setDeleted(false);
            xpScheduling.setCreateTime(LocalDateTime.now());
@@ -434,23 +439,23 @@
                        && s.getPlanTime().equals(parse)
                ).findAny().orElse(null);
                //构建存储对象
                if(null == schedulingDetail){
                if (null == schedulingDetail) {
                    schedulingDetail = new XpSchedulingDetail();
                    schedulingDetail.setCreateBy(userId.toString());
                    schedulingDetail.setCreateTime(LocalDateTime.now());
                    schedulingDetail.setUpdateBy(userId.toString());
                    schedulingDetail.setUpdateTime(LocalDateTime.now());
                    schedulingDetail.setDeleted(false);
                }else{
                } else {
                    //构建通知消息
                    Long old_shiftId = schedulingDetail.getShiftId();
                    if(!old_shiftId.equals(shiftId)){
                    if (!old_shiftId.equals(shiftId)) {
                        //获取车队的所有人员
                        XpShift xpShift1 = xpShifts.stream().filter(s -> s.getId().equals(old_shiftId)).findAny().orElse(null);
                        XpShift xpShift2 = xpShifts.stream().filter(s -> s.getId().equals(shiftId)).findAny().orElse(null);
                        List<Long> operationsIds = xpFleetOperationsClient.getOperationsIdsByFleetId(fleetId).getData();
                        if(null != operationsIds && !operationsIds.isEmpty()){
                        if (null != operationsIds && !operationsIds.isEmpty()) {
                            List<XpOperationsUser> data1 = xpOperationUserClient.listByIds(operationsIds).getData();
                            for (XpOperationsUser xpOperationsUser : data1) {
                                String nickName = xpOperationsUser.getNickName();
@@ -471,7 +476,7 @@
                schedulingDetail.setShiftId(shiftId);
                XpShift xpShift = xpShifts.stream().filter(s -> s.getId().equals(shiftId)).findAny().orElse(null);
                if(null != xpShift){
                if (null != xpShift) {
                    schedulingDetail.setIsAllDay(xpShift.getShiftName().contains("全天"));
                    schedulingDetail.setPlanTime(parse);
                    schedulingDetails.add(schedulingDetail);
@@ -479,7 +484,7 @@
            }
        }
        //批量保存排班明细数据
        if(!schedulingDetails.isEmpty()){
        if (!schedulingDetails.isEmpty()) {
            this.saveOrUpdateBatch(schedulingDetails);
        }
        //异步处理消息通知数据
@@ -490,11 +495,12 @@
    /**
     * 构建推送消息对象
     *
     * @param message
     * @param xpOperationsUser
     * @return
     */
    private AliPushMessageDTO buildPushMessage(String message, XpOperationsUser xpOperationsUser){
    private AliPushMessageDTO buildPushMessage(String message, XpOperationsUser xpOperationsUser) {
        JSONObject body = new JSONObject();
        body.put("content", message);
        body.put("strategy", 4);
@@ -513,11 +519,12 @@
    /**
     * 构建消息存储
     *
     * @param body
     * @param xpOperationsUser
     * @return
     */
    private XpOperationsUserNotification buildXpOperationsUserNotification(String message, String body, XpOperationsUser xpOperationsUser){
    private XpOperationsUserNotification buildXpOperationsUserNotification(String message, String body, XpOperationsUser xpOperationsUser) {
        XpOperationsUserNotification operationsUserNotification = new XpOperationsUserNotification();
        operationsUserNotification.setNotificationType(NotificationTypeEnum.SCHEDULE_CHANGED.getCode());
        operationsUserNotification.setNotificationContent(message);
@@ -530,11 +537,12 @@
    /**
     * 异步处理消息推送
     *
     * @param pushMessage
     * @param notifications
     */
    private void pushMessage(List<AliPushMessageDTO> pushMessage, List<XpOperationsUserNotification> notifications) {
        if(pushMessage.isEmpty()){
        if (pushMessage.isEmpty()) {
            return;
        }
        ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
@@ -547,10 +555,9 @@
    }
    /**
     * 导出排班数据
     *
     * @param month
     * @param response
     */
@@ -559,6 +566,40 @@
        PageInfo<SchedulingDetailDto> pageInfo = new PageInfo<>(0, 10000);
        List<SchedulingDetailDto> schedulingDetailDtos = this.baseMapper.pageList(pageInfo, month);
        List<ExportSchedulingDetailDto> exportSchedulingDetailDtos = new ArrayList<>();
        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
//        for (int i = 0; i < titles.size(); i++) {
//            HSSFSheet hssfSheet = hssfWorkbook.createSheet();
//            hssfSheet.setColumnWidth(0, 6 * 256);
//            hssfSheet.setDefaultRowHeightInPoints(20f);
//
//            HSSFRow hssfRow = hssfSheet.createRow(0);//设置第一行数据(标题)
//            HSSFCellStyle style = hssfWorkbook.createCellStyle();
//            HSSFFont font = hssfWorkbook.createFont();
//            font.setBold(true);
//            style.setFont(font);
//            style.setAlignment(HorizontalAlignment.CENTER);
//            for (int l = 0; l < titles.get(i).size(); l++) {
//                HSSFCell hssfCell = hssfRow.createCell(l);
//                hssfCell.setCellType(CellType.STRING);//设置表格类型
//                hssfCell.setCellValue(titles.get(i).get(l));
//                hssfCell.setCellStyle(style);
//                hssfSheet.setColumnWidth(l, 20 * 256);
//            }
//
//            //将数据添加到表格中
//            List<String> data = null;
//            for (int l = 0; l < datas.get(i).size(); l++) {
//                hssfRow = hssfSheet.createRow(l + 1);
//                data = datas.get(i).get(l);
//                for (int j = 0; j < data.size(); j++) {
//                    HSSFCell hssfCell = hssfRow.createCell(j);
//                    hssfCell.setCellType(CellType.STRING);//设置表格类型
//                    hssfCell.setCellValue(data.get(j));
//                }
//            }
//        }
        //获取月份的最大天数
        LocalDate parse1 = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd"));
        int dayOfMonth = parse1.with(TemporalAdjusters.lastDayOfMonth()).getDayOfMonth();
@@ -568,7 +609,7 @@
        for (int i = 1; i <= dayOfMonth; i++) {
            LocalDate parse = LocalDate.parse(month + "-" + String.format("%02d", i), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
            String week = "";
            switch (parse.getDayOfWeek()){
            switch (parse.getDayOfWeek()) {
                case MONDAY:
                    week = "一";
                    break;
@@ -626,7 +667,7 @@
                exportSchedulingDetailDto.setMorning(morning + "");
                exportSchedulingDetailDto.setMidDay(midDay + "");
                exportSchedulingDetailDto.setEvening(evening + "");
            }else{
            } else {
                for (int i = 1; i <= 31; i++) {
                    String shiftName = "休";
                    setEnglishDay(i, exportSchedulingDetailDto, shiftName);
@@ -644,4 +685,6 @@
        excelUtil.exportExcel(response, exportSchedulingDetailDtos, "排班计划[日期:" + split[0] + "年" + split[1] + "月]");
    }
}
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/utils/TaskOrderUtil.java
@@ -262,7 +262,6 @@
        for (int i = 0; i < count; i++) {
            //等到sleepTime秒钟
            Thread.sleep(sleepTime * 1000);
//            log.info("进入找车环节 单号 {} 第{}轮", orderNo, count++);
            // 根据距离找车
            // 车多则根据配置找具体车数量 根据距离最近
            // 更改 暂不限制数量
@@ -856,17 +855,6 @@
                        log.info("开始推送 {} 订单到XPU", xpOrder.getOrderNumber());
                        redisService.popFirstElement(quoteName);
                        log.info("将订单 {} 从队列 {} 弹出去", orderNo, quoteName);
                        //判断还原车辆状态
                        Object cacheObject = redisService.getCacheObject("CREATE_ORDER:" + xpOrder.getId().toString());
                        if(null != cacheObject){
                            JSONObject jsonObject = JSON.parseObject(cacheObject.toString());
                            String vin = jsonObject.getString("vin");
                            XpVehicle vehicle = xpVehicleClient.findByVehicleVin(vin).getData();
                            if(null != vehicle && 0 != vehicle.getState()){
                                vehicle.setState(0);
                                xpVehicleClient.updateVehicleById(vehicle);
                            }
                        }
                        return true;
                    } catch (Exception e) {
                        e.printStackTrace();