fix 优化出差任务生成
This commit is contained in:
@@ -143,25 +143,31 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
}
|
||||
|
||||
|
||||
public async Task ResetPermissionsAsync(GainfoPermissionResetRequest request)
|
||||
public async Task ResetPermissionsAsync(string userNo, DeviceTaskEnumType type)
|
||||
{
|
||||
var gainfo = await _dbContext.Queryable<GainfoEntity>()
|
||||
.Where(x => x.No == request.UserNo)
|
||||
.Where(x => x.No == userNo)
|
||||
.SingleAsync();
|
||||
|
||||
if (gainfo == null && request.IsLeave)
|
||||
|
||||
var msg = gainfo == null ? "不存在职数据" : string.Empty;
|
||||
|
||||
//如果找不到就为离职人员
|
||||
if (gainfo == null)
|
||||
{
|
||||
gainfo = await _dbContext.Queryable<GainfoEntity>().AS("GainfoLeave")
|
||||
.Where(x => x.No == request.UserNo)
|
||||
.Where(x => x.No == userNo)
|
||||
.SingleAsync();
|
||||
|
||||
if (gainfo != null)
|
||||
{
|
||||
gainfo.Id = gainfo.IdentityUserId;
|
||||
}
|
||||
|
||||
msg += gainfo == null ? "并且不存在离职数据" : string.Empty;
|
||||
}
|
||||
|
||||
gainfo.ThrowIfNull("档案数据不存在");
|
||||
gainfo.ThrowIfNull($"档案数据有误:{msg}");
|
||||
|
||||
//获取人员的设备权限
|
||||
var deviceCodes = await _devicePermissionService.GetAssignDeviceCodesAsync(gainfo!.Code);
|
||||
@@ -173,10 +179,8 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
DeviceUniqueNo = x.UniqueNo,
|
||||
Status = DeviceTaskStatusEnumType.Wait,
|
||||
Version = 0,
|
||||
UserNo = request.UserNo,
|
||||
Type = request.IsLeave
|
||||
? DeviceTaskEnumType.Delete
|
||||
: DeviceTaskEnumType.Add,
|
||||
UserNo = userNo,
|
||||
Type = type,
|
||||
DeviceType = x.Type,
|
||||
TenantId = x.TenantId,
|
||||
Priority = 10,
|
||||
|
||||
Reference in New Issue
Block a user