|
|
@ -18,7 +18,6 @@ |
|
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.epmet.common.token.constant.LoginConstant; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.MqConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
@ -68,11 +67,6 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, |
|
|
|
private Logger logger = LogManager.getLogger(VolunteerInfoServiceImpl.class); |
|
|
|
private static final String SEND_SMS_CODE_ERROR = "发送短信验证码异常,手机号[%s],code[%s],msg[%s]"; |
|
|
|
|
|
|
|
/** |
|
|
|
* redis 验证码 过期时长为30分钟,单位:秒 |
|
|
|
*/ |
|
|
|
private final static long MINUTE_THIRTY_EXPIRE = 60 * 30 * 1L; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
|
|
|
|
@ -90,7 +84,7 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, |
|
|
|
public Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO) { |
|
|
|
// 验证码校验
|
|
|
|
if (null != formDTO.getSmsCode()){ |
|
|
|
String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_RESI, LoginConstant.CLIENT_WXMP, formDTO.getMobile()); |
|
|
|
String smsCodeKey = RedisKeys.getVolunteerSmsCodeKey(formDTO.getMobile()); |
|
|
|
String rightSmsCode = (String) redisUtils.get(smsCodeKey); |
|
|
|
if (!formDTO.getSmsCode().equals(rightSmsCode)) { |
|
|
|
logger.error(String.format("验证码错误code[%s],msg[%s]", EpmetErrorCode.MOBILE_CODE_ERROR.getCode(), EpmetErrorCode.MOBILE_CODE_ERROR.getMsg())); |
|
|
@ -185,15 +179,15 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, |
|
|
|
* 保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis) |
|
|
|
* 过期时长为30分钟 |
|
|
|
* |
|
|
|
* @param sendSmsCodeFormDTO app、client、phone |
|
|
|
* @param sendSmsCodeFormDTO phone |
|
|
|
* @param smsCode 验证码 |
|
|
|
* @return void |
|
|
|
* @Author zhangyong |
|
|
|
* @Date 09:43 2020-08-10 |
|
|
|
**/ |
|
|
|
public void saveSmsCode(ResiSendSmsCodeFormDTO sendSmsCodeFormDTO, String smsCode) { |
|
|
|
String smsCodeKey = RedisKeys.getLoginSmsCodeKey(LoginConstant.APP_RESI, LoginConstant.CLIENT_WXMP, sendSmsCodeFormDTO.getMobile()); |
|
|
|
String smsCodeKey = RedisKeys.getVolunteerSmsCodeKey(sendSmsCodeFormDTO.getMobile()); |
|
|
|
logger.info(String.format("短信验证码key=%s", smsCodeKey)); |
|
|
|
redisUtils.set(smsCodeKey, smsCode, MINUTE_THIRTY_EXPIRE); |
|
|
|
redisUtils.set(smsCodeKey, smsCode, RedisUtils.MINUTE_THIRTY_EXPIRE); |
|
|
|
} |
|
|
|
} |
|
|
|