liujie
9 天以前 3caaf21916009fe7d12430f8fbac053384616e45
DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -17,17 +17,13 @@
import com.stylefeng.guns.modular.system.util.*;
import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GeodeticCalculator;
import org.gavaghan.geodesy.GeodeticCurve;
import org.gavaghan.geodesy.GlobalCoordinates;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
@@ -84,23 +80,24 @@
    @Autowired
    private ICompanyService companyService;
    @Value("${pushMinistryOfTransport}")
    private boolean pushMinistryOfTransport;
    @Autowired
    private ICarService carService;
    @Resource
    private CarServiceMapper carServiceMapper;
    @Resource
    private RedisTemplate<String, Object> redisTemplate;
    /**
     * 获取司机端首页订单列表
     * @param state     1=服务中,2=待服务(30分钟定义预约)
     *
     * @param state    1=服务中,2=待服务(30分钟定义预约)
     * @param driverId
     * @return
     * @throws Exception
@@ -164,7 +161,7 @@
                    new EntityWrapper<OrderTaxi>()
                            .eq("type", 2)
                            .eq("userId", orderPrivateCar.getUserId())
                            .ne("state", 1)
                            .notIn("state", 1,11)
                            .eq("crossCityOrderId", orderPrivateCar.getCrossCityOrderId())
                            .eq("place", orderPrivateCar.getPlace())
            );
@@ -176,9 +173,15 @@
        if(orderPrivateCar.getState() == 10){
            return ResultUtil.error("订单已取消");
        }
        if(orderPrivateCar.getState() != 1){
        if(orderPrivateCar.getState() != 1 && orderPrivateCar.getState() != 11){
            return ResultUtil.error("手速有点慢哦,订单已被抢啦!");
        }
        Integer oldDriverId = null;
        if(orderPrivateCar.getState()==11){
            oldDriverId= orderPrivateCar.getDriverId();
        }
        Driver driver = driverService.selectById(uid);
        if(orderPrivateCar.getType() == 3){
            //批量订单
@@ -262,14 +265,22 @@
        }
        //推送相关代码------------------start----------------
        Integer finalOldDriverId = oldDriverId;
        new Thread(new Runnable() {
            @Override
            public void run() {
                pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState());
                pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState());
                if(orderPrivateCar.getType() == 2){
                    pushUtil.pushFerryOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, 2);
                if(finalOldDriverId !=null){
                    pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState());
                    pushUtil.pushOrderReassign(orderPrivateCar.getUserId(),1 , orderPrivateCar.getId(), 1);
                    pushUtil.pushOrderReassign(finalOldDriverId,2, orderPrivateCar.getId(), 1);
                }else {
                    pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState());
                    pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState());
                    if(orderPrivateCar.getType() == 2){
                        pushUtil.pushFerryOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, 2);
                    }
                }
            }
        }).start();
@@ -298,8 +309,6 @@
    }
    @Autowired
    private RedisUtil redisUtil;
    /**
     * 获取订单详情页(服务中的页面)
@@ -322,7 +331,7 @@
            if(order!=null){
                orders.addAll(order);
            }
            String value = redisUtil.getValue("DRIVER" + String.valueOf(orderPrivateCar.getDriverId()));
            String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(orderPrivateCar.getDriverId()));
            order = this.baseMapper.queryOrderInfo(orderId,5,value.split(",")[0],value.split(",")[1]);
            if(order!=null){
                orders.addAll(order);
@@ -337,7 +346,7 @@
            if(order!=null){
                orders.addAll(order);
            }
            String value = redisUtil.getValue("DRIVER" + String.valueOf(orderPrivateCar.getDriverId()));
            String value = (String) redisTemplate.opsForValue().get("DRIVER" + String.valueOf(orderPrivateCar.getDriverId()));
            order = this.baseMapper.queryOrderInfo(orderPrivateCar.getPid(),5,value.split(",")[0],value.split(",")[1]);
            if(order!=null){
                orders.addAll(order);