zhibing.pu
2024-05-28 9317fed1cea5372d9997a8273c07f041db94f99c
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -4,17 +4,23 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.specialTrain.dao.OrderPrivateCarMapper;
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.dao.CarModelMapper;
import com.stylefeng.guns.modular.system.dao.RegionMapper;
import com.stylefeng.guns.modular.system.dao.SystemPriceMapper;
import com.stylefeng.guns.modular.system.dao.UserInfoMapper;
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.quartz.QuartzUtil;
import com.stylefeng.guns.modular.system.util.quartz.jobs.OrderTimeOutJob;
import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
import org.quartz.JobDataMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@@ -24,6 +30,9 @@
import java.io.FileWriter;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -64,13 +73,7 @@
    private GDMapElectricFenceUtil gdMapElectricFenceUtil;
    @Autowired
    private PushMinistryOfTransportUtil pushMinistryOfTransportUtil;
    @Autowired
    private IOrderTaxiService orderTaxiService;
    @Value("${pushMinistryOfTransport}")
    private boolean pushMinistryOfTransport;
    @Resource
@@ -82,9 +85,27 @@
    @Autowired
    private IIncomeService incomeService;
    @Autowired
    private IPaymentRecordService paymentRecordService;
    @Autowired
    private ITransactionDetailsService transactionDetailsService;
    @Value("${filePath}")
    private String filePath;
    @Autowired
    private IReminderRulesService reminderRulesService;
    @Autowired
    private FleetEngineUtil fleetEngineUtil;
    @Resource
    private CarModelMapper carModelMapper;
    @Autowired
    private ICarService carService;
