From bb4c617340baa5c307848e804a37127b030e0959 Mon Sep 17 00:00:00 2001 From: liguoyang Date: Mon, 8 Jan 2024 20:49:25 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=20=E7=94=A8=E6=88=B7=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E9=97=AE=E9=A2=98,=E6=A1=A3=E6=A1=88=E8=B0=83=E6=95=B4,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessPlaceWithShiftResponse.cs | 12 +- .../Request/BusinessPlaceShiftSaveRequest.cs | 5 + .../BusinessPlaceShiftTinyResponse.cs | 24 ++++ .../Implements/BusinessPlaceShiftService.cs | 15 ++- .../Controllers/GainfosController.cs | 28 +---- .../Organization/Request/GainfoSaveRequest.cs | 96 ++++---------- .../Response/GainfoPageResponse.cs | 2 +- .../Organization/Services/IGainfoService.cs | 9 +- .../Organization/Services/IGainfoStore.cs | 15 ++- .../Services/Implements/GainfoService.cs | 117 +++++++++--------- .../Services/Implements/GainfoStore.cs | 24 +++- .../Entity/CanteenBusinessShiftEntity.cs | 6 + Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs | 13 +- Src/Dlhis.Entity/Basic/Entity/Gainfofields.cs | 53 -------- .../Sys/Entities/IdentityResourceClaims.cs | 10 ++ .../Sys/Entities/IdentityResources.cs | 23 ++++ Src/Dlhis.Entity/Sys/Entities/UserClaims.cs | 16 +++ Src/Dlhis.Entity/Sys/Entities/UserEntity.cs | 46 ++++++- .../Identity/Controllers/UsersController.cs | 10 +- .../Identity/Services/IUserService.cs | 2 + .../Services/Implements/UserService.cs | 5 + 21 files changed, 295 insertions(+), 236 deletions(-) create mode 100644 Src/Dlhis.Basic/BusinessShift/Response/BusinessPlaceShiftTinyResponse.cs delete mode 100644 Src/Dlhis.Entity/Basic/Entity/Gainfofields.cs create mode 100644 Src/Dlhis.Entity/Sys/Entities/IdentityResourceClaims.cs create mode 100644 Src/Dlhis.Entity/Sys/Entities/IdentityResources.cs create mode 100644 Src/Dlhis.Entity/Sys/Entities/UserClaims.cs diff --git a/Src/Dlhis.Basic/BusinessPlace/Response/BusinessPlaceWithShiftResponse.cs b/Src/Dlhis.Basic/BusinessPlace/Response/BusinessPlaceWithShiftResponse.cs index 69baba51..6b5374f5 100644 --- a/Src/Dlhis.Basic/BusinessPlace/Response/BusinessPlaceWithShiftResponse.cs +++ b/Src/Dlhis.Basic/BusinessPlace/Response/BusinessPlaceWithShiftResponse.cs @@ -4,8 +4,18 @@ namespace Dlhis.Basic.BusinessPlace.Response; public class BusinessPlaceWithShiftResponse { + /// + /// 营业点手工号 + /// public string CustomCode { get; set; } + + /// + /// 营业点 + /// public string Name { get; set; } - public List Shifts { get; set; } + /// + /// 餐次 + /// + public List Shifts { get; set; } } diff --git a/Src/Dlhis.Basic/BusinessShift/Request/BusinessPlaceShiftSaveRequest.cs b/Src/Dlhis.Basic/BusinessShift/Request/BusinessPlaceShiftSaveRequest.cs index ad49ea9c..6ffb8105 100644 --- a/Src/Dlhis.Basic/BusinessShift/Request/BusinessPlaceShiftSaveRequest.cs +++ b/Src/Dlhis.Basic/BusinessShift/Request/BusinessPlaceShiftSaveRequest.cs @@ -24,6 +24,11 @@ public class BusinessPlaceShiftSaveRequest : IValidatableObject [Required(ErrorMessage = "餐次名称不能为空")] public string Name { get; set; } + /// + /// 序号 + /// + public int Sequence { get; set; } = 100; + /// /// 时间段 /// diff --git a/Src/Dlhis.Basic/BusinessShift/Response/BusinessPlaceShiftTinyResponse.cs b/Src/Dlhis.Basic/BusinessShift/Response/BusinessPlaceShiftTinyResponse.cs new file mode 100644 index 00000000..5e39079a --- /dev/null +++ b/Src/Dlhis.Basic/BusinessShift/Response/BusinessPlaceShiftTinyResponse.cs @@ -0,0 +1,24 @@ +namespace Dlhis.Basic.BusinessShift.Response; + +public class BusinessPlaceShiftTinyResponse +{ + /// + /// 自定义代号 + /// + public string CustomCode { get; set; } + + /// + /// 餐次名称 + /// + public string Name { get; set; } + + /// + /// 经营开始时间 + /// + public TimeOnly Start { get; set; } + + /// + /// 经营结束时间 + /// + public TimeOnly End { get; set; } +} diff --git a/Src/Dlhis.Basic/BusinessShift/Services/Implements/BusinessPlaceShiftService.cs b/Src/Dlhis.Basic/BusinessShift/Services/Implements/BusinessPlaceShiftService.cs index a1993c14..a2f417bb 100644 --- a/Src/Dlhis.Basic/BusinessShift/Services/Implements/BusinessPlaceShiftService.cs +++ b/Src/Dlhis.Basic/BusinessShift/Services/Implements/BusinessPlaceShiftService.cs @@ -76,22 +76,21 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService { return new BusinessPlaceWithShiftResponse() { - Shifts = new List() + Shifts = new List() }; } - var shifts = await _dbContext.Queryable().Where(x => x.BusinessPlaceCode == place.Code).ToListAsync(); + + var shifts = await _dbContext.Queryable() + .Where(x => x.BusinessPlaceCode == place.Code) + .OrderBy(x => x.Sequence) //排序 + .ToListAsync(); return new BusinessPlaceWithShiftResponse { CustomCode = placeCustomCode, Name = place.Name, - Shifts = shifts.Select(shift => new BusinessPlaceShiftResponse + Shifts = shifts.Select(shift => new BusinessPlaceShiftTinyResponse { - Id = shift.Id, - BusinessPlaceCode = place.Code, - BusinessPlaceCustomCode = place.CustomCode, - BusinessPlace = place.Name, - Code = shift.Code, CustomCode = shift.CustomCode, Name = shift.Name, Start = shift.Start, diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs index 868b8d77..93590dd6 100644 --- a/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs +++ b/Src/Dlhis.Basic/Organization/Controllers/GainfosController.cs @@ -1,7 +1,6 @@ using Dlhis.Basic.Organization.Request; using Dlhis.Basic.Organization.Response; using Dlhis.Basic.Organization.Services; -using Dlhis.Entity.Basic.Entity; using Kurisu.AspNetCore.MVC; using Kurisu.Core.DataAccess.Dto; using Microsoft.AspNetCore.Authorization; @@ -28,12 +27,12 @@ public class GainfosController : ControllerBase /// /// 档案表保存 /// - /// + /// /// [HttpPost("save")] - public async Task SaveAsync(GainfoSaveRequest request) + public async Task SaveAsync(List requests) { - await _gainfoService.SaveAsync(request); + await _gainfoService.SaveAsync(requests); } /// @@ -79,26 +78,5 @@ public class GainfosController : ControllerBase { await _gainfoService.OnboardingAsync(request); } - - /// - /// 获取所有字段 - /// - /// - [HttpGet("GetAllFields")] - public List GetAllFields() - { - return _gainfoService.GetAllFields(); - } - - - /// - /// 获取固定字段信息字段 - /// - /// - [HttpGet("GetAllFieldData")] - public List GetAllFieldData(string fieldName) - { - return _gainfoService.GetAllFieldData(fieldName); - } } diff --git a/Src/Dlhis.Basic/Organization/Request/GainfoSaveRequest.cs b/Src/Dlhis.Basic/Organization/Request/GainfoSaveRequest.cs index 3bea1e69..895357ff 100644 --- a/Src/Dlhis.Basic/Organization/Request/GainfoSaveRequest.cs +++ b/Src/Dlhis.Basic/Organization/Request/GainfoSaveRequest.cs @@ -1,6 +1,5 @@ using System.ComponentModel.DataAnnotations; using Dlhis.Entity.Basic.Enums; -using SqlSugar; namespace Dlhis.Basic.Organization.Request; @@ -14,40 +13,37 @@ public class GainfoSaveRequest : IValidatableObject [EnumDataType(typeof(GainfoStatusEnumType))] public GainfoStatusEnumType? GainfoStatus { get; set; } - /// - /// SAP内部编号 - /// - public string Ano { get; set; } - - /// - /// 人员类型 - /// - public string Class { get; set; } + public string SapNo { get; set; } /// /// 姓名 /// - public string Gname { get; set; } + public string Name { get; set; } + + /// + /// 外文名字 + /// + public string NameEn { get; set; } /// /// 工号 /// - public string Ename { get; set; } + public string Code { get; set; } /// /// 国家代码 /// - public string Country { get; set; } + public string CountryNo { get; set; } /// /// 证件类型代码 /// - public string Idcls { get; set; } + public string IdClass { get; set; } /// /// 身份证号 /// - public string IdNO { get; set; } + public string IdNo { get; set; } /// /// 身份证籍贯区域代码 @@ -57,7 +53,7 @@ public class GainfoSaveRequest : IValidatableObject /// /// 性别 /// - public string Sex { get; set; } + public GenderEnumType Gender { get; set; } /// /// 生日 @@ -72,12 +68,12 @@ public class GainfoSaveRequest : IValidatableObject /// /// 已婚/未婚 /// - public string Postcode { get; set; } + public string Marital { get; set; } /// /// 部门编码 /// - public string Appellation { get; set; } + public string DepartmentNo { get; set; } /// /// 民族代码 @@ -89,11 +85,6 @@ public class GainfoSaveRequest : IValidatableObject /// public string Phone { get; set; } - /// - /// 联系电话 - /// - public string Mobile { get; set; } - /// /// 学历 /// @@ -102,70 +93,27 @@ public class GainfoSaveRequest : IValidatableObject /// /// 岗位 /// - public string Web { get; set; } - - /// - /// 备注 - /// - public string Remark { get; set; } - - /// - /// 操作账号 - /// - public string Log_id { get; set; } - - /// - /// 操作班次 - /// - public string Log_shift { get; set; } - - /// - /// 操作时间 - /// - public DateTime Log_date { get; set; } - - /// - /// 操作IP - /// - public string Log_ip { get; set; } - - /// - /// 是否在职 F 在职 T离职 - /// - public string Isowner { get; set; } - - /// - /// 创建时间 - /// - public DateTime Createdate { get; set; } - - /// - /// 外文名字 - /// - public string Gname_en { get; set; } + public string Position { get; set; } /// /// 卡号 /// public string CarNo { get; set; } + /// + /// 备注 + /// + public string Remark { get; set; } + /// /// 人事范围 /// - [SugarColumn(ColumnDescription = "人事范围")] public string Werks { get; set; } /// - /// 人员号 + /// 在职状态 /// - [SugarColumn(ColumnDescription = "人员号")] - public string Pernr { get; set; } - - /// - /// 邮箱 - /// - [SugarColumn(ColumnDescription = "邮箱")] - public string Email { get; set; } + public string Employed { get; set; } public IEnumerable Validate(ValidationContext validationContext) { diff --git a/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs b/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs index 6c2a976b..5c3a43be 100644 --- a/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs +++ b/Src/Dlhis.Basic/Organization/Response/GainfoPageResponse.cs @@ -12,7 +12,7 @@ public class GainfoPageResponse /// /// 人员类型 /// - public string GType { get; set; } + public string Type { get; set; } /// /// 姓名 diff --git a/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs b/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs index 61e44a9d..43fbd0f8 100644 --- a/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/IGainfoService.cs @@ -6,17 +6,14 @@ namespace Dlhis.Basic.Organization.Services; public interface IGainfoService : IScopeDependency { - Task SaveAsync(GainfoSaveRequest request); - Task> GetPageAsync(GainfoPageRequest request); + + Task SaveAsync(List requests); + Task UpdateAsync(GainfoSaveRequest request); Task DimissionAsync(GainfoDImissionRequest request); Task OnboardingAsync(GainfoDImissionRequest request); - - public List GetAllFieldData(string fieldName); - - public List GetAllFields(); } diff --git a/Src/Dlhis.Basic/Organization/Services/IGainfoStore.cs b/Src/Dlhis.Basic/Organization/Services/IGainfoStore.cs index 5fb918d7..3204fb74 100644 --- a/Src/Dlhis.Basic/Organization/Services/IGainfoStore.cs +++ b/Src/Dlhis.Basic/Organization/Services/IGainfoStore.cs @@ -11,9 +11,18 @@ public interface IGainfoStore : IScopeDependency { ISugarQueryable Queryable(GainfoStatusEnumType? gainfoStatus); - Task InsertAsync(GainfoStatusEnumType? gainfoStatus, List entities); - Task UpdateAsync(GainfoStatusEnumType? gainfoStatus, List entities); - Task DeleteAsync(GainfoStatusEnumType? gainfoStatus, List entities); + Task InsertAsync(List entities, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working); + Task InsertAsync(GainfoEntity entity, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working); + + + + Task UpdateAsync(List entities, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working); + Task UpdateAsync(GainfoEntity entity, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working); + + + + Task DeleteAsync(List entities, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working); + Task DeleteAsync(GainfoEntity entity, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working); } diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 4ca1306a..97404be6 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -13,7 +13,6 @@ namespace Dlhis.Basic.Organization.Services.Implements; public class GainfoService : IGainfoService { - private readonly IGainfoStore _gainfoStore; private readonly IDbContext _dbContext; @@ -28,9 +27,12 @@ public class GainfoService : IGainfoService /// /// /// - public Task> GetPageAsync(GainfoPageRequest request) + public async Task> GetPageAsync(GainfoPageRequest request) { - var page = _gainfoStore.Queryable(request.Status) + request.DepartmentNos = await GetRecursionDepartmentNosAsync(request.DepartmentNos); + + var page = await _gainfoStore.Queryable(request.Status) + .WhereIF(request.DepartmentNos.Any(), gainfo => request.DepartmentNos.Contains(gainfo.DepartmentNo)) .Select() .ToPageListAsync(request); @@ -42,15 +44,19 @@ public class GainfoService : IGainfoService /// /// /// - public async Task SaveAsync(GainfoSaveRequest request) + public async Task SaveAsync(List request) { - var gainfos = new List(); - GainfoEntity aginfoEntity = request.Adapt(); + //todo check + var entities = request.Adapt>(); + entities.ForEach(x => + { + if (x.No.IsEmpty()) + { + x.No = "F" + Guid.NewGuid().ToString(); + } + }); - aginfoEntity.No = "F" + Guid.NewGuid().ToString(); - gainfos.Add(aginfoEntity); - - await _gainfoStore.InsertAsync(GainfoStatusEnumType.Working, gainfos); + await _gainfoStore.InsertAsync(entities); } @@ -65,13 +71,7 @@ public class GainfoService : IGainfoService gainfo.ThrowIfNull("档案数据不存在,无法更新"); request.Adapt(gainfo); - - var gainfos = new List() - { - gainfo - }; - - await _gainfoStore.UpdateAsync(request.GainfoStatus, gainfos); + await _gainfoStore.UpdateAsync(gainfo); } /// @@ -79,25 +79,19 @@ public class GainfoService : IGainfoService /// /// /// - /// [Transactional] public async Task DimissionAsync(GainfoDImissionRequest request) { var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.Working) .Where(x => x.No == request.UserId) .FirstAsync(); - gainfo.ThrowIfNull($"该档案不存在"); + + gainfo.ThrowIfNull("该档案不存在"); //添加到离职表 - var gainfos = new List - { - gainfo - }; - - await _gainfoStore.InsertAsync(GainfoStatusEnumType.Leave, gainfos); - + await _gainfoStore.InsertAsync(gainfo, GainfoStatusEnumType.Leave); //删除原数据 - await _gainfoStore.DeleteAsync(GainfoStatusEnumType.Working, gainfos); + await _gainfoStore.DeleteAsync(gainfo, GainfoStatusEnumType.Working); } /// @@ -111,43 +105,50 @@ public class GainfoService : IGainfoService var gainfo = await _gainfoStore.Queryable(GainfoStatusEnumType.External) .Where(x => x.No == request.UserId) .FirstAsync(); + gainfo.ThrowIfNull($"该档案不存在"); - //添加到正式表 - var gainfos = new List - { - gainfo - }; - - await _gainfoStore.InsertAsync(GainfoStatusEnumType.Working, gainfos); + //添加到正式表,不删除原数据,留档处理 + await _gainfoStore.InsertAsync(gainfo); } - /// - /// 获取所有字段 - /// - /// - public List GetAllFields() - { - var entityType = typeof(Gainfofields); - var propertyNames = entityType.GetProperties().Select(p => p.Name).ToList(); - - return propertyNames; - - } - - /// - /// 获取固定字段数据 - /// - /// - /// - public List GetAllFieldData(string fieldName) - { - var columnData = _dbContext.Queryable().Select(fieldName).ToList(); - - return columnData; - } //-------------------------------------------help methods ------------------------------------------------ + /// + /// 递归获取部门No + /// + /// + /// + private async Task> GetRecursionDepartmentNosAsync(List departmentNos) + { + if (departmentNos == null || departmentNos.Count == 0) + { + return new List(); + } + var departments = await _dbContext.Queryable().ToListAsync(); + var currentNos = departments.Where(x => departmentNos.Contains(x.Code)).ToList(); + + foreach (var item in currentNos) + { + RecursionGetNext(item.Code, departments, departmentNos); + } + + return departmentNos.Distinct().ToList(); + + void RecursionGetNext(string currentCode, List departments, List result) + { + var next = departments.Where(x => x.PCode == currentCode).ToList(); + foreach (var item in next) + { + result.Add(item.Code); + } + + foreach (var item in next) + { + RecursionGetNext(item.Code, departments, result); + } + } + } } diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoStore.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoStore.cs index 6bfed005..76d22e58 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoStore.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoStore.cs @@ -34,21 +34,37 @@ public class GainfoStore : IGainfoStore return _dbContext.Queryable(); } - public async Task InsertAsync(GainfoStatusEnumType? gainfoStatus, List entities) + + public async Task InsertAsync(List entities, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working) { await _dbContext.Client.Insertable(entities).AS(GetTableName(gainfoStatus)).EnableDiffLogEventIF(_sqlSugarOptionsService.Diff).ExecuteCommandAsync(); } - public async Task UpdateAsync(GainfoStatusEnumType? gainfoStatus, List entities) + public async Task InsertAsync(GainfoEntity entity, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working) + { + await _dbContext.Client.Insertable(entity).AS(GetTableName(gainfoStatus)).EnableDiffLogEventIF(_sqlSugarOptionsService.Diff).ExecuteCommandAsync(); + } + + public async Task UpdateAsync(List entities, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working) { await _dbContext.Client.Updateable(entities).AS(GetTableName(gainfoStatus)).EnableDiffLogEventIF(_sqlSugarOptionsService.Diff).ExecuteCommandAsync(); } - public async Task DeleteAsync(GainfoStatusEnumType? gainfoStatus, List entities) + public async Task UpdateAsync(GainfoEntity entity, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working) + { + await _dbContext.Client.Updateable(entity).AS(GetTableName(gainfoStatus)).EnableDiffLogEventIF(_sqlSugarOptionsService.Diff).ExecuteCommandAsync(); + } + + public async Task DeleteAsync(List entities, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working) { await _dbContext.Client.Deleteable(entities).AS(GetTableName(gainfoStatus)).EnableDiffLogEventIF(_sqlSugarOptionsService.Diff).ExecuteCommandAsync(); } + public async Task DeleteAsync(GainfoEntity entity, GainfoStatusEnumType gainfoStatus = GainfoStatusEnumType.Working) + { + await _dbContext.Client.Deleteable(entity).AS(GetTableName(gainfoStatus)).EnableDiffLogEventIF(_sqlSugarOptionsService.Diff).ExecuteCommandAsync(); + } + //*************************************************************** help method ********************************************************************************* @@ -67,4 +83,6 @@ public class GainfoStore : IGainfoStore return tableName; } + + } diff --git a/Src/Dlhis.Entity/Basic/Entity/CanteenBusinessShiftEntity.cs b/Src/Dlhis.Entity/Basic/Entity/CanteenBusinessShiftEntity.cs index 417d18bd..f39eca25 100644 --- a/Src/Dlhis.Entity/Basic/Entity/CanteenBusinessShiftEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/CanteenBusinessShiftEntity.cs @@ -45,5 +45,11 @@ public class CanteenBusinessShiftEntity : SugarBaseEntity, ITenantId [SugarColumn(ColumnDescription = "经营结束时间")] public TimeOnly End { get; set; } + /// + /// 序号 + /// + [SugarColumn(ColumnDescription = "序号")] + public int Sequence { 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 9c56815a..fcb01d70 100644 --- a/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/GainfoEntity.cs @@ -26,7 +26,7 @@ public class GainfoEntity : SugarBaseEntity /// 人员类型 /// [SugarColumn(ColumnDescription = "人员类型")] - public string GType { get; set; } + public string Type { get; set; } /// /// 姓名 @@ -148,3 +148,14 @@ public class GainfoEntity : SugarBaseEntity [SugarColumn(ColumnDescription = "在职状态")] public string Employed { get; set; } } + +//[SugarTable(TableName = "GainfoLeave", TableDescription = "离职人员档案表")] +//public class GainfoLeaveEntity : GainfoEntity +//{ + +//} +//[SugarTable(TableName = "GainfoExternal", TableDescription = "外部人员档案表")] +//public class GainfoExternalEntity : GainfoEntity +//{ + +//} diff --git a/Src/Dlhis.Entity/Basic/Entity/Gainfofields.cs b/Src/Dlhis.Entity/Basic/Entity/Gainfofields.cs deleted file mode 100644 index ea202035..00000000 --- a/Src/Dlhis.Entity/Basic/Entity/Gainfofields.cs +++ /dev/null @@ -1,53 +0,0 @@ -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Dlhis.Entity.Basic.Entity -{ - /// - /// 用户档案字段列表 - /// - [SugarTable(TableName = "Gainfofields", TableDescription = "用户档案字段列表")] - public class Gainfofields : SugarBaseEntity - { - - /// - /// 人员类型 - /// - [SugarColumn(ColumnDescription = "人员类型")] - public string Class { get; set; } - - /// - /// 国家代码 - /// - [SugarColumn(ColumnDescription = "国家代码")] - public string Country { get; set; } - - /// - /// 证件类型 - /// - [SugarColumn(ColumnDescription = "证件类型")] - public string Idcls { get; set; } - - /// - /// 身份证籍贯区 - /// - [SugarColumn(ColumnDescription = "身份证籍贯区")] - public string Native { get; set; } - - /// - /// 部门编码 - /// - [SugarColumn(ColumnDescription = "部门编码")] - public string Appellation { get; set; } - - /// - /// 民族代码 - /// - [SugarColumn(ColumnDescription = "民族代码")] - public string Nation { get; set; } - } -} diff --git a/Src/Dlhis.Entity/Sys/Entities/IdentityResourceClaims.cs b/Src/Dlhis.Entity/Sys/Entities/IdentityResourceClaims.cs new file mode 100644 index 00000000..1aef75ef --- /dev/null +++ b/Src/Dlhis.Entity/Sys/Entities/IdentityResourceClaims.cs @@ -0,0 +1,10 @@ +namespace Dlhis.Entity.Sys.Entities; + +public class IdentityResourceClaims +{ + public int Id { get; set; } + + public string IdentityResourceId { get; set; } + + public string Type { get; set; } +} diff --git a/Src/Dlhis.Entity/Sys/Entities/IdentityResources.cs b/Src/Dlhis.Entity/Sys/Entities/IdentityResources.cs new file mode 100644 index 00000000..ede62b02 --- /dev/null +++ b/Src/Dlhis.Entity/Sys/Entities/IdentityResources.cs @@ -0,0 +1,23 @@ +namespace Dlhis.Entity.Sys.Entities; + +public class IdentityResources +{ + public int Id { get; set; } + public bool Enabled { get; set; } + public string Name { get; set; } + public string DisplayName { get; set; } + + public string Description { get; set; } + + public bool Required { get; set; } + + public bool Emphasize { get; set; } + + public bool ShowInDiscoveryDocument { get; set; } + + public DateTime Created { get; set; } + + public DateTime Updated { get; set; } + + public bool NonEditable { get; set; } +} diff --git a/Src/Dlhis.Entity/Sys/Entities/UserClaims.cs b/Src/Dlhis.Entity/Sys/Entities/UserClaims.cs new file mode 100644 index 00000000..fd9b494a --- /dev/null +++ b/Src/Dlhis.Entity/Sys/Entities/UserClaims.cs @@ -0,0 +1,16 @@ +using SqlSugar; + +namespace Dlhis.Entity.Sys.Entities; + +/// +/// identity-userclaim +/// +[SugarTable(TableName = "UserClaims")] +public class UserClaims +{ + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public int Id { get; set; } + public int UserId { get; set; } + public string ClaimType { get; set; } + public string ClaimValue { get; set; } +} diff --git a/Src/Dlhis.Entity/Sys/Entities/UserEntity.cs b/Src/Dlhis.Entity/Sys/Entities/UserEntity.cs index 55a4a8e5..3c60c700 100644 --- a/Src/Dlhis.Entity/Sys/Entities/UserEntity.cs +++ b/Src/Dlhis.Entity/Sys/Entities/UserEntity.cs @@ -5,37 +5,79 @@ namespace Dlhis.Entity.Sys.Entities; /// /// identity-user /// -[SugarTable("Users")] +[SugarTable(TableName = "Users")] public class UserEntity { [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] public int Id { get; set; } + /// + /// 账号 + /// public string UserName { get; set; } + /// + /// 账号大写 + /// public string NormalizedUserName { get; set; } + /// + /// 邮件 + /// public string Email { get; set; } + /// + /// 邮件大写 + /// public string NormalizedEmail { get; set; } + /// + /// 邮件确认 + /// public bool EmailConfirmed { get; set; } + /// + /// 密码hash + /// public string PasswordHash { get; set; } + /// + /// 安全时间戳 + /// public string SecurityStamp { get; set; } + /// + /// 并发时间戳 + /// public string ConcurrencyStamp { get; set; } + /// + /// 手机号 + /// public string PhoneNumber { get; set; } + /// + /// 手机号确认 + /// public string PhoneNumberConfirmed { get; set; } + /// + /// 双重验证启用 + /// public bool TwoFactorEnabled { get; set; } - public bool LockoutEnd { get; set; } + /// + /// 账号锁定结束时间 + /// + public DateTime? LockoutEnd { get; set; } + /// + /// 锁定启用 + /// public bool LockoutEnabled { get; set; } + /// + /// 登陆错误次数 + /// public int AccessFailedCount { get; set; } } diff --git a/Src/Dlhis.User/Identity/Controllers/UsersController.cs b/Src/Dlhis.User/Identity/Controllers/UsersController.cs index e0d5d519..84ad6832 100644 --- a/Src/Dlhis.User/Identity/Controllers/UsersController.cs +++ b/Src/Dlhis.User/Identity/Controllers/UsersController.cs @@ -10,7 +10,6 @@ namespace Dlhis.User.Identity.Controllers; /// /// 用户 /// -[Authorize(Roles = "admin")] [Route("api/[controller]")] [ApiController] public class UsersController : ControllerBase @@ -27,6 +26,7 @@ public class UsersController : ControllerBase /// /// /// + [Authorize(Roles = "admin")] [HttpGet("page")] public async Task> GetPageAsync([FromQuery] UserPageRequest request) { @@ -37,6 +37,7 @@ public class UsersController : ControllerBase /// 获取用户列表 /// /// + [Authorize(Roles = "admin")] [HttpGet("list")] public async Task> GetUsersAsync() { @@ -49,4 +50,11 @@ public class UsersController : ControllerBase { return await _userService.GetUserByIdAsync(id); } + + [Authorize] + [HttpPost("avatar")] + public async Task UploadUserAvatarAsync([FromForm] UserAvatarUploadRequest request) + { + await _userService.UploadUserAvatarAsync(request); + } } diff --git a/Src/Dlhis.User/Identity/Services/IUserService.cs b/Src/Dlhis.User/Identity/Services/IUserService.cs index e07ac0d6..53932ffb 100644 --- a/Src/Dlhis.User/Identity/Services/IUserService.cs +++ b/Src/Dlhis.User/Identity/Services/IUserService.cs @@ -13,4 +13,6 @@ public interface IUserService : IScopeDependency Task> GetUsersAsync(); Task GetUserByIdAsync(int id); + + Task UploadUserAvatarAsync(UserAvatarUploadRequest request); } diff --git a/Src/Dlhis.User/Identity/Services/Implements/UserService.cs b/Src/Dlhis.User/Identity/Services/Implements/UserService.cs index e7ebc36a..033bb762 100644 --- a/Src/Dlhis.User/Identity/Services/Implements/UserService.cs +++ b/Src/Dlhis.User/Identity/Services/Implements/UserService.cs @@ -51,4 +51,9 @@ public class UserService : IUserService var user = await _dbContext.Queryable().Where(x => x.Id == id).Select().FirstAsync(); return user; } + + public async Task UploadUserAvatarAsync(UserAvatarUploadRequest request) + { + var user = await _dbContext.Queryable().Where(x => x.Id == request.UserId).Select().FirstAsync(); + } } From 19bbf9a0fd416efdff5b9d8804c3f070006b441d Mon Sep 17 00:00:00 2001 From: liguoyang Date: Mon, 8 Jan 2024 20:53:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=20=E8=A1=A5=E5=85=85=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Request/UserAvatarUploadRequest.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Src/Dlhis.User/Identity/Request/UserAvatarUploadRequest.cs diff --git a/Src/Dlhis.User/Identity/Request/UserAvatarUploadRequest.cs b/Src/Dlhis.User/Identity/Request/UserAvatarUploadRequest.cs new file mode 100644 index 00000000..d4b9dcce --- /dev/null +++ b/Src/Dlhis.User/Identity/Request/UserAvatarUploadRequest.cs @@ -0,0 +1,18 @@ +using System.ComponentModel.DataAnnotations; + +namespace Dlhis.User.Identity.Request; + +public class UserAvatarUploadRequest +{ + /// + /// 用户id + /// + [Range(1, int.MaxValue)] + public int UserId { get; set; } + + /// + /// 图片地址 + /// + [Required(ErrorMessage = "图片地址不能为空")] + public string Picture { get; set; } +}