| | |
| | | import com.stylefeng.guns.core.support.HttpKit; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.model.BankCard; |
| | | import com.stylefeng.guns.modular.system.model.TEmail; |
| | | import com.stylefeng.guns.modular.system.model.UserInfo; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | |
| | | @Value("${spring.mail.template-path}") |
| | | private String templatePath; |
| | | |
| | | @Autowired |
| | | private TEmailService emailService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取短信验证码 |
| | | * @param phone |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "手机号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "图片验证码", name = "kaptcha", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "场景类型(1=身份验证,2=登录确认,3=用户注册,4=修改密码)", name = "type", required = true, dataType = "String") |
| | | @ApiImplicitParam(value = "场景类型(1=身份验证,2=登录确认,3=用户注册,4=修改密码)", name = "type", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil queryCaptcha(HttpServletRequest request,String phone, Integer type,String kaptcha, Integer language){ |
| | | if(ToolUtil.isNotEmpty(phone)){ |
| | |
| | | String code = redisUtil.getValue(phone+"_Code"); |
| | | System.out.println("缓存中验证码为:"+code); |
| | | if (ToolUtil.isEmpty(kaptcha) || !kaptcha.equalsIgnoreCase(code)) { |
| | | return ResultUtil.error(language == 1 ? "图形验证码错误" : language == 2 ? "The graphic verification code is incorrect" : "Code de vérification graphique incorrect"); |
| | | return ResultUtil.error(language == 1 ? "图形验证码错误" : language == 2 ? "Wrong CAPTCHA" : "CAPTCHA erroné"); |
| | | } |
| | | return userInfoService.queryCaptcha(phone, type, language); |
| | | }catch (Exception e){ |
| | |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/queryCaptcha1") |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/sedEmail") |
| | | @ApiOperation(value = "获取邮箱验证码【1.0】", tags = {"用户端-登录"}, notes = "") |
| | |
| | | }) |
| | | public ResultUtil sedEmail(String email, Integer language, HttpServletRequest request){ |
| | | try { |
| | | |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | |
| | | if(ToolUtil.isEmpty(email)){ |
| | | return ResultUtil.error(language == 1 ? "邮箱不能为空" : language == 2 ? "The mailbox cannot be empty" : "L’email ne peut pas être vide"); |
| | | return ResultUtil.error(language == 1 ? "邮箱不能为空" : language == 2 ? "E-mail address cannot be empty." : "L’adresse e-mail ne peut pas être vide."); |
| | | } |
| | | |
| | | Random random = new Random(); |
| | | |
| | | StringBuffer sb = new StringBuffer(); |
| | | |
| | | for(int i = 0; i < 4; i++){ |
| | | sb.append((int) (random.nextDouble() * 10)); |
| | | } |
| | | |
| | | String authCode = sb.toString(); |
| | | |
| | | redisUtil.setStrValue(email, authCode, 5 * 60); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | |
| | | String nickName = ""; |
| | | |
| | | if(null != userInfo){ |
| | | |
| | | nickName = userInfo.getNickName(); |
| | | |
| | | } |
| | | |
| | | if(ToolUtil.isNotEmpty(email)){ |
| | |
| | | Element content_french = document.getElementById("content_french"); |
| | | content_french.text(authCode); |
| | | } |
| | | |
| | | EmailUtil.send(email, language == 1 ? "验证码" : language == 2 ? "Verification code" : "Code de vérification", document.html()); |
| | | } |
| | | return ResultUtil.success(); |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 手机验证码登录 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 手机验证码登录 |
| | | * @param phone |
| | |
| | | @ApiImplicitParam(value = "短信验证码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "分享的用户id", name = "uid", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "用户类型(1=用户,2=司机)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "注册类型(1=司机注册,2=用户注册)", name = "userType", required = true, dataType = "int") |
| | | @ApiImplicitParam(value = "注册类型(1=司机注册,2=用户注册)", name = "userType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int") |
| | | }) |
| | | public ResultUtil<LoginWarpper> captchaLogin_(String phoneOperator, String phone, String code, Integer uid, Integer type, Integer userType, Integer language){ |
| | | try { |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 账号密码登录 |
| | |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 忘记密码 |
| | |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信授权登录 |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "微信jscode(小程序登录上传)", name = "jscode", required = false, dataType = "String") |
| | | }) |
| | | public ResultUtil<LoginWarpper> wxIsLogin( String jscode){ |
| | | public ResultUtil<LoginWarpper> wxIsLogin(Integer language, String jscode){ |
| | | try { |
| | | return userInfoService.wxIsLogin(jscode); |
| | | return userInfoService.wxIsLogin(language, jscode); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/facebookLogin") |
| | |
| | | }) |
| | | public ResultUtil facebookLogin(String id, String name, String email, Double lat, Double lng, Integer uid, Integer language){ |
| | | try { |
| | | return userInfoService.facebookLogin(id, name, email, lat, lng, uid, language); |
| | | return userInfoService.facebookLogin(id, name, email, lat, lng, uid, language,1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/twitterLogin") |
| | | @ApiOperation(value = "twitter授权登录【1.0】", tags = {"用户端-登录"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "twitter用户id", name = "id", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "twitter用户名称", name = "name", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "twitter绑定的email", name = "email", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "头像", name = "avatar", required = false, dataType = "String"), |
| | | @ApiImplicitParam(value = "性别(1=男,2=女)", name = "sex", required = false, dataType = "int"), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", required = false, dataType = "double"), |
| | | @ApiImplicitParam(value = "经度", name = "lng", required = false, dataType = "double"), |
| | | @ApiImplicitParam(value = "分享的用户id", name = "uid", required = false, dataType = "int"), |
| | | }) |
| | | public ResultUtil twitterLogin(String id, String name, String email, Double lat, Double lng, Integer uid, Integer language){ |
| | | try { |
| | | return userInfoService.facebookLogin(id, name, email, lat, lng, uid, language,2); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置电话号码 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/bindingEmail") |
| | | @ApiOperation(value = "设置邮箱地址【1.0】", tags = {"用户端-登录"}, notes = "") |
| | |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/getEmailList") |
| | | @ApiOperation(value = "获取邮箱信息", tags = {"用户端-获取邮箱信息"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<?> getEmailList(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return ResultUtil.success(emailService.selectList(new EntityWrapper<TEmail>().eq("userId",uid).eq("type",1).orderBy("createTime",false))); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取用户个人信息 |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<UserInfoWarpper> queryUserInfo(HttpServletRequest request){ |
| | | public ResultUtil<UserInfoWarpper> queryUserInfo(Integer language, HttpServletRequest request){ |
| | | try { |
| | | Integer uid = userInfoService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Map<String, Object> map = userInfoService.queryUserInfo(uid); |
| | | Map<String, Object> map = userInfoService.queryUserInfo(language, uid); |
| | | return ResultUtil.success(UserInfoWarpper.getUserInfoWarpper(map)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 手机号码获取用户 |
| | |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<Object> queryUser(String phone){ |
| | | public ResultUtil<Object> queryUser(Integer language, String phone){ |
| | | try { |
| | | String substring = phone.substring(0, 1); |
| | | if("0".equals(substring)){ |
| | |
| | | if(phone.indexOf("233") < 0){ |
| | | phone = "233" + phone; |
| | | } |
| | | Map<String, Object> map = userInfoService.queryUser(phone); |
| | | Map<String, Object> map = userInfoService.queryUser(language, phone); |
| | | if(null != map){ |
| | | return ResultUtil.success(UserInfoWarpper.getUserInfoWarpper(map)); |
| | | } |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 实名认证操作 |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置紧急联系人 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 用户充值余额 |
| | | * @param payType |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改手机号码 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 修改登录密码 |
| | | * @param password |
| | |
| | | @ApiOperation(value = "修改登录密码", tags = {"用户端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "新密码", name = "password", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "语言", name = "language", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil updatePassword(String password, Integer language, HttpServletRequest request){ |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改个人信息 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/queryRealName") |
| | | @ApiOperation(value = "获取实名认证的数据", tags = {"用户端-个人中心"}, notes = "") |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 后台调用禁用用户 |
| | | * @param uid |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 仿socket接口(单点登录) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/editLanguage") |
| | | @ApiOperation(value = "修改多语言配置", tags = {"用户端-个人中心"}, notes = "") |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/addReportLoss") |
| | | @ApiOperation(value = "提交报失", tags = {"用户端-个人中心"}, notes = "") |
| | |
| | | @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "提交内容", name = "remark", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "提交图片", name = "image", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "1=中文,2=英文,3=法语", name = "language", required = true, dataType = "int"), |
| | | }) |
| | | public ResultUtil addReportLoss(Integer orderType, Integer orderId, String remark, String image){ |
| | | public ResultUtil addReportLoss(Integer orderType, Integer orderId, String remark, String image, Integer language){ |
| | | try { |
| | | reportLossService.addReportLoss(orderType, orderId, remark, image); |
| | | reportLossService.addReportLoss(orderType, orderId, remark, image, language); |
| | | return ResultUtil.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/user/queryOrderLicensePlate") |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("/base/user/image") |
| | | public String image(@RequestPart("file") MultipartFile file) { |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/queryBankCardList") |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/addBankCard") |
| | | @ApiOperation(value = "添加银行卡【1.1】", tags = {"用户端-个人中心"}, notes = "") |
| | |
| | | BigDecimal bigDecimal = new BigDecimal(code); |
| | | long max = Long.MAX_VALUE; |
| | | if(bigDecimal.compareTo(new BigDecimal(max)) >= 0){ |
| | | return ResultUtil.error(language == 1 ? "银行卡号格式错误" : language == 2 ? "The format of bank card number is incorrect" : "Format incorrect du numéro de carte bancaire"); |
| | | return ResultUtil.error(language == 1 ? "银行卡号格式错误" : language == 2 ? "Format error of bank card" : "Erreur de format de la carte bancaire"); |
| | | } |
| | | BankCard bankCard = bankCardService.selectOne(new EntityWrapper<BankCard>().eq("code", code)); |
| | | if(null != bankCard){ |
| | | return ResultUtil.error(language == 1 ? "银行卡重复" : language == 2 ? "Duplicate bank card" : "Double carte bancaire"); |
| | | return ResultUtil.error(language == 1 ? "银行卡重复" : language == 2 ? "Reduplication of bank card" : "Reduplication de la carte bancaire"); |
| | | } |
| | | bankCard = new BankCard(); |
| | | bankCard.setUserId(uid); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/user/delBankCard") |
| | | @ApiOperation(value = "删除银行卡【1.1】", tags = {"用户端-个人中心"}, notes = "") |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下载pdf |