Pu Zhibing
2025-04-25 fc5b7d2d48a90ffbd0d033598f12ee3d9c1625f7
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -400,6 +400,8 @@
        orderLogistics.setTravelTime(null == travelTime ? new Date() : travelTime);
        orderLogistics.setOrderSource(orderSource);
        orderLogistics.setIsDelete(1);
        orderLogistics.setTripId(tripId);
        orderLogistics.setIsover(0);
        this.insert(orderLogistics);
        //添加消息
@@ -670,8 +672,7 @@
        if(ToolUtil.isEmpty(userInfo.getPhone())){
            return ResultUtil.error(language == 1 ? "请先绑定手机号码" : language == 2 ? "Please bind your mobile phone number first." : "Veuillez d’abord vous inscrire en liant votre numéro de téléphone portable.");
        }
        String[] split1 = placementLon.split(",");
        Company company = companyCityService.query1(uid, split1[0], split1[1]);
        Company company = companyCityService.query1(uid, placementLon, placementLat);
        if(null != userInfo && null != company){
            userInfo.setCompanyId(company.getId());
            userInfoService.updateById(userInfo);
@@ -779,6 +780,7 @@
        orderLogistics.setIsReassign(1);
        orderLogistics.setIsDelete(1);
        orderLogistics.setTripId(tripId);
        orderLogistics.setIsover(0);
        DistancematrixVo distancematrix1 = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), orderLogistics.getEndLat(), orderLogistics.getEndLon(), tripId);
        Long distance1 = distancematrix1.getDistance();
        orderLogistics.setEstimatedMileage(new BigDecimal(distance1).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue());
@@ -971,10 +973,20 @@
                                dr.getCompanyId() != null && dr.getCompanyId() != 0 ? dr.getCompanyId() : 1));
                        orderLogistics.setState(2);
                        orderLogistics.setCarId(dr.getCarId());
                        CarService query1 = carServiceMapper.query(1, dr.getCarId());
                        CarService query1 = carServiceMapper.query(4, dr.getCarId());
                        orderLogistics.setServerCarModelId(query1.getServerCarModelId());
                        orderLogistics.setSnatchOrderTime(new Date());
    
                        String value = redisUtil.getValue("DRIVER" + driver1.getId());
                        if(ToolUtil.isNotEmpty(value)) {
                            String[] split = value.split(",");
                            DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderLogistics.getStartLat(), orderLogistics.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]), tripId);
                            //超时时间
                            long timeOut = System.currentTimeMillis() + (distancematrix.getDuration() * 1000);
                            orderLogistics.setEstimateArriveTime(new Date(timeOut));
                            orderLogistics.setEstimateArriveMileage(distancematrix.getDistance());
                        }
                        dr.setState(3);
                        driverService.updateById(dr);
                        this.updateById(orderLogistics);
@@ -1026,10 +1038,12 @@
                        new Thread(new Runnable() {
                            @Override
                            public void run() {
                                System.err.println("直推司机后推送司机订单状态");
                                pushUtil.pushOrderState(1, uid, orderLogistics.getId(), 4, 2, 0, "");
                                pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), 4, 2, 0, finalAudioUrl);
                            }
                        }).start();
                    }
                }
            }
@@ -3223,16 +3237,16 @@
        if(orderLogistics.getState() > 5 && orderLogistics.getState() != 11 && orderLogistics.getState() != 12){
            return ResultUtil.error(language == 1 ? "取消订单失败,不合法的操作" : language == 2 ? "Failed to cancel order, illegal operation." : "Échec de l’annulation de la commande, opération illégale.");
        }
        orderCancelService.delete(new EntityWrapper<OrderCancel>().eq("orderId", orderLogistics.getId()).eq("orderType", 4));
        if(null == orderLogistics.getDriverId()){//没有接单的情况
            integer = orderCancelService.saveData(id, 4, language == 1 ? "无司机接单" : language == 2 ? "No driver to take orders" : "Pas de chauffeur pour prendre les commandes", language == 1 ? "无司机接单" : language == 2 ? "No driver to take orders" : "Pas de chauffeur pour prendre les commandes", null, null, 2, 1, uid);
            integer = orderCancelService.saveData(id, 4, language == 1 ? "无司机接单" : language == 2 ? "No driver to take orders" : "Pas de chauffeur pour prendre les commandes", language == 1 ? "无司机接单" : language == 2 ? "No driver to take orders" : "Pas de chauffeur pour prendre les commandes", null, 0D, 2, 1, uid);
            orderLogistics.setState(10);
            this.updateById(orderLogistics);
        }else {
            BaseWarpper data = queryCancleAmount(id, language).getData();
            Double amount = data.getAmount();
            if(0 == amount){
                integer = orderCancelService.saveData(id, 4, reason, remark, null, null, 2, 1, uid);
                integer = orderCancelService.saveData(id, 4, reason, remark, null, 0D, 2, 1, uid);
                if(5 == orderLogistics.getState()){
                    orderLogistics.setState(6);
                    orderLogistics.setGetoffLon(lon);
@@ -3499,7 +3513,10 @@
        BaseWarpper baseWarpper = new BaseWarpper();
        double amount = 0;
        CancleOrder query = cancleOrderService.query(orderLogistics.getCompanyId());
        if(null == query || null == orderLogistics.getDriverId() || orderLogistics.getState() == 11){
        if(null == query){
            return ResultUtil.error("请先添加取消规则");
        }
        if(null == orderLogistics.getDriverId() || orderLogistics.getState() == 11){
            baseWarpper.setAmount(amount);
            return ResultUtil.success(baseWarpper);
        }