From 79fc712ed025069c1d21de230bdc95c74910288c Mon Sep 17 00:00:00 2001
From: zhibing.pu <393733352@qq.com>
Date: 星期四, 25 七月 2024 18:22:40 +0800
Subject: [PATCH] 修改2.0 bug

---
 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java |   85 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 77 insertions(+), 8 deletions(-)

diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java
index 5b51032..02d52a4 100644
--- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java
+++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/api/DriverController.java
@@ -12,11 +12,8 @@
 import com.stylefeng.guns.modular.system.dao.DriverActivityHistoryMapper;
 import com.stylefeng.guns.modular.system.model.*;
 import com.stylefeng.guns.modular.system.service.*;
-import com.stylefeng.guns.modular.system.util.ALiSendSms;
-import com.stylefeng.guns.modular.system.util.DateUtil;
-import com.stylefeng.guns.modular.system.util.EmailUtil;
+import com.stylefeng.guns.modular.system.util.*;
 import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil;
-import com.stylefeng.guns.modular.system.util.ResultUtil;
 import com.stylefeng.guns.modular.system.warpper.*;
 import com.stylefeng.guns.modular.system.warpper.BalanceUsageRecord;
 import com.stylefeng.guns.modular.taxi.model.OrderTaxi;
@@ -32,6 +29,7 @@
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -1210,6 +1208,9 @@
                     switch (Integer.valueOf(String.valueOf(null != map.get("orderType") ? map.get("orderType") : 0))){
                         case 1:
                             OrderPrivateCar orderPrivateCar = orderPrivateCarService.selectById(map.get("incomeId").toString());
+                            if(null == orderPrivateCar){
+                                continue;
+                            }
                             baseWarpper.setName(language == 1 ? (orderPrivateCar.getCancelMidway() == 0 ? "" : "【途中取消】") + "打车" : language == 2 ? (orderPrivateCar.getCancelMidway() == 0 ? "" : "【Cancelled during the trip】") + "Ride" : (orderPrivateCar.getCancelMidway() == 0 ? "" : "【Annulé en cours de voyage】") + "Course");
                             break;
                         case 2:
@@ -1220,6 +1221,9 @@
                             break;
                         case 4:
                             OrderLogistics orderLogistics = orderLogisticsService.selectById(map.get("incomeId").toString());
+                            if(null == orderLogistics){
+                                continue;
+                            }
                             baseWarpper.setName(language == 1 ? (orderLogistics.getCancelMidway() == 0 ? "" : "【途中取消】") + "包裹" : language == 2 ? (orderLogistics.getCancelMidway() == 0 ? "" : "【Cancelled during the trip】") + "Delivery" : (orderLogistics.getCancelMidway() == 0 ? "" : "【Annulé en cours de voyage】") + "Livraison");
                             break;
                         case 5:
@@ -1242,6 +1246,9 @@
                             break;
                         case 2:
                             OrderTaxi orderTaxi = orderTaxiService.selectById(map.get("incomeId").toString());
+                            if(null == orderTaxi){
+                                continue;
+                            }
                             List<Income> incomes1 = incomeService.queryData(1, null, 2, orderTaxi.getId(), 2);
                             map1.put("travelMoney", orderTaxi != null ? orderTaxi.getTravelMoney() : 0);//行程费
                             map1.put("parkMoney", orderTaxi != null ? orderTaxi.getParkMoney() : 0);//停车费
@@ -1251,6 +1258,9 @@
                             break;
                         case 3:
                             OrderCrossCity orderCrossCity = orderCrossCityService.selectById(map.get("incomeId").toString());
+                            if(null == orderCrossCity){
+                                continue;
+                            }
                             List<Income> incomes2 = incomeService.queryData(1, null, 2, orderCrossCity.getId(), 3);
                             map1.put("travelMoney", orderCrossCity != null ? orderCrossCity.getOrderMoney() : 0);//行程费
                             map1.put("parkMoney", 0);//停车费
@@ -1260,6 +1270,9 @@
                             break;
                         case 4:
                             OrderLogistics orderLogistics = orderLogisticsService.selectById(map.get("incomeId").toString());
+                            if(null == orderLogistics){
+                                continue;
+                            }
                             List<Income> incomes3 = incomeService.queryData(1, null, 2, orderLogistics.getId(), 4);
                             map1.put("parkMoney", orderLogistics != null ? orderLogistics.getParkMoney() : 0);//停车费
                             map1.put("tipMoney", 0);//小费
@@ -1268,6 +1281,9 @@
                             break;
                         case 5:
                             OrderLogistics orderLogistics1 = orderLogisticsService.selectById(map.get("incomeId").toString());
+                            if(null == orderLogistics1){
+                                continue;
+                            }
                             List<Income> incomes4 = incomeService.queryData(1, null, 2, orderLogistics1.getId(), 5);
                             map1.put("travelMoney", orderLogistics1 != null ? orderLogistics1.getOrderMoney() : 0);//行程费
                             map1.put("parkMoney", 0);//停车费
@@ -1298,7 +1314,10 @@
                             break;
                     }
                     baseWarpper.setName(language == 1 ? "取消订单费用" : language == 2 ? "Cancellation fee" : "Frais d'annulation");
