From a2c9831a0ab7dbf6cbb4cfd2bfe1d03be8c3d24e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Tue, 26 Nov 2024 15:57:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E9=87=8D=E8=AF=95?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Pages/EvaluationProject.razor | 2 +- .../Components/Pages/VideoTaskPage.razor | 56 +++++++++++++------ .../Components/Pages/VideoTaskPage.razor.cs | 52 ++++++++++++----- VideoAnalysis/Controllers/Dto/ApiDto.cs | 3 +- 4 files changed, 79 insertions(+), 34 deletions(-) diff --git a/VideoAnalysis/Components/Pages/EvaluationProject.razor b/VideoAnalysis/Components/Pages/EvaluationProject.razor index e9a99cb..e40e629 100644 --- a/VideoAnalysis/Components/Pages/EvaluationProject.razor +++ b/VideoAnalysis/Components/Pages/EvaluationProject.razor @@ -5,7 +5,7 @@ @using SqlSugar @using VideoAnalysisCore.Model - +
diff --git a/VideoAnalysis/Components/Pages/VideoTaskPage.razor b/VideoAnalysis/Components/Pages/VideoTaskPage.razor index fc4f140..eb213f0 100644 --- a/VideoAnalysis/Components/Pages/VideoTaskPage.razor +++ b/VideoAnalysis/Components/Pages/VideoTaskPage.razor @@ -2,12 +2,13 @@ @using AntDesign @using AntDesign.TableModels @using System.ComponentModel.DataAnnotations +@using Learn.VideoAnalysis.Controllers.Dto @using SqlSugar @using VideoAnalysisCore.Model @using VideoAnalysisCore.Model.Dto @using VideoAnalysisCore.Enum -
@@ -16,16 +17,16 @@ - - - - - - - + + + + + + + - + @@ -38,7 +39,7 @@ OnClick="()=>RowRestart(rowData)"> 刷新数据 - @@ -46,26 +47,26 @@ + Description="@RowST(rowData,RedisChannelEnum.DownloadFile)" /> + Description="@RowST(rowData,RedisChannelEnum.SeparateAudio)" /> + Description="@RowST(rowData,RedisChannelEnum.ParsingCaptions)" /> + Description="@RowST(rowData,RedisChannelEnum.ParsingSpeaker)" /> + Description="@RowST(rowData,RedisChannelEnum.ChatModelAnalysis)" /> + Description="@RowST(rowData,RedisChannelEnum.EndTask)" /> - @if (!string.IsNullOrEmpty( @rowData.Data.ErrorMessage)) + @if (!string.IsNullOrEmpty(@rowData.Data.ErrorMessage)) { @rowData.Data.ErrorMessage @@ -73,6 +74,25 @@ } - +
+ + + + ID : @reStartTask.Id +

+

将从哪个步骤重试?

