From f43c2d6c590862aba0fff2374ea541b809b4e10d Mon Sep 17 00:00:00 2001 From: liguoyang Date: Tue, 3 Feb 2026 18:57:12 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=B8=8D=E5=86=8D=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=80=81=E7=B3=BB=E7=BB=9F=E6=A1=A3=E6=A1=88=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/AppointmentAreaService.cs | 4 +- .../Controllers/OldDeviceGainfosController.cs | 32 --------- .../Services/Implements/OldGainfoService.cs | 30 --------- .../Basic/Entity/OldDeviceGainfoEntity.cs | 46 ------------- .../Implements/DeviceUploadLogService.cs | 13 ---- .../Services/Implements/AssignmentService.cs | 66 ------------------- 6 files changed, 3 insertions(+), 188 deletions(-) delete mode 100644 Src/Dlhis.Basic/Organization/Controllers/OldDeviceGainfosController.cs delete mode 100644 Src/Dlhis.Basic/Organization/Services/Implements/OldGainfoService.cs delete mode 100644 Src/Dlhis.Entity/Basic/Entity/OldDeviceGainfoEntity.cs diff --git a/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs b/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs index aad83490..cb71525a 100644 --- a/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs +++ b/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs @@ -132,7 +132,9 @@ public class AppointmentAreaService : IAppointmentAreaService public async Task> GetAssignmentsAsync(string customCode) { return await _dbContext.Queryable() - .Where(x => x.CustomCode == customCode).Select(x => x.DeviceGroupCode) + .LeftJoin((x, dg) => x.DeviceGroupCode == dg.Code) + .Where((x, dg) => x.CustomCode == customCode && dg.AsAppointment) + .Select(x => x.DeviceGroupCode) .ToListAsync(); } diff --git a/Src/Dlhis.Basic/Organization/Controllers/OldDeviceGainfosController.cs b/Src/Dlhis.Basic/Organization/Controllers/OldDeviceGainfosController.cs deleted file mode 100644 index a6a99c02..00000000 --- a/Src/Dlhis.Basic/Organization/Controllers/OldDeviceGainfosController.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Dlhis.Basic.Organization.Request; -using Dlhis.Basic.Organization.Services; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; - -namespace Dlhis.Basic.Organization.Controllers; - -/// -/// 老系统档案表 -/// -[Authorize] -[Route("api/[controller]")] -[ApiController] -public class OldDeviceGainfosController : ControllerBase -{ - private readonly IOldDeviceGainfoService _oldGainfoService; - - public OldDeviceGainfosController(IOldDeviceGainfoService oldGainfoService) - { - _oldGainfoService = oldGainfoService; - } - - /// - /// 上传 - /// - /// - [HttpPost("upload")] - public async Task BatchUploadAsync(List requests) - { - await _oldGainfoService.BatchUploadAsync(requests); - } -} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/OldGainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/OldGainfoService.cs deleted file mode 100644 index efe70ca2..00000000 --- a/Src/Dlhis.Basic/Organization/Services/Implements/OldGainfoService.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Dlhis.Basic.Organization.Request; -using Dlhis.Entity.Basic.Entity; -using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; -using Mapster; - -namespace Dlhis.Basic.Organization.Services.Implements; - -public class OldGainfoService : IOldDeviceGainfoService -{ - private readonly IDbContext _dbContext; - - public OldGainfoService(IDbContext dbContext) - { - _dbContext = dbContext; - } - - /// - public async Task BatchUploadAsync(List requests) - { - var entities = requests.Adapt>(); - - foreach (var entity in entities) - { - if (!await _dbContext.Queryable().AnyAsync(x => x.No == entity.No && x.Code == entity.Code && x.DeviceUniqueNo == entity.DeviceUniqueNo)) - { - await _dbContext.InsertAsync(entity); - } - } - } -} \ No newline at end of file diff --git a/Src/Dlhis.Entity/Basic/Entity/OldDeviceGainfoEntity.cs b/Src/Dlhis.Entity/Basic/Entity/OldDeviceGainfoEntity.cs deleted file mode 100644 index 27ff63a2..00000000 --- a/Src/Dlhis.Entity/Basic/Entity/OldDeviceGainfoEntity.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Dlhis.Entity.Device.Enums; -using Kurisu.AspNetCore.DataAccess.SqlSugar; -using SqlSugar; -using SqlSugar.DbConvert; - -namespace Dlhis.Entity.Basic.Entity; - -/// -/// 老系统设备档案 -/// -[SugarTable(TableName = "OldDeviceGainfos", TableDescription = "老系统设备档案")] -public class OldDeviceGainfoEntity : SugarBaseEntity -{ - [SugarColumn(IsNullable = false, ColumnDescription = "厂区")] - public string Factory { get; set; } - - /// - /// 档案号 - /// - [SugarColumn(IsNullable = false, ColumnDescription = "档案号", IndexGroupNameList = new[] { "unique_OldGainfos_no_code_unique" })] - public string No { get; set; } - - /// - /// 工号 - /// - [SugarColumn(IsNullable = false, ColumnDescription = "工号", IndexGroupNameList = new[] { "unique_OldGainfos_no_code_unique" })] - public string Code { get; set; } - - /// - /// 设备唯一号 - /// - [SugarColumn(IsNullable = false, ColumnDescription = "设备唯一号", IndexGroupNameList = new[] { "unique_OldGainfos_no_code_unique" })] - public string DeviceUniqueNo { get; set; } - - /// - /// 处理状态 - /// - [SugarColumn(ColumnDescription = "处理状态", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] - public OldDeviceGainfoEnumType Status { get; set; } - - /// - /// 备注说明 - /// - [SugarColumn(IsNullable = true, ColumnDataType = "varchar(2000)", ColumnDescription = "备注说明")] - public string Remark { get; set; } -} \ No newline at end of file diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs index 67c8d774..1e477af9 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs @@ -116,19 +116,6 @@ public class DeviceUploadLogService : IDeviceUploadLogService continue; } - if (request.CardNo.IsPresent() && request.UserUniqueNo != request.CardNo) - { - //UserUniqueNo为老系统档案号(自动生成),CardNo为工号 - if (await _dbContext.Queryable() - .Where(x => x.DeviceUniqueNo == request.DeviceUniqueNo) - .Where(x => x.No == request.UserUniqueNo && x.Code == request.CardNo) - .Select(x => x.Code) - .AnyAsync()) - { - request.UserUniqueNo = request.CardNo; - } - } - var currentGainfo = gainfos.FirstOrDefault(x => x.Code == request.UserUniqueNo); var userType = currentGainfo?.Type; var needUpload = ((userType is GainfoUserTypeEnumType.Normal or GainfoUserTypeEnumType.SecurityWhite) diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs index bac70b72..1c727860 100644 --- a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs +++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs @@ -43,7 +43,6 @@ public class AssignmentService : IAssignmentService var data = await GetDataAsync(request); if (data.IsEmpty()) return new List(); - await HandlerOldDeviceGainfoAsync(data); await HandlerTimePeriodAsync(data); var deviceUploadInfos = await GetDeviceUploadRecordInfosAsync(data); @@ -196,46 +195,6 @@ public class AssignmentService : IAssignmentService task.ModifiedTime = now; }); - if (await _dbContext.Queryable().Where(x => x.Status != OldDeviceGainfoEnumType.Deleted).AnyAsync()) - { - var dCodes = await _dbContext.Queryable() - .LeftJoin((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(); - dCodes.ForEach(item => { oldDeviceGainfoWhere = oldDeviceGainfoWhere.Or(x => x.Code == item.Code && x.DeviceUniqueNo == item.DeviceUniqueNo); }); - var oldData = await _dbContext.Queryable().Where(x => x.Status == OldDeviceGainfoEnumType.Wait) - .Where(oldDeviceGainfoWhere) - .ToListAsync(); - - oldData.ForEach(d => - { - var current = dCodes.FirstOrDefault(x => x.Code == d.Code); - if (current != null) - { - var task = deviceTasks.FirstOrDefault(x => x.UserNo == current.No && x.DeviceUniqueNo == current.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); } @@ -406,31 +365,6 @@ public class AssignmentService : IAssignmentService } - /// - /// 处理老档案数据 - /// - /// - private async Task HandlerOldDeviceGainfoAsync(List data) - { - if (await _dbContext.Queryable().Where(x => x.Status != OldDeviceGainfoEnumType.Deleted).AnyAsync()) - { - var oldDeviceGainfoWhere = LinqExpressionExtensions.False(); - data.ForEach(item => { oldDeviceGainfoWhere = oldDeviceGainfoWhere.Or(x => x.Code == item.UserCode && x.DeviceUniqueNo == item.DeviceUniqueNo); }); - var oldData = await _dbContext.Queryable() - .Where(x => x.Status == OldDeviceGainfoEnumType.Wait || x.Status == OldDeviceGainfoEnumType.Error) - .Where(oldDeviceGainfoWhere) - .ToListAsync(); - - data.ForEach(item => - { - var o = oldData.FirstOrDefault(x => x.Code == item.UserCode && x.DeviceUniqueNo == item.DeviceUniqueNo); - if (o != null) - item.OldUserNo = o.No; - }); - } - } - - private async Task HandlerTimePeriodAsync(List data) { try