From 435f6e023163ccee35dda99e9c07c187c8f0b9c6 Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期四, 08 五月 2025 18:20:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml |    3 +
 ruoyi-system/src/main/java/com/ruoyi/system/domain/VehicleGps.java |   22 +++++++++++
 ruoyi-ui/src/views/system/gps/mapNeed.vue                          |   44 ++++++++++++++++++++-
 ruoyi-ui/src/views/system/gps/map.vue                              |   45 +++++++++++++++++++++-
 4 files changed, 107 insertions(+), 7 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/VehicleGps.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/VehicleGps.java
index b786ad2..3d7f7fd 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/VehicleGps.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/VehicleGps.java
@@ -58,6 +58,12 @@
     @Excel(name = "GPS骞冲彴澶勭悊鏃堕棿")
     private String platformProcessTime;
 
+    /** 寮�濮嬫椂闂� */
+    private String beginTime;
+
+    /** 缁撴潫鏃堕棿 */
+    private String endTime;
+
     public void setGpsId(Long gpsId) {
         this.gpsId = gpsId;
     }
@@ -154,6 +160,22 @@
         return platformProcessTime;
     }
 
+    public String getBeginTime() {
+        return beginTime;
+    }
+
+    public void setBeginTime(String beginTime) {
+        this.beginTime = beginTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
diff --git a/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml b/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml
index e4c2477..a1c00c3 100644
--- a/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/VehicleGpsMapper.xml
@@ -37,7 +37,8 @@
             <if test="altitude != null "> and g.altitude = #{altitude}</if>
             <if test="speed != null "> and g.speed = #{speed}</if>
             <if test="direction != null "> and g.direction = #{direction}</if>
-            <if test="collectTime != null  and collectTime != ''"> and g.collect_time = #{collectTime}</if>
+            <if test="beginTime != null and beginTime != ''"> and g.collect_time &gt;= #{beginTime}</if>
+            <if test="endTime != null and endTime != ''"> and g.collect_time &lt;= #{endTime}</if>
         </where>
     </select>
     
diff --git a/ruoyi-ui/src/views/system/gps/map.vue b/ruoyi-ui/src/views/system/gps/map.vue
index 972e902..bd09c70 100644
--- a/ruoyi-ui/src/views/system/gps/map.vue
+++ b/ruoyi-ui/src/views/system/gps/map.vue
@@ -169,10 +169,18 @@
     if (query.timestamp) {
       this.queryParams.timestamp = query.timestamp;
     }
-    // 璁剧疆鏃堕棿鑼冨洿
+    
+    // 璁剧疆榛樿鏃堕棿鑼冨洿
+    const today = new Date();
+    const startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0);
+    const endTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59);
+    this.dateRange = [this.parseTime(startTime), this.parseTime(endTime)];
+    
+    // 濡傛灉URL涓湁鏃堕棿鍙傛暟锛屽垯浣跨敤URL涓殑鏃堕棿
     if (query.beginTime && query.endTime) {
       this.dateRange = [query.beginTime, query.endTime];
     }
+    
     this.getList();
   },
   mounted() {
@@ -220,10 +228,37 @@
         };
       });
     },
+    /** 鏍煎紡鍖栨椂闂� */
+    parseTime(time) {
+      const year = time.getFullYear();
+      const month = String(time.getMonth() + 1).padStart(2, '0');
+      const day = String(time.getDate()).padStart(2, '0');
+      const hours = String(time.getHours()).padStart(2, '0');
+      const minutes = String(time.getMinutes()).padStart(2, '0');
+      const seconds = String(time.getSeconds()).padStart(2, '0');
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
+    },
     /** 鏌ヨGPS鍒楄〃 */
     getList() {
       this.loading = true;      
-      anonymousList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+      // 鏋勫缓鏌ヨ鍙傛暟
+      const params = {
+        ...this.queryParams
+      };
+
+      // 濡傛灉娌℃湁閫夋嫨鏃堕棿鑼冨洿锛屽垯榛樿浣跨敤褰撳ぉ
+      if (!this.dateRange || this.dateRange.length === 0) {
+        const today = new Date();
+        const startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0);
+        const endTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59);
+        params.beginTime = this.parseTime(startTime);
+        params.endTime = this.parseTime(endTime);
+      } else {
+        params.beginTime = this.dateRange[0];
+        params.endTime = this.dateRange[1];
+      }
+      
+      anonymousList(params).then(response => {
         this.gpsList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -252,7 +287,11 @@
     },
     /** 閲嶇疆鎸夐挳鎿嶄綔 */
     resetQuery() {
-      this.dateRange = [];
+      // 閲嶇疆涓哄綋澶╂椂闂磋寖鍥�
+      const today = new Date();
+      const startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0);
+      const endTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59);
+      this.dateRange = [this.parseTime(startTime), this.parseTime(endTime)];
       this.resetForm("queryForm");
       this.handleQuery();
     },