+ + +
+
+
diff --git a/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs b/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs index af79c30..ab23777 100644 --- a/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs +++ b/VideoAnalysis/Components/Pages/VideoTaskPage.razor.cs @@ -1,6 +1,7 @@ using AntDesign; using AntDesign.TableModels; using FFmpeg.NET.Services; +using Learn.VideoAnalysis.Controllers.Dto; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.DataProtection.KeyManagement; @@ -28,19 +29,41 @@ namespace Learn.VideoAnalysis.Components.Pages List _dataSource = null; RefAsync _total = 0; + bool modalShow = false; + bool tableLoading = false; private VideoTaskDto selectData; - private bool rowRestartLoading=false; + private bool rowRestartLoading = false; + private VideoTaskDto reStartTask ; + TextValue[] SelectDataSource = Enum.GetValues(typeof(RedisChannelEnum)) + .Cast() + .Select(s => new TextValue(s.ToString(), (int)s)) + .ToArray(); + int selectEnum = 1; + int selectDefaultValue =1; + + /// + /// 点击重试 + /// + /// + async void ReStartClick(VideoTaskDto query) + { + selectDefaultValue = + (await RedisExpand.Redis.HMGetAsync(RedisExpandKey.Task(query.Id), "LastEnum")).FirstOrDefault(); + selectEnum = selectDefaultValue; + reStartTask = query; + modalShow = true; + } /// /// 重试 /// /// - async void ReStart(VideoTaskDto query) + async void ReStart() { - var lastEnum = (await RedisExpand.Redis.HMGetAsync(RedisExpandKey.Task(query.Id), "LastEnum")).FirstOrDefault() ; - await RedisExpand.SetTaskErrorMessage(query.Id, null); - RedisExpand.InsertChannel(lastEnum, query.Id); + await RedisExpand.SetTaskErrorMessage(reStartTask.Id, null); + RedisExpand.InsertChannel((RedisChannelEnum)selectEnum, reStartTask.Id); + modalShow = false; } private QueryModel lastQuery = null; /// @@ -51,7 +74,7 @@ namespace Learn.VideoAnalysis.Components.Pages async void ShowErrorTask(MouseEventArgs e) { _dataSource = await taskDB.AsQueryable() - .Where(s=>s.ErrorMessage != null &&s.ErrorMessage!=string.Empty) + .Where(s => s.ErrorMessage != null && s.ErrorMessage != string.Empty) .Select() .ToListAsync(); _total = _dataSource.Count(); @@ -66,7 +89,7 @@ namespace Learn.VideoAnalysis.Components.Pages /// async void OnChange(QueryModel query) { - lastQuery= query; + lastQuery = query; tableLoading = true; List where = default!; if (query.FilterModel != null && ((query.FilterModel?.Count() ?? 0) > 0)) @@ -76,13 +99,14 @@ namespace Learn.VideoAnalysis.Components.Pages _dataSource = await taskDB.AsQueryable() .Where(where) .Select() + .OrderByDescending(s => s.Id) .ToPageListAsync(query.PageIndex - 1, query.PageSize, _total); tableLoading = false; StateHasChanged(); } - public void RowRestart(RowData rowData) + public void RowRestart(RowData rowData) { rowRestartLoading = true; var item = rowData.Data; @@ -101,7 +125,7 @@ namespace Learn.VideoAnalysis.Components.Pages /// /// /// - private string RowST(RowData rowData, RedisChannelEnum e) + private string RowST(RowData rowData, RedisChannelEnum e) { var dic = rowData.Data.StartTimeDic; if (dic is null || !dic.ContainsKey(e)) @@ -113,20 +137,20 @@ namespace Learn.VideoAnalysis.Components.Pages var dic = rowData.Data.StartTimeDic; if (dic is null) return "wait"; - if(!string.IsNullOrEmpty(rowData.Data.ErrorMessage)) + if (!string.IsNullOrEmpty(rowData.Data.ErrorMessage)) return "error"; - if(dic.ContainsKey(RedisChannelEnum.EndTask)) + if (dic.ContainsKey(RedisChannelEnum.EndTask)) return "finish"; return "wait"; } - private int RowSTIndex(RowData rowData) + private int RowSTIndex(RowData rowData) { var dic = rowData.Data.StartTimeDic; - if (dic is null ) + if (dic is null) return 0; return (int)dic.LastOrDefault().Key; } - private void OnExpand(RowData rowData) + private void OnExpand(RowData rowData) { RowRestart(rowData); } diff --git a/VideoAnalysis/Controllers/Dto/ApiDto.cs b/VideoAnalysis/Controllers/Dto/ApiDto.cs index 4994651..cd40a88 100644 --- a/VideoAnalysis/Controllers/Dto/ApiDto.cs +++ b/VideoAnalysis/Controllers/Dto/ApiDto.cs @@ -49,7 +49,8 @@ namespace Learn.VideoAnalysis.Controllers.Dto } public TextValue(string t,object v) { - + Text = t; + Value = v; } public TextValue() {