From ae478a3d5dab28dd598d39f27429e4a544b15ad2 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期四, 25 十二月 2025 22:48:06 +0800
Subject: [PATCH] feat:已完成时,检查附件是否上传

---
 app/api/task.js                                                                           |   12 ++
 app/pagesTask/create-normal.vue                                                           |    8 
 app/pages/index.vue                                                                       |   26 +++-
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskController.java            |   24 ++++
 app/pagesTask/create-emergency.vue                                                        |   34 ++++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskAttachmentSyncController.java |   23 +++-
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskSyncUtilService.java         |   10 +
 app/pages/task/index.vue                                                                  |   26 +++-
 app/pagesTask/edit.vue                                                                    |   10 +-
 ruoyi-system/src/main/java/com/ruoyi/system/utils/TaskStatusPushConverter.java            |   27 +++++
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java          |   13 ++
 ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml                           |   10 ++
 ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysTaskMapper.java                     |    9 +
 app/pagesTask/edit-welfare.vue                                                            |    2 
 ruoyi-system/src/main/java/com/ruoyi/system/service/ISysTaskService.java                  |    9 +
 app/pagesTask/detail.vue                                                                  |   27 +++-
 app/pagesTask/create-welfare.vue                                                          |    8 
 17 files changed, 225 insertions(+), 53 deletions(-)

diff --git a/app/api/task.js b/app/api/task.js
index f958fc0..f9c95ba 100644
--- a/app/api/task.js
+++ b/app/api/task.js
@@ -165,3 +165,15 @@
     method: 'post'
   })
 }
+
+// 妫�鏌ヤ换鍔℃槸鍚﹂噸澶嶏紙鏍规嵁鑱旂郴浜虹數璇濆拰鍒涘缓鏃ユ湡锛�
+export function checkTaskDuplicate(phone, createDate) {
+  return request({
+    url: '/task/checkDuplicate',
+    method: 'get',
+    params: {
+      phone: phone,
+      createDate: createDate
+    }
+  })
+}
diff --git a/app/pages/index.vue b/app/pages/index.vue
index 7b2aeb4..a98e7e1 100644
--- a/app/pages/index.vue
+++ b/app/pages/index.vue
@@ -851,12 +851,19 @@
           title: '妫�鏌ラ檮浠�...'
         });
         
-        const response = await checkTaskConsentAttachment(taskId);
+        // 娉ㄦ剰锛氳繖閲屼細琚姹傛嫤鎴櫒澶勭悊锛宑ode !== 200 鏃朵細 reject
+        const response = await checkTaskConsentAttachment(taskId).catch(err => {
+          // 鎷︽埅鍣� reject 鐨勬儏鍐碉紝杩斿洖涓�涓粯璁ゅ璞�
+          console.log('璇锋眰琚嫤鎴櫒 reject锛宔rr:', err);
+          return { code: -1, msg: '鏈笂浼犵煡鎯呭悓鎰忎功' };
+        });
         
         uni.hideLoading();
+        console.log('妫�鏌ラ檮浠剁粨鏋�:', response);
         
