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();
            }
@@ -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 推送状态
@@ -711,12 +761,21 @@
    
        OrderPrivateCar finalOrderPrivateCar = orderPrivateCar;
        new Thread(()->{
            try {
                //上报google
                fleetEngineUtil.reportBillableEvent(finalOrderPrivateCar.getTripId());
                log.warn("行程结束:{}   {}", System.currentTimeMillis(), finalOrderPrivateCar.getTripId());
            }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();
@@ -1067,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("");