zhibing.pu
2024-08-01 656ac293601d6da08d25e892a79604fe3edcd086
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -53,6 +53,9 @@
    @Resource
    private OrderLogisticsMapper orderLogisticsMapper;
    @Resource
    private IOrderCancelService orderCancelService;
    @Autowired
    private IDriverService driverService;
@@ -218,7 +221,7 @@
            CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", driver.getCompanyId()));
            Integer driverTimeout = JSON.parseObject(cancleOrder.getContent()).getInteger("driverTimeout");
            //超时时间
            long timeOut = orderLogistics.getEstimateArriveTime().getTime() + (driverTimeout * 60 * 1000);
            long timeOut = orderLogistics.getEstimateArriveTime().getTime() + (driverTimeout * 60000);
            //乘客取消不收费提醒
            JobDataMap jobDataMap = new JobDataMap();
            jobDataMap.put("driverId", uid);
@@ -227,9 +230,10 @@
            jobDataMap.put("orderType", 4);
            jobDataMap.put("language", language);
            jobDataMap.put("timeOut", timeOut);
            jobDataMap.put("driverTimeout", driverTimeout);
            jobDataMap.put("describe", language == 1 ? "您已超时" + driverTimeout + "分钟,用户可免费取消订单" : language == 2 ? "Reminder You are overdue for " + driverTimeout + " minutes The subscriber could cancel the order for free Confirm" : "Rappel Vous êtes en retard de " + driverTimeout + " minutes L’abonné peut annuler la commande gratuitement Confirmer");
            QuartzUtil.addSimpleQuartzTask(
                    new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderLogistics.getId() + "_4", "ORDER_TIME_OUT", jobDataMap)
                    new OrderTimeOutJob().buildQuartzJob("1_" + orderLogistics.getId() + "_4", "ORDER_TIME_OUT", jobDataMap)
                    , new Date(timeOut), timeOut, 0);
    
            //超时循环提醒
@@ -240,9 +244,10 @@
            jobDataMap.put("orderType", 4);
            jobDataMap.put("language", language);
            jobDataMap.put("timeOut", orderLogistics.getEstimateArriveTime().getTime());
            jobDataMap.put("driverTimeout", driverTimeout);
            jobDataMap.put("describe", "");
            QuartzUtil.addSimpleQuartzTask(
                    new OrderTimeOutJob().buildQuartzJob(UUIDUtil.getRandomCode(5) + "_" + orderLogistics.getId() + "_4", "ORDER_TIME_OUT", jobDataMap)
                    new OrderTimeOutJob().buildQuartzJob("3_" + orderLogistics.getId() + "_4", "ORDER_TIME_OUT", jobDataMap)
                    , orderLogistics.getEstimateArriveTime(), reminderRules.getCar() * 60000, -1);
        }
    
@@ -275,8 +280,8 @@
        new Thread(new Runnable() {
            @Override
            public void run() {
                pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState());
                pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState());
                pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "");
                pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "");
            }
        }).start();
@@ -299,11 +304,28 @@
    @Override
    public Map<String, Object> queryOrderInfo(Integer language, Integer orderId) throws Exception {
        Map<String, Object> map = orderLogisticsMapper.queryOrderInfo(orderId);
        OrderLogistics orderLogistics = this.selectById(orderId);
        if(null != map.get("travelTime_")){
            String travelTime_ = map.get("travelTime_").toString();
            map.put("travelTime_", DateUtil.conversionFormat1(language, travelTime_));
        }
        Integer orderState = Integer.valueOf(map.get("orderState").toString());
        if(orderState == 12){
            OrderCancel orderCancel = orderCancelService.selectOne(new EntityWrapper<OrderCancel>().eq("orderId", orderId)
                    .eq("orderType", 4).eq("state", 1).orderBy("insertTime desc limit 0, 1"));
            if(null != orderCancel){
                map.put("cancelPayMoney", orderCancel.getMoney());
            }
        }
        map.put("cancelUser", language == 1 ? "用户" : language == 2 ? "The client" : "Le client");
        map.put("timeOutCancel", 0);
        if(null != orderLogistics.getEstimateArriveTime()){
            CancleOrder cancleOrder = cancleOrderService.selectOne(new EntityWrapper<CancleOrder>().eq("companyId", orderLogistics.getCompanyId()));
            JSONObject jsonObject = JSON.parseObject(cancleOrder.getContent());
            int driverTimeout = jsonObject.getIntValue("driverTimeout");
            long timeOutCancel = orderLogistics.getEstimateArriveTime().getTime() + driverTimeout;
            map.put("timeOutCancel", timeOutCancel);
        }
        return map;
    }
@@ -395,8 +417,8 @@
        new Thread(new Runnable() {
            @Override
            public void run() {
                pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState());
                pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState());
                pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "");
                pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "");
            }
        }).start();
        
@@ -531,8 +553,8 @@
        new Thread(new Runnable() {
            @Override
            public void run() {
                pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState());
                pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState());
                pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "");
                pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "");
            }
        }).start();
@@ -1050,8 +1072,8 @@
        new Thread(new Runnable() {
            @Override
            public void run() {
                pushUtil.pushOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 4, finalOrderTaxi.getState());
                pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 4, finalOrderTaxi.getState());
                pushUtil.pushOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 4, finalOrderTaxi.getState(), 0, "");
                pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 4, finalOrderTaxi.getState(), 0, "");
            }
        }).start();
    
@@ -1079,6 +1101,9 @@
    @Override
    public boolean calculateMileage(Integer orderId, String lon, String lat) throws Exception {
        OrderLogistics orderLogistics = this.selectById(orderId);
        if(orderLogistics.getState() == 2){
            return false;
        }
        OrderPosition orderPosition = orderPositionService.queryNew(orderId, 4);
        String now = lon + "," + lat;
        String old = null;
@@ -1094,7 +1119,7 @@
        Map<String, Double> distance = GeodesyUtil.getDistance(now, old);
        if(null != distance){
            Double distance1 = distance.get("WGS84");
            if(distance1 > 50 && orderLogistics.getState() < 5){//大于50米表示在移动
            if(distance1 > 50 &&  Arrays.asList(3, 4).contains(orderLogistics.getState())){//大于50米表示在移动
                orderLogistics.setToStartPointMileage(new BigDecimal(orderLogistics.getToStartPointMileage()).add(new BigDecimal(distance1)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue());
                this.updateById(orderLogistics);
                return true;