/** * Description:进入手机认证页面<br> * * @author justin.xu * @version 0.1 2014年4月25日 * @param session * @param request * @return ModelAndView */ @RequiresAuthentication @RequestMapping(value = "mobileforinsert") public ModelAndView mobileforinsert(HttpSession session, HttpServletRequest request) { ModelAndView mv = new ModelAndView(); try { ShiroUser shiroUser = currentUser(); // 手机认证 MobileApproVo mobileAppro = mobileApproService.queryMobileApproByUserId(shiroUser.getUserId()); // 邮件认证 EmailApproVo emailApproVo = emailApprService.queryEmailApproByUserId(shiroUser.getUserId()); mv.addObject("mobileAppro", mobileAppro); mv.addObject("emailApproVo", emailApproVo); // 修改手机号时原有手机号是否验证通过,不为空代表通过 if (null != session.getAttribute( BusinessConstants.MOBILE_APPRO_RESET_FUNCTION + shiroUser.getUserId())) { mv.setViewName("account/approve/mobile/newMobile"); return mv; } if (null != mobileAppro && null != mobileAppro.getPassed() && mobileAppro.getPassed() == Constants.YES) { mv.setViewName("account/approve/mobile/verifyOldMobile"); } else { mv.setViewName("account/approve/mobile/newMobile"); } } catch (Exception e) { e.printStackTrace(); } return mv; }
/** * Description:进行手机认证<br> * * @author justin.xu * @version 0.1 2014年4月30日 * @param request * @param session * @param mobile 手机号 * @param activeCode 验证码 * @return String */ @RequestMapping(value = "activeMobile") @ResponseBody public MessageBox activeMobile( HttpServletRequest request, HttpSession session, String mobile, String activeCode) { String result = "success"; try { ShiroUser shiroUser = currentUser(); MobileApproVo mobileApproVo = mobileApproService.queryMobileApproByUserId(shiroUser.getUserId()); // 修改手机号码操作 if (null != mobileApproVo && null != mobileApproVo.getPassed() && mobileApproVo.getPassed() == Constants.YES) { return new MessageBox("0", "手机号码已认证通过"); } MemberCnd memberCnd = new MemberCnd(); memberCnd.setId(shiroUser.getUserId()); MemberVo memberVo = memberService.queryMemberByCnd(memberCnd); result = mobileApproService.saveMobileAppro( memberVo, mobile, activeCode, request, BusinessConstants.MOBILE_APPRO_FUNCTION); } catch (AppException ae) { result = ae.getMessage(); } catch (Exception e) { result = "网络连接异常,请刷新页面或稍后重试!"; e.printStackTrace(); } if (BusinessConstants.SUCCESS.equals(result)) { return new MessageBox("1", "短信认证成功!"); } return new MessageBox("0", result); }
/** * Description:修改绑定手机时,对原来的手机号码认证<br> * * @author hujianpan * @version 0.1 2014年4月30日 * @param request * @param session * @param mobile 手机号 * @param activeCode 验证码 * @return String */ @RequestMapping(value = "verifyCurrentUserMobile") @ResponseBody public MessageBox verifyCurrentUserMobile( HttpServletRequest request, HttpSession session, String mobile, String activeCode) { String result = "success"; ShiroUser shiroUser = currentUser(); try { MemberCnd memberCnd = new MemberCnd(); memberCnd.setId(shiroUser.getUserId()); MemberVo memberVo = memberService.queryMemberByCnd(memberCnd); memberVo.setIsModify(true); result = mobileApproService.saveMobileAppro( memberVo, mobile, activeCode, request, BusinessConstants.MOBILE_APPRO_RESET_FUNCTION, BusinessConstants.SMS_TEMPLATE_TYPE_VERIFYSUCCESS_MOBILE_CODE); } catch (AppException ae) { result = ae.getMessage(); } catch (Exception e) { result = "网络连接异常,请刷新页面或稍后重试!"; e.printStackTrace(); } if (BusinessConstants.SUCCESS.equals(result)) { // 记录到session中,代表验证原有手机通过 session.setAttribute( BusinessConstants.MOBILE_APPRO_RESET_FUNCTION + shiroUser.getUserId(), "true"); return new MessageBox("1", "短信认证成功!"); } return new MessageBox("0", result); }
/** * Description:保存提现申请<br> * * @author justin.xu * @version 0.1 2014年6月19日 * @param request * @param session * @param response * @param takeCashMoneyVo * @return String */ @RequestMapping(value = "saveTakeCash") @RequiresAuthentication public @ResponseBody String saveTakeCash( HttpServletRequest request, HttpSession session, HttpServletResponse response, TakeCashMoneyVo takeCashMoneyVo) { String result = "success"; try { ShiroUser shiroUser = currentUser(); if (super.judgeBlackByType(BusinessConstants.BLACK_TYPE_CASH)) { return ""; } if (shiroUser.getIsFinancialUser() == 0) { return "借款用户无法提现!"; } // 查询用户认证信息 MemberApproVo memberApproVo = memberService.queryMemberApproByUserId(shiroUser.getUserId()); // 您还没有进行手机认证,请先进行手机认证 if (null == memberApproVo.getMobilePassed() || memberApproVo.getMobilePassed() != Constants.YES) { return "请先进行手机认证"; } // 判断是否通过了实名认证 if (null == memberApproVo.getNamePassed() || memberApproVo.getNamePassed() != Constants.REALNAME_APPR_ISPASSED_PASSED) { return "请先进行实名认证"; } MemberCnd memberCnd = new MemberCnd(); memberCnd.setId(shiroUser.getUserId()); MemberVo memberVo = memberService.queryMemberByCnd(memberCnd); // 未设置交易密码 if (null == memberVo.getPaypassword() || "".equals(memberVo.getPaypassword())) { return "请先设置交易密码"; } if (null != takeCashMoneyVo && StringUtils.isNotEmpty(takeCashMoneyVo.getTakeMoney())) { if (Double.valueOf(takeCashMoneyVo.getTakeMoney()) < 100) { return "提现金额必须大于¥100!"; } if (Double.valueOf(takeCashMoneyVo.getTakeMoney()) > 500000) { return "提现金额必须小于¥500000!"; } } else { return "提现金额不能为空!"; } result = cashRecordService.saveTakeCash(takeCashMoneyVo, memberVo, request); if (!"success".equals(result)) { return result; } } catch (AppException ae) { return ae.getMessage(); } catch (Exception e) { logger.error("保持提现出错", e); return "网络连接异常,请刷新页面或稍后重试!"; } return result; }
private Member currentMember() { ShiroUser user = currentUser(); Member member = new Member(); member.setUsername(user.getUserName()); member.setId(user.getUserId()); return member; }
/** * Description:重设手机提交方法<br> * * @author justin.xu * @version 0.1 2014年4月25日 * @param session * @param request * @return ModelAndView */ @RequestMapping(value = "toModifyPhone") public ModelAndView toModifyPhone( HttpSession session, HttpServletRequest request, String resetActiveCode) { ModelAndView mv = new ModelAndView("account/approve/mobile/resetMobile"); try { ShiroUser shiroUser = currentUser(); MobileApproVo mobileApproVo = mobileApproService.queryMobileApproByUserId(shiroUser.getUserId()); mv.addObject("mobileAppro", mobileApproVo); // 验证验证码是否正确 String valiateResult = phoneService.compareSmsValidate( mobileApproVo.getMobileNum(), resetActiveCode, BusinessConstants.MOBILE_APPRO_RESET_FUNCTION); if (valiateResult != "success") { mv.addObject("errorMsg", valiateResult); } else { mv.setViewName("account/approve/mobile/newMobile"); } } catch (Exception e) { mv.addObject("errorMsg", "网络异常,请刷新页面或稍候重试"); e.printStackTrace(); } return mv; }
/** * Description:跳转到提现菜单页面<br> * * @author justin.xu * @version 0.1 2014年5月21日 * @param request * @return ModelAndView */ @RequestMapping(value = "toCashIndex") @RequiresAuthentication public ModelAndView toTopupMain() throws Exception { ModelAndView mv = new ModelAndView("account/cash/cashIndex"); ShiroUser shiroUser = currentUser(); if (super.judgeBlackByType(BusinessConstants.BLACK_TYPE_CASH)) { mv = new ModelAndView("redirect:/myaccount/toIndex.html"); return mv; } MemberCnd memberCnd = new MemberCnd(); memberCnd.setId(shiroUser.getUserId()); MemberVo memberVo = memberService.queryMemberByCnd(memberCnd); // 查询用户认证信息 MemberApproVo memberApproVo = memberService.queryMemberApproByUserId(shiroUser.getUserId()); // 您还没有进行手机认证,请先进行手机认证 if (null == memberApproVo.getMobilePassed() || memberApproVo.getMobilePassed() != Constants.YES) { mv.addObject("errorCode", "-3"); return mv; } // 判断是否通过了实名认证 if (null == memberApproVo.getNamePassed() || memberApproVo.getNamePassed() != Constants.REALNAME_APPR_ISPASSED_PASSED) { mv.addObject("errorCode", "-1"); return mv; } // 如果交易密码为空,则跳到交易密码页面 if (null == memberVo.getPaypassword() || "".equals(memberVo.getPaypassword())) { mv.addObject("errorCode", "-4"); return mv; } // 设置菜单名 mv.addObject(BusinessConstants.ACCOUNT_FIRST_MENU, BusinessConstants.LEFT_MENU_ZJ); mv.addObject(BusinessConstants.ACCOUNT_SECOND_MENU, BusinessConstants.LEFT_MENU_ZJ_TAKE_CASH); return mv; }
/** * Description:判断当前登录用户是否设置了交易密码,如果设置了交易密码,则返回:true,如果没有设置,则返回:false<br> * * @author justin.xu * @version 0.1 2014年7月14日 * @param session * @return String */ @RequestMapping(value = "/isPayPasswordExist") public @ResponseBody String isPayPasswordExist(HttpSession session) { String result = "success"; ShiroUser shiroUser = currentUser(); MemberCnd memberCnd = new MemberCnd(); memberCnd.setId(shiroUser.getUserId()); MemberVo memberVo = memberService.queryMemberByCnd(memberCnd); if (null == memberVo) { result = "notlogin"; } else if (null == memberVo.getPaypassword() || "".equals(memberVo.getPaypassword())) { result = "nopaypassword"; } return result; }
/** * Description:查询当前用户的提现记录.<br> * * @author justin.xu * @version 0.1 2014年6月18日 * @param request * @param pageNo * @return * @throws Exception ModelAndView */ @RequestMapping(value = "/queryPageList/{pageNo}") @RequiresAuthentication public ModelAndView queryPageList(HttpServletRequest request, @PathVariable Integer pageNo) throws Exception { ModelAndView mv = new ModelAndView("account/cash/cashRecordList"); ShiroUser shiroUser = currentUser(); CashRecordCnd cashRecordCnd = new CashRecordCnd(); cashRecordCnd.setUserId(shiroUser.getUserId()); Page page = cashRecordService.queryPageListByCnd( cashRecordCnd, new Page(pageNo, BusinessConstants.DEFAULT_PAGE_SIZE)); mv.addObject("page", page); return mv; }
/** * Description:进入提现页面<br> * * @author justin.xu * @version 0.1 2014年6月18日 * @param request * @param session * @return * @throws Exception String */ @RequestMapping(value = "toGetcash") @RequiresAuthentication public ModelAndView getcash(HttpServletRequest request, HttpSession session) throws Exception { ModelAndView mav = new ModelAndView("account/cash/getcash"); ShiroUser shiroUser = currentUser(); if (super.judgeBlackByType(BusinessConstants.BLACK_TYPE_CASH)) { mav = new ModelAndView("redirect:/myaccount/toIndex.html"); return mav; } // 当前帐号信息 AccountVo accountVo = accountService.queryAccountByUserId(shiroUser.getUserId()); mav.addObject("accountVo", accountVo); BigDecimal maxDrawMoney = cashRecordService.getMaxDrawMoney(shiroUser.getUserId()); // 当前用户银行卡信息 BankInfoVo currentBankCardVo = bankInfoService.getUserCurrentCard(shiroUser.getUserId()); // 查询银行卡数量; int cardNum = bankInfoService.querytBankCardNum(shiroUser.getUserId()); mav.addObject("cardNum", cardNum); // 查询银行卡操作日志中的锁定记录(type=0的记录) int cardLock = bankInfoService.querytBankCardLock(shiroUser.getUserId()); mav.addObject("cardLock", cardLock); // 查询用户信息 MemberCnd memberCnd = new MemberCnd(); memberCnd.setId(shiroUser.getUserId()); MemberVo memberVo = memberService.queryMemberByCnd(memberCnd); // 未设置交易密码 if (null == memberVo.getPaypassword() || "".equals(memberVo.getPaypassword())) { mav.addObject("nosetPaypassword", true); } if (vipLevelService.getIsSvipByUserId(shiroUser.getUserId())) { mav.addObject("isSvip", "yes"); } else { mav.addObject("isSvip", "no"); } mav.addObject("currentBankCardVo", currentBankCardVo); mav.addObject("maxDrawMoney", maxDrawMoney); Integer getCashedCount = cashRecordService.getCashedCount(shiroUser.getUserId(), new Date()); mav.addObject("getCashedCount", getCashedCount); return mav; }
/** * Description:检查用户名或邮箱或推荐人是否存在<br> * * @author justin.xu * @version 0.1 2014年4月22日 * @param memberRegisterCnd * @return String */ @RequestMapping(value = "/checkMemberRepeat") public @ResponseBody String checkMemberRepeat( MemberRegisterCnd memberRegisterCnd, HttpServletRequest request, String inviterName, HttpSession session) { String result = "success"; try { ShiroUser shiroUser = currentUser(); result = memberRegisterService.queryMemberRepeat(memberRegisterCnd, shiroUser.getUserId()); } catch (Exception e) { result = "failer"; logger.error("验证用户名或邮箱是否存在错误"); e.printStackTrace(); } return result; }
/** * Description:安全中心-验证账户信息-发送手机认证验证码<br> * * @author hujianpan * @version 0.1 2014年8月30日 * @param request * @param session * @return String */ @RequiresAuthentication @RequestMapping(value = "/sendMobailActiveInSaftCenter") @ResponseBody public MessageBox sendMobailActiveInSaftCenter(HttpServletRequest request, HttpSession session) { String result = BusinessConstants.SUCCESS; Member member = currentMember(); if (StringUtils.isEmpty(member.getUsername())) { return new MessageBox("0", "请先登入!"); } String mobile = request.getParameter("mobile"); String activeCode = request.getParameter("activeCode"); try { MobileApproVo mobileApproVo = mobileApproService.queryMobileApproByUserId(member.getId()); // 修改手机号码操作 if (null == session.getAttribute( BusinessConstants.MOBILE_APPRO_RESET_FUNCTION + member.getId()) && (null != mobileApproVo && null != mobileApproVo.getPassed() && mobileApproVo.getPassed() == Constants.YES)) { return new MessageBox("0", "手机号码已认证通过"); } result = mobileApproService.sendMobileApprValidate( mobile, request, member.getUsername(), BusinessConstants.MOBILE_APPRO_FUNCTION); if (!BusinessConstants.SUCCESS.equals(result)) { return new MessageBox("0", result); } ShiroUser shiroUser = currentUser(); MemberVo memberVo = new MemberVo(); memberVo.setId(shiroUser.getUserId()); mobileApproService.packageMobileApproCode(memberVo, mobile, activeCode, request); // 删除验证原有手机号码session session.removeAttribute(BusinessConstants.MOBILE_APPRO_RESET_FUNCTION + member.getId()); } catch (Exception e) { result = "发送验证码出错,请联系客服"; e.printStackTrace(); } if (!BusinessConstants.SUCCESS.equals(result)) { return new MessageBox("0", result); } return new MessageBox("1", "发送成功,请注意查收"); }
/** * Description:检查当前用户VIP认证是否通过<br> * * @author justin.xu * @version 0.1 2014年4月25日 * @param request * @return boolean */ @RequiresAuthentication @RequestMapping(value = "/checkVipAppro") @ResponseBody public String checkVipAppro(HttpServletRequest request) { String result = "success"; try { ShiroUser shiroUser = currentUser(); VIPApproVo vipApproVo = vipApproService.queryVIPApproByUserId(shiroUser.getUserId()); if (null != vipApproVo && vipApproVo.getPassed() == 1) { result = "true"; } else { result = "false"; } } catch (Exception e) { result = "网络连接异常,请稍候重试"; logger.error("VIP认证是否通过", e); } return result; }
/** * Description:跳转到会员邮箱和手机认证界面<br> * * @author hujianpan * @version 0.1 2014年8月30日 * @param memberRegisterCnd * @return String */ @RequestMapping(value = "/toCheckMemberInfo") public ModelAndView checkMemberInfo(HttpServletRequest request) { Member member = new Member(); ShiroUser shiroUser = currentUser(); member.setId(shiroUser.getUserId()); member.setUsername(shiroUser.getUserName()); if (null == member || StringUtils.isEmpty(member.getUsername())) { return redirect("/" + BusinessConstants.TOP_HOME_ADDRESS); } // 通过用户名查询上一步的信息 MemberCnd memberCnd = new MemberCnd(); memberCnd.setUsername(member.getUsername()); MemberVo memberVo = memberService.queryMemberByCnd(memberCnd); // 0:正式身份 -1:游客身份 if (null != memberVo && BusinessConstants.VISITOR_OFFICIAL == memberVo.getType()) { logger.info("当前用户已经认证通过"); return redirect("/" + BusinessConstants.TOP_HOME_ADDRESS); } return forword("/member/register_CheckMember") .addObject("currentEmail", memberVo.getEmail() == null ? "" : memberVo.getEmail()); }
/** * Description:发送手机认证验证码<br> * * @author justin.xu * @version 0.1 2014年4月29日 * @param request * @param session * @return String */ @RequestMapping(value = "activeMobileAndSendMsg") @ResponseBody public String activeMobileAndSendMsg( HttpServletRequest request, HttpSession session, String mobile, String activeCode) { String result = "success"; try { ShiroUser shiroUser = currentUser(); result = mobileApproService.sendMobileApprValidate( mobile, request, shiroUser.getUserName(), BusinessConstants.MOBILE_APPRO_FUNCTION); MemberVo memberVo = new MemberVo(); memberVo.setId(shiroUser.getUserId()); // mobileApproService.packageMobileApproCode(memberVo, mobile, // activeCode, request); } catch (Exception e) { result = "网络连接异常,请刷新页面或稍后重试!"; e.printStackTrace(); } return result; }
/** * Description:取消提现<br> * * @author justin.xu * @version 0.1 2014年6月18日 * @param request * @param session * @param response * @param shengReceiveForm * @return String */ @RequestMapping(value = "cancelCash") @RequiresAuthentication public @ResponseBody MessageBox cancelCash( HttpServletRequest request, HttpSession session, HttpServletResponse response, CashRecordCnd cashRecordCnd) { String result = BusinessConstants.SUCCESS; try { ShiroUser shiroUser = currentUser(); cashRecordCnd.setUserId(shiroUser.getUserId()); result = cashRecordService.saveCancelCash(cashRecordCnd, request); if (!"success".equals(result)) { return new MessageBox("0", result); } } catch (AppException ae) { return new MessageBox("0", ae.getMessage()); } catch (Exception e) { logger.error("取消提现出错", e); return new MessageBox("0", "网络连接异常,请刷新页面或稍后重试!"); } return new MessageBox("1", result); }
/** * Description:根据当前用户的手机号发送验证码<br> * * @author justin.xu * @version 0.1 2014年4月30日 * @param request * @param session * @return String */ @RequestMapping(value = "sendResetMsg") @ResponseBody public MessageBox sendResetMsg(HttpServletRequest request, HttpSession session) { String result = BusinessConstants.SUCCESS; try { ShiroUser shiroUser = currentUser(); MobileApproVo mobileApproVo = mobileApproService.queryMobileApproByUserId(shiroUser.getUserId()); result = mobileApproService.sendMobileApprValidate( mobileApproVo.getMobileNum(), request, shiroUser.getUserName(), BusinessConstants.MOBILE_APPRO_RESET_FUNCTION, BusinessConstants.SMS_TEMPLATE_TYPE_VERIFY_MOBILE_CODE); } catch (Exception e) { result = "网络连接异常,请刷新页面或稍后重试!"; e.printStackTrace(); } if (BusinessConstants.SUCCESS.equals(result)) { return new MessageBox("1", "验证码发送成功,请查收手机短信。"); } return new MessageBox("0", result); }