fix 批量更新任务状态
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
||||||
<PackageReference Include="Kurisu.AspNetCore" Version="0.5.0" />
|
<PackageReference Include="Kurisu.AspNetCore" Version="0.5.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.26" />
|
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="6.0.26" />
|
||||||
|
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
|||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ["Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj", "Src/Dlhis.ScheduledTask/"]
|
COPY ["Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj", "Src/Dlhis.ScheduledTask/"]
|
||||||
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
COPY ["Src/Dlhis.Entity/Dlhis.Entity.csproj", "Src/Dlhis.Entity/"]
|
||||||
|
COPY ["Src/Dlhis.User.Api/Dlhis.User.Api.csproj", "Src/Dlhis.User.Api/"]
|
||||||
RUN dotnet restore "Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj"
|
RUN dotnet restore "Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj"
|
||||||
COPY . .
|
COPY . .
|
||||||
WORKDIR "/src/Src/Dlhis.ScheduledTask"
|
WORKDIR "/src/Src/Dlhis.ScheduledTask"
|
||||||
|
|||||||
@@ -44,13 +44,14 @@ public class AssignmentsController : ControllerBase
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新任务状态
|
/// 更新任务状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="requests"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("taskstatus")]
|
[HttpPost("taskstatus")]
|
||||||
public async Task UpdateDeviceTaskStatusAsync(UpdateDeviceTaskStatusRequest request)
|
public async Task UpdateDeviceTaskStatusAsync(List<UpdateDeviceTaskStatusRequest> requests)
|
||||||
{
|
{
|
||||||
await _assignmentService.UpdateDeviceTaskStatusAsync(request);
|
await _assignmentService.UpdateDeviceTaskStatusAsync(requests);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取新人脸照片
|
/// 获取新人脸照片
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ public interface IAssignmentService : IScopeDependency
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新设备任务状态
|
/// 更新设备任务状态
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
/// <param name="requests"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task UpdateDeviceTaskStatusAsync(UpdateDeviceTaskStatusRequest request);
|
Task UpdateDeviceTaskStatusAsync(List<UpdateDeviceTaskStatusRequest> requests);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取新人脸照片
|
/// 获取新人脸照片
|
||||||
|
|||||||
@@ -188,10 +188,24 @@ public class AssignmentService : IAssignmentService
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task UpdateDeviceTaskStatusAsync(UpdateDeviceTaskStatusRequest request)
|
public async Task UpdateDeviceTaskStatusAsync(List<UpdateDeviceTaskStatusRequest> requests)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 5; i++)
|
foreach (var request in requests)
|
||||||
{
|
{
|
||||||
|
//for (int i = 0; i < 5; i++)
|
||||||
|
//{
|
||||||
|
|
||||||
|
|
||||||
|
// if (effect == 0)
|
||||||
|
// {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//throw new UserFriendlyException("操作失败,请重试");
|
||||||
|
|
||||||
var deviceTask = await _dbContext.Queryable<DeviceTaskEntity>().Where(x => x.Id == request.TaskId).SingleAsync();
|
var deviceTask = await _dbContext.Queryable<DeviceTaskEntity>().Where(x => x.Id == request.TaskId).SingleAsync();
|
||||||
deviceTask.ThrowIfNull("设备任务不存在");
|
deviceTask.ThrowIfNull("设备任务不存在");
|
||||||
(deviceTask.Status != DeviceTaskStatusEnumType.Process)
|
(deviceTask.Status != DeviceTaskStatusEnumType.Process)
|
||||||
@@ -206,16 +220,7 @@ public class AssignmentService : IAssignmentService
|
|||||||
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
.SetColumns(x => x.ModifiedTime == DateTime.Now)
|
||||||
.Where(x => x.Id == request.TaskId && x.Version == deviceTask.Version)
|
.Where(x => x.Id == request.TaskId && x.Version == deviceTask.Version)
|
||||||
.ExecuteCommandAsync();
|
.ExecuteCommandAsync();
|
||||||
|
|
||||||
if (effect == 0)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new UserFriendlyException("操作失败,请重试");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user