diff --git a/ruoyi-ui/src/views/system/gps/mapNeed.vue b/ruoyi-ui/src/views/system/gps/mapNeed.vue
index b4709f3..48adcc7 100644
--- a/ruoyi-ui/src/views/system/gps/mapNeed.vue
+++ b/ruoyi-ui/src/views/system/gps/mapNeed.vue
@@ -160,10 +160,17 @@
       this.queryParams.vehicleNo = query.vehicleNo;
     }
     
-    // 璁剧疆鏃堕棿鑼冨洿
+    // 璁剧疆榛樿鏃堕棿鑼冨洿
+    const today = new Date();
+    const startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0);
+    const endTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59);
+    this.dateRange = [this.parseTime(startTime), this.parseTime(endTime)];
+    
+    // 濡傛灉URL涓湁鏃堕棿鍙傛暟锛屽垯浣跨敤URL涓殑鏃堕棿
     if (query.beginTime && query.endTime) {
       this.dateRange = [query.beginTime, query.endTime];
     }
+    
     this.getList();
   },
   mounted() {
@@ -214,7 +221,24 @@
     /** 鏌ヨGPS鍒楄〃 */
     getList() {
       this.loading = true;      
-      listGps(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
+      // 鏋勫缓鏌ヨ鍙傛暟
+      const params = {
+        ...this.queryParams
+      };
+
+      // 濡傛灉娌℃湁閫夋嫨鏃堕棿鑼冨洿锛屽垯榛樿浣跨敤褰撳ぉ
+      if (!this.dateRange || this.dateRange.length === 0) {
+        const today = new Date();
+        const startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0);
+        const endTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59);
+        params.beginTime = this.parseTime(startTime);
+        params.endTime = this.parseTime(endTime);
+      } else {
+        params.beginTime = this.dateRange[0];
+        params.endTime = this.dateRange[1];
+      }
+      
+      listGps(params).then(response => {
         this.gpsList = response.rows;
         this.total = response.total;
         this.loading = false;
@@ -223,6 +247,16 @@
           this.drawTrack();
         }
       });
+    },
+    /** 鏍煎紡鍖栨椂闂� */
+    parseTime(time) {
+      const year = time.getFullYear();
+      const month = String(time.getMonth() + 1).padStart(2, '0');
+      const day = String(time.getDate()).padStart(2, '0');
+      const hours = String(time.getHours()).padStart(2, '0');
+      const minutes = String(time.getMinutes()).padStart(2, '0');
+      const seconds = String(time.getSeconds()).padStart(2, '0');
+      return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
     },
     async translatePoints(points) {
       // 灏哤GS84鍧愭爣杞崲涓虹櫨搴﹀潗鏍�
@@ -243,7 +277,11 @@
     },
     /** 閲嶇疆鎸夐挳鎿嶄綔 */
     resetQuery() {
-      this.dateRange = [];
+      // 閲嶇疆涓哄綋澶╂椂闂磋寖鍥�
+      const today = new Date();
+      const startTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 0, 0, 0);
+      const endTime = new Date(today.getFullYear(), today.getMonth(), today.getDate(), 23, 59, 59);
+      this.dateRange = [this.parseTime(startTime), this.parseTime(endTime)];
       this.resetForm("queryForm");
       this.handleQuery();
     },

--
Gitblit v1.9.1