From 938d93722b6ebaf8953e1e17307ef7739affc3d0 Mon Sep 17 00:00:00 2001
From: wzp <2040239371@qq.com>
Date: 星期日, 04 五月 2025 16:21:11 +0800
Subject: [PATCH] feat: 回调地址可配置、回调接口文档和知情同意

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/IDispatchOrdService.java          |    8 ++
 ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java                          |   78 +++++++++++++------
 ruoyi-system/src/main/java/com/ruoyi/system/domain/SysClientApp.java                  |   13 +++
 ruoyi-system/src/main/resources/mapper/system/DispatchOrdMapper.xml                   |   10 ++
 ruoyi-system/src/main/resources/mapper/system/SysClientAppMapper.xml                  |    6 +
 ruoyi-ui/src/views/system/clientApp/index.vue                                         |   14 ++
 ruoyi-ui/src/views/system/order/detail.vue                                            |   31 ++++++-
 doc/订单状态回调接口文档.docx                                                                   |    0 
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ServiceOrderController.java |   14 ++-
 ruoyi-system/src/main/java/com/ruoyi/system/mapper/DispatchOrdMapper.java             |    8 ++
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DispatchOrdServiceImpl.java  |   13 +++
 11 files changed, 159 insertions(+), 36 deletions(-)

diff --git "a/doc/\350\256\242\345\215\225\347\212\266\346\200\201\345\233\236\350\260\203\346\216\245\345\217\243\346\226\207\346\241\243.docx" "b/doc/\350\256\242\345\215\225\347\212\266\346\200\201\345\233\236\350\260\203\346\216\245\345\217\243\346\226\207\346\241\243.docx"
new file mode 100644
index 0000000..6e3f130
--- /dev/null
+++ "b/doc/\350\256\242\345\215\225\347\212\266\346\200\201\345\233\236\350\260\203\346\216\245\345\217\243\346\226\207\346\241\243.docx"
Binary files differ
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ServiceOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ServiceOrderController.java
index 2e805b7..cddada2 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ServiceOrderController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ServiceOrderController.java
@@ -46,7 +46,6 @@
  */
 @RestController
 @RequestMapping("/system/order")
