Pu Zhibing
2025-04-18 77f5f06057b425fe96058113f906300d2b47752b
UserZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -16,6 +16,7 @@
import com.stylefeng.guns.modular.system.dao.*;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.service.*;
import com.stylefeng.guns.modular.system.service.impl.OrderPositionServiceImpl;
import com.stylefeng.guns.modular.system.util.*;
import com.stylefeng.guns.modular.system.warpper.BaseWarpper;
import com.stylefeng.guns.modular.system.warpper.EndPushWarpper;
@@ -47,6 +48,7 @@
import java.math.MathContext;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -360,100 +362,113 @@
            }
            AssignOrder assignOrder = assignOrderService.selectOne(new EntityWrapper<AssignOrder>().eq("companyId", query.getId()).eq("type", 1));
            if(null != assignOrder){//配置了指派规则才处理
                //获取空闲司机
                List<Driver> drivers = driverService.queryIdleDriver(1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), assignOrder.getDistance(), null);//获取范围内空闲司机
                List<Integer> driverIds = drivers.stream().map(Driver::getId).collect(Collectors.toList());
                if(drivers.size() > 0){//有司机,直接指派给司机
                    Driver dr = null;
                    if(drivers.size() > 1){
                        List<Driver> ds = new ArrayList<>();//存储直线距离最近的几个司机
                        for(int i = 0; i < assignOrder.getPeople(); i++){
                            Driver driver = null;
                            int m = 0;
                            int index = 0;
                            // 查询预约单
                            List<OrderPrivateCar> orderPrivateCarss = orderPrivateCarMapper.queryOrderByState(driverIds, 2, 1, 2, 3, 4, 5, 6,  11);
                            List<Integer> orderPrivateCarDriverIds = orderPrivateCars.stream().map(OrderPrivateCar::getDriverId).collect(Collectors.toList());
                            for(int j = 0; j < drivers.size(); j++){
                                Driver driver1 = drivers.get(j);
                                // 判断该司机是否有30分钟内预约单
                                long count = orderPrivateCarss.stream().filter(orderPrivateCar1 -> driver1.getId().equals(orderPrivateCar1.getDriverId())
                                        && DateUtil.dateToLocalDateTime(orderPrivateCar1.getTravelTime()).minusMinutes(30).isBefore(LocalDateTime.now())
                                        && DateUtil.dateToLocalDateTime(orderPrivateCar1.getTravelTime()).isAfter(LocalDateTime.now())).count();
                                if(orderPrivateCar.getOrderType() == 2 && orderPrivateCarDriverIds.contains(driver.getId())){
                                    continue;
                                }
                                if(count > 0){
                                    continue;
                                }
                                String value = redisUtil.getValue("DRIVER" + drivers.get(j).getId());
                                if(null != value){
                boolean lock = redisUtil.lock("order_lock", 10);
                if(!lock){
                    int num1 = 1;
                    while (num1 <= 10){
                        Thread.sleep(3000);//等待3秒
                        lock = redisUtil.lock("order_lock", 10);
                        if(lock){
                            break;
                        }else{
                            num1++;
                        }
                    }
                }
                try {
                    //获取空闲司机
                    List<Driver> drivers = driverService.queryIdleDriver(1, orderPrivateCar.getServerCarModelId(), orderPrivateCar.getStartLon(), orderPrivateCar.getStartLat(), assignOrder.getDistance(), null);//获取范围内空闲司机
                    List<Integer> driverIds = drivers.stream().map(Driver::getId).collect(Collectors.toList());
                    if(drivers.size() > 0) {//有司机,直接指派给司机
                        Driver dr = null;
                        if (drivers.size() > 1) {
                            List<Driver> ds = new ArrayList<>();//存储直线距离最近的几个司机
                            for (int i = 0; i < assignOrder.getPeople(); i++) {
                                Driver driver = null;
                                int m = 0;
                                int index = 0;
                                // 查询预约单
                                List<OrderPrivateCar> orderPrivateCarss = orderPrivateCarMapper.queryOrderByState(driverIds, 2, 1, 2, 3, 4, 5, 6, 11);
                                List<Integer> orderPrivateCarDriverIds = orderPrivateCars.stream().map(OrderPrivateCar::getDriverId).collect(Collectors.toList());
                                for (int j = 0; j < drivers.size(); j++) {
                                    Driver driver1 = drivers.get(j);
                                    if (orderPrivateCar.getOrderType() == 2 && orderPrivateCarDriverIds.contains(driver.getId())) {
                                        continue;
                                    }
                                    // 判断该司机是否有30分钟内预约单
                                    long count = orderPrivateCarss.stream().filter(s -> s.getDriverId().equals(driver1.getId()) &&
                                            DateUtil.dateToLocalDateTime(s.getTravelTime()).minusMinutes(30).isBefore(LocalDateTime.now())).count();
                                    if (count > 0) {
                                        continue;
                                    }
                                    String value = redisUtil.getValue("DRIVER" + drivers.get(j).getId());
                                    if (null != value) {
//                                Map<String, String> distance1 = gdMapElectricFenceUtil.getDistance(orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(), value, 0);//计算距离
//                                Integer d = Integer.valueOf(distance1.get("distance"));
                                    String[] split = value.split(",");
                                    double distance = GDMapGeocodingUtil.getDistance(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]));
                                    int d = Double.valueOf(distance).intValue();
                                    if((0 == m && null == driver) || (d < m)){
                                        driver = drivers.get(j);
                                        String[] split = value.split(",");
                                        double distance = GDMapGeocodingUtil.getDistance(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]));
                                        int d = Double.valueOf(distance).intValue();
                                        if ((0 == m && null == driver) || (d < m)) {
                                            driver = drivers.get(j);
                                            m = d;
                                            index = j;
                                        }
                                    }
                                }
                                ds.add(driver);
                                drivers.remove(index);
                            }
                            //再根据直线距离最短的司机中找出行驶距离最短的司机
                            Integer m = 0;
                            for (Driver driver : ds) {
                                String value = redisUtil.getValue("DRIVER" + driver.getId());
                                if (null != value) {
                                    Map<String, String> distance1 = gdMapElectricFenceUtil.getDistance(orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(), value, 1);//计算距离
                                    Integer d = Integer.valueOf(distance1.get("distance"));
                                    if ((0 == m && null == dr) || (d.intValue() < m.intValue())) {
                                        dr = driver;
                                        m = d;
                                        index = j;
                                    }
                                }
                            }
                            ds.add(driver);
                            drivers.remove(index);
                        } else {
                            List<OrderPrivateCar> orderPrivateCarss = orderPrivateCarMapper.queryOrderByState(driverIds, 2, 1, 2, 3, 4, 5, 6, 11);
                            if (orderPrivateCarss.size() == 0) {
                                dr = drivers.get(0);
                            }
                        }
                        //再根据直线距离最短的司机中找出行驶距离最短的司机
                        Integer m = 0;
                        for(Driver driver : ds){
                            String value = redisUtil.getValue("DRIVER" + driver.getId());
                            if(null != value){
                                Map<String, String> distance1 = gdMapElectricFenceUtil.getDistance(orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(), value, 1);//计算距离
                                Integer d = Integer.valueOf(distance1.get("distance"));
                                if((0 == m && null == dr) || (d.intValue() < m.intValue())){
                                    dr = driver;
                                    m = d;
                        if (Objects.nonNull(dr)) {
                            orderPrivateCar.setDriverId(dr.getId());
                            orderPrivateCar.setCompanyId(dr.getFranchiseeId() != null && dr.getFranchiseeId() != 0 ? dr.getFranchiseeId() : (
                                    dr.getCompanyId() != null && dr.getCompanyId() != 0 ? dr.getCompanyId() : 1));
                            orderPrivateCar.setState(2);
                            orderPrivateCar.setCarId(dr.getCarId());
                            CarService query1 = carServiceMapper.query(1, dr.getCarId());
                            orderPrivateCar.setServerCarModelId(query1.getServerCarModelId());
                            orderPrivateCar.setSnatchOrderTime(new Date());
                            if (orderPrivateCar.getOrderType() != 2) {
                                dr.setState(3);
                            }
                            driverService.updateById(dr);
                            new Thread(new Runnable() {
                                @Override
                                public void run() {
                                    pushUtil.pushOrderState(1, uid, orderPrivateCar.getId(), 1, 2, 0);
                                    pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 2, 0);
                                    pushUtil.pushDriverPosition(orderPrivateCar.getId(), 1);
                                }
                            }
                            }).start();
                        }
                    }else{
                        List<OrderPrivateCar> orderPrivateCarss = orderPrivateCarMapper.queryOrderByState(driverIds, 2, 1, 2, 3, 4, 5, 6,  11);
                        if(orderPrivateCarss.size()==0){
                            dr = drivers.get(0);
                        }
                    }
                    if(Objects.nonNull(dr)){
                        orderPrivateCar.setDriverId(dr.getId());
                        orderPrivateCar.setCompanyId(dr.getFranchiseeId() != null && dr.getFranchiseeId() != 0 ? dr.getFranchiseeId() : (
                                dr.getCompanyId() != null && dr.getCompanyId() != 0 ? dr.getCompanyId() : 1));
                        orderPrivateCar.setState(2);
                        orderPrivateCar.setCarId(dr.getCarId());
                        CarService query1 = carServiceMapper.query(1, dr.getCarId());
                        orderPrivateCar.setServerCarModelId(query1.getServerCarModelId());
                        orderPrivateCar.setSnatchOrderTime(new Date());
                        if(orderPrivateCar.getOrderType() != 2){
                            dr.setState(3);
                        }
                        driverService.updateById(dr);
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                pushUtil.pushOrderState(1, uid, orderPrivateCar.getId(), 1, 2, 0);
                                pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, 2, 0);
                                pushUtil.pushDriverPosition(orderPrivateCar.getId(), 1);
                            }
                        }).start();
                    }
                    //调用高德创建轨迹
                        //调用高德创建轨迹
