Pu Zhibing
2025-05-09 bd320a2fd55964833d1d8f137beb1a169d0b88f2
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);
        //添加消息
@@ -778,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());
@@ -970,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);
@@ -1025,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();
                    }
                }
            }
@@ -1127,10 +1142,9 @@
        if(null != redDeduction && 1 == redDeduction && null == orderLogistics.getRedPacketId()){
            RedEnvelopePaymentSettings redEnvelopePaymentSettings = redEnvelopePaymentSettingsService.getRedEnvelopePaymentSettings();
            if(null != redEnvelopePaymentSettings){
                Double total = userRedPacketRecordService.queryRemainingAmount(uid);
                List<UserRedPacketRecord> userRedPacketRecords = userRedPacketRecordService.selectList(new EntityWrapper<UserRedPacketRecord>().eq("userId", uid)
                        .eq("state", 1).eq("companyId", orderLogistics.getCompanyId()).gt("remainingAmount", 0).orderBy("insertTime", false));
                Double total = userRedPacketRecords.stream().mapToDouble(UserRedPacketRecord::getRemainingAmount).sum();
                BigDecimal deductionRatio = redEnvelopePaymentSettings.getDeductionRatio();
                BigDecimal multiply1 = orderMoney.multiply(deductionRatio.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_EVEN);
                if(total > 0 && multiply1.doubleValue() > 0 && total.compareTo(multiply1.doubleValue()) >= 0){
@@ -1343,6 +1357,9 @@
                            if(null != orderLogistics.getDriverId()){
                                aDouble = orderEvaluateService.queryDriverScore(orderLogistics.getDriverId());
                            }
                            Double aDouble1 = new BigDecimal(orderLogistics.getMileage()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
                            Long serviceTime = new BigDecimal(orderLogistics.getEndServiceTime().getTime() - orderLogistics.getStartServiceTime().getTime()).divide(new BigDecimal(60000)).setScale(0, RoundingMode.HALF_EVEN).longValue();
                            if(1 == finalLanguage1){
                                document.getElementById("english").remove();
                                document.getElementById("french").remove();
@@ -1443,6 +1460,8 @@
                                cp_chinese.text("车牌:" + car.getCarLicensePlate());
                                Element pf_chinese = document.getElementById("pf_chinese");
                                pf_chinese.text("司机评分:" + aDouble);
                                Element lc_chinese = document.getElementById("lc_chinese");
                                lc_chinese.text("里程:" + aDouble1 + "公里 /" + serviceTime + "分钟");
                                Element start_address_chinese = document.getElementById("start_address_chinese");
                                start_address_chinese.text(orderLogistics.getStartAddress());
                                Element end_address_chinese = document.getElementById("end_address_chinese");
@@ -1551,6 +1570,8 @@
                                cp_english.text("Number Plate:" + car.getCarLicensePlate());
                                Element pf_english = document.getElementById("pf_english");
                                pf_english.text("Driver Rating:" + aDouble);
                                Element lc_english = document.getElementById("lc_english");
                                lc_english.text("Mileage:" + aDouble1 + "KM / " + serviceTime + "Minutes");
                                Element start_address_english = document.getElementById("start_address_english");
                                start_address_english.text(orderLogistics.getStartAddress());
                                Element end_address_english = document.getElementById("end_address_english");
@@ -1659,6 +1680,8 @@
                                cp_french.text("Plaque: GS " + car.getCarLicensePlate());
                                Element pf_french = document.getElementById("pf_french");
                                pf_french.text("Note du chauffeur: " + aDouble);
                                Element lc_french = document.getElementById("lc_french");
                                lc_french.text("Distance: " + aDouble1 + "km / " + serviceTime + "minutes");
                                Element start_address_french = document.getElementById("start_address_french");
                                start_address_french.text(orderLogistics.getStartAddress());
                                Element end_address_french = document.getElementById("end_address_french");
@@ -1980,6 +2003,8 @@
                            if(null != orderLogistics.getDriverId()){
                                aDouble = orderEvaluateService.queryDriverScore(orderLogistics.getDriverId());
                            }
                            Double aDouble1 = new BigDecimal(orderLogistics.getMileage()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
                            Long serviceTime = new BigDecimal(orderLogistics.getEndServiceTime().getTime() - orderLogistics.getStartServiceTime().getTime()).divide(new BigDecimal(60000)).setScale(0, RoundingMode.HALF_EVEN).longValue();
                            if(1 == finalLanguage){
                                document.getElementById("english").remove();
                                document.getElementById("french").remove();
@@ -2080,6 +2105,8 @@
                                cp_chinese.text("车牌:" + car.getCarLicensePlate());
                                Element pf_chinese = document.getElementById("pf_chinese");
                                pf_chinese.text("司机评分:" + aDouble);
                                Element lc_chinese = document.getElementById("lc_chinese");
                                lc_chinese.text("里程:" + aDouble1 + "公里 /" + serviceTime + "分钟");
                                Element start_address_chinese = document.getElementById("start_address_chinese");
                                start_address_chinese.text(orderLogistics.getStartAddress());
                                Element end_address_chinese = document.getElementById("end_address_chinese");
@@ -2188,6 +2215,8 @@
                                cp_english.text("Number Plate:" + car.getCarLicensePlate());
                                Element pf_english = document.getElementById("pf_english");
                                pf_english.text("Driver Rating:" + aDouble);
                                Element lc_english = document.getElementById("lc_english");
                                lc_english.text("Mileage:" + aDouble1 + "KM / " + serviceTime + "Minutes");
                                Element start_address_english = document.getElementById("start_address_english");
                                start_address_english.text(orderLogistics.getStartAddress());
                                Element end_address_english = document.getElementById("end_address_english");
@@ -2296,6 +2325,8 @@
                                cp_french.text("Plaque: GS " + car.getCarLicensePlate());
                                Element pf_french = document.getElementById("pf_french");
                                pf_french.text("Note du chauffeur: " + aDouble);
                                Element lc_french = document.getElementById("lc_french");
                                lc_french.text("Distance: " + aDouble1 + "km / " + serviceTime + "minutes");
                                Element start_address_french = document.getElementById("start_address_french");
                                start_address_french.text(orderLogistics.getStartAddress());
                                Element end_address_french = document.getElementById("end_address_french");
@@ -2628,6 +2659,8 @@
                if(null != orderLogistics.getDriverId()){
                    aDouble = orderEvaluateService.queryDriverScore(orderLogistics.getDriverId());
                }
                Double aDouble1 = new BigDecimal(orderLogistics.getMileage()).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
                Long serviceTime = new BigDecimal(orderLogistics.getEndServiceTime().getTime() - orderLogistics.getStartServiceTime().getTime()).divide(new BigDecimal(60000)).setScale(0, RoundingMode.HALF_EVEN).longValue();
                if(1 == language){
                    document.getElementById("english").remove();
                    document.getElementById("french").remove();
@@ -2728,6 +2761,8 @@
                    cp_chinese.text("车牌:" + car.getCarLicensePlate());
                    Element pf_chinese = document.getElementById("pf_chinese");
                    pf_chinese.text("司机评分:" + aDouble);
                    Element lc_chinese = document.getElementById("lc_chinese");
                    lc_chinese.text("里程:" + aDouble1 + "公里 /" + serviceTime + "分钟");
                    Element start_address_chinese = document.getElementById("start_address_chinese");
                    start_address_chinese.text(orderLogistics.getStartAddress());
                    Element end_address_chinese = document.getElementById("end_address_chinese");
@@ -2836,6 +2871,8 @@
                    cp_english.text("Number Plate:" + car.getCarLicensePlate());
                    Element pf_english = document.getElementById("pf_english");
                    pf_english.text("Driver Rating:" + aDouble);
                    Element lc_english = document.getElementById("lc_english");
                    lc_english.text("Mileage:" + aDouble1 + "KM / " + serviceTime + "Minutes");
                    Element start_address_english = document.getElementById("start_address_english");
                    start_address_english.text(orderLogistics.getStartAddress());
                    Element end_address_english = document.getElementById("end_address_english");
@@ -2944,6 +2981,8 @@
                    cp_french.text("Plaque: GS " + car.getCarLicensePlate());
                    Element pf_french = document.getElementById("pf_french");
                    pf_french.text("Note du chauffeur: " + aDouble);
                    Element lc_french = document.getElementById("lc_french");
                    lc_french.text("Distance: " + aDouble1 + "km / " + serviceTime + "minutes");
                    Element start_address_french = document.getElementById("start_address_french");
                    start_address_french.text(orderLogistics.getStartAddress());
                    Element end_address_french = document.getElementById("end_address_french");
@@ -3498,7 +3537,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);
        }