|
@@ -1,4 +1,7 @@
|
|
|
-namespace Hotline.BatchTask;
|
|
|
+using FluentValidation;
|
|
|
+using Hotline.Validators.BatchTask;
|
|
|
+
|
|
|
+namespace Hotline.BatchTask;
|
|
|
|
|
|
public class ApptaskDomainService : IApptaskDomainService
|
|
|
{
|
|
@@ -7,6 +10,15 @@ public class ApptaskDomainService : IApptaskDomainService
|
|
|
/// </summary>
|
|
|
public Task<string> AddAsync(Apptask apptask, CancellationToken cancellation)
|
|
|
{
|
|
|
+ var validator = new ApptaskValidator();
|
|
|
+ var result = validator.Validate(apptask);
|
|
|
+ if (!result.IsValid)
|
|
|
+ throw new ValidationException(result.Errors.FirstOrDefault()?.ErrorMessage);
|
|
|
+
|
|
|
+ if(string.IsNullOrEmpty(apptask.Name))
|
|
|
+ apptask.CreateName();
|
|
|
+
|
|
|
+
|
|
|
//todo 1.参数校验,
|
|
|
//2. 任务名称可选:依据任务类型生成 3.类型、次数上限由主表冗余到明细
|
|
|
throw new NotImplementedException();
|
|
@@ -16,7 +28,7 @@ public class ApptaskDomainService : IApptaskDomainService
|
|
|
/// 查询任务进度
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
- public Task<ApptaskProgress> QueryProgressAsync(string taskId, CancellationToken cancellation)
|
|
|
+ public Task<ApptaskProgress> GetProgressAsync(string taskId, CancellationToken cancellation)
|
|
|
{
|
|
|
throw new NotImplementedException();
|
|
|
}
|