From 6eddbbc337d8ab1de6daaa5afda2699179e3e8db Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期一, 05 五月 2025 20:33:54 +0800
Subject: [PATCH] fix:修复bug

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TbOrdersController.java     |    4 ++--
 ruoyi-common/src/main/java/com/ruoyi/common/utils/civilAviation/ServiceOrderUtil.java |   41 +++++++++++++++++++++++++++++++----------
 ruoyi-system/src/main/resources/mapper/system/TbOrdersMapper.xml                      |    2 ++
 doc/sqlncli.msi                                                                       |    0 
 doc/java8.rar                                                                         |    0 
 doc/jdk-8u291-windows-x64.exe                                                         |    0 
 6 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/doc/java8.rar b/doc/java8.rar
new file mode 100644
index 0000000..7cc0344
--- /dev/null
+++ b/doc/java8.rar
Binary files differ
diff --git a/doc/jdk-8u291-windows-x64.exe b/doc/jdk-8u291-windows-x64.exe
new file mode 100644
index 0000000..da5cb5f
--- /dev/null
+++ b/doc/jdk-8u291-windows-x64.exe
Binary files differ
diff --git a/doc/sqlncli.msi b/doc/sqlncli.msi
new file mode 100644
index 0000000..a01b934
--- /dev/null
+++ b/doc/sqlncli.msi
Binary files differ
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TbOrdersController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TbOrdersController.java
index d7a9801..50ab317 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TbOrdersController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/TbOrdersController.java
@@ -125,7 +125,7 @@
 //        model.setCoTies("瀹跺睘"); // 闅忔満璁剧疆瀹㈡埛鑱旂郴浜轰笌鎮h�呭叧绯�
             // 璁剧疆棰勭害鏃堕棿涓轰竴澶╁悗
             Calendar calendar = Calendar.getInstance();
-            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd%20HH:mm");
+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
             model.setApptDate(sdf.format(tbOrders.getBookingDate())); // 鏍煎紡鍖栭绾﹁繍閫佹椂闂�
 
             model.setPtName(tbOrders.getPatientName()); // 鎮h�呭鍚�
@@ -188,7 +188,7 @@
 //        model.setCoTies("瀹跺睘"); // 闅忔満璁剧疆瀹㈡埛鑱旂郴浜轰笌鎮h�呭叧绯�
         // 璁剧疆棰勭害鏃堕棿涓轰竴澶╁悗
         Calendar calendar = Calendar.getInstance();
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd%20HH:mm");
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
         model.setApptDate(sdf.format(tbOrders.getBookingDate())); // 鏍煎紡鍖栭绾﹁繍閫佹椂闂�
 
         model.setPtName(tbOrders.getPatientName()); // 鎮h�呭鍚�
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/civilAviation/ServiceOrderUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/civilAviation/ServiceOrderUtil.java
index 4e7498f..cf5f262 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/civilAviation/ServiceOrderUtil.java
+++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/civilAviation/ServiceOrderUtil.java
@@ -8,8 +8,11 @@
 import com.ruoyi.common.utils.http.HttpUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
 
 import java.io.IOException;
+import java.io.UnsupportedEncodingException;
 import java.util.HashMap;
 import java.util.Map;
 import java.net.URLEncoder;
@@ -19,9 +22,19 @@
 /**
  * 姘戣埅鍖荤枟鎺ュ彛澶勭悊
  */
