From 37c52e72c458afb4d1d6d1c5223156df78fd0e63 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 19 Dec 2024 15:21:45 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat=20=E6=89=8B=E5=8A=A8=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?,=E6=89=8B=E5=8A=A8=E8=AE=BE=E7=BD=AE=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/AppointmentAreaService.cs | 2 - .../BasePermissionAnalyzeService.cs | 2 - .../Services/Implements/DeviceGroupService.cs | 2 - .../DevicePermissionAnalyzeService.cs | 1 - .../Implements/DevicePermissionService.cs | 5 - .../Implements/DeviceTimePeriodService.cs | 4 +- .../Services/Implements/GainfoGroupService.cs | 2 - .../Services/Implements/GainfoService.cs | 1 - Src/Dlhis.Basic/appsettings.Development.json | 2 +- .../BusinessPlaceManagerRelationshipEntity.cs | 7 +- .../Basic/Entity/DepartmentEntity.cs | 6 +- Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs | 157 +++++++++--------- Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs | 52 +++--- .../Basic/Entity/GainfoGroupEntity.cs | 74 ++++----- .../Basic/Entity/GainfoSapEntity.cs | 19 ++- Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs | 8 +- .../Canteen/Entities/BalanceRecordEntity.cs | 46 ++--- .../Canteen/Entities/CanteenOrderEntity.cs | 12 +- .../Canteen/Entities/DishesCategoryEntity.cs | 3 +- .../Entities/EMealVoucherDetailEntity.cs | 26 +-- .../Canteen/Entities/EMealVoucherEntity.cs | 24 +-- .../Entities/MealSupplementRecordEntity.cs | 9 +- .../Canteen/Entities/UserBalanceEntity.cs | 3 +- Src/Dlhis.Entity/Common/FileVersionEntity.cs | 6 +- .../Device/Entities/DeviceGroupEntity.cs | 13 +- .../Device/Entities/DeviceTaskEntity.cs | 15 +- .../Device/Entities/DeviceUploadLogEntity.cs | 2 +- .../Entities/DeviceUploadLogManuallyEntity.cs | 24 +++ Src/Dlhis.Entity/SqlSugarPack.cs | 3 +- Src/Dlhis.Entity/Sys/Entities/MenuEntity.cs | 24 +-- .../Entity/VisitorAppointmentDetailEntity.cs | 17 +- .../Controllers/DeviceUploadLogsController.cs | 20 +++ ...viceUploadLogManuallySetTimeInfoRequest.cs | 22 +++ .../SetUploadLogsBeginDateTimeRequest.cs | 17 -- .../Services/IDeviceUploadLogService.cs | 25 ++- .../Implements/DeviceUploadLogService.cs | 71 +++++++- .../Jobs/CreateGetUploadRecordJob.cs | 1 - .../Properties/launchSettings.json | 4 +- .../Services/Implements/AssignmentService.cs | 37 ++++- 39 files changed, 460 insertions(+), 308 deletions(-) create mode 100644 Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs create mode 100644 Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogManuallySetTimeInfoRequest.cs delete mode 100644 Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/SetUploadLogsBeginDateTimeRequest.cs diff --git a/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs b/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs index 34fd9041..aad83490 100644 --- a/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs +++ b/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs @@ -108,7 +108,6 @@ public class AppointmentAreaService : IAppointmentAreaService DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo, Status = DeviceTaskStatusEnumType.Wait, Version = 0, - CancellationId = 0, Source = "预约区域和设备组关系变更生成", Priority = 99 })); @@ -121,7 +120,6 @@ public class AppointmentAreaService : IAppointmentAreaService DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo, Status = DeviceTaskStatusEnumType.Wait, Version = 0, - CancellationId = 0, Source = "预约区域和设备组关系变更生成", Priority = 99 })); diff --git a/Src/Dlhis.Basic/Device/Services/Implements/BasePermissionAnalyzeService.cs b/Src/Dlhis.Basic/Device/Services/Implements/BasePermissionAnalyzeService.cs index 004cd6c5..3ec41f3b 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/BasePermissionAnalyzeService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/BasePermissionAnalyzeService.cs @@ -83,7 +83,6 @@ public abstract class BasePermissionAnalyzeService : IPermissionAnalyzeService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = source, Priority = 0, TenantId = x.TenantId, @@ -99,7 +98,6 @@ public abstract class BasePermissionAnalyzeService : IPermissionAnalyzeService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = source, Priority = 0, TenantId = x.TenantId, diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs index 24781f2f..e35a2b9f 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs @@ -225,7 +225,6 @@ public class DeviceGroupService : IDeviceGroupService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "人员分组分配", Priority = 0, TenantId = x.TenantId @@ -259,7 +258,6 @@ public class DeviceGroupService : IDeviceGroupService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "人员分组分配", Priority = 0, TenantId = x.TenantId, diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionAnalyzeService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionAnalyzeService.cs index 85b0ef7e..833f0f32 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionAnalyzeService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionAnalyzeService.cs @@ -125,7 +125,6 @@ public class DevicePermissionAnalyzeService : IDevicePermissionAnalyzeService DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo, Status = DeviceTaskStatusEnumType.Wait, Type = DeviceTaskEnumType.Delete, - CancellationId = 0, DeviceType = devices.First(item => item.Code == x).Type, UserNo = userNo, Version = 0, diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs index dc79662d..372e566f 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs @@ -101,7 +101,6 @@ public class DevicePermissionService : IDevicePermissionService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "人员分配到设备unique", Priority = 0, TenantId = currentTenantId, @@ -131,7 +130,6 @@ public class DevicePermissionService : IDevicePermissionService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 20, Source = "人员分配到设备unique", Priority = 0, TenantId = currentTenantId @@ -209,7 +207,6 @@ public class DevicePermissionService : IDevicePermissionService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "人员分配到设备import", Priority = 0, TenantId = device.TenantId, @@ -399,7 +396,6 @@ public class DevicePermissionService : IDevicePermissionService DeviceUniqueNo = device.UniqueNo, Status = DeviceTaskStatusEnumType.Wait, Type = DeviceTaskEnumType.Delete, - CancellationId = 0, DeviceType = device.Type, UserNo = x, Version = 0, @@ -425,7 +421,6 @@ public class DevicePermissionService : IDevicePermissionService Type = taskType, DeviceType = x.Type, UserNo = userNo, - CancellationId = 0, Priority = 0, Version = 0, TenantId = x.TenantId, diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DeviceTimePeriodService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DeviceTimePeriodService.cs index 0f16b0f6..71997067 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DeviceTimePeriodService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DeviceTimePeriodService.cs @@ -158,7 +158,6 @@ public class DeviceTimePeriodService : IDeviceTimePeriodService DeviceUniqueNo = deviceUniqueNo, Status = DeviceTaskStatusEnumType.Wait, Version = 0, - CancellationId = 0, Source = source, Priority = 90, TenantId = device.TenantId @@ -191,7 +190,6 @@ public class DeviceTimePeriodService : IDeviceTimePeriodService DeviceUniqueNo = deviceUniqueNo, Status = DeviceTaskStatusEnumType.Wait, Version = 0, - CancellationId = 0, Source = source, Priority = 90, TenantId = device.TenantId @@ -213,7 +211,7 @@ public class DeviceTimePeriodService : IDeviceTimePeriodService var devices = await _dbContext.Queryable() .Where(x => !SqlFunc.IsNullOrEmpty(x.TemplateCode)) - .Where(x => templateCodes.Contains(x.TemplateCode.Value) || deviceCodes.Contains(x.Code)) + .Where(x => templateCodes.Contains(x.TemplateCode) || deviceCodes.Contains(x.Code)) .Where(x => x.Enable && x.EnableTimePeriod) .ToListAsync(); diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs index 071b8647..6a302996 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs @@ -189,7 +189,6 @@ public class GainfoGroupService : IGainfoGroupService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "手动操作人员分组关系", Priority = 0, TenantId = device.TenantId @@ -209,7 +208,6 @@ public class GainfoGroupService : IGainfoGroupService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "手动操作人员分组关系", Priority = 0, TenantId = device.TenantId diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index d328f4c1..144508a2 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -305,7 +305,6 @@ public class GainfoService : IGainfoService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "安全级别提高", Priority = 60, TenantId = x.TenantId diff --git a/Src/Dlhis.Basic/appsettings.Development.json b/Src/Dlhis.Basic/appsettings.Development.json index 47d1cb6f..c22992e5 100644 --- a/Src/Dlhis.Basic/appsettings.Development.json +++ b/Src/Dlhis.Basic/appsettings.Development.json @@ -22,7 +22,7 @@ "Timeout": 30, "SlowSqlTime": 1, "EnableSqlLog": true, - "Generate": false + "Generate": true }, "SwaggerOptions": { "Enable": true, diff --git a/Src/Dlhis.Entity/Basic/Entity/BusinessPlaceManagerRelationshipEntity.cs b/Src/Dlhis.Entity/Basic/Entity/BusinessPlaceManagerRelationshipEntity.cs index 45694dc3..4ac9f3f8 100644 --- a/Src/Dlhis.Entity/Basic/Entity/BusinessPlaceManagerRelationshipEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/BusinessPlaceManagerRelationshipEntity.cs @@ -15,16 +15,15 @@ public class BusinessPlaceManagerRelationshipEntity : SugarBaseEntity , ITenantI /// 管理人员 /// [AdaptIgnore(MemberSide.Destination)] - [SugarColumn(ColumnDescription = "管理人员", IsNullable = false)] + [SugarColumn(IsNullable = false, ColumnDescription = "管理人员")] public int ManagerUserId { get; set; } /// /// 营业点 /// - [SugarColumn(ColumnDescription = "营业点", IsNullable = false)] + [SugarColumn(IsNullable = false, ColumnDescription = "营业点")] public Guid BusinessPlaceCode { get; set; } - /// public string TenantId { get; set; } -} +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/Basic/Entity/DepartmentEntity.cs b/Src/Dlhis.Entity/Basic/Entity/DepartmentEntity.cs index 11db4561..270793d5 100644 --- a/Src/Dlhis.Entity/Basic/Entity/DepartmentEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/DepartmentEntity.cs @@ -12,19 +12,19 @@ namespace Dlhis.Entity.Basic.Entity /// /// 部门号 /// - [SugarColumn(ColumnDescription = "部门号", IsNullable = false, UniqueGroupNameList = new[] { "idx_Department_No" })] + [SugarColumn(IsNullable = false, ColumnDescription = "部门号", UniqueGroupNameList = new[] { "idx_Department_No" })] public string No { get; set; } /// /// 上级部门号 /// - [SugarColumn(ColumnDescription = "上级部门号")] + [SugarColumn(IsNullable = true, ColumnDescription = "上级部门号")] public string PNo { get; set; } /// /// 部门名称 /// - [SugarColumn(ColumnDescription = "部门名称", IsNullable = false)] + [SugarColumn(IsNullable = false, ColumnDescription = "部门名称")] public string Name { get; set; } } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs b/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs index 44bde49a..2a73f65f 100644 --- a/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs @@ -6,102 +6,101 @@ using Mapster; using SqlSugar; using SqlSugar.DbConvert; -namespace Dlhis.Entity.Basic.Entity +namespace Dlhis.Entity.Basic.Entity; + +/// +/// 设备 +/// +[SugarTable(TableName = "Device", TableDescription = "设备表")] +public class DeviceEntity : SugarBaseEntity, ITenantId { /// - /// 设备 + /// 设备code /// - [SugarTable(TableName = "Device", TableDescription = "设备表")] - public class DeviceEntity : SugarBaseEntity, ITenantId - { - /// - /// 设备code - /// - [DeviceCode] - [SugarColumn(ColumnDescription = "设备code")] - public Guid Code { get; set; } + [DeviceCode] + [SugarColumn(IsNullable = false, ColumnDescription = "设备code")] + public Guid Code { get; set; } - /// - /// 设备唯一码,IP/MAC/SNO - /// - [AdaptIgnore(MemberSide.Destination)] - [SugarColumn(ColumnDescription = "设备唯一码", IsNullable = false, UniqueGroupNameList = new[] { "Idx_Device_UniqueNo" })] - public string UniqueNo { get; set; } + /// + /// 设备唯一码,IP/MAC/SNO + /// + [AdaptIgnore(MemberSide.Destination)] + [SugarColumn(IsNullable = false, ColumnDescription = "设备唯一码", UniqueGroupNameList = new[] { "Idx_Device_UniqueNo" })] + public string UniqueNo { get; set; } - /// - /// 心跳间隔 - /// - [SugarColumn(ColumnDescription = "心跳检查间隔")] - public int HeartbeatInterval { get; set; } + /// + /// 心跳间隔 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "心跳检查间隔")] + public int HeartbeatInterval { get; set; } = 30; - /// - /// 供应商 - /// - [SugarColumn(ColumnDescription = "供应商")] - public string Supplier { get; set; } + /// + /// 供应商 + /// + [SugarColumn(IsNullable = true, ColumnDescription = "供应商")] + public string Supplier { get; set; } - /// - /// 设备功能 - /// - [SugarColumn(ColumnDataType = "varchar(150)", IsJson = true, ColumnDescription = "设备功能", DefaultValue = "[]")] - public List Funcs { get; set; } + /// + /// 设备功能 + /// + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(150)", IsJson = true, ColumnDescription = "设备功能", DefaultValue = "[]")] + public List Funcs { get; set; } - /// - /// 设备类型 - /// - [SugarColumn(ColumnDescription = "设备类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] - public DeviceTypeEnumType Type { get; set; } + /// + /// 设备类型 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "设备类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + public DeviceTypeEnumType Type { get; set; } - /// - /// 部署点 - /// - [SugarColumn(ColumnDescription = "部署点")] - public string DeployPlace { get; set; } + /// + /// 部署点 + /// + [SugarColumn(IsNullable = true, ColumnDescription = "部署点")] + public string DeployPlace { get; set; } - /// - /// 部署坐标 - /// - [SugarColumn(ColumnDescription = "部署坐标")] - public string DeployPosition { get; set; } + /// + /// 部署坐标 + /// + [SugarColumn(IsNullable = true, ColumnDescription = "部署坐标")] + public string DeployPosition { get; set; } - /// - /// 部署方向 - /// - [SugarColumn(ColumnDescription = "部署方向", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] - public DeviceDeployDirectionEnumType? DeployDirection { get; set; } + /// + /// 部署方向 + /// + [SugarColumn(IsNullable = true, ColumnDescription = "部署方向", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + public DeviceDeployDirectionEnumType? DeployDirection { get; set; } - /// - /// 模板code - /// - [SugarColumn(ColumnDescription = "模板code")] - public Guid? TemplateCode { get; set; } + /// + /// 模板code + /// + [SugarColumn(IsNullable = false, ColumnDescription = "模板code")] + public Guid TemplateCode { get; set; } - /// - /// 连接信息 - /// - [SugarColumn(ColumnDescription = "连接信息")] - public string ConnectionInfo { get; set; } + /// + /// 连接信息 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "连接信息")] + public string ConnectionInfo { get; set; } - /// - /// 是否启用 - /// - [SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否启用")] - public bool Enable { get; set; } + /// + /// 是否启用 + /// + [SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "是否启用")] + public bool Enable { get; set; } - /// - /// 是否作为考勤设备 - /// - [SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否作为考勤设备")] - public bool AsAttendance { get; set; } + /// + /// 是否作为考勤设备 + /// + [SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "是否作为考勤设备")] + public bool AsAttendance { get; set; } - /// - /// 是否启用时段码 - /// - [SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否启用时段码", DefaultValue = "0")] - public bool EnableTimePeriod { get; set; } = false; + /// + /// 是否启用时段码 + /// + [SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "是否启用时段码", DefaultValue = "0")] + public bool EnableTimePeriod { get; set; } = false; - public string TenantId { get; set; } - } + public string TenantId { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs index c5ae6fa3..7cfb4bb2 100644 --- a/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs @@ -29,146 +29,146 @@ public class GainfoEntity : SugarBaseEntity /// 人员类型 /// [AdaptIgnore(MemberSide.Destination)] - [SugarColumn(ColumnDescription = "人员类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + [SugarColumn(IsNullable = false, ColumnDescription = "人员类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] public GainfoUserTypeEnumType Type { get; set; } /// /// 人员来源 /// - [SugarColumn(ColumnDescription = "人员来源", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "人员来源")] public string Source { get; set; } /// /// 姓名 /// - [SugarColumn(ColumnDescription = "姓名")] + [SugarColumn(IsNullable = false, ColumnDescription = "姓名")] public string Name { get; set; } /// /// 学工号 /// - [SugarColumn(ColumnDescription = "学工号", UniqueGroupNameList = new[] { "idx_Gainfo_Code" })] + [SugarColumn(IsNullable = false, ColumnDescription = "学工号", UniqueGroupNameList = new[] { "idx_Gainfo_Code" })] public string Code { get; set; } /// /// 国家代码 /// - [SugarColumn(ColumnDescription = "国家代码")] + [SugarColumn(IsNullable = true, ColumnDescription = "国家代码")] public string CountryNo { get; set; } /// /// 证件类型代码 /// - [SugarColumn(ColumnDescription = "证件类型代码")] + [SugarColumn(IsNullable = true, ColumnDescription = "证件类型代码")] public string IdClass { get; set; } /// /// 身份证号 /// - [SugarColumn(ColumnDescription = "身份证号", UniqueGroupNameList = new[] { "idx_Gainfo_IdNo" })] + [SugarColumn(IsNullable = true, ColumnDescription = "身份证号", UniqueGroupNameList = new[] { "idx_Gainfo_IdNo" })] public string IdNo { get; set; } /// /// 身份证籍贯区域代码 /// - [SugarColumn(ColumnDescription = "身份证籍贯区域代码")] + [SugarColumn(IsNullable = true, ColumnDescription = "身份证籍贯区域代码")] public string Native { get; set; } /// /// 性别 /// - [SugarColumn(ColumnDescription = "性别", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + [SugarColumn(IsNullable = false, ColumnDescription = "性别", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] public GenderEnumType Gender { get; set; } /// /// 生日 /// - [SugarColumn(ColumnDescription = "生日")] + [SugarColumn(IsNullable = true, ColumnDescription = "生日")] public DateTime Birthday { get; set; } /// /// 身份证地址 /// - [SugarColumn(ColumnDescription = "身份证地址")] + [SugarColumn(IsNullable = true, ColumnDescription = "身份证地址")] public string Address { get; set; } /// /// 部门编码 /// - [SugarColumn(ColumnDescription = "部门编码")] + [SugarColumn(IsNullable = true, ColumnDescription = "部门编码")] public string DepartmentNo { get; set; } /// /// 民族代码 /// - [SugarColumn(ColumnDescription = "民族代码")] + [SugarColumn(IsNullable = true, ColumnDescription = "民族代码")] public string Nation { get; set; } /// /// 手机号码 /// - [SugarColumn(ColumnDescription = "手机号码")] + [SugarColumn(IsNullable = true, ColumnDescription = "手机号码")] public string Phone { get; set; } /// /// 学历 /// - [SugarColumn(ColumnDescription = "学历")] + [SugarColumn(IsNullable = true, ColumnDescription = "学历")] public string Degree { get; set; } /// /// 岗位 /// - [SugarColumn(ColumnDescription = "岗位")] + [SugarColumn(IsNullable = true, ColumnDescription = "岗位")] public string PositionNo { get; set; } /// /// 职等 /// - [SugarColumn(ColumnDescription = "职等")] + [SugarColumn(IsNullable = true, ColumnDescription = "职等")] public string Grade { get; set; } /// /// 职级 /// - [SugarColumn(ColumnDescription = "职级")] + [SugarColumn(IsNullable = true, ColumnDescription = "职级")] public string Title { get; set; } /// /// 卡号 /// - [SugarColumn(ColumnDescription = "卡号", IndexGroupNameList = new[] { "idx_Gainfo_CardNo" })] + [SugarColumn(IsNullable = true, ColumnDescription = "卡号", IndexGroupNameList = new[] { "idx_Gainfo_CardNo" })] public string CardNo { get; set; } /// /// 备注 /// - [SugarColumn(ColumnDescription = "备注")] + [SugarColumn(IsNullable = true, ColumnDescription = "备注")] public string Remark { get; set; } /// /// 人事范围 /// - [SugarColumn(ColumnDescription = "人事范围")] + [SugarColumn(IsNullable = true, ColumnDescription = "人事范围")] public string Werks { get; set; } /// /// 工作地 /// - [SugarColumn(ColumnDescription = "工作地")] + [SugarColumn(IsNullable = false, ColumnDescription = "工作地")] public string Workplace { get; set; } /// /// 厂区 /// [TenantId] - [SugarColumn(ColumnDescription = "厂区")] + [SugarColumn(IsNullable = false, ColumnDescription = "厂区")] public string Factory { get; set; } /// /// 成本中心 /// - [SugarColumn(ColumnDescription = "成本中心")] + [SugarColumn(IsNullable = true, ColumnDescription = "成本中心")] public string CostId { get; set; } /// @@ -186,13 +186,13 @@ public class GainfoEntity : SugarBaseEntity /// /// 身份认证用户Id(如果为空匹配code) /// - [SugarColumn(ColumnDescription = "身份认证用户Id", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "身份认证用户Id")] public int IdentityUserId { get; set; } /// /// 卡类型 /// - [SugarColumn(ColumnDescription = "卡类型", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "卡类型")] public int? CardType { get; set; } } diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs index 77aee1e4..46d940bc 100644 --- a/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs @@ -2,50 +2,50 @@ using Kurisu.AspNetCore.DataAccess.SqlSugar; using SqlSugar; -namespace Dlhis.Entity.Basic.Entity +namespace Dlhis.Entity.Basic.Entity; + +/// +/// 档案组 +/// +[SugarTable(TableName = "GainfoGroup", TableDescription = "档案组")] +public class GainfoGroupEntity : SugarBaseEntity, ITenantId { /// - /// 档案组 + /// 父级Code /// - [SugarTable(TableName = "GainfoGroup", TableDescription = "档案组")] - public class GainfoGroupEntity : SugarBaseEntity, ITenantId - { - /// - /// 父级Code - /// - public Guid? PCode { get; set; } + [SugarColumn(IsNullable = true)] + public Guid? PCode { get; set; } - /// - /// 分组code - /// - [SugarColumn(ColumnDescription = "分组code")] - public Guid Code { get; set; } + /// + /// 分组code + /// + [SugarColumn(IsNullable = false, ColumnDescription = "分组code")] + public Guid Code { get; set; } - /// - /// 名称 - /// - [SugarColumn(ColumnDescription = "名称")] - public string Name { get; set; } + /// + /// 名称 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "名称")] + public string Name { get; set; } - /// - /// 备注 - /// - [SugarColumn(ColumnDescription = "备注")] - public string Remark { get; set; } + /// + /// 备注 + /// + [SugarColumn(IsNullable = true, ColumnDescription = "备注")] + public string Remark { get; set; } - /// - /// 是否默认分组 - /// - [SugarColumn(ColumnDescription = "是否默认分组", ColumnDataType = "bit", DefaultValue = "1")] - public bool IsDefault { get; set; } = true; + /// + /// 是否默认分组 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "是否默认分组", ColumnDataType = "bit", DefaultValue = "1")] + public bool IsDefault { get; set; } = true; - /// - /// 是否可编辑 - /// - [SugarColumn(ColumnDescription = "是否可编辑", ColumnDataType = "bit", DefaultValue = "1")] - public bool Editable { get; set; } = true; + /// + /// 是否可编辑 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "是否可编辑", ColumnDataType = "bit", DefaultValue = "1")] + public bool Editable { get; set; } = true; - - public string TenantId { get; set; } - } + [SugarColumn(IsNullable = true)] + public string TenantId { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs index 39b143e6..d3207d59 100644 --- a/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs @@ -1,7 +1,9 @@ -using SqlSugar; +using Microsoft.Extensions.DependencyInjection; +using SqlSugar; namespace Dlhis.Entity.Basic.Entity { + [SkipScan] [SugarTable(TableName = "GainfoSap")] public class GainfoSapEntity { @@ -11,6 +13,7 @@ namespace Dlhis.Entity.Basic.Entity public string @class { get; set; } public string passwd { get; set; } + public string question { get; set; } public string answer { get; set; } @@ -25,6 +28,7 @@ namespace Dlhis.Entity.Basic.Entity public string sex { get; set; } public DateTime birthday { get; set; } public string address { get; set; } + public string postcode { get; set; } public string occupation { get; set; } public string appellation { get; set; } @@ -33,16 +37,24 @@ namespace Dlhis.Entity.Basic.Entity public string fax { get; set; } public string mobile { get; set; } public string email { get; set; } + public string web { get; set; } + public string vip { get; set; } + public string sec { get; set; } + public string cropsno { get; set; } + public string cropname { get; set; } + public string fancy { get; set; } public string remark { get; set; } public int amount { get; set; } + public int days { get; set; } + public decimal consume01 { get; set; } public decimal consume02 { get; set; } @@ -90,12 +102,17 @@ namespace Dlhis.Entity.Basic.Entity public string MASSN { get; set; } public string MNTXT { get; set; } + public string MASSG { get; set; } + public string MGTXT { get; set; } public DateTime? logdate { get; set; } + public DateTime? updatelogdate { get; set; } + public string guestno { get; set; } public string ZZ_KLX { get; set; } + public DateTime? DAT01 { get; set; } public string ZZ_COUNNM { get; set; } diff --git a/Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs b/Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs index d275d96d..01c21c42 100644 --- a/Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs @@ -17,7 +17,7 @@ public class WerkEntity : SugarBaseEntity /// /// 名称 /// - [SugarColumn(IsNullable = false, ColumnDescription = "名称")] + [SugarColumn(ColumnDescription = "名称")] public string Name { get; set; } /// @@ -53,12 +53,12 @@ public class WerkEntity : SugarBaseEntity /// /// 结果 /// - [SugarColumn(IsNullable = false, ColumnDescription = "结果")] + [SugarColumn(IsNullable = true, ColumnDescription = "结果")] public string HandleMessage { get; set; } /// /// 是否启用 /// - [SugarColumn(ColumnDataType = "bit", DefaultValue = "1")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", DefaultValue = "1")] public bool Enable { get; set; } -} +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/BalanceRecordEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/BalanceRecordEntity.cs index a3fdedda..ed889f1a 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/BalanceRecordEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/BalanceRecordEntity.cs @@ -15,138 +15,140 @@ public class BalanceRecordEntity : SugarBaseEntity, ISoftDeleted, ITenantId /// /// 流水号 /// - [SugarColumn(ColumnDescription = "流水号", UniqueGroupNameList = new[] { "Unique_BalanceRecord_No" })] + [SugarColumn(IsNullable = false, ColumnDescription = "流水号", UniqueGroupNameList = new[] { "Unique_BalanceRecord_No" })] public string No { get; set; } /// /// 档案号/QRCode /// - [SugarColumn(ColumnDescription = "档案号/QRCode")] + [SugarColumn(IsNullable = false, ColumnDescription = "档案号/QRCode")] public string UserNo { get; set; } /// /// 姓名 /// - [SugarColumn(ColumnDescription = "姓名")] + [SugarColumn(IsNullable = false, ColumnDescription = "姓名")] public string Name { get; set; } /// /// 学工号 /// - [SugarColumn(ColumnDescription = "学工号")] + [SugarColumn(IsNullable = false, ColumnDescription = "学工号")] public string UserCode { get; set; } /// /// 部门号 /// - [SugarColumn(ColumnDescription = "部门号")] + [SugarColumn(IsNullable = true, ColumnDescription = "部门号")] public string DepartmentNo { get; set; } /// /// 来源 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "来源")] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "来源")] public BalanceRecordSourceEnumType Source { get; set; } /// /// 收入/支出 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "收入/支出")] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "收入/支出")] public BalanceRecordTypeEnumType Type { get; set; } /// /// 金额 + - 表示 /// - [SugarColumn(ColumnDescription = "金额+-表示")] + [SugarColumn(IsNullable = false, ColumnDescription = "金额+-表示")] public decimal Amount { get; set; } /// /// 营业点 /// - [SugarColumn(ColumnDescription = "营业点", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "营业点")] public Guid? BusinessPlaceCode { get; set; } /// /// 餐别 /// - [SugarColumn(ColumnDescription = "餐别", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "餐别")] public Guid? BusinessShiftCode { get; set; } /// /// 餐次 /// - [SugarColumn(ColumnDescription = "餐次", ColumnDataType = "varchar(50)", IsNullable = true, SqlParameterDbType = typeof(EnumToStringConvert))] + [SugarColumn(IsNullable = true, ColumnDescription = "餐次", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] public ShiftEnumType? ShiftType { get; set; } /// /// 所属成本日期 /// - [SugarColumn(ColumnDataType = "date", ColumnDescription = "所属成本日期")] + [SugarColumn(IsNullable = false, ColumnDataType = "date", ColumnDescription = "所属成本日期")] public DateTime CostDate { get; set; } /// /// 消费机器唯一信息 /// - [SugarColumn(ColumnDescription = "消费机器唯一信息", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "消费机器唯一信息")] public string DeviceUniqueNo { get; set; } /// /// Ip /// - [SugarColumn(ColumnDescription = "IP")] + [SugarColumn(IsNullable = true, ColumnDescription = "IP")] public string IP { get; set; } /// /// 成本中心 /// - [SugarColumn(ColumnDescription = "成本中心")] + [SugarColumn(IsNullable = true, ColumnDescription = "成本中心")] public string CostId { get; set; } /// /// 消费者所在基地 /// - [SugarColumn(ColumnDescription = "消费者所在基地")] + [SugarColumn(IsNullable = false, ColumnDescription = "消费者所在基地")] public string OriginTenantId { get; set; } /// /// 成本计算是否允许跨基地范围 /// - [SugarColumn(ColumnDataType = "bit", ColumnDescription = "成本计算是否允许跨基地范围")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "成本计算是否允许跨基地范围")] public bool IsCostCrossTenant { get; set; } /// /// 数据状态 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "数据状态")] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "数据状态")] public BalanceRecordStatusEnumType Status { get; set; } /// /// 消费时间 /// - [SugarColumn(ColumnDescription = "消费时间")] + [SugarColumn(IsNullable = false, ColumnDescription = "消费时间")] public DateTime CostDateTime { get; set; } /// /// 备注 /// - [SugarColumn(ColumnDescription = "备注")] + [SugarColumn(IsNullable = true, ColumnDescription = "备注")] public string Remark { get; set; } /// /// 餐饮应用类型 /// - [SugarColumn(ColumnDescription = "餐饮应用类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + [SugarColumn(IsNullable = false, ColumnDescription = "餐饮应用类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] public CanteenApplicationTypeEnumType ApplicationType { get; set; } + [SugarColumn(IsNullable = false)] public string TenantId { get; set; } /// /// 人事范围 /// + [SugarColumn(IsNullable = true)] public string Werks { get; set; } - [SugarColumn(ColumnDataType = "bit")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit")] public bool IsDeleted { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/CanteenOrderEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/CanteenOrderEntity.cs index 4394049f..a9aa1fbc 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/CanteenOrderEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/CanteenOrderEntity.cs @@ -13,36 +13,36 @@ public class CanteenOrderEntity : BalanceRecordEntity /// /// 请求json /// - [SugarColumn(ColumnDescription = "请求json",ColumnDataType = "varchar(2000)")] + [SugarColumn(IsNullable = true, ColumnDescription = "请求json", ColumnDataType = "varchar(2000)")] public string RequestJson { get; set; } /// /// 第三方订单号 /// - [SugarColumn(ColumnDescription = "第三方订单号")] + [SugarColumn(IsNullable = true,ColumnDescription = "第三方订单号")] public string ThirdNo { get; set; } /// /// 订单状态 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "订单状态")] + [SugarColumn(IsNullable = false,ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "订单状态")] public CanteenOrderStatusEnumType OrderStatus { get; set; } /// /// 是否离线数据 /// - [SugarColumn(ColumnDataType = "bit", ColumnDescription = "请求json")] + [SugarColumn(IsNullable = false,ColumnDataType = "bit", ColumnDescription = "请求json")] public bool IsOffline { get; set; } /// /// 配送地址 /// - [SugarColumn(ColumnDescription = "配送地址")] + [SugarColumn(IsNullable = true,ColumnDescription = "配送地址")] public string DeliveryAddress { get; set; } /// /// 处理结果 /// - [SugarColumn(ColumnDescription = "处理结果")] + [SugarColumn(IsNullable = true,ColumnDescription = "处理结果")] public string Result { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/DishesCategoryEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/DishesCategoryEntity.cs index 1e980a86..13e2955e 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/DishesCategoryEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/DishesCategoryEntity.cs @@ -16,6 +16,7 @@ public class DishesCategoryEntity : SugarBaseEntity, ITenantId /// /// PCode /// + [SugarColumn(IsNullable = true)] public Guid? PCode { get; set; } /// @@ -38,4 +39,4 @@ public class DishesCategoryEntity : SugarBaseEntity, ITenantId public string TenantId { get; set; } -} +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherDetailEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherDetailEntity.cs index f353f4e7..52816945 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherDetailEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherDetailEntity.cs @@ -13,70 +13,70 @@ public class EMealVoucherDetailEntity : SugarBaseEntity, IVersion /// /// 主表id /// - [SugarColumn(ColumnDescription = "主表id")] + [SugarColumn(IsNullable = false, ColumnDescription = "主表id")] public long VoucherId { get; set; } /// /// 流水号 /// - [SugarColumn(ColumnDescription = "流水号", UniqueGroupNameList = new[] { "idx_EMealVoucherDetail_no_idno" })] + [SugarColumn(IsNullable = false, ColumnDescription = "流水号", UniqueGroupNameList = new[] { "idx_EMealVoucherDetail_no_idno" })] public string No { get; set; } /// /// 人员类型 /// - [SugarColumn(ColumnDescription = "人员类型(新员工/外来人员)")] + [SugarColumn(IsNullable = false, ColumnDescription = "人员类型(新员工/外来人员)")] public string UserType { get; set; } /// /// 身份证 /// - [SugarColumn(ColumnDescription = "证件号", UniqueGroupNameList = new[] { "idx_EMealVoucherDetail_no_idno" })] + [SugarColumn(IsNullable = false, ColumnDescription = "证件号", UniqueGroupNameList = new[] { "idx_EMealVoucherDetail_no_idno" })] public string IdNo { get; set; } /// /// 用餐人 /// - [SugarColumn(ColumnDescription = "用餐人")] + [SugarColumn(IsNullable = false, ColumnDescription = "用餐人")] public string Name { get; set; } /// /// 手机号 /// - [SugarColumn(ColumnDescription = "手机号")] + [SugarColumn(IsNullable = false, ColumnDescription = "手机号")] public string Phone { get; set; } /// /// 就餐开始 /// - [SugarColumn(ColumnDescription = "使用开始", ColumnDataType = "date")] + [SugarColumn(IsNullable = false, ColumnDescription = "使用开始", ColumnDataType = "date")] public DateTime Start { get; set; } /// /// 就餐结束 /// - [SugarColumn(ColumnDescription = "使用结束", ColumnDataType = "date")] + [SugarColumn(IsNullable = false, ColumnDescription = "使用结束", ColumnDataType = "date")] public DateTime End { get; set; } /// /// 金额 /// - [SugarColumn(ColumnDescription = "余额", ColumnDataType = "decimal(16,2)")] + [SugarColumn(IsNullable = false, ColumnDescription = "余额", ColumnDataType = "decimal(16,2)")] public decimal Balance { get; set; } - + /// /// 金额 /// - [SugarColumn(ColumnDescription = "原始余额", ColumnDataType = "decimal(16,2)")] + [SugarColumn(IsNullable = false, ColumnDescription = "原始余额", ColumnDataType = "decimal(16,2)")] public decimal OriginBalance { get; set; } /// /// 版本 /// - [SugarColumn(ColumnDescription = "版本")] + [SugarColumn(IsNullable = false, ColumnDescription = "版本")] public int Version { get; set; } - [SugarColumn(ColumnDataType = "varchar(255)")] + [SugarColumn(IsNullable = true, ColumnDataType = "varchar(255)")] public string Signature { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherEntity.cs index c13e7ed1..e015507c 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherEntity.cs @@ -13,72 +13,72 @@ public class EMealVoucherEntity : SugarBaseEntity /// /// oa流程id /// - [SugarColumn(ColumnDescription = "oa流程id", UniqueGroupNameList = new[] { "index_EMealVoucher_No" })] + [SugarColumn(IsNullable = false, ColumnDescription = "oa流程id", UniqueGroupNameList = new[] { "index_EMealVoucher_No" })] public string No { get; set; } /// /// 标题 /// - [SugarColumn(ColumnDescription = "标题")] + [SugarColumn(IsNullable = false, ColumnDescription = "标题")] public string Title { get; set; } /// /// 申请人工号 /// - [SugarColumn(ColumnDescription = "申请人工号", IndexGroupNameList = new[] { "index_EMealVoucher_Code" })] + [SugarColumn(IsNullable = false, ColumnDescription = "申请人工号", IndexGroupNameList = new[] { "index_EMealVoucher_Code" })] public string Code { get; set; } /// /// 成本中心 /// - [SugarColumn(ColumnDescription = "成本中心")] + [SugarColumn(IsNullable = false, ColumnDescription = "成本中心")] public string CostId { get; set; } /// /// 来宾公司 /// - [SugarColumn(ColumnDescription = "来宾来源")] + [SugarColumn(IsNullable = false, ColumnDescription = "来宾来源")] public string Source { get; set; } /// /// 联系人 /// - [SugarColumn(ColumnDescription = "手机号")] + [SugarColumn(IsNullable = false, ColumnDescription = "手机号")] public string Phone { get; set; } /// /// 来宾人数 /// - [SugarColumn(ColumnDescription = "来宾人数")] + [SugarColumn(IsNullable = false, ColumnDescription = "来宾人数")] public int Number { get; set; } /// /// 就餐事由 /// - [SugarColumn(ColumnDescription = "申请事由")] + [SugarColumn(IsNullable = false, ColumnDescription = "申请事由")] public string Reason { get; set; } /// /// 就餐次 /// - [SugarColumn(ColumnDescription = "就餐次", ColumnDataType = "varchar(500)", IsJson = true)] + [SugarColumn(IsNullable = false, ColumnDescription = "就餐次", ColumnDataType = "varchar(500)", IsJson = true)] public List Shifts { get; set; } /// /// 可消费厂区 /// - [SugarColumn(ColumnDescription = "可消费厂区", ColumnDataType = "varchar(500)", IsJson = true)] + [SugarColumn(IsNullable = false, ColumnDescription = "可消费厂区", ColumnDataType = "varchar(500)", IsJson = true)] public List Factories { get; set; } /// /// 申请日期 /// - [SugarColumn(ColumnDescription = "申请日期")] + [SugarColumn(IsNullable = false, ColumnDescription = "申请日期")] public DateTime Date { get; set; } /// /// 厂区 /// - [SugarColumn(ColumnDescription = "厂区")] + [SugarColumn(IsNullable = false, ColumnDescription = "厂区")] public string Factory { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/MealSupplementRecordEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/MealSupplementRecordEntity.cs index 9292d21c..dfa72a6e 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/MealSupplementRecordEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/MealSupplementRecordEntity.cs @@ -26,23 +26,22 @@ public class MealSupplementRecordEntity : MealSupplementRequestRecordEntity /// /// 餐补状态 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] public MealSupplementStatusEnumtype Status { get; set; } /// /// 处理结果 /// - [SugarColumn(ColumnDescription = "处理结果", ColumnDataType = "varchar(2000)")] + [SugarColumn(IsNullable = true, ColumnDescription = "处理结果", ColumnDataType = "varchar(2000)")] public string Result { get; set; } /// /// 状态同步 /// - [SugarColumn(ColumnDataType = "bit")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit")] public bool Sync { get; set; } } - /// /// 餐补请求记录 /// @@ -78,4 +77,4 @@ public class MealSupplementRequestRecordEntity : SugarBaseEntity /// [SugarColumn(IsNullable = false, ColumnDescription = "餐补")] public decimal Amount { get; set; } -} +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/UserBalanceEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/UserBalanceEntity.cs index fe4196ec..1f897d8a 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/UserBalanceEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/UserBalanceEntity.cs @@ -22,6 +22,7 @@ public class UserBalanceEntity : SugarBaseEntity, IVersion [SugarColumn(IsNullable = false, ColumnDescription = "余额")] public decimal Balance { get; set; } - /// + + [SugarColumn(IsNullable = false)] public int Version { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Common/FileVersionEntity.cs b/Src/Dlhis.Entity/Common/FileVersionEntity.cs index 30699d36..006656ca 100644 --- a/Src/Dlhis.Entity/Common/FileVersionEntity.cs +++ b/Src/Dlhis.Entity/Common/FileVersionEntity.cs @@ -30,7 +30,7 @@ public class FileVersionEntity : SugarBaseEntity /// /// 描述信息 /// - [SugarColumn(ColumnDescription = "描述信息")] + [SugarColumn(IsNullable = false, ColumnDescription = "描述信息")] public string Description { get; set; } /// @@ -38,6 +38,4 @@ public class FileVersionEntity : SugarBaseEntity /// [SugarColumn(IsNullable = false, ColumnDescription = "文件地址")] public string Url { get; set; } -} - - +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs index 7aa96cba..16e6c55f 100644 --- a/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs +++ b/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs @@ -23,7 +23,7 @@ public class DeviceGroupEntity : SugarBaseEntity, ITenantId, ISoftDeleted /// /// 上级设备组code /// - [SugarColumn(ColumnDescription = "上级设备组code")] + [SugarColumn(IsNullable = true, ColumnDescription = "上级设备组code")] public Guid? PCode { get; set; } /// @@ -37,20 +37,20 @@ public class DeviceGroupEntity : SugarBaseEntity, ITenantId, ISoftDeleted /// /// 设备组名称 /// - [SugarColumn(ColumnDescription = "设备组名称")] + [SugarColumn(IsNullable = false, ColumnDescription = "设备组名称")] public string Name { get; set; } /// /// 是否可编辑 /// - [SugarColumn(ColumnDataType = "bit", DefaultValue = "1", ColumnDescription = "是否可编辑")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", DefaultValue = "1", ColumnDescription = "是否可编辑")] public bool Editable { get; set; } = true; /// /// 可设置下级 /// - [SugarColumn(ColumnDataType = "bit", DefaultValue = "1")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", DefaultValue = "1")] public bool AbleSetNext { get; set; } = true; /// @@ -62,16 +62,17 @@ public class DeviceGroupEntity : SugarBaseEntity, ITenantId, ISoftDeleted /// /// 可作为预约分组 /// - [SugarColumn(ColumnDataType = "bit", DefaultValue = "0")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", DefaultValue = "0")] public bool AsAppointment { get; set; } = false; /// /// 是否为出差分组 /// - [SugarColumn(ColumnDataType = "bit", DefaultValue = "0")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", DefaultValue = "0")] public bool IsBusinessTrip { get; set; } = false; + [SugarColumn(IsNullable = true)] public string TenantId { get; set; } diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs index 79ca66e0..41d69385 100644 --- a/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs +++ b/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs @@ -15,7 +15,7 @@ public class DeviceTaskEntity : SugarBaseEntity, ITenantId, IVersion /// /// 任务类型 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), IndexGroupNameList = new[] { "idx_DeviceTask_Type" })] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), IndexGroupNameList = new[] { "idx_DeviceTask_Type" })] public DeviceTaskEnumType Type { get; set; } /// @@ -44,27 +44,22 @@ public class DeviceTaskEntity : SugarBaseEntity, ITenantId, IVersion /// /// 任务下发状态 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), IndexGroupNameList = new[] { "idx_DeviceTask_Status" })] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), IndexGroupNameList = new[] { "idx_DeviceTask_Status" })] public DeviceTaskStatusEnumType Status { get; set; } /// /// 数据版本 /// + [SugarColumn(IsNullable = false)] public int Version { get; set; } /// /// 处理结果 /// - [SugarColumn(ColumnDataType = "longtext")] + [SugarColumn(IsNullable = true, ColumnDataType = "longtext")] public string ResultMessage { get; set; } - /// - /// 取消id - /// - [SugarColumn(DefaultValue = "0")] - public long CancellationId { get; set; } = 0; - /// /// 任务来源 /// @@ -74,7 +69,7 @@ public class DeviceTaskEntity : SugarBaseEntity, ITenantId, IVersion /// /// 优先级 /// - [SugarColumn(IsNullable = true, DefaultValue = "0")] + [SugarColumn(IsNullable = false, DefaultValue = "0")] public int Priority { get; set; } = 0; diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs index ffa5a474..10471948 100644 --- a/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs +++ b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs @@ -49,6 +49,6 @@ public class DeviceUploadLogEntity : SugarBaseEntity, ITenantId public bool Status { get; set; } - [SugarColumn(IndexGroupNameList = new string[] { "idx_DeviceUploadLog_TenantId" })] + [SugarColumn(IndexGroupNameList = new[] { "idx_DeviceUploadLog_TenantId" })] public string TenantId { get; set; } } diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs new file mode 100644 index 00000000..6be6f3a0 --- /dev/null +++ b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs @@ -0,0 +1,24 @@ +using Kurisu.AspNetCore.DataAccess.Entity; +using Kurisu.AspNetCore.DataAccess.SqlSugar; +using SqlSugar; + +namespace Dlhis.Entity.Device.Entities; + +[SugarTable(TableName = "DeviceUploadLogManually", TableDescription = "设备上传记录")] +public class DeviceUploadLogManuallyEntity : SugarBaseEntity, ITenantId +{ + [SugarColumn(IsNullable = false, IndexGroupNameList = new[] { "idx_DeviceUploadLogManually_deviceNo" })] + public string DeviceNo { get; set; } + + [SugarColumn(IsNullable = false)] + public DateTime Start { get; set; } + + [SugarColumn(IsNullable = false)] + public DateTime End { get; set; } + + [SugarColumn(IsNullable = false, ColumnDataType = "bit")] + public bool IsFinished { get; set; } + + /// + public string TenantId { get; set; } +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/SqlSugarPack.cs b/Src/Dlhis.Entity/SqlSugarPack.cs index 82741972..efc5cd1c 100644 --- a/Src/Dlhis.Entity/SqlSugarPack.cs +++ b/Src/Dlhis.Entity/SqlSugarPack.cs @@ -1,4 +1,5 @@ using Dlhis.Entity.Basic.Entity; +using Dlhis.Entity.Device.Entities; using Kurisu.AspNetCore; using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; @@ -94,7 +95,7 @@ public class SqlSugarPack : BaseAppPack var tables = App.ActiveTypes.Where(x => x.IsDefined(typeof(SugarTable), false)) .Where(x => !x.IsDefined(typeof(SkipScanAttribute), false)) .ToArray(); - + db.Client.DbMaintenance.CreateDatabase(); db.Client.CodeFirst.InitTables(tables); diff --git a/Src/Dlhis.Entity/Sys/Entities/MenuEntity.cs b/Src/Dlhis.Entity/Sys/Entities/MenuEntity.cs index 10a70c6e..dd36c54d 100644 --- a/Src/Dlhis.Entity/Sys/Entities/MenuEntity.cs +++ b/Src/Dlhis.Entity/Sys/Entities/MenuEntity.cs @@ -14,76 +14,76 @@ public class MenuEntity : SugarBaseEntity /// /// code /// - [SugarColumn(ColumnDescription = "code")] + [SugarColumn(IsNullable = false, ColumnDescription = "code")] public string Code { get; set; } /// /// 上级 /// - [SugarColumn(ColumnDescription = "上级")] + [SugarColumn(IsNullable = true, ColumnDescription = "上级")] public string PCode { get; set; } /// /// 标题 /// - [SugarColumn(ColumnDescription = "标题")] + [SugarColumn(IsNullable = false, ColumnDescription = "标题")] public string Title { get; set; } /// /// 名称 /// - [SugarColumn(ColumnDescription = "名称")] + [SugarColumn(IsNullable = false, ColumnDescription = "名称")] public string Name { get; set; } /// /// 图标 /// - [SugarColumn(ColumnDescription = "图标")] + [SugarColumn(IsNullable = true, ColumnDescription = "图标")] public string Icon { get; set; } /// /// 路由地址 /// - [SugarColumn(ColumnDescription = "路由地址")] + [SugarColumn(IsNullable = true, ColumnDescription = "路由地址")] public string Route { get; set; } /// /// 权限标识 /// - [SugarColumn(ColumnDescription = "权限标识")] + [SugarColumn(IsNullable = true, ColumnDescription = "权限标识")] public string Permission { get; set; } /// /// 是否为外链 /// - [SugarColumn(ColumnDescription = "是否为外链")] + [SugarColumn(IsNullable = false, ColumnDescription = "是否为外链")] public bool IsLink { get; set; } /// /// 序号 /// - [SugarColumn(ColumnDescription = "序号")] + [SugarColumn(IsNullable = false, ColumnDescription = "序号")] public int Sequence { get; set; } /// /// 是否可见 /// - [SugarColumn(ColumnDescription = "是否可见")] + [SugarColumn(IsNullable = false, ColumnDescription = "是否可见")] public bool Visible { get; set; } /// /// 菜单类型 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "菜单类型")] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "菜单类型")] public MenuEnumType MenuType { get; set; } /// /// 平台类型 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "平台类型")] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "平台类型")] public PlatformEnumType Platform { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs index bf94af3f..ce162ca4 100644 --- a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs +++ b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs @@ -26,11 +26,13 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity /// /// 证件类型 /// + [SugarColumn(IsNullable = false)] public string IdType { get; set; } /// /// 证件号 /// + [SugarColumn(IsNullable = false)] public string IdNo { get; set; } /// @@ -48,17 +50,19 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity /// /// 车牌 /// - [SugarColumn(ColumnDescription = "车牌")] + [SugarColumn(IsNullable = true, ColumnDescription = "车牌")] public string LicensePlate { get; set; } /// /// 进入门岗 /// + [SugarColumn(IsNullable = false)] public bool IsEnterDoorArea { get; set; } /// /// 预约门禁区域 /// + [SugarColumn(IsNullable = true)] public string ApplyDoorArea { get; set; } /// @@ -76,34 +80,37 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity /// /// 是否进入车间 /// + [SugarColumn(IsNullable = false)] public bool IsEnterWorkplace { get; set; } /// /// 申请车间区域 /// - [SugarColumn(ColumnDescription = "车间区域", IsJson = true, DefaultValue = "[]")] + [SugarColumn(IsNullable = true, ColumnDescription = "车间区域", IsJson = true, DefaultValue = "[]")] public List ApplyWorkplaceAreas { get; set; } /// /// 车间访问开始 /// + [SugarColumn(IsNullable = true)] public DateTime? WorkplaceStart { get; set; } /// /// 车间访问结束 /// + [SugarColumn(IsNullable = true)] public DateTime? WorkplaceEnd { get; set; } /// /// 社保照片url /// - [SugarColumn(ColumnDescription = "社保照片url")] + [SugarColumn(IsNullable = true, ColumnDescription = "社保照片url")] public string ImageUrl { get; set; } /// /// 备注 /// - [SugarColumn(ColumnDescription = "备注")] + [SugarColumn(IsNullable = true, ColumnDescription = "备注")] public string Remark { get; set; } /// @@ -117,7 +124,7 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity /// [SugarColumn(IsNullable = true)] public DateTime? ArrivedTime { get; set; } - + /// /// 强制离场时间 /// diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs index 57b090ee..4b5233dc 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs @@ -79,4 +79,24 @@ public class DeviceUploadLogsController : ControllerBase { return await _deviceUploadLogService.GetDeviceUploadRecordSettingAsync(deviceNo); } + + /// + /// 手动上传考勤记录 + /// + /// + [HttpPost("manuallyUpload")] + public async Task ManuallyUploadAsync(List logIds) + { + await _deviceUploadLogService.ManuallyUploadAsync(logIds); + } + + /// + /// 手动设置上传考勤时间范围 + /// + /// + [HttpPost("manuallySetTimeInfo")] + public async Task ManuallySetTimeInfoAsync(DeviceUploadLogManuallySetTimeInfoRequest request) + { + await _deviceUploadLogService.ManuallySetTimeInfoAsync(request.DeviceNo, request.Start, request.End); + } } \ No newline at end of file diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogManuallySetTimeInfoRequest.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogManuallySetTimeInfoRequest.cs new file mode 100644 index 00000000..884eb2f1 --- /dev/null +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogManuallySetTimeInfoRequest.cs @@ -0,0 +1,22 @@ +using System.ComponentModel.DataAnnotations; + +namespace Dlhis.ScheduledTask.DeviceUploadLog.Request; + +public class DeviceUploadLogManuallySetTimeInfoRequest : IValidatableObject +{ + [Required(ErrorMessage = "设备号不能为空")] + public string DeviceNo { get; set; } + + public DateTime Start { get; set; } + + public DateTime End { get; set; } + + /// + public IEnumerable Validate(ValidationContext validationContext) + { + if (Start >= End) + { + yield return new ValidationResult("开始时间不可大于等于结束时间"); + } + } +} \ No newline at end of file diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/SetUploadLogsBeginDateTimeRequest.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/SetUploadLogsBeginDateTimeRequest.cs deleted file mode 100644 index e5a65b58..00000000 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/SetUploadLogsBeginDateTimeRequest.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Dlhis.ScheduledTask.DeviceUploadLog.Request; - -public class SetUploadLogsBeginDateTimeRequest -{ - /// - /// 设备号不能为空 - /// - [Required(ErrorMessage = "设备号不能为空")] - public string DeviceUniqueNo { get; set; } - - /// - /// 开始时间 - /// - public DateTime Begin { get; set; } -} diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/IDeviceUploadLogService.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/IDeviceUploadLogService.cs index 1f1e9f4b..791e06ee 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/IDeviceUploadLogService.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/IDeviceUploadLogService.cs @@ -13,7 +13,7 @@ public interface IDeviceUploadLogService : IScopeDependency /// /// Task UploadLogsAsync(List requests); - + /// /// 查询通行记录分页 /// @@ -28,13 +28,30 @@ public interface IDeviceUploadLogService : IScopeDependency /// Task> GetMyRecordsAsync(DeviceUploadLogMyRecordRequest request); + Task QiaoqiaoGaoshiqingAsync(DeviceUploadLogSecretAddRequest request); - - + + /// /// 获取设备记录获取的开始-结束时间 /// /// /// Task GetDeviceUploadRecordSettingAsync(string deviceNo); -} + + /// + /// 手动上传考勤记录 + /// + /// + /// + Task ManuallyUploadAsync(List requestIds); + + /// + /// 手动设置获取记录时间范围 + /// + /// + /// + /// + /// + Task ManuallySetTimeInfoAsync(string deviceNo, DateTime start, DateTime end); +} \ 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 df2acb6a..d4b38b00 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs @@ -1,12 +1,13 @@ using Dlhis.Entity.Basic.Entity; using Dlhis.Entity.Device.Entities; using Dlhis.Entity.Device.Enums; +using Dlhis.Jip.Api; +using Dlhis.Jip.Api.Requests; using Dlhis.ScheduledTask.DeviceUploadLog.Request; using Dlhis.ScheduledTask.DeviceUploadLog.Response; using Kurisu.AspNetCore.Authentication.Abstractions; using Kurisu.AspNetCore.CustomClass; using Kurisu.AspNetCore.DataAccess.Dto; -using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; using Kurisu.AspNetCore.Utils.Extensions; using SqlSugar; @@ -17,11 +18,13 @@ public class DeviceUploadLogService : IDeviceUploadLogService { private readonly IDbContext _dbContext; private readonly ICurrentUser _currentUser; + private readonly IJinkoJipApi _jinkoJipApi; - public DeviceUploadLogService(IDbContext dbContext, ICurrentUser currentUser) + public DeviceUploadLogService(IDbContext dbContext, ICurrentUser currentUser, IJinkoJipApi jinkoJipApi) { _dbContext = dbContext; _currentUser = currentUser; + _jinkoJipApi = jinkoJipApi; } public async Task UploadLogsAsync(List requests) @@ -104,6 +107,64 @@ public class DeviceUploadLogService : IDeviceUploadLogService .ToListAsync(); } + /// + public async Task ManuallyUploadAsync(List requestIds) + { + var existsOther = await _dbContext.Queryable() + .Where(x => requestIds.Contains(x.Id)) + .Where(x => x.Type != DeviceUploadLogTypeEnumType.Attendance) + .AnyAsync(); + + existsOther.ThrowIfTrue("存在非考勤通行记录,无法上传"); + + var requests = await _dbContext.Queryable() + .LeftJoin((x, device) => x.DeviceUniqueNo == device.UniqueNo) + .Where(x => x.Sync == false) + .Where(x => !string.IsNullOrEmpty(x.UserUniqueNo)) + .Where(x => SqlFunc.Subqueryable().Where(p => p.Code == x.UserUniqueNo).NotAny()) + .Where(x => requestIds.Contains(x.Id)) + .Select((x, device) => new UploadAttendanceRequestItem + { + Id = x.Id, + RaiseDateTime = x.RaiseDateTime, + ZNOTE = device.DeployPlace, + ZWORKCODE = x.UserUniqueNo + }) + .ToListAsync(); + + if (requests.Any()) + { + foreach (var items in requests.Chunk(500)) + { + var ids = items.Select(x => x.Id).ToList(); + var r = await _jinkoJipApi.UploadAttendancesAsync(new UploadAttendanceRequest { Data = items.ToList() }); + if (r.OLX == "0") + { + await _dbContext.Updateable() + .SetColumns(x => x.Sync == true) + .SetColumns(x => x.ModifiedTime == DateTime.Now) + .Where(x => ids.Contains(x.Id)) + .ExecuteCommandAsync(); + } + } + } + } + + /// + public async Task ManuallySetTimeInfoAsync(string deviceNo, DateTime start, DateTime end) + { + var exists = await _dbContext.Queryable().Where(x => x.DeviceNo == deviceNo).Where(x => x.IsFinished == false).AnyAsync(); + exists.ThrowIfTrue("已存在时间配置尚未完成"); + + await _dbContext.InsertAsync(new DeviceUploadLogManuallyEntity + { + DeviceNo = deviceNo, + Start = start, + End = end, + IsFinished = false + }); + } + public async Task QiaoqiaoGaoshiqingAsync(DeviceUploadLogSecretAddRequest request) { var device = await _dbContext.Queryable().Where(x => x.UniqueNo == request.DeviceUniqueNo).SingleAsync(); @@ -123,7 +184,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService TenantId = device.TenantId, Status = true, CreatedBy = 1, - ModifiedBy = 1, + ModifiedBy = 1 }); } @@ -158,7 +219,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService .LeftJoin((os, x, device) => x.DeviceUniqueNo == device.UniqueNo) .LeftJoin((os, x, device, ga) => os.Code == ga.Code) .LeftJoin((os, x, device, ga, gaSap) => gaSap.Code == os.SapCode) - .WhereIF(request.SearchDateTimePeriod.HasValue(), (os, x) => x.RaiseDateTime >= request.SearchDateTimePeriod.Start + .WhereIF(request.SearchDateTimePeriod.HasValue(), (os, x) => x.RaiseDateTime >= request.SearchDateTimePeriod.Start && x.RaiseDateTime <= request.SearchDateTimePeriod.End) .WhereIF(request.Search.IsPresent(), (os, x, device, ga, gaSap) => x.UserUniqueNo == request.Search @@ -200,7 +261,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService .LeftJoin((x, device, ga) => x.UserUniqueNo == ga.Code) .LeftJoin((x, device, ga, os) => x.UserUniqueNo == os.Code) .LeftJoin((x, device, ga, os, gasap) => gasap.Code == os.SapCode) - .WhereIF(request.SearchDateTimePeriod.HasValue(), x => x.RaiseDateTime >= request.SearchDateTimePeriod.Start + .WhereIF(request.SearchDateTimePeriod.HasValue(), x => x.RaiseDateTime >= request.SearchDateTimePeriod.Start && x.RaiseDateTime <= request.SearchDateTimePeriod.End) .Where((x, device) => x.Type == type && !SqlFunc.IsNullOrEmpty(x.UserUniqueNo)) .WhereIF(request.Sync.HasValue, x => x.Sync == request.Sync) diff --git a/Src/Dlhis.ScheduledTask/Jobs/CreateGetUploadRecordJob.cs b/Src/Dlhis.ScheduledTask/Jobs/CreateGetUploadRecordJob.cs index f43ccec9..433ca81a 100644 --- a/Src/Dlhis.ScheduledTask/Jobs/CreateGetUploadRecordJob.cs +++ b/Src/Dlhis.ScheduledTask/Jobs/CreateGetUploadRecordJob.cs @@ -37,7 +37,6 @@ public class CreateGetUploadRecordJob : BaseJob TenantId = x.TenantId, Version = 0, Type = DeviceTaskEnumType.UploadRecord, - CancellationId = 0, Priority = 50, Source = "定时任务创建设备获取通行记录任务" }).ToList(); diff --git a/Src/Dlhis.ScheduledTask/Properties/launchSettings.json b/Src/Dlhis.ScheduledTask/Properties/launchSettings.json index a6ea1802..93731c83 100644 --- a/Src/Dlhis.ScheduledTask/Properties/launchSettings.json +++ b/Src/Dlhis.ScheduledTask/Properties/launchSettings.json @@ -2,10 +2,12 @@ "profiles": { "Dlhis.ScheduledTask": { "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger/index.html", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, - "applicationUrl": "http://*:5010" + "applicationUrl": "http://localhost:5010;http://*:5010;" } } } \ No newline at end of file diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs index 71a7bcd9..1e147899 100644 --- a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs +++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs @@ -12,7 +12,6 @@ using Newtonsoft.Json.Linq; using Kurisu.AspNetCore.Utils; using Dlhis.ScheduledTask.TaskAssignment.Dto; using Kurisu.AspNetCore.CustomClass; -using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; namespace Dlhis.ScheduledTask.TaskAssignment.Services.Implements; @@ -153,12 +152,13 @@ public class AssignmentService : IAssignmentService case DeviceTaskEnumType.UploadRecord: { + var timeInfo = deviceUploadInfos[d]; dto.Info = new UploadRecordToDeviceResponse { DateTimePeriod = new DateTimePeriod { - Start = deviceUploadInfos.TryGetValue(d, out var dt) ? (dt ?? DateTime.Now) : DateTime.Now, - End = DateTime.Now.AddDays(1) + Start = timeInfo.Item1, + End = timeInfo.Item2 } }; } @@ -328,15 +328,21 @@ public class AssignmentService : IAssignmentService /// /// /// - private async Task> GetDeviceUploadRecordInfosAsync(List data) + private async Task> GetDeviceUploadRecordInfosAsync(List data) { if (data.All(x => x.Type != DeviceTaskEnumType.UploadRecord)) { - return new Dictionary(); + return new Dictionary(); } var deviceNos = data.Select(x => x.DeviceUniqueNo).Distinct().ToList(); - var result = new Dictionary(deviceNos.Count); + var result = new Dictionary(deviceNos.Count); + + var manualSettings = await _dbContext.Queryable().Where(x => deviceNos.Contains(x.DeviceNo)) + .Where(x => x.IsFinished == false) + .OrderBy(x => x.CreateTime) + .Select(x => new { x.Id, x.DeviceNo, x.Start, x.End }) + .ToListAsync(); var logInfos = await _dbContext.Queryable() .GroupBy(x => x.DeviceUniqueNo) @@ -347,12 +353,27 @@ public class AssignmentService : IAssignmentService }) .ToListAsync(); + var commonEnd = DateTime.Now.AddDays(1); foreach (var item in deviceNos) { - var logInfo = logInfos.FirstOrDefault(x => x.DeviceUniqueNo == item); - result.Add(item, logInfo?.RaiseDateTime); + var setting = manualSettings.FirstOrDefault(x => x.DeviceNo == item); + if (setting != null) + { + result.Add(item, (setting.Start, setting.End)); + } + else + { + var logInfo = logInfos.FirstOrDefault(x => x.DeviceUniqueNo == item); + result.Add(item, logInfo == null ? (DateTime.Now.AddMinutes(-10), commonEnd) : (logInfo.RaiseDateTime, commonEnd)); + } } + //更新为已处理 + await _dbContext.Updateable() + .SetColumns(x => x.IsFinished == true) + .Where(x => manualSettings.Select(p => p.Id).Contains(x.Id)) + .ExecuteCommandAsync(); + return result; } From 4ce8672c1ee9290d92160be2a0eaffbaf6bd5da4 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 19 Dec 2024 16:08:56 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat=20=E6=89=8B=E5=8A=A8=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=9D=83=E9=99=90=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DevicePermissionManuallyController.cs | 56 ++++++++++ .../DevicePermissionManuallyAddRequest.cs | 11 ++ .../DevicePermissionManuallyResponse.cs | 11 ++ .../IDevicePermissionManuallyService.cs | 14 +++ .../DevicePermissionManuallyService.cs | 103 ++++++++++++++++++ .../Services/Implements/GainfoService.cs | 2 +- .../Implements/GainfoUpdateService.cs | 2 +- .../DevicePermissionManuallyEntity.cs | 23 ++++ 8 files changed, 220 insertions(+), 2 deletions(-) create mode 100644 Src/Dlhis.Basic/Device/Controllers/DevicePermissionManuallyController.cs create mode 100644 Src/Dlhis.Basic/Device/Request/DevicePermissionManuallyAddRequest.cs create mode 100644 Src/Dlhis.Basic/Device/Response/DevicePermissionManuallyResponse.cs create mode 100644 Src/Dlhis.Basic/Device/Services/IDevicePermissionManuallyService.cs create mode 100644 Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionManuallyService.cs create mode 100644 Src/Dlhis.Entity/Device/Entities/DevicePermissionManuallyEntity.cs diff --git a/Src/Dlhis.Basic/Device/Controllers/DevicePermissionManuallyController.cs b/Src/Dlhis.Basic/Device/Controllers/DevicePermissionManuallyController.cs new file mode 100644 index 00000000..0177d5c5 --- /dev/null +++ b/Src/Dlhis.Basic/Device/Controllers/DevicePermissionManuallyController.cs @@ -0,0 +1,56 @@ +using Dlhis.Basic.Device.Request; +using Dlhis.Basic.Device.Response; +using Dlhis.Basic.Device.Services; +using Kurisu.AspNetCore.DataAccess.Dto; +using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace Dlhis.Basic.Device.Controllers; + +[Authorize] +[Route("api/[controller]")] +[ApiController] +public class DevicePermissionManuallyController : ControllerBase +{ + private readonly IDevicePermissionManuallyService _devicePermissionService; + + public DevicePermissionManuallyController(IDevicePermissionManuallyService devicePermissionService) + { + _devicePermissionService = devicePermissionService; + } + + /// + /// 数据分页 + /// + /// + /// + [HttpGet("page")] + [DataPermission] + public async Task> GetPageAsync([FromQuery] PageDto requestDto) + { + return await _devicePermissionService.GetPageAsync(requestDto); + } + + /// + /// 添加权限 + /// + /// + [HttpPost("add")] + [Transactional] + public async Task AddAsync(DevicePermissionManuallyAddRequest request) + { + await _devicePermissionService.AddAsync(request); + } + + /// + /// 删除权限 + /// + /// + [HttpGet("{id:long}")] + [Transactional] + public async Task DeleteAsync(long id) + { + await _devicePermissionService.DeleteAsync(id); + } +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Device/Request/DevicePermissionManuallyAddRequest.cs b/Src/Dlhis.Basic/Device/Request/DevicePermissionManuallyAddRequest.cs new file mode 100644 index 00000000..2ae23a8e --- /dev/null +++ b/Src/Dlhis.Basic/Device/Request/DevicePermissionManuallyAddRequest.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace Dlhis.Basic.Device.Request; + +public class DevicePermissionManuallyAddRequest +{ + public Guid DeviceCode { get; set; } + + [Required] + public string UserNo { get; set; } +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Device/Response/DevicePermissionManuallyResponse.cs b/Src/Dlhis.Basic/Device/Response/DevicePermissionManuallyResponse.cs new file mode 100644 index 00000000..4ca605e6 --- /dev/null +++ b/Src/Dlhis.Basic/Device/Response/DevicePermissionManuallyResponse.cs @@ -0,0 +1,11 @@ +namespace Dlhis.Basic.Device.Response; + +public class DevicePermissionManuallyResponse +{ + public long Id { get; set; } + public Guid DeviceCode { get; set; } + public string DeviceUniqueNo { get; set; } + public string DeployPlace { get; set; } + public string UserNo { get; set; } + public string UserName { get; set; } +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Device/Services/IDevicePermissionManuallyService.cs b/Src/Dlhis.Basic/Device/Services/IDevicePermissionManuallyService.cs new file mode 100644 index 00000000..e2a6149b --- /dev/null +++ b/Src/Dlhis.Basic/Device/Services/IDevicePermissionManuallyService.cs @@ -0,0 +1,14 @@ +using Dlhis.Basic.Device.Request; +using Dlhis.Basic.Device.Response; +using Kurisu.AspNetCore.DataAccess.Dto; + +namespace Dlhis.Basic.Device.Services; + +public interface IDevicePermissionManuallyService : IScopeDependency +{ + Task> GetPageAsync(PageDto requestDto); + + Task AddAsync(DevicePermissionManuallyAddRequest request); + + Task DeleteAsync(long id); +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionManuallyService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionManuallyService.cs new file mode 100644 index 00000000..9c09542e --- /dev/null +++ b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionManuallyService.cs @@ -0,0 +1,103 @@ +using Dlhis.Basic.Device.Request; +using Dlhis.Basic.Device.Response; +using Dlhis.Entity.Basic.Entity; +using Dlhis.Entity.Device.Entities; +using Dlhis.Entity.Device.Enums; +using Kurisu.AspNetCore.DataAccess.Dto; +using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions; +using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; +using Kurisu.AspNetCore.Utils.Extensions; + +namespace Dlhis.Basic.Device.Services.Implements; + +public class DevicePermissionManuallyService : IDevicePermissionManuallyService +{ + private readonly IDbContext _dbContext; + + public DevicePermissionManuallyService(IDbContext dbContext) + { + _dbContext = dbContext; + } + + /// + public async Task> GetPageAsync(PageDto requestDto) + { + return await _dbContext.Queryable() + .LeftJoin((x, d) => x.DeviceCode == d.Code) + .LeftJoin((x, d, g) => x.UserNo == g.No) + .Select((x, d, g) => new DevicePermissionManuallyResponse + { + Id = x.Id, + DeviceCode = x.DeviceCode, + DeviceUniqueNo = d.UniqueNo, + DeployPlace = d.DeployPlace, + UserNo = x.UserNo, + UserName = g.Name + }) + .ToPageListAsync(requestDto); + } + + /// + public async Task AddAsync(DevicePermissionManuallyAddRequest request) + { + var device = await _dbContext.Queryable().Where(x => x.Code == request.DeviceCode).SingleAsync(); + device.ThrowIfNull("设备不存在"); + + var gainfo = await _dbContext.Queryable().Where(x => x.No == request.UserNo).SingleAsync(); + gainfo.ThrowIfNull("人员不存在"); + + + await _dbContext.InsertAsync(new DevicePermissionManuallyEntity + { + DeviceCode = request.DeviceCode, + UserNo = request.UserNo + }); + + await _dbContext.InsertAsync(new DeviceTaskEntity + { + Type = DeviceTaskEnumType.Add, + DeviceType = device.Type, + UserId = null, + UserNo = request.UserNo, + DeviceUniqueNo = device.UniqueNo, + Status = DeviceTaskStatusEnumType.Wait, + Version = 0, + ResultMessage = null, + Source = "手动分配额外权限", + Priority = 0, + TenantId = device.TenantId + }); + } + + /// + public async Task DeleteAsync(long id) + { + var data = await _dbContext.Queryable().Where(x => x.Id == id).SingleAsync(); + data.ThrowIfNull("数据不存在"); + + var device = await _dbContext.Queryable().Where(x => x.Code == data.DeviceCode).SingleAsync(); + if (device != null) + { + var userNo = await _dbContext.Queryable().Where(x => x.No == data.UserNo).Select(x => x.No).SingleAsync(); + if (userNo.IsPresent()) + { + await _dbContext.InsertAsync(new DeviceTaskEntity + { + Type = DeviceTaskEnumType.Delete, + DeviceType = device.Type, + UserId = null, + UserNo = userNo, + DeviceUniqueNo = device.UniqueNo, + Status = DeviceTaskStatusEnumType.Wait, + Version = 0, + ResultMessage = null, + Source = "手动分配额外权限", + Priority = 0, + TenantId = device.TenantId + }); + } + } + + await _dbContext.DeleteAsync(data); + } +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 144508a2..032787e1 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -256,7 +256,7 @@ public class GainfoService : IGainfoService await _gainfoPermissionService.ResetPermissionsAsync(gainfo.No, DeviceTaskEnumType.Delete, null, request.Reason); - await _dbContext.Deleteable().Where(x => x.UserNo != gainfo.No).ExecuteCommandAsync(); + await _dbContext.Deleteable().Where(x => x.UserNo == gainfo.No).ExecuteCommandAsync(); await _dbContext.Deleteable().Where(x => x.AssignType == AssignTypeEnumType.User && x.AssignValue == gainfo.No).ExecuteCommandAsync(); //先写入离职表 diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs index 0f467016..50a410a9 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs @@ -302,7 +302,7 @@ public class GainfoUpdateService : IGainfoUpdateService await _dbContext.Client.Insertable(gainfo).AS("GainfoLeave").ExecuteCommandAsync(); } - await _dbContext.Deleteable().Where(x => x.UserNo != gainfo.No).ExecuteCommandAsync(); + await _dbContext.Deleteable().Where(x => x.UserNo == gainfo.No).ExecuteCommandAsync(); await _dbContext.Deleteable().Where(x => x.AssignType == AssignTypeEnumType.User && x.AssignValue == gainfo.No).ExecuteCommandAsync(); gainfo.Id = gainfo.IdentityUserId; diff --git a/Src/Dlhis.Entity/Device/Entities/DevicePermissionManuallyEntity.cs b/Src/Dlhis.Entity/Device/Entities/DevicePermissionManuallyEntity.cs new file mode 100644 index 00000000..e61a1f73 --- /dev/null +++ b/Src/Dlhis.Entity/Device/Entities/DevicePermissionManuallyEntity.cs @@ -0,0 +1,23 @@ +using Dlhis.DataPermission.Model; +using Kurisu.AspNetCore.DataAccess.Entity; +using Kurisu.AspNetCore.DataAccess.SqlSugar; +using SqlSugar; + +namespace Dlhis.Entity.Device.Entities; + +/// +/// 设备权限(手动) +/// +[SugarTable(TableName = "DevicePermissionManually")] +public class DevicePermissionManuallyEntity : SugarBaseEntity, ISoftDeleted +{ + [DeviceCode] + [SugarColumn(IsNullable = false)] + public Guid DeviceCode { get; set; } + + [SugarColumn(IsNullable = false)] + public string UserNo { get; set; } + + /// + public bool IsDeleted { get; set; } +} \ No newline at end of file From 0f69c56a93f441e2162c40d30040e2eca090a5fc Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 19 Dec 2024 15:21:45 +0800 Subject: [PATCH 3/9] =?UTF-8?q?feat=20=E6=89=8B=E5=8A=A8=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?,=E6=89=8B=E5=8A=A8=E8=AE=BE=E7=BD=AE=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E8=8C=83=E5=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/AppointmentAreaService.cs | 2 - .../BasePermissionAnalyzeService.cs | 2 - .../Services/Implements/DeviceGroupService.cs | 2 - .../DevicePermissionAnalyzeService.cs | 1 - .../Implements/DevicePermissionService.cs | 4 - .../Implements/DeviceTimePeriodService.cs | 4 +- .../Services/Implements/GainfoGroupService.cs | 2 - .../Services/Implements/GainfoService.cs | 1 - Src/Dlhis.Basic/appsettings.Development.json | 2 +- .../BusinessPlaceManagerRelationshipEntity.cs | 7 +- .../Basic/Entity/DepartmentEntity.cs | 6 +- Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs | 157 +++++++++--------- Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs | 52 +++--- .../Basic/Entity/GainfoGroupEntity.cs | 74 ++++----- .../Basic/Entity/GainfoSapEntity.cs | 19 ++- Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs | 8 +- .../Canteen/Entities/BalanceRecordEntity.cs | 46 ++--- .../Canteen/Entities/CanteenOrderEntity.cs | 12 +- .../Canteen/Entities/DishesCategoryEntity.cs | 3 +- .../Entities/EMealVoucherDetailEntity.cs | 26 +-- .../Canteen/Entities/EMealVoucherEntity.cs | 24 +-- .../Entities/MealSupplementRecordEntity.cs | 9 +- .../Canteen/Entities/UserBalanceEntity.cs | 3 +- Src/Dlhis.Entity/Common/FileVersionEntity.cs | 6 +- .../Device/Entities/DeviceGroupEntity.cs | 13 +- .../Device/Entities/DeviceTaskEntity.cs | 15 +- .../Device/Entities/DeviceUploadLogEntity.cs | 2 +- .../Entities/DeviceUploadLogManuallyEntity.cs | 24 +++ Src/Dlhis.Entity/SqlSugarPack.cs | 3 +- Src/Dlhis.Entity/Sys/Entities/MenuEntity.cs | 24 +-- .../Entity/VisitorAppointmentDetailEntity.cs | 17 +- .../Controllers/DeviceUploadLogsController.cs | 20 +++ ...viceUploadLogManuallySetTimeInfoRequest.cs | 22 +++ .../SetUploadLogsBeginDateTimeRequest.cs | 17 -- .../Services/IDeviceUploadLogService.cs | 25 ++- .../Implements/DeviceUploadLogService.cs | 66 +++++++- .../Jobs/CreateGetUploadRecordJob.cs | 1 - .../Properties/launchSettings.json | 4 +- .../Services/Implements/AssignmentService.cs | 37 ++++- 39 files changed, 458 insertions(+), 304 deletions(-) create mode 100644 Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs create mode 100644 Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogManuallySetTimeInfoRequest.cs delete mode 100644 Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/SetUploadLogsBeginDateTimeRequest.cs diff --git a/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs b/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs index 34fd9041..aad83490 100644 --- a/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs +++ b/Src/Dlhis.Basic/Appointment/Services/Implements/AppointmentAreaService.cs @@ -108,7 +108,6 @@ public class AppointmentAreaService : IAppointmentAreaService DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo, Status = DeviceTaskStatusEnumType.Wait, Version = 0, - CancellationId = 0, Source = "预约区域和设备组关系变更生成", Priority = 99 })); @@ -121,7 +120,6 @@ public class AppointmentAreaService : IAppointmentAreaService DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo, Status = DeviceTaskStatusEnumType.Wait, Version = 0, - CancellationId = 0, Source = "预约区域和设备组关系变更生成", Priority = 99 })); diff --git a/Src/Dlhis.Basic/Device/Services/Implements/BasePermissionAnalyzeService.cs b/Src/Dlhis.Basic/Device/Services/Implements/BasePermissionAnalyzeService.cs index 004cd6c5..3ec41f3b 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/BasePermissionAnalyzeService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/BasePermissionAnalyzeService.cs @@ -83,7 +83,6 @@ public abstract class BasePermissionAnalyzeService : IPermissionAnalyzeService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = source, Priority = 0, TenantId = x.TenantId, @@ -99,7 +98,6 @@ public abstract class BasePermissionAnalyzeService : IPermissionAnalyzeService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = source, Priority = 0, TenantId = x.TenantId, diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs index 24781f2f..e35a2b9f 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DeviceGroupService.cs @@ -225,7 +225,6 @@ public class DeviceGroupService : IDeviceGroupService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "人员分组分配", Priority = 0, TenantId = x.TenantId @@ -259,7 +258,6 @@ public class DeviceGroupService : IDeviceGroupService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "人员分组分配", Priority = 0, TenantId = x.TenantId, diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionAnalyzeService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionAnalyzeService.cs index 85b0ef7e..833f0f32 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionAnalyzeService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionAnalyzeService.cs @@ -125,7 +125,6 @@ public class DevicePermissionAnalyzeService : IDevicePermissionAnalyzeService DeviceUniqueNo = devices.First(item => item.Code == x).UniqueNo, Status = DeviceTaskStatusEnumType.Wait, Type = DeviceTaskEnumType.Delete, - CancellationId = 0, DeviceType = devices.First(item => item.Code == x).Type, UserNo = userNo, Version = 0, diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs index c26d00f0..f42217ae 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs @@ -101,7 +101,6 @@ public class DevicePermissionService : IDevicePermissionService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "人员分配到设备unique", Priority = 0, TenantId = currentTenantId, @@ -129,7 +128,6 @@ public class DevicePermissionService : IDevicePermissionService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 20, Source = "人员分配到设备unique", Priority = 0, TenantId = currentTenantId @@ -207,7 +205,6 @@ public class DevicePermissionService : IDevicePermissionService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "人员分配到设备import", Priority = 0, TenantId = device.TenantId, @@ -423,7 +420,6 @@ public class DevicePermissionService : IDevicePermissionService Type = taskType, DeviceType = x.Type, UserNo = userNo, - CancellationId = 0, Priority = 0, Version = 0, TenantId = x.TenantId, diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DeviceTimePeriodService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DeviceTimePeriodService.cs index 0f16b0f6..71997067 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DeviceTimePeriodService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DeviceTimePeriodService.cs @@ -158,7 +158,6 @@ public class DeviceTimePeriodService : IDeviceTimePeriodService DeviceUniqueNo = deviceUniqueNo, Status = DeviceTaskStatusEnumType.Wait, Version = 0, - CancellationId = 0, Source = source, Priority = 90, TenantId = device.TenantId @@ -191,7 +190,6 @@ public class DeviceTimePeriodService : IDeviceTimePeriodService DeviceUniqueNo = deviceUniqueNo, Status = DeviceTaskStatusEnumType.Wait, Version = 0, - CancellationId = 0, Source = source, Priority = 90, TenantId = device.TenantId @@ -213,7 +211,7 @@ public class DeviceTimePeriodService : IDeviceTimePeriodService var devices = await _dbContext.Queryable() .Where(x => !SqlFunc.IsNullOrEmpty(x.TemplateCode)) - .Where(x => templateCodes.Contains(x.TemplateCode.Value) || deviceCodes.Contains(x.Code)) + .Where(x => templateCodes.Contains(x.TemplateCode) || deviceCodes.Contains(x.Code)) .Where(x => x.Enable && x.EnableTimePeriod) .ToListAsync(); diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs index 071b8647..6a302996 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoGroupService.cs @@ -189,7 +189,6 @@ public class GainfoGroupService : IGainfoGroupService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "手动操作人员分组关系", Priority = 0, TenantId = device.TenantId @@ -209,7 +208,6 @@ public class GainfoGroupService : IGainfoGroupService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "手动操作人员分组关系", Priority = 0, TenantId = device.TenantId diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 5afbccef..032787e1 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -305,7 +305,6 @@ public class GainfoService : IGainfoService Status = DeviceTaskStatusEnumType.Wait, Version = 0, ResultMessage = null, - CancellationId = 0, Source = "安全级别提高", Priority = 60, TenantId = x.TenantId diff --git a/Src/Dlhis.Basic/appsettings.Development.json b/Src/Dlhis.Basic/appsettings.Development.json index 47d1cb6f..c22992e5 100644 --- a/Src/Dlhis.Basic/appsettings.Development.json +++ b/Src/Dlhis.Basic/appsettings.Development.json @@ -22,7 +22,7 @@ "Timeout": 30, "SlowSqlTime": 1, "EnableSqlLog": true, - "Generate": false + "Generate": true }, "SwaggerOptions": { "Enable": true, diff --git a/Src/Dlhis.Entity/Basic/Entity/BusinessPlaceManagerRelationshipEntity.cs b/Src/Dlhis.Entity/Basic/Entity/BusinessPlaceManagerRelationshipEntity.cs index 45694dc3..4ac9f3f8 100644 --- a/Src/Dlhis.Entity/Basic/Entity/BusinessPlaceManagerRelationshipEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/BusinessPlaceManagerRelationshipEntity.cs @@ -15,16 +15,15 @@ public class BusinessPlaceManagerRelationshipEntity : SugarBaseEntity , ITenantI /// 管理人员 /// [AdaptIgnore(MemberSide.Destination)] - [SugarColumn(ColumnDescription = "管理人员", IsNullable = false)] + [SugarColumn(IsNullable = false, ColumnDescription = "管理人员")] public int ManagerUserId { get; set; } /// /// 营业点 /// - [SugarColumn(ColumnDescription = "营业点", IsNullable = false)] + [SugarColumn(IsNullable = false, ColumnDescription = "营业点")] public Guid BusinessPlaceCode { get; set; } - /// public string TenantId { get; set; } -} +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/Basic/Entity/DepartmentEntity.cs b/Src/Dlhis.Entity/Basic/Entity/DepartmentEntity.cs index 11db4561..270793d5 100644 --- a/Src/Dlhis.Entity/Basic/Entity/DepartmentEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/DepartmentEntity.cs @@ -12,19 +12,19 @@ namespace Dlhis.Entity.Basic.Entity /// /// 部门号 /// - [SugarColumn(ColumnDescription = "部门号", IsNullable = false, UniqueGroupNameList = new[] { "idx_Department_No" })] + [SugarColumn(IsNullable = false, ColumnDescription = "部门号", UniqueGroupNameList = new[] { "idx_Department_No" })] public string No { get; set; } /// /// 上级部门号 /// - [SugarColumn(ColumnDescription = "上级部门号")] + [SugarColumn(IsNullable = true, ColumnDescription = "上级部门号")] public string PNo { get; set; } /// /// 部门名称 /// - [SugarColumn(ColumnDescription = "部门名称", IsNullable = false)] + [SugarColumn(IsNullable = false, ColumnDescription = "部门名称")] public string Name { get; set; } } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs b/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs index 44bde49a..2a73f65f 100644 --- a/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/DeviceEntity.cs @@ -6,102 +6,101 @@ using Mapster; using SqlSugar; using SqlSugar.DbConvert; -namespace Dlhis.Entity.Basic.Entity +namespace Dlhis.Entity.Basic.Entity; + +/// +/// 设备 +/// +[SugarTable(TableName = "Device", TableDescription = "设备表")] +public class DeviceEntity : SugarBaseEntity, ITenantId { /// - /// 设备 + /// 设备code /// - [SugarTable(TableName = "Device", TableDescription = "设备表")] - public class DeviceEntity : SugarBaseEntity, ITenantId - { - /// - /// 设备code - /// - [DeviceCode] - [SugarColumn(ColumnDescription = "设备code")] - public Guid Code { get; set; } + [DeviceCode] + [SugarColumn(IsNullable = false, ColumnDescription = "设备code")] + public Guid Code { get; set; } - /// - /// 设备唯一码,IP/MAC/SNO - /// - [AdaptIgnore(MemberSide.Destination)] - [SugarColumn(ColumnDescription = "设备唯一码", IsNullable = false, UniqueGroupNameList = new[] { "Idx_Device_UniqueNo" })] - public string UniqueNo { get; set; } + /// + /// 设备唯一码,IP/MAC/SNO + /// + [AdaptIgnore(MemberSide.Destination)] + [SugarColumn(IsNullable = false, ColumnDescription = "设备唯一码", UniqueGroupNameList = new[] { "Idx_Device_UniqueNo" })] + public string UniqueNo { get; set; } - /// - /// 心跳间隔 - /// - [SugarColumn(ColumnDescription = "心跳检查间隔")] - public int HeartbeatInterval { get; set; } + /// + /// 心跳间隔 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "心跳检查间隔")] + public int HeartbeatInterval { get; set; } = 30; - /// - /// 供应商 - /// - [SugarColumn(ColumnDescription = "供应商")] - public string Supplier { get; set; } + /// + /// 供应商 + /// + [SugarColumn(IsNullable = true, ColumnDescription = "供应商")] + public string Supplier { get; set; } - /// - /// 设备功能 - /// - [SugarColumn(ColumnDataType = "varchar(150)", IsJson = true, ColumnDescription = "设备功能", DefaultValue = "[]")] - public List Funcs { get; set; } + /// + /// 设备功能 + /// + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(150)", IsJson = true, ColumnDescription = "设备功能", DefaultValue = "[]")] + public List Funcs { get; set; } - /// - /// 设备类型 - /// - [SugarColumn(ColumnDescription = "设备类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] - public DeviceTypeEnumType Type { get; set; } + /// + /// 设备类型 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "设备类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + public DeviceTypeEnumType Type { get; set; } - /// - /// 部署点 - /// - [SugarColumn(ColumnDescription = "部署点")] - public string DeployPlace { get; set; } + /// + /// 部署点 + /// + [SugarColumn(IsNullable = true, ColumnDescription = "部署点")] + public string DeployPlace { get; set; } - /// - /// 部署坐标 - /// - [SugarColumn(ColumnDescription = "部署坐标")] - public string DeployPosition { get; set; } + /// + /// 部署坐标 + /// + [SugarColumn(IsNullable = true, ColumnDescription = "部署坐标")] + public string DeployPosition { get; set; } - /// - /// 部署方向 - /// - [SugarColumn(ColumnDescription = "部署方向", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] - public DeviceDeployDirectionEnumType? DeployDirection { get; set; } + /// + /// 部署方向 + /// + [SugarColumn(IsNullable = true, ColumnDescription = "部署方向", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + public DeviceDeployDirectionEnumType? DeployDirection { get; set; } - /// - /// 模板code - /// - [SugarColumn(ColumnDescription = "模板code")] - public Guid? TemplateCode { get; set; } + /// + /// 模板code + /// + [SugarColumn(IsNullable = false, ColumnDescription = "模板code")] + public Guid TemplateCode { get; set; } - /// - /// 连接信息 - /// - [SugarColumn(ColumnDescription = "连接信息")] - public string ConnectionInfo { get; set; } + /// + /// 连接信息 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "连接信息")] + public string ConnectionInfo { get; set; } - /// - /// 是否启用 - /// - [SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否启用")] - public bool Enable { get; set; } + /// + /// 是否启用 + /// + [SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "是否启用")] + public bool Enable { get; set; } - /// - /// 是否作为考勤设备 - /// - [SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否作为考勤设备")] - public bool AsAttendance { get; set; } + /// + /// 是否作为考勤设备 + /// + [SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "是否作为考勤设备")] + public bool AsAttendance { get; set; } - /// - /// 是否启用时段码 - /// - [SugarColumn(ColumnDataType = "bit", ColumnDescription = "是否启用时段码", DefaultValue = "0")] - public bool EnableTimePeriod { get; set; } = false; + /// + /// 是否启用时段码 + /// + [SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "是否启用时段码", DefaultValue = "0")] + public bool EnableTimePeriod { get; set; } = false; - public string TenantId { get; set; } - } + public string TenantId { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs index c5ae6fa3..7cfb4bb2 100644 --- a/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs @@ -29,146 +29,146 @@ public class GainfoEntity : SugarBaseEntity /// 人员类型 /// [AdaptIgnore(MemberSide.Destination)] - [SugarColumn(ColumnDescription = "人员类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + [SugarColumn(IsNullable = false, ColumnDescription = "人员类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] public GainfoUserTypeEnumType Type { get; set; } /// /// 人员来源 /// - [SugarColumn(ColumnDescription = "人员来源", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "人员来源")] public string Source { get; set; } /// /// 姓名 /// - [SugarColumn(ColumnDescription = "姓名")] + [SugarColumn(IsNullable = false, ColumnDescription = "姓名")] public string Name { get; set; } /// /// 学工号 /// - [SugarColumn(ColumnDescription = "学工号", UniqueGroupNameList = new[] { "idx_Gainfo_Code" })] + [SugarColumn(IsNullable = false, ColumnDescription = "学工号", UniqueGroupNameList = new[] { "idx_Gainfo_Code" })] public string Code { get; set; } /// /// 国家代码 /// - [SugarColumn(ColumnDescription = "国家代码")] + [SugarColumn(IsNullable = true, ColumnDescription = "国家代码")] public string CountryNo { get; set; } /// /// 证件类型代码 /// - [SugarColumn(ColumnDescription = "证件类型代码")] + [SugarColumn(IsNullable = true, ColumnDescription = "证件类型代码")] public string IdClass { get; set; } /// /// 身份证号 /// - [SugarColumn(ColumnDescription = "身份证号", UniqueGroupNameList = new[] { "idx_Gainfo_IdNo" })] + [SugarColumn(IsNullable = true, ColumnDescription = "身份证号", UniqueGroupNameList = new[] { "idx_Gainfo_IdNo" })] public string IdNo { get; set; } /// /// 身份证籍贯区域代码 /// - [SugarColumn(ColumnDescription = "身份证籍贯区域代码")] + [SugarColumn(IsNullable = true, ColumnDescription = "身份证籍贯区域代码")] public string Native { get; set; } /// /// 性别 /// - [SugarColumn(ColumnDescription = "性别", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + [SugarColumn(IsNullable = false, ColumnDescription = "性别", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] public GenderEnumType Gender { get; set; } /// /// 生日 /// - [SugarColumn(ColumnDescription = "生日")] + [SugarColumn(IsNullable = true, ColumnDescription = "生日")] public DateTime Birthday { get; set; } /// /// 身份证地址 /// - [SugarColumn(ColumnDescription = "身份证地址")] + [SugarColumn(IsNullable = true, ColumnDescription = "身份证地址")] public string Address { get; set; } /// /// 部门编码 /// - [SugarColumn(ColumnDescription = "部门编码")] + [SugarColumn(IsNullable = true, ColumnDescription = "部门编码")] public string DepartmentNo { get; set; } /// /// 民族代码 /// - [SugarColumn(ColumnDescription = "民族代码")] + [SugarColumn(IsNullable = true, ColumnDescription = "民族代码")] public string Nation { get; set; } /// /// 手机号码 /// - [SugarColumn(ColumnDescription = "手机号码")] + [SugarColumn(IsNullable = true, ColumnDescription = "手机号码")] public string Phone { get; set; } /// /// 学历 /// - [SugarColumn(ColumnDescription = "学历")] + [SugarColumn(IsNullable = true, ColumnDescription = "学历")] public string Degree { get; set; } /// /// 岗位 /// - [SugarColumn(ColumnDescription = "岗位")] + [SugarColumn(IsNullable = true, ColumnDescription = "岗位")] public string PositionNo { get; set; } /// /// 职等 /// - [SugarColumn(ColumnDescription = "职等")] + [SugarColumn(IsNullable = true, ColumnDescription = "职等")] public string Grade { get; set; } /// /// 职级 /// - [SugarColumn(ColumnDescription = "职级")] + [SugarColumn(IsNullable = true, ColumnDescription = "职级")] public string Title { get; set; } /// /// 卡号 /// - [SugarColumn(ColumnDescription = "卡号", IndexGroupNameList = new[] { "idx_Gainfo_CardNo" })] + [SugarColumn(IsNullable = true, ColumnDescription = "卡号", IndexGroupNameList = new[] { "idx_Gainfo_CardNo" })] public string CardNo { get; set; } /// /// 备注 /// - [SugarColumn(ColumnDescription = "备注")] + [SugarColumn(IsNullable = true, ColumnDescription = "备注")] public string Remark { get; set; } /// /// 人事范围 /// - [SugarColumn(ColumnDescription = "人事范围")] + [SugarColumn(IsNullable = true, ColumnDescription = "人事范围")] public string Werks { get; set; } /// /// 工作地 /// - [SugarColumn(ColumnDescription = "工作地")] + [SugarColumn(IsNullable = false, ColumnDescription = "工作地")] public string Workplace { get; set; } /// /// 厂区 /// [TenantId] - [SugarColumn(ColumnDescription = "厂区")] + [SugarColumn(IsNullable = false, ColumnDescription = "厂区")] public string Factory { get; set; } /// /// 成本中心 /// - [SugarColumn(ColumnDescription = "成本中心")] + [SugarColumn(IsNullable = true, ColumnDescription = "成本中心")] public string CostId { get; set; } /// @@ -186,13 +186,13 @@ public class GainfoEntity : SugarBaseEntity /// /// 身份认证用户Id(如果为空匹配code) /// - [SugarColumn(ColumnDescription = "身份认证用户Id", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "身份认证用户Id")] public int IdentityUserId { get; set; } /// /// 卡类型 /// - [SugarColumn(ColumnDescription = "卡类型", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "卡类型")] public int? CardType { get; set; } } diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs index 77aee1e4..46d940bc 100644 --- a/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/GainfoGroupEntity.cs @@ -2,50 +2,50 @@ using Kurisu.AspNetCore.DataAccess.SqlSugar; using SqlSugar; -namespace Dlhis.Entity.Basic.Entity +namespace Dlhis.Entity.Basic.Entity; + +/// +/// 档案组 +/// +[SugarTable(TableName = "GainfoGroup", TableDescription = "档案组")] +public class GainfoGroupEntity : SugarBaseEntity, ITenantId { /// - /// 档案组 + /// 父级Code /// - [SugarTable(TableName = "GainfoGroup", TableDescription = "档案组")] - public class GainfoGroupEntity : SugarBaseEntity, ITenantId - { - /// - /// 父级Code - /// - public Guid? PCode { get; set; } + [SugarColumn(IsNullable = true)] + public Guid? PCode { get; set; } - /// - /// 分组code - /// - [SugarColumn(ColumnDescription = "分组code")] - public Guid Code { get; set; } + /// + /// 分组code + /// + [SugarColumn(IsNullable = false, ColumnDescription = "分组code")] + public Guid Code { get; set; } - /// - /// 名称 - /// - [SugarColumn(ColumnDescription = "名称")] - public string Name { get; set; } + /// + /// 名称 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "名称")] + public string Name { get; set; } - /// - /// 备注 - /// - [SugarColumn(ColumnDescription = "备注")] - public string Remark { get; set; } + /// + /// 备注 + /// + [SugarColumn(IsNullable = true, ColumnDescription = "备注")] + public string Remark { get; set; } - /// - /// 是否默认分组 - /// - [SugarColumn(ColumnDescription = "是否默认分组", ColumnDataType = "bit", DefaultValue = "1")] - public bool IsDefault { get; set; } = true; + /// + /// 是否默认分组 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "是否默认分组", ColumnDataType = "bit", DefaultValue = "1")] + public bool IsDefault { get; set; } = true; - /// - /// 是否可编辑 - /// - [SugarColumn(ColumnDescription = "是否可编辑", ColumnDataType = "bit", DefaultValue = "1")] - public bool Editable { get; set; } = true; + /// + /// 是否可编辑 + /// + [SugarColumn(IsNullable = false, ColumnDescription = "是否可编辑", ColumnDataType = "bit", DefaultValue = "1")] + public bool Editable { get; set; } = true; - - public string TenantId { get; set; } - } + [SugarColumn(IsNullable = true)] + public string TenantId { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs index 39b143e6..d3207d59 100644 --- a/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs @@ -1,7 +1,9 @@ -using SqlSugar; +using Microsoft.Extensions.DependencyInjection; +using SqlSugar; namespace Dlhis.Entity.Basic.Entity { + [SkipScan] [SugarTable(TableName = "GainfoSap")] public class GainfoSapEntity { @@ -11,6 +13,7 @@ namespace Dlhis.Entity.Basic.Entity public string @class { get; set; } public string passwd { get; set; } + public string question { get; set; } public string answer { get; set; } @@ -25,6 +28,7 @@ namespace Dlhis.Entity.Basic.Entity public string sex { get; set; } public DateTime birthday { get; set; } public string address { get; set; } + public string postcode { get; set; } public string occupation { get; set; } public string appellation { get; set; } @@ -33,16 +37,24 @@ namespace Dlhis.Entity.Basic.Entity public string fax { get; set; } public string mobile { get; set; } public string email { get; set; } + public string web { get; set; } + public string vip { get; set; } + public string sec { get; set; } + public string cropsno { get; set; } + public string cropname { get; set; } + public string fancy { get; set; } public string remark { get; set; } public int amount { get; set; } + public int days { get; set; } + public decimal consume01 { get; set; } public decimal consume02 { get; set; } @@ -90,12 +102,17 @@ namespace Dlhis.Entity.Basic.Entity public string MASSN { get; set; } public string MNTXT { get; set; } + public string MASSG { get; set; } + public string MGTXT { get; set; } public DateTime? logdate { get; set; } + public DateTime? updatelogdate { get; set; } + public string guestno { get; set; } public string ZZ_KLX { get; set; } + public DateTime? DAT01 { get; set; } public string ZZ_COUNNM { get; set; } diff --git a/Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs b/Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs index d275d96d..01c21c42 100644 --- a/Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/WerkEntity.cs @@ -17,7 +17,7 @@ public class WerkEntity : SugarBaseEntity /// /// 名称 /// - [SugarColumn(IsNullable = false, ColumnDescription = "名称")] + [SugarColumn(ColumnDescription = "名称")] public string Name { get; set; } /// @@ -53,12 +53,12 @@ public class WerkEntity : SugarBaseEntity /// /// 结果 /// - [SugarColumn(IsNullable = false, ColumnDescription = "结果")] + [SugarColumn(IsNullable = true, ColumnDescription = "结果")] public string HandleMessage { get; set; } /// /// 是否启用 /// - [SugarColumn(ColumnDataType = "bit", DefaultValue = "1")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", DefaultValue = "1")] public bool Enable { get; set; } -} +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/BalanceRecordEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/BalanceRecordEntity.cs index a3fdedda..ed889f1a 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/BalanceRecordEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/BalanceRecordEntity.cs @@ -15,138 +15,140 @@ public class BalanceRecordEntity : SugarBaseEntity, ISoftDeleted, ITenantId /// /// 流水号 /// - [SugarColumn(ColumnDescription = "流水号", UniqueGroupNameList = new[] { "Unique_BalanceRecord_No" })] + [SugarColumn(IsNullable = false, ColumnDescription = "流水号", UniqueGroupNameList = new[] { "Unique_BalanceRecord_No" })] public string No { get; set; } /// /// 档案号/QRCode /// - [SugarColumn(ColumnDescription = "档案号/QRCode")] + [SugarColumn(IsNullable = false, ColumnDescription = "档案号/QRCode")] public string UserNo { get; set; } /// /// 姓名 /// - [SugarColumn(ColumnDescription = "姓名")] + [SugarColumn(IsNullable = false, ColumnDescription = "姓名")] public string Name { get; set; } /// /// 学工号 /// - [SugarColumn(ColumnDescription = "学工号")] + [SugarColumn(IsNullable = false, ColumnDescription = "学工号")] public string UserCode { get; set; } /// /// 部门号 /// - [SugarColumn(ColumnDescription = "部门号")] + [SugarColumn(IsNullable = true, ColumnDescription = "部门号")] public string DepartmentNo { get; set; } /// /// 来源 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "来源")] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "来源")] public BalanceRecordSourceEnumType Source { get; set; } /// /// 收入/支出 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "收入/支出")] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "收入/支出")] public BalanceRecordTypeEnumType Type { get; set; } /// /// 金额 + - 表示 /// - [SugarColumn(ColumnDescription = "金额+-表示")] + [SugarColumn(IsNullable = false, ColumnDescription = "金额+-表示")] public decimal Amount { get; set; } /// /// 营业点 /// - [SugarColumn(ColumnDescription = "营业点", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "营业点")] public Guid? BusinessPlaceCode { get; set; } /// /// 餐别 /// - [SugarColumn(ColumnDescription = "餐别", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "餐别")] public Guid? BusinessShiftCode { get; set; } /// /// 餐次 /// - [SugarColumn(ColumnDescription = "餐次", ColumnDataType = "varchar(50)", IsNullable = true, SqlParameterDbType = typeof(EnumToStringConvert))] + [SugarColumn(IsNullable = true, ColumnDescription = "餐次", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] public ShiftEnumType? ShiftType { get; set; } /// /// 所属成本日期 /// - [SugarColumn(ColumnDataType = "date", ColumnDescription = "所属成本日期")] + [SugarColumn(IsNullable = false, ColumnDataType = "date", ColumnDescription = "所属成本日期")] public DateTime CostDate { get; set; } /// /// 消费机器唯一信息 /// - [SugarColumn(ColumnDescription = "消费机器唯一信息", IsNullable = true)] + [SugarColumn(IsNullable = true, ColumnDescription = "消费机器唯一信息")] public string DeviceUniqueNo { get; set; } /// /// Ip /// - [SugarColumn(ColumnDescription = "IP")] + [SugarColumn(IsNullable = true, ColumnDescription = "IP")] public string IP { get; set; } /// /// 成本中心 /// - [SugarColumn(ColumnDescription = "成本中心")] + [SugarColumn(IsNullable = true, ColumnDescription = "成本中心")] public string CostId { get; set; } /// /// 消费者所在基地 /// - [SugarColumn(ColumnDescription = "消费者所在基地")] + [SugarColumn(IsNullable = false, ColumnDescription = "消费者所在基地")] public string OriginTenantId { get; set; } /// /// 成本计算是否允许跨基地范围 /// - [SugarColumn(ColumnDataType = "bit", ColumnDescription = "成本计算是否允许跨基地范围")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", ColumnDescription = "成本计算是否允许跨基地范围")] public bool IsCostCrossTenant { get; set; } /// /// 数据状态 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "数据状态")] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "数据状态")] public BalanceRecordStatusEnumType Status { get; set; } /// /// 消费时间 /// - [SugarColumn(ColumnDescription = "消费时间")] + [SugarColumn(IsNullable = false, ColumnDescription = "消费时间")] public DateTime CostDateTime { get; set; } /// /// 备注 /// - [SugarColumn(ColumnDescription = "备注")] + [SugarColumn(IsNullable = true, ColumnDescription = "备注")] public string Remark { get; set; } /// /// 餐饮应用类型 /// - [SugarColumn(ColumnDescription = "餐饮应用类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + [SugarColumn(IsNullable = false, ColumnDescription = "餐饮应用类型", ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] public CanteenApplicationTypeEnumType ApplicationType { get; set; } + [SugarColumn(IsNullable = false)] public string TenantId { get; set; } /// /// 人事范围 /// + [SugarColumn(IsNullable = true)] public string Werks { get; set; } - [SugarColumn(ColumnDataType = "bit")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit")] public bool IsDeleted { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/CanteenOrderEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/CanteenOrderEntity.cs index 4394049f..a9aa1fbc 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/CanteenOrderEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/CanteenOrderEntity.cs @@ -13,36 +13,36 @@ public class CanteenOrderEntity : BalanceRecordEntity /// /// 请求json /// - [SugarColumn(ColumnDescription = "请求json",ColumnDataType = "varchar(2000)")] + [SugarColumn(IsNullable = true, ColumnDescription = "请求json", ColumnDataType = "varchar(2000)")] public string RequestJson { get; set; } /// /// 第三方订单号 /// - [SugarColumn(ColumnDescription = "第三方订单号")] + [SugarColumn(IsNullable = true,ColumnDescription = "第三方订单号")] public string ThirdNo { get; set; } /// /// 订单状态 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "订单状态")] + [SugarColumn(IsNullable = false,ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "订单状态")] public CanteenOrderStatusEnumType OrderStatus { get; set; } /// /// 是否离线数据 /// - [SugarColumn(ColumnDataType = "bit", ColumnDescription = "请求json")] + [SugarColumn(IsNullable = false,ColumnDataType = "bit", ColumnDescription = "请求json")] public bool IsOffline { get; set; } /// /// 配送地址 /// - [SugarColumn(ColumnDescription = "配送地址")] + [SugarColumn(IsNullable = true,ColumnDescription = "配送地址")] public string DeliveryAddress { get; set; } /// /// 处理结果 /// - [SugarColumn(ColumnDescription = "处理结果")] + [SugarColumn(IsNullable = true,ColumnDescription = "处理结果")] public string Result { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/DishesCategoryEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/DishesCategoryEntity.cs index 1e980a86..13e2955e 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/DishesCategoryEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/DishesCategoryEntity.cs @@ -16,6 +16,7 @@ public class DishesCategoryEntity : SugarBaseEntity, ITenantId /// /// PCode /// + [SugarColumn(IsNullable = true)] public Guid? PCode { get; set; } /// @@ -38,4 +39,4 @@ public class DishesCategoryEntity : SugarBaseEntity, ITenantId public string TenantId { get; set; } -} +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherDetailEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherDetailEntity.cs index f353f4e7..52816945 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherDetailEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherDetailEntity.cs @@ -13,70 +13,70 @@ public class EMealVoucherDetailEntity : SugarBaseEntity, IVersion /// /// 主表id /// - [SugarColumn(ColumnDescription = "主表id")] + [SugarColumn(IsNullable = false, ColumnDescription = "主表id")] public long VoucherId { get; set; } /// /// 流水号 /// - [SugarColumn(ColumnDescription = "流水号", UniqueGroupNameList = new[] { "idx_EMealVoucherDetail_no_idno" })] + [SugarColumn(IsNullable = false, ColumnDescription = "流水号", UniqueGroupNameList = new[] { "idx_EMealVoucherDetail_no_idno" })] public string No { get; set; } /// /// 人员类型 /// - [SugarColumn(ColumnDescription = "人员类型(新员工/外来人员)")] + [SugarColumn(IsNullable = false, ColumnDescription = "人员类型(新员工/外来人员)")] public string UserType { get; set; } /// /// 身份证 /// - [SugarColumn(ColumnDescription = "证件号", UniqueGroupNameList = new[] { "idx_EMealVoucherDetail_no_idno" })] + [SugarColumn(IsNullable = false, ColumnDescription = "证件号", UniqueGroupNameList = new[] { "idx_EMealVoucherDetail_no_idno" })] public string IdNo { get; set; } /// /// 用餐人 /// - [SugarColumn(ColumnDescription = "用餐人")] + [SugarColumn(IsNullable = false, ColumnDescription = "用餐人")] public string Name { get; set; } /// /// 手机号 /// - [SugarColumn(ColumnDescription = "手机号")] + [SugarColumn(IsNullable = false, ColumnDescription = "手机号")] public string Phone { get; set; } /// /// 就餐开始 /// - [SugarColumn(ColumnDescription = "使用开始", ColumnDataType = "date")] + [SugarColumn(IsNullable = false, ColumnDescription = "使用开始", ColumnDataType = "date")] public DateTime Start { get; set; } /// /// 就餐结束 /// - [SugarColumn(ColumnDescription = "使用结束", ColumnDataType = "date")] + [SugarColumn(IsNullable = false, ColumnDescription = "使用结束", ColumnDataType = "date")] public DateTime End { get; set; } /// /// 金额 /// - [SugarColumn(ColumnDescription = "余额", ColumnDataType = "decimal(16,2)")] + [SugarColumn(IsNullable = false, ColumnDescription = "余额", ColumnDataType = "decimal(16,2)")] public decimal Balance { get; set; } - + /// /// 金额 /// - [SugarColumn(ColumnDescription = "原始余额", ColumnDataType = "decimal(16,2)")] + [SugarColumn(IsNullable = false, ColumnDescription = "原始余额", ColumnDataType = "decimal(16,2)")] public decimal OriginBalance { get; set; } /// /// 版本 /// - [SugarColumn(ColumnDescription = "版本")] + [SugarColumn(IsNullable = false, ColumnDescription = "版本")] public int Version { get; set; } - [SugarColumn(ColumnDataType = "varchar(255)")] + [SugarColumn(IsNullable = true, ColumnDataType = "varchar(255)")] public string Signature { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherEntity.cs index c13e7ed1..e015507c 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/EMealVoucherEntity.cs @@ -13,72 +13,72 @@ public class EMealVoucherEntity : SugarBaseEntity /// /// oa流程id /// - [SugarColumn(ColumnDescription = "oa流程id", UniqueGroupNameList = new[] { "index_EMealVoucher_No" })] + [SugarColumn(IsNullable = false, ColumnDescription = "oa流程id", UniqueGroupNameList = new[] { "index_EMealVoucher_No" })] public string No { get; set; } /// /// 标题 /// - [SugarColumn(ColumnDescription = "标题")] + [SugarColumn(IsNullable = false, ColumnDescription = "标题")] public string Title { get; set; } /// /// 申请人工号 /// - [SugarColumn(ColumnDescription = "申请人工号", IndexGroupNameList = new[] { "index_EMealVoucher_Code" })] + [SugarColumn(IsNullable = false, ColumnDescription = "申请人工号", IndexGroupNameList = new[] { "index_EMealVoucher_Code" })] public string Code { get; set; } /// /// 成本中心 /// - [SugarColumn(ColumnDescription = "成本中心")] + [SugarColumn(IsNullable = false, ColumnDescription = "成本中心")] public string CostId { get; set; } /// /// 来宾公司 /// - [SugarColumn(ColumnDescription = "来宾来源")] + [SugarColumn(IsNullable = false, ColumnDescription = "来宾来源")] public string Source { get; set; } /// /// 联系人 /// - [SugarColumn(ColumnDescription = "手机号")] + [SugarColumn(IsNullable = false, ColumnDescription = "手机号")] public string Phone { get; set; } /// /// 来宾人数 /// - [SugarColumn(ColumnDescription = "来宾人数")] + [SugarColumn(IsNullable = false, ColumnDescription = "来宾人数")] public int Number { get; set; } /// /// 就餐事由 /// - [SugarColumn(ColumnDescription = "申请事由")] + [SugarColumn(IsNullable = false, ColumnDescription = "申请事由")] public string Reason { get; set; } /// /// 就餐次 /// - [SugarColumn(ColumnDescription = "就餐次", ColumnDataType = "varchar(500)", IsJson = true)] + [SugarColumn(IsNullable = false, ColumnDescription = "就餐次", ColumnDataType = "varchar(500)", IsJson = true)] public List Shifts { get; set; } /// /// 可消费厂区 /// - [SugarColumn(ColumnDescription = "可消费厂区", ColumnDataType = "varchar(500)", IsJson = true)] + [SugarColumn(IsNullable = false, ColumnDescription = "可消费厂区", ColumnDataType = "varchar(500)", IsJson = true)] public List Factories { get; set; } /// /// 申请日期 /// - [SugarColumn(ColumnDescription = "申请日期")] + [SugarColumn(IsNullable = false, ColumnDescription = "申请日期")] public DateTime Date { get; set; } /// /// 厂区 /// - [SugarColumn(ColumnDescription = "厂区")] + [SugarColumn(IsNullable = false, ColumnDescription = "厂区")] public string Factory { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/MealSupplementRecordEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/MealSupplementRecordEntity.cs index 9292d21c..dfa72a6e 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/MealSupplementRecordEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/MealSupplementRecordEntity.cs @@ -26,23 +26,22 @@ public class MealSupplementRecordEntity : MealSupplementRequestRecordEntity /// /// 餐补状态 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert))] public MealSupplementStatusEnumtype Status { get; set; } /// /// 处理结果 /// - [SugarColumn(ColumnDescription = "处理结果", ColumnDataType = "varchar(2000)")] + [SugarColumn(IsNullable = true, ColumnDescription = "处理结果", ColumnDataType = "varchar(2000)")] public string Result { get; set; } /// /// 状态同步 /// - [SugarColumn(ColumnDataType = "bit")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit")] public bool Sync { get; set; } } - /// /// 餐补请求记录 /// @@ -78,4 +77,4 @@ public class MealSupplementRequestRecordEntity : SugarBaseEntity /// [SugarColumn(IsNullable = false, ColumnDescription = "餐补")] public decimal Amount { get; set; } -} +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/Canteen/Entities/UserBalanceEntity.cs b/Src/Dlhis.Entity/Canteen/Entities/UserBalanceEntity.cs index fe4196ec..1f897d8a 100644 --- a/Src/Dlhis.Entity/Canteen/Entities/UserBalanceEntity.cs +++ b/Src/Dlhis.Entity/Canteen/Entities/UserBalanceEntity.cs @@ -22,6 +22,7 @@ public class UserBalanceEntity : SugarBaseEntity, IVersion [SugarColumn(IsNullable = false, ColumnDescription = "余额")] public decimal Balance { get; set; } - /// + + [SugarColumn(IsNullable = false)] public int Version { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Common/FileVersionEntity.cs b/Src/Dlhis.Entity/Common/FileVersionEntity.cs index 30699d36..006656ca 100644 --- a/Src/Dlhis.Entity/Common/FileVersionEntity.cs +++ b/Src/Dlhis.Entity/Common/FileVersionEntity.cs @@ -30,7 +30,7 @@ public class FileVersionEntity : SugarBaseEntity /// /// 描述信息 /// - [SugarColumn(ColumnDescription = "描述信息")] + [SugarColumn(IsNullable = false, ColumnDescription = "描述信息")] public string Description { get; set; } /// @@ -38,6 +38,4 @@ public class FileVersionEntity : SugarBaseEntity /// [SugarColumn(IsNullable = false, ColumnDescription = "文件地址")] public string Url { get; set; } -} - - +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs index 7aa96cba..16e6c55f 100644 --- a/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs +++ b/Src/Dlhis.Entity/Device/Entities/DeviceGroupEntity.cs @@ -23,7 +23,7 @@ public class DeviceGroupEntity : SugarBaseEntity, ITenantId, ISoftDeleted /// /// 上级设备组code /// - [SugarColumn(ColumnDescription = "上级设备组code")] + [SugarColumn(IsNullable = true, ColumnDescription = "上级设备组code")] public Guid? PCode { get; set; } /// @@ -37,20 +37,20 @@ public class DeviceGroupEntity : SugarBaseEntity, ITenantId, ISoftDeleted /// /// 设备组名称 /// - [SugarColumn(ColumnDescription = "设备组名称")] + [SugarColumn(IsNullable = false, ColumnDescription = "设备组名称")] public string Name { get; set; } /// /// 是否可编辑 /// - [SugarColumn(ColumnDataType = "bit", DefaultValue = "1", ColumnDescription = "是否可编辑")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", DefaultValue = "1", ColumnDescription = "是否可编辑")] public bool Editable { get; set; } = true; /// /// 可设置下级 /// - [SugarColumn(ColumnDataType = "bit", DefaultValue = "1")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", DefaultValue = "1")] public bool AbleSetNext { get; set; } = true; /// @@ -62,16 +62,17 @@ public class DeviceGroupEntity : SugarBaseEntity, ITenantId, ISoftDeleted /// /// 可作为预约分组 /// - [SugarColumn(ColumnDataType = "bit", DefaultValue = "0")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", DefaultValue = "0")] public bool AsAppointment { get; set; } = false; /// /// 是否为出差分组 /// - [SugarColumn(ColumnDataType = "bit", DefaultValue = "0")] + [SugarColumn(IsNullable = false, ColumnDataType = "bit", DefaultValue = "0")] public bool IsBusinessTrip { get; set; } = false; + [SugarColumn(IsNullable = true)] public string TenantId { get; set; } diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs index 79ca66e0..41d69385 100644 --- a/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs +++ b/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs @@ -15,7 +15,7 @@ public class DeviceTaskEntity : SugarBaseEntity, ITenantId, IVersion /// /// 任务类型 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), IndexGroupNameList = new[] { "idx_DeviceTask_Type" })] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), IndexGroupNameList = new[] { "idx_DeviceTask_Type" })] public DeviceTaskEnumType Type { get; set; } /// @@ -44,27 +44,22 @@ public class DeviceTaskEntity : SugarBaseEntity, ITenantId, IVersion /// /// 任务下发状态 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), IndexGroupNameList = new[] { "idx_DeviceTask_Status" })] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), IndexGroupNameList = new[] { "idx_DeviceTask_Status" })] public DeviceTaskStatusEnumType Status { get; set; } /// /// 数据版本 /// + [SugarColumn(IsNullable = false)] public int Version { get; set; } /// /// 处理结果 /// - [SugarColumn(ColumnDataType = "longtext")] + [SugarColumn(IsNullable = true, ColumnDataType = "longtext")] public string ResultMessage { get; set; } - /// - /// 取消id - /// - [SugarColumn(DefaultValue = "0")] - public long CancellationId { get; set; } = 0; - /// /// 任务来源 /// @@ -74,7 +69,7 @@ public class DeviceTaskEntity : SugarBaseEntity, ITenantId, IVersion /// /// 优先级 /// - [SugarColumn(IsNullable = true, DefaultValue = "0")] + [SugarColumn(IsNullable = false, DefaultValue = "0")] public int Priority { get; set; } = 0; diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs index ffa5a474..10471948 100644 --- a/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs +++ b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogEntity.cs @@ -49,6 +49,6 @@ public class DeviceUploadLogEntity : SugarBaseEntity, ITenantId public bool Status { get; set; } - [SugarColumn(IndexGroupNameList = new string[] { "idx_DeviceUploadLog_TenantId" })] + [SugarColumn(IndexGroupNameList = new[] { "idx_DeviceUploadLog_TenantId" })] public string TenantId { get; set; } } diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs new file mode 100644 index 00000000..6be6f3a0 --- /dev/null +++ b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs @@ -0,0 +1,24 @@ +using Kurisu.AspNetCore.DataAccess.Entity; +using Kurisu.AspNetCore.DataAccess.SqlSugar; +using SqlSugar; + +namespace Dlhis.Entity.Device.Entities; + +[SugarTable(TableName = "DeviceUploadLogManually", TableDescription = "设备上传记录")] +public class DeviceUploadLogManuallyEntity : SugarBaseEntity, ITenantId +{ + [SugarColumn(IsNullable = false, IndexGroupNameList = new[] { "idx_DeviceUploadLogManually_deviceNo" })] + public string DeviceNo { get; set; } + + [SugarColumn(IsNullable = false)] + public DateTime Start { get; set; } + + [SugarColumn(IsNullable = false)] + public DateTime End { get; set; } + + [SugarColumn(IsNullable = false, ColumnDataType = "bit")] + public bool IsFinished { get; set; } + + /// + public string TenantId { get; set; } +} \ No newline at end of file diff --git a/Src/Dlhis.Entity/SqlSugarPack.cs b/Src/Dlhis.Entity/SqlSugarPack.cs index 82741972..efc5cd1c 100644 --- a/Src/Dlhis.Entity/SqlSugarPack.cs +++ b/Src/Dlhis.Entity/SqlSugarPack.cs @@ -1,4 +1,5 @@ using Dlhis.Entity.Basic.Entity; +using Dlhis.Entity.Device.Entities; using Kurisu.AspNetCore; using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; @@ -94,7 +95,7 @@ public class SqlSugarPack : BaseAppPack var tables = App.ActiveTypes.Where(x => x.IsDefined(typeof(SugarTable), false)) .Where(x => !x.IsDefined(typeof(SkipScanAttribute), false)) .ToArray(); - + db.Client.DbMaintenance.CreateDatabase(); db.Client.CodeFirst.InitTables(tables); diff --git a/Src/Dlhis.Entity/Sys/Entities/MenuEntity.cs b/Src/Dlhis.Entity/Sys/Entities/MenuEntity.cs index 10a70c6e..dd36c54d 100644 --- a/Src/Dlhis.Entity/Sys/Entities/MenuEntity.cs +++ b/Src/Dlhis.Entity/Sys/Entities/MenuEntity.cs @@ -14,76 +14,76 @@ public class MenuEntity : SugarBaseEntity /// /// code /// - [SugarColumn(ColumnDescription = "code")] + [SugarColumn(IsNullable = false, ColumnDescription = "code")] public string Code { get; set; } /// /// 上级 /// - [SugarColumn(ColumnDescription = "上级")] + [SugarColumn(IsNullable = true, ColumnDescription = "上级")] public string PCode { get; set; } /// /// 标题 /// - [SugarColumn(ColumnDescription = "标题")] + [SugarColumn(IsNullable = false, ColumnDescription = "标题")] public string Title { get; set; } /// /// 名称 /// - [SugarColumn(ColumnDescription = "名称")] + [SugarColumn(IsNullable = false, ColumnDescription = "名称")] public string Name { get; set; } /// /// 图标 /// - [SugarColumn(ColumnDescription = "图标")] + [SugarColumn(IsNullable = true, ColumnDescription = "图标")] public string Icon { get; set; } /// /// 路由地址 /// - [SugarColumn(ColumnDescription = "路由地址")] + [SugarColumn(IsNullable = true, ColumnDescription = "路由地址")] public string Route { get; set; } /// /// 权限标识 /// - [SugarColumn(ColumnDescription = "权限标识")] + [SugarColumn(IsNullable = true, ColumnDescription = "权限标识")] public string Permission { get; set; } /// /// 是否为外链 /// - [SugarColumn(ColumnDescription = "是否为外链")] + [SugarColumn(IsNullable = false, ColumnDescription = "是否为外链")] public bool IsLink { get; set; } /// /// 序号 /// - [SugarColumn(ColumnDescription = "序号")] + [SugarColumn(IsNullable = false, ColumnDescription = "序号")] public int Sequence { get; set; } /// /// 是否可见 /// - [SugarColumn(ColumnDescription = "是否可见")] + [SugarColumn(IsNullable = false, ColumnDescription = "是否可见")] public bool Visible { get; set; } /// /// 菜单类型 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "菜单类型")] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "菜单类型")] public MenuEnumType MenuType { get; set; } /// /// 平台类型 /// - [SugarColumn(ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "平台类型")] + [SugarColumn(IsNullable = false, ColumnDataType = "varchar(50)", SqlParameterDbType = typeof(EnumToStringConvert), ColumnDescription = "平台类型")] public PlatformEnumType Platform { get; set; } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs index bf94af3f..ce162ca4 100644 --- a/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs +++ b/Src/Dlhis.Entity/Visitor/Entity/VisitorAppointmentDetailEntity.cs @@ -26,11 +26,13 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity /// /// 证件类型 /// + [SugarColumn(IsNullable = false)] public string IdType { get; set; } /// /// 证件号 /// + [SugarColumn(IsNullable = false)] public string IdNo { get; set; } /// @@ -48,17 +50,19 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity /// /// 车牌 /// - [SugarColumn(ColumnDescription = "车牌")] + [SugarColumn(IsNullable = true, ColumnDescription = "车牌")] public string LicensePlate { get; set; } /// /// 进入门岗 /// + [SugarColumn(IsNullable = false)] public bool IsEnterDoorArea { get; set; } /// /// 预约门禁区域 /// + [SugarColumn(IsNullable = true)] public string ApplyDoorArea { get; set; } /// @@ -76,34 +80,37 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity /// /// 是否进入车间 /// + [SugarColumn(IsNullable = false)] public bool IsEnterWorkplace { get; set; } /// /// 申请车间区域 /// - [SugarColumn(ColumnDescription = "车间区域", IsJson = true, DefaultValue = "[]")] + [SugarColumn(IsNullable = true, ColumnDescription = "车间区域", IsJson = true, DefaultValue = "[]")] public List ApplyWorkplaceAreas { get; set; } /// /// 车间访问开始 /// + [SugarColumn(IsNullable = true)] public DateTime? WorkplaceStart { get; set; } /// /// 车间访问结束 /// + [SugarColumn(IsNullable = true)] public DateTime? WorkplaceEnd { get; set; } /// /// 社保照片url /// - [SugarColumn(ColumnDescription = "社保照片url")] + [SugarColumn(IsNullable = true, ColumnDescription = "社保照片url")] public string ImageUrl { get; set; } /// /// 备注 /// - [SugarColumn(ColumnDescription = "备注")] + [SugarColumn(IsNullable = true, ColumnDescription = "备注")] public string Remark { get; set; } /// @@ -117,7 +124,7 @@ public class VisitorAppointmentDetailEntity : SugarBaseEntity /// [SugarColumn(IsNullable = true)] public DateTime? ArrivedTime { get; set; } - + /// /// 强制离场时间 /// diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs index 57b090ee..4b5233dc 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs @@ -79,4 +79,24 @@ public class DeviceUploadLogsController : ControllerBase { return await _deviceUploadLogService.GetDeviceUploadRecordSettingAsync(deviceNo); } + + /// + /// 手动上传考勤记录 + /// + /// + [HttpPost("manuallyUpload")] + public async Task ManuallyUploadAsync(List logIds) + { + await _deviceUploadLogService.ManuallyUploadAsync(logIds); + } + + /// + /// 手动设置上传考勤时间范围 + /// + /// + [HttpPost("manuallySetTimeInfo")] + public async Task ManuallySetTimeInfoAsync(DeviceUploadLogManuallySetTimeInfoRequest request) + { + await _deviceUploadLogService.ManuallySetTimeInfoAsync(request.DeviceNo, request.Start, request.End); + } } \ No newline at end of file diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogManuallySetTimeInfoRequest.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogManuallySetTimeInfoRequest.cs new file mode 100644 index 00000000..884eb2f1 --- /dev/null +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/DeviceUploadLogManuallySetTimeInfoRequest.cs @@ -0,0 +1,22 @@ +using System.ComponentModel.DataAnnotations; + +namespace Dlhis.ScheduledTask.DeviceUploadLog.Request; + +public class DeviceUploadLogManuallySetTimeInfoRequest : IValidatableObject +{ + [Required(ErrorMessage = "设备号不能为空")] + public string DeviceNo { get; set; } + + public DateTime Start { get; set; } + + public DateTime End { get; set; } + + /// + public IEnumerable Validate(ValidationContext validationContext) + { + if (Start >= End) + { + yield return new ValidationResult("开始时间不可大于等于结束时间"); + } + } +} \ No newline at end of file diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/SetUploadLogsBeginDateTimeRequest.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/SetUploadLogsBeginDateTimeRequest.cs deleted file mode 100644 index e5a65b58..00000000 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Request/SetUploadLogsBeginDateTimeRequest.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Dlhis.ScheduledTask.DeviceUploadLog.Request; - -public class SetUploadLogsBeginDateTimeRequest -{ - /// - /// 设备号不能为空 - /// - [Required(ErrorMessage = "设备号不能为空")] - public string DeviceUniqueNo { get; set; } - - /// - /// 开始时间 - /// - public DateTime Begin { get; set; } -} diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/IDeviceUploadLogService.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/IDeviceUploadLogService.cs index 1f1e9f4b..791e06ee 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/IDeviceUploadLogService.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/IDeviceUploadLogService.cs @@ -13,7 +13,7 @@ public interface IDeviceUploadLogService : IScopeDependency /// /// Task UploadLogsAsync(List requests); - + /// /// 查询通行记录分页 /// @@ -28,13 +28,30 @@ public interface IDeviceUploadLogService : IScopeDependency /// Task> GetMyRecordsAsync(DeviceUploadLogMyRecordRequest request); + Task QiaoqiaoGaoshiqingAsync(DeviceUploadLogSecretAddRequest request); - - + + /// /// 获取设备记录获取的开始-结束时间 /// /// /// Task GetDeviceUploadRecordSettingAsync(string deviceNo); -} + + /// + /// 手动上传考勤记录 + /// + /// + /// + Task ManuallyUploadAsync(List requestIds); + + /// + /// 手动设置获取记录时间范围 + /// + /// + /// + /// + /// + Task ManuallySetTimeInfoAsync(string deviceNo, DateTime start, DateTime end); +} \ 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 8beeafa1..308d9a99 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs @@ -1,6 +1,8 @@ using Dlhis.Entity.Basic.Entity; using Dlhis.Entity.Device.Entities; using Dlhis.Entity.Device.Enums; +using Dlhis.Jip.Api; +using Dlhis.Jip.Api.Requests; using Dlhis.ScheduledTask.DeviceUploadLog.Request; using Dlhis.ScheduledTask.DeviceUploadLog.Response; using Kurisu.AspNetCore.Authentication.Abstractions; @@ -16,11 +18,13 @@ public class DeviceUploadLogService : IDeviceUploadLogService { private readonly IDbContext _dbContext; private readonly ICurrentUser _currentUser; + private readonly IJinkoJipApi _jinkoJipApi; - public DeviceUploadLogService(IDbContext dbContext, ICurrentUser currentUser) + public DeviceUploadLogService(IDbContext dbContext, ICurrentUser currentUser, IJinkoJipApi jinkoJipApi) { _dbContext = dbContext; _currentUser = currentUser; + _jinkoJipApi = jinkoJipApi; } public async Task UploadLogsAsync(List requests) @@ -103,6 +107,64 @@ public class DeviceUploadLogService : IDeviceUploadLogService .ToListAsync(); } + /// + public async Task ManuallyUploadAsync(List requestIds) + { + var existsOther = await _dbContext.Queryable() + .Where(x => requestIds.Contains(x.Id)) + .Where(x => x.Type != DeviceUploadLogTypeEnumType.Attendance) + .AnyAsync(); + + existsOther.ThrowIfTrue("存在非考勤通行记录,无法上传"); + + var requests = await _dbContext.Queryable() + .LeftJoin((x, device) => x.DeviceUniqueNo == device.UniqueNo) + .Where(x => x.Sync == false) + .Where(x => !string.IsNullOrEmpty(x.UserUniqueNo)) + .Where(x => SqlFunc.Subqueryable().Where(p => p.Code == x.UserUniqueNo).NotAny()) + .Where(x => requestIds.Contains(x.Id)) + .Select((x, device) => new UploadAttendanceRequestItem + { + Id = x.Id, + RaiseDateTime = x.RaiseDateTime, + ZNOTE = device.DeployPlace, + ZWORKCODE = x.UserUniqueNo + }) + .ToListAsync(); + + if (requests.Any()) + { + foreach (var items in requests.Chunk(500)) + { + var ids = items.Select(x => x.Id).ToList(); + var r = await _jinkoJipApi.UploadAttendancesAsync(new UploadAttendanceRequest { Data = items.ToList() }); + if (r.OLX == "0") + { + await _dbContext.Updateable() + .SetColumns(x => x.Sync == true) + .SetColumns(x => x.ModifiedTime == DateTime.Now) + .Where(x => ids.Contains(x.Id)) + .ExecuteCommandAsync(); + } + } + } + } + + /// + public async Task ManuallySetTimeInfoAsync(string deviceNo, DateTime start, DateTime end) + { + var exists = await _dbContext.Queryable().Where(x => x.DeviceNo == deviceNo).Where(x => x.IsFinished == false).AnyAsync(); + exists.ThrowIfTrue("已存在时间配置尚未完成"); + + await _dbContext.InsertAsync(new DeviceUploadLogManuallyEntity + { + DeviceNo = deviceNo, + Start = start, + End = end, + IsFinished = false + }); + } + public async Task QiaoqiaoGaoshiqingAsync(DeviceUploadLogSecretAddRequest request) { var device = await _dbContext.Queryable().Where(x => x.UniqueNo == request.DeviceUniqueNo).SingleAsync(); @@ -122,7 +184,7 @@ public class DeviceUploadLogService : IDeviceUploadLogService TenantId = device.TenantId, Status = true, CreatedBy = 1, - ModifiedBy = 1, + ModifiedBy = 1 }); } diff --git a/Src/Dlhis.ScheduledTask/Jobs/CreateGetUploadRecordJob.cs b/Src/Dlhis.ScheduledTask/Jobs/CreateGetUploadRecordJob.cs index f43ccec9..433ca81a 100644 --- a/Src/Dlhis.ScheduledTask/Jobs/CreateGetUploadRecordJob.cs +++ b/Src/Dlhis.ScheduledTask/Jobs/CreateGetUploadRecordJob.cs @@ -37,7 +37,6 @@ public class CreateGetUploadRecordJob : BaseJob TenantId = x.TenantId, Version = 0, Type = DeviceTaskEnumType.UploadRecord, - CancellationId = 0, Priority = 50, Source = "定时任务创建设备获取通行记录任务" }).ToList(); diff --git a/Src/Dlhis.ScheduledTask/Properties/launchSettings.json b/Src/Dlhis.ScheduledTask/Properties/launchSettings.json index a6ea1802..93731c83 100644 --- a/Src/Dlhis.ScheduledTask/Properties/launchSettings.json +++ b/Src/Dlhis.ScheduledTask/Properties/launchSettings.json @@ -2,10 +2,12 @@ "profiles": { "Dlhis.ScheduledTask": { "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger/index.html", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, - "applicationUrl": "http://*:5010" + "applicationUrl": "http://localhost:5010;http://*:5010;" } } } \ No newline at end of file diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs index 29e079e6..6922436b 100644 --- a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs +++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs @@ -12,7 +12,6 @@ using Newtonsoft.Json.Linq; using Kurisu.AspNetCore.Utils; using Dlhis.ScheduledTask.TaskAssignment.Dto; using Kurisu.AspNetCore.CustomClass; -using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; namespace Dlhis.ScheduledTask.TaskAssignment.Services.Implements; @@ -153,12 +152,13 @@ public class AssignmentService : IAssignmentService case DeviceTaskEnumType.UploadRecord: { + var timeInfo = deviceUploadInfos[d]; dto.Info = new UploadRecordToDeviceResponse { DateTimePeriod = new DateTimePeriod { - Start = deviceUploadInfos.TryGetValue(d, out var dt) ? (dt ?? DateTime.Now) : DateTime.Now, - End = DateTime.Now.AddDays(1) + Start = timeInfo.Item1, + End = timeInfo.Item2 } }; } @@ -328,15 +328,21 @@ public class AssignmentService : IAssignmentService /// /// /// - private async Task> GetDeviceUploadRecordInfosAsync(List data) + private async Task> GetDeviceUploadRecordInfosAsync(List data) { if (data.All(x => x.Type != DeviceTaskEnumType.UploadRecord)) { - return new Dictionary(); + return new Dictionary(); } var deviceNos = data.Select(x => x.DeviceUniqueNo).Distinct().ToList(); - var result = new Dictionary(deviceNos.Count); + var result = new Dictionary(deviceNos.Count); + + var manualSettings = await _dbContext.Queryable().Where(x => deviceNos.Contains(x.DeviceNo)) + .Where(x => x.IsFinished == false) + .OrderBy(x => x.CreateTime) + .Select(x => new { x.Id, x.DeviceNo, x.Start, x.End }) + .ToListAsync(); var logInfos = await _dbContext.Queryable() .GroupBy(x => x.DeviceUniqueNo) @@ -347,12 +353,27 @@ public class AssignmentService : IAssignmentService }) .ToListAsync(); + var commonEnd = DateTime.Now.AddDays(1); foreach (var item in deviceNos) { - var logInfo = logInfos.FirstOrDefault(x => x.DeviceUniqueNo == item); - result.Add(item, logInfo?.RaiseDateTime); + var setting = manualSettings.FirstOrDefault(x => x.DeviceNo == item); + if (setting != null) + { + result.Add(item, (setting.Start, setting.End)); + } + else + { + var logInfo = logInfos.FirstOrDefault(x => x.DeviceUniqueNo == item); + result.Add(item, logInfo == null ? (DateTime.Now.AddMinutes(-10), commonEnd) : (logInfo.RaiseDateTime, commonEnd)); + } } + //更新为已处理 + await _dbContext.Updateable() + .SetColumns(x => x.IsFinished == true) + .Where(x => manualSettings.Select(p => p.Id).Contains(x.Id)) + .ExecuteCommandAsync(); + return result; } From 41411b4f2e4c56ae01ed5a0edab71aef94739140 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Thu, 19 Dec 2024 16:08:56 +0800 Subject: [PATCH 4/9] =?UTF-8?q?feat=20=E6=89=8B=E5=8A=A8=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=9D=83=E9=99=90=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DevicePermissionManuallyController.cs | 56 ++++++++++ .../DevicePermissionManuallyAddRequest.cs | 11 ++ .../DevicePermissionManuallyResponse.cs | 11 ++ .../IDevicePermissionManuallyService.cs | 14 +++ .../DevicePermissionManuallyService.cs | 103 ++++++++++++++++++ .../Implements/GainfoUpdateService.cs | 1 + .../DevicePermissionManuallyEntity.cs | 23 ++++ 7 files changed, 219 insertions(+) create mode 100644 Src/Dlhis.Basic/Device/Controllers/DevicePermissionManuallyController.cs create mode 100644 Src/Dlhis.Basic/Device/Request/DevicePermissionManuallyAddRequest.cs create mode 100644 Src/Dlhis.Basic/Device/Response/DevicePermissionManuallyResponse.cs create mode 100644 Src/Dlhis.Basic/Device/Services/IDevicePermissionManuallyService.cs create mode 100644 Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionManuallyService.cs create mode 100644 Src/Dlhis.Entity/Device/Entities/DevicePermissionManuallyEntity.cs diff --git a/Src/Dlhis.Basic/Device/Controllers/DevicePermissionManuallyController.cs b/Src/Dlhis.Basic/Device/Controllers/DevicePermissionManuallyController.cs new file mode 100644 index 00000000..0177d5c5 --- /dev/null +++ b/Src/Dlhis.Basic/Device/Controllers/DevicePermissionManuallyController.cs @@ -0,0 +1,56 @@ +using Dlhis.Basic.Device.Request; +using Dlhis.Basic.Device.Response; +using Dlhis.Basic.Device.Services; +using Kurisu.AspNetCore.DataAccess.Dto; +using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace Dlhis.Basic.Device.Controllers; + +[Authorize] +[Route("api/[controller]")] +[ApiController] +public class DevicePermissionManuallyController : ControllerBase +{ + private readonly IDevicePermissionManuallyService _devicePermissionService; + + public DevicePermissionManuallyController(IDevicePermissionManuallyService devicePermissionService) + { + _devicePermissionService = devicePermissionService; + } + + /// + /// 数据分页 + /// + /// + /// + [HttpGet("page")] + [DataPermission] + public async Task> GetPageAsync([FromQuery] PageDto requestDto) + { + return await _devicePermissionService.GetPageAsync(requestDto); + } + + /// + /// 添加权限 + /// + /// + [HttpPost("add")] + [Transactional] + public async Task AddAsync(DevicePermissionManuallyAddRequest request) + { + await _devicePermissionService.AddAsync(request); + } + + /// + /// 删除权限 + /// + /// + [HttpGet("{id:long}")] + [Transactional] + public async Task DeleteAsync(long id) + { + await _devicePermissionService.DeleteAsync(id); + } +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Device/Request/DevicePermissionManuallyAddRequest.cs b/Src/Dlhis.Basic/Device/Request/DevicePermissionManuallyAddRequest.cs new file mode 100644 index 00000000..2ae23a8e --- /dev/null +++ b/Src/Dlhis.Basic/Device/Request/DevicePermissionManuallyAddRequest.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace Dlhis.Basic.Device.Request; + +public class DevicePermissionManuallyAddRequest +{ + public Guid DeviceCode { get; set; } + + [Required] + public string UserNo { get; set; } +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Device/Response/DevicePermissionManuallyResponse.cs b/Src/Dlhis.Basic/Device/Response/DevicePermissionManuallyResponse.cs new file mode 100644 index 00000000..4ca605e6 --- /dev/null +++ b/Src/Dlhis.Basic/Device/Response/DevicePermissionManuallyResponse.cs @@ -0,0 +1,11 @@ +namespace Dlhis.Basic.Device.Response; + +public class DevicePermissionManuallyResponse +{ + public long Id { get; set; } + public Guid DeviceCode { get; set; } + public string DeviceUniqueNo { get; set; } + public string DeployPlace { get; set; } + public string UserNo { get; set; } + public string UserName { get; set; } +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Device/Services/IDevicePermissionManuallyService.cs b/Src/Dlhis.Basic/Device/Services/IDevicePermissionManuallyService.cs new file mode 100644 index 00000000..e2a6149b --- /dev/null +++ b/Src/Dlhis.Basic/Device/Services/IDevicePermissionManuallyService.cs @@ -0,0 +1,14 @@ +using Dlhis.Basic.Device.Request; +using Dlhis.Basic.Device.Response; +using Kurisu.AspNetCore.DataAccess.Dto; + +namespace Dlhis.Basic.Device.Services; + +public interface IDevicePermissionManuallyService : IScopeDependency +{ + Task> GetPageAsync(PageDto requestDto); + + Task AddAsync(DevicePermissionManuallyAddRequest request); + + Task DeleteAsync(long id); +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionManuallyService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionManuallyService.cs new file mode 100644 index 00000000..9c09542e --- /dev/null +++ b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionManuallyService.cs @@ -0,0 +1,103 @@ +using Dlhis.Basic.Device.Request; +using Dlhis.Basic.Device.Response; +using Dlhis.Entity.Basic.Entity; +using Dlhis.Entity.Device.Entities; +using Dlhis.Entity.Device.Enums; +using Kurisu.AspNetCore.DataAccess.Dto; +using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions; +using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; +using Kurisu.AspNetCore.Utils.Extensions; + +namespace Dlhis.Basic.Device.Services.Implements; + +public class DevicePermissionManuallyService : IDevicePermissionManuallyService +{ + private readonly IDbContext _dbContext; + + public DevicePermissionManuallyService(IDbContext dbContext) + { + _dbContext = dbContext; + } + + /// + public async Task> GetPageAsync(PageDto requestDto) + { + return await _dbContext.Queryable() + .LeftJoin((x, d) => x.DeviceCode == d.Code) + .LeftJoin((x, d, g) => x.UserNo == g.No) + .Select((x, d, g) => new DevicePermissionManuallyResponse + { + Id = x.Id, + DeviceCode = x.DeviceCode, + DeviceUniqueNo = d.UniqueNo, + DeployPlace = d.DeployPlace, + UserNo = x.UserNo, + UserName = g.Name + }) + .ToPageListAsync(requestDto); + } + + /// + public async Task AddAsync(DevicePermissionManuallyAddRequest request) + { + var device = await _dbContext.Queryable().Where(x => x.Code == request.DeviceCode).SingleAsync(); + device.ThrowIfNull("设备不存在"); + + var gainfo = await _dbContext.Queryable().Where(x => x.No == request.UserNo).SingleAsync(); + gainfo.ThrowIfNull("人员不存在"); + + + await _dbContext.InsertAsync(new DevicePermissionManuallyEntity + { + DeviceCode = request.DeviceCode, + UserNo = request.UserNo + }); + + await _dbContext.InsertAsync(new DeviceTaskEntity + { + Type = DeviceTaskEnumType.Add, + DeviceType = device.Type, + UserId = null, + UserNo = request.UserNo, + DeviceUniqueNo = device.UniqueNo, + Status = DeviceTaskStatusEnumType.Wait, + Version = 0, + ResultMessage = null, + Source = "手动分配额外权限", + Priority = 0, + TenantId = device.TenantId + }); + } + + /// + public async Task DeleteAsync(long id) + { + var data = await _dbContext.Queryable().Where(x => x.Id == id).SingleAsync(); + data.ThrowIfNull("数据不存在"); + + var device = await _dbContext.Queryable().Where(x => x.Code == data.DeviceCode).SingleAsync(); + if (device != null) + { + var userNo = await _dbContext.Queryable().Where(x => x.No == data.UserNo).Select(x => x.No).SingleAsync(); + if (userNo.IsPresent()) + { + await _dbContext.InsertAsync(new DeviceTaskEntity + { + Type = DeviceTaskEnumType.Delete, + DeviceType = device.Type, + UserId = null, + UserNo = userNo, + DeviceUniqueNo = device.UniqueNo, + Status = DeviceTaskStatusEnumType.Wait, + Version = 0, + ResultMessage = null, + Source = "手动分配额外权限", + Priority = 0, + TenantId = device.TenantId + }); + } + } + + await _dbContext.DeleteAsync(data); + } +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs index 5a3ad9bd..6dd86fb1 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs @@ -312,6 +312,7 @@ public class GainfoUpdateService : IGainfoUpdateService await _dbContext.Deleteable().Where(x => x.UserNo == gainfo.No).ExecuteCommandAsync(); await _dbContext.Deleteable().Where(x => x.AssignType == AssignTypeEnumType.User && x.AssignValue == gainfo.No).ExecuteCommandAsync(); + gainfo.Id = gainfo.IdentityUserId; await _dbContext.DeleteReallyAsync(gainfo); diff --git a/Src/Dlhis.Entity/Device/Entities/DevicePermissionManuallyEntity.cs b/Src/Dlhis.Entity/Device/Entities/DevicePermissionManuallyEntity.cs new file mode 100644 index 00000000..e61a1f73 --- /dev/null +++ b/Src/Dlhis.Entity/Device/Entities/DevicePermissionManuallyEntity.cs @@ -0,0 +1,23 @@ +using Dlhis.DataPermission.Model; +using Kurisu.AspNetCore.DataAccess.Entity; +using Kurisu.AspNetCore.DataAccess.SqlSugar; +using SqlSugar; + +namespace Dlhis.Entity.Device.Entities; + +/// +/// 设备权限(手动) +/// +[SugarTable(TableName = "DevicePermissionManually")] +public class DevicePermissionManuallyEntity : SugarBaseEntity, ISoftDeleted +{ + [DeviceCode] + [SugarColumn(IsNullable = false)] + public Guid DeviceCode { get; set; } + + [SugarColumn(IsNullable = false)] + public string UserNo { get; set; } + + /// + public bool IsDeleted { get; set; } +} \ No newline at end of file From beba2d19f34476f01f698a5f3d6f5f397ea278e5 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Mon, 30 Dec 2024 15:06:53 +0800 Subject: [PATCH 5/9] remove CancellationId --- .../Device/Services/Implements/DevicePermissionService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs index f42217ae..91d0ddbf 100644 --- a/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs +++ b/Src/Dlhis.Basic/Device/Services/Implements/DevicePermissionService.cs @@ -394,7 +394,6 @@ public class DevicePermissionService : IDevicePermissionService DeviceUniqueNo = device.UniqueNo, Status = DeviceTaskStatusEnumType.Wait, Type = DeviceTaskEnumType.Add, - CancellationId = 0, DeviceType = device.Type, UserNo = x, Version = 0, From d7ab8f27e663b04b53ac15efa44fe1ad09f2af01 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Fri, 3 Jan 2025 09:46:18 +0800 Subject: [PATCH 6/9] =?UTF-8?q?fix=20=E7=A7=BB=E9=99=A4=E5=9C=A8=E8=81=8C?= =?UTF-8?q?=E7=9A=84=E4=BB=BB=E5=8A=A1=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Organization/Services/Implements/GainfoUpdateService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs index 5a3ad9bd..122accd1 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs @@ -182,7 +182,6 @@ public class GainfoUpdateService : IGainfoUpdateService { await _dbContext.InsertAsync(info); await _identityUserSyncService.SyncAccountAsync(info.Code, info.Name, info.IdNo, info.Factory); - await _gainfoPermissionService.ResetPermissionsAsync(info.No, DeviceTaskEnumType.Add, null, "入职生成"); } else { From fddf77858efd94f2d9d4b4e60786c64fc44f35ec Mon Sep 17 00:00:00 2001 From: liguoyang Date: Fri, 3 Jan 2025 11:56:06 +0800 Subject: [PATCH 7/9] =?UTF-8?q?feat=20=E5=8D=A1=E7=B1=BB=E5=9E=8B=E7=BC=96?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Comparers/SapPersonComparer.cs | 4 +- .../Controllers/GainfoCardsController.cs | 24 +++++++++- .../Request/GainfoCardEditRequest.cs | 18 +++++++ .../Response/GainfoDetailResponse.cs | 11 +++-- .../Services/IGainfoCardService.cs | 15 ++++++ .../Services/Implements/GainfoCardService.cs | 47 ++++++++++++++++++- .../Services/Implements/GainfoService.cs | 2 +- .../Implements/GainfoUpdateService.cs | 16 ------- .../Basic/Entity/GainfoSapEntity.cs | 33 ++++++------- Src/Dlhis.Jip.Api/Dto/SapPersonItem.cs | 2 +- 10 files changed, 129 insertions(+), 43 deletions(-) create mode 100644 Src/Dlhis.Basic/Organization/Request/GainfoCardEditRequest.cs diff --git a/Src/Dlhis.Basic/Organization/Comparers/SapPersonComparer.cs b/Src/Dlhis.Basic/Organization/Comparers/SapPersonComparer.cs index 8ef64662..6cb3883a 100644 --- a/Src/Dlhis.Basic/Organization/Comparers/SapPersonComparer.cs +++ b/Src/Dlhis.Basic/Organization/Comparers/SapPersonComparer.cs @@ -33,7 +33,7 @@ public class SapPersonComparer : IEqualityComparer && (x.MASSN ?? string.Empty) == (y.MASSN ?? string.Empty) && (x.MNTXT ?? string.Empty) == (y.MNTXT ?? string.Empty) && (x.ZXUELI ?? string.Empty).Trim() == (y.ZXUELI ?? string.Empty).Trim() - && (x.ZZ_KLX ?? string.Empty) == (y.ZZ_KLX ?? string.Empty) + //&& (x.ZZ_KLX ?? string.Empty) == (y.ZZ_KLX ?? string.Empty) && (x.ZZ_GZDJDNM ?? string.Empty) == (y.ZZ_GZDJDNM ?? string.Empty) && (x.ZZ_GZDCQNM ?? string.Empty) == (y.ZZ_GZDCQNM ?? string.Empty) ; @@ -60,7 +60,7 @@ public class SapPersonComparer : IEqualityComparer ^ obj.MASSN.SafeGetHashCode() ^ obj.MNTXT.SafeGetHashCode() ^ obj.ZXUELI.SafeGetHashCode() - ^ obj.ZZ_KLX.SafeGetHashCode() + //^ obj.ZZ_KLX.SafeGetHashCode() ^ obj.ZZ_GZDJDNM.SafeGetHashCode() ^ obj.ZZ_GZDCQNM.SafeGetHashCode() ; diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs index 55e21c4d..82a85b1c 100644 --- a/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs +++ b/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs @@ -1,6 +1,7 @@ using Dlhis.Basic.Organization.Request; using Dlhis.Basic.Organization.Response; using Dlhis.Basic.Organization.Services; +using Kurisu.AspNetCore.CustomClass; using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -44,4 +45,25 @@ public class GainfoCardsController : ControllerBase { return await _gainfoCardService.GetChangeRecordsAsync(userNo); } -} + + /// + /// 获取卡类型 + /// + /// + [HttpGet("cardTypes")] + public async Task>> GetCardTypesAsync() + { + return await _gainfoCardService.GetCardTypesAsync(); + } + + /// + /// 编辑卡类型 + /// + /// + [HttpPost("cardType")] + public async Task EditCardTypeAsync(GainfoCardEditRequest request) + { + //string code, int typeId + await _gainfoCardService.EditCardTypeAsync(request.UserCode, request.CardType); + } +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Request/GainfoCardEditRequest.cs b/Src/Dlhis.Basic/Organization/Request/GainfoCardEditRequest.cs new file mode 100644 index 00000000..6c4887cb --- /dev/null +++ b/Src/Dlhis.Basic/Organization/Request/GainfoCardEditRequest.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; + +namespace Dlhis.Basic.Organization.Request; + +public class GainfoCardEditRequest +{ + /// + /// 工号 + /// + [Required(ErrorMessage = "工号不能为空")] + public string UserCode { get; set; } + + /// + /// 卡类型 + /// + [Range(1, 100, ErrorMessage = "卡类型有误")] + public int CardType { get; set; } +} \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs b/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs index acd65556..227c86a9 100644 --- a/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs +++ b/Src/Dlhis.Basic/Organization/Response/GainfoDetailResponse.cs @@ -45,7 +45,7 @@ public class GainfoDetailResponse /// /// 身份证号 /// - [JsonConverter(typeof(ObfuscateProviderJsonConverter), 6)] + [JsonConverter(typeof(ObfuscateProviderJsonConverter), 0)] public string IdNo { get; set; } /// @@ -67,17 +67,20 @@ public class GainfoDetailResponse /// 身份证地址 /// public string Address { get; set; } + + [JsonIgnore] + public DateTime OriginalBirthday { get; set; } /// /// 出生日期 /// - [JsonConverter(typeof(ToDateJsonConverter))] - public DateTime Birthday { get; set; } + [JsonConverter(typeof(ObfuscateProviderJsonConverter), 0)] + public string Birthday => OriginalBirthday.ToString("yyyy-MM-dd"); /// /// 手机号码 /// - [JsonConverter(typeof(ObfuscateProviderJsonConverter), 4)] + [JsonConverter(typeof(ObfuscateProviderJsonConverter), 0)] public string Phone { get; set; } /// diff --git a/Src/Dlhis.Basic/Organization/Services/IGainfoCardService.cs b/Src/Dlhis.Basic/Organization/Services/IGainfoCardService.cs index 42e8eea9..a3e5f425 100644 --- a/Src/Dlhis.Basic/Organization/Services/IGainfoCardService.cs +++ b/Src/Dlhis.Basic/Organization/Services/IGainfoCardService.cs @@ -1,5 +1,6 @@ using Dlhis.Basic.Organization.Request; using Dlhis.Basic.Organization.Response; +using Kurisu.AspNetCore.CustomClass; namespace Dlhis.Basic.Organization.Services; @@ -18,4 +19,18 @@ public interface IGainfoCardService : IScopeDependency /// /// Task> GetChangeRecordsAsync(string userNo); + + /// + /// 获取卡类型 + /// + /// + Task>> GetCardTypesAsync(); + + /// + /// 编辑卡类型 + /// + /// + /// + /// + Task EditCardTypeAsync(string code, int typeId); } \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs index 4524a1ae..ded048d9 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs @@ -1,6 +1,9 @@ -using Dlhis.Basic.Organization.Request; +using Dlhis.Basic.Device.Services; +using Dlhis.Basic.Organization.Request; using Dlhis.Basic.Organization.Response; using Dlhis.Entity.Basic.Entity; +using Dlhis.Entity.Device.Enums; +using Kurisu.AspNetCore.CustomClass; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; using Kurisu.AspNetCore.Utils.Extensions; using Mapster; @@ -11,11 +14,18 @@ public class GainfoCardService : IGainfoCardService { private readonly IDbContext _dbContext; private readonly IGainfoStore _gainfoStore; + private readonly IDevicePermissionService _devicePermissionService; + private readonly IGainfoPermissionService _gainfoPermissionService; - public GainfoCardService(IDbContext dbContext, IGainfoStore gainfoStore) + public GainfoCardService(IDbContext dbContext, + IGainfoStore gainfoStore, + IDevicePermissionService devicePermissionService, + IGainfoPermissionService gainfoPermissionService) { _dbContext = dbContext; _gainfoStore = gainfoStore; + _devicePermissionService = devicePermissionService; + _gainfoPermissionService = gainfoPermissionService; } public async Task ChangeCardAsync(GainfoChangeCardRequest request) @@ -46,4 +56,37 @@ public class GainfoCardService : IGainfoCardService }) .ToListAsync(); } + + public async Task>> GetCardTypesAsync() + { + var r = new List> + { + new() + { + Key = "行政卡", Value = "2" + }, + new() + { + Key = "车间卡", Value = "3" + } + }; + + return await Task.FromResult(r); + } + + public async Task EditCardTypeAsync(string code, int typeId) + { + var gainfo = await _dbContext.Queryable().Where(x => x.Code == code).SingleAsync(); + gainfo.ThrowIfNull("人员不存在"); + gainfo.CardType = typeId; + + var myDeviceCodes = await _devicePermissionService.GetUserDeviceCodesByNoAsync(gainfo.No); + var deviceCodes = await _dbContext.Queryable() + .Where(x => myDeviceCodes.Contains(x.Code)) + .Where(x => x.EnableTimePeriod) + .Select(x => x.Code) + .ToListAsync(); + + await _gainfoPermissionService.ResetPermissionsAsync(gainfo.No, DeviceTaskEnumType.Update, deviceCodes, "卡类型编辑下发"); + } } \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 032787e1..aa0a46a7 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -362,7 +362,7 @@ public class GainfoService : IGainfoService IdNo = ga.IdNo, Gender = ga.Gender, Address = ga.Address, - Birthday = ga.Birthday, + OriginalBirthday = ga.Birthday, Phone = ga.Phone, Grade = ga.Grade, Title = ga.Title, diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs index 122accd1..0724e80c 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoUpdateService.cs @@ -221,7 +221,6 @@ public class GainfoUpdateService : IGainfoUpdateService CostId = item.KOSTL, EntryDate = item.createdate, ResignationDate = item.ZLZRQ, - CardType = SafeParseCardType(item.ZZ_KLX), Workplace = _tenants.LastOrDefault(x => x.Name == item.ZZ_GZDJDNM)?.Code ?? item.ZZ_GZDJDNM, Factory = _tenants.FirstOrDefault(x => x.Name == item.ZZ_GZDCQNM)?.Code ?? item.ZZ_GZDCQNM, }; @@ -251,7 +250,6 @@ public class GainfoUpdateService : IGainfoUpdateService ZSTATUS = item.ZSTATUS, ZLZRQ = item.ZLZRQ, STELL_NM = item.STELL_NM, - ZZ_KLX = item.ZZ_KLX, createdate = item.createdate, ZZ_GZDJDNM = item.ZZ_GZDJDNM, ZZ_GZDCQNM = item.ZZ_GZDCQNM, @@ -284,7 +282,6 @@ public class GainfoUpdateService : IGainfoUpdateService ResignationDate = item.ZLZRQ, Workplace = workplace, Factory = factory, - CardType = SafeParseCardType(item.ZZ_KLX) }).Where(x => x.Code == item.ename).ExecuteCommandAsync(); await _identityUserSyncService.SyncAccountAsync(gainfo.Code, gainfo.Name, gainfo.IdNo, factory); @@ -355,7 +352,6 @@ public class GainfoUpdateService : IGainfoUpdateService ResignationDate = item.ZLZRQ, Workplace = workplace, Factory = factory, - CardType = SafeParseCardType(item.ZZ_KLX) }).Where(x => x.Code == item.ename).ExecuteCommandAsync(); } } @@ -385,7 +381,6 @@ public class GainfoUpdateService : IGainfoUpdateService ZWORKCODE = x.ename, ZZ_SFZH = x.idno, GBDAT = x.birthday, - ZZ_KLX = x.ZZ_KLX, ZXUELI = x.email, ORGEH = x.appellation, ZMOBILE = x.phone, @@ -432,7 +427,6 @@ public class GainfoUpdateService : IGainfoUpdateService ename = person.ZWORKCODE, idno = person.ZZ_SFZH, birthday = person.GBDAT, - ZZ_KLX = person.ZZ_KLX, email = person.ZXUELI, appellation = person.ORGEH, phone = person.ZMOBILE, @@ -477,14 +471,4 @@ public class GainfoUpdateService : IGainfoUpdateService idNo = idNo.TrimStart(); return idNo[..6]; } - - private static int? SafeParseCardType(string ZZ_KLX) - { - if (int.TryParse(ZZ_KLX, out var cardType)) - { - return cardType; - } - - return null; - } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs b/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs index d3207d59..804f2958 100644 --- a/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/GainfoSapEntity.cs @@ -13,7 +13,7 @@ namespace Dlhis.Entity.Basic.Entity public string @class { get; set; } public string passwd { get; set; } - + public string question { get; set; } public string answer { get; set; } @@ -28,7 +28,7 @@ namespace Dlhis.Entity.Basic.Entity public string sex { get; set; } public DateTime birthday { get; set; } public string address { get; set; } - + public string postcode { get; set; } public string occupation { get; set; } public string appellation { get; set; } @@ -37,24 +37,24 @@ namespace Dlhis.Entity.Basic.Entity public string fax { get; set; } public string mobile { get; set; } public string email { get; set; } - + public string web { get; set; } - + public string vip { get; set; } - + public string sec { get; set; } - + public string cropsno { get; set; } - + public string cropname { get; set; } - + public string fancy { get; set; } public string remark { get; set; } public int amount { get; set; } - + public int days { get; set; } - + public decimal consume01 { get; set; } public decimal consume02 { get; set; } @@ -102,17 +102,18 @@ namespace Dlhis.Entity.Basic.Entity public string MASSN { get; set; } public string MNTXT { get; set; } - + public string MASSG { get; set; } - + public string MGTXT { get; set; } public DateTime? logdate { get; set; } - + public DateTime? updatelogdate { get; set; } - + public string guestno { get; set; } - public string ZZ_KLX { get; set; } - + +// public string ZZ_KLX { get; set; }不再同步 + public DateTime? DAT01 { get; set; } public string ZZ_COUNNM { get; set; } diff --git a/Src/Dlhis.Jip.Api/Dto/SapPersonItem.cs b/Src/Dlhis.Jip.Api/Dto/SapPersonItem.cs index a20b2862..e3b90f53 100644 --- a/Src/Dlhis.Jip.Api/Dto/SapPersonItem.cs +++ b/Src/Dlhis.Jip.Api/Dto/SapPersonItem.cs @@ -15,7 +15,7 @@ public class SapPersonItem public string STELL_NM { get; set; } - public string ZZ_KLX { get; set; } + //public string ZZ_KLX { get; set; } /// /// From a915492d27d5fb3948c0798b357e7564a275a896 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Fri, 3 Jan 2025 17:39:32 +0800 Subject: [PATCH 8/9] =?UTF-8?q?feat=20=E5=A4=84=E7=90=86=E5=B7=B2=E7=9F=A5?= =?UTF-8?q?=E7=A6=85=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Services/IAppointmentService.cs | 10 ++++-- .../GainfoPermissionsController.cs | 2 +- .../Implements/GainfoOutsourceService.cs | 21 +++++++++++++ .../Services/Implements/GainfoService.cs | 31 ++++++++++++++----- .../Entities/DeviceUploadLogManuallyEntity.cs | 17 +++++++++- .../Services/IAppointmentService.cs | 11 +++++++ .../Services/Implements/AppointmentService.cs | 28 +++++++++++------ .../Implements/DeviceUploadLogService.cs | 4 ++- 8 files changed, 100 insertions(+), 24 deletions(-) diff --git a/Src/Dlhis.Basic/Appointment/Services/IAppointmentService.cs b/Src/Dlhis.Basic/Appointment/Services/IAppointmentService.cs index 7c037ee7..d875b375 100644 --- a/Src/Dlhis.Basic/Appointment/Services/IAppointmentService.cs +++ b/Src/Dlhis.Basic/Appointment/Services/IAppointmentService.cs @@ -1,9 +1,7 @@ using Dlhis.Basic.Appointment.Request; using Dlhis.Basic.Appointment.Response; -using Dlhis.Entity.Device.Enums; using Dlhis.Entity.Visitor.Enums; using Kurisu.AspNetCore.DataAccess.Dto; -using Microsoft.AspNetCore.Mvc; namespace Dlhis.Basic.Appointment.Services; @@ -57,9 +55,15 @@ public interface IAppointmentService : IScopeDependency /// Task> GetRecordListAsync(string factory, string search, VisitorAppointmentDetailStatusEnumType? status, DateTime start, DateTime end); - Task> GetRecordPageByIdNoAsync([FromQuery] AppointmentIdNoPageRequest request); + Task> GetRecordPageByIdNoAsync(AppointmentIdNoPageRequest request); Task GetSummaryAsync(string factory, DateTime start, DateTime end); + /// + /// 更新人脸 + /// + /// + /// + /// Task UpdateFaceAsync(long detailId, string base64); } \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfoPermissionsController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfoPermissionsController.cs index d6f0621f..b8faad8b 100644 --- a/Src/Dlhis.Basic/Organization/Controllers/GainfoPermissionsController.cs +++ b/Src/Dlhis.Basic/Organization/Controllers/GainfoPermissionsController.cs @@ -51,7 +51,7 @@ public class GainfoPermissionsController : ControllerBase /// /// /// - [Authorize(Roles = "admin,tenant-admin")] + //[Authorize(Roles = "admin,tenant-admin")] [HttpPost("reset")] public async Task ResetPermissionsAsync(GainfoPermissionResetRequest request) { diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs index b08bb76f..c5343ebb 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoOutsourceService.cs @@ -170,6 +170,27 @@ public class GainfoOutsourceService : IGainfoOutsourceService await using var handler = await _redisCache.LockAsync("gainfo:outsource:code-generate", expiry: TimeSpan.FromSeconds(3), retryInterval: TimeSpan.FromSeconds(1), retryCount: 3); handler.Acquired.ThrowIfFalse("生成虚拟工号失败"); + // var value = await _dbContext.Queryable().Where(x => x.Type == "gainfoExternalMaxNum").Select(x => x.Code).SingleAsync(); + // if (value.IsEmpty()) + // { + // code = 1; + // await _dbContext.InsertAsync(new BasicTypeEntity + // { + // Type = "gainfoExternalMaxNum", + // Code = "1", + // Display = "外部人员序号", + // DisplayEn = "外部人员序号", + // Sequence = 1 + // }); + // } + // else + // { + // code = int.Parse(value) + 1; + // } + // + // return "EXT" + code.ToString().PadLeft(6, '0'); + + int code; var entity = await _dbContext.Queryable().Where(x => x.Code.StartsWith("LS")).OrderBy(x => x.Id, OrderByType.Desc).FirstAsync(); if (entity == null) diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index aa0a46a7..af06ba7f 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -1,4 +1,5 @@ -using Dlhis.Basic.Device.Services; +using Dlhis.Basic.Appointment.Services; +using Dlhis.Basic.Device.Services; using Dlhis.Basic.Organization.Request; using Dlhis.Basic.Organization.Response; using Dlhis.Entity.Basic.Entity; @@ -8,6 +9,7 @@ using Dlhis.Entity.Device.Enums; using Dlhis.Entity.Sys.Entities; using Dlhis.Entity.Sys.Enums; using Dlhis.Entity.Visitor.Entity; +using Dlhis.Entity.Visitor.Enums; using Dlhis.Sys.Api; using Kurisu.AspNetCore.Authentication.Abstractions; using Kurisu.AspNetCore.DataAccess.Dto; @@ -29,6 +31,7 @@ public class GainfoService : IGainfoService private readonly IJinkoSapService _jinkoSapService; private readonly IDevicePermissionService _devicePermissionService; private readonly IGainfoPermissionService _gainfoPermissionService; + private readonly IAppointmentService _appointmentService; private readonly ILogger _logger; public GainfoService(IGainfoStore gainfoStore, @@ -39,6 +42,7 @@ public class GainfoService : IGainfoService IJinkoSapService jinkoSapService, IDevicePermissionService devicePermissionService, IGainfoPermissionService gainfoPermissionService, + IAppointmentService appointmentService, ILogger logger) { _gainfoStore = gainfoStore; @@ -49,6 +53,7 @@ public class GainfoService : IGainfoService _jinkoSapService = jinkoSapService; _devicePermissionService = devicePermissionService; _gainfoPermissionService = gainfoPermissionService; + _appointmentService = appointmentService; _logger = logger; } @@ -248,16 +253,26 @@ public class GainfoService : IGainfoService var gainfo = await _dbContext.Queryable().SingleAsync(x => x.Id == request.Id); gainfo.ThrowIfNull("档案数据不存在"); - if (request.IsOutsource) + if (gainfo.Type == GainfoUserTypeEnumType.External) { - var outsource = await _dbContext.Queryable().SingleAsync(x => x.Code == gainfo.Code); - (outsource == null).ThrowIfTrue("非外包人员不可手动离职"); + var visitorAppointmentDetails = await _dbContext.Queryable() + .Where(x => x.UserNo == gainfo.No) + .Where(x => x.DoorStatus == VisitorAppointmentDetailStatusEnumType.Wait || x.WorkplaceStatus == VisitorAppointmentDetailStatusEnumType.Wait) + .ToListAsync(); + + + foreach (var visitorAppointment in visitorAppointmentDetails) + { + await _appointmentService.FocusLeaveAsync(visitorAppointment.Id, request.Reason); + } } + else + { + await _gainfoPermissionService.ResetPermissionsAsync(gainfo.No, DeviceTaskEnumType.Delete, null, request.Reason); - await _gainfoPermissionService.ResetPermissionsAsync(gainfo.No, DeviceTaskEnumType.Delete, null, request.Reason); - - await _dbContext.Deleteable().Where(x => x.UserNo == gainfo.No).ExecuteCommandAsync(); - await _dbContext.Deleteable().Where(x => x.AssignType == AssignTypeEnumType.User && x.AssignValue == gainfo.No).ExecuteCommandAsync(); + await _dbContext.Deleteable().Where(x => x.UserNo == gainfo.No).ExecuteCommandAsync(); + await _dbContext.Deleteable().Where(x => x.AssignType == AssignTypeEnumType.User && x.AssignValue == gainfo.No).ExecuteCommandAsync(); + } //先写入离职表 gainfo.IdentityUserId = (int)gainfo.Id; //记录原始id diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs index 6be6f3a0..3d2146a0 100644 --- a/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs +++ b/Src/Dlhis.Entity/Device/Entities/DeviceUploadLogManuallyEntity.cs @@ -4,18 +4,33 @@ using SqlSugar; namespace Dlhis.Entity.Device.Entities; -[SugarTable(TableName = "DeviceUploadLogManually", TableDescription = "设备上传记录")] +/// +/// 设备通行记录手动获取配置 +/// +[SugarTable(TableName = "DeviceUploadLogManually", TableDescription = "设备通行记录手动获取配置")] public class DeviceUploadLogManuallyEntity : SugarBaseEntity, ITenantId { + /// + /// 设备号 + /// [SugarColumn(IsNullable = false, IndexGroupNameList = new[] { "idx_DeviceUploadLogManually_deviceNo" })] public string DeviceNo { get; set; } + /// + /// 开始时间 + /// [SugarColumn(IsNullable = false)] public DateTime Start { get; set; } + /// + /// 结束时间 + /// [SugarColumn(IsNullable = false)] public DateTime End { get; set; } + /// + /// 是否完成 + /// [SugarColumn(IsNullable = false, ColumnDataType = "bit")] public bool IsFinished { get; set; } diff --git a/Src/Dlhis.External/Appointment/Services/IAppointmentService.cs b/Src/Dlhis.External/Appointment/Services/IAppointmentService.cs index 7dab3e68..0d701f4d 100644 --- a/Src/Dlhis.External/Appointment/Services/IAppointmentService.cs +++ b/Src/Dlhis.External/Appointment/Services/IAppointmentService.cs @@ -4,5 +4,16 @@ namespace Dlhis.External.Appointment.Services; public interface IAppointmentService : IScopeDependency { + /// + /// 接收申请 + /// + /// + /// Task ReceiveAsync(VisitorAppointmentReceiveRequest request); + + /// + /// 获取下一位外部人员工号 + /// + /// + Task GetNextExternalCodeAsync(); } \ No newline at end of file diff --git a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs index fc523f0d..556bfdfa 100644 --- a/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs +++ b/Src/Dlhis.External/Appointment/Services/Implements/AppointmentService.cs @@ -7,7 +7,6 @@ using Kurisu.AspNetCore.Cache; using Kurisu.AspNetCore.CustomClass; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; using Kurisu.AspNetCore.Utils.Extensions; -using SqlSugar; namespace Dlhis.External.Appointment.Services.Implements; @@ -70,7 +69,7 @@ public class AppointmentService : IAppointmentService gainfo = new GainfoEntity { No = Guid.NewGuid().ToString(), - Code = await GetExternalCodeAsync(), + Code = await GetNextExternalCodeAsync(), Gender = GetGender(item.IdNo), Type = GainfoUserTypeEnumType.External, IdNo = item.IdNo, @@ -131,7 +130,7 @@ public class AppointmentService : IAppointmentService } } - private GenderEnumType GetGender(string idNo) + private static GenderEnumType GetGender(string idNo) { try { @@ -142,31 +141,40 @@ public class AppointmentService : IAppointmentService : GenderEnumType.Male; } } - catch (Exception e) + catch (Exception) { + //ignore } return GenderEnumType.Unknown; } - private async Task GetExternalCodeAsync() + public async Task GetNextExternalCodeAsync() { await using var handler = await _redisCache.LockAsync("gainfo:external:code-generate", expiry: TimeSpan.FromSeconds(3), retryInterval: TimeSpan.FromSeconds(1), retryCount: 3); handler.Acquired.ThrowIfFalse("生成虚拟工号失败"); int code; - var entity = await _dbContext.Queryable() - .Where(x => x.Type == GainfoUserTypeEnumType.External && x.Code.StartsWith("EXT")) - .OrderBy(x => x.Id, OrderByType.Desc) - .FirstAsync(); + var entity = await _dbContext.Queryable().Where(x => x.Type == "gainfoExternalMaxNum").SingleAsync(); if (entity == null) { code = 1; + await _dbContext.InsertAsync(new BasicTypeEntity + { + Type = "gainfoExternalMaxNum", + Code = "1", + Display = "外部人员序号", + DisplayEn = "外部人员序号", + Remark = string.Empty, + Sequence = 1 + }); } else { - code = int.Parse(entity.Code.Replace("EXT", "").TrimStart('0')) + 1; + code = int.Parse(entity.Code) + 1; + entity.Code = code.ToString(); + await _dbContext.UpdateAsync(entity); } return "EXT" + code.ToString().PadLeft(6, '0'); diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs index 308d9a99..7dcdfc67 100644 --- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs +++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Services/Implements/DeviceUploadLogService.cs @@ -153,8 +153,10 @@ public class DeviceUploadLogService : IDeviceUploadLogService /// public async Task ManuallySetTimeInfoAsync(string deviceNo, DateTime start, DateTime end) { + var device = await _dbContext.Queryable().Where(x => x.UniqueNo == deviceNo).SingleAsync(); + (device.Type != DeviceTypeEnumType.Attendance && device.Type != DeviceTypeEnumType.Door).ThrowIfTrue("不支持该设备类型"); var exists = await _dbContext.Queryable().Where(x => x.DeviceNo == deviceNo).Where(x => x.IsFinished == false).AnyAsync(); - exists.ThrowIfTrue("已存在时间配置尚未完成"); + exists.ThrowIfTrue("已存在配置尚未完成"); await _dbContext.InsertAsync(new DeviceUploadLogManuallyEntity { From a9d284b43c40eb1c995b5327ed61431289effae5 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Mon, 6 Jan 2025 10:57:04 +0800 Subject: [PATCH 9/9] =?UTF-8?q?fix=20=E4=BC=98=E5=8C=96=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/GainfoCardsController.cs | 15 +----- .../Request/GainfoCardEditRequest.cs | 4 +- .../Services/IGainfoCardService.cs | 11 +--- .../Services/Implements/GainfoCardService.cs | 51 ++++++++----------- .../Device/Entities/DeviceTaskEntity.cs | 1 + .../Services/Implements/AssignmentService.cs | 2 - 6 files changed, 28 insertions(+), 56 deletions(-) diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs index 82a85b1c..df849686 100644 --- a/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs +++ b/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs @@ -45,17 +45,7 @@ public class GainfoCardsController : ControllerBase { return await _gainfoCardService.GetChangeRecordsAsync(userNo); } - - /// - /// 获取卡类型 - /// - /// - [HttpGet("cardTypes")] - public async Task>> GetCardTypesAsync() - { - return await _gainfoCardService.GetCardTypesAsync(); - } - + /// /// 编辑卡类型 /// @@ -63,7 +53,6 @@ public class GainfoCardsController : ControllerBase [HttpPost("cardType")] public async Task EditCardTypeAsync(GainfoCardEditRequest request) { - //string code, int typeId - await _gainfoCardService.EditCardTypeAsync(request.UserCode, request.CardType); + await _gainfoCardService.EditCardTypeAsync(request.UserCodes, request.CardType); } } \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Request/GainfoCardEditRequest.cs b/Src/Dlhis.Basic/Organization/Request/GainfoCardEditRequest.cs index 6c4887cb..378f3481 100644 --- a/Src/Dlhis.Basic/Organization/Request/GainfoCardEditRequest.cs +++ b/Src/Dlhis.Basic/Organization/Request/GainfoCardEditRequest.cs @@ -7,8 +7,8 @@ public class GainfoCardEditRequest /// /// 工号 /// - [Required(ErrorMessage = "工号不能为空")] - public string UserCode { get; set; } + [MinLength(1, ErrorMessage = "工号不能为空")] + public List UserCodes { get; set; } /// /// 卡类型 diff --git a/Src/Dlhis.Basic/Organization/Services/IGainfoCardService.cs b/Src/Dlhis.Basic/Organization/Services/IGainfoCardService.cs index a3e5f425..e1c285ff 100644 --- a/Src/Dlhis.Basic/Organization/Services/IGainfoCardService.cs +++ b/Src/Dlhis.Basic/Organization/Services/IGainfoCardService.cs @@ -1,6 +1,5 @@ using Dlhis.Basic.Organization.Request; using Dlhis.Basic.Organization.Response; -using Kurisu.AspNetCore.CustomClass; namespace Dlhis.Basic.Organization.Services; @@ -20,17 +19,11 @@ public interface IGainfoCardService : IScopeDependency /// Task> GetChangeRecordsAsync(string userNo); - /// - /// 获取卡类型 - /// - /// - Task>> GetCardTypesAsync(); - /// /// 编辑卡类型 /// - /// + /// /// /// - Task EditCardTypeAsync(string code, int typeId); + Task EditCardTypeAsync(List userCodes, int typeId); } \ No newline at end of file diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs index ded048d9..8957da51 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoCardService.cs @@ -3,7 +3,6 @@ using Dlhis.Basic.Organization.Request; using Dlhis.Basic.Organization.Response; using Dlhis.Entity.Basic.Entity; using Dlhis.Entity.Device.Enums; -using Kurisu.AspNetCore.CustomClass; using Kurisu.AspNetCore.DataAccess.SqlSugar.Services; using Kurisu.AspNetCore.Utils.Extensions; using Mapster; @@ -14,17 +13,17 @@ public class GainfoCardService : IGainfoCardService { private readonly IDbContext _dbContext; private readonly IGainfoStore _gainfoStore; - private readonly IDevicePermissionService _devicePermissionService; + private readonly IDevicePermissionAnalyzeService _devicePermissionAnalyzeService; private readonly IGainfoPermissionService _gainfoPermissionService; public GainfoCardService(IDbContext dbContext, IGainfoStore gainfoStore, - IDevicePermissionService devicePermissionService, + IDevicePermissionAnalyzeService devicePermissionAnalyzeService, IGainfoPermissionService gainfoPermissionService) { _dbContext = dbContext; _gainfoStore = gainfoStore; - _devicePermissionService = devicePermissionService; + _devicePermissionAnalyzeService = devicePermissionAnalyzeService; _gainfoPermissionService = gainfoPermissionService; } @@ -57,36 +56,28 @@ public class GainfoCardService : IGainfoCardService .ToListAsync(); } - public async Task>> GetCardTypesAsync() + + public async Task EditCardTypeAsync(List userCodes, int typeId) { - var r = new List> + var gainfos = await _dbContext.Queryable().Where(x => userCodes.Contains(x.Code)).ToListAsync(); + (gainfos.Count == userCodes.Count).ThrowIfFalse("人员不存在"); + + var result = await _devicePermissionAnalyzeService.GetUserAssignDeviceCodesWithTypeInTenantAsync(gainfos.Select(x => x.No).ToList()); + foreach (var gainfo in gainfos) { - new() - { - Key = "行政卡", Value = "2" - }, - new() - { - Key = "车间卡", Value = "3" - } - }; + var userNo = gainfo.No; + var myDeviceCodes = result[userNo].SelectMany(x => x.AssignTypes.SelectMany(p => p.Codes)).Distinct().ToList(); - return await Task.FromResult(r); - } + var deviceCodes = await _dbContext.Queryable() + .Where(x => myDeviceCodes.Contains(x.Code)) + .Where(x => x.EnableTimePeriod) + .Select(x => x.Code) + .ToListAsync(); - public async Task EditCardTypeAsync(string code, int typeId) - { - var gainfo = await _dbContext.Queryable().Where(x => x.Code == code).SingleAsync(); - gainfo.ThrowIfNull("人员不存在"); - gainfo.CardType = typeId; + await _gainfoPermissionService.ResetPermissionsAsync(userNo, DeviceTaskEnumType.Update, deviceCodes, "卡类型编辑下发"); + gainfo.CardType = typeId; + } - var myDeviceCodes = await _devicePermissionService.GetUserDeviceCodesByNoAsync(gainfo.No); - var deviceCodes = await _dbContext.Queryable() - .Where(x => myDeviceCodes.Contains(x.Code)) - .Where(x => x.EnableTimePeriod) - .Select(x => x.Code) - .ToListAsync(); - - await _gainfoPermissionService.ResetPermissionsAsync(gainfo.No, DeviceTaskEnumType.Update, deviceCodes, "卡类型编辑下发"); + await _dbContext.UpdateAsync(gainfos); } } \ No newline at end of file diff --git a/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs b/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs index 41d69385..2317377b 100644 --- a/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs +++ b/Src/Dlhis.Entity/Device/Entities/DeviceTaskEntity.cs @@ -33,6 +33,7 @@ public class DeviceTaskEntity : SugarBaseEntity, ITenantId, IVersion /// /// 用户档案号 /// + [SugarColumn(IsNullable = true)] public string UserNo { get; set; } /// diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs index 6922436b..7439e54e 100644 --- a/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs +++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Services/Implements/AssignmentService.cs @@ -262,8 +262,6 @@ public class AssignmentService : IAssignmentService .WhereIF(request.Brand.IsPresent(), (deviceTask, device, deviceTemplate) => deviceTemplate.Brand == request.Brand) .Where((deviceTask, device, deviceTemplate, ga, gaLeave, department, deviceRegistry) => device.HeartbeatInterval == 0 || SqlFunc.DateAdd(deviceRegistry.LastHeartbeatTime, device.HeartbeatInterval, DateType.Second) > DateTime.Now) -#if !DEBUG -#endif .OrderBy(deviceTask => new { deviceTask.CreateTime, Priority = SqlFunc.Desc(deviceTask.Priority) }) .Select((deviceTask, device, deviceTemplate, ga, gaLeave, department) => new TaskDto {