fix 处理已知问题
This commit is contained in:
@@ -28,11 +28,18 @@ public interface ISyncApi
|
|||||||
[Post("/api/sync/businessTrips")]
|
[Post("/api/sync/businessTrips")]
|
||||||
[RequestContentHandler(typeof(CodeContentHandler))]
|
[RequestContentHandler(typeof(CodeContentHandler))]
|
||||||
Task HandlerBusinessTripsAsync(string code);
|
Task HandlerBusinessTripsAsync(string code);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 外包自动离职处理
|
/// 外包自动离职处理
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[Post("/api/gainfoOutsource/autoResign")]
|
[Post("/api/gainfoOutsource/autoResign")]
|
||||||
Task OutsourceAutoResignAsync();
|
Task OutsourceAutoResignAsync();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 外部人员自动离职处理
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Post("/api/appointments/autoResign")]
|
||||||
|
Task ExternalAutoResignAsync();
|
||||||
}
|
}
|
||||||
@@ -140,4 +140,16 @@ public class AppointmentsController : ControllerBase
|
|||||||
end = start.Date.AddDays(1).AddMilliseconds(-1);
|
end = start.Date.AddDays(1).AddMilliseconds(-1);
|
||||||
return await _appointmentService.GetSummaryAsync(factory, start, end);
|
return await _appointmentService.GetSummaryAsync(factory, start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自动离职处理
|
||||||
|
/// </summary>
|
||||||
|
[AllowAnonymous]
|
||||||
|
[HttpPost("autoResign")]
|
||||||
|
[IgnoreTenant]
|
||||||
|
public async Task AutoResignAsync()
|
||||||
|
{
|
||||||
|
await _appointmentService.AutoResignAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -66,4 +66,10 @@ public interface IAppointmentService : IScopeDependency
|
|||||||
/// <param name="base64"></param>
|
/// <param name="base64"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task UpdateFaceAsync(long detailId, string base64);
|
Task UpdateFaceAsync(long detailId, string base64);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自动离职
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task AutoResignAsync();
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ using Dlhis.Basic.Organization.Services;
|
|||||||
using Dlhis.Dh.Api;
|
using Dlhis.Dh.Api;
|
||||||
using Dlhis.Dh.Api.Requests;
|
using Dlhis.Dh.Api.Requests;
|
||||||
using Dlhis.Entity.Basic.Entity;
|
using Dlhis.Entity.Basic.Entity;
|
||||||
|
using Dlhis.Entity.Basic.Enums;
|
||||||
using Dlhis.Entity.Device.Entities;
|
using Dlhis.Entity.Device.Entities;
|
||||||
using Dlhis.Entity.Device.Enums;
|
using Dlhis.Entity.Device.Enums;
|
||||||
using Dlhis.Entity.Visitor.Entity;
|
using Dlhis.Entity.Visitor.Entity;
|
||||||
@@ -26,6 +27,8 @@ public class AppointmentService : IAppointmentService
|
|||||||
private readonly IDataProtectionProvider _dataProtectionProvider;
|
private readonly IDataProtectionProvider _dataProtectionProvider;
|
||||||
private readonly ICurrentUser _currentUser;
|
private readonly ICurrentUser _currentUser;
|
||||||
private readonly IDhApi _dhApi;
|
private readonly IDhApi _dhApi;
|
||||||
|
private readonly IGainfoService _gainfoService;
|
||||||
|
private readonly IFactorySettingService _factorySettingService;
|
||||||
private readonly ILogger<AppointmentService> _logger;
|
private readonly ILogger<AppointmentService> _logger;
|
||||||
private readonly IGainfoFaceService _gainfoFaceService;
|
private readonly IGainfoFaceService _gainfoFaceService;
|
||||||
|
|
||||||
@@ -33,6 +36,8 @@ public class AppointmentService : IAppointmentService
|
|||||||
IDataProtectionProvider dataProtectionProvider,
|
IDataProtectionProvider dataProtectionProvider,
|
||||||
ICurrentUser currentUser,
|
ICurrentUser currentUser,
|
||||||
IDhApi dhApi,
|
IDhApi dhApi,
|
||||||
|
IGainfoService gainfoService,
|
||||||
|
IFactorySettingService factorySettingService,
|
||||||
IGainfoFaceService gainfoFaceService,
|
IGainfoFaceService gainfoFaceService,
|
||||||
ILogger<AppointmentService> logger)
|
ILogger<AppointmentService> logger)
|
||||||
{
|
{
|
||||||
@@ -40,6 +45,8 @@ public class AppointmentService : IAppointmentService
|
|||||||
_dataProtectionProvider = dataProtectionProvider;
|
_dataProtectionProvider = dataProtectionProvider;
|
||||||
_currentUser = currentUser;
|
_currentUser = currentUser;
|
||||||
_dhApi = dhApi;
|
_dhApi = dhApi;
|
||||||
|
_gainfoService = gainfoService;
|
||||||
|
_factorySettingService = factorySettingService;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_gainfoFaceService = gainfoFaceService;
|
_gainfoFaceService = gainfoFaceService;
|
||||||
}
|
}
|
||||||
@@ -311,6 +318,57 @@ public class AppointmentService : IAppointmentService
|
|||||||
await GenerateDeviceTasksAsync(detail, true, DeviceTaskEnumType.Update, "访客手动上传照片");
|
await GenerateDeviceTasksAsync(detail, true, DeviceTaskEnumType.Update, "访客手动上传照片");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public async Task AutoResignAsync()
|
||||||
|
{
|
||||||
|
var outsources = await _dbContext.Queryable<GainfoEntity>()
|
||||||
|
.Where(x => x.Type == GainfoUserTypeEnumType.External)
|
||||||
|
.Select(x => new { x.Id, x.Code, x.Factory, x.CreateTime })
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var settings = await _factorySettingService.GetListAsync(false);
|
||||||
|
//0001/1/1 0:00:00
|
||||||
|
var nullDateTime = new DateTime(1, 1, 1);
|
||||||
|
|
||||||
|
foreach (var grp in outsources.GroupBy(x => x.Factory))
|
||||||
|
{
|
||||||
|
var setting = settings.First(x => x.Factory == grp.Key);
|
||||||
|
if (setting.NoRecordAutoResignExternalDays == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var outsource in grp)
|
||||||
|
{
|
||||||
|
var raiseDateTime = await _dbContext.Queryable<DeviceUploadLogEntity>()
|
||||||
|
.Where(x => x.UserUniqueNo == outsource.Code)
|
||||||
|
.GroupBy(x => x.UserUniqueNo)
|
||||||
|
.Select(x => SqlFunc.IsNull(SqlFunc.AggregateMax(x.RaiseDateTime), outsource.CreateTime))
|
||||||
|
.SingleAsync();
|
||||||
|
|
||||||
|
raiseDateTime = raiseDateTime == nullDateTime ? outsource.CreateTime : raiseDateTime;
|
||||||
|
|
||||||
|
if (raiseDateTime.AddDays(setting.NoRecordAutoResignExternalDays) < DateTime.Now)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _gainfoService.ResignAsync(new GainfoResignRequest
|
||||||
|
{
|
||||||
|
Id = outsource.Id,
|
||||||
|
Reason = $"{setting.NoRecordAutoResignExternalDays}天无通行记录",
|
||||||
|
Date = DateTime.Now,
|
||||||
|
IsOutsource = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
_logger.LogError(e, "自动归档外部人员异常:{msg}", e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//*********************************************************************************************************************
|
//*********************************************************************************************************************
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,4 +27,9 @@ public class FactorySettingResponse
|
|||||||
/// 外包自动离职天数(无通行记录)
|
/// 外包自动离职天数(无通行记录)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int NoRecordAutoResignOutsourceDays { get; set; }
|
public int NoRecordAutoResignOutsourceDays { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 外部人员自动离职天数(无通行记录)
|
||||||
|
/// </summary>
|
||||||
|
public int NoRecordAutoResignExternalDays { get; set; }
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,8 @@ public class FactorySettingService : IFactorySettingService
|
|||||||
Level = FaceQualityLevelEnumType.Medium
|
Level = FaceQualityLevelEnumType.Medium
|
||||||
}).ToList()
|
}).ToList()
|
||||||
},
|
},
|
||||||
NoRecordAutoResignOutsourceDays = currentSetting?.NoRecordAutoResignOutsourceDays ?? 30
|
NoRecordAutoResignOutsourceDays = currentSetting?.NoRecordAutoResignOutsourceDays ?? 30,
|
||||||
|
NoRecordAutoResignExternalDays = currentSetting?.NoRecordAutoResignExternalDays ?? 0
|
||||||
};
|
};
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class WorkGridScheduleService : IWorkGridScheduleService
|
|||||||
|
|
||||||
var timeSetting = await _dbContext.Queryable<WorkGridTimePeriodEntity>().Where(x => x.Type == request.PeriodType).Select(x => new { x.Start, x.Before }).SingleAsync();
|
var timeSetting = await _dbContext.Queryable<WorkGridTimePeriodEntity>().Where(x => x.Type == request.PeriodType).Select(x => new { x.Start, x.Before }).SingleAsync();
|
||||||
timeSetting.ThrowIfNull("工作网格时间尚未配置,无法操作");
|
timeSetting.ThrowIfNull("工作网格时间尚未配置,无法操作");
|
||||||
|
|
||||||
var currentLimit = request.Date.ToDateTime(timeSetting.Start.Add(-TimeSpan.FromSeconds(timeSetting.Before)));
|
var currentLimit = request.Date.ToDateTime(timeSetting.Start.Add(-TimeSpan.FromSeconds(timeSetting.Before)));
|
||||||
(DateTime.Now >= currentLimit).ThrowIfTrue("当前时间不可修改排班信息");
|
(DateTime.Now >= currentLimit).ThrowIfTrue("当前时间不可修改排班信息");
|
||||||
|
|
||||||
@@ -265,7 +265,7 @@ public class WorkGridScheduleService : IWorkGridScheduleService
|
|||||||
var t = request.IsError.ToString().ToLower();
|
var t = request.IsError.ToString().ToLower();
|
||||||
var filterString = $"{{\"IsError\":{t}";
|
var filterString = $"{{\"IsError\":{t}";
|
||||||
|
|
||||||
return await _dbContext.Queryable<DeviceUploadLogEntity>()
|
var r = await _dbContext.Queryable<DeviceUploadLogEntity>()
|
||||||
.LeftJoin<DeviceEntity>((log, d) => log.DeviceUniqueNo == d.UniqueNo)
|
.LeftJoin<DeviceEntity>((log, d) => log.DeviceUniqueNo == d.UniqueNo)
|
||||||
.LeftJoin<GainfoEntity>((log, d, ga) => log.UserUniqueNo == ga.Code)
|
.LeftJoin<GainfoEntity>((log, d, ga) => log.UserUniqueNo == ga.Code)
|
||||||
.WhereIF(request.DateTimePeriod.HasValue(), log => log.RaiseDateTime >= request.DateTimePeriod.Start
|
.WhereIF(request.DateTimePeriod.HasValue(), log => log.RaiseDateTime >= request.DateTimePeriod.Start
|
||||||
@@ -294,7 +294,15 @@ public class WorkGridScheduleService : IWorkGridScheduleService
|
|||||||
Status = log.Status,
|
Status = log.Status,
|
||||||
WorkGridInfo = log.WorkGridInfo,
|
WorkGridInfo = log.WorkGridInfo,
|
||||||
})
|
})
|
||||||
.ToPageListAsync(request);
|
.ToPageListAsync(request.PageIndex, request.PageSize);
|
||||||
|
|
||||||
|
return new Pagination<WorkGridScheduleAttendancePageResponse>
|
||||||
|
{
|
||||||
|
PageIndex = request.PageIndex,
|
||||||
|
PageSize = request.PageSize,
|
||||||
|
Total = 0,
|
||||||
|
Data = r
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<Pagination<WorkGridScheduleAttendancePageResponse>> GetAllAttendancePageAsync(WorkGridScheduleAttendancePageRequest request)
|
public async Task<Pagination<WorkGridScheduleAttendancePageResponse>> GetAllAttendancePageAsync(WorkGridScheduleAttendancePageRequest request)
|
||||||
|
|||||||
@@ -41,6 +41,11 @@ public class FactorySettingEntity : SugarBaseEntity, ITenantId
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int NoRecordAutoResignOutsourceDays { get; set; }
|
public int NoRecordAutoResignOutsourceDays { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 访客自动离职天数(无通行记录)
|
||||||
|
/// </summary>
|
||||||
|
public int NoRecordAutoResignExternalDays { get; set; }
|
||||||
|
|
||||||
[SugarColumn(IsNullable = true, ColumnDataType = "time", ColumnDescription = "工作网格编辑限制时间")]
|
[SugarColumn(IsNullable = true, ColumnDataType = "time", ColumnDescription = "工作网格编辑限制时间")]
|
||||||
public TimeOnly? WorkGridSetLimit { get; set; }
|
public TimeOnly? WorkGridSetLimit { get; set; }
|
||||||
|
|
||||||
|
|||||||
25
Src/Dlhis.ScheduledTask/Jobs/ExternalAutoResignJob.cs
Normal file
25
Src/Dlhis.ScheduledTask/Jobs/ExternalAutoResignJob.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using Dlhis.Basic.Api;
|
||||||
|
using Dlhis.ScheduledTask.Attributes;
|
||||||
|
|
||||||
|
namespace Dlhis.ScheduledTask.Jobs;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 自动处理外包离职
|
||||||
|
/// </summary>
|
||||||
|
[RecurringJob(nameof(ExternalAutoResignJob), "0 0 1 1/1 * ? ", Name = "自动处理外部人员离职")]
|
||||||
|
public class ExternalAutoResignJob : BaseJob
|
||||||
|
{
|
||||||
|
private readonly ISyncApi _syncApi;
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public ExternalAutoResignJob(IServiceProvider serviceProvider, ISyncApi syncApi) : base(serviceProvider)
|
||||||
|
{
|
||||||
|
_syncApi = syncApi;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override async Task RunAsync(IServiceProvider serviceProvider)
|
||||||
|
{
|
||||||
|
await _syncApi.ExternalAutoResignAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user