From 19d2b6427ebed89895b402d5e61ab78f4687b550 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期四, 10 十月 2024 11:31:11 +0800
Subject: [PATCH] 修改bug

---
 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java |   48 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java
index afe78cc..b9713a2 100644
--- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java
+++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/ReassignServiceImpl.java
@@ -33,7 +33,9 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.io.BufferedReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -228,7 +230,7 @@
                             text = "Received a new ride order, starting from " + orderPrivateCar.getStartAddress() + ", the whole journey is about " + orderPrivateCar.getEstimatedMileage() + "kilometre";
                             break;
                         case 3:
-                            text = "J'ai reçu une nouvelle commande de course, à partir de " + orderPrivateCar.getStartAddress() + ", le trajet complet est d’environ " + orderPrivateCar.getEstimatedMileage() + "kilométrage";
+                            text = "Reçu une nouvelle commande de course, à partir de " + orderPrivateCar.getStartAddress() + ", le trajet complet est d’environ " + orderPrivateCar.getEstimatedMileage();
                             break;
             
                     }
@@ -243,14 +245,21 @@
                     new Timer().schedule(new TimerTask() {
                         @Override
                         public void run() {
-                            Process process = null;
                             try {
-                                process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName);
-                            } catch (IOException e) {
-                                throw new RuntimeException(e);
-                            }
-                            if (process != null) {
-                                process.destroy();
+                                // 使用Runtime执行命令
+                                Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName);
+                                // 读取命令的输出
+                                BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+                                String line;
+                                while ((line = reader.readLine()) != null) {
+                                    System.out.println(line);
+                                }
+                                // 等待命令执行完成
+                                process.waitFor();
+                                // 关闭流
+                                reader.close();
+                            } catch (IOException | InterruptedException e) {
+                                e.printStackTrace();
                             }
                         }
                     }, 30000);
@@ -479,7 +488,7 @@
                             text = "Received a new delivery order, starting from " + orderLogistics.getStartAddress() + ", the whole journey is about " + orderLogistics.getEstimatedMileage() + "kilometre";
                             break;
                         case 3:
-                            text = "J'ai reçu une nouvelle commande de livraison, à partir de " + orderLogistics.getStartAddress() + ", le trajet complet est d’environ " + orderLogistics.getEstimatedMileage() + "kilométrage";
+                            text = "Reçu une nouvelle commande de livraison, à partir de " + orderLogistics.getStartAddress() + ", le trajet complet est d’environ " + orderLogistics.getEstimatedMileage();
                             break;
             
                     }
@@ -494,14 +503,21 @@
                     new Timer().schedule(new TimerTask() {
                         @Override
                         public void run() {
-                            Process process = null;
                             try {
-                                process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName);
-                            } catch (IOException e) {
-                                throw new RuntimeException(e);
-                            }
-                            if (process != null) {
-                                process.destroy();
+                                // 使用Runtime执行命令
+                                Process process = Runtime.getRuntime().exec("sudo rm -rf /home/igotechgh/nginx/html/files/audio/" + fileName);
+                                // 读取命令的输出
+                                BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
+                                String line;
+                                while ((line = reader.readLine()) != null) {
+                                    System.out.println(line);
+                                }
+                                // 等待命令执行完成
+                                process.waitFor();
+                                // 关闭流
+                                reader.close();
+                            } catch (IOException | InterruptedException e) {
+                                e.printStackTrace();
                             }
                         }
                     }, 30000);

--
Gitblit v1.7.1