From 18925965b55c103283a2fcbb161cceed41139ec6 Mon Sep 17 00:00:00 2001
From: 陈昶聿 <chychen@nbjetron.com>
Date: 星期四, 12 十一月 2026 17:14:20 +0800
Subject: [PATCH] /system/user/list 增加hospInfoCode\deptInfoCode 匹配

---
 ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java |   36 ++++++++++++++++++++++++++++++------
 1 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
index 0310368..2c73634 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/HttpUtil.java
@@ -95,7 +95,26 @@
         return httpClient;
     }
 
+    /**
+     * json鐨刾ost璇锋眰锛堝彧鍏冲績鏄惁鎴愬姛锛岄潪200鐩存帴鎶涘紓甯革級
+     *
+     * @param url     璇锋眰url
+     * @param request 璇锋眰鎶ユ枃
+     * @return 鍥哄畾杩斿洖true锛坔ttp鐘舵�侀潪200浼氭姏HttpRequestException锛�
+     */
     public static Boolean postJsonRequest(String url, String request) throws HttpRequestException {
+        postJsonRequestForString(url, request);
+        return true;
+    }
+
+    /**
+     * json鐨刾ost璇锋眰锛岃繑鍥炲搷搴旀姤鏂囧唴瀹癸紙鐢ㄤ簬闇�瑕佽В鏋愯繑鍥炵爜鐨勫満鏅紝濡備簯MAS鐭俊锛�
+     *
+     * @param url     璇锋眰url
+     * @param request 璇锋眰鎶ユ枃
+     * @return 鍝嶅簲鎶ユ枃鍐呭
+     */
+    public static String postJsonRequestForString(String url, String request) throws HttpRequestException {
         Assert.hasLength(url, "璇锋眰url涓嶈兘涓虹┖瀛楃涓层��");
         EntityEnclosingMethod httpMethod = new PostMethod(url);
 
@@ -132,8 +151,9 @@
             String respJson = stringBuffer.toString();
             // String respJson = httpMethod.getResponseBodyAsString();
             if (resultCode == OK) {
-                return true;
+                return respJson;
             } else {
+                log.warn("銆恜ostJsonRequestForString銆戣姹傚け璐ワ紝url锛歿}锛岀姸鎬佺爜锛歿}锛屽搷搴旓細{}", url, resultCode, respJson);
                 throw new HttpRequestException(resultCode, respJson);
             }
         } catch (UnsupportedEncodingException e) {
@@ -395,14 +415,18 @@
 
             // 鑾峰彇鍝嶅簲鐮�
             int responseCode = connection.getResponseCode();
+            log.info("postFormRequest 鍝嶅簲鐮侊細{}锛寀rl锛歿}", responseCode, fullUrl);
 
-            // 璇诲彇鍝嶅簲
+            // 璇诲彇鍝嶅簲锛堥潪200鏃秂rrorStream鍙兘涓簄ull锛岄伩鍏峃PE锛�
             StringBuilder response = new StringBuilder();
-            if (responseCode == HttpURLConnection.HTTP_OK) {
-                reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
-            } else {
-                reader = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
+            InputStream respStream = responseCode == HttpURLConnection.HTTP_OK
+                    ? connection.getInputStream()
+                    : connection.getErrorStream();
+            if (respStream == null) {
+                log.warn("postFormRequest 鍝嶅簲浣撲负绌猴紝鍝嶅簲鐮侊細{}锛寀rl锛歿}", responseCode, fullUrl);
+                return "";
             }
+            reader = new BufferedReader(new InputStreamReader(respStream));
 
             String line;
             while ((line = reader.readLine()) != null) {

--
Gitblit v1.9.3