zhibing.pu
2024-05-27 b79eed290aa7f76545c1ad4b465362cec6b88bc9
UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/smallLogistics/server/impl/OrderLogisticsServiceImpl.java
@@ -198,6 +198,15 @@
    
    @Autowired
    private IUserActivityRedenvelopeService userActivityRedenvelopeService;
    @Autowired
    private FleetEngineUtil fleetEngineUtil;
    @Resource
    private CarModelMapper carModelMapper;
    @Autowired
    private ICarService carService;
@@ -683,6 +692,26 @@
        orderLogistics.setIsDelete(1);
        this.insert(orderLogistics);
    
        Integer vehicleId = null;
        if(null != orderLogistics.getDriverId()){
            Driver driver = driverService.selectById(orderLogistics.getDriverId());
            vehicleId = driver.getCarId();
            //查询车辆信息,没有则创建信息
            String vehicles = fleetEngineUtil.getVehicles(vehicleId);
            if(ToolUtil.isEmpty(vehicles)){
                Car car = carService.selectById(vehicleId);
                CarModel carModel = carModelMapper.selectById(car.getCarModelId());
                fleetEngineUtil.createVehicles(carModel.getSeat() - 1, car.getCarLicensePlate(), driver.getCarId());
                fleetEngineUtil.updateVehicles("ONLINE", carModel.getSeat() - 1, car.getCarLicensePlate(), driver.getCarId());
            }
        }
        //创建行程数据
        fleetEngineUtil.createTrip(vehicleId, 1, 4, orderLogistics.getId(),
                orderLogistics.getStartLat().toString(), orderLogistics.getStartLon().toString(), orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString());
        if(orderSource == 2){//扫码下单
            new Thread(new Runnable() {
                @Override
@@ -836,7 +865,7 @@
        if(null != couponId){
            //TODO 待翻译
            if(null != redDeduction && 1 == redDeduction){
                return ResultUtil.error(language == 1 ? "优惠券和红包不能同时使用" : language == 2 ? "" : "", "");
                return ResultUtil.error(language == 1 ? "优惠券和红包不能同时使用" : language == 2 ? "Coupons and lucky-promo cannot be used at the same time." : "Les coupons et les bonus ne peuvent pas être utilisés en même temps", "");
            }
            userCouponRecord = userCouponRecordService.selectById(couponId);
            if(userCouponRecord.getCompanyId() != orderLogistics.getCompanyId()){
@@ -1100,6 +1129,13 @@
                    title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney());
                    Element xcf_chinese = document.getElementById("xcf_chinese");
                    xcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element bcj_chinese = document.getElementById("bcj_chinese");
                    if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                        bcj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element bcj_chinese_div = document.getElementById("bcj_chinese_div");
                        bcj_chinese_div.remove();
                    }
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_chinese = document.getElementById("yhq_chinese");
                        yhq_chinese.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
@@ -1160,6 +1196,13 @@
                    title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip ");
                    Element xcf_english = document.getElementById("xcf_english");
                    xcf_english.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element bcj_english = document.getElementById("bcj_english");
                    if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                        bcj_english.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element bcj_english_div = document.getElementById("bcj_english_div");
                        bcj_english_div.remove();
                    }
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_english = document.getElementById("yhq_english");
                        yhq_english.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
@@ -1220,6 +1263,13 @@
                    title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le ");
                    Element xcf_french = document.getElementById("xcf_french");
                    xcf_french.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element bcj_french = document.getElementById("bcj_french");
                    if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                        bcj_french.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element bcj_french_div = document.getElementById("bcj_french_div");
                        bcj_french_div.remove();
                    }
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_french = document.getElementById("yhq_french");
                        yhq_french.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
@@ -1503,6 +1553,13 @@
                    title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney());
                    Element xcf_chinese = document.getElementById("xcf_chinese");
                    xcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element bcj_chinese = document.getElementById("bcj_chinese");
                    if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                        bcj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element bcj_chinese_div = document.getElementById("bcj_chinese_div");
                        bcj_chinese_div.remove();
                    }
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_chinese = document.getElementById("yhq_chinese");
                        yhq_chinese.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
