Browse Source

博物馆单点登录接口

shenji 2 years ago
parent
commit
9c74da099f

+ 11 - 5
jeecg-boot/jeecg-boot-base-common/src/main/java/org/jeecg/common/util/RestUtil.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.http.*;
 import org.springframework.web.client.RestTemplate;
+import org.springframework.web.util.UriComponentsBuilder;
 
 import java.util.Iterator;
 import java.util.Map;
@@ -173,6 +174,8 @@ public class RestUtil {
         if (StringUtils.isEmpty(url)) {
             throw new RuntimeException("url 不能为空");
         }
+        UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url);
+
         if (method == null) {
             throw new RuntimeException("method 不能为空");
         }
@@ -186,11 +189,12 @@ public class RestUtil {
         }
         // 拼接 url 参数
         if (variables != null) {
-            url += ("?" + asUrlVariables(variables));
+//            url += ("?" + asUrlVariables(variables));
+            asUrlVariables(builder, variables);
         }
         // 发送请求
         HttpEntity<String> request = new HttpEntity<>(body, headers);
-        return RT.exchange(url, method, request, responseType);
+        return RT.exchange(builder.encode().build().toUri(), method, request, responseType);
     }
 
     /**
@@ -213,7 +217,7 @@ public class RestUtil {
     /**
      * 将 JSONObject 转为 a=1&b=2&c=3...&n=n 的形式
      */
-    public static String asUrlVariables(JSONObject variables) {
+    public static String asUrlVariables(UriComponentsBuilder builder, JSONObject variables) {
         Map<String, Object> source = variables.getInnerMap();
         Iterator<String> it = source.keySet().iterator();
         StringBuilder urlVariables = new StringBuilder();
@@ -226,10 +230,12 @@ public class RestUtil {
                     value = object.toString();
                 }
             }
-            urlVariables.append("&").append(key).append("=").append(value);
+            builder.queryParam(key, value);
+//            urlVariables.append("&").append(key).append("=").append(value);
         }
         // 去掉第一个&
-        return urlVariables.substring(1);
+//        return urlVariables.substring(1);
+        return "";
     }
 
 }

+ 1 - 0
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/config/ShiroConfig.java

@@ -73,6 +73,7 @@ public class ShiroConfig {
 		filterChainDefinitionMap.put("/sys/getCheckCode", "anon"); //登录验证码接口排除
 		filterChainDefinitionMap.put("/sys/randomImage/**", "anon"); //登录验证码接口排除
 		filterChainDefinitionMap.put("/sys/login", "anon"); //登录接口排除
+		filterChainDefinitionMap.put("/sys/redirect/login", "anon"); //登录接口排除
 		filterChainDefinitionMap.put("/sys/mLogin", "anon"); //登录接口排除
 		filterChainDefinitionMap.put("/sys/logout", "anon"); //登出接口排除
 		filterChainDefinitionMap.put("/sys/getDingLogin", "anon"); //钉钉登录接口排除

File diff suppressed because it is too large
+ 36 - 1
jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/LoginController.java


+ 2 - 2
jeecg-boot/jeecg-boot-module-system/src/main/resources/application-wsm.yml

@@ -98,7 +98,7 @@ spring:
         master:
           url: jdbc:mysql://172.18.96.11:3306/wsmoa?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&useSSL=false
           username: root
-          password: Wsm2022
+          password: Wsm2022!
           driver-class-name: com.mysql.jdbc.Driver
 #        master:
 #          url: jdbc:mysql://106.15.206.14:3306/cd_work_flow_dev?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&useSSL=false
@@ -122,7 +122,7 @@ spring:
         max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
       shutdown-timeout: 100ms
-    password: ''
+    password: Wsm2022!
     port: 27017
   main:
     allow-bean-definition-overriding: true

Some files were not shown because too many files changed in this diff