From fa0a4b0ac2c4eaf2d289983ae117488ad80511cb Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 11 十月 2024 18:44:24 +0800
Subject: [PATCH] 修改2.0 bug

---
 UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java |   40 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
index 090c631..1f35f33 100644
--- a/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
+++ b/UserIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/OrderController.java
@@ -31,6 +31,8 @@
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.http.client.utils.URLEncodedUtils;
 import org.bouncycastle.util.encoders.UrlBase64Encoder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.StringUtils;
@@ -55,6 +57,8 @@
 @RestController
 @RequestMapping("")
 public class OrderController {
+    
+    private Logger log = LoggerFactory.getLogger(OrderController.class);
 
     @Autowired
     private IOrderTaxiService orderTaxiService;
@@ -118,6 +122,14 @@
     
     @Resource
     private UserActivityDiscount1Mapper userActivityDiscount1Mapper;
+    
+    @Resource
+    private RedisUtil redisUtil;
+    
+    
+    
+    
+    
 
     /**
      * 获取正在进行中的订单
@@ -849,9 +861,10 @@
             @ApiImplicitParam(value = "终点经度", name = "elon", required = true, dataType = "double"),
             @ApiImplicitParam(value = "终点纬度", name = "elat", required = true, dataType = "double")
     })
-    public ResultUtil<BaseWarpper> queryExpectedTime(Double slon, Double slat, Double elon, Double elat){
+    public ResultUtil<BaseWarpper> queryExpectedTime(Double slon, Double slat, Double elon, Double elat, HttpServletRequest request){
         try {
-            return orderService.queryExpectedTime(slon, slat, elon, elat);
+            Integer uid = userInfoService.getUserIdFormRedis(request);
+            return orderService.queryExpectedTime(uid, slon, slat, elon, elat);
         }catch (Exception e){
             e.printStackTrace();
             return ResultUtil.runErr();
@@ -1810,4 +1823,27 @@
             return ResultUtil.runErr();
         }
     }
+    
+    
+    @ResponseBody
+    @PostMapping("/api/order/getNewTripId")
+    @ApiOperation(value = "获取google预定tripid【2.0】", tags = {"用户端-首页"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil<String> getNewTripId(HttpServletRequest request){
+        try {
+            Integer uid = userInfoService.getUserIdFormRedis(request);
+            if(null == uid){
+                return ResultUtil.tokenErr();
+            }
+            String randomCode = UUIDUtil.getRandomCode();
+            redisUtil.setStrValue("trip" + uid, randomCode);
+            log.warn("生成tripId:{}   {}", System.currentTimeMillis(), randomCode);
+            return ResultUtil.success(randomCode);
+        }catch (Exception e){
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
 }

--
Gitblit v1.7.1