@@ -1563,6 +1620,13 @@
                    title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip ");
                    Element xcf_english = document.getElementById("xcf_english");
                    xcf_english.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element bcj_english = document.getElementById("bcj_english");
                    if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                        bcj_english.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element bcj_english_div = document.getElementById("bcj_english_div");
                        bcj_english_div.remove();
                    }
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_english = document.getElementById("yhq_english");
                        yhq_english.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
@@ -1623,6 +1687,13 @@
                    title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le ");
                    Element xcf_french = document.getElementById("xcf_french");
                    xcf_french.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element bcj_french = document.getElementById("bcj_french");
                    if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                        bcj_french.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element bcj_french_div = document.getElementById("bcj_french_div");
                        bcj_french_div.remove();
                    }
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_french = document.getElementById("yhq_french");
                        yhq_french.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
@@ -2008,6 +2079,13 @@
                    title_chinese.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",您在I-GO此订单消费GHS " + orderLogistics.getPayMoney());
                    Element xcf_chinese = document.getElementById("xcf_chinese");
                    xcf_chinese.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element bcj_chinese = document.getElementById("bcj_chinese");
                    if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                        bcj_chinese.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element bcj_chinese_div = document.getElementById("bcj_chinese_div");
                        bcj_chinese_div.remove();
                    }
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_chinese = document.getElementById("yhq_chinese");
                        yhq_chinese.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
@@ -2068,6 +2146,13 @@
                    title_english.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",You spent GHS " + orderLogistics.getPayMoney() + " on the trip ");
                    Element xcf_english = document.getElementById("xcf_english");
                    xcf_english.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element bcj_english = document.getElementById("bcj_english");
                    if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                        bcj_english.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element bcj_english_div = document.getElementById("bcj_english_div");
                        bcj_english_div.remove();
                    }
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_english = document.getElementById("yhq_english");
                        yhq_english.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
@@ -2128,6 +2213,13 @@
                    title_french.text(DateUtil.conversionFormat(language, sdf2.format(orderLogistics.getTravelTime())) + ",Vous consommez GHS " + orderLogistics.getPayMoney() + " sur votre commande i-go1 le ");
                    Element xcf_french = document.getElementById("xcf_french");
                    xcf_french.text("GHS " + new BigDecimal(orderLogistics.getOrderMoney()).setScale(2, RoundingMode.HALF_EVEN));
                    Element bcj_french = document.getElementById("bcj_french");
                    if(null != orderLogistics.getPriceDifference() && orderLogistics.getPriceDifference() > 0){
                        bcj_french.text("GHS " + new BigDecimal(orderLogistics.getPriceDifference()).setScale(2, RoundingMode.HALF_EVEN));
                    }else{
                        Element bcj_french_div = document.getElementById("bcj_french_div");
                        bcj_french_div.remove();
                    }
                    if(null != orderLogistics.getCouponMoney() && orderLogistics.getCouponMoney() > 0){
                        Element yhq_french = document.getElementById("yhq_french");
                        yhq_french.text("GHS -" + new BigDecimal(orderLogistics.getCouponMoney()).setScale(2, RoundingMode.HALF_EVEN));
@@ -2469,7 +2561,10 @@
            driver.setState(2);
            driverService.updateById(driver);
        }
        //修改行程信息
        fleetEngineUtil.updateTrip("CANCELED", null, null, 4, orderLogistics.getId(), null, null, null, null);
        //添加消息
        systemNoticeService.addSystemNotice(1, language == 1 ? "您已成功取消包裹订单,谢谢使用!" : language == 2 ? "You've cancelled the delivery order successfully, thank you for using I-GO "
                : "Vous avez annulé la commande de livraison avec succès, merci d’utiliser I-GO", orderLogistics.getUserId(), 1);