Эх сурвалжийг харах

411 市州通用-新增【附件列表】等功能

田爽 1 сар өмнө
parent
commit
5a1a3e717d

+ 45 - 12
src/Hotline.Api/Controllers/OrderController.cs

@@ -5609,12 +5609,6 @@ public class OrderController : BaseController
 				var ids = order.FileJson.Select(x => x.Id).ToList();
 				allFiles = await _fileRepository.GetFilesAsync(ids, cancellationToken: HttpContext.RequestAborted);
 			}
-            if (order.ListFileJson!= null)
-            {
-				var listIds = order.ListFileJson.Select(x => x.Id).ToList();
-				var listFiles = await _fileRepository.GetFilesAsync(listIds, cancellationToken: HttpContext.RequestAborted);
-				allFiles.AddRange(listFiles);
-			}
 		}
 		foreach (var step in steps)
 		{
@@ -5630,21 +5624,60 @@ public class OrderController : BaseController
 	}
 
 	/// <summary>
-	/// 新增附件 Classify ="附件列表上传"
+	/// 获取流程信息
+	/// </summary>
+	/// <param name="workflowId"></param>
+	/// <returns></returns>
+	[HttpGet("all_file/workflow/{id}")]
+	public async Task<WorkflowDto> GetOrderWorkflowAsync(string workflowId)
+	{
+		var workflow = await _workflowDomainService.GetWorkflowAsync(workflowId, withSteps: false,
+			cancellationToken: HttpContext.RequestAborted);
+        var steps = _mapper.Map<List<WorkflowTraceDto>>(workflow.Steps);
+		var workflowDto = _mapper.Map<WorkflowDto>(workflow);
+        workflowDto.Traces = steps;
+		foreach (var item in workflowDto.Traces)
+        {
+            if (item.FileJson != null)
+            {
+				var ids = item.FileJson.Select(x => x.Id).ToList();
+				item.Files = await _fileRepository.GetFilesAsync(ids, HttpContext.RequestAborted);
+			}
+		}
+        return workflowDto;
+	}
+
+	/// <summary>
+	/// 附件列表补充附件
 	/// </summary>
 	/// <param name="dtos"></param>
 	/// <returns></returns>
 	[HttpPost("list/file_upload")]
-	[LogFilter("附件列表新增附件")]
+	[LogFilter("附件列表补充附件")]
 
-	public async Task Add([FromBody] OrderListUploadFilesDto dto)
+	public async Task Add([FromBody] OrderStepUploadFilesDto dto)
 	{
-        var listFileJson = new List<FileJson>();
+		var order = await _orderRepository.GetAsync(dto.OrderId);
+		var step = await _workflowStepRepository.GetAsync(dto.StepId);
+
+		var listFileJson = new List<FileJson>();
 		if (dto.Files.Any())
         {
-             listFileJson = await _fileRepository.AddFileAsync(dto.Files, dto.OrderId, "", HttpContext.RequestAborted);
+             listFileJson = await _fileRepository.AddFileAsync(dto.Files, dto.StepId, "", HttpContext.RequestAborted);
 		}
-		await _orderRepository.Updateable().SetColumns(x => new Order { ListFileJson = listFileJson }).Where(x => x.Id == dto.OrderId).ExecuteCommandAsync(HttpContext.RequestAborted);
+		await _workflowStepRepository.Updateable().SetColumns(x => new WorkflowStep { FileJson = listFileJson }).Where(x => x.Id == dto.StepId).ExecuteCommandAsync(HttpContext.RequestAborted);
+		await _workflowTraceRepository.Updateable().SetColumns(x => new WorkflowTrace { FileJson = listFileJson }).Where(x => x.Id == dto.StepId).ExecuteCommandAsync(HttpContext.RequestAborted);
+
+        ////附件上传后推送省上
+		var orderDto = _mapper.Map<OrderDto>(order);
+		var flowDto = new OrderFlowDto
+		{
+			Order = orderDto,
+			WorkflowTrace = _mapper.Map<WorkflowTraceDto>(step),
+			ExpiredTimeChanged = false,
+			HandlerOrgLevel = step.HandlerOrgId.CalcOrgLevel()
+		};
+		await _capPublisher.PublishAsync(Hotline.Share.Mq.EventNames.HotlineOrderFlowFile, flowDto, cancellationToken: HttpContext.RequestAborted);
 	}
 
 	#endregion

+ 2 - 1
src/Hotline.Share/Dtos/Order/OrderDto.cs

@@ -1837,9 +1837,10 @@ namespace Hotline.Share.Dtos.Order
         public string? SensitiveText => (Sensitive != null && Sensitive.Any()) ? string.Join(',', Sensitive) : "";
     }
 
-    public class OrderListUploadFilesDto
+    public class OrderStepUploadFilesDto
 	{
 		public string OrderId { get; set; }
+		public string StepId { get; set; }
 		public List<FileDto> Files { get; set; } = new();
 	}
 }

+ 9 - 4
src/Hotline.Share/Mq/EventNames.Order.cs

@@ -20,10 +20,15 @@ namespace Hotline.Share.Mq
         /// </summary>
         public const string HotlineOrderFlowHandled = "hotline.order.flow.handled";
 
-        /// <summary>
-        /// 撤回
-        /// </summary>
-        public const string HotlineOrderFlowRecalled = "hotline.order.flow.recalled";
+		/// <summary>
+		/// 补传附件
+		/// </summary>
+		public const string HotlineOrderFlowFile = "hotline.order.flow.file";
+
+		/// <summary>
+		/// 撤回
+		/// </summary>
+		public const string HotlineOrderFlowRecalled = "hotline.order.flow.recalled";
 
         /// <summary>
         /// 退回

+ 2 - 2
src/Hotline/Orders/Order.cs

@@ -910,8 +910,8 @@ namespace Hotline.Orders
         [SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true, ColumnDescription = "附件JSON")]
         public List<FileJson>? FileJson { get; set; }
 
-		[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true, ColumnDescription = "附件列表附件JSON")]
-		public List<FileJson>? ListFileJson { get; set; }
+		//[SugarColumn(ColumnDataType = "json", IsJson = true, IsNullable = true, ColumnDescription = "附件列表附件JSON")]
+		//public List<FileJson>? ListFileJson { get; set; }
 
 		#endregion