-//@DataSource(DataSourceType.SQLSERVER)
 public class ServiceOrderController extends BaseController {
     @Autowired
     private IServiceOrderService serviceOrderService;
@@ -262,13 +261,20 @@
 
 
         //鏀粯淇℃伅
-//        List<PayInfo> payInfoList = payInfoService.selectPayInfoByServiceOrdIDDt(orderDetail.getServiceOrdID()); //1016302788
-        List<PayInfo> payInfoList = payInfoService.selectPayInfoByServiceOrdIDDt("1016302788");
+//        List<PayInfo> payInfoList = payInfoService.selectPayInfoByServiceOrdIDDt(orderDetail.getServiceOrdID()); //姝e紡浣跨敤
+        List<PayInfo> payInfoList = payInfoService.selectPayInfoByServiceOrdIDDt("1016302788");//娴嬭瘯浣跨敤
 
         //鍏朵粬淇℃伅
         Map<String, Object> otherInfo = new HashMap<>();
         //璇勪环
-        otherInfo.put("serviceOrdVisit", Objects.toString(mingServiceOrder.getServiceOrdVisit(), "鏃�"));
+        otherInfo.put("serviceOrdVisit", Objects.toString(mingServiceOrder.getServiceOrdVisit(), "-"));
+
+        //鐭ユ儏鍚屾剰涔�
+        // List<String> imageUrls = dispatchOrdService.selectImageUrlsByDOrdIDDt(orderDetail.getServiceOrdID());  //姝e紡浣跨敤
+        List<String> imageUrls = new ArrayList<>();//娴嬭瘯浣跨敤
+        imageUrls.add("https://sys.966120.com.cn/upload/202505/3016127678_3VhEv_VVql2K6eM9tS9uXgKv8fm7vaKtrSFCiP0SraTgz2qe1isgvIuUrqSNv-XgEvdC5kFUxeyrn_wz8Mfc2Sg.jpg");
+        imageUrls.add("https://sys.966120.com.cn/upload/202505/3016127678_3cDOPpqc_fzEJ-dHz8lq5aIx3tsnmEtossC6F5VCi2vj6sBwkuzOx4g1RcsWnQ3XNua7COADksYI1rHnbizccOw.jpg");
+        otherInfo.put("imageUrls", imageUrls);
 
         //鍙戠エ鑾峰彇
         Map<String, Object> invoiceInfo = payInfoService.selectLatestInvoiceInfo("1016302788");
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
index 6fdb634..10363e2 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -1,12 +1,10 @@
 package com.ruoyi.quartz.task;
 
 import com.ruoyi.common.utils.HttpUtil;
-import com.ruoyi.system.domain.AOrderStatus;
-import com.ruoyi.system.domain.DispatchOrd;
-import com.ruoyi.system.domain.OrderStatusCallBackVo;
-import com.ruoyi.system.domain.TbOrders;
+import com.ruoyi.system.domain.*;
 import com.ruoyi.system.service.IAOrderStatusService;
 import com.ruoyi.system.service.IDispatchOrdService;
+import com.ruoyi.system.service.ISysClientAppService;
 import com.ruoyi.system.service.ITbOrdersService;
 import com.ruoyi.system.service.impl.SysUserServiceImpl;
 import org.slf4j.Logger;
@@ -37,6 +35,9 @@
     @Autowired
     private IDispatchOrdService dispatchOrdService;
 
+    @Autowired
+    private ISysClientAppService sysClientAppService;
+
     public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
     {
         System.out.println(StringUtils.format("鎵ц澶氬弬鏂规硶锛� 瀛楃涓茬被鍨媨}锛屽竷灏旂被鍨媨}锛岄暱鏁村瀷{}锛屾诞鐐瑰瀷{}锛屾暣褰}", s, b, l, d, i));
@@ -52,6 +53,9 @@
         System.out.println("鎵ц鏃犲弬鏂规硶");
     }
 
+    /**
+     * 鍥炶皟鎺ㄩ�佺姸鎬�
+     */
     public void ryOrderStatus() {
         try {
             List<AOrderStatus> orderStatusList = orderStatusService.selectAOrderStatusList();
@@ -62,7 +66,6 @@
             for (AOrderStatus orderStatus : orderStatusList) {
                 int count = tbOrdersService.checkServiceOrdIDExists(orderStatus.getServiceOrdID());
                 if (count > 0) {
-                    // orderStatusService.updateAOrderStatusFlag(orderStatus.getId());
                     System.out.println("鏈嶅姟璁㈠崟ID瀛樺湪锛�" + orderStatus.getServiceOrdID());
 
                     TbOrders tbOrders = tbOrdersService.selectTbOrdersByServiceOrdID(orderStatus.getServiceOrdID());
@@ -108,10 +111,13 @@
                         log.error("鑾峰彇璋冨害鍗曞紓甯革細"+e.getMessage());
                     }
 
+                    SysClientApp clientApp = sysClientAppService.selectSysClientAppByAppId(1L);
+                    if(clientApp==null){
+                        log.error("鍥炶皟鍦板潃涓嶅瓨鍦�");
+                        return;
+                    }
 
-
-                    // 浣跨敤鑾峰彇鍒扮殑鎵�鏈夊徃鏈哄鍚�
-                    String callbackUrl = "http://localhost:8080/system/apitest/orderCallback";
+                    String callbackUrl = clientApp.getCallbackUrl();
                     try {
                         // 鏋勫缓璇锋眰鍙傛暟
                         Map<String, String> map = new HashMap<>();
@@ -123,25 +129,29 @@
                         map.put("driverMobile",driverMobiles.toString());
                         map.put("driverName", driverNames.toString());
 
-                        // 鎵撳嵃璇锋眰鍙傛暟
-                        log.info("鍙戦�佸洖璋冭姹傦紝URL: " + callbackUrl);
-                        log.info("璇锋眰鍙傛暟: " + map);
-
-                        // 鍙戦�佽姹傚苟鑾峰彇鍝嶅簲
-                        String response = HttpUtil.post(callbackUrl, map);
-
-                        // 鎵撳嵃鍝嶅簲缁撴灉
-                        log.info("鍥炶皟鍝嶅簲缁撴灉: " + response);
-
-                        // 鏇存柊鐘舵��
-                        // orderStatusService.updateAOrderStatusFlag(orderStatus.getId());
+                        // 绗竴娆″皾璇�
+                        String response = sendCallback(callbackUrl, map);
+                        
+                        if (response == null) {
+                            // 濡傛灉绗竴娆″け璐ワ紝绛夊緟3绉掑悗閲嶈瘯
+                            Thread.sleep(3000);
+                            log.info("绗竴娆″洖璋冨け璐ワ紝鍑嗗閲嶈瘯");
+                            response = sendCallback(callbackUrl, map);
+                        }
+                        
+                        if (response != null) {
+                            // 鏇存柊鐘舵��
+                            log.info("鍥炶皟鎺ㄩ�佹垚鍔燂紝鍙傛暟濡備笅锛�");
+                            map.forEach((key, value) -> log.info("    {} : {}", key, value));
+                            orderStatusService.updateAOrderStatusFlag(orderStatus.getId());
+                        } else {
+                            log.error("鍥炶皟璇锋眰閲嶈瘯鍚庝粛鐒跺け璐�");
+                            orderStatusService.updateAOrderStatusFlag(orderStatus.getId());
+                        }
                     } catch (Exception e) {
                         log.error("鍥炶皟璇锋眰澶辫触: " + e.getMessage());
-                        // 鍙互鑰冭檻閲嶈瘯鏈哄埗鎴栬�呰褰曞け璐ユ棩蹇�
+                        orderStatusService.updateAOrderStatusFlag(orderStatus.getId());
                     }
-
-
-
                 }
                 else {
                     log.info("鏈嶅姟璁㈠崟ID涓嶅瓨鍦細" + orderStatus.getServiceOrdID());
@@ -153,4 +163,24 @@
             e.printStackTrace();
         }
     }
+
+    // 鏂板鍙戦�佸洖璋冪殑鏂规硶
+    private String sendCallback(String callbackUrl, Map<String, String> params) {
+        try {
+            // 鎵撳嵃璇锋眰鍙傛暟
+            log.info("鍙戦�佸洖璋冭姹傦紝URL: " + callbackUrl);
+            log.info("璇锋眰鍙傛暟: " + params);
+
+            // 鍙戦�佽姹傚苟鑾峰彇鍝嶅簲
+            String response = HttpUtil.post(callbackUrl, params);
+
+            // 鎵撳嵃鍝嶅簲缁撴灉
+            log.info("鍥炶皟鍝嶅簲缁撴灉: " + response);
+            
+            return response;
+        } catch (Exception e) {
+            log.error("鍥炶皟璇锋眰寮傚父: " + e.getMessage());
+            return null;
+        }
+    }
 }
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysClientApp.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysClientApp.java
index 0230ec5..78c4a8e 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysClientApp.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysClientApp.java
@@ -52,6 +52,11 @@
     private String minAppId;
 
 
+    /** 鍥炶皟鍦板潃 */
+    @Excel(name = "鍥炶皟鍦板潃")
+    private String callbackUrl;
+
+
 
     public Long getAppId() {
         return appId;
@@ -125,6 +130,14 @@
         this.minAppId = minAppId;
     }
 
+    public String getCallbackUrl() {
+        return callbackUrl;
+    }
+
+    public void setCallbackUrl(String callbackUrl) {
+        this.callbackUrl = callbackUrl;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/DispatchOrdMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/DispatchOrdMapper.java
index a83219b..4b76078 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/DispatchOrdMapper.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/DispatchOrdMapper.java
@@ -51,4 +51,12 @@
      * @return 鍙告満鎵嬫満鍙�
      */
     public String selectDriverMobileByName(String driverName);
+
+    /**
+     * 鏍规嵁娲惧伐鍗曞彿鏌ヨ鍥剧墖URL鍒楄〃
+     * 
+     * @param dOrdIDDt 娲惧伐鍗曞彿
+     * @return 鍥剧墖URL鍒楄〃
+     */
+    public List<String> selectImageUrlsByDOrdIDDt(String dOrdIDDt);
 } 
\ No newline at end of file
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IDispatchOrdService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IDispatchOrdService.java
index 320adf0..c3ad290 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IDispatchOrdService.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IDispatchOrdService.java
@@ -50,4 +50,12 @@
      * @return 鍙告満鎵嬫満鍙�
      */
     public String selectDriverMobileByName(String driverName);
+
+    /**
+     * 鏍规嵁娲惧伐鍗曞彿鏌ヨ鍥剧墖URL鍒楄〃
+     * 
+     * @param dOrdIDDt 娲惧伐鍗曞彿 
+     * @return 鍥剧墖URL鍒楄〃  
+     */
+    public List<String> selectImageUrlsByDOrdIDDt(String dOrdIDDt);
 } 