@@ -98,8 +119,15 @@
     * @throws Exception
     */
    @Override
    public List<Map<String, Object>> queryOrderList(Integer state, Integer driverId) throws Exception {
        return orderPrivateCarMapper.queryOrderList(state, driverId);
    public List<Map<String, Object>> queryOrderList(Integer state, Integer driverId, Integer language) throws Exception {
        List<Map<String, Object>> list = orderPrivateCarMapper.queryOrderList(state, driverId, language);
        for (Map<String, Object> map : list) {
            if(null != map.get("time")){
                String time = map.get("time").toString();
                map.put("time", DateUtil.conversionFormat(language, time));
            }
        }
        return list;
    }
    /**
@@ -110,8 +138,15 @@
     * @throws Exception
     */
    @Override
    public List<Map<String, Object>> queryMyAllOrder(Integer state, Integer uid) throws Exception {
        return orderPrivateCarMapper.queryMyAllOrder(state, uid);
    public List<Map<String, Object>> queryMyAllOrder(Integer state, Integer uid, Integer language) throws Exception {
        List<Map<String, Object>> list = orderPrivateCarMapper.queryMyAllOrder(state, uid, language);
        for (Map<String, Object> map : list) {
            if(null != map.get("time")){
                String time = map.get("time").toString();
                map.put("time", DateUtil.conversionFormat(language, time));
            }
        }
        return list;
    }
@@ -122,8 +157,13 @@
     * @throws Exception
     */
    @Override
    public Map<String, Object> queryPushOrder(Integer orderId) throws Exception {
        return orderPrivateCarMapper.queryPushOrder(orderId);
    public Map<String, Object> queryPushOrder(Integer orderId, Integer language) throws Exception {
        Map<String, Object> map = orderPrivateCarMapper.queryPushOrder(orderId, language);
        if(null != map.get("travelTime")){
            String travelTime = map.get("travelTime").toString();
            map.put("travelTime", DateUtil.conversionFormat1(language, travelTime));
        }
        return map;
    }
@@ -136,7 +176,7 @@
     * @throws Exception
     */
    @Override
    public synchronized ResultUtil grabOrder(Integer orderId, Integer uid) throws Exception {
    public synchronized ResultUtil grabOrder(Integer orderId, Integer uid, Integer language) throws Exception {
        OrderPrivateCar orderPrivateCar = this.selectById(orderId);
        //处理摆渡车的情况
        if(orderPrivateCar.getType() == 2){
@@ -158,15 +198,15 @@
                            .eq("place", orderPrivateCar.getPlace())
            );
            if(list.size() > 0 || list1.size() > 0){
                return ResultUtil.error("手速有点慢哦,订单已被抢啦!");
                return ResultUtil.error(language == 1 ? "手速有点慢哦,订单已被抢啦" : language == 2 ? "Too slow, order was snatched!" : "Trop lent, l’ordre a été arraché!");
            }
        }
        if(orderPrivateCar.getState() == 9){
            return ResultUtil.error("订单已取消");
        if(orderPrivateCar.getState() == 10){
            return ResultUtil.error(language == 1 ? "订单已取消" : language == 2 ? "Order cancelled" : "Commande annulée");
        }
        if(orderPrivateCar.getState() != 1){
            return ResultUtil.error("手速有点慢哦,订单已被抢啦!");
            return ResultUtil.error(language == 1 ? "手速有点慢哦,订单已被抢啦" : language == 2 ? "Too slow, order was snatched!" : "Trop lent, l’ordre a été arraché!");
        }
        Driver driver = driverService.selectById(uid);
        orderPrivateCar.setDriverId(uid);
@@ -175,21 +215,6 @@
                driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1));
        orderPrivateCar.setState(2);
        orderPrivateCar.setSnatchOrderTime(new Date());
        //调用高德创建轨迹
        String s = gdFalconUtil.selectTerminal(driver.getPhone());
        String track = gdFalconUtil.createTrack(s);
        orderPrivateCar.setTrackId(track);
        //调用移动的小号接口
        /*Map<String, String> geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString());
        Region region = regionMapper.query(geocode.get("districtCode"));*/
        Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderPrivateCar.getPassengersPhone(), driver.getPhone(), null);
        if(String.valueOf(map.get("code")).equals("200")){
            orderPrivateCar.setTelX(map.get("telX"));
            orderPrivateCar.setBindId(map.get("bindId"));
        }
        System.out.println(map);
        this.updateById(orderPrivateCar);
        //如果是预约单,则不修改司机为服务中
@@ -198,7 +223,65 @@
            driver.setState(3);
            driverService.updateById(driver);
        }
        //添加定时任务(普通任务)
        ReminderRules reminderRules = reminderRulesService.selectOne(new EntityWrapper<ReminderRules>().eq("companyId", driver.getCompanyId()));
        if(null != reminderRules){
            JSONObject jsonObject = JSON.parseObject(reminderRules.getContent());
            //预约单
            if(orderPrivateCar.getOrderType() == 1){
                long specialCarTimeoutReminderInterval = jsonObject.getInteger("specialCarTimeoutReminderInterval") * 60000L;
                long m = (System.currentTimeMillis() - orderPrivateCar.getSnatchOrderTime().getTime()) / 60000;
                JobDataMap jobDataMap = new JobDataMap();
                jobDataMap.put("driverId", uid);
                jobDataMap.put("orderId", orderPrivateCar.getId());
                jobDataMap.put("orderType", 1);
                jobDataMap.put("describe", language == 1 ? "您的打车订单已超时" + m + "分钟,请抓紧!" : language == 2 ? "Your ride order is overdue for " + m + " minute(s), please go faster." : "Votre commande de course est en retard depuis " + m + " minute(s), veuillez aller plus vite.");
                QuartzUtil.addSimpleQuartzTask(
                        new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap)
                        , new Date(specialCarTimeoutReminderInterval), specialCarTimeoutReminderInterval, -1);
            }else{
                UserInfo userInfo = userInfoMapper.selectById(orderPrivateCar.getUserId());
                JSONObject reservationOrder = jsonObject.getJSONObject("reservationOrder");
                long appointmentReminder = reservationOrder.getInteger("appointmentReminder") * 60000L;
                long appointmentTimeoutReminderInterval = reservationOrder.getInteger("appointmentTimeoutReminderInterval") * 60000L;
                SimpleDateFormat sdf = new SimpleDateFormat("");
                JobDataMap jobDataMap = new JobDataMap();
                jobDataMap.put("driverId", uid);
                jobDataMap.put("orderId", orderPrivateCar.getId());
                jobDataMap.put("orderType", 1);
                jobDataMap.put("describe", "您将于" + sdf.format(orderPrivateCar.getTravelTime()) + "去接" + userInfo.getFirstName() + " " + userInfo.getLastName() + ",请准时!");
                QuartzUtil.addSimpleQuartzTask(
                        new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap)
                        , new Date(appointmentReminder), appointmentReminder, 0);
                jobDataMap = new JobDataMap();
                jobDataMap.put("driverId", uid);
                jobDataMap.put("orderId", orderPrivateCar.getId());
                jobDataMap.put("orderType", 1);
                jobDataMap.put("describe", "您将于" + sdf.format(orderPrivateCar.getTravelTime()) + "去接" + userInfo.getFirstName() + " " + userInfo.getLastName() + ",请准时!");
                QuartzUtil.addSimpleQuartzTask(
                        new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderPrivateCar.getId() + "_1", "ORDER_TIME_OUT", jobDataMap)
                        , new Date(appointmentReminder + appointmentTimeoutReminderInterval), appointmentTimeoutReminderInterval, -1);
            }
        }
        String trip = fleetEngineUtil.getTrip(1, orderPrivateCar.getId());
        if(ToolUtil.isEmpty(trip)){
            String vehicles = fleetEngineUtil.getVehicles(orderPrivateCar.getCarId());
            if(ToolUtil.isEmpty(vehicles)){
                Car car = carService.selectById(orderPrivateCar.getCarId());
                CarModel carModel = carModelMapper.selectById(car.getCarModelId());
                fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), car.getId());
            }
            fleetEngineUtil.createTrip(orderPrivateCar.getCarId(), 1, 1, orderPrivateCar.getId(),
                    orderPrivateCar.getStartLat().toString(), orderPrivateCar.getStartLon().toString(),  orderPrivateCar.getEndLat().toString(), orderPrivateCar.getEndLon().toString());
        }
        //开始修改行程数据
        fleetEngineUtil.updateTrip(null, driver.getCarId(), null, 1, orderPrivateCar.getId(), null, null, null, null);
        //推送相关代码------------------start----------------
        new Thread(new Runnable() {
            @Override
@@ -211,27 +294,13 @@
            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                pushUtil.pushDriverPosition(orderId, 1);
            }
        }).start();
        systemNoticeService.addSystemNotice(2, "您已成功抢得专车订单,请及时联系客户!", orderPrivateCar.getDriverId());
        systemNoticeService.addSystemNotice(1, "您的订单已指派给" + driver.getName().substring(0, 1) + "师傅,请保持电话畅通!", orderPrivateCar.getUserId());
        new Thread(new Runnable() {
            @Override
            public void run() {
                if(pushMinistryOfTransport){
                    //上传数据
                    pushMinistryOfTransportUtil.orderCreate(orderId);
                    pushMinistryOfTransportUtil.orderMatch(orderId);
                }
            }
        }).start();
        systemNoticeService.addSystemNotice(2, language == 1 ? "您已成功抢得打车订单,请及时联系客户!" :
                language == 2 ? "You have grabbed the ride order, please contact the client timely."
                        : "Vous avez saisi la commande de course, veuillez contacter le client en temps opportun.", orderPrivateCar.getDriverId());
        systemNoticeService.addSystemNotice(1, language == 1 ? "您的订单已指派给" + driver.getFirstName() + "师傅,请保持电话畅通!" :
                language == 2 ? "Your order has been assigned to the driver- " + driver.getFirstName() + ", please keep your line on."
                        : "Votre commande a été attribuée au chauffeur- " + driver.getFirstName() + ", S'il vous plaît, restez en ligne.", orderPrivateCar.getUserId());
        return ResultUtil.success();
    }