+@Component
 public class ServiceOrderUtil {
     private static final Logger log = LoggerFactory.getLogger(ServiceOrderUtil.class);
-    public static String AddServiceOrederAPI = "http://localhost:8011/v1/";
+    private static String addServiceOrederAPI;
+
+    @Value("${min.apiUrl}")
+    public void setAddServiceOrederAPI(String apiUrl) {
+        ServiceOrderUtil.addServiceOrederAPI = apiUrl;
+    }
+
+    public static String getAddServiceOrederAPI() {
+        return addServiceOrederAPI;
+    }
 
     /**
      * 鍒涘缓鏈嶅姟鍗�
@@ -30,13 +43,15 @@
      * @return 鏈嶅姟鍗曟帴鍙h皟鐢ㄧ粨鏋�
      */
     public static ServiceOrderAppResultVo CreateServiceOrder(ServiceOrderAppVo model,String appSecret) {
-        if (AddServiceOrederAPI.isEmpty()) {
+        if (addServiceOrederAPI.isEmpty()) {
             // log.info("AddServiceOrederAPI 鏈缃紝璇峰厛璁剧疆鎺ュ彛鍦板潃銆�");
             return null;
         }
 
+        log.info("鎺ュ彛鍦板潃锛�"+addServiceOrederAPI);
+
         //璁$畻鏃堕棿鎴冲拰绛惧悕
-        long unixTime = System.currentTimeMillis() / 1000; // 鑾峰彇褰撳墠鏃堕棿鎴筹紙绉掞級
+        long unixTime = System.currentTimeMillis() / 1000; // 鑾峰彇褰撳墠鏃堕棿鎴筹紙绉掞級  Long.valueOf("1746444543") ;//
         model.setUnixTime(unixTime); // 璁剧疆鏃堕棿鎴冲埌妯″瀷涓�
 
         // 灏� model 杞崲涓� Map<String, String>
@@ -47,15 +62,18 @@
             try {
                 Object value = field.get(model);
                 if (value != null) {
-                    params.put(field.getName(), value.toString());
+                    params.put(field.getName(),URLEncoder.encode(value.toString(), StandardCharsets.UTF_8.toString()));
                 }
             } catch (IllegalAccessException e) {
                 // log.error("鑾峰彇瀵硅薄灞炴�у�兼椂鍑洪敊", e);
+            } catch (UnsupportedEncodingException e) {
+                throw new RuntimeException(e);
             }
         }
 
         model.setSign(ServiceOrderSign.generateSign(params,appSecret)); // 鐢熸垚绛惧悕骞惰缃埌妯″瀷涓�
 
+        log.info("Sign鍊�="+model.getSign());
 
         // 鏇挎崲涓�
         StringBuilder formData = new StringBuilder();
@@ -71,16 +89,19 @@
                     // 灏嗗瓧娈靛悕棣栧瓧姣嶅ぇ鍐�
                     String fieldName = field.getName();
                     String capitalizedFieldName = fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1);
+
                     formData.append(capitalizedFieldName)
-                           .append("=")
-                           .append(value.toString());
+                            .append("=")
+                            .append(URLEncoder.encode(value.toString(), StandardCharsets.UTF_8.toString()));
                 }
             } catch (Exception e) {
                 // log.error("鎷兼帴琛ㄥ崟鏁版嵁鏃跺嚭閿�", e);
             }
         }
 
-        String responseData = HttpUtils.sendPost(AddServiceOrederAPI, formData.toString(), "application/x-www-form-urlencoded");
+        log.info("璇锋眰鍙傛暟="+formData.toString());
+
+        String responseData = HttpUtils.sendPost(addServiceOrederAPI, formData.toString(), "application/x-www-form-urlencoded");
 
 
         if (responseData != null && !responseData.isEmpty()) {
@@ -106,7 +127,7 @@
      * @return 鏈嶅姟璁㈠崟鍒犻櫎鎺ュ彛璋冪敤缁撴灉
      */
     public static ServiceOrderAppResultVo CancelServiceOrder(ServiceOrderDelVo model,String appSecret) {
-        if (AddServiceOrederAPI.isEmpty()) {
+        if (addServiceOrederAPI.isEmpty()) {
             // log.info("AddServiceOrederAPI 鏈缃紝璇峰厛璁剧疆鎺ュ彛鍦板潃銆�");
             return null;
         }
@@ -147,14 +168,14 @@
                     String fieldName = field.getName();
                     formData.append(fieldName)
                            .append("=")
-                           .append(value.toString());
+                           .append(URLEncoder.encode(value.toString(), StandardCharsets.UTF_8.toString()));
                 }
             } catch (Exception e) {
                 // log.error("鎷兼帴琛ㄥ崟鏁版嵁鏃跺嚭閿�", e);
             }
         }
 
-        String responseData = HttpUtils.sendPost(AddServiceOrederAPI, formData.toString(), "application/x-www-form-urlencoded");
+        String responseData = HttpUtils.sendPost(addServiceOrederAPI, formData.toString(), "application/x-www-form-urlencoded");
 
         if (responseData != null && !responseData.isEmpty()) {
             // log.info("鎺ュ彛鍝嶅簲: " + responseData);
diff --git a/ruoyi-system/src/main/resources/mapper/system/TbOrdersMapper.xml b/ruoyi-system/src/main/resources/mapper/system/TbOrdersMapper.xml
index 8c236c7..5160bce 100644
--- a/ruoyi-system/src/main/resources/mapper/system/TbOrdersMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/TbOrdersMapper.xml
@@ -90,11 +90,13 @@
             <if test="UpdateTime != null "> and UpdateTime = #{UpdateTime}</if>
             <if test="OrderStatus != null "> and OrderStatus = #{OrderStatus}</if>
         </where>
+        ORDER BY CreateTime DESC
     </select>
     
     <select id="selectTbOrdersByOrderID" parameterType="Long" resultMap="TbOrdersResult">
         <include refid="selectTbOrdersVo"/>
         where OrderID = #{OrderID}
+        ORDER BY CreateTime DESC
     </select>
 
     <insert id="insertTbOrders" parameterType="TbOrders">

--
Gitblit v1.9.1