|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.nacos.client.config.utils.IOUtils; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.HttpClientManager; |
|
|
|
import com.epmet.constant.ModuleConstant; |
|
|
|
import com.epmet.constant.ThirdRedisKeyConstant; |
|
|
@ -27,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
@ -367,38 +369,28 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public void redirectUri(HttpServletRequest request, HttpServletResponse response,String customerId, String client) throws IOException{ |
|
|
|
public void redirectUri(TokenDto tokenDto, @RequestBody AuthCodeAndTimeFromDTO authCodeAndTime){ |
|
|
|
log.info("开始执行回调URL"); |
|
|
|
try { |
|
|
|
request.setCharacterEncoding(ModuleConstant.UTF8); |
|
|
|
response.setCharacterEncoding(ModuleConstant.UTF8); |
|
|
|
} catch (UnsupportedEncodingException e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
/*String customerId = request.getParameter(ModuleConstant.CUSTOMER_ID); |
|
|
|
String client = request.getParameter(ModuleConstant.CLIENT);*/ |
|
|
|
String authCode = request.getParameter(ModuleConstant.AUTH_CODE); |
|
|
|
String expiresIn = request.getParameter(ModuleConstant.EXPIRES_IN); |
|
|
|
String authCode = authCodeAndTime.getAuthCode(); |
|
|
|
String client = authCodeAndTime.getClientType(); |
|
|
|
String expiresIn = authCodeAndTime.getExpiresIn(); |
|
|
|
String customerId = tokenDto.getCustomerId(); |
|
|
|
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); |
|
|
|
} |
|
|
|
// AuthorizationInfoResultDTO authorizationInfo = this.authInfoByAuthCode(authCode, customerId,client);
|
|
|
|
//authCode存数据库
|
|
|
|
AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); |
|
|
|
formDTO.setAuthCode(authCode); |
|
|
|
formDTO.setExpiresInTime(expiresInTime); |
|
|
|
formDTO.setClientType(client); |
|
|
|
//授权方AppId
|
|
|
|
// formDTO.setAuthAppId(authorizationInfo.getAuthorizer_appid());
|
|
|
|
formDTO.setCustomerId(customerId); |
|
|
|
log.info(formDTO.toString()); |
|
|
|
// this.updateCustomerMpAppIdAndCreateOpenPlatform(customerId,authorizationInfo.getAuthorizer_appid(),client);
|
|
|
|
authCodeDao.insertRedirectAuthCode(formDTO); |
|
|
|
//authCode存缓存
|
|
|
|
redisThird.setAuthCode(formDTO); |
|
|
|
log.info("回调结束"); |
|
|
|
// response.sendRedirect(WxMaCodeConstant.WEB_URL);
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|