ソースを参照

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

wangliang 2 年 前
コミット
8249f975ca

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

@@ -9,18 +9,20 @@ import com.qmth.teachcloud.exchange.common.entity.BasicSchool;
 import com.qmth.teachcloud.exchange.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.exchange.common.service.BasicSchoolService;
 import com.qmth.teachcloud.exchange.common.service.CommonService;
+import com.qmth.teachcloud.exchange.common.util.Base64Util;
 import com.qmth.teachcloud.exchange.common.util.JacksonUtil;
 import com.qmth.teachcloud.exchange.common.util.ServletUtil;
 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.nio.charset.StandardCharsets;
 import java.util.Objects;
 import java.util.Optional;
 import java.util.StringJoiner;
@@ -88,16 +90,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(UriUtils.encode(signature, SystemConstant.CHARSET_NAME))
-                .add(SystemConstant.GET_SYMBOL).add(SystemConstant.USER).add(SystemConstant.GET_EQUAL).add(UriUtils.encode(account, SystemConstant.CHARSET_NAME));
+                .add(SystemConstant.GET_SYMBOL).add(SystemConstant.SIGNATURE).add(SystemConstant.GET_EQUAL).add(Base64Util.encode(signature.getBytes(StandardCharsets.UTF_8)))
+                .add(SystemConstant.GET_SYMBOL).add(SystemConstant.USER).add(SystemConstant.GET_EQUAL).add(URLEncoder.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(UriUtils.encode(returnUrl, SystemConstant.CHARSET_NAME));
+            stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.RETURN_URL).add(SystemConstant.GET_EQUAL).add(URLEncoder.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(UriUtils.encode(JacksonUtil.parseJson(openParams), SystemConstant.CHARSET_NAME));
+            stringJoiner = stringJoiner.add(SystemConstant.GET_SYMBOL).add(SystemConstant.PARAMS).add(SystemConstant.GET_EQUAL).add(URLEncoder.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);