|
@ -14,10 +14,13 @@ import com.epmet.commons.tools.security.dto.GovTokenDto; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.security.password.PasswordUtils; |
|
|
import com.epmet.commons.tools.security.password.PasswordUtils; |
|
|
import com.epmet.commons.tools.utils.*; |
|
|
import com.epmet.commons.tools.utils.*; |
|
|
|
|
|
import com.epmet.commons.tools.validator.PhoneValidatorUtils; |
|
|
import com.epmet.constant.AuthHttpUrlConstant; |
|
|
import com.epmet.constant.AuthHttpUrlConstant; |
|
|
|
|
|
import com.epmet.constant.SmsTemplateConstant; |
|
|
import com.epmet.dto.*; |
|
|
import com.epmet.dto.*; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.result.*; |
|
|
import com.epmet.dto.result.*; |
|
|
|
|
|
import com.epmet.feign.EpmetMessageOpenFeignClient; |
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.feign.EpmetUserOpenFeignClient; |
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
import com.epmet.feign.GovOrgOpenFeignClient; |
|
|
import com.epmet.jwt.JwtTokenProperties; |
|
|
import com.epmet.jwt.JwtTokenProperties; |
|
@ -56,6 +59,8 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { |
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @param formDTO |
|
|
* @param formDTO |
|
@ -589,4 +594,45 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { |
|
|
return phone; |
|
|
return phone; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param formDTO |
|
|
|
|
|
* @author sun |
|
|
|
|
|
* @description 单客户-工作端微信小程序登录-发送验证码 |
|
|
|
|
|
**/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void sendSmsCode(ThirdSendSmsCodeFormDTO formDTO) { |
|
|
|
|
|
String str = "发送短信验证码异常,手机号[%s],code[%s],msg[%s]"; |
|
|
|
|
|
//1.校验手机号是否符合规范
|
|
|
|
|
|
if (!PhoneValidatorUtils.isMobile(formDTO.getMobile())) { |
|
|
|
|
|
logger.warn(String.format(str, formDTO.getMobile(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg())); |
|
|
|
|
|
throw new RenException(EpmetErrorCode.ERROR_PHONE.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
//2.根据手机号校验用户是否存在
|
|
|
|
|
|
//2-1.根据appId查询对应客户Id
|
|
|
|
|
|
PaCustomerDTO customer = this.getCustomerInfo(formDTO.getAppId()); |
|
|
|
|
|
//2-2.根据手机号查询到用户信息
|
|
|
|
|
|
ThirdCustomerStaffFormDTO dto = new ThirdCustomerStaffFormDTO(); |
|
|
|
|
|
dto.setCustomerId(customer.getId()); |
|
|
|
|
|
dto.setMobile(formDTO.getMobile()); |
|
|
|
|
|
Result<List<CustomerStaffDTO>> customerStaffResult = epmetUserOpenFeignClient.getCustsomerStaffByIdAndPhone(dto); |
|
|
|
|
|
if (!customerStaffResult.success()) { |
|
|
|
|
|
logger.warn(String.format(str, formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); |
|
|
|
|
|
throw new RenException(customerStaffResult.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
//3.发送短信验证码
|
|
|
|
|
|
SendVerificationCodeFormDTO sendVerificationCodeFormDTO = new SendVerificationCodeFormDTO(); |
|
|
|
|
|
sendVerificationCodeFormDTO.setMobile(formDTO.getMobile()); |
|
|
|
|
|
sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.LGOIN_CONFIRM); |
|
|
|
|
|
Result<SendVerificationCodeResultDTO> smsCodeResult = epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO); |
|
|
|
|
|
if (!smsCodeResult.success()) { |
|
|
|
|
|
logger.warn(String.format(str, formDTO.getMobile(), smsCodeResult.getCode(), smsCodeResult.getMsg())); |
|
|
|
|
|
throw new RenException(smsCodeResult.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
//4.保存短信验证码(删除现有短信验证码 将新的短信验证码存入Redis)
|
|
|
|
|
|
SendSmsCodeFormDTO sendSmsCodeFormDTO = new SendSmsCodeFormDTO(); |
|
|
|
|
|
sendSmsCodeFormDTO.setMobile(formDTO.getMobile()); |
|
|
|
|
|
captchaRedis.saveSmsCode(sendSmsCodeFormDTO, smsCodeResult.getData().getCode()); |
|
|
|
|
|
logger.info(String.format("发送短信验证码成功,手机号[%s]", formDTO.getMobile())); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|