提交 e2494cfc 编写于 作者:  Peijun.zhao's avatar Peijun.zhao

check code

上级 6cb1cca9
流水线 #33411 已失败 于阶段
in 0 second
......@@ -71,7 +71,7 @@ public class LoginV1Controller extends AccountBaseController {
return PicaResponse.toResponse(oneClickLoginResultVo);
}
@ApiOperation(value = "统一校验(传空则不会校验)")
@ApiOperation(value = "手机号统一校验")
@PostMapping("/unifiedVerification")
public PicaResponse unifiedVerification(@RequestBody AesAuthCodeReq req) throws Exception {
EncryptEntity entity = new EncryptEntity();
......
......@@ -68,6 +68,7 @@ public enum AccountExceptionEnum {
PICA_PASSWORD_RESET("216559", "您尚未设置密码,请退出登录后使用密码方式登录进行密码设置"),
MOBILE_NOT_REGISTER("216560", "手机号{mobile}尚未注册"),
PARAMS_BIZ_TYPE_EMPTY("216561", "参数bizType不能为空"),
xxx_xxx("","");
......
......@@ -64,6 +64,9 @@ public class LoginV1ServiceImpl implements LoginV1Service {
@Autowired
private AccountLogUtils picaLogUtils;
@Autowired
private AccountInfoDetailMapper accountInfoMapper;
/**
* 新版一键登录
......@@ -103,55 +106,20 @@ public class LoginV1ServiceImpl implements LoginV1Service {
return result;
}
private LoginResult processLogin(BaseRequest baseRequest, Integer acctId, Integer loginType, QueryMobileEntity queryMobileEntity) {
//接入新旭事务一致性
String batchNo = IntactUtils.getUUID();
intactUtil.sendIntact(batchNo, "processLogin", com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_1, "baseRequest:" + JSON.toJSONString(baseRequest) + ",+acctId:" + acctId + ",loginType:" + loginType + ",queryMobileEntity:" + JSON.toJSONString(queryMobileEntity));
Date currentTime = new Date();
Long userId = accountUtils.getUserIdByAcctId(baseRequest.getProductType(), acctId);
Account account = new Account();
account.setId(userId);
account.setAcctId(acctId);
account.setCreatTime(currentTime);
account.setMobilePhone(baseRequest.getMobile());
account.setRegisterSource(baseRequest.getSourceType());
String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult();
result.setToken(newToken);
result.setUserId(userId);
result.setMobile(baseRequest.getMobile());
result.setDoctorId(EncryptUtils.encryptContent(userId + "", EncryptConstants.ENCRYPT_TYPE_ID));
//是否完善过个人信息(云鹊医app才需要)
if (baseRequest.getProductType() != AccountTypeEnum.PRODUCT_TYPE_HEALTH.getCode()) {
Doctor doctorEntity = doctorInfoMapper.selectByPrimaryKey(userId.intValue());
result.setEntireFlag(doctorEntity.getEntireFlag());
}
//记录登录日志
LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, baseRequest.getProductType(), baseRequest.getSourceType(),
loginType, baseRequest.getLoginIp(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(), AccountTypeEnum.LOG_TYPE_LOGIN.getCode(), newToken, 1, baseRequest.getUserTokenTourist());
if (queryMobileEntity != null) {
entity.setQueryMobileEntity(queryMobileEntity);
}
picaLogUtils.info(entity);
intactUtil.sendIntact(batchNo, "processLogin", com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3, "baseRequest:" + JSON.toJSONString(baseRequest) + ",+acctId:" + acctId + ",loginType:" + loginType + ",queryMobileEntity:" + JSON.toJSONString(queryMobileEntity));
return result;
}
@Autowired
private AccountInfoDetailMapper accountInfoMapper;
/**
* 手机号 统一check
* @param request
*/
@Override
public void mobileValidate(BaseRequest request) {
Integer bizType = request.getBizType();
String mobile = request.getMobile();
Integer sourceType = request.getSourceType();
// todo 报错提示 bizetype
if (null == bizType) {
logger.info("bizType is null");
throw new PicaWarnException(PicaResultCode.PARAM_IS_BLANK.code(),
PicaResultCode.PARAM_IS_BLANK.message());
throw new PicaWarnException(AccountExceptionEnum.PARAMS_BIZ_TYPE_EMPTY.getCode(),
AccountExceptionEnum.PARAMS_BIZ_TYPE_EMPTY.getMessage());
}
// 手机号规则校验
......@@ -185,6 +153,41 @@ public class LoginV1ServiceImpl implements LoginV1Service {
}
}
/**------------------- private -------------------*/
private LoginResult processLogin(BaseRequest baseRequest, Integer acctId, Integer loginType, QueryMobileEntity queryMobileEntity) {
//接入新旭事务一致性
String batchNo = IntactUtils.getUUID();
intactUtil.sendIntact(batchNo, "processLogin", com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_1, "baseRequest:" + JSON.toJSONString(baseRequest) + ",+acctId:" + acctId + ",loginType:" + loginType + ",queryMobileEntity:" + JSON.toJSONString(queryMobileEntity));
Date currentTime = new Date();
Long userId = accountUtils.getUserIdByAcctId(baseRequest.getProductType(), acctId);
Account account = new Account();
account.setId(userId);
account.setAcctId(acctId);
account.setCreatTime(currentTime);
account.setMobilePhone(baseRequest.getMobile());
account.setRegisterSource(baseRequest.getSourceType());
String newToken = tokenUtils.generateToken(account);
LoginResult result = new LoginResult();
result.setToken(newToken);
result.setUserId(userId);
result.setMobile(baseRequest.getMobile());
result.setDoctorId(EncryptUtils.encryptContent(userId + "", EncryptConstants.ENCRYPT_TYPE_ID));
//是否完善过个人信息(云鹊医app才需要)
if (baseRequest.getProductType() != AccountTypeEnum.PRODUCT_TYPE_HEALTH.getCode()) {
Doctor doctorEntity = doctorInfoMapper.selectByPrimaryKey(userId.intValue());
result.setEntireFlag(doctorEntity.getEntireFlag());
}
//记录登录日志
LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, baseRequest.getProductType(), baseRequest.getSourceType(),
loginType, baseRequest.getLoginIp(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(), AccountTypeEnum.LOG_TYPE_LOGIN.getCode(), newToken, 1, baseRequest.getUserTokenTourist());
if (queryMobileEntity != null) {
entity.setQueryMobileEntity(queryMobileEntity);
}
picaLogUtils.info(entity);
intactUtil.sendIntact(batchNo, "processLogin", com.pica.cloud.foundation.completeness.contract.constants.CommonConstants.INTACT_CONTENT_LOG_STATUS_3, "baseRequest:" + JSON.toJSONString(baseRequest) + ",+acctId:" + acctId + ",loginType:" + loginType + ",queryMobileEntity:" + JSON.toJSONString(queryMobileEntity));
return result;
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册