Pu Zhibing
7 天以前 8675ddc7e76f418ee47adc50ee7bac35171a9620
DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
@@ -8,19 +8,18 @@
import com.stylefeng.guns.core.util.ToolUtil;
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.dao.RegionMapper;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.model.Company;
import com.stylefeng.guns.modular.system.model.Driver;
import com.stylefeng.guns.modular.system.model.OrderAdditionalFee;
import com.stylefeng.guns.modular.system.model.OrderPosition;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.util.*;
import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper;
import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService;
import io.swagger.annotations.ApiImplicitParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
@@ -41,9 +40,9 @@
    @Autowired
    private GDFalconUtil gdFalconUtil;
    @Autowired
    private RedisUtil redisUtil;
    private RedisTemplate redisTemplate;
    @Autowired
    private IOrderPositionService orderPositionService;
@@ -331,16 +330,16 @@
        orderTaxi.setArriveTime(date);
        orderTaxi.setStartServiceTime(date);
        orderTaxi.setBoardingTime(date);
        String value = redisUtil.getValue("DRIVER" + uid);
        if(ToolUtil.isNotEmpty(value)){
        String value = (String) redisTemplate.opsForValue().get("DRIVER" + uid);
        if (ToolUtil.isNotEmpty(value)) {
            String[] split = value.split(",");
            Map<String, String> geocode1 = gdMapGeocodingUtil.geocode(split[0], split[1]);
            orderTaxi.setBoardingAddress(geocode1.get("address"));
            orderTaxi.setBoardingLon(Double.valueOf(split[0]));
            orderTaxi.setBoardingLat(Double.valueOf(split[1]));
        }
        //调用高德创建轨迹
        String s = gdFalconUtil.selectTerminal(driver.getPhone());
        String track = gdFalconUtil.createTrack(s);
@@ -589,13 +588,13 @@
                }
            }).start();
            //添加定时任务6分钟司机不确认收款自动完成支付(仅车载端),6分钟之内司机无法接单
            String vehicle = redisUtil.getValue("VEHICLE");
            String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE");
            JSONArray jsonArray = new JSONArray();
            if(ToolUtil.isNotEmpty(vehicle)){
                jsonArray = JSON.parseArray(vehicle);
            }
            jsonArray.add(orderTaxi.getDriverId());
            redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识
            redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识
            TimerTask timerTask = new TimerTask() {
                @Override
@@ -610,8 +609,8 @@
                        orderTaxi1.setPayMoney(orderTaxi1.getOrderMoney());
                        orderTaxi1.setState(8);
                        OrderTaxiServiceImpl.this.updateById(orderTaxi1);
                        String vehicle = redisUtil.getValue("VEHICLE");
                        String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE");
                        if(ToolUtil.isNotEmpty(vehicle)){
                            JSONArray jsonArray = JSON.parseArray(vehicle);
                            for(int i = 0; i < jsonArray.size(); i++){
@@ -620,7 +619,7 @@
                                    break;
                                }
                            }
                            redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString());
                            redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString());
                        }
                        new Thread(new Runnable() {
@@ -683,13 +682,13 @@
        }).start();
        //添加定时任务6分钟司机不确认收款自动完成支付(仅车载端),6分钟之内司机无法接单
        String vehicle = redisUtil.getValue("VEHICLE");
        String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE");
        JSONArray jsonArray = new JSONArray();
        if(ToolUtil.isNotEmpty(vehicle)){
            jsonArray = JSON.parseArray(vehicle);
        }
        jsonArray.add(orderTaxi.getDriverId());
        redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识
        redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString());//添加司机不能接单标识
        TimerTask timerTask = new TimerTask() {
            @Override
@@ -704,8 +703,8 @@
                    orderTaxi1.setPayMoney(orderTaxi1.getOrderMoney());
                    orderTaxi1.setState(8);
                    OrderTaxiServiceImpl.this.updateById(orderTaxi1);
                    String vehicle = redisUtil.getValue("VEHICLE");
                    String vehicle = (String) redisTemplate.opsForValue().get("VEHICLE");
                    if(ToolUtil.isNotEmpty(vehicle)){
                        JSONArray jsonArray = JSON.parseArray(vehicle);
                        for(int i = 0; i < jsonArray.size(); i++){
@@ -714,7 +713,7 @@
                                break;
                            }
                        }
                        redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString());
                        redisTemplate.opsForValue().set("VEHICLE", jsonArray.toJSONString());
                    }
                    new Thread(new Runnable() {