Browse Source

微信第三方平台-授权回调修改

dev_shibei_match
zxc 5 years ago
parent
commit
a46583f3ba
  1. 26
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java

26
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java

@ -140,13 +140,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
String authCode = result.get(ModuleConstant.AUTHORIZATION_CODE_HUMP);
String authAppId = result.get(ModuleConstant.AUTHORIZER_APP_ID_HUMP);
log.info("=============================="+authCode);
AuthCodeResultDTO authCodeResultDTO = authorizationInfoDao.selectCustomerIdByAuthAppId(authAppId);
String clientType = authCodeResultDTO.getClientType();
String customerId = authCodeResultDTO.getCustomerId();
this.createAndBindOpenAccount(customerId,authAppId,clientType);
this.updateCustomerMpAppId(customerId,authAppId,clientType);
authCodeDao.updateAppId(customerId,clientType,authAppId);
this.saveAuthAccountInfo(customerId,authAppId,clientType);
break;
case ModuleConstant.UNAUTHORIZED://用户取消授权
//todo 取消授权
@ -373,26 +367,32 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
public void redirectUri(TokenDto tokenDto, @RequestBody AuthCodeAndTimeFromDTO authCodeAndTime){
log.info("开始执行回调URL");
String authCode = authCodeAndTime.getAuthCode();
String client = authCodeAndTime.getClientType();
String clientType = authCodeAndTime.getClientType();
String expiresIn = authCodeAndTime.getExpiresIn();
String customerId = this.getLoginUserCustomerId(tokenDto);
Date expiresInTime = this.countExpirationTime(expiresIn);
if (StringUtils.isBlank(customerId)||StringUtils.isBlank(client)||StringUtils.isBlank(authCode)||StringUtils.isBlank(expiresIn)){
log.info("客户ID = "+customerId+", 客户端类型为 = "+client+", 授权码为 = "+authCode+", 有效期 = "+expiresIn);
if (StringUtils.isBlank(customerId)||StringUtils.isBlank(clientType)||StringUtils.isBlank(authCode)||StringUtils.isBlank(expiresIn)){
log.info("客户ID = "+customerId+", 客户端类型为 = "+clientType+", 授权码为 = "+authCode+", 有效期 = "+expiresIn);
}
//authCode存数据库
AuthCodeFormDTO formDTO = new AuthCodeFormDTO();
formDTO.setAuthCode(authCode);
formDTO.setExpiresInTime(expiresInTime);
formDTO.setClientType(client);
formDTO.setClientType(clientType);
//授权方AppId
formDTO.setCustomerId(customerId);
log.info(formDTO.toString());
authCodeDao.deleteCustomerAuthCode(customerId,client);
authCodeDao.deleteCustomerAuthCode(customerId,clientType);
authCodeDao.insertRedirectAuthCode(formDTO);
//authCode存缓存
redisThird.setAuthCode(formDTO);
this.authInfoByAuthCode(authCode, customerId,client);
AuthorizationInfoResultDTO authorizationInfoResultDTO = this.authInfoByAuthCode(authCode, customerId, clientType);
String authAppId = authorizationInfoResultDTO.getAuthorizer_appid();
AuthCodeResultDTO authCodeResultDTO = authorizationInfoDao.selectCustomerIdByAuthAppId(authAppId);
this.createAndBindOpenAccount(customerId,authAppId,clientType);
this.updateCustomerMpAppId(customerId,authAppId,clientType);
authCodeDao.updateAppId(customerId,clientType,authAppId);
this.saveAuthAccountInfo(customerId,authAppId,clientType);
log.info("回调结束");
}

Loading…
Cancel
Save