|
|
|
@ -1,22 +1,15 @@
|
|
|
|
|
package com.greateme.passenger.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.greateme.contant.business.VerificationCodeConstant;
|
|
|
|
|
import com.greateme.contant.http.HttpStatus;
|
|
|
|
|
import com.greateme.entity.respose.ResponseEntity;
|
|
|
|
|
import com.greateme.passenger.service.PassengerVerificationService;
|
|
|
|
|
import com.greateme.util.StringUtil;
|
|
|
|
|
import com.greateme.verification.entity.dto.PassengerVerificationCodeDTO;
|
|
|
|
|
import com.greateme.verification.entity.dto.PassengerVerificationCodeRedisDTO;
|
|
|
|
|
import com.greateme.verification.entity.vo.PassengerVerificationCodeVO;
|
|
|
|
|
import com.greateme.verification.feign.VerificationCodeRemote;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
import java.util.UUID;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <p>
|
|
|
|
@ -52,7 +45,7 @@ public class PassengerVerificationServiceImpl implements PassengerVerificationSe
|
|
|
|
|
public String generationPhoneVerificationCode(PassengerVerificationCodeDTO verificationCode) {
|
|
|
|
|
ResponseEntity<PassengerVerificationCodeVO> passengerVerificationCodeEntity = verificationCodeRemote.passengerPhone(verificationCode, 6);
|
|
|
|
|
if (HttpStatus.SUCCESS.getCode() == passengerVerificationCodeEntity.getCode()) {
|
|
|
|
|
PassengerVerificationCodeVO passengerVerificationCode = passengerVerificationCodeEntity.getDate();
|
|
|
|
|
PassengerVerificationCodeVO passengerVerificationCode = passengerVerificationCodeEntity.getData();
|
|
|
|
|
if (null != passengerVerificationCode) {
|
|
|
|
|
log.info("成功生成验证码:{},验证码的token为:{}", passengerVerificationCode.getVerificationCode(), passengerVerificationCode.getVerificationToken());
|
|
|
|
|
return passengerVerificationCode.getVerificationToken();
|
|
|
|
@ -70,10 +63,10 @@ public class PassengerVerificationServiceImpl implements PassengerVerificationSe
|
|
|
|
|
* @return 检查结果,返回bool,判断是否正确
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public Boolean checkPhoneVerificationCode(PassengerVerificationCodeVO passengerVerificationCode) {
|
|
|
|
|
public Integer checkPhoneVerificationCode(PassengerVerificationCodeVO passengerVerificationCode) {
|
|
|
|
|
ResponseEntity<Integer> checkResult = verificationCodeRemote.checkPhoneVerificationCode(passengerVerificationCode);
|
|
|
|
|
if (HttpStatus.SUCCESS.getCode() == checkResult.getCode()) {
|
|
|
|
|
return Objects.equals(VerificationCodeConstant.VERIFICATION_CODE_RIGHT, checkResult.getDate());
|
|
|
|
|
return checkResult.getData();
|
|
|
|
|
}
|
|
|
|
|
log.error("判断验证码是否正确的是否发生了错误,错误码:{},错误信息:{}", checkResult.getCode(), checkResult.getMessage());
|
|
|
|
|
return null;
|
|
|
|
|