From a54efe83adc7dfb362a88fde19bac40fa307153e Mon Sep 17 00:00:00 2001 From: liguoyang Date: Wed, 8 Jan 2025 17:30:01 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BC=98=E5=8C=96needUpload=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/Implements/DeviceUploadLogService.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs index 37a543e2..2298cd68 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs @@ -1,4 +1,5 @@ using Dlhis.Entity.Basic.Entity; +using Dlhis.Entity.Basic.Enums; using Dlhis.Entity.Device.Entities; using Dlhis.Entity.Device.Enums; using Dlhis.Jip.Api; @@ -63,18 +64,21 @@ public class DeviceUploadLogService : IDeviceUploadLogService var device = devices.First(x => x.UniqueNo == request.DeviceUniqueNo); + var userType = gainfos.FirstOrDefault(x => x.Code == request.UserUniqueNo)?.Type; + var needUpload = userType == GainfoUserTypeEnumType.Normal && (device.Type == DeviceTypeEnumType.Attendance || (device.Type == DeviceTypeEnumType.Door && device.AsAttendance)); + var dataType = device.Type == DeviceTypeEnumType.Attendance + ? DeviceUploadLogTypeEnumType.Attendance + : DeviceUploadLogTypeEnumType.Door; inserts.Add(new DeviceUploadLogEntity { DeviceCode = device.Code, DeviceUniqueNo = request.DeviceUniqueNo, UserUniqueNo = request.UserUniqueNo, - UserType = gainfos.FirstOrDefault(x => x.Code == request.UserUniqueNo)?.Type, + UserType = userType, RaiseDateTime = request.RaiseDateTime, SerialNo = request.SerialNo ?? string.Empty, - Type = device.Type == DeviceTypeEnumType.Attendance - ? DeviceUploadLogTypeEnumType.Attendance - : DeviceUploadLogTypeEnumType.Door, - NeedUpload = device.Type == DeviceTypeEnumType.Attendance || (device.Type == DeviceTypeEnumType.Door && device.AsAttendance), + Type = dataType, + NeedUpload = needUpload, TenantId = device.TenantId, Status = request.Status ?? true, CreatedBy = 1,