wzp
2025-05-04 938d93722b6ebaf8953e1e17307ef7739affc3d0
feat: 回调地址可配置、回调接口文档和知情同意
1个文件已添加
10个文件已修改
195 ■■■■ 已修改文件
doc/订单状态回调接口文档.docx 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/ServiceOrderController.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java 78 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/domain/SysClientApp.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/DispatchOrdMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/IDispatchOrdService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/DispatchOrdServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/DispatchOrdMapper.xml 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysClientAppMapper.xml 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/views/system/clientApp/index.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-ui/src/views/system/order/detail.vue 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
doc/¶©µ¥×´Ì¬»Øµ÷½Ó¿ÚÎĵµ.docx
Binary files differ
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()); //正式使用
        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());  //正式使用
        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");
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;
        }
    }
}
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)
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);
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);
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);
    }
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> 
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>
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="民航分公司Id" 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="民航分公司Id" 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>
</script>
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>