//                    String s = gdFalconUtil.selectTerminal(dr.getPhone());
//                    String track = gdFalconUtil.createTrack(s);
//                    orderPrivateCar.setTrackId(track);
                    //调用移动的小号接口
                        //调用移动的小号接口
               /* Map<String, String> geocode1 = gdMapGeocodingUtil.geocode(orderPrivateCar.getStartLon().toString(), orderPrivateCar.getStartLat().toString());
                Region region = regionMapper.query(geocode1.get("districtCode"));*/
//                    Map<String, String> map = chinaMobileUtil.midAxbBindSend(orderPrivateCar.getPassengersPhone(), dr.getPhone(), null);
@@ -461,11 +476,16 @@
//                        orderPrivateCar.setTelX(map.get("telX"));
//                        orderPrivateCar.setBindId(map.get("bindId"));
//                    }
                    this.updateById(orderPrivateCar);
                    //发送短信给司机
                        this.updateById(orderPrivateCar);
                        //发送短信给司机
//                    aLiSendSms.sendSms(dr.getPhone(), "SMS_216832951", "{\"" + orderPrivateCar.getStartAddress() + "\"}");
                    }
                }catch (Exception e){
                    e.printStackTrace();
                }finally {
                    redisUtil.unlock("order_lock");
                }
            }
        }
