From 6037bae970a614ddd49867d9ae81846aec44f517 Mon Sep 17 00:00:00 2001 From: yys <47@gamerwa.com> Date: Tue, 7 Apr 2026 09:30:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E7=94=9F=E6=88=90?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=BB=BB=E5=8A=A1=E7=9A=84=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E7=8A=B6=E6=80=81=EF=BC=8C=E5=9C=A8=E4=B8=8D=E5=8A=A8=E7=8E=B0?= =?UTF-8?q?=E6=9C=89=E9=80=BB=E8=BE=91=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B?= =?UTF-8?q?=E8=83=BD=E6=98=BE=E7=A4=BA=E9=98=9F=E5=88=97=E4=B8=AD=E3=80=81?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E4=B8=AD=E3=80=82=E5=B9=B6=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=88=9A=E7=94=9F=E6=88=90=E5=B0=B1=E6=98=BE=E7=A4=BA=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- portal-ui/src/views/VideoGen.vue | 20 ++++++++++++-- .../java/com/ruoyi/api/ByteApiController.java | 26 +++++++++++++++++-- .../java/com/ruoyi/ai/domain/AiOrder.java | 3 +++ .../resources/mapper/system/AiOrderMapper.xml | 2 +- 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/portal-ui/src/views/VideoGen.vue b/portal-ui/src/views/VideoGen.vue index a480a2d..7d4b582 100644 --- a/portal-ui/src/views/VideoGen.vue +++ b/portal-ui/src/views/VideoGen.vue @@ -599,14 +599,30 @@ export default { taskStatusText(row) { const st = row?.status if (st === 2 || st === '2') return '已失败/已取消' - if (st === 0 || st === '0') return '执行中' + if (st === 0 || st === '0') { + const extStatus = row?.extStatus + if (extStatus === 0) { + return '队列中' + } + return '执行中' + } if (st === 1 || st === '1') { const r = this.taskRowResultTrim(row) if (!r) return '失败' - if (this.isHttpOrHttpsUrl(r)) return '已完成' + if (this.isHttpOrHttpsUrl(r)) { + return '已完成' + } // 任务 id 格式由火山侧决定,不再假定 cgt 前缀;非 URL 的中间态均视为执行中 + const extStatus = row?.extStatus + if (extStatus === 0) { + return '队列中' + } return '任务执行中' } + const extStatus = row?.extStatus + if (extStatus === 0) { + return '队列中' + } return '执行中' }, diff --git a/web-api/ruoyi-admin/src/main/java/com/ruoyi/api/ByteApiController.java b/web-api/ruoyi-admin/src/main/java/com/ruoyi/api/ByteApiController.java index 75fe98a..7871511 100644 --- a/web-api/ruoyi-admin/src/main/java/com/ruoyi/api/ByteApiController.java +++ b/web-api/ruoyi-admin/src/main/java/com/ruoyi/api/ByteApiController.java @@ -343,8 +343,30 @@ public class ByteApiController extends BaseController { boolean codeError = code != null && code != 200; String st = byteBodyRes.getStatus(); - if ("running".equals(st) && !codeError) { - return AjaxResult.success("callback success"); + if (st != null && !st.isEmpty()) { + // 执行中状态 + Integer extStatus = null; + if ("queued".equals(st)) { + extStatus = 0; + } else if ("running".equals(st)) { + extStatus = 1; + } + if (extStatus != null) { + AiOrder order = findAiOrderByVolcTaskId(id); + if (order == null) { + logger.warn("volcCallback 修改执行中状态,未找到任务对应订单, id={}, {}", id, st); + return AjaxResult.success("callback success"); + } +// if (order.getStatus() != 0) { +// logger.warn("订单状态不为0, 因此不修改ext_status, id = {}, status = {}, order status = {}", id, st, order.getStatus()); +// return AjaxResult.success("callback success"); +// } + AiOrder upd = new AiOrder(); + upd.setId(order.getId()); + upd.setExtStatus(extStatus); + aiOrderService.updateAiOrder(upd); + return AjaxResult.success("callback success"); + } } if (codeError) { diff --git a/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/domain/AiOrder.java b/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/domain/AiOrder.java index 3938055..7fec8e0 100644 --- a/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/domain/AiOrder.java +++ b/web-api/ruoyi-system/src/main/java/com/ruoyi/ai/domain/AiOrder.java @@ -64,6 +64,9 @@ public class AiOrder extends BaseEntity { @Excel(name = "状态:0-进行中 1-已完成 2-失败", readConverterExp = "余=额退回") private Integer status; + @Excel(name = "扩展状态:0-队列中 1-执行中") + private Integer extStatus; + /** 是否置顶:N-否 Y-是 */ @Excel(name = "是否置顶:N-否 Y-是") private String isTop; diff --git a/web-api/ruoyi-system/src/main/resources/mapper/system/AiOrderMapper.xml b/web-api/ruoyi-system/src/main/resources/mapper/system/AiOrderMapper.xml index 1951a01..293cf2e 100644 --- a/web-api/ruoyi-system/src/main/resources/mapper/system/AiOrderMapper.xml +++ b/web-api/ruoyi-system/src/main/resources/mapper/system/AiOrderMapper.xml @@ -32,7 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.user_id, ao.type, ao.amount, ao.result, ao.status, ao.source, ao.text, ao.is_top, ao.img1, ao.img2, ao.mode, ao.duration, ao.resolution, ao.ratio, ao.model, ao.video_params, au.user_id uuid from ai_order ao + select ao.id, ao.del_flag, ao.create_by, ao.create_time, ao.update_by, ao.update_time, ao.remark, ao.order_num, ao.user_id, ao.type, ao.amount, ao.result, ao.status, ao.source, ao.text, ao.is_top, ao.img1, ao.img2, ao.mode, ao.duration, ao.resolution, ao.ratio, ao.model, ao.video_params, au.user_id uuid, ao.ext_status from ai_order ao left join ai_user au on au.id = ao.user_id