-        if (response.code === 200) {
+        if (response && response.code === 200) {
           // 宸蹭笂浼犵煡鎯呭悓鎰忎功锛岀户缁洿鏂扮姸鎬�
+          console.log('宸蹭笂浼犵煡鎯呭悓鎰忎功锛岀户缁畬鎴愪换鍔�');
           this.$modal
             .confirm("纭浠诲姟宸插畬鎴愶紵")
             .then(() => {
@@ -864,20 +871,21 @@
             })
             .catch(() => {});
         } else {
-          // 鏈笂浼犵煡鎯呭悓鎰忎功锛屾樉绀烘彁绀�
-          this.$modal.confirm('浠诲姟鏈笂浼犵煡鎯呭悓鎰忎功锛屾棤娉曞畬鎴愪换鍔°�傛槸鍚︾幇鍦ㄥ幓涓婁紶锛�').then(() => {
+          // 鏈笂浼犵煡鎯呭悓鎰忎功鎴栧叾浠栭敊璇紝闃绘瀹屾垚
+          const message = (response && response.msg) || '浠诲姟鏈笂浼犵煡鎯呭悓鎰忎功锛屾棤娉曞畬鎴愪换鍔�';
+          console.log('鏈笂浼犵煡鎯呭悓鎰忎功锛岄樆姝㈠畬鎴�');
+          
+          this.$modal.confirm(message + '銆傛槸鍚︾幇鍦ㄥ幓涓婁紶锛�').then(() => {
             // 璺宠浆鍒颁换鍔¤鎯呴〉涓婁紶闄勪欢
             this.$tab.navigateTo(`/pagesTask/detail?id=${taskId}`);
           }).catch(() => {});
         }
       } catch (error) {
         uni.hideLoading();
-        console.error('妫�鏌ラ檮浠跺け璐�:', error);
+        console.error('妫�鏌ラ檮浠跺紓甯�:', error);
         
-        // 濡傛灉妫�鏌ュけ璐ワ紝璇㈤棶鐢ㄦ埛鏄惁缁х画
-        this.$modal.confirm('妫�鏌ラ檮浠剁姸鎬佸け璐ワ紝鏄惁缁х画瀹屾垚浠诲姟锛�').then(() => {
-          this.updateTaskStatus(taskId, status, remark);
-        }).catch(() => {});
+        // 濡傛灉妫�鏌ュけ璐ワ紙缃戠粶寮傚父绛夛級锛屼笉鍏佽瀹屾垚浠诲姟
+        this.$modal.showToast('妫�鏌ラ檮浠剁姸鎬佸け璐ワ紝鏃犳硶瀹屾垚浠诲姟');
       }
     },
 
diff --git a/app/pages/task/index.vue b/app/pages/task/index.vue
index 3b0a399..df49429 100644
--- a/app/pages/task/index.vue
+++ b/app/pages/task/index.vue
@@ -940,12 +940,19 @@
           title: '妫�鏌ラ檮浠�...'
         });
         
-        const response = await checkTaskConsentAttachment(taskId);
+        // 娉ㄦ剰锛氳繖閲屼細琚姹傛嫤鎴櫒澶勭悊锛宑ode !== 200 鏃朵細 reject
+        const response = await checkTaskConsentAttachment(taskId).catch(err => {
+          // 鎷︽埅鍣� reject 鐨勬儏鍐碉紝杩斿洖涓�涓粯璁ゅ璞�
+          console.log('璇锋眰琚嫤鎴櫒 reject锛宔rr:', err);
+          return { code: -1, msg: '鏈笂浼犵煡鎯呭悓鎰忎功' };
+        });
         
         uni.hideLoading();
+        console.log('妫�鏌ラ檮浠剁粨鏋�:', response);
         
