提交 3d4fa799 编写于 作者: Chongwen.jiang's avatar Chongwen.jiang

bizCode值都放到code中 抛异常出去..

上级 8bdb779e
......@@ -10,14 +10,12 @@ import com.pica.cloud.account.account.server.constants.Constants;
import com.pica.cloud.account.account.server.entity.*;
import com.pica.cloud.account.account.server.enums.AccountExceptionEnum;
import com.pica.cloud.account.account.server.enums.AccountTypeEnum;
import com.pica.cloud.account.account.server.enums.BizTypeRespEnum;
import com.pica.cloud.account.account.server.log.AccountLogEntityUtils;
import com.pica.cloud.account.account.server.log.AccountLogUtils;
import com.pica.cloud.account.account.server.mapper.*;
import com.pica.cloud.account.account.server.model.OneClickProcessor;
import com.pica.cloud.account.account.server.req.BaseRequest;
import com.pica.cloud.account.account.server.req.OneClickLoginReq;
import com.pica.cloud.account.account.server.resp.UnifiedVerificationResp;
import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.service.LoginService;
import com.pica.cloud.account.account.server.service.RegisterService;
......@@ -252,10 +250,10 @@ public class LoginServiceImpl implements LoginService {
* @param baseRequest
*/
private LoginResult processLogin(BaseRequest baseRequest, Integer acctId, Integer loginType) {
return processLogin(baseRequest,acctId,loginType,null);
return processLogin(baseRequest, acctId, loginType, null);
}
private LoginResult processLogin(BaseRequest baseRequest, Integer acctId, Integer loginType,QueryMobileEntity queryMobileEntity) {
private LoginResult processLogin(BaseRequest baseRequest, Integer acctId, Integer loginType, QueryMobileEntity queryMobileEntity) {
Date currentTime = new Date();
Long userId = accountUtils.getUserIdByAcctId(baseRequest.getProductType(), acctId);
Account account = new Account();
......@@ -278,7 +276,7 @@ public class LoginServiceImpl implements LoginService {
//记录登录日志
LogLoginEntity entity = AccountLogEntityUtils.getLogLoginEntity(acctId, baseRequest.getProductType(), baseRequest.getSourceType(),
loginType, baseRequest.getLoginIp(), AccountTypeEnum.LOGIN_STATUS_SUCCESS.getCode(), AccountTypeEnum.LOG_TYPE_LOGIN.getCode());
if(queryMobileEntity != null){
if (queryMobileEntity != null) {
entity.setQueryMobileEntity(queryMobileEntity);
}
picaLogUtils.info(entity);
......@@ -340,7 +338,7 @@ public class LoginServiceImpl implements LoginService {
return result;
} else {
AccountWeChatInfoEntity entity = accountWeChatInfoMapper.selectByUnionId(unionId);
logger.info("loginByWeChat-数据是否存在...entity:{}", (entity==null));
logger.info("loginByWeChat-数据是否存在...entity:{}", (entity == null));
//如果微信信息表数据不存在,就把用户信息存储到微信信息表中。
if (entity == null) {
processWeChatInfoUser(weChatUserInfoEntity, request.getWeChatLoginType());
......@@ -489,7 +487,7 @@ public class LoginServiceImpl implements LoginService {
@Override
public LoginResult oneClickLogin(OneClickLoginReq req) {
QueryMobileEntity queryMobileEntity = oneClickProcessor.tokenExchangeMobile(req.getToken(),req.getSourceType());
QueryMobileEntity queryMobileEntity = oneClickProcessor.tokenExchangeMobile(req.getToken(), req.getSourceType());
if (queryMobileEntity == null || StringUtils.isBlank(queryMobileEntity.getMobile()) || !ValidateUtils.isMobile(queryMobileEntity.getMobile())) {
throw new PicaException(PicaResultCode.INTERFACE_INVOKE_EXCEPTION.code(), "获取手机号失败!");
}
......@@ -503,16 +501,15 @@ public class LoginServiceImpl implements LoginService {
LoginResult result;
if (accountInfoEntity == null) {
//说明是注册功能
result = registerService.register(baseRequest,queryMobileEntity);
result = registerService.register(baseRequest, queryMobileEntity);
} else {
//登录功能
result = processLogin(baseRequest, accountInfoEntity.getId(), AccountTypeEnum.LOGIN_CODE.getCode(),queryMobileEntity);
result = processLogin(baseRequest, accountInfoEntity.getId(), AccountTypeEnum.LOGIN_CODE.getCode(), queryMobileEntity);
}
return result;
}
private String processDoctorAvatar(String avatar_image_url) {
if (StringUtils.isEmpty(avatar_image_url)) {
return DEFAULT_DOCTOR_PICTURE_URL;
......@@ -564,12 +561,12 @@ public class LoginServiceImpl implements LoginService {
AccountInfoEntity accountInfo = accountInfoDetailMapper.selectByMobile(AESUtil.encryptV0(mobile));
if (accountInfo == null) {
throw new PicaWarnException(AccountExceptionEnum.PICA_MOBILE_NOT_REGIST.getCode(),
AccountExceptionEnum.PICA_MOBILE_NOT_REGIST.getMessage());
AccountExceptionEnum.PICA_MOBILE_NOT_REGIST.getMessage().replace("{mobile}", mobile));
}
// 手机号是否设置了密码
if (StringUtils.isEmpty(accountInfo.getPassword())) {
throw new PicaWarnException(AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD.getCode(),
AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD.getMessage());
AccountExceptionEnum.PICA_MOBILE_NOT_SETED_PASSWORD.getMessage().replace("{mobile}", mobile));
}
}
......@@ -593,7 +590,7 @@ public class LoginServiceImpl implements LoginService {
AccountExceptionEnum.PICA_PARAMS_ERROR.getMessage());
}
// identifyToken校验
if(!checkIdentifyToken(request)){
if (!checkIdentifyToken(request)) {
throw new PicaException(
AccountExceptionEnum.PICA_APPLE_TOKEN_ERROR.getCode(),
AccountExceptionEnum.PICA_APPLE_TOKEN_ERROR.getMessage());
......@@ -706,14 +703,14 @@ public class LoginServiceImpl implements LoginService {
JSONObject jsonObject = JSONObject.parseObject(appleResp);
String keys = jsonObject.getString("keys");
JSONArray arr = JSONObject.parseArray(keys);
JSONObject jsonObject1 = JSONObject.parseObject(arr.getString(0));
System.out.println("jsonObject1:"+jsonObject1);
JSONObject jsonObject1 = JSONObject.parseObject(arr.getString(1));
System.out.println("jsonObject1:" + jsonObject1);
Jwk jwa = Jwk.fromValues(jsonObject1);
PublicKey publicKey = jwa.getPublicKey();
String audience= "com.yunqueyi.Doctor";
String subject= "001130.2b871465fd1f45ffaf5dc287e489eef1.0315";
String audience = "com.yunqueyi.Doctor";
String subject = "001130.2b871465fd1f45ffaf5dc287e489eef1.0315";
JwtParser jwtParser = Jwts.parser().setSigningKey(publicKey);
jwtParser.requireIssuer(Constants.APPLE_ISSUE_URL);
jwtParser.requireAudience(audience);
......@@ -722,7 +719,7 @@ public class LoginServiceImpl implements LoginService {
try {
System.out.println("checkIdentifyToken-apple-verify-starting");
Jws<Claims> claim = jwtParser.parseClaimsJws(jwt);
System.out.println("checkIdentifyToken-apple-verify-claim:"+ JSON.toJSONString(claim));
System.out.println("checkIdentifyToken-apple-verify-claim:" + JSON.toJSONString(claim));
if (claim != null && claim.getBody().containsKey("auth_time")) {
JSONObject claimBody = JSONObject.parseObject(JSON.toJSONString(claim.getBody()), JSONObject.class);
System.out.println("success......");
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册