@@ -957,259 +977,276 @@
    @Override
    public ResultUtil payPrivateCarOrder(Integer payType, Integer orderId, Integer couponId, Integer type) throws Exception {
        String value = redisUtil.getValue(orderId + "_status_1");
        if(ToolUtil.isNotEmpty(value) && "8".equals(value)){
            return ResultUtil.error("订单已完成支付,不允许重复支付", "");
        }
        OrderPrivateCar orderPrivateCar = this.selectById(orderId);
        if(orderPrivateCar.getState() == 8 || orderPrivateCar.getState() == 9){
            return ResultUtil.error("订单已完成支付,不允许重复支付", "");
        }
        if(orderPrivateCar.getState() != 7){
            return ResultUtil.error("订单不在待支付状态,不允许支付", "");
        }
        PaymentRecord query3 = paymentRecordService.query(1, null, null, orderId, 1, null, 1);
        if(null != query3){
            ResultUtil<Map<String, Object>> resultUtil1 = payMoneyUtil.queryWXOrder("", query3.getSerialNumber(), "JSAPI");
            if (resultUtil1.getCode() == 200) {
                /**
                 * SUCCESS--支付成功
                 * REFUND--转入退款
                 * NOTPAY--未支付
                 * CLOSED--已关闭
                 * REVOKED--已撤销(刷卡支付)
                 * USERPAYING--用户支付中
                 * PAYERROR--支付失败(其他原因,如银行返回失败)
                 * ACCEPT--已接收,等待扣款
                 */
                String result_code = resultUtil1.getData().get("result_code").toString();
                if("SUCCESS".equals(result_code)){
                    String s = resultUtil1.getData().get("trade_state").toString();
                    if ("REFUND".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s)) {
                        payMoneyUtil.closeWXOrder(query3.getSerialNumber());
                        paymentRecordService.deleteById(query3.getId());
                    }
                    if ("SUCCESS".equals(s) || "ACCEPT".equals(s)) {
                        return ResultUtil.error("不允许重复支付");
                    }
                    if ("NOTPAY".equals(s) || "USERPAYING".equals(s)) {
                        payMoneyUtil.closeWXOrder(query3.getSerialNumber());
                        paymentRecordService.deleteById(query3.getId());
                    }
        boolean lock = redisUtil.lock(orderId + "_payment", 10);
        if(!lock){
            int num1 = 1;
            while (num1 <= 10){
                Thread.sleep(3000);//等待3秒
                lock = redisUtil.lock(orderId + "_payment", 10);
                if(lock){
                    break;
                }else{
                    num1++;
                }
            }
        }
        Integer uid = orderPrivateCar.getUserId();
        Double orderMoney = orderPrivateCar.getOrderMoney();
        UserInfo userInfo = userInfoService.selectById(uid);
        ResultUtil resultUtil = ResultUtil.success(new HashMap<>());
        orderPrivateCar.setCouponMoney(0D);//初始化历史数据
        orderPrivateCar.setCouponId(null);
        //计算优惠券
        UserCouponRecord userCouponRecord = null;
        if(null != couponId){
            userCouponRecord = userCouponRecordService.selectById(couponId);
            if(userCouponRecord.getCompanyId().compareTo(orderPrivateCar.getCompanyId()) != 0){
                return ResultUtil.error("优惠券不能用于此订单", "");
        try {
            OrderPrivateCar orderPrivateCar = this.selectById(orderId);
            if(orderPrivateCar.getState() == 8 || orderPrivateCar.getState() == 9){
                return ResultUtil.error("订单已完成支付,不允许重复支付", "");
            }
            if(userCouponRecord.getState() == 2){
                return ResultUtil.error("优惠券已使用", "");
            if(orderPrivateCar.getState() != 7){
                return ResultUtil.error("订单不在待支付状态,不允许支付", "");
            }
            if(userCouponRecord.getState() == 3){
                return ResultUtil.error("优惠券已过期", "");
            }
            if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 1){
                return ResultUtil.error("优惠券不能用于此类型订单", "");
            }
            if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){
                return ResultUtil.error("优惠券不能用于此订单", "");
            }
            orderMoney = orderMoney - userCouponRecord.getMoney();
            orderPrivateCar.setCouponMoney(userCouponRecord.getMoney());
            orderPrivateCar.setCouponId(couponId);
        }
        orderMoney=new BigDecimal(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
        //计算红包
        UserRedPacketRecord query = userRedPacketRecordService.query(uid, orderPrivateCar.getCompanyId(), 1, 1, orderMoney);
        if(null != query && query.getMoney().compareTo(orderMoney) < 0){
            orderMoney = orderMoney - query.getMoney();
            orderPrivateCar.setRedPacketMoney(query.getMoney());
            orderPrivateCar.setRedPacketId(query.getId());
        }
       //计算折扣
        UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId());
        if(null != query2){
            Integer orderNum=this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())"));
            if(query2.getDistance()*1000>orderPrivateCar.getMileage() && query2.getOrderNum()>orderNum){
                Double special = query2.getSpecial();
                orderPrivateCar.setDiscount(special);
                double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
                if(orderMoney.compareTo(v) > 0){
                    orderPrivateCar.setDiscountMoney(orderMoney - v);
                    orderPrivateCar.setActivityId(query2.getId());
                    orderMoney = v;
            PaymentRecord query3 = paymentRecordService.query(1, null, null, orderId, 1, null, 1);
            if(null != query3){
                ResultUtil<Map<String, Object>> resultUtil1 = payMoneyUtil.queryWXOrder("", query3.getSerialNumber(), "JSAPI");
                if (resultUtil1.getCode() == 200) {
                    /**
                     * SUCCESS--支付成功
                     * REFUND--转入退款
                     * NOTPAY--未支付
                     * CLOSED--已关闭
                     * REVOKED--已撤销(刷卡支付)
                     * USERPAYING--用户支付中
                     * PAYERROR--支付失败(其他原因,如银行返回失败)
                     * ACCEPT--已接收,等待扣款
                     */
                    String result_code = resultUtil1.getData().get("result_code").toString();
                    if("SUCCESS".equals(result_code)){
                        String s = resultUtil1.getData().get("trade_state").toString();
                        if ("REFUND".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s)) {
                            payMoneyUtil.closeWXOrder(query3.getSerialNumber());
                            paymentRecordService.deleteById(query3.getId());
                        }
                        if ("SUCCESS".equals(s) || "ACCEPT".equals(s)) {
                            return ResultUtil.error("不允许重复支付");
                        }
                        if ("NOTPAY".equals(s) || "USERPAYING".equals(s)) {
                            payMoneyUtil.closeWXOrder(query3.getSerialNumber());
                            paymentRecordService.deleteById(query3.getId());
                        }
                    }
                }
            }
        }
        if(ToolUtil.isEmpty(userInfo.getAppletsOpenId())){
            return ResultUtil.error("未授权微信,无法完成支付");
        }
        String code = orderId + "_1_" + UUIDUtil.getRandomCode(5);
        if(payType == 1){//微信支付
            resultUtil = payMoneyUtil.weixinpay("完成订单",orderId +"", code,orderMoney+"","/base/wxPayOrderTaxi","JSAPI",userInfo.getAppletsOpenId());
            if(resultUtil.getCode()==200){
                paymentRecordService.saveData(1, orderPrivateCar.getUserId(), 1, orderId, 1, 1, orderMoney, null, 1, code);//添加预支付数据
                long millis = System.currentTimeMillis();
                new Thread(()->{
                    long time = millis;
                    try {
                        Thread.sleep(5000);
                    } catch (InterruptedException e) {
                        throw new RuntimeException(e);
            Integer uid = orderPrivateCar.getUserId();
            Double orderMoney = orderPrivateCar.getOrderMoney();
            UserInfo userInfo = userInfoService.selectById(uid);
            ResultUtil resultUtil = ResultUtil.success(new HashMap<>());
            orderPrivateCar.setCouponMoney(0D);//初始化历史数据
            orderPrivateCar.setCouponId(null);
            //计算优惠券
            UserCouponRecord userCouponRecord = null;
            if(null != couponId){
                userCouponRecord = userCouponRecordService.selectById(couponId);
                if(userCouponRecord.getCompanyId().compareTo(orderPrivateCar.getCompanyId()) != 0){
                    return ResultUtil.error("优惠券不能用于此订单", "");
                }
                if(userCouponRecord.getState() == 2){
                    return ResultUtil.error("优惠券已使用", "");
                }
                if(userCouponRecord.getState() == 3){
                    return ResultUtil.error("优惠券已过期", "");
                }
                if(userCouponRecord.getCouponUseType() != 0 && userCouponRecord.getCouponUseType() != 1){
                    return ResultUtil.error("优惠券不能用于此类型订单", "");
                }
                if(userCouponRecord.getCouponType() == 2 && orderMoney.compareTo(userCouponRecord.getFullMoney()) < 0){
                    return ResultUtil.error("优惠券不能用于此订单", "");
                }
                orderMoney = orderMoney - userCouponRecord.getMoney();
                orderPrivateCar.setCouponMoney(userCouponRecord.getMoney());
                orderPrivateCar.setCouponId(couponId);
            }
            orderMoney=new BigDecimal(orderMoney).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
            //计算红包
            UserRedPacketRecord query = userRedPacketRecordService.query(uid, orderPrivateCar.getCompanyId(), 1, 1, orderMoney);
            if(null != query && query.getMoney().compareTo(orderMoney) < 0){
                orderMoney = orderMoney - query.getMoney();
                orderPrivateCar.setRedPacketMoney(query.getMoney());
                orderPrivateCar.setRedPacketId(query.getId());
            }
            //计算折扣
            UserActivityDiscount1 query2 = userActivityDiscount1Mapper.query(orderPrivateCar.getCompanyId());
            if(null != query2){
                Integer orderNum=this.selectCount(new EntityWrapper<OrderPrivateCar>().eq("userId",orderPrivateCar.getUserId()).eq("activityId",query2.getId()).last(" and to_days(getoffTime) = to_days(now())"));
                if(query2.getDistance()*1000>orderPrivateCar.getMileage() && query2.getOrderNum()>orderNum){
                    Double special = query2.getSpecial();
                    orderPrivateCar.setDiscount(special);
                    double v = new BigDecimal(orderMoney).multiply(new BigDecimal(special / 10)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
                    if(orderMoney.compareTo(v) > 0){
                        orderPrivateCar.setDiscountMoney(orderMoney - v);
                        orderPrivateCar.setActivityId(query2.getId());
                        orderMoney = v;
                    }
                    //订单创建后15分钟
                    while ((System.currentTimeMillis() - time) <= 900000) {
                }
            }
            if(ToolUtil.isEmpty(userInfo.getAppletsOpenId())){
                return ResultUtil.error("未授权微信,无法完成支付");
            }
            String code = orderId + "_1_" + UUIDUtil.getRandomCode(5);
            if(payType == 1){//微信支付
                resultUtil = payMoneyUtil.weixinpay("完成订单",orderId +"", code,orderMoney+"","/base/wxPayOrderTaxi","JSAPI",userInfo.getAppletsOpenId());
                if(resultUtil.getCode()==200){
                    paymentRecordService.saveData(1, orderPrivateCar.getUserId(), 1, orderId, 1, 1, orderMoney, null, 1, code);//添加预支付数据
                    long millis = System.currentTimeMillis();
                    new Thread(()->{
                        long time = millis;
                        try {
                            String value1 = redisUtil.getValue(orderId + "_status_1");
                            if(ToolUtil.isNotEmpty(value1) && "8".equals(value1)){
                            Thread.sleep(5000);
                        } catch (InterruptedException e) {
                            throw new RuntimeException(e);
                        }
                        //订单创建后15分钟
                        while ((System.currentTimeMillis() - time) <= 900000) {
                            OrderPrivateCar orderPrivateCar1 = OrderPrivateCarServiceImpl.this.selectById(orderId);
                            if(orderPrivateCar1.getState() != 7){
                                break;
                            }
                            ResultUtil<Map<String, Object>> resultUtil2 = payMoneyUtil.queryWXOrder("", code, "JSAPI");
                            if (resultUtil2.getCode() == 200) {
                                /**
                                 * SUCCESS--支付成功
                                 * REFUND--转入退款
                                 * NOTPAY--未支付
                                 * CLOSED--已关闭
                                 * REVOKED--已撤销(刷卡支付)
                                 * USERPAYING--用户支付中
                                 * PAYERROR--支付失败(其他原因,如银行返回失败)
                                 * ACCEPT--已接收,等待扣款
                                 */
                                String s = resultUtil2.getData().get("trade_state").toString();
                                if ("REFUND".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s)) {
                                    break;
                            try {
                                ResultUtil<Map<String, Object>> resultUtil2 = payMoneyUtil.queryWXOrder("", code, "JSAPI");
                                if (resultUtil2.getCode() == 200) {
                                    /**
                                     * SUCCESS--支付成功
                                     * REFUND--转入退款
                                     * NOTPAY--未支付
                                     * CLOSED--已关闭
                                     * REVOKED--已撤销(刷卡支付)
                                     * USERPAYING--用户支付中
                                     * PAYERROR--支付失败(其他原因,如银行返回失败)
                                     * ACCEPT--已接收,等待扣款
                                     */
                                    String s = resultUtil2.getData().get("trade_state").toString();
                                    if ("REFUND".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s)) {
                                        break;
                                    }
                                    if ("SUCCESS".equals(s) || "ACCEPT".equals(s)) {
                                        String transaction_id = resultUtil2.getData().get("transaction_id").toString();
                                        payOrderPrivateCarCallback(orderId, transaction_id, 1);
                                        break;
                                    }
                                    if ("NOTPAY".equals(s) || "USERPAYING".equals(s)) {
                                    }
                                }
                                if ("SUCCESS".equals(s) || "ACCEPT".equals(s)) {
                                    String transaction_id = resultUtil2.getData().get("transaction_id").toString();
                                    payOrderPrivateCarCallback(orderId, transaction_id, 1);
                                    break;
                                }
                                if ("NOTPAY".equals(s) || "USERPAYING".equals(s)) {
                                }
                                Thread.sleep(5000);
                            }catch (Exception e){
                                e.printStackTrace();
                            }
                            Thread.sleep(5000);
                        }catch (Exception e){
                            e.printStackTrace();
                        }
                        OrderPrivateCar orderPrivateCar1 = OrderPrivateCarServiceImpl.this.selectById(orderId);
                        if(7 == orderPrivateCar1.getState()){
                            //关闭订单,不允许支付
                            payMoneyUtil.closeWXOrder(code);
                            PaymentRecord paymentRecord = paymentRecordService.selectOne(new EntityWrapper<PaymentRecord>().eq("serialNumber", code));
                            if(null != paymentRecord){
                                paymentRecordService.deleteById(paymentRecord.getId());
                            }
                        }
                    }).start();
                }else{
                    resultUtil = ResultUtil.error("支付失败", "");
                }
            }
            if(payType == 2) {//支付宝支付
                resultUtil =  payMoneyUtil.alipay("完成订单","完成订单", "",code,orderMoney+"","/base/aliPayOrderTaxi");
                if (resultUtil.getCode()==200) {
                    paymentRecordService.saveData(1, orderPrivateCar.getUserId(), 1, orderId, 1, 2, orderMoney, null, 1, code);//添加预支付数据
                } else {
                    resultUtil = ResultUtil.error("支付失败", "");
                }
            }
            if(payType == 3){//余额支付
                if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){
                    return ResultUtil.error("余额不足,无法完成支付", "");
                }
                userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                SysIntegral query1 = sysIntegralMapper.query(orderPrivateCar.getCompanyId());
                userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
                //添加交易明细
                transactionDetailsService.saveData(uid, "完成订单", orderMoney, 2, 1, 1, 1, orderId);
                userInfoService.updateById(userInfo);
                orderPrivateCar.setState(8);
                orderPrivateCar.setPayType(3);
                orderPrivateCar.setPayMoney(orderMoney);
                orderPrivateCar.setOrderMoney(orderPrivateCar.getOrderMoney()+orderPrivateCar.getFreeMoney().doubleValue());
                //处理优惠券和红包
                if(null != userCouponRecord){
                    userCouponRecord.setState(2);
                    userCouponRecord.setEndTime(new Date());
                    userCouponRecordService.updateById(userCouponRecord);
                }
                if(null != query){
                    query.setState(2);
                    query.setEndTime(new Date());
                    userRedPacketRecordService.updateById(query);
                }
                if(orderPrivateCar.getIsplatPay()==1){
                    //添加已收入明细
                    Company company = companyService.selectById(orderPrivateCar.getCompanyId());
                    Double speMoney = company.getSpeMoney();
                    BigDecimal d = null;//企业收入
                    BigDecimal c = null;//司机收入
                    if(company.getIsSpeFixedOrProportional() == 2){//固定
                        d = new BigDecimal(speMoney);
                        c = new BigDecimal(orderPrivateCar.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机
                    }
                    String value1 = redisUtil.getValue(orderId + "_status_1");
                    if(ToolUtil.isNotEmpty(value1) && "7".equals(value1)){
                        //关闭订单,不允许支付
                        payMoneyUtil.closeWXOrder(code);
                        PaymentRecord paymentRecord = paymentRecordService.selectOne(new EntityWrapper<PaymentRecord>().eq("serialNumber", code));
                        if(null != paymentRecord){
                            paymentRecordService.deleteById(paymentRecord.getId());
                        }
                    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), new MathContext(2, RoundingMode.HALF_EVEN))).setScale(2, BigDecimal.ROUND_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());
                    incomeService.saveData(2, orderPrivateCar.getDriverId(), 2, orderPrivateCar.getId(), 1, c.doubleValue());
                    Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
                    driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                    driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                    driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                    driverService.updateById(driver);
                }
                // TODO: 2020/5/24 这里需要给司机和用户推送订单状态
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0);
                        pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0);
                    }
                }).start();
            }else{
                resultUtil = ResultUtil.error("支付失败", "");
                systemNoticeService.addSystemNotice(1, "您已使用余额成功完成出行订单支付,谢谢使用!", uid, 1);
            }
        }
        if(payType == 2) {//支付宝支付
            resultUtil =  payMoneyUtil.alipay("完成订单","完成订单", "",code,orderMoney+"","/base/aliPayOrderTaxi");
            if (resultUtil.getCode()==200) {
                paymentRecordService.saveData(1, orderPrivateCar.getUserId(), 1, orderId, 1, 2, orderMoney, null, 1, code);//添加预支付数据
            } else {
                resultUtil = ResultUtil.error("支付失败", "");
            }
        }
        if(payType == 3){//余额支付
            if(userInfo.getBalance() == null || userInfo.getBalance() < orderMoney){
                return ResultUtil.error("余额不足,无法完成支付", "");
            }
            userInfo.setBalance(new BigDecimal(userInfo.getBalance()).subtract(new BigDecimal(orderMoney)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
            SysIntegral query1 = sysIntegralMapper.query(orderPrivateCar.getCompanyId());
            userInfo.setIntegral(userInfo.getIntegral() + (orderMoney.intValue() * query1.getIntegral()));//积分
            //添加交易明细
            transactionDetailsService.saveData(uid, "完成订单", orderMoney, 2, 1, 1, 1, orderId);
            userInfoService.updateById(userInfo);
            orderPrivateCar.setState(8);
            orderPrivateCar.setPayType(3);
            orderPrivateCar.setPayMoney(orderMoney);
            orderPrivateCar.setOrderMoney(orderPrivateCar.getOrderMoney()+orderPrivateCar.getFreeMoney().doubleValue());
            //处理优惠券和红包
            if(null != userCouponRecord){
                userCouponRecord.setState(2);
                userCouponRecord.setEndTime(new Date());
                userCouponRecordService.updateById(userCouponRecord);
            }
            if(null != query){
                query.setState(2);
                query.setEndTime(new Date());
                userRedPacketRecordService.updateById(query);
            }
            if(orderPrivateCar.getIsplatPay()==1){
                //添加已收入明细
                Company company = companyService.selectById(orderPrivateCar.getCompanyId());
                Double speMoney = company.getSpeMoney();
                BigDecimal d = null;//企业收入
                BigDecimal c = null;//司机收入
                if(company.getIsSpeFixedOrProportional() == 2){//固定
                    d = new BigDecimal(speMoney);
                    c = new BigDecimal(orderPrivateCar.getOrderMoney()).subtract(d);//只有出行金额参与抽成,其余归属司机
                }
                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), new MathContext(2, RoundingMode.HALF_EVEN))).setScale(2, BigDecimal.ROUND_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());
                incomeService.saveData(2, orderPrivateCar.getDriverId(), 2, orderPrivateCar.getId(), 1, c.doubleValue());
                Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
                driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                driverService.updateById(driver);
            }
            // TODO: 2020/5/24 这里需要给司机和用户推送订单状态
            this.updateAllColumnById(orderPrivateCar);
            new Thread(new Runnable() {
                @Override
                public void run() {
                    pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0);
                    pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0);
                    if(pushMinistryOfTransport){//上传数据
                        pushMinistryOfTransportUtil.operatePay(orderId);
                    }
                }
            }).start();
            systemNoticeService.addSystemNotice(1, "您已使用余额成功完成出行订单支付,谢谢使用!", uid, 1);
            return resultUtil;
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            redisUtil.unlock(orderId + "_payment");
        }
        this.updateAllColumnById(orderPrivateCar);
        new Thread(new Runnable() {
            @Override
            public void run() {
                if(pushMinistryOfTransport){//上传数据
                    pushMinistryOfTransportUtil.operatePay(orderId);
                }
            }
        }).start();
        return resultUtil;
        return ResultUtil.error("支付异常");
    }
    @Override