-                    baseWarpper.setData(new Object());
+                    List<Income> incomes = incomeService.queryData(1, 1, 3, Integer.valueOf(map.get("incomeId").toString()), Integer.valueOf(map.get("orderType").toString()));
+                    Map<String, Object> map1 = new HashMap<>();
+                    map1.put("rakeMoney", incomes.size() > 0 ? incomes.get(0).getMoney() : 0);//抽成
+                    baseWarpper.setData(map1);
                 }
                 if("5".equals(type)){
                     switch (Integer.valueOf(String.valueOf(null != map.get("orderType") ? map.get("orderType") : 0))){
@@ -1732,20 +1751,70 @@
     @PostMapping("/api/driver/getFleetEngineAuth")
     @ApiOperation(value = "获取google地图授权token", tags = {"司机端-个人中心"}, notes = "")
     @ApiImplicitParams({
+            @ApiImplicitParam(value = "车辆id", name = "vehicleId", required = true, dataType = "string"),
             @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
     })
-    public ResultUtil<Map<String, Object>> getFleetEngineAuth(HttpServletRequest request){
+    public ResultUtil<Map<String, Object>> getFleetEngineAuth(String vehicleId, HttpServletRequest request){
         try {
             Integer uid = driverService.getUserIdFormRedis(request);
             if(null == uid){
                 return ResultUtil.tokenErr();
             }
-            Map<String, Object> s = fleetEngineUtil.fleetEngineAuth(2, uid);
+            Map<String, Object> s = fleetEngineUtil.fleetEngineAuth(2, vehicleId);
             return ResultUtil.success(s);
         }catch (Exception e){
             e.printStackTrace();
             return ResultUtil.runErr();
         }
     }
-
+    
+    
+    
+    @ResponseBody
+    @PostMapping("/api/driver/textToSpeech")
+    @ApiOperation(value = "获取语音播报文件地址", tags = {"司机端-个人中心"}, notes = "")
+    @ApiImplicitParams({
+            @ApiImplicitParam(value = "语言", name = "languageCode", required = true, dataType = "string"),
+            @ApiImplicitParam(value = "内容", name = "text", required = true, dataType = "string"),
+            @ApiImplicitParam(value = "文件名称", name = "fileName", required = true, dataType = "string"),
+            @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+    })
+    public ResultUtil textToSpeech(String languageCode, String text, String fileName){
+        try {
+            String s = TextToSpeechUtil.create(languageCode, text, fileName + ".mp3");
+            //定时任务删除语音文件
+            new Timer().schedule(new TimerTask() {
+                @Override
+                public void run() {
+                    Process process = null;
+                    try {
+                        process = Runtime.getRuntime().exec("rm -rf /usr/local/nginx/html/files/audio/" + fileName + ".mp3");
+                    } catch (IOException e) {
+                        throw new RuntimeException(e);
+                    }
+                    if (process != null) {
+                        process.destroy();
+                    }
+                }
+            }, 30000);
+            return ResultUtil.success(s);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return ResultUtil.runErr();
+        }
+    }
+    
+    
+    /**
+     * 手动添加当日活动
+     */
+    @ResponseBody
+    @GetMapping("/base/driver/addTodayActivity")
+    public void addTodayActivity(){
+        try {
+            driverService.addTodayActivity();
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
 }

--
Gitblit v1.7.1