Răsfoiți Sursa

西安交通大学新增退出接口

wangliang 2 ani în urmă
părinte
comite
853a9f95b7

+ 5 - 5
teachcloud-exchange-common/src/main/java/com/qmth/teachcloud/exchange/common/service/impl/CommonServiceImpl.java

@@ -15,12 +15,12 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import org.springframework.web.util.UriUtils;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.net.URLDecoder;
-import java.net.URLEncoder;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.StringJoiner;
@@ -88,16 +88,16 @@ public class CommonServiceImpl implements CommonService {
         StringJoiner stringJoiner = new StringJoiner("")
                 .add(teachcloudLoginUrl)
                 .add(SystemConstant.GET_UNKNOWN).add(SystemConstant.HEADER_TIME).add(SystemConstant.GET_EQUAL).add(String.valueOf(timestamp))
-                .add(SystemConstant.GET_SYMBOL).add(SystemConstant.SIGNATURE).add(SystemConstant.GET_EQUAL).add(URLEncoder.encode(signature, SystemConstant.CHARSET_NAME))
-                .add(SystemConstant.GET_SYMBOL).add(SystemConstant.USER).add(SystemConstant.GET_EQUAL).add(URLEncoder.encode(account, SystemConstant.CHARSET_NAME));
+                .add(SystemConstant.GET_SYMBOL).add(SystemConstant.SIGNATURE).add(SystemConstant.GET_EQUAL).add(UriUtils.encode(signature, SystemConstant.CHARSET_NAME))
+                .add(SystemConstant.GET_SYMBOL).add(SystemConstant.USER).add(SystemConstant.GET_EQUAL).add(UriUtils.encode(account, SystemConstant.CHARSET_NAME));
 
         if (Objects.nonNull(returnUrl) && !Objects.equals(returnUrl, "")) {
-            stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.RETURN_URL).add(SystemConstant.GET_EQUAL).add(URLEncoder.encode(returnUrl, SystemConstant.CHARSET_NAME));
+            stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.RETURN_URL).add(SystemConstant.GET_EQUAL).add(UriUtils.encode(returnUrl, SystemConstant.CHARSET_NAME));
         }
         if (Objects.nonNull(params) && !Objects.equals(params, "")) {
             String decodeJson = URLDecoder.decode(params, SystemConstant.CHARSET_NAME);
             OpenParams openParams = JacksonUtil.readJson(decodeJson, OpenParams.class);
-            stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.PARAMS).add(SystemConstant.GET_EQUAL).add(URLEncoder.encode(JacksonUtil.parseJson(openParams), SystemConstant.CHARSET_NAME));
+            stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.PARAMS).add(SystemConstant.GET_EQUAL).add(UriUtils.encode(JacksonUtil.parseJson(openParams), SystemConstant.CHARSET_NAME));
         }
 //        String redirectUrl = URLEncoder.encode(stringJoiner.toString(), SystemConstant.CHARSET);
 //        log.info("path:{},timestamp:{},account:{},signature:{},redirectUrl:{},redirectUrl_urlencode:{}", path, timestamp, account, signature, stringJoiner.toString(), redirectUrl);