zhibing.pu
2024-05-27 9a331bdd7b6203a58778d26ac1cf5c8a732cc346
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -18,6 +18,7 @@
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.*;
import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil;
import com.stylefeng.guns.modular.system.util.itextpdf.HtmlToPdfUtils;
import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil;
import com.stylefeng.guns.modular.system.util.quartz.jobs.OrderTimeOutJob;
@@ -116,6 +117,9 @@
    @Resource
    private SystemPriceMapper systemPriceMapper;
    @Autowired
    private FleetEngineUtil fleetEngineUtil;
@@ -168,7 +172,6 @@
        driver.setState(3);
        driverService.updateById(driver);
    
        //todo 待翻译
        //添加定时任务(普通任务)
        ReminderRules reminderRules = reminderRulesService.selectOne(new EntityWrapper<ReminderRules>().eq("companyId", driver.getCompanyId()));
        if(null != reminderRules){
@@ -179,13 +182,14 @@
            jobDataMap.put("driverId", uid);
            jobDataMap.put("orderId", orderLogistics.getId());
            jobDataMap.put("orderType", 4);
            jobDataMap.put("describe", "您的包裹订单已超时" + m + "分钟,请抓紧!");
            jobDataMap.put("describe", language == 1 ? "您的包裹订单已超时" + m + "分钟,请抓紧!" : language == 2 ? "Your delivery order is overdue for " + m + " minute(s), please go faster." : "Votre commande de livraison est en retard depuis " + m + " minute(s), veuillez aller plus vite.");
            QuartzUtil.addSimpleQuartzTask(
                    new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderLogistics.getId() + "_4", "ORDER_TIME_OUT", jobDataMap)
                    , new Date(packageTimeoutReminderInterval), packageTimeoutReminderInterval, -1);
        }
        
        //开始修改行程数据
        fleetEngineUtil.updateTrip(null, driver.getCarId(), null, 4, orderLogistics.getId(), null, null, null, null);
        
        //推送相关代码------------------start----------------
        new Thread(new Runnable() {
@@ -259,17 +263,20 @@
        List<OrderLogisticsSpread> orderLogisticsId = spreadService.selectList(new EntityWrapper<OrderLogisticsSpread>().eq("orderLogisticsId", orderLogistics.getId()).eq("payType",4));
        String tripStatus = "UNKNOWN_TRIP_STATUS";
        switch (state){
            case 3://出发前往预约点
                orderLogistics.setState(3);
                orderLogistics.setSetOutTime(new Date());
                systemNoticeService.addSystemNotice(1, language == 1 ? "司机已出发,请耐心等待" : language == 2 ? "The driver is on the way, please wait." : "Le chauffeur est en route. Veuillez patienter.", orderLogistics.getUserId());
                pushUtil.pushDriverPosition(orderId, 4);
                tripStatus = "ENROUTE_TO_PICKUP";
                break;
            case 4://到达预约点,等待客户上车
                orderLogistics.setState(4);
                orderLogistics.setArriveTime(new Date());
                systemNoticeService.addSystemNotice(1, language == 1 ? "司机已到达您设置的预约地点。" : language == 2 ? "The driver has arrived at the reserved location." : "Le chauffeur est arrivé à l'endroit prévu.", orderLogistics.getUserId());
                tripStatus = "ARRIVED_AT_PICKUP";
                break;
            case 5://开始服务
                orderLogistics.setBoardingLon(lon);
@@ -278,6 +285,7 @@
                orderLogistics.setBoardingTime(new Date());
                orderLogistics.setState(5);
                orderLogistics.setStartServiceTime(new Date());
                tripStatus = "ENROUTE_TO_DROPOFF";
                break;
            case 6://结束服务
                orderLogistics.setGetoffLon(lon);
@@ -286,10 +294,15 @@
                orderLogistics.setGetoffTime(new Date());
                orderLogistics.setEndServiceTime(new Date());
                orderLogistics.setState(6);
                tripStatus = "COMPLETE";
                break;
        }
        this.updateById(orderLogistics);
        
        Driver driver = driverService.selectById(orderLogistics.getDriverId());
        //修改行程数据
        fleetEngineUtil.updateTrip(tripStatus, null, null, 4, orderLogistics.getId(), null, null, null, null);
        // TODO: 2020/6/5 推送状态
        new Thread(new Runnable() {
            @Override