From 997bf5ea58c2741b1862a1010bf5d60a32850c4f Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期二, 14 三月 2023 18:45:50 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java | 197 +++++++++++++++++++++++++++++++++++++------------ 1 files changed, 149 insertions(+), 48 deletions(-) diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java index b9a4587..c7b79df 100644 --- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java +++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java @@ -8,6 +8,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.model.City; import com.stylefeng.guns.modular.system.model.Driver; import com.stylefeng.guns.modular.system.model.Income; import com.stylefeng.guns.modular.system.model.OrderPosition; @@ -22,6 +23,7 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -72,6 +74,12 @@ @Autowired private IDriverOnlineService driverOnlineService; + + @Autowired + private ICityService cityService; + + @Value("${share.url}") + private String shareUrl; @@ -124,10 +132,10 @@ @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), @ApiImplicitParam(value = "场景类型(1=身份验证,2=登录确认,3=用户注册,4=修改密码)", name = "type", required = true, dataType = "String") }) - public ResultUtil queryCaptcha(String phone, Integer type){ + public ResultUtil queryCaptcha(String phone, Integer type, Integer language){ if(ToolUtil.isNotEmpty(phone)){ try { - return driverService.queryCaptcha(phone, type); + return driverService.queryCaptcha(phone, type, language); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); @@ -137,26 +145,43 @@ } } + + @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, Integer language){ + if(ToolUtil.isNotEmpty(email)){ + try { + return driverService.queryEmailCaptcha(email, language); + }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); return b ? ResultUtil.success() : ResultUtil.error("验证码无效"); }catch (Exception e){ e.printStackTrace(); @@ -179,9 +204,9 @@ @ApiImplicitParam(value = "用户类型(1=用户,2=司机)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(value = "注册类型(1=司机注册,2=用户注册)", name = "userType", required = true, dataType = "int") }) - public ResultUtil registeredDriver(String phone, String code, String password, Integer uid, Integer type, Integer userType){ + public ResultUtil registeredDriver(String phone, String code, String password, Integer uid, Integer type, Integer userType, Integer language){ try { - return driverService.registeredDriver(phone, code, password, uid, type, userType); + return driverService.registeredDriver(phone, code, password, uid, type, userType, language); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); @@ -207,31 +232,33 @@ @ApiImplicitParam(value = "用户类型(1=用户,2=司机)", name = "type", required = true, dataType = "int"), @ApiImplicitParam(value = "注册类型(1=司机注册,2=用户注册)", name = "userType", required = true, dataType = "int") }) - public ResultUtil<LoginWarpper> registeredDriver_(String phone, String code, String password, Integer uid, Integer type, Integer userType){ + public ResultUtil<LoginWarpper> registeredDriver_(String phone, String code, String password, Integer uid, Integer type, Integer userType, Integer language){ try { - return driverService.registeredDriver(phone, code, password, uid, type, userType); + return driverService.registeredDriver(phone, code, password, uid, type, userType, language); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } + + @ResponseBody - @PostMapping("/base/driver/queryNeedCertificate") - @ApiOperation(value = "注册完善个人信息根据选择的从业地判断是否需要网约车资格证", tags = {"司机端-注册"}, notes = "0=城市未开通,1=是,2=否") + @PostMapping("/base/driver/queryAllCity") + @ApiOperation(value = "获取所有城市", tags = {"司机端-注册"}, notes = "") @ApiImplicitParams({ - @ApiImplicitParam(value = "城市行政编号", name = "code", required = true, dataType = "String") }) - public ResultUtil queryNeedCertificate(String code){ + public ResultUtil<List<City>> queryAllCity(){ try { - Integer integer = driverService.queryNeedCertificate(code); - return ResultUtil.success(integer == null ? 0 : integer); + List<City> cities = cityService.selectList(null); + return ResultUtil.success(cities); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } + @@ -242,18 +269,44 @@ */ @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") }) - public ResultUtil updateDriver(RegisteredWarpper registeredWarpper, Integer uid){ + public ResultUtil updateDriver(RegisteredWarpper registeredWarpper, Integer uid, Integer language){ try { - return driverService.updateDriver(registeredWarpper, uid); + return driverService.updateDriver(registeredWarpper, uid, language); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } + + @ResponseBody + @PostMapping("/api/driver/editEmail") + @ApiOperation(value = "个人中心修改邮箱【1.0】", tags = {"司机端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "邮箱", name = "email", required = true, dataType = "string"), + @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResultUtil editEmail(String email, HttpServletRequest request){ + try { + Integer uid = driverService.getUserIdFormRedis(request); + if(null == uid){ + return ResultUtil.tokenErr(); + } + Driver driver = driverService.selectById(uid); + driver.setEmail(email); + driverService.updateById(driver); + return ResultUtil.success(); + }catch (Exception e){ + e.printStackTrace(); + return ResultUtil.runErr(); + } + } + + + /** * 司机注册后完善车辆信息 * @param @@ -261,22 +314,26 @@ */ @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 = "drivingLicenseNumber", required = true, 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 = "人车合一照片", name = "peopleAndCarsPhone", 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 drivingLicenseNumber, String drivingLicensePhoto, String drivingLicenseEndTime, + String carPhoto, String insurancePhoto, String commercialInsuranceTime, Integer uid, Integer carId, String peopleAndCarsPhone){ try { - return carService.addCar(modelId, color, licensePlate, time, drivingLicensePhoto, carPhoto, insurancePhoto, uid,carId); + return carService.addCar(modelId, color, licensePlate, time, drivingLicenseNumber, drivingLicensePhoto, drivingLicenseEndTime, carPhoto, insurancePhoto, commercialInsuranceTime, uid,carId, peopleAndCarsPhone); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); @@ -339,12 +396,12 @@ @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){ + public ResultUtil resetPassword(String phone, String code, String password, Integer language){ try { - return driverService.resetPassword(phone, code, password); + return driverService.resetPassword(phone, code, password, language); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); @@ -358,13 +415,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 +488,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 +563,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 +684,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.....") }) @@ -639,9 +697,9 @@ Map<String, Object> map = driverService.queryInfo(uid); map.put("qrCodeIsOpen",driverService.getAppOpenInfo(1)==1); DriverInfoWarpper driverInfoWarpper = DriverInfoWarpper.getDriverInfoWarpper(map); - Double money = driverService.getThisWeekMoney(uid); - driverInfoWarpper.setLaveBusinessMoney(driverInfoWarpper.getLaveBusinessMoney()-(money==null?0d:money)); - driverInfoWarpper.setLaveBusinessNextWeekMoney(money==null?0d:money); +// Double money = driverService.getThisWeekMoney(uid); +// driverInfoWarpper.setLaveBusinessMoney(driverInfoWarpper.getLaveBusinessMoney()-(money==null?0d:money)); + driverInfoWarpper.setLaveBusinessNextWeekMoney(0D); return ResultUtil.success(driverInfoWarpper); }catch (Exception e){ e.printStackTrace(); @@ -678,6 +736,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 @@ -691,13 +772,13 @@ @ApiImplicitParam(value = "新密码", name = "password", required = true, dataType = "String"), @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ResultUtil updatePassword(String password, HttpServletRequest request){ + public ResultUtil updatePassword(String password, Integer language, HttpServletRequest request){ try { Integer uid = driverService.getUserIdFormRedis(request); if(null == uid){ return ResultUtil.tokenErr(); } - driverService.updatePassword(password, uid); + driverService.updatePassword(password, uid, language); return ResultUtil.success(); }catch (Exception e){ e.printStackTrace(); @@ -954,7 +1035,7 @@ baseWarpper.setAmount(Double.valueOf(String.valueOf(null != map.get("money") ? map.get("money") : 0))); switch (Integer.valueOf(String.valueOf(null != map.get("orderType") ? map.get("orderType") : 0))){ case 1: - baseWarpper.setName("快车"); + baseWarpper.setName("专车"); break; case 2: baseWarpper.setName("出租车"); @@ -963,7 +1044,7 @@ baseWarpper.setName("城际出行"); break; case 4: - baseWarpper.setName("同城小件物流"); + baseWarpper.setName("市内小件物流"); break; case 5: baseWarpper.setName("跨城小件物流"); @@ -1304,4 +1385,24 @@ return ResultUtil.runErr(); } } + + + @ResponseBody + @PostMapping("/base/driver/queryShareLink") + @ApiOperation(value = "获取分享链接及分案", tags = {"司机端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "链接上的type", name = "type", required = true, dataType = "int"), + @ApiImplicitParam(value = "链接上的uid", name = "driverId", required = true, dataType = "int"), + @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int"), + }) + public ResultUtil<Map<String, Object>> queryShareLink(Integer type, Integer driverId, Integer language){ + try { + Map<String, Object> map = new HashMap<>(); + map.put("link", shareUrl + "?type=" + type + "&uid=" + driverId + "&language=" + (null == language ? 2 : language)); + return ResultUtil.success(map); + }catch (Exception e){ + e.printStackTrace(); + return ResultUtil.runErr(); + } + } } -- Gitblit v1.7.1