提交 788524eb 编写于 作者: tao.jin's avatar tao.jin

Merge branch 'dev-2022218' into 'release'

Dev 2022218

See merge request !90
流水线 #43152 已失败 于阶段
......@@ -11,7 +11,7 @@
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-client</artifactId>
<version>1.0.7</version>
<version>1.0.8</version>
<name>pica-cloud-account-client</name>
<packaging>jar</packaging>
......@@ -28,7 +28,7 @@
<dependency>
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId>
<version>1.0.7</version>
<version>1.0.8</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
......
......@@ -21,4 +21,9 @@ public interface CaptchaClient {
PicaResponse checkAuthCode(@RequestParam("mobilePhone") String mobilePhone,
@RequestParam("flag") String flag,
@RequestParam("authCode") String authCode);
@GetMapping("/account/account/checkMobile/authCode")
PicaResponse checkDetectionCode(@RequestParam("mobilePhone") String mobilePhone,
@RequestParam("flag") String flag,
@RequestParam("authCode") String authCode);
}
......@@ -11,7 +11,7 @@
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId>
<version>1.0.7</version>
<version>1.0.8</version>
<name>pica-cloud-account-common</name>
<packaging>jar</packaging>
......
......@@ -161,7 +161,7 @@
<dependency>
<groupId>com.pica.cloud.account</groupId>
<artifactId>pica-cloud-account-common</artifactId>
<version>1.0.7</version>
<version>1.0.8</version>
</dependency>
<dependency>
......
......@@ -32,6 +32,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.Objects;
@Api(description = "短信验证码资源")
@RestController
public class AutoCodeController extends AccountBaseController {
......@@ -107,10 +109,10 @@ public class AutoCodeController extends AccountBaseController {
@PostMapping(value = "/authCode")
public PicaResponse getAuthCode(@RequestBody AesAuthCodeReq authCodeReq, HttpServletRequest req) throws Exception {
// 验证码类型 0默认 1注册 2微信登录绑定手机 3修改手机
// 4重置密码 5忘记密码 7患者招募提交问卷(效验) 8Appe登录绑定手机
// 4重置密码 5忘记密码 7患者招募提交问卷(效验) 8Appe登录绑定手机 9患者查询检测报告列表
EncryptEntity entity = new EncryptEntity();
if(StringUtils.isEmpty(authCodeReq.getKey()) && StringUtils.isEmpty(authCodeReq.getContent())){
if (StringUtils.isEmpty(authCodeReq.getKey()) && StringUtils.isEmpty(authCodeReq.getContent())) {
//明文时处理
entity = RSAUtil.getAuthCodeEncrypt(authCodeReq);
logger.info("AesAuthCodeReq getAuthCode:" + JSONObject.toJSONString(authCodeReq));
......@@ -123,7 +125,7 @@ public class AutoCodeController extends AccountBaseController {
loginAes.setMobile(authCodeReq.getMobile());
loginAes.setDeviceInfo(super.getDeviceInfoLow("deviceinfo"));
loginService.insertLoginAesLog(loginAes);
}else {
} else {
//执行原逻辑
entity.setKey(authCodeReq.getKey());
entity.setContent(authCodeReq.getContent());
......@@ -131,12 +133,15 @@ public class AutoCodeController extends AccountBaseController {
BaseRequest request = CryptoUtil.decrypt(entity, BaseRequest.class);
request.setSourceType(super.getSourceType());
logger.info("authCode/getAuthCode:{}",JSONObject.toJSONString(request));
logger.info("authCode/getAuthCode:{}", JSONObject.toJSONString(request));
AccountUtils.checkMobilePhone(request.getMobile());
if (request.getBizType() != null && request.getBizType().equals(1)) {
logger.info("app-rcValidate-start");
if (Objects.equals(9, request.getFlag())) {
logger.info("input select patient record ");
}
// 调用风控接口
authCodeService.rcValidate(req, request, super.getDeviceInfo(), super.getSourceType());
// 发送短信验证码
......@@ -209,7 +214,7 @@ public class AutoCodeController extends AccountBaseController {
//验证码保存到redis,失效时间10分钟
cacheClient.set(this.getAuthCodeKey(mobilePhone, flag), authCode, 600);
//处理验证码原子性的问题
cacheClient.set(RegisterCodeKeyUtils.getRegisterKey(mobilePhone,authCode), 100, 600);
cacheClient.set(RegisterCodeKeyUtils.getRegisterKey(mobilePhone, authCode), 100, 600);
logger.info(this.getAuthCodeKey(mobilePhone, flag));
//发送短信
super.sendMobileMessage(mobilePhone, message, senderId);
......@@ -285,7 +290,7 @@ public class AutoCodeController extends AccountBaseController {
private void processSendAuthCode(String mobilePhone, Integer flag, String authCodeKeySecure) {
//接入新旭事务一致性
String batchNo = IntactUtils.getUUID();
intactUtil.sendIntact(batchNo,"processSendAuthCode",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_1,"mobilePhone:"+mobilePhone+",flag:"+flag+",authCodeKeySecure:"+authCodeKeySecure);
intactUtil.sendIntact(batchNo, "processSendAuthCode", com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_1, "mobilePhone:" + mobilePhone + ",flag:" + flag + ",authCodeKeySecure:" + authCodeKeySecure);
long start = System.currentTimeMillis();
String authCode = CommonUtil.createValidateCode();
String message = "您的验证码是" + authCode + ",在10分钟内有效。如非本人操作,请忽略本短信!";
......@@ -294,17 +299,17 @@ public class AutoCodeController extends AccountBaseController {
String authCodeKey = getAuthCodeKey(mobilePhone, flag.toString());
boolean set = cacheClient.set(authCodeKey, authCode, 600);
logger.info(cacheClient.get(authCodeKey));
logger.info("验证码缓存是否成功----->:"+set);
logger.info("验证码缓存信息----->:"+authCodeKey);
logger.info("验证码缓存是否成功----->:" + set);
logger.info("验证码缓存信息----->:" + authCodeKey);
cacheClient.set(authCodeKeySecure, System.currentTimeMillis(), 60);
//处理验证码原子性的问题
cacheClient.set(RegisterCodeKeyUtils.getRegisterKey(mobilePhone,authCode), 100, 600);
cacheClient.set(RegisterCodeKeyUtils.getRegisterKey(mobilePhone, authCode), 100, 600);
long end1 = System.currentTimeMillis();
logger.info("processSendAuthCode-1 used {} million seconds", end1-start);
logger.info("processSendAuthCode-1 used {} million seconds", end1 - start);
super.sendMobileMessage(mobilePhone, message, senderId);
long end2 = System.currentTimeMillis();
logger.info("processSendAuthCode-2 used {} million seconds", end2-start);
intactUtil.sendIntact(batchNo,"processSendAuthCode",com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3,"mobilePhone:"+mobilePhone+",flag:"+flag+",authCodeKeySecure:"+authCodeKeySecure);
logger.info("processSendAuthCode-2 used {} million seconds", end2 - start);
intactUtil.sendIntact(batchNo, "processSendAuthCode", com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3, "mobilePhone:" + mobilePhone + ",flag:" + flag + ",authCodeKeySecure:" + authCodeKeySecure);
}
......@@ -322,11 +327,10 @@ public class AutoCodeController extends AccountBaseController {
@ApiOperation("微信获取验证码")
@PostMapping(value = "/authCode/get")
public PicaResponse getAuthCode(){
public PicaResponse getAuthCode() {
String cacheCode = cacheClient.get("authCode-j1VrU5MSc1uuZaEa82ZKfQ==");
return PicaResponse.toResponse(cacheCode);
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册