puzhibing
2023-05-18 53562814add61acfdc02d6b25dae6324f6fd5f92
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/specialTrain/server/impl/OrderPrivateCarServiceImpl.java
@@ -4,6 +4,7 @@
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;
@@ -24,6 +25,8 @@
import java.io.FileWriter;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.*;
@@ -64,13 +67,7 @@
    private GDMapElectricFenceUtil gdMapElectricFenceUtil;
    @Autowired
    private PushMinistryOfTransportUtil pushMinistryOfTransportUtil;
    @Autowired
    private IOrderTaxiService orderTaxiService;
    @Value("${pushMinistryOfTransport}")
    private boolean pushMinistryOfTransport;
    @Resource
@@ -220,18 +217,6 @@
        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();
        return ResultUtil.success();
    }
@@ -260,12 +245,12 @@
    @Override
    public ResultUtil process(Integer orderId, Integer state, Double lon, Double lat, String address,String phone) 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(state==5){
//            UserInfo userInfo = userInfoMapper.selectById(orderPrivateCar.getUserId());
//            if(!userInfo.getPhone().substring(7, userInfo.getPhone().length()).equals(phone)){
//                return ResultUtil.error("手机号错误");
//            }
//        }
        if(state==3 && orderPrivateCar.getState()!=2){
            return ResultUtil.error("当前订单不能触发前往预约地点");
        }
@@ -296,14 +281,6 @@
                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);
@@ -393,7 +370,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());
@@ -442,19 +419,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();
    }
@@ -590,6 +554,7 @@
        //夜间服务处理逻辑
        if(ToolUtil.isNotEmpty(num16)){
        Calendar s = Calendar.getInstance();
        s.setTime(date);
        s.set(Calendar.HOUR_OF_DAY, Integer.valueOf(num16.split(" - ")[0].split(":")[0]));
@@ -639,6 +604,7 @@
            orderPrivateCar.setMoneyTime(num16);
            return orderPrivateCar;
        }
        }
        //高峰时段处理逻辑