From 8f329481c1122ae2d2fe37f76898654a487c9b88 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期一, 25 十一月 2024 15:37:41 +0800
Subject: [PATCH] 修改bug

---
 DriverZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushMinistryOfTransportUtil.java |   34 ++++++++++++++++++++--------------
 1 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/DriverZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushMinistryOfTransportUtil.java b/DriverZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushMinistryOfTransportUtil.java
index ccdede4..8a14f3c 100644
--- a/DriverZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushMinistryOfTransportUtil.java
+++ b/DriverZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushMinistryOfTransportUtil.java
@@ -1,6 +1,8 @@
 package com.stylefeng.guns.modular.system.util;
 
 
+import cn.hutool.http.HttpRequest;
+import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
@@ -438,7 +440,7 @@
         Double Speed = 0D;
         if(orderPositions != null && orderPositions.size() > 1){
             Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(),
-                    orderPositions.get(orderPositions.size() - 0).getLon() + "," + orderPositions.get(orderPositions.size() - 0).getLat(), 0);
+                    orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), 0);
             Speed = distance != null ? Double.valueOf(distance.get("distance")) / 1000 : 0D;
         }
         Integer state = 4;
@@ -478,13 +480,18 @@
         header.put("Accept", "*/*");
         header.put("Accept-Encoding", "gzip");
         header.put("Accept-Charset", "utf-8");
-        String result = null;
         try {
-            result = httpClientUtil.pushHttpRequset("POST", path + "ministryOfTransport/positionDriver", map, header,"form").toString();
+            HttpRequest post = HttpUtil.createPost(path + "ministryOfTransport/positionDriver");
+            post.header("Connection", "keep-alive");
+            post.header("Content-Type", "application/x-www-form-urlencoded");
+            post.header("Accept", "*/*");
+            post.header("Accept-Encoding", "gzip");
+            post.header("Accept-Charset", "utf-8");
+            post.body(JSON.toJSONString(map));
+            post.execute();
         } catch (Exception e) {
             e.printStackTrace();
         }
-        System.err.println("-----------------------------驾驶员定位信息------------------------:" + result);
     }
 
 
@@ -508,7 +515,7 @@
         Double Speed = 0D;
         if(orderPositions != null && orderPositions.size() > 1){
             Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(),
-                    orderPositions.get(orderPositions.size() - 0).getLon() + "," + orderPositions.get(orderPositions.size() - 0).getLat(), 0);
+                    orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), 0);
             Speed = distance != null ? Double.valueOf(distance.get("distance")) / 1000 : 0D;
         }
         Integer state = 4;
@@ -542,19 +549,18 @@
         jsonObject.put("OrderId", orderNum);//订单编号(非营运状态下填"0")
         Map<String, Object> map = new HashMap<>();
         map.put("positionVehicle", jsonObject.toJSONString());
-        Map<String, String> header = new HashMap<>();
-        header.put("Connection", "keep-alive");
-        header.put("Content-Type", "application/x-www-form-urlencoded");
-        header.put("Accept", "*/*");
-        header.put("Accept-Encoding", "gzip");
-        header.put("Accept-Charset", "utf-8");
-        String result = null;
         try {
-            result = httpClientUtil.pushHttpRequset("POST", path + "ministryOfTransport/positionVehicle", map, header,"form").toString();
+            HttpRequest post = HttpUtil.createPost(path + "ministryOfTransport/positionVehicle");
+            post.header("Connection", "keep-alive");
+            post.header("Content-Type", "application/x-www-form-urlencoded");
+            post.header("Accept", "*/*");
+            post.header("Accept-Encoding", "gzip");
+            post.header("Accept-Charset", "utf-8");
+            post.body(JSON.toJSONString(map));
+            post.execute();
         } catch (Exception e) {
             e.printStackTrace();
         }
-        System.err.println("----------------------------车辆定位信息---------------------------:" + result);
     }
 
 

--
Gitblit v1.7.1