feat 老档案号任务处理
This commit is contained in:
@@ -13,6 +13,8 @@ public class TaskDto
|
||||
public string Brand { get; set; }
|
||||
public string FuncStr { get; set; }
|
||||
public string UserNo { get; set; }
|
||||
|
||||
public string OldUserNo { get; set; }
|
||||
public string UserCode { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public string DepartmentNo { get; set; }
|
||||
|
||||
@@ -219,6 +219,43 @@ public class AssignmentService : IAssignmentService
|
||||
task.ModifiedTime = now;
|
||||
});
|
||||
|
||||
if (await _dbContext.Queryable<OldDeviceGainfoEntity>().Where(x => x.Status == OldDeviceGainfoEnumType.Wait).AnyAsync())
|
||||
{
|
||||
var dCodes = await _dbContext.Queryable<DeviceTaskEntity>()
|
||||
.LeftJoin<GainfoEntity>((x, ga) => x.UserNo == ga.No)
|
||||
.Where(x => taskIds.Contains(x.Id))
|
||||
.Where(x => x.Status == DeviceTaskStatusEnumType.Process)
|
||||
.Select((x, ga) => new
|
||||
{
|
||||
x.DeviceUniqueNo,
|
||||
ga.Code,
|
||||
ga.No
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
var oldDeviceGainfoWhere = LinqExpressionExtensions.False<OldDeviceGainfoEntity>();
|
||||
dCodes.ForEach(item => { oldDeviceGainfoWhere = oldDeviceGainfoWhere.Or(x => x.Code == item.Code && x.DeviceUniqueNo == item.DeviceUniqueNo); });
|
||||
var oldData = await _dbContext.Queryable<OldDeviceGainfoEntity>().Where(x => x.Status == OldDeviceGainfoEnumType.Wait)
|
||||
.Where(oldDeviceGainfoWhere)
|
||||
.ToListAsync();
|
||||
|
||||
oldData.ForEach(d =>
|
||||
{
|
||||
var task = deviceTasks.FirstOrDefault(x => x.UserNo == d.No && x.DeviceUniqueNo == d.DeviceUniqueNo);
|
||||
if (task != null)
|
||||
{
|
||||
d.Status = task.Status == DeviceTaskStatusEnumType.Success
|
||||
? OldDeviceGainfoEnumType.Deleted
|
||||
: OldDeviceGainfoEnumType.Error;
|
||||
|
||||
d.Remark = task.ResultMessage;
|
||||
}
|
||||
});
|
||||
|
||||
await _dbContext.UpdateAsync(oldData);
|
||||
}
|
||||
|
||||
|
||||
await _dbContext.UpdateAsync(deviceTasks);
|
||||
}
|
||||
|
||||
@@ -299,6 +336,19 @@ public class AssignmentService : IAssignmentService
|
||||
throw new VersionExceptions("version exceptions");
|
||||
}
|
||||
|
||||
var oldDeviceGainfoWhere = LinqExpressionExtensions.False<OldDeviceGainfoEntity>();
|
||||
page.Data.ForEach(item => { oldDeviceGainfoWhere = oldDeviceGainfoWhere.Or(x => x.Code == item.UserCode && x.DeviceUniqueNo == item.DeviceUniqueNo); });
|
||||
var oldData = await _dbContext.Queryable<OldDeviceGainfoEntity>().Where(x => x.Status == OldDeviceGainfoEnumType.Wait || x.Status == OldDeviceGainfoEnumType.Error)
|
||||
.Where(oldDeviceGainfoWhere)
|
||||
.ToListAsync();
|
||||
|
||||
page.Data.ForEach(item =>
|
||||
{
|
||||
var o = oldData.FirstOrDefault(x => x.Code == item.UserCode && x.DeviceUniqueNo == item.DeviceUniqueNo);
|
||||
if (o != null)
|
||||
item.OldUserNo = o.No;
|
||||
});
|
||||
|
||||
return page.Data;
|
||||
}, 5);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user