@@ -244,8 +313,14 @@
     * @throws Exception
     */
    @Override
    public Map<String, Object> queryOrderInfo(Integer orderId) throws Exception {
        return orderPrivateCarMapper.queryOrderInfo(orderId);
    public Map<String, Object> queryOrderInfo(Integer language, Integer orderId) throws Exception {
        Map<String, Object> map = orderPrivateCarMapper.queryOrderInfo(orderId);
        if(null != map.get("travelTime_")){
            String travelTime_ = map.get("travelTime_").toString();
            map.put("travelTime_", DateUtil.conversionFormat1(language, travelTime_));
        }
        map.put("cancelUser", language == 1 ? "用户" : language == 2 ? "The client" : "Le client");
        return map;
    }
@@ -258,33 +333,33 @@
     * @throws Exception
     */
    @Override
    public ResultUtil process(Integer orderId, Integer state, Double lon, Double lat, String address,String phone) throws Exception {
    public ResultUtil process(Integer orderId, Integer state, Double lon, Double lat, String address,String phone, Integer language) throws Exception {
        OrderPrivateCar orderPrivateCar = this.selectById(orderId);
        if(state==5){
            UserInfo userInfo = userInfoMapper.selectById(orderPrivateCar.getUserId());
            if(!userInfo.getPhone().substring(7, userInfo.getPhone().length()).equals(phone)){
                return ResultUtil.error("手机号错误");
            }
        if(orderPrivateCar.getState().compareTo(state) == 0){
            return ResultUtil.error(language == 1 ? "不能重复操作" : language == 2 ? "Unable to recur operate" : "Impossible de récurrence des opérer");
        }
        if(state==3 && orderPrivateCar.getState()!=2){
            return ResultUtil.error("当前订单不能触发前往预约地点");
            return ResultUtil.error(language == 1 ? "当前订单不能触发前往预约地点" : language == 2 ? "The current order cannot trigger travel to the reservation" : "La commande en cours ne peut pas déclencher une visite au lieu de rendez-vous");
        }
        if(state==4 && orderPrivateCar.getState()!=3){
            return ResultUtil.error("当前订单不能到达预约地点");
            return ResultUtil.error(language == 1 ? "当前订单不能到达预约地点" : language == 2 ? "The current order cannot arrive at the reservation" : "La commande en cours ne peut pas atteindre le rendez-vous");
        }
        /*if(state==5 && orderPrivateCar.getState()!=4){
            return ResultUtil.error("当前订单不能开始服务");
        }*/
        String tripStatus = "UNKNOWN_TRIP_STATUS";
        switch (state){
            case 3://出发前往预约点
                orderPrivateCar.setState(3);
                orderPrivateCar.setSetOutTime(new Date());
                systemNoticeService.addSystemNotice(1, "司机已出发,请耐心等待", orderPrivateCar.getUserId());
                systemNoticeService.addSystemNotice(1, language == 1 ? "司机已出发,请耐心等待" : language == 2 ? "The driver is on the way, please wait." : "Le chauffeur est en route. Veuillez patienter.", orderPrivateCar.getUserId());
                pushUtil.pushDriverPosition(orderPrivateCar.getId(), 1);//主动推送司机定位
                tripStatus = "ENROUTE_TO_PICKUP";
                break;
            case 4://到达预约点,等待客户上车
                orderPrivateCar.setState(4);
                orderPrivateCar.setArriveTime(new Date());
                systemNoticeService.addSystemNotice(1, "司机已到达您设置的预约地点,请及时上车", orderPrivateCar.getUserId());
                systemNoticeService.addSystemNotice(1, language == 1 ? "司机已到达您设置的预约地点,请及时上车" : language == 2 ?
                        "The driver has arrived at the reserved location, please get in timely." :
                        "Le chauffeur est arrivé à l'endroit prévu, veuillez monter dans la voiture à temps.", orderPrivateCar.getUserId());
                tripStatus = "ARRIVED_AT_PICKUP";
                break;
            case 5://开始服务
                orderPrivateCar.setBoardingLon(lon);
@@ -294,16 +369,6 @@
                orderPrivateCar.setState(5);
                orderPrivateCar.setStartServiceTime(new Date());
                pushUtil.pushDriverPosition(orderPrivateCar.getId(), 1);//主动推送司机定位
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        if(pushMinistryOfTransport){//上传数据
                            pushMinistryOfTransportUtil.operateDepart(orderId);
                        }
                    }
                }).start();
                OrderPosition orderPosition = new OrderPosition();
                orderPosition.setOrderId(orderId);
                orderPosition.setOrderType(1);
@@ -327,16 +392,23 @@
                out.write(JSON.toJSONString(orderPositions));
                out.flush();
                out.close();
                tripStatus = "ENROUTE_TO_DROPOFF";
                break;
            case 6://结束服务(专车可以返回继续服务)不修改状态
                orderPrivateCar.setState(6);
                orderPrivateCar.setGetoffLon(lon);
                orderPrivateCar.setGetoffLat(lat);
                orderPrivateCar.setGetoffAddress(address);
                orderPrivateCar.setGetoffTime(new Date());
                orderPrivateCar.setEndServiceTime(new Date());
                tripStatus = "COMPLETE";
                break;
        }
        this.updateById(orderPrivateCar);
        Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
        //修改行程数据
        fleetEngineUtil.updateTrip(tripStatus, null, 1, 1, orderPrivateCar.getId(), null, null, null, null);
        // TODO: 2020/6/5 推送状态
        OrderPrivateCar finalOrderPrivateCar = orderPrivateCar;
@@ -362,7 +434,7 @@
     * @throws Exception
     */
    @Override
    public ResultUtil confirmFees(Integer orderId, Integer type, Double parkingFee, Double crossingFee) throws Exception {
    public ResultUtil confirmFees(Integer language, Integer orderId, Integer type, Double parkingFee, Double crossingFee) throws Exception {
        OrderPrivateCar orderPrivateCar = this.selectById(orderId);
        if(orderPrivateCar.getArriveTime()==null){
            orderPrivateCar.setArriveTime(orderPrivateCar.getStartServiceTime());
@@ -393,7 +465,7 @@
                    }
                    if(company.getIsSpeFixedOrProportional() == 1){//比例
                        Double price = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getDurationMoney() + orderPrivateCar.getLongDistanceMoney();
                        d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_EVEN);
                        d = new BigDecimal(price).multiply(new BigDecimal(speMoney).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN)));
                        c = new BigDecimal(orderPrivateCar.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
                    }
                    incomeService.saveData(1, orderPrivateCar.getCompanyId(), 2, orderPrivateCar.getId(), 1, d.doubleValue());
@@ -427,7 +499,8 @@
        pushUtil.removeTask(orderId, 1);//删除定时任务,结束推送数据
        systemNoticeService.addSystemNotice(1, "司机已结束本次行程,谢谢使用", orderPrivateCar.getUserId());
        systemNoticeService.addSystemNotice(1, language == 1 ? "司机已结束本次行程,谢谢使用" : language == 2 ?
                "The driver has finished the trip,thank you for using I-GO" : "Le chauffeur a terminé le trajet, merci d'utiliser I-GO", orderPrivateCar.getUserId());
        //回滚司机状态为空闲
        Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
@@ -442,19 +515,6 @@
                pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 1, finalOrderTaxi.getState());
            }
        }).start();
        OrderPrivateCar finalOrderPrivateCar = orderPrivateCar;
        new Thread(new Runnable() {
            @Override
            public void run() {
                if(pushMinistryOfTransport){//上传交通数据
                    pushMinistryOfTransportUtil.baseInfoVehicleTotalMile(finalOrderPrivateCar.getCarId());
                    pushMinistryOfTransportUtil.operateArrive(orderId);
                }
            }
        }).start();
        return ResultUtil.success();
    }
