Pu Zhibing
2025-04-25 42490ec10cb18dd38deba7b400935dd91c976065
UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/taxi/service/impl/OrderTaxiServiceImpl.java
@@ -256,11 +256,6 @@
        warpper.setStartLon(orderTaxi.getStartLon());
        warpper.setEndLat(orderTaxi.getEndLat());
        warpper.setEndLon(orderTaxi.getEndLon());
        ResultUtil<Double> forecastPrice = getForecastPrice(warpper);
        if(forecastPrice.getCode() != 200){
            return ResultUtil.error(forecastPrice.getMsg());
        }
        orderTaxi.setOrderMoney(forecastPrice.getData());
        if (!StringUtils.hasLength(orderTaxi.getPassengers())  || StringUtils.hasLength(orderTaxi.getPassengersPhone()) ){
            // 如果没有填写乘车人电话或者姓名 那么用用户的
@@ -358,8 +353,8 @@
            if(null == query){
                return ResultUtil.error("获取企业失败");
            }
            Map<String, String> distance = gdMapElectricFenceUtil.getDistance(warpper.getStartLon() + "," + warpper.getStartLat(),
                    warpper.getEndLon() + "," + warpper.getEndLat(), 1);
            Map<String, String> distance = gdMapElectricFenceUtil.getDistance(warpper.getStartLat() + "," + warpper.getStartLon() ,
                    warpper.getEndLat() + "," + warpper.getEndLon(), 1);
            if(null == distance){
                return ResultUtil.error("计算行驶距离失败");
            }
@@ -830,8 +825,22 @@
    @Override
    public List<Map<String, Object>> queryCoupon(Integer orderId, Integer uid, Integer pageNum, Integer size) throws Exception {
        OrderTaxi orderTaxi = this.selectById(orderId);
        List<Map<String, Object>> list = userCouponRecordService.queryCoupon(uid, null, 1, 2, orderTaxi.getOrderMoney(), pageNum, size);
        List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon(uid, null, 1, 0, orderTaxi.getOrderMoney(), pageNum, size);
        Driver driver = driverService.selectById(orderTaxi.getDriverId());
        Integer companyId = driver.getCompanyId();
        List<CompanyCity> companyCityList = companyCityService.selectList(new EntityWrapper<CompanyCity>().eq("companyId", companyId));
        List<Map<String, Integer>> cityCode = new ArrayList<>();
        for (CompanyCity companyCity : companyCityList) {
            Map<String, Integer> city = new HashMap<>();
            if(ToolUtil.isNotEmpty(companyCity.getAreaCode())){
                city.put("code", Integer.valueOf(companyCity.getAreaCode()));
            }else if(ToolUtil.isEmpty(companyCity.getAreaCode()) && ToolUtil.isNotEmpty(companyCity.getCityCode())){
                city.put("code", Integer.valueOf(companyCity.getCityCode()));
            }else if(ToolUtil.isEmpty(companyCity.getCityCode()) && ToolUtil.isNotEmpty(companyCity.getProvinceCode())){
                city.put("code", Integer.valueOf(companyCity.getProvinceCode()));
            }
        }
        List<Map<String, Object>> list = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 2, orderTaxi.getOrderMoney(), pageNum, size);
        List<Map<String, Object>> list1 = userCouponRecordService.queryCoupon1(uid, JSON.toJSONString(cityCode), 1, 0, orderTaxi.getOrderMoney(), pageNum, size);
        list.addAll(list1);
        return list;
    }
@@ -914,7 +923,7 @@
            }else{
                appletsOpenId = userInfo.getAppletsOpenId();
            }
            Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + ",2", 9, 5, uid.toString(), "完成订单", orderMoney, callbackPath + "/base/wxPayOrderTaxi", "", type, appletsOpenId);
//            Map<String, String> map = icbcPayUtil.placeAnOrder(orderId + ",2", 9, 5, uid.toString(), "完成订单", orderMoney, callbackPath + "/base/wxPayOrderTaxi", "", type, appletsOpenId);
            String app = type == 1 ? "APP" : "JSAPI";
            resultUtil = payMoneyUtil.weixinpay("完成订单", "", orderId + "_2_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/wxPayOrderTaxi", app, userInfo.getAppletsOpenId());
            paymentRecordService.saveData(1, orderTaxi.getUserId(), 1, orderId, 2, 1, orderMoney, "", 1);//添加预支付数据
@@ -1030,6 +1039,7 @@
                public void run() {
                    pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0);
                    pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0);
                    pushUtil.pushSystemMessage(2, orderTaxi.getDriverId(), "用户已线上完成支付");
                }
            }).start();
@@ -1046,6 +1056,8 @@
                redisUtil.setStrValue("VEHICLE", jsonArray.toJSONString());
            }
            systemNoticeService.addSystemNotice(1, "您已使用余额成功完成出行订单支付,谢谢使用!", uid, 1);
            //添加司机消息提醒
            systemNoticeService.addSystemNotice(2, "用户已线上完成支付", driver.getId(), 1);
        }
        this.updateAllColumnById(orderTaxi);
@@ -1508,6 +1520,7 @@
                public void run() {
                    pushUtil.pushOrderState(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0);
                    pushUtil.pushOrderState(2, orderTaxi.getDriverId(), orderTaxi.getId(), 2, orderTaxi.getState(), 0);
                    pushUtil.pushSystemMessage(2, orderTaxi.getDriverId(), "用户已线上完成支付");
                }
            }).start();
@@ -1526,6 +1539,8 @@
            systemNoticeService.addSystemNotice(1, "您已使用" + (type == 1 ? "微信" : "支付宝") + "成功完成出行订单支付,谢谢使用!", orderTaxi.getUserId(), 1);
            //添加司机消息提醒
            systemNoticeService.addSystemNotice(2, "用户已线上完成支付", driver.getId(), 1);
        }else{
            System.err.println("预支付数据异常(orderId = "  + id + ")");
        }