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

Merge branch 'dev-2022218' into 'release'

Dev 2022218

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