@@ -512,10 +572,11 @@
            this.updateById(orderPrivateCar);
            return true;//第一条数据不作处理,直接存储
        }
        Map<String, String> distance = gdMapElectricFenceUtil.getDistance(now, old, 0);//直线距离
        Map<String, Double> distance = GeodesyUtil.getDistance(now, old);
        if(null != distance){
            String distance1 = distance.get("distance");
            if(Double.valueOf(distance1) > 50 && orderPrivateCar.getState()==5/* && orderPosition.getInsertTime().getTime()>=orderPrivateCar.getBoardingTime().getTime()*/){//大于50米表示在移动
            Double distance1 = distance.get("WGS84");
            if(distance1 > 50 && orderPrivateCar.getState()==5/* && orderPosition.getInsertTime().getTime()>=orderPrivateCar.getBoardingTime().getTime()*/){//大于50米表示在移动
                orderPrivateCar.setMileage(new BigDecimal(orderPrivateCar.getMileage()).add(new BigDecimal(distance1)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                this.updateById(orderPrivateCar);
                return true;
@@ -589,54 +650,56 @@
        //夜间服务处理逻辑
        Calendar s = Calendar.getInstance();
        s.setTime(date);
        s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num16.split(" - ")[0].split(":")[0]));
        s.set(Calendar.MINUTE, Integer.valueOf(num16.split(" - ")[0].split(":")[1]));
        if(ToolUtil.isNotEmpty(num16)){
            Calendar s = Calendar.getInstance();
            s.setTime(date);
            s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num16.split(" - ")[0].split(":")[0]));
            s.set(Calendar.MINUTE, Integer.valueOf(num16.split(" - ")[0].split(":")[1]));
        Calendar e = Calendar.getInstance();
        e.setTime(date);
        e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num16.split(" - ")[1].split(":")[0]));
        e.set(Calendar.MINUTE, Integer.valueOf(num16.split(" - ")[1].split(":")[1]));
            Calendar e = Calendar.getInstance();
            e.setTime(date);
            e.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num16.split(" - ")[1].split(":")[0]));
            e.set(Calendar.MINUTE, Integer.valueOf(num16.split(" - ")[1].split(":")[1]));
        if(date.getTime() > s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){
            if(d > num8.doubleValue() && d <= num9.doubleValue()){
                yt1 = num20 * (d - num8);
            if(date.getTime() > s.getTimeInMillis() && date.getTime() < e.getTimeInMillis()){
                if(d > num8.doubleValue() && d <= num9.doubleValue()){
                    yt1 = num20 * (d - num8);
                }
                if(d > num9.doubleValue()){
                    yt1 = num20 * (num9 - num8);
                }
                if(d > num11.doubleValue() && d <= num12.doubleValue()){
                    yt2 = num21 * (d - num11);
                }
                if(d > num12.doubleValue()){
                    yt2 = num21 * (num12 - num11);
                }
                if(d > num14.doubleValue()){
                    yt3 = num22 * (d - num14);
                }
                amount = num17 + (d1 * num18) + (t1 * num19) + (w1 * num7) + yt1 + yt2 + yt3;
                orderPrivateCar.setStartMileage(num2);
                orderPrivateCar.setStartMoney(num17);//起步价
                orderPrivateCar.setStartDuration((int)(num3.doubleValue()));
                orderPrivateCar.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                orderPrivateCar.setMileageMoney(new BigDecimal(d1 * num18).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//里程费
                orderPrivateCar.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                orderPrivateCar.setDurationMoney(new BigDecimal(t1 * num19).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//时长费
                orderPrivateCar.setWait(new BigDecimal(w1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                orderPrivateCar.setWaitMoney(new BigDecimal(w1 * num7).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//等待费
                orderPrivateCar.setLongDistance(new BigDecimal((d > num8) ? d - num8 : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                orderPrivateCar.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//远途费
                orderPrivateCar.setParkMoney(parkingFee);//停车费
                orderPrivateCar.setRoadTollMoney(crossingFee);//过路费
                orderPrivateCar.setRedPacketMoney(0D);//红包抵扣
                orderPrivateCar.setCouponMoney(0D);//优惠券抵扣
                orderPrivateCar.setDiscount(0D);//优惠抵扣
                orderPrivateCar.setPayMoney(0D);//支付金额
                orderPrivateCar.setOrderMoney(new BigDecimal(amount + parkingFee + crossingFee).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                orderPrivateCar.setMoneyType(2);
                orderPrivateCar.setMoneyTime(num16);
                return orderPrivateCar;
            }
            if(d > num9.doubleValue()){
                yt1 = num20 * (num9 - num8);
            }
            if(d > num11.doubleValue() && d <= num12.doubleValue()){
                yt2 = num21 * (d - num11);
            }
            if(d > num12.doubleValue()){
                yt2 = num21 * (num12 - num11);
            }
            if(d > num14.doubleValue()){
                yt3 = num22 * (d - num14);
            }
            amount = num17 + (d1 * num18) + (t1 * num19) + (w1 * num7) + yt1 + yt2 + yt3;
            orderPrivateCar.setStartMileage(num2);
            orderPrivateCar.setStartMoney(num17);//起步价
            orderPrivateCar.setStartDuration((int)(num3.doubleValue()));
            orderPrivateCar.setMileageKilometers(new BigDecimal(d1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
            orderPrivateCar.setMileageMoney(new BigDecimal(d1 * num18).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//里程费
            orderPrivateCar.setDuration(new BigDecimal(t1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
            orderPrivateCar.setDurationMoney(new BigDecimal(t1 * num19).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//时长费
            orderPrivateCar.setWait(new BigDecimal(w1).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
            orderPrivateCar.setWaitMoney(new BigDecimal(w1 * num7).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//等待费
            orderPrivateCar.setLongDistance(new BigDecimal((d > num8) ? d - num8 : 0).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
            orderPrivateCar.setLongDistanceMoney(new BigDecimal(yt1 + yt2 + yt3).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());//远途费
            orderPrivateCar.setParkMoney(parkingFee);//停车费
            orderPrivateCar.setRoadTollMoney(crossingFee);//过路费
            orderPrivateCar.setRedPacketMoney(0D);//红包抵扣
            orderPrivateCar.setCouponMoney(0D);//优惠券抵扣
            orderPrivateCar.setDiscount(0D);//优惠抵扣
            orderPrivateCar.setPayMoney(0D);//支付金额
            orderPrivateCar.setOrderMoney(new BigDecimal(amount + parkingFee + crossingFee).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
            orderPrivateCar.setMoneyType(2);
            orderPrivateCar.setMoneyTime(num16);
            return orderPrivateCar;
        }
@@ -756,4 +819,44 @@
    public List<OrderPrivateCar> getSmsOrderList() {
        return this.baseMapper.getSmsOrderList();
    }
    @Override
    public void payOrderPrivateCarCallback(Integer id, String order_id, Integer language) throws Exception {
        OrderPrivateCar orderPrivateCar = this.selectById(id);
        PaymentRecord query = paymentRecordService.query(1, orderPrivateCar.getDriverId(), 2, id, 1, null, 1);
        if(null != query){
            //添加交易明细
            transactionDetailsService.saveData(orderPrivateCar.getDriverId(), language == 1 ? "现金收款代付" : language == 2 ? "Cash collection on behalf of payment" : "Paiement en espèces", query.getAmount(), 2, 1, 2, 1, id);
            orderPrivateCar.setDriverPay(2);
            this.updateById(orderPrivateCar);
            query.setState(2);
            query.setCode(order_id);
            paymentRecordService.updateById(query);
        }else{
            System.err.println("预支付数据异常(orderId = "  + id + ")");
        }
    }
    /**
     * 处理乘客修改终点
     * @param orderId
     * @param status
     */
    @Override
    public void updateEndAddress(Integer orderId, Integer status) {
        OrderPrivateCar orderPrivateCar = this.selectById(orderId);
        if(2 == status){
            orderPrivateCar.setEndLon(Double.valueOf(orderPrivateCar.getDestinationLon()));
            orderPrivateCar.setEndLat(Double.valueOf(orderPrivateCar.getDestinationLat()));
            orderPrivateCar.setEndAddress(orderPrivateCar.getDestination());
        }
        orderPrivateCar.setDestinationLon("");
        orderPrivateCar.setDestination("");
        orderPrivateCar.setDestinationLat("");
        this.updateById(orderPrivateCar);
        pushUtil.pushModifyAddress(1, orderPrivateCar.getUserId(), orderId, 1, status);
    }
}