\ No newline at end of file
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DispatchOrdServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DispatchOrdServiceImpl.java
index ce6ba50..d6eaf52 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DispatchOrdServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DispatchOrdServiceImpl.java
@@ -76,4 +76,17 @@
     public String selectDriverMobileByName(String driverName) {
         return dispatchOrdMapper.selectDriverMobileByName(driverName);
     }
+
+    /**
+     * 鏍规嵁娲惧伐鍗曞彿鏌ヨ鍥剧墖URL鍒楄〃
+     * 
+     * @param dOrdIDDt 娲惧伐鍗曞彿 
+     * @return 鍥剧墖URL鍒楄〃
+     */
+    @Override
+    public List<String> selectImageUrlsByDOrdIDDt(String dOrdIDDt) {
+        return dispatchOrdMapper.selectImageUrlsByDOrdIDDt(dOrdIDDt);
+    }
+        
+
 } 
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/DispatchOrdMapper.xml b/ruoyi-system/src/main/resources/mapper/system/DispatchOrdMapper.xml
index b9f198d..46e5853 100644
--- a/ruoyi-system/src/main/resources/mapper/system/DispatchOrdMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/DispatchOrdMapper.xml
@@ -73,4 +73,14 @@
         AND OA_Name = #{driverName}
     </select>
 