-        if (response.code === 200) {
+        if (response && response.code === 200) {
           // 宸蹭笂浼犵煡鎯呭悓鎰忎功锛岀户缁洿鏂扮姸鎬�
+          console.log('宸蹭笂浼犵煡鎯呭悓鎰忎功锛岀户缁畬鎴愪换鍔�');
           this.$modal
             .confirm("纭浠诲姟宸插畬鎴愶紵")
             .then(() => {
@@ -953,8 +960,11 @@
             })
             .catch(() => {});
         } else {
-          // 鏈笂浼犵煡鎯呭悓鎰忎功锛屾樉绀烘彁绀�
-          this.$modal.confirm('浠诲姟鏈笂浼犵煡鎯呭悓鎰忎功锛屾棤娉曞畬鎴愪换鍔°�傛槸鍚︾幇鍦ㄥ幓涓婁紶锛�').then(() => {
+          // 鏈笂浼犵煡鎯呭悓鎰忎功鎴栧叾浠栭敊璇紝闃绘瀹屾垚
+          const message = (response && response.msg) || '浠诲姟鏈笂浼犵煡鎯呭悓鎰忎功锛屾棤娉曞畬鎴愪换鍔�';
+          console.log('鏈笂浼犵煡鎯呭悓鎰忎功锛岄樆姝㈠畬鎴�');
+          
+          this.$modal.confirm(message + '銆傛槸鍚︾幇鍦ㄥ幓涓婁紶锛�').then(() => {
             // 璺宠浆鍒颁换鍔¤鎯呴〉涓婁紶闄勪欢
             uni.navigateTo({
               url: `/pagesTask/detail?id=${taskId}`
@@ -963,12 +973,10 @@
         }
       } catch (error) {
         uni.hideLoading();
-        console.error('妫�鏌ラ檮浠跺け璐�:', error);
+        console.error('妫�鏌ラ檮浠跺紓甯�:', error);
         
-        // 濡傛灉妫�鏌ュけ璐ワ紝璇㈤棶鐢ㄦ埛鏄惁缁х画
-        this.$modal.confirm('妫�鏌ラ檮浠剁姸鎬佸け璐ワ紝鏄惁缁х画瀹屾垚浠诲姟锛�').then(() => {
-          this.updateTaskStatus(taskId, status, remark);
-        }).catch(() => {});
+        // 濡傛灉妫�鏌ュけ璐ワ紙缃戠粶寮傚父绛夛級锛屼笉鍏佽瀹屾垚浠诲姟
+        this.$modal.showToast('妫�鏌ラ檮浠剁姸鎬佸け璐ワ紝鏃犳硶瀹屾垚浠诲姟');
       }
     },
 
diff --git a/app/pagesTask/create-emergency.vue b/app/pagesTask/create-emergency.vue
index 146f013..8d590d5 100644
--- a/app/pagesTask/create-emergency.vue
+++ b/app/pagesTask/create-emergency.vue
@@ -266,7 +266,7 @@
 import { mapState } from 'vuex'
 import uniDatetimePicker from '@/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue'
 import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue'
-import { addTask } from "@/api/task"
+import { addTask, checkTaskDuplicate } from "@/api/task"
 import { listAvailableVehicles, getUserBoundVehicle } from "@/api/vehicle"
 import { searchHospitals, searchHospitalsByDeptRegion } from "@/api/hospital"
 import DepartureSelector from './components/DepartureSelector.vue'
@@ -909,6 +909,38 @@
         return
       }
       
+      // 鑾峰彇褰撳墠鏃ユ湡锛堟牸寮廦YYY-MM-DD锛�
+      const today = new Date()
+      const createDate = today.getFullYear() + '-' + 
+                        String(today.getMonth() + 1).padStart(2, '0') + '-' + 
+                        String(today.getDate()).padStart(2, '0')
+      const phone = this.taskForm.patient.phone
+      
+      // 鍏堟鏌ユ槸鍚﹂噸澶�
+      uni.showLoading({
+        title: '妫�鏌ヤ腑...'
+      })
+      
+      checkTaskDuplicate(phone, createDate).then(response => {
+        uni.hideLoading()
+        
+        // 濡傛灉鎺ュ彛杩斿洖閿欒锛岃鏄庡瓨鍦ㄩ噸澶�
+        if (response.code !== 200) {
+          this.$modal.showToast(response.msg || '璇ヨ仈绯荤數璇濆湪褰撳ぉ宸叉湁浠诲姟锛屼笉鑳介噸澶嶆彁浜�')
+          return
+        }
+        
+        // 妫�鏌ラ�氳繃锛岀户缁彁浜�
+        this.doSubmitTask()
+      }).catch(error => {
+        uni.hideLoading()
+        console.error('閲嶅鎬ф鏌ュけ璐�:', error)
+        this.$modal.showToast('妫�鏌ュけ璐ワ紝璇烽噸璇�')
+      })
+    },
+    
+    // 鎵ц瀹為檯鐨勬彁浜ゆ搷浣�
+    doSubmitTask() {
       this.$modal.confirm('纭畾瑕佷繚瀛樹换鍔″悧锛�').then(() => {
         this.loading = true
         const submitData = this.buildSubmitData()
diff --git a/app/pagesTask/create-normal.vue b/app/pagesTask/create-normal.vue
index a2a7bdf..b43d69e 100644
--- a/app/pagesTask/create-normal.vue
+++ b/app/pagesTask/create-normal.vue
@@ -91,7 +91,7 @@
           class="form-input" 
           type="digit" 
           placeholder="璇疯緭鍏ヨ椹跺叕閲屾暟" 
-          v-model="taskForm.distance"
+          v-model="taskForm.transferDistance"
         />
       </view>
       
@@ -186,7 +186,7 @@
         plannedEndTime: '',
         startLocation: '',
         endLocation: '',
-        distance: '',
+        transferDistance: '',
         remark: ''
       },
       vehicles: [],
@@ -497,7 +497,7 @@
           // 鐧惧害鍦板浘杩斿洖鐨勮窛绂诲崟浣嶆槸绫�,闇�瑕佽浆鎹负鍏噷
           const distanceInMeters = response.data.distance
           const distanceInKm = distanceInMeters / 1000
-          this.taskForm.distance = distanceInKm.toFixed(2)
+          this.taskForm.transferDistance = distanceInKm.toFixed(2)
           
           console.log('璺濈璁$畻鎴愬姛:', distanceInMeters, '绫� =', distanceInKm, '鍏噷')
           
@@ -576,7 +576,7 @@
         plannedEndTime: this.taskForm.plannedEndTime,
         departureAddress: this.taskForm.startLocation,
         destinationAddress: this.taskForm.endLocation,
-        estimatedDistance: this.taskForm.distance ? parseFloat(this.taskForm.distance) : null,
+        transferDistance: this.taskForm.transferDistance ? parseFloat(this.taskForm.transferDistance) : null,
         remark: this.taskForm.remark
       }
       
diff --git a/app/pagesTask/create-welfare.vue b/app/pagesTask/create-welfare.vue
index 096e089..2ca09fb 100644
--- a/app/pagesTask/create-welfare.vue
+++ b/app/pagesTask/create-welfare.vue
@@ -103,7 +103,7 @@
           class="form-input" 
           type="digit" 
           placeholder="璇疯緭鍏ュ叕閲屾暟" 
-          v-model="taskForm.distance"
+          v-model="taskForm.transferDistance"
         />
       </view>
       
@@ -171,7 +171,7 @@
         },
         startAddress: '',
         endAddress: '',
-        distance: '',
+        transferDistance: '',
         price: ''
       },
       vehicles: [],
@@ -267,7 +267,7 @@
           this.addressCoordinates.endAddress.lat,
           this.addressCoordinates.endAddress.lng
         ).then(distance => {
-          this.taskForm.distance = distance.toFixed(2)
+          this.taskForm.transferDistance = distance.toFixed(2)
         }).catch(error => {
           console.error('璺濈璁$畻澶辫触:', error)
         })
@@ -344,7 +344,7 @@
         passenger: this.taskForm.passenger,
         startAddress: this.taskForm.startAddress,
         endAddress: this.taskForm.endAddress,
-        distance: this.taskForm.distance ? parseFloat(this.taskForm.distance) : null,
+        transferDistance: this.taskForm.transferDistance ? parseFloat(this.taskForm.transferDistance) : null,
         price: this.taskForm.price ? parseFloat(this.taskForm.price) : null
       }
       
