Pu Zhibing
2024-10-21 f08b7e95bc941a72d4a7b7bc64c2086ed53f1565
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -390,13 +390,53 @@
                    String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId());
                    if(ToolUtil.isEmpty(vehicles)){
                        CarModel carModel = carModelMapper.selectById(car.getCarModelId());
                        fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
                        boolean createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
                        if(!createVehicles){
                            for (int i = 0; i < 5; i++) {
                                createVehicles = fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
                                if(createVehicles){
                                    break;
                                }
                                try {
                                    Thread.sleep(5000L);
                                } catch (InterruptedException e) {
                                    throw new RuntimeException(e);
                                }
                            }
                        }
                    }
                    fleetEngineUtil.createTrip(car.getVehicleId(), 1, orderPrivateCar.getTripId(),
                    boolean createTrip = fleetEngineUtil.createTrip(car.getVehicleId(), 1, orderPrivateCar.getTripId(),
                            orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(),  orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString());
                    if(!createTrip){
                        for (int i = 0; i < 5; i++) {
                            createTrip = fleetEngineUtil.createTrip(car.getVehicleId(), 1, orderPrivateCar.getTripId(),
                                    orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(),  orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString());
                            if(createTrip){
                                break;
                            }
                            try {
                                Thread.sleep(5000L);
                            } catch (InterruptedException e) {
                                throw new RuntimeException(e);
                            }
                        }
                    }
                }
                //开始修改行程数据
                fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderPrivateCar.getTripId(), null, null, null, null);
                boolean updateTrip = fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderPrivateCar.getTripId(), null, null, null, null);
                if(!updateTrip){
                    for (int i = 0; i < 5; i++) {
                        updateTrip = fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderPrivateCar.getTripId(), null, null, null, null);
                        if(updateTrip){
                            break;
                        }
                        try {
                            Thread.sleep(5000L);
                        } catch (InterruptedException e) {
                            throw new RuntimeException(e);
                        }
                    }
                }
            }catch (Exception e){
                e.printStackTrace();
            }
@@ -547,13 +587,13 @@
                tripStatus = "ENROUTE_TO_DROPOFF";
                switch (language){
                    case 1:
                        audioUrl = "http://182.160.16.251:81/files/audio/system/OnboardReminder-CN.mp3";
                        audioUrl = "https://igo.i-go.group/files/audio/system/OnboardReminder-CN.mp3";
                        break;
                    case 2:
                        audioUrl = "http://182.160.16.251:81/files/audio/system/OnboardReminder-EN.mp3";
                        audioUrl = "https://igo.i-go.group/files/audio/system/OnboardReminder-EN.mp3";
                        break;
                    case 3:
                        audioUrl = "http://182.160.16.251:81/files/audio/system/OnboardReminder-FR.mp3";
                        audioUrl = "https://igo.i-go.group/files/audio/system/OnboardReminder-FR.mp3";
                        break;
                }
                break;
@@ -567,13 +607,13 @@
                tripStatus = "COMPLETE";
                switch (language){
                    case 1:
                        audioUrl = "http://182.160.16.251:81/files/audio/system/ReachDestination-CN.mp3";
                        audioUrl = "https://igo.i-go.group/files/audio/system/ReachDestination-CN.mp3";
                        break;
                    case 2:
                        audioUrl = "http://182.160.16.251:81/files/audio/system/ReachDestination-EN.mp3";
                        audioUrl = "https://igo.i-go.group/files/audio/system/ReachDestination-EN.mp3";
                        break;
                    case 3:
                        audioUrl = "http://182.160.16.251:81/files/audio/system/ReachDestination-FR.mp3";
                        audioUrl = "https://igo.i-go.group/files/audio/system/ReachDestination-FR.mp3";
                        break;
                }
                break;
@@ -584,11 +624,21 @@
        String finalTripStatus = tripStatus;
        new Thread(()->{
            //修改行程数据
            try {
                fleetEngineUtil.updateTrip(finalTripStatus, null, 1, orderPrivateCar.getTripId(), null, null, null, null);
            } catch (Exception e) {
                throw new RuntimeException(e);
            boolean updateTrip = fleetEngineUtil.updateTrip(finalTripStatus, null, 1, orderPrivateCar.getTripId(), null, null, null, null);
            if(!updateTrip){
                for (int i = 0; i < 5; i++) {
                    updateTrip = fleetEngineUtil.updateTrip(finalTripStatus, null, 1, orderPrivateCar.getTripId(), null, null, null, null);
                    if(updateTrip){
                        break;
                    }
                    try {
                        Thread.sleep(5000L);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }).start();
        // TODO: 2020/6/5 推送状态
@@ -626,6 +676,10 @@
        if(orderPrivateCar.getArriveTime()==null){
            orderPrivateCar.setArriveTime(orderPrivateCar.getStartServiceTime());
        }
        //获取google trip_info获取轨迹线路,重新存储轨迹和计算行驶距离和时间
        orderPrivateCar = this.setMoney(orderPrivateCar, 0D, 0D);//计算费用
        orderPrivateCar.setPayManner(type);
        orderPrivateCar.setParkMoney(null == parkingFee ? 0D : parkingFee);
@@ -707,13 +761,21 @@
    
        OrderPrivateCar finalOrderPrivateCar = orderPrivateCar;
        new Thread(()->{
            try {
                //上报google
                fleetEngineUtil.reportBillableEvent(finalOrderPrivateCar.getTripId());
                log.warn("上报时间:{},tripid:{},created_at:{},completed_at:{}", System.currentTimeMillis(), finalOrderPrivateCar.getTripId(),
                        finalOrderPrivateCar.getInsertTime().getTime(), finalOrderPrivateCar.getEndServiceTime().getTime());
            }catch (Exception e){
                e.printStackTrace();
            //上报google
            log.warn("行程结束:{}   {}", System.currentTimeMillis(), finalOrderPrivateCar.getTripId());
            boolean reportBillableEvent = fleetEngineUtil.reportBillableEvent(finalOrderPrivateCar.getTripId());
            if(!reportBillableEvent){
                for (int i = 0; i < 5; i++) {
                    reportBillableEvent = fleetEngineUtil.reportBillableEvent(finalOrderPrivateCar.getTripId());
                    if(reportBillableEvent){
                        break;
                    }
                    try {
                        Thread.sleep(5000L);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }).start();
        return ResultUtil.success();
@@ -1064,12 +1126,21 @@
            orderPrivateCar.setEndLat(Double.valueOf(orderPrivateCar.getDestinationLat()));
            orderPrivateCar.setEndAddress(orderPrivateCar.getDestination());
            //修改google地图行程终点
            try {
                fleetEngineUtil.updateTrip(null, null, null, orderPrivateCar.getTripId(),
                        null, null, orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString());
            } catch (Exception e) {
                e.printStackTrace();
                throw new RuntimeException(e);
            boolean updateTrip = fleetEngineUtil.updateTrip(null, null, null, orderPrivateCar.getTripId(),
                    null, null, orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString());
            if(!updateTrip){
                for (int i = 0; i < 5; i++) {
                    updateTrip = fleetEngineUtil.updateTrip(null, null, null, orderPrivateCar.getTripId(),
                            null, null, orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString());
                    if(updateTrip){
                        break;
                    }
                    try {
                        Thread.sleep(5000L);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
                    }
                }
            }
        }
        orderPrivateCar.setDestinationLon("");