puzhibing
2022-09-14 ab7cc0cb35f3375b35f7f3d866704d1383ddcff5
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java
@@ -137,26 +137,47 @@
        }
    }
    @ResponseBody
    @PostMapping("/base/driver/queryEmailCaptcha")
    @ApiOperation(value = "发送验证码【1.0】", tags = {"司机端-注册"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "邮箱地址", name = "email", required = true, dataType = "String"),
    })
    public ResultUtil queryEmailCaptcha(String email){
        if(ToolUtil.isNotEmpty(email)){
            try {
                return driverService.queryEmailCaptcha(email);
            }catch (Exception e){
                e.printStackTrace();
                return ResultUtil.runErr();
            }
        }else{
            return ResultUtil.paranErr();
        }
    }
    /**
     * 验证短信验证码
     * @param phone
     * @param code
     * @return
     */
    @ResponseBody
    @PostMapping("/base/driver/checkCaptcha")
    @ApiOperation(value = "验证短信验证码", tags = {"司机端-注册"}, notes = "")
    @ApiOperation(value = "验证验证码", tags = {"司机端-注册"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"),
            @ApiImplicitParam(value = "短信验证码", name = "code", required = true, dataType = "String")
            @ApiImplicitParam(value = "邮箱", name = "email", required = true, dataType = "String"),
            @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String")
    })
    public ResultUtil checkCaptcha(String phone, String code){
    public ResultUtil checkCaptcha(String email, String code){
        try {
            boolean b = driverService.checkCaptcha(phone, code);
            if(b){
                Driver driver = driverService.queryByPhone(phone);
                smsrecordService.saveData(null == driver ? 5 : 8, phone, code, "短信验证码【" + code + "】已发到您的手机,验证码将在5分钟后失效,请及时登录!");
            }
            boolean b = driverService.checkCaptcha(email, code);
//            if(b){
//                Driver driver = driverService.queryByPhone(email);
//                smsrecordService.saveData(null == driver ? 5 : 8, email, code, "验证码【" + code + "】已发到您的邮箱,验证码将在5分钟后失效!");
//            }
            return b ? ResultUtil.success() : ResultUtil.error("验证码无效");
        }catch (Exception e){
            e.printStackTrace();
@@ -242,7 +263,7 @@
     */
    @ResponseBody
    @PostMapping("/base/driver/updateDriver")
    @ApiOperation(value = "司机注册后完善个人信息", tags = {"司机端-注册"}, notes = "")
    @ApiOperation(value = "司机注册后完善个人信息【1.0】", tags = {"司机端-注册"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "司机id", name = "uid", required = true, dataType = "int")
    })
@@ -261,22 +282,24 @@
     */
    @ResponseBody
    @PostMapping("/base/driver/addDriverCar")
    @ApiOperation(value = "司机注册后完善车辆信息", tags = {"司机端-注册"}, notes = "")
    @ApiOperation(value = "司机注册后完善车辆信息【1.0】", tags = {"司机端-注册"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "车辆型号id", name = "modelId", required = true, dataType = "int"),
            @ApiImplicitParam(value = "车辆颜色", name = "color", required = true, dataType = "string"),
            @ApiImplicitParam(value = "车牌号", name = "licensePlate", required = true, dataType = "string"),
            @ApiImplicitParam(value = "年审日期(需要格式化)", name = "time", required = false, dataType = "string"),
            @ApiImplicitParam(value = "行驶证照片", name = "drivingLicensePhoto", required = true, dataType = "string"),
            @ApiImplicitParam(value = "行驶证到期时间(yyyy-MM-dd)", name = "drivingLicenseEndTime", required = true, dataType = "string"),
            @ApiImplicitParam(value = "车辆照片", name = "carPhoto", required = true, dataType = "string"),
            @ApiImplicitParam(value = "保险照片", name = "insurancePhoto", required = false, dataType = "string"),
            @ApiImplicitParam(value = "保险到期时间(yyyy-MM-dd)", name = "commercialInsuranceTime", required = false, dataType = "string"),
            @ApiImplicitParam(value = "司机id", name = "uid", required = true, dataType = "int"),
            @ApiImplicitParam(value = "车辆id", name = "carId", required = false, dataType = "int")
    })
    public ResultUtil addDriverCar(Integer modelId, String color, String licensePlate, Date time, String drivingLicensePhoto,
                                   String carPhoto, String insurancePhoto, Integer uid, Integer carId){
    public ResultUtil addDriverCar(Integer modelId, String color, String licensePlate, Date time, String drivingLicensePhoto, String drivingLicenseEndTime,
                                   String carPhoto, String insurancePhoto, String commercialInsuranceTime, Integer uid, Integer carId){
        try {
            return carService.addCar(modelId, color, licensePlate, time, drivingLicensePhoto, carPhoto, insurancePhoto, uid,carId);
            return carService.addCar(modelId, color, licensePlate, time, drivingLicensePhoto, drivingLicenseEndTime, carPhoto, insurancePhoto, commercialInsuranceTime, uid,carId);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
@@ -339,7 +362,7 @@
    @ApiOperation(value = "忘记密码操作", tags = {"司机端-登录"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"),
            @ApiImplicitParam(value = "短信验证码", name = "code", required = true, dataType = "String"),
            @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"),
            @ApiImplicitParam(value = "新密码", name = "password", required = true, dataType = "String")
    })
    public ResultUtil resetPassword(String phone, String code, String password){
@@ -358,13 +381,14 @@
     */
    @ResponseBody
    @PostMapping("/base/driver/queryPhone")
    @ApiOperation(value = "获取忘记密码页面的电话", tags = {"司机端-登录"}, notes = "")
    @ApiOperation(value = "获取忘记密码页面的电话【1.0】", tags = {"司机端-登录"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "当前定位城市行政编号(510100)", name = "code", required = true, dataType = "String")
            @ApiImplicitParam(value = "当前定位纬度", name = "lat", required = true, dataType = "double"),
            @ApiImplicitParam(value = "当前定位经度", name = "lnt", required = true, dataType = "double")
    })
    public ResultUtil queryPhone(String code){
    public ResultUtil queryPhone(Double lat, Double lnt){
        try {
            Map<String, Object> map = driverService.queryPhone(code);
            Map<String, Object> map = driverService.queryPhone(lat, lnt);
            return ResultUtil.success(map);
        }catch (Exception e){
            e.printStackTrace();
@@ -430,9 +454,9 @@
     */
    @ResponseBody
    @PostMapping("/api/driver/work")
    @ApiOperation(value = "司机上下班操作", tags = {"司机端-首页"}, notes = "")
    @ApiOperation(value = "司机上下班操作【1.0】", tags = {"司机端-首页"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "上班的业务类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城)多个已逗号分隔", name = "type", required = false, dataType = "String"),
            @ApiImplicitParam(value = "上班的业务类型(1=专车,4=小件物流-同城)多个已逗号分隔", name = "type", required = false, dataType = "String"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil work(String type, HttpServletRequest request){
@@ -505,9 +529,9 @@
    @ResponseBody
    @PostMapping("/api/driver/work2")
    @ApiOperation(value = "司机上下班操作,同时设置接单类型", tags = {"司机端-车载端"}, notes = "")
    @ApiOperation(value = "司机上下班操作,同时设置接单类型【1.0】", tags = {"司机端-车载端"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "上班的业务类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城)多个已逗号分隔", name = "type", required = false, dataType = "String"),
            @ApiImplicitParam(value = "上班的业务类型(1=专车,4=小件物流-同城)多个已逗号分隔", name = "type", required = false, dataType = "String"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil work2(String type, HttpServletRequest request){
@@ -626,7 +650,7 @@
     */
    @ResponseBody
    @PostMapping("/api/driver/queryInfo")
    @ApiOperation(value = "获取个人中心详情", tags = {"司机端-个人中心"}, notes = "")
    @ApiOperation(value = "获取个人中心详情【1.0】", tags = {"司机端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
@@ -678,6 +702,29 @@
        }
    }
    @ResponseBody
    @PostMapping("/api/driver/editLanguage")
    @ApiOperation(value = "修改系统语言【1.0】", tags = {"司机端-个人中心"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "语言类型(1=简体中文,2=英语,3=法语)", name = "language", required = true, dataType = "String"),
            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
    })
    public ResultUtil editLanguage(Integer language, HttpServletRequest request){
        try {
            Integer uid = driverService.getUserIdFormRedis(request);
            if(null == uid){
                return ResultUtil.tokenErr();
            }
            driverService.editLanguage(language, uid);
            return ResultUtil.success();
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
    /**
     * 修改密码
     * @param password