zhibing.pu
2024-06-21 0f9a91a7609e6623ada0f8b5a9ee878e77e5aa32
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -20,6 +20,7 @@
import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil;
import com.stylefeng.guns.modular.system.util.quartz.jobs.OrderTimeOutJob;
import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
import org.apache.shiro.util.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
@@ -169,7 +170,9 @@
                driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1));
        orderLogistics.setState(2);
        orderLogistics.setSnatchOrderTime(new Date());
        if(!StringUtils.hasLength(orderLogistics.getTripId())){
            orderLogistics.setTripId(UUIDUtil.getRandomCode());
        }
        this.updateById(orderLogistics);
        //修改司机为服务中
        driver.setState(3);
@@ -191,19 +194,23 @@
                    , new Date(packageTimeoutReminderInterval), packageTimeoutReminderInterval, -1);
        }
    
        String trip = fleetEngineUtil.getTrip(1, orderLogistics.getId());
        Car car = carService.selectById(orderLogistics.getCarId());
        if(!StringUtils.hasLength(car.getVehicleId())){
            car.setVehicleId(UUIDUtil.getRandomCode());
            carService.updateById(car);
        }
        String trip = fleetEngineUtil.getTrip(orderLogistics.getTripId());
        if(ToolUtil.isEmpty(trip)){
            String vehicles = fleetEngineUtil.getVehicles(orderLogistics.getCarId());
            String vehicles = fleetEngineUtil.getVehicles(car.getVehicleId());
            if(ToolUtil.isEmpty(vehicles)){
                Car car = carService.selectById(orderLogistics.getCarId());
                CarModel carModel = carModelMapper.selectById(car.getCarModelId());
                fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getId());
                fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getVehicleId());
            }
            fleetEngineUtil.createTrip(orderLogistics.getCarId(), 1, 4, orderLogistics.getId(),
            fleetEngineUtil.createTrip(car.getVehicleId(), 1, orderLogistics.getTripId(),
                    orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(),  orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString());
        }else{
            //开始修改行程数据
            fleetEngineUtil.updateTrip(null, driver.getCarId(), null, 4, orderLogistics.getId(), null, null, null, null);
            fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null);
        }
        
        //推送相关代码------------------start----------------
@@ -315,8 +322,9 @@
        this.updateById(orderLogistics);
    
        Driver driver = driverService.selectById(orderLogistics.getDriverId());
        Car car = carMapper.selectById(driver.getCarId());
        //修改行程数据
        fleetEngineUtil.updateTrip(tripStatus, null, null, 4, orderLogistics.getId(), null, null, null, null);
        fleetEngineUtil.updateTrip(tripStatus, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null);
        
        // TODO: 2020/6/5 推送状态
        new Thread(new Runnable() {