diff --git a/app/pagesTask/detail.vue b/app/pagesTask/detail.vue
index c6b060a..0382fc3 100644
--- a/app/pagesTask/detail.vue
+++ b/app/pagesTask/detail.vue
@@ -1014,16 +1014,27 @@
             title: '妫�鏌ラ檮浠�...'
           });
           
-          const response = await checkTaskConsentAttachment(this.taskId);
+          // 娉ㄦ剰锛氳繖閲屼細琚姹傛嫤鎴櫒澶勭悊锛宑ode !== 200 鏃朵細 reject
+          const response = await checkTaskConsentAttachment(this.taskId).catch(err => {
+            // 鎷︽埅鍣� reject 鐨勬儏鍐碉紝杩斿洖涓�涓粯璁ゅ璞�
+            console.log('璇锋眰琚嫤鎴櫒 reject锛宔rr:', err);
+            return { code: -1, msg: '鏈笂浼犵煡鎯呭悓鎰忎功' };
+          });
           
           uni.hideLoading();
+          console.log('妫�鏌ラ檮浠剁粨鏋�:', response);
           
-          if (response.code === 200) {
+          // 鍚庡彴杩斿洖 code: 200 琛ㄧず宸蹭笂浼狅紝code: -1 琛ㄧず鏈笂浼�
+          if (response && response.code === 200) {
             // 宸蹭笂浼犵煡鎯呭悓鎰忎功锛岀户缁洿鏂扮姸鎬�
+            console.log('宸蹭笂浼犵煡鎯呭悓鎰忎功锛岀户缁畬鎴愪换鍔�');
             this.getLocationAndUpdateStatus(status, remark);
           } else {
-            // 鏈笂浼犵煡鎯呭悓鎰忎功锛屾樉绀烘彁绀�
-            this.$modal.confirm('浠诲姟鏈笂浼犵煡鎯呭悓鎰忎功锛屾棤娉曞畬鎴愪换鍔°�傛槸鍚︾幇鍦ㄥ幓涓婁紶锛�').then(() => {
+            // 鏈笂浼犵煡鎯呭悓鎰忎功鎴栧叾浠栭敊璇紝闃绘瀹屾垚
+            const message = (response && response.msg) || '浠诲姟鏈笂浼犵煡鎯呭悓鎰忎功锛屾棤娉曞畬鎴愪换鍔�';
+            console.log('鏈笂浼犵煡鎯呭悓鎰忎功锛岄樆姝㈠畬鎴�');
+            
+            this.$modal.confirm(message + '銆傛槸鍚︾幇鍦ㄥ幓涓婁紶锛�').then(() => {
               // 婊氬姩鍒伴檮浠朵笂浼犲尯鍩�
               this.$nextTick(() => {
                 uni.pageScrollTo({
@@ -1035,12 +1046,10 @@
           }
         } catch (error) {
           uni.hideLoading();
-          console.error('妫�鏌ラ檮浠跺け璐�:', error);
+          console.error('妫�鏌ラ檮浠跺紓甯�:', error);
           
-          // 濡傛灉妫�鏌ュけ璐ワ紝璇㈤棶鐢ㄦ埛鏄惁缁х画
-          this.$modal.confirm('妫�鏌ラ檮浠剁姸鎬佸け璐ワ紝鏄惁缁х画瀹屾垚浠诲姟锛�').then(() => {
-            this.getLocationAndUpdateStatus(status, remark);
-          }).catch(() => {});
+          // 濡傛灉妫�鏌ュけ璐ワ紙缃戠粶寮傚父绛夛級锛屼笉鍏佽瀹屾垚浠诲姟
+          this.$modal.showToast('妫�鏌ラ檮浠剁姸鎬佸け璐ワ紝鏃犳硶瀹屾垚浠诲姟');
         }
       },
       
diff --git a/app/pagesTask/edit-welfare.vue b/app/pagesTask/edit-welfare.vue
index ec5c362..6ab079d 100644
--- a/app/pagesTask/edit-welfare.vue
+++ b/app/pagesTask/edit-welfare.vue
@@ -380,7 +380,7 @@
         destinationLatitude: this.addressCoordinates.endAddress ? this.addressCoordinates.endAddress.lat : null,
         
         // 璺濈鍜屼环鏍硷紙涓讳换鍔″瓧娈碉級
-        distance: this.taskForm.distance ? parseFloat(this.taskForm.distance) : null,
+        transferDistance: this.taskForm.transferDistance ? parseFloat(this.taskForm.transferDistance) : null,
         price: this.taskForm.price ? parseFloat(this.taskForm.price) : null,
         
         // 涔樺淇℃伅锛堝祵濂楀璞★級
diff --git a/app/pagesTask/edit.vue b/app/pagesTask/edit.vue
index ee17c8b..0be25aa 100644
--- a/app/pagesTask/edit.vue
+++ b/app/pagesTask/edit.vue
@@ -53,7 +53,7 @@
           class="form-input" 
           type="digit" 
           placeholder="璇疯緭鍏ヨ椹跺叕閲屾暟" 
-          v-model="taskForm.distance"
+          v-model="taskForm.transferDistance"
         />
       </view>
       
@@ -165,7 +165,7 @@
         plannedEndTime: '',
         startLocation: '',
         endLocation: '',
-        distance: '',
+        transferDistance: '',
         remark: ''
       },
       loading: false
@@ -209,7 +209,7 @@
         this.taskForm.plannedEndTime = this.taskDetail.plannedEndTime || ''
         this.taskForm.startLocation = this.taskDetail.departureAddress || ''
         this.taskForm.endLocation = this.taskDetail.destinationAddress || ''
-        this.taskForm.distance = this.taskDetail.estimatedDistance || ''
+        this.taskForm.transferDistance = this.taskDetail.transferDistance || ''
         this.taskForm.remark = this.taskDetail.remark || ''
         
         // 璁剧疆杞﹁締淇℃伅
@@ -289,7 +289,7 @@
       
       // 鐩戝惉mixin涓殑璺濈璁$畻瀹屾垚浜嬩欢
       this.$once('distance-calculated', (distance) => {
-        this.taskForm.distance = this.formatDistance(distance)
+        this.taskForm.transferDistance = this.formatDistance(distance)
       })
       
       this.closeMapSelector()
@@ -360,7 +360,7 @@
         destinationLatitude: this.addressCoordinates.endLocation ? this.addressCoordinates.endLocation.lat : null,
         
         // 璺濈锛堜富浠诲姟瀛楁锛�
-        distance: this.taskForm.distance ? parseFloat(this.taskForm.distance) : null,
+        transferDistance: this.taskForm.transferDistance ? parseFloat(this.taskForm.transferDistance) : null,
         
         remark: this.taskForm.remark
       }
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskController.java
index 8d94003..e41be20 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/SysTaskController.java
@@ -193,6 +193,30 @@
     public AjaxResult appAdd(@RequestBody TaskCreateVO createVO) {
         return toAjax(sysTaskService.insertSysTask(createVO));
     }
+    
+    /**
+     * 妫�鏌ヤ换鍔℃槸鍚﹂噸澶嶏紙鏍规嵁鑱旂郴浜虹數璇濆拰鍒涘缓鏃ユ湡锛�
+     * @param phone 鑱旂郴浜虹數璇�
+     * @param createDate 浠诲姟鍒涘缓鏃ユ湡锛堟牸寮忥細YYYY-MM-DD锛�
+     * @return 鏄惁瀛樺湪閲嶅浠诲姟
+     */
+    @GetMapping("/checkDuplicate")
+    public AjaxResult checkDuplicate(
+            @RequestParam("phone") String phone,
+            @RequestParam("createDate") String createDate) {
+        
+        if (StringUtils.isEmpty(phone) || StringUtils.isEmpty(createDate)) {
+            return AjaxResult.error("鍙傛暟涓嶈兘涓虹┖");
+        }
+        
+        boolean isDuplicate = sysTaskService.checkTaskDuplicate(phone, createDate);
+        
+        if (isDuplicate) {
+            return AjaxResult.error("璇ヨ仈绯荤數璇濆湪璇ユ棩鏈熷凡鏈変换鍔★紝涓嶈兘閲嶅鎻愪氦");
+        }
+        
+        return AjaxResult.success("鏈彂鐜伴噸澶嶄换鍔�");
+    }
 
     /**
      * 淇敼浠诲姟锛堝悗鍙扮鐞嗙锛�
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskAttachmentSyncController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskAttachmentSyncController.java
index 5bd04aa..df2b916 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskAttachmentSyncController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/task/TaskAttachmentSyncController.java
@@ -87,17 +87,28 @@
         }
     }
 
+    /**
+     * 妫�鏌ヤ换鍔℃槸鍚︿笂浼犱簡鐭ユ儏鍚屾剰涔�
+     * 
+     * @param taskId 浠诲姟ID
+     * @return 妫�鏌ョ粨鏋�
+     */
     @PostMapping("/task/check/{taskId}")
     public AjaxResult checkTaskAttachment(@PathVariable("taskId") Long taskId) {
         try {
-
-            Boolean ret=taskAttachmentSyncService.checkAttachment(taskId,"1");
-            if(ret){
+            logger.info("妫�鏌ヤ换鍔� {} 鐨勭煡鎯呭悓鎰忎功闄勪欢", taskId);
+            
+            Boolean ret = taskAttachmentSyncService.checkAttachment(taskId, "1");
+            
+            if (ret) {
+                logger.info("浠诲姟 {} 宸蹭笂浼犵煡鎯呭悓鎰忎功", taskId);
                 return AjaxResult.success("宸蹭笂浼犵煡鎯呭悓鎰忎功");
-            }else{
-                return AjaxResult.error(-1,"鏈笂浼犵煡鎯呭悓鎰忎功");
+            } else {
+                logger.warn("浠诲姟 {} 鏈笂浼犵煡鎯呭悓鎰忎功", taskId);
+                return AjaxResult.error(-1, "鏈笂浼犵煡鎯呭悓鎰忎功");
             }
-        }catch (Exception e){
+        } catch (Exception e) {
+            logger.error("妫�鏌ヤ换鍔� {} 鐨勯檮浠跺け璐�", taskId, e);
             return AjaxResult.error("妫�鏌ュけ璐ワ細" + e.getMessage());
         }
     }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysTaskMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysTaskMapper.java
index f900677..fbd9c61 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysTaskMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/SysTaskMapper.java
@@ -140,4 +140,13 @@
     public List<SysTask> selectTaskByVehicleIdAndDate(@Param("vehicleId") Long vehicleId,
                                                       @Param("startTime") String startTime,
                                                       @Param("endTime") String endTime);
+    
+    /**
+     * 鏍规嵁鑱旂郴浜虹數璇濆拰鍒涘缓鏃ユ湡鏌ヨ浠诲姟鏁伴噺
+     * 
+     * @param phone 鑱旂郴浜虹數璇�
+     * @param createDate 浠诲姟鍒涘缓鏃ユ湡锛堟牸寮忥細YYYY-MM-DD锛�
+     * @return 浠诲姟鏁伴噺
+     */
+    public int countTaskByPhoneAndDate(@Param("phone") String phone, @Param("createDate") String createDate);
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysTaskService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysTaskService.java
index 4d42c86..7988e3e 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysTaskService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/ISysTaskService.java
@@ -336,5 +336,14 @@
      * @return 缁撴灉
      */
     public com.ruoyi.common.core.domain.AjaxResult cancelAssigneeReady(Long taskId, Long userId);
+    
+    /**
+     * 妫�鏌ヤ换鍔℃槸鍚﹂噸澶嶏紙鏍规嵁鑱旂郴浜虹數璇濆拰鍒涘缓鏃ユ湡锛�
+     * 
+     * @param phone 鑱旂郴浜虹數璇�
+     * @param createDate 浠诲姟鍒涘缓鏃ユ湡锛堟牸寮忥細YYYY-MM-DD锛�
+     * @return true-瀛樺湪閲嶅锛宖alse-涓嶉噸澶�
+     */
+    public boolean checkTaskDuplicate(String phone, String createDate);
 
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java
index abbeaab..51f3800 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysTaskServiceImpl.java
@@ -1717,6 +1717,19 @@
     public AjaxResult cancelAssigneeReady(Long taskId, Long userId) {
         return sysTaskAssigneeService.cancelAssigneeReady(taskId, userId);
     }
+    
+    /**
+     * 妫�鏌ヤ换鍔℃槸鍚﹂噸澶嶏紙鏍规嵁鑱旂郴浜虹數璇濆拰鍒涘缓鏃ユ湡锛�
+     * 
+     * @param phone 鑱旂郴浜虹數璇�
+     * @param createDate 浠诲姟鍒涘缓鏃ユ湡锛堟牸寮忥細YYYY-MM-DD锛�
+     * @return true-瀛樺湪閲嶅锛宖alse-涓嶉噸澶�
+     */
+    @Override
+    public boolean checkTaskDuplicate(String phone, String createDate) {
+        int count = sysTaskMapper.countTaskByPhoneAndDate(phone, createDate);
+        return count > 0;
+    }
 
 
    
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskSyncUtilService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskSyncUtilService.java
index 8fcf410..de82106 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskSyncUtilService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TaskSyncUtilService.java
@@ -19,6 +19,7 @@
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.math.BigDecimal;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.net.URLEncoder;
@@ -91,6 +92,9 @@
         return adminID;
     }
 
+    private String getCoo(BigDecimal lng, BigDecimal lat){
+        return lng+","+lat;
+    }
     /**
      * 鏋勫缓鍚屾鍙傛暟
      */
@@ -160,7 +164,7 @@
         params.put("ServiceOrdCoName", StringUtils.nvl(emergency.getPatientContact(), ""));
         params.put("ServiceOrdCoPhone", StringUtils.nvl(emergency.getPatientPhone(), ""));
         params.put("ServiceOrdCoTies", ""); // 鑱旂郴浜轰笌鎮h�呭叧绯�
-
+//ServiceOrdTraVia
         // 鎮h�呬俊鎭�
         params.put("ServiceOrdPtName", StringUtils.nvl(emergency.getPatientName(), ""));
         params.put("ServiceOrdPtAge", ""); // 骞撮緞
@@ -196,14 +200,14 @@
         params.put("ServiceOrdTraStreetCoo", ""); // 鍑哄彂鍦板潗鏍�
         params.put("ServiceOrdTraEnd", StringUtils.nvl(task.getDestinationAddress(), StringUtils.nvl(emergency.getHospitalInAddress(), "")));
         params.put("ServiceOrdTraEndCoo", ""); // 鐩殑鍦板潗鏍�
-        params.put("ServiceOrdTraVia", ""); // 閫旂粡鍦�
+        params.put("ServiceOrdTraVia", emergency.getHospitalOutAddress()!=null ? emergency.getHospitalOutAddress() : ""); // 閫旂粡鍦�
 
         // 璺濈鍜屼环鏍间俊鎭�
         params.put("ServiceOrdViaDistance", "0"); // 涓�旇窛绂�
         params.put("ServiceOrdTraDistance", emergency.getTransferDistance() != null ? emergency.getTransferDistance().toString() : "0");
         params.put("ServiceOrdTraDuration", ""); // 棰勮琛岀▼鏃堕棿
         params.put("ServiceOrdTraUnitPrice", "0"); // 鍗曚环/鍏噷
-        params.put("ServiceOrdTraOfferPrice", emergency.getTransferPrice() != null ? emergency.getTransferPrice().toString() : "0");
+//        params.put("ServiceOrdTraOfferPrice", emergency.getTransferPrice() != null ? emergency.getTransferPrice().toString() : "0");
         params.put("ServiceOrdTraTxnPrice", emergency.getTransferPrice() != null ? emergency.getTransferPrice().toString() : "0");
         params.put("ServiceOrdTraPrePayment", "0"); // 闇�棰勪粯娆�
         params.put("SettlementPrice", "0"); // 缁撶畻浠�
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/utils/TaskStatusPushConverter.java b/ruoyi-system/src/main/java/com/ruoyi/system/utils/TaskStatusPushConverter.java
index 7e1fe24..8993dc6 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/utils/TaskStatusPushConverter.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/utils/TaskStatusPushConverter.java
@@ -13,7 +13,29 @@
 public class TaskStatusPushConverter {
     
     private static final Logger log = LoggerFactory.getLogger(TaskStatusPushConverter.class);
-    
+    /** 鏈嶅姟鍗曠姸鎬�
+     * 1	鍜ㄨ鍗�
+     * 2	鏈皟搴�
+     * 3	宸茶皟搴�
+     * 4	鍙栨秷鍗�
+     */
+    /**
+     * 1	1 - 瀹屽叏鏈‘璁�
+     * 2	2 - 閮ㄥ垎宸茬‘璁�
+     * 3	鏈嚭杞�
+     * 4	3 - 宸插嚭杞︼紙鍘绘帴鎮h�呴�斾腑锛�
+     * 5	宸插嚭杞︼紙绛夊緟鎮h�咃級
+     * 6	4 - 宸插嚭杞︼紙鏈嶅姟涓級
+     * 7	5 - 宸查�佽揪锛堝洖绋嬩腑锛�
+     * 8	宸茶繑鍥�
+     * 9	璺戠┖鍗曪紝宸茶繑鍥�
+     * 10	鍙栨秷
+     * 0	0 - 鏂拌皟搴﹀崟锛堟湭涓嬪彂锛�
+     * 11	宸叉彁浜わ紝绛夊緟瀹℃牳
+     * 12	瀹℃牳瀹屾垚
+     * 13	瀹℃牳涓嶉�氳繃
+     * 14	宸查┗鐐�
+     */
     /**
      * 灏嗘柊绯荤粺TaskStatus杞崲涓烘棫绯荤粺鐘舵�佺爜
      * 
@@ -37,8 +59,9 @@
                 return 8;
             case CANCELLED:      // 宸插彇娑�
                 return 10;
+            case ARRIVED:        // 宸插埌杈�
+                return 6;
             case PENDING:        // 寰呭鐞� - 涓嶅悓姝�
-            case ARRIVED:        // 宸插埌杈� - 涓嶅悓姝�
             default:
 //                log.debug("鏂扮郴缁熺姸鎬佷笉闇�瑕佸悓姝ュ埌鏃х郴缁�: {}", taskStatus.getInfo());
                 return null;
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml
index 3206401..4fe1ac6 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysTaskMapper.xml
@@ -344,4 +344,14 @@
             #{taskId}
         </foreach>
     </delete>
+    
+    <!-- 鏍规嵁鑱旂郴浜虹數璇濆拰鍒涘缓鏃ユ湡鏌ヨ浠诲姟鏁伴噺 -->
+    <select id="countTaskByPhoneAndDate" resultType="int">
+        select count(1)
+        from sys_task t
+        inner join sys_task_emergency e on t.task_id = e.task_id
+        where t.del_flag = '0'
+          and e.patient_phone = #{phone}
+          and DATE(t.create_time) = #{createDate}
+    </select>
 </mapper>

--
Gitblit v1.9.1