@@ -1359,81 +1396,100 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public synchronized void payOrderPrivateCarCallback(Integer id, String order_id, Integer type) throws Exception {
        PaymentRecord query = paymentRecordService.query(1, null, null, Integer.valueOf(id), 1, type, null);
        if(null != query){
            String value = redisUtil.getValue(order_id + "_status_1");
            if(ToolUtil.isNotEmpty(value) && "8".equals(value)){
                return;
            }
            //添加交易明细
            OrderPrivateCar orderPrivateCar = this.selectById(id);
            transactionDetailsService.saveData(orderPrivateCar.getUserId(), "完成订单", query.getAmount(), 2, 1, 1, 1, query.getOrderId());
            orderPrivateCar.setState(8);
            orderPrivateCar.setPayType(type);
            orderPrivateCar.setOrderMoney(orderPrivateCar.getOrderMoney()+orderPrivateCar.getFreeMoney().doubleValue());
            orderPrivateCar.setPayMoney(query.getAmount());
            this.updateById(orderPrivateCar);
            UserInfo userInfo = userInfoService.selectById(orderPrivateCar.getUserId());
            SysIntegral query1 = sysIntegralMapper.query(orderPrivateCar.getCompanyId());
            userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分
            userInfoService.updateById(userInfo);
            //处理优惠券和红包
            if(null != orderPrivateCar.getCouponId()){
                UserCouponRecord userCouponRecord = userCouponRecordService.selectById(orderPrivateCar.getCouponId());
                userCouponRecord.setState(2);
                userCouponRecord.setEndTime(new Date());
                userCouponRecordService.updateById(userCouponRecord);
            }
            if(null != orderPrivateCar.getRedPacketId()){
                UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(orderPrivateCar.getRedPacketId());
                userRedPacketRecord.setState(2);
                userRedPacketRecord.setEndTime(new Date());
                userRedPacketRecordService.updateById(userRedPacketRecord);
            }
            query.setState(2);
            query.setCode(order_id);
            paymentRecordService.updateById(query);
            redisUtil.setStrValue(order_id + "_status_1", "8");
            if(orderPrivateCar.getIsplatPay()==1){
                //添加已收入明细
                Company company = companyService.selectById(orderPrivateCar.getCompanyId());
                Double taxi = company.getSpeMoney();
                BigDecimal d = null;//企业收入
                BigDecimal c = null;//司机收入
                if(company.getIsSpeFixedOrProportional() == 2){//固定
                    d = new BigDecimal(taxi);
                    c = new BigDecimal(orderPrivateCar.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
        boolean lock = redisUtil.lock(order_id + "_paymentCallback", 10);
        if(!lock){
            int num1 = 1;
            while (num1 <= 10){
                Thread.sleep(3000);//等待3秒
                lock = redisUtil.lock(order_id + "_paymentCallback", 10);
                if(lock){
                    break;
                }else{
                    num1++;
                }
                if(company.getIsSpeFixedOrProportional() == 1){//比例
                    Double price = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getDurationMoney() + orderPrivateCar.getLongDistanceMoney();
                    d = new BigDecimal(price).multiply(new BigDecimal(taxi).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))).setScale(2, BigDecimal.ROUND_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());
                incomeService.saveData(2, orderPrivateCar.getDriverId(), 2, orderPrivateCar.getId(), 1, c.doubleValue());
                Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
                driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                driverService.updateById(driver);
            }
            // TODO: 2020/5/24 这里需要给司机和用户推送订单状态
            new Thread(new Runnable() {
                @Override
                public void run() {
                    pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0);
                    pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0);
        }
        try {
            PaymentRecord query = paymentRecordService.query(1, null, null, Integer.valueOf(id), 1, type, null);
            if(null != query){
                //添加交易明细
                OrderPrivateCar orderPrivateCar = this.selectById(id);
                if(7 != orderPrivateCar.getState()){
                    return;
                }
            }).start();
            systemNoticeService.addSystemNotice(1, "您已使用" + (type == 1 ? "微信" : "支付宝") + "成功完成出行订单支付,谢谢使用!", orderPrivateCar.getUserId(), 1);
        }else{
            System.err.println("预支付数据异常(orderId = "  + id + ")");
                transactionDetailsService.saveData(orderPrivateCar.getUserId(), "完成订单", query.getAmount(), 2, 1, 1, 1, query.getOrderId());
                orderPrivateCar.setState(8);
                orderPrivateCar.setPayType(type);
                orderPrivateCar.setOrderMoney(orderPrivateCar.getOrderMoney()+orderPrivateCar.getFreeMoney().doubleValue());
                orderPrivateCar.setPayMoney(query.getAmount());
                this.updateById(orderPrivateCar);
                UserInfo userInfo = userInfoService.selectById(orderPrivateCar.getUserId());
                SysIntegral query1 = sysIntegralMapper.query(orderPrivateCar.getCompanyId());
                userInfo.setIntegral(userInfo.getIntegral() + (query.getAmount().intValue() * query1.getIntegral()));//积分
                userInfoService.updateById(userInfo);
                //处理优惠券和红包
                if(null != orderPrivateCar.getCouponId()){
                    UserCouponRecord userCouponRecord = userCouponRecordService.selectById(orderPrivateCar.getCouponId());
                    userCouponRecord.setState(2);
                    userCouponRecord.setEndTime(new Date());
                    userCouponRecordService.updateById(userCouponRecord);
                }
                if(null != orderPrivateCar.getRedPacketId()){
                    UserRedPacketRecord userRedPacketRecord = userRedPacketRecordService.selectById(orderPrivateCar.getRedPacketId());
                    userRedPacketRecord.setState(2);
                    userRedPacketRecord.setEndTime(new Date());
                    userRedPacketRecordService.updateById(userRedPacketRecord);
                }
                query.setState(2);
                query.setCode(order_id);
                paymentRecordService.updateById(query);
                if(orderPrivateCar.getIsplatPay()==1){
                    //添加已收入明细
                    Company company = companyService.selectById(orderPrivateCar.getCompanyId());
                    Double taxi = company.getSpeMoney();
                    BigDecimal d = null;//企业收入
                    BigDecimal c = null;//司机收入
                    if(company.getIsSpeFixedOrProportional() == 2){//固定
                        d = new BigDecimal(taxi);
                        c = new BigDecimal(orderPrivateCar.getOrderMoney()).subtract(d).setScale(2, BigDecimal.ROUND_HALF_EVEN);
                    }
                    if(company.getIsSpeFixedOrProportional() == 1){//比例
                        Double price = orderPrivateCar.getStartMoney() + orderPrivateCar.getMileageMoney() + orderPrivateCar.getWaitMoney() + orderPrivateCar.getDurationMoney() + orderPrivateCar.getLongDistanceMoney();
                        d = new BigDecimal(price).multiply(new BigDecimal(taxi).divide(new BigDecimal(100), new MathContext(2, RoundingMode.HALF_EVEN))).setScale(2, BigDecimal.ROUND_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());
                    incomeService.saveData(2, orderPrivateCar.getDriverId(), 2, orderPrivateCar.getId(), 1, c.doubleValue());
                    Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
                    driver.setBusinessMoney(new BigDecimal(null != driver.getBusinessMoney() ? driver.getBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                    driver.setLaveBusinessMoney(new BigDecimal(null != driver.getLaveBusinessMoney() ? driver.getLaveBusinessMoney() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                    driver.setBalance(new BigDecimal(null != driver.getBalance() ? driver.getBalance() : 0).add(c).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                    driverService.updateById(driver);
                }
                // TODO: 2020/5/24 这里需要给司机和用户推送订单状态
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        pushUtil.pushOrderState(1, orderPrivateCar.getUserId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0);
                        pushUtil.pushOrderState(2, orderPrivateCar.getDriverId(), orderPrivateCar.getId(), 1, orderPrivateCar.getState(), 0);
                    }
                }).start();
                systemNoticeService.addSystemNotice(1, "您已使用" + (type == 1 ? "微信" : "支付宝") + "成功完成出行订单支付,谢谢使用!", orderPrivateCar.getUserId(), 1);
            }else{
                System.err.println("预支付数据异常(orderId = "  + id + ")");
            }
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            redisUtil.unlock(order_id + "_paymentCallback");
        }
    }