From bd375f4fe8081c0ca612d72ed06c47ab3f89d68d Mon Sep 17 00:00:00 2001
From: xin <1099200748@qq.com>
Date: Wed, 02 Jul 2025 16:37:47 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/pxb'

---
 oying-system/src/main/java/com/oying/modules/rider/utils/RiderSourceHttpUtils.java |  108 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 108 insertions(+), 0 deletions(-)

diff --git a/oying-system/src/main/java/com/oying/modules/rider/utils/RiderSourceHttpUtils.java b/oying-system/src/main/java/com/oying/modules/rider/utils/RiderSourceHttpUtils.java
new file mode 100644
index 0000000..3e777aa
--- /dev/null
+++ b/oying-system/src/main/java/com/oying/modules/rider/utils/RiderSourceHttpUtils.java
@@ -0,0 +1,108 @@
+package com.oying.modules.rider.utils;
+
+import cn.hutool.core.io.IoUtil;
+import cn.hutool.http.Header;
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpResponse;
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.oying.modules.rider.domain.RiderSourceInfoHttp;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashMap;
+
+
+/**
+ * TODO
+ * 骑手信息查询
+ *
+ * @author pxb
+ * @version 1.0
+ */
+public class RiderSourceHttpUtils {
+
+    private static final Logger log = LoggerFactory.getLogger(RiderSourceHttpUtils.class);
+    // private static final String URL = "http://1.14.71.182:5000/";
+    // private static final String URL = "http://192.168.18.111:5000/";
+
+
+    /**
+     * 功能描述: <HTTp请求>
+     *
+     * @param: paramMap 请求参数
+     * @return: java.lang.Object
+     * @author: pxb
+     */
+    public static String httpPostRequest(HashMap<String, Object> paramMap, String url) {
+        String jsonParam = JSON.toJSONString(paramMap);
+        HttpResponse response = null;
+        try {
+            response = HttpRequest.post(url)
+                    // 头信息,多个头信息多次调用此方法即可
+                    .header(Header.USER_AGENT, "*")
+                    .header(Header.CONTENT_TYPE, "application/json;charset=utf-8")
+                    // .form(paramMap)//表单内容
+                    // 超时,毫秒
+                    .timeout(30000)
+                    .body(jsonParam)
+                    .execute();
+            return response.body();
+        } catch (Exception e) {
+            RiderSourceInfoHttp riderSourceInfoHttp = new RiderSourceInfoHttp();
+            riderSourceInfoHttp.setCode("500");
+            riderSourceInfoHttp.setMessage(paramMap.get("phone") + "手机号请求异常:" + url);
+            riderSourceInfoHttp.setSuccess("false");
+            return JSON.toJSONString(riderSourceInfoHttp);
+        } finally {
+            IoUtil.close(response);
+        }
+    }
+
+    /**
+     * 功能描述: <获取第三方骑手数据信息>
+     *
+     * @param: [phone, sourcePlatform] 手机号,来源平台
+     * @return: riderSourceInfoHttp
+     * @author: pxb
+     */
+    public static RiderSourceInfoHttp getRiderSourceInfoHttp(String phone, String sourcePlatform) {
+        HashMap<String, Object> paramMap = new HashMap<>(2);
+        paramMap.put("phone", phone);
+        paramMap.put("produceType", sourcePlatform);
+        String url = "";
+        // 转化成对象
+        RiderSourceInfoHttp riderSourceInfoHttp = new RiderSourceInfoHttp();
+        try {
+            String result = httpPostRequest(paramMap, url);
+            // 转换数据
+            riderSourceInfoHttp = riderConvertUtils(result);
+        } catch (Exception e) {
+            riderSourceInfoHttp.setCode("500");
+            riderSourceInfoHttp.setMessage("获取数据失败");
+            riderSourceInfoHttp.setSuccess("false");
+            return riderSourceInfoHttp;
+        }
+        return riderSourceInfoHttp;
+    }
+
+    /**
+     * 功能描述: <转换第三方骑手数据信息>
+     *
+     * @param: []
+     * @return: java.lang.Object
+     * @author: pxb
+     */
+    public static RiderSourceInfoHttp riderConvertUtils(String result) {
+        RiderSourceInfoHttp riderSourceInfoHttp = new RiderSourceInfoHttp();
+        try {
+            riderSourceInfoHttp = JSONObject.parseObject(result, RiderSourceInfoHttp.class);
+            return riderSourceInfoHttp;
+        } catch (Exception e) {
+            riderSourceInfoHttp.setCode("500");
+            riderSourceInfoHttp.setMessage("转化数据失败");
+            riderSourceInfoHttp.setSuccess("false");
+            return riderSourceInfoHttp;
+        }
+    }
+}

--
Gitblit v1.9.3