|
|
@ -26,19 +26,18 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.constant.SmsTemplateConstant; |
|
|
|
import com.epmet.constant.UserConstant; |
|
|
|
import com.epmet.constant.UserRoleConstant; |
|
|
|
import com.epmet.dao.UserResiInfoDao; |
|
|
|
import com.epmet.dto.UserResiInfoDTO; |
|
|
|
import com.epmet.dto.UserRoleDTO; |
|
|
|
import com.epmet.dto.form.IssueInitiatorFormDTO; |
|
|
|
import com.epmet.dto.form.UserResiInfoFormDTO; |
|
|
|
import com.epmet.dto.form.UserResiInfoListFormDTO; |
|
|
|
import com.epmet.dto.form.VerificationCodeFormDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.IssueInitiatorResultDTO; |
|
|
|
import com.epmet.dto.result.SendVerificationCodeResultDTO; |
|
|
|
import com.epmet.dto.result.UserResiInfoResultDTO; |
|
|
|
import com.epmet.entity.UserResiInfoEntity; |
|
|
|
import com.epmet.feign.MessageFeignClient; |
|
|
|
import com.epmet.feign.EpmetMessageOpenFeignClient; |
|
|
|
import com.epmet.redis.UserResiInfoRedis; |
|
|
|
import com.epmet.service.RegisterRelationService; |
|
|
|
import com.epmet.service.UserResiInfoService; |
|
|
@ -77,7 +76,7 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us |
|
|
|
@Autowired |
|
|
|
private UserRoleService userRoleService; |
|
|
|
@Autowired |
|
|
|
private MessageFeignClient messageFeignClient; |
|
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<UserResiInfoDTO> page(Map<String, Object> params) { |
|
|
@ -202,25 +201,25 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl<UserResiInfoDao, Us |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public Result getVerificationCode(VerificationCodeFormDTO verificationCodeFormDTO) { |
|
|
|
Result result = new Result(); |
|
|
|
//1:更新居民注册访问记录表数据
|
|
|
|
userResiRegisterVisitService.updateResiVisitOperate(verificationCodeFormDTO); |
|
|
|
//2:判断手机号是否可用
|
|
|
|
if (!getResiInfoByMobile(verificationCodeFormDTO.getMobile())) { |
|
|
|
return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode()); |
|
|
|
} |
|
|
|
//TODO 2020-05-23方便测试先屏蔽短信验证码发送
|
|
|
|
/*//3:调用短信服务 生成验证码发送短信
|
|
|
|
result = messageFeignClient.sendSmsCaptcha(verificationCodeFormDTO.getMobile()); |
|
|
|
Map<String,Object> map = (Map<String, Object>) result.getData(); |
|
|
|
if (null == map || null == map.get("code")) { |
|
|
|
//3:调用短信服务 生成验证码发送短信
|
|
|
|
SendVerificationCodeFormDTO sendVerificationCodeFormDTO=new SendVerificationCodeFormDTO(); |
|
|
|
sendVerificationCodeFormDTO.setMobile(verificationCodeFormDTO.getMobile()); |
|
|
|
sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.USER_REGISTER); |
|
|
|
Result<SendVerificationCodeResultDTO> result = epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO); |
|
|
|
if(!result.success()||null==result.getData()||StringUtils.isBlank(result.getData().getCode())){ |
|
|
|
return new Result().error(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode()); |
|
|
|
} |
|
|
|
//4:删除缓存中可能存在的旧验证码
|
|
|
|
userResiInfoRedis.deleteOldUserMobileCode(verificationCodeFormDTO.getUserId(), verificationCodeFormDTO.getMobile()); |
|
|
|
//5:将验证码存入redis
|
|
|
|
userResiInfoRedis.setUserResiMobileCode(verificationCodeFormDTO.getUserId(),verificationCodeFormDTO.getMobile(),map.get("code").toString());*/ |
|
|
|
return result; |
|
|
|
userResiInfoRedis.setUserResiMobileCode(verificationCodeFormDTO.getUserId(),verificationCodeFormDTO.getMobile(),result.getData().getCode()); |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|