diff --git a/Src/Dlhis.Common/EnumSetting/EnumsController.cs b/Src/Dlhis.Common/EnumSetting/EnumsController.cs index e0879962..bd342d06 100644 --- a/Src/Dlhis.Common/EnumSetting/EnumsController.cs +++ b/Src/Dlhis.Common/EnumSetting/EnumsController.cs @@ -1,8 +1,5 @@ using System.Reflection; -using Dlhis.Common.Response; -using Dlhis.Entity.Basic.Entity; using Kurisu.AspNetCore.Utils.Extensions; -using Kurisu.SqlSugar.Services; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; @@ -16,14 +13,6 @@ namespace Dlhis.Common.EnumSetting; [ApiController] public class EnumsController : ControllerBase { - - private readonly IDbContext _dbContext; - - public EnumsController(IDbContext dbContext) - { - _dbContext = dbContext; - } - /// /// 获取所有枚举 /// @@ -57,30 +46,4 @@ public class EnumsController : ControllerBase }; }); } - /// - /// 获取档案类型数据 - /// - /// - /// - public object GetTypes(string type) - { - var types = _dbContext.Queryable().Where(x => x.Type == type).ToList(); - - return types.Select(x => - { - return new - { - Type = x.Type, - Data = types.Select(x => new GainfoTypeResponse - { - Id = x.Id, - Type = x.Type, - Code = x.Code, - Descript = x.Descript, - DescriptEn = x.DescriptEn, - Remark = x.Remark, - }).ToList() - }; - }); - } } diff --git a/Src/Dlhis.Common/EnumSetting/TypesController.cs b/Src/Dlhis.Common/EnumSetting/TypesController.cs new file mode 100644 index 00000000..03c13fd1 --- /dev/null +++ b/Src/Dlhis.Common/EnumSetting/TypesController.cs @@ -0,0 +1,48 @@ +using Dlhis.Entity.Basic.Entity; +using Kurisu.SqlSugar.Services; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; + +namespace Dlhis.Common.EnumSetting; + +/// +/// 类型 +/// +[Authorize] +[Route("api/[controller]")] +[ApiController] +public class TypesController : ControllerBase +{ + private readonly IDbContext _dbContext; + + public TypesController(IDbContext dbContext) + { + _dbContext = dbContext; + } + + /// + /// Basic类型表 + /// + /// + [HttpGet] + public object GetTypes() + { + var types = _dbContext.Queryable().ToList().AsEnumerable(); + var distinctTypes = types.Select(x => x.Type).Distinct(); + + return distinctTypes.Select(type => + { + var date = types.Where(item => item.Type == type) + .Select(item => new + { + Key = item.Code, + Value = item.Descript + }); + return new + { + Type = type, + Date = date + }; + }); + } +} \ No newline at end of file diff --git a/Src/Dlhis.Common/Packs/SqlSugarPack.cs b/Src/Dlhis.Common/Packs/SqlSugarPack.cs new file mode 100644 index 00000000..4c984c21 --- /dev/null +++ b/Src/Dlhis.Common/Packs/SqlSugarPack.cs @@ -0,0 +1,15 @@ +using Kurisu.AspNetCore.Startup; +using Kurisu.SqlSugar.Extensions; + +namespace Dlhis.Common.Packs +{ + public class SqlSugarPack : BaseAppPack + { + public override bool IsBeforeUseRouting { get; } + + public override void ConfigureServices(IServiceCollection services) + { + services.AddSqlSugar(); + } + } +} diff --git a/Src/Dlhis.Common/Response/GainfoTypeResponse.cs b/Src/Dlhis.Common/Response/GainfoTypeResponse.cs deleted file mode 100644 index b5823421..00000000 --- a/Src/Dlhis.Common/Response/GainfoTypeResponse.cs +++ /dev/null @@ -1,38 +0,0 @@ -using SqlSugar; - -namespace Dlhis.Common.Response -{ - public class GainfoTypeResponse - { - /// - /// id - /// - public long Id { get; set; } - - /// - /// 类型 - /// - public string Type { get; set; } - - /// - /// 编码 - /// - public string Code { get; set; } - - /// - /// 中文描述 - /// - public string Descript { get; set; } - - /// - /// 英文描述 - /// - public string DescriptEn { get; set; } - - /// - /// 备注 - /// - public string Remark { get; set; } - - } -} diff --git a/Src/Dlhis.Common/appsettings.Development.json b/Src/Dlhis.Common/appsettings.Development.json index 0c208ae9..17b935d5 100644 --- a/Src/Dlhis.Common/appsettings.Development.json +++ b/Src/Dlhis.Common/appsettings.Development.json @@ -4,5 +4,28 @@ "Default": "Information", "Microsoft.AspNetCore": "Warning" } + }, + "SwaggerOptions": { + "Enable": true, + "Authority": "https://yikatong.isawesome.cn/oauth2", + "ClientId": "4fb184324eac4180", + "ClientSecret": "8ac8f235152f1524", + "Scopes": { + "openid": "openid", + "profile": "profile", + "yikatong": "yikatong" + } + }, + "IdentityServerOptions": { + "Authority": "https://yikatong.isawesome.cn/oauth2", + "RequireHttpsMetadata": true, + "Issuer": "identity.isawesome.cn", + "Audience": "", + "Pat": { + "Enable": false, + "Scheme": "token", + "ClientId": "reference", + "ClientSecret": "123456" + } } } diff --git a/Src/Dlhis.Common/appsettings.json b/Src/Dlhis.Common/appsettings.json index 21403016..732e541b 100644 --- a/Src/Dlhis.Common/appsettings.json +++ b/Src/Dlhis.Common/appsettings.json @@ -5,6 +5,14 @@ "Microsoft.AspNetCore": "Warning" } }, + "SqlSugarOptions": { + "DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;", + "SlaveConnectionString": [], + "Timeout": 30, + "SlowSqlTime": 1, + "EnableSqlLog": true + }, + "AllowedHosts": "*", "SwaggerOptions": { "Enable": true, diff --git a/Src/Dlhis.Entity/Basic/Entity/GainfoTypeEntity.cs b/Src/Dlhis.Entity/Basic/Entity/BasicTypeEntity.cs similarity index 86% rename from Src/Dlhis.Entity/Basic/Entity/GainfoTypeEntity.cs rename to Src/Dlhis.Entity/Basic/Entity/BasicTypeEntity.cs index eff3e85f..7f9a18cc 100644 --- a/Src/Dlhis.Entity/Basic/Entity/GainfoTypeEntity.cs +++ b/Src/Dlhis.Entity/Basic/Entity/BasicTypeEntity.cs @@ -3,10 +3,10 @@ namespace Dlhis.Entity.Basic.Entity { /// - /// 用户档案类型表 + /// Basic类型表 /// - [SugarTable(TableName = "GainfoType", TableDescription = "用户档案类型表")] - public class GainfoTypeEntity : SugarBaseEntity + [SugarTable(TableName = "BasicType", TableDescription = "Basic类型表")] + public class BasicTypeEntity : SugarBaseEntity { /// /// 类型 diff --git a/Src/Dlhis.ScheduledTask/Job/SyncPersonJob.cs b/Src/Dlhis.ScheduledTask/Job/SyncPersonJob.cs index c67e521d..9bc903a9 100644 --- a/Src/Dlhis.ScheduledTask/Job/SyncPersonJob.cs +++ b/Src/Dlhis.ScheduledTask/Job/SyncPersonJob.cs @@ -11,8 +11,6 @@ using Dlhis.ScheduledTask.Configurations; using Kurisu.SqlSugar.Services; using Dlhis.Entity.Basic.Entity; using Dlhis.ScheduledTask.Wsproxy.Dlhis.JinkoHr.WsProxy; -using System.Net; -using System; using Dlhis.Entity.Basic.Enums; namespace Dlhis.ScheduledTask.Job @@ -166,7 +164,7 @@ namespace Dlhis.ScheduledTask.Job { SapNo = item.ano, No = item.guestno, - GType = item.@class, + //GType = item.@class, Name = item.gname, Code = item.ename, CountryNo = item.country,