longz
2026-06-30 80fd77e1bcb47726e440b8a728838189cd39a56a
DriverYKDTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java
@@ -17,6 +17,7 @@
import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService;
import com.stylefeng.guns.modular.specialTrain.model.OrderPrivateCar;
import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService;
import com.stylefeng.guns.modular.system.dao.CarModelMapper;
import com.stylefeng.guns.modular.system.dao.RegionMapper;
import com.stylefeng.guns.modular.system.model.*;
import com.stylefeng.guns.modular.system.model.vo.*;
@@ -79,6 +80,9 @@
    
    @Autowired
    private ICarService carService;
    @Autowired
    private CarModelMapper carModelMapper;
    
    @Resource
    private RegionMapper regionMapper;
@@ -124,12 +128,6 @@
    
    @Autowired
    private WeChatUtil weChatUtil;
    @Value("${filePath}")
    private String filePath;
    @Value("${qyt.admin_url}")
    private String adminUrl;
    
    /**
     * 获取短信验证码
@@ -942,6 +940,52 @@
                return ResultUtil.tokenErr();
            }
            Map<String, Object> map = carService.queryCars(uid);
            return ResultUtil.success(map);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
    /**
     * 获取当前司机当前车车型
     * @param request
     * @return
     */
    @ResponseBody
    @PostMapping("/api/driver/queryMyCarModel")
    @ApiOperation(value = "获取当前司机当前车车型(主要用于获取座位数)", tags = {"司机端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil queryMyCarModel(HttpServletRequest request){
        try {
            Integer uid = driverService.getUserIdFormRedis(request);
            if (uid == null) {
                return ResultUtil.tokenErr();
            }
            Driver driver = driverService.selectById(uid);
            Map<String, Object> map = new HashMap<>(4);
            map.put("carId", null);
            map.put("carModelId", null);
            map.put("carModelName", null);
            map.put("seat", null);
            if (driver == null || driver.getCarId() == null) {
                return ResultUtil.success(map);
            }
            Integer carId = driver.getCarId();
            map.put("carId", carId);
            Car car = carService.selectById(carId);
            if (car == null || car.getCarModelId() == null) {
                return ResultUtil.success(map);
            }
            Integer carModelId = car.getCarModelId();
            map.put("carModelId", carModelId);
            CarModel carModel = carModelMapper.selectById(carModelId);
            if (carModel != null) {
                map.put("carModelName", carModel.getName());
                map.put("seat", carModel.getSeat());
            }
            return ResultUtil.success(map);
        }catch (Exception e){
            e.printStackTrace();
@@ -1786,19 +1830,11 @@
            if (driver != null) {
                String fileName = driver.getQrCode();
                if (fileName == null || "".equals(fileName)) {
                    String appletPath = "pages/home/scanPage/scanPage";
                    //HttpURLConnection httpURLConnection = weChatUtil.getwxacodeunlimit(appletPath, "d=" + driverId + "&k=" + 0, "release",driverId);
                    InputStream inputStream = weChatUtil.getwxacodeunlimit(appletPath, "driverId=" + driverId, "release");
                    if (inputStream != null) {
                        File file = FileUtil.writeFromStream(inputStream, new File(filePath + "/" + UUID.randomUUID().toString() + ".png"));
                        HttpRequest post = HttpUtil.createPost(adminUrl + "/upload/image");
                        post.form("file", file);
                        HttpResponse execute = post.execute();
                        int status = execute.getStatus();
                        if(200 != status){
                            throw new RuntimeException("上传图片异常");
                        }
                        driver.setQrCode(execute.body());
                    String appletPath = "pages/home/home";
                    String scene = "driverId=" + driverId;
                    String unlimitQrcodeUrl = weChatUtil.getUnlimitQrcode(appletPath, scene);
                    if (unlimitQrcodeUrl != null) {
                        driver.setQrCode(unlimitQrcodeUrl);
                        driverService.updateById(driver);
                        fileName = driver.getQrCode();
                    }