+    <!-- 鏍规嵁娲惧伐鍗曞彿鏌ヨ鍥剧墖URL鍒楄〃 -->
+    <select id="selectImageUrlsByDOrdIDDt" parameterType="String" resultType="String">
+        select ImageUrl 
+        from ImageData 
+        where DOrdIDDt = #{dOrdIDDt}
+        and ImageDel = 0 
+        and ImageType in (1,2)
+        order by UpImageTime desc
+    </select>
+
 </mapper> 
\ No newline at end of file
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysClientAppMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysClientAppMapper.xml
index 9f761e0..647484c 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysClientAppMapper.xml
+++ b/ruoyi-system/src/main/resources/mapper/system/SysClientAppMapper.xml
@@ -19,10 +19,11 @@
         <result property="updateTime"    column="update_time"    />
         <result property="remark"    column="remark"    />
         <result property="minAppId"    column="min_app_id"    />
+        <result property="callbackUrl"    column="callback_url"    />
     </resultMap>
 
     <sql id="selectSysClientAppVo">
-        select app_id, client_name, app_key, security_key, valid_start_time, valid_end_time, status, del_flag, create_by, create_time, update_by, update_time, remark, min_app_id from sys_client_app
+        select app_id, client_name, app_key, security_key, valid_start_time, valid_end_time, status, del_flag, create_by, create_time, update_by, update_time, remark, min_app_id, callback_url from sys_client_app
     </sql>
 
     <select id="selectSysClientAppList" parameterType="SysClientApp" resultMap="SysClientAppResult">
@@ -62,6 +63,7 @@
             <if test="updateTime != null">update_time,</if>
             <if test="remark != null">remark,</if>
             <if test="minAppId != null">min_app_id,</if>
+            <if test="callbackUrl != null">callback_url,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="clientName != null">#{clientName},</if>
@@ -77,6 +79,7 @@
             <if test="updateTime != null">#{updateTime},</if>
             <if test="remark != null">#{remark},</if>
             <if test="minAppId != null">#{minAppId},</if>
+            <if test="callbackUrl != null">#{callbackUrl},</if>
          </trim>
     </insert>
 
@@ -91,6 +94,7 @@
             <if test="status != null and status != ''">status = #{status},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="minAppId != null">min_app_id = #{minAppId},</if>
+            <if test="callbackUrl != null">callback_url = #{callbackUrl},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             update_time = sysdate()
         </set>
diff --git a/ruoyi-ui/src/views/system/clientApp/index.vue b/ruoyi-ui/src/views/system/clientApp/index.vue
index fbb651e..ee47357 100644
--- a/ruoyi-ui/src/views/system/clientApp/index.vue
+++ b/ruoyi-ui/src/views/system/clientApp/index.vue
@@ -102,6 +102,8 @@
           <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
         </template>
       </el-table-column>
