From 88639cbfc0baf8bb5cdb188ff65cc3bca344e30b Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 23 Jun 2020 22:53:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/GovLoginServiceImpl.java | 3 +-- .../impl/PartyMemberConfirmServiceImpl.java | 6 ++--- .../service/impl/UserResiInfoServiceImpl.java | 27 +++++++++---------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 45e34e282e..7e11ab328e 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -115,8 +115,7 @@ public class GovLoginServiceImpl implements GovLoginService { String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile()); if (!formDTO.getSmsCode().equals(rightSmsCode)) { logger.error(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg())); - //TODO 2020-05-21 校验验证码先去掉方便测试 - //throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); + throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); } //3、查询用户所有的组织信息 List customerIdList = new ArrayList<>(); diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java index a51cc29d90..a06d5b460b 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/PartyMemberConfirmServiceImpl.java @@ -57,6 +57,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.Map; /** * 党员认证 @@ -150,8 +151,7 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService if (null != partyMemberInfoResult) { return new Result().error(EpmetErrorCode.MOBILE_HAS_BEEN_USED.getCode()); } - //TODO 方便测试屏蔽短信验证码 - /*//生成短信验证码 + //生成短信验证码 Map message = (Map) messageFeignClient.sendSmsCaptcha(fromDTO.getMobile()).getData(); if (null == message) { return new Result().error(EpmetErrorCode.MOBILE_GET_CODE_ERROR.getCode()); @@ -160,7 +160,7 @@ public class PartyMemberConfirmServiceImpl implements PartyMemberConfirmService partyMemberInfoRedis.deleteUserMobileCodeByPattern(fromDTO.getUserId(), fromDTO.getMobile()); //将验证码存入Redis - partyMemberInfoRedis.setUserMobileCode(fromDTO.getUserId(), fromDTO.getMobile(), message.get("code"));*/ + partyMemberInfoRedis.setUserMobileCode(fromDTO.getUserId(), fromDTO.getMobile(), message.get("code")); //将访问记录更新到热心居民申请行为记录表 saveOrUpdateVisit(fromDTO.getVisitId(), null, PartyMemberConstant.OPERATE_OPERATE_SMS_CODE); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java index d831b34e14..5901ddd950 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java @@ -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 page(Map params) { @@ -202,25 +201,25 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl map = (Map) result.getData(); - if (null == map || null == map.get("code")) { + //3:调用短信服务 生成验证码发送短信 + SendVerificationCodeFormDTO sendVerificationCodeFormDTO=new SendVerificationCodeFormDTO(); + sendVerificationCodeFormDTO.setMobile(verificationCodeFormDTO.getMobile()); + sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.USER_REGISTER); + Result 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