From 1da73e129402bb3923e92f3d561ac49acc87fee5 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 10 十月 2025 15:39:43 +0800
Subject: [PATCH] 删除不必要的日志

---
 DriverZYTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/PushMinistryOfTransportUtil.java |  105 ++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 89 insertions(+), 16 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 5ce2365..a74b1d0 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
@@ -58,6 +58,8 @@
 
     @Autowired
     private ITransactionDetailsService transactionDetailsService;
+    @Autowired
+    private  GDMapGeocodingUtil gdMapGeocodingUtil;
 
     private String path = "http://127.0.0.1:8868/";
 
@@ -101,11 +103,25 @@
      * 订单发起接口
      * @param orderId
      */
-    public void orderCreate(Integer orderId){
+    public void orderCreate(Integer orderId)  {
         OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
         Map<String, Object> query = systemPriceMapper.query(orderPrivateCar.getCompanyId(), 1, orderPrivateCar.getServerCarModelId());
         JSONObject jsonObject = new JSONObject();
-        jsonObject.put("Address", 530602);//发起第行政区划代码
+        if (orderPrivateCar.getBoardingLon()!=null && orderPrivateCar.getBoardingLat()!=null){
+            Map<String, String> geocode = null;
+            try {
+                geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            if (geocode!=null){
+                jsonObject.put("Address", geocode.get("provinceCode"));//发起第行政区划代码
+            }else{
+                jsonObject.put("Address", 530602);//发起第行政区划代码
+            }
+        }else{
+            jsonObject.put("Address", 530602);//发起第行政区划代码
+        }
         jsonObject.put("OrderId", orderPrivateCar.getOrderNum());//订单编号
         jsonObject.put("DepartTime", orderPrivateCar.getTravelTime());//预计用车时间YYYYMMDDhhmmss
         jsonObject.put("OrderTime", orderPrivateCar.getInsertTime());//订单发起时间YYYYMMDDhhmmss
@@ -141,13 +157,27 @@
      * 订单成功接口
      * @param orderId
      */
-    public void orderMatch(Integer orderId){
+    public void orderMatch(Integer orderId)  {
         OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
         Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
         Car car = carService.selectById(orderPrivateCar.getCarId());
         String value = redisUtil.getValue("DRIVER" + orderPrivateCar.getDriverId());
         JSONObject jsonObject = new JSONObject();
-        jsonObject.put("Address", 530602);//发起地行政区划代码
+        if (orderPrivateCar.getBoardingLon()!=null && orderPrivateCar.getBoardingLat()!=null){
+            Map<String, String> geocode = null;
+            try {
+                geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            if (geocode!=null){
+                jsonObject.put("Address", geocode.get("provinceCode"));//发起第行政区划代码
+            }else{
+                jsonObject.put("Address", 530602);//发起第行政区划代码
+            }
+        }else{
+            jsonObject.put("Address", 530602);//发起第行政区划代码
+        }
         jsonObject.put("OrderId", orderPrivateCar.getOrderNum());//订单编号
         jsonObject.put("Longitude", Double.valueOf(value.split(",")[0]));//车辆经度
         jsonObject.put("Latitude", Double.valueOf(value.split(",")[1]));//车辆纬度
@@ -353,7 +383,7 @@
      * 经营支付接口
      * @param orderId
      */
-    public void operatePay(Integer orderId){
+    public void operatePay(Integer orderId)  {
         OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
         Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
         Map<String, Object> query = systemPriceMapper.query(orderPrivateCar.getCompanyId(), 1, orderPrivateCar.getServerCarModelId());
@@ -362,7 +392,22 @@
         TransactionDetails transactionDetails = transactionDetailsService.selectOne(new EntityWrapper<TransactionDetails>().eq("orderType", 1).eq("orderId", orderId));
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("OrderId", orderPrivateCar.getOrderNum());//订单号
-        jsonObject.put("OnArea", 530602);//上车位置行政区划代码
+        if (orderPrivateCar.getBoardingLon()!=null && orderPrivateCar.getBoardingLat()!=null){
+            Map<String, String> geocode = null;
+            try {
+                geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            if (geocode!=null){
+                jsonObject.put("OnArea", geocode.get("provinceCode"));//发起第行政区划代码
+            }else{
+                jsonObject.put("OnArea", 530602);//发起第行政区划代码
+            }
+        }else{
+            jsonObject.put("OnArea", 530602);//发起第行政区划代码
+        }
+//        jsonObject.put("OnArea", 530602);//上车位置行政区划代码
         jsonObject.put("DriverName", driver.getName());//机动车驾驶员
         if (driver.getIdCard() == null){
             return;
@@ -448,7 +493,7 @@
      * 驾驶员定位信息
      * @param orderId
      */
-    public void positionDriver(Integer orderId){
+    public void positionDriver(Integer orderId) {
         OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
         Driver driver = driverService.selectById(orderPrivateCar.getDriverId());
         Car car = carService.selectById(orderPrivateCar.getCarId());
@@ -464,8 +509,8 @@
         Double Elevation = orderPositions != null && orderPositions.size() > 0 ? Double.valueOf(orderPositions.get(orderPositions.size() - 1).getAltitude()) : 0D;
         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);
+            Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 2).getLon() + "," + orderPositions.get(orderPositions.size() - 2).getLat(),
+                    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;
@@ -490,7 +535,22 @@
             return;
         }
         jsonObject.put("LicenseId", driver.getIdCard());//机动车驾驶证号
-        jsonObject.put("DriverRegionCode", 530602);//行政区划代码
+        if (orderPrivateCar.getBoardingLon()!=null && orderPrivateCar.getBoardingLat()!=null){
+            Map<String, String> geocode = null;
+            try {
+                geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            if (geocode!=null){
+                jsonObject.put("DriverRegionCode", geocode.get("provinceCode"));//发起第行政区划代码
+            }else{
+                jsonObject.put("DriverRegionCode", 530602);//发起第行政区划代码
+            }
+        }else{
+            jsonObject.put("DriverRegionCode", 530602);//发起第行政区划代码
+        }
+//        jsonObject.put("DriverRegionCode", 530602);//行政区划代码
         jsonObject.put("VehicleNo", car.getCarLicensePlate());//车辆号牌
         jsonObject.put("PositionTime", new Date());//定位时间(时间戳)
         jsonObject.put("Longitude", Longitude);//经度
@@ -515,7 +575,6 @@
         } catch (Exception e) {
             e.printStackTrace();
         }
-        System.err.println("-----------------------------驾驶员定位信息------------------------:" + result);
     }
 
 
@@ -523,7 +582,7 @@
      * 车辆定位信息
      * @param orderId
      */
-    public void positionVehicle(Integer orderId){
+    public void positionVehicle(Integer orderId) {
         OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(orderId);
         Car car = carService.selectById(orderPrivateCar.getCarId());
         List<OrderPosition> orderPositions = null;
@@ -538,8 +597,8 @@
         Double Elevation = orderPositions != null && orderPositions.size() > 0 ? Double.valueOf(orderPositions.get(orderPositions.size() - 1).getAltitude()) : 0D;
         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);
+            Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 2).getLon() + "," + orderPositions.get(orderPositions.size() - 2).getLat(),
+                    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;
@@ -558,7 +617,22 @@
         }
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("VehicleNo", car.getCarLicensePlate());//车辆号牌
-        jsonObject.put("VehicleRegionCode", 530602);//行政区划代码
+        if (orderPrivateCar.getBoardingLon()!=null && orderPrivateCar.getBoardingLat()!=null){
+            Map<String, String> geocode = null;
+            try {
+                geocode = gdMapGeocodingUtil.geocode(orderPrivateCar.getBoardingLon() + "", orderPrivateCar.getBoardingLat() + "");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            if (geocode!=null){
+                jsonObject.put("VehicleRegionCode", geocode.get("provinceCode"));//发起第行政区划代码
+            }else{
+                jsonObject.put("VehicleRegionCode", 530602);//发起第行政区划代码
+            }
+        }else{
+            jsonObject.put("VehicleRegionCode", 530602);//发起第行政区划代码
+        }
+//        jsonObject.put("VehicleRegionCode", 530602);//行政区划代码
         jsonObject.put("PositionTime", new Date());//定位时间(时间戳)
         jsonObject.put("Longitude", Longitude);//经度
         jsonObject.put("Latitude", Latitude);//纬度
@@ -585,7 +659,6 @@
         } catch (Exception e) {
             e.printStackTrace();
         }
-        System.err.println("----------------------------车辆定位信息---------------------------:" + result);
     }
 
 

--
Gitblit v1.7.1