+      <el-table-column label="姘戣埅鍒嗗叕鍙窱d" align="center" prop="minAppId" />
+      <el-table-column label="鍥炶皟鍦板潃" align="center" prop="callbackUrl" />
       <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -121,7 +123,7 @@
         </template>
       </el-table-column>
     </el-table>
-    
+
     <pagination
       v-show="total>0"
       :total="total"
@@ -161,6 +163,12 @@
               :label="dict.value"
             >{{dict.label}}</el-radio>
           </el-radio-group>
+        </el-form-item>
+        <el-form-item label="姘戣埅鍒嗗叕鍙窱d" prop="minAppId">
+          <el-input v-model="form.minAppId" placeholder="璇疯緭鍏ユ皯鑸垎鍏徃Id" />
+        </el-form-item>
+        <el-form-item label="鍥炶皟鍦板潃" prop="callbackUrl">
+          <el-input v-model="form.callbackUrl" placeholder="璇疯緭鍏ュ洖璋冨湴鍧�" />
         </el-form-item>
         <el-form-item label="澶囨敞" prop="remark">
           <el-input v-model="form.remark" type="textarea" placeholder="璇疯緭鍏ュ唴瀹�" />
@@ -316,7 +324,7 @@
           if (this.form.validEndTime) {
             this.form.validEndTime = this.parseTime(this.form.validEndTime, '{y}-{m}-{d} {h}:{i}:{s}');
           }
-          
+
           if (this.form.appId != null) {
             updateClientApp(this.form).then(response => {
               this.$modal.msgSuccess("淇敼鎴愬姛");
@@ -361,4 +369,4 @@
     }
   }
 };
-</script> 
\ No newline at end of file
+</script>
diff --git a/ruoyi-ui/src/views/system/order/detail.vue b/ruoyi-ui/src/views/system/order/detail.vue
index 12c64c6..faf6639 100644
--- a/ruoyi-ui/src/views/system/order/detail.vue
+++ b/ruoyi-ui/src/views/system/order/detail.vue
@@ -98,9 +98,9 @@
               :size="isMobile ? 'mini' : 'medium'"
               class="responsive-table">
               <el-table-column prop="id" label="鏀舵娴佹按" min-width="120" />
-              <el-table-column 
-                prop="paidMoneyTime" 
-                label="鏀舵鏃堕棿" 
+              <el-table-column
+                prop="paidMoneyTime"
+                label="鏀舵鏃堕棿"
                 min-width="140"
                 :formatter="(row, column, cellValue) => formatDateTime(cellValue)"
               />
@@ -112,7 +112,7 @@
         </el-col>
       </el-row>
 
-      
+
       <!-- 璁㈠崟鎯呭喌 -->
       <el-row :gutter="20">
         <!-- 璋冨害淇℃伅 -->
@@ -122,6 +122,18 @@
             <el-descriptions :column="isMobile ? 1 : 2" border>
               <el-descriptions-item label="鏈嶅姟璇勪环">{{ otherInfo.serviceOrdVisit }}</el-descriptions-item>
               <el-descriptions-item label="鍙戠エ鐘舵��">{{ otherInfo.invoiceStatus }}</el-descriptions-item>
+              <el-descriptions-item label="鐭ユ儏鍚屾剰涔�">
+                <div v-if="otherInfo.imageUrls && otherInfo.imageUrls.length > 0" class="image-container">
+                  <el-image
+                    v-for="image in otherInfo.imageUrls"
+                    :key="image"
+                    :src="image"
+                    :preview-src-list="otherInfo.imageUrls"
+                    class="preview-image"
+                  />
+                </div>
+                <span v-else>鏆傛棤鍥剧墖</span>
+              </el-descriptions-item>
             </el-descriptions>
           </el-card>
         </el-col>
@@ -225,4 +237,15 @@
   .el-descriptions-item { padding: 8px !important; }
   .el-descriptions-item__label { width: 100px !important; }
 }
+.image-container {
+  display: flex;
+  flex-wrap: wrap;
+  gap: 10px;
+}
+.preview-image {
+  width: 100px;
+  height: 100px;
+  object-fit: cover;
+  cursor: pointer;
+}
 </style>

--
Gitblit v1.9.1