From f78a1ad6fd6c0d70f33dd2edc6170104e9ed6429 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期日, 27 七月 2025 13:56:34 +0800
Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/QianYunTong

---
 DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java |   58 +++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java
index 7e4ed92..c721ab2 100644
--- a/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java
+++ b/DriverQYTTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java
@@ -35,25 +35,19 @@
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.geo.Point;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.geo.GeoJsonPoint;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.*;
-import org.springframework.util.Base64Utils;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
 import java.math.BigDecimal;
-import java.security.SecureRandom;
 import java.text.MessageFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -87,7 +81,7 @@
     @Autowired
     private ICarService carService;
     
-    @Autowired
+    @Resource
     private RegionMapper regionMapper;
     
     @Autowired
@@ -108,7 +102,6 @@
     @Autowired
     private GunsProperties gunsProperties;
 
-
     @Autowired
     private ICompanyService companyService;
 
@@ -118,9 +111,23 @@
     @Autowired
     private TDriverPromotionActivityService driverPromotionActivityService;
 
-
     @Autowired
     private QianYunTongConfig qianYunTongConfig;
+    
+    @Value("${wx.url}")
+    private String ACCESS_TOKEN_URL;
+    
+    @Value("${wx.appletsAppSecret}")
+    private String memberAppSecret;
+    
+    @Value("${wx.appletsAppid}")
+    private String wxAppId;
+    
+    @Autowired
+    private RestTemplate restTemplate;
+    
+    @Autowired
+    private MongoTemplate mongoTemplate;
     
     /**
      * 获取短信验证码
@@ -599,17 +606,7 @@
         return ResultUtil.error("获取二维码失败");
     }
 
-    @Value("${wx.url}")
-    private String ACCESS_TOKEN_URL;
-
-    @Value("${wx.appletsAppSecret}")
-    private String memberAppSecret;
-
-    @Value("${wx.appletsAppid}")
-    private String wxAppId;
-
-    @Autowired
-    private RestTemplate restTemplate;
+    
 
 
     public  String getAccessToken() {
@@ -733,6 +730,17 @@
     @PostMapping("/base/savePosition")
     public String savePosition(OrderPosition orderPosition){
         try {
+            //将最新定位存储mongodb中
+            GeoJsonPoint point = new GeoJsonPoint(new Point(Double.parseDouble(orderPosition.getLon()),
+                    Double.parseDouble(orderPosition.getLat())));
+            DriverPosition position = mongoTemplate.findOne(Query.query(Criteria.where("driverId")
+                    .is(orderPosition.getDriverId())), DriverPosition.class);
+            if(null == position){
+                position = new DriverPosition();
+            }
+            position.setPoint(point);
+            mongoTemplate.save(position);
+            //处理业务上的功能
             orderPositionService.saveData(orderPosition);
             return JSON.toJSONString(ResultUtil.success());
         }catch (Exception e){

--
Gitblit v1.7.1