fix 功能调整

This commit is contained in:
2024-02-01 17:46:40 +08:00
parent 2f5f6be7d7
commit 28871aa450
23 changed files with 164 additions and 59 deletions

View File

@@ -28,8 +28,8 @@ public class DeviceUploadLogUploadRequest
/// <summary>
/// 日志类型
/// 记录类型
/// </summary>
[EnumDataType(typeof(DeviceUploadLogTypeEnumType))]
public DeviceUploadLogTypeEnumType Type { get; set; } = DeviceUploadLogTypeEnumType.Door;
public DeviceUploadLogTypeEnumType Type { get; set; } = DeviceUploadLogTypeEnumType.Attendance;
}

View File

@@ -1,4 +1,5 @@
using Dlhis.Entity.Basic.Entity;
using System.Linq.Expressions;
using Dlhis.Entity.Basic.Entity;
using Dlhis.Entity.Device.Entities;
using Dlhis.ScheduledTask.DeviceUploadLog.Request;
using Dlhis.ScheduledTask.DeviceUploadLog.Response;
@@ -7,6 +8,7 @@ using Kurisu.Core.DataAccess.Dto;
using Kurisu.SqlSugar.Attributes;
using Kurisu.SqlSugar.Extensions;
using Kurisu.SqlSugar.Services;
using SqlSugar;
namespace Dlhis.ScheduledTask.DeviceUploadLog.Services.Implements;
@@ -59,6 +61,20 @@ public class DeviceUploadLogService : IDeviceUploadLogService
[IgnoreTenant]
public async Task UploadLogsAsync(List<DeviceUploadLogUploadRequest> requests)
{
//判断存在的记录
Expression<Func<DeviceUploadLogEntity, bool>> where = LinqExpressionExtension.False<DeviceUploadLogEntity>();
requests.ForEach(p =>
{
where = where.Or(x => x.DeviceUniqueNo == p.DeviceUniqueNo && x.SerialNo == p.SerialNo && x.RaiseDateTime == p.RaiseDateTime);
});
//处理冗余的请求数据
var exists = await _dbContext.Queryable<DeviceUploadLogEntity>().Where(where).ToListAsync();
foreach (var item in exists)
{
requests.RemoveAll(x => x.DeviceUniqueNo == item.DeviceUniqueNo && x.SerialNo == item.SerialNo && x.RaiseDateTime == item.RaiseDateTime);
}
var nos = requests.Select(x => x.DeviceUniqueNo).ToList();
var devices = await _dbContext.Queryable<DeviceEntity>().Where(x => nos.Contains(x.UniqueNo)).ToListAsync();

View File

@@ -1,7 +1,7 @@
using System.Text;
using Dlhis.ScheduledTask.SyncSapInfo.Dto;
using Dlhis.ScheduledTask.SyncSapInfo.Response;
using Dlhis.User.Api;
using Dlhis.Sys.Api;
using Newtonsoft.Json;
namespace Dlhis.ScheduledTask.SyncSapInfo.Services.Implements;