标签:数据库 exce ring 返回 object format pap wpa over
1 @Override 2 public Result updatePayPassword(long userId, String oldPayPwd, String tradePassword)throws MyException { 3 //验证新旧密码格式是否正确 4 if(!CheckPwd.checkPayPwd(oldPayPwd) || !CheckPwd.checkPayPwd(tradePassword)){ 5 throw new MyException(ResultEnum.trade_pwd_format_not_true); 6 } 7 //判断原交易密码是否正确 8 String oldPayPwdInDB = appUpdatePayPasswordMapper.findOldPayPwd(userId); 9 if(StringUtils.isBlank(oldPayPwdInDB)){ 10 throw new MyException(ResultEnum.user_is_not_tradepwd); 11 } 12 //不正确(退出App,返回错误码并重置token) 13 if(!oldPayPwdInDB.equals(oldPayPwd)){ 14 try { 15 //查询数据库,修改交易密码时输入交易密码错误次数是否为5次,5次则返回错误码,提示APP退出登录 16 byte modifyTradePwdErrorCount = appUpdatePayPasswordMapper.findModifyTradePwdErrorCount(userId); 17 if(modifyTradePwdErrorCount==5){ 18 throw new MyException(ResultEnum.trade_pwd_not_true_login); 19 } 20 //更新 修改交易密码时输入交易密码错误次数 21 appUpdatePayPasswordMapper.updateModifyTradePwdErrorCount(userId); 22 } catch (Exception e) { 23 e.printStackTrace(); 24 throw new MyException(ResultEnum.error_update_failed); 25 } 26 //提示交易密码错误 27 throw new MyException(ResultEnum.trade_pwd_not_true); 28 } 29 //更新交易密码 30 Map<String,Object> c = new HashMap<>(); 31 c.put("userId",userId); 32 c.put("tradePassword",tradePassword); 33 try { 34 appUpdatePayPasswordMapper.updateNewPaPwd(c); 35 } catch (Exception e) { 36 e.printStackTrace(); 37 throw new MyException(ResultEnum.error_update_failed); 38 } 39 return ResultUtil.success(); 40 }
标签:数据库 exce ring 返回 object format pap wpa over
原文地址:https://www.cnblogs.com/ccEmma/p/8981818.html