diff --git a/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs b/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs
index 9829ea9a..14c35704 100644
--- a/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs
+++ b/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs
@@ -208,13 +208,4 @@ public class DevicesController : ControllerBase
return await _deviceService.GetRecentNumbersAsync();
}
- ///
- /// 获取api日志
- ///
- ///
- [HttpGet("logs")]
- public async Task> GetLogsAsync([FromQuery]ApiLogRequest request)
- {
- return await _deviceService.GetLogsAsync(request);
- }
}
diff --git a/Src/Dlhis.Basic/Device/Request/ApiLogRequest.cs b/Src/Dlhis.Basic/Device/Request/ApiLogRequest.cs
deleted file mode 100644
index 03278171..00000000
--- a/Src/Dlhis.Basic/Device/Request/ApiLogRequest.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Kurisu.Core.DataAccess.Dto;
-using System.ComponentModel.DataAnnotations;
-
-namespace Dlhis.Basic.Device.Request;
-
-public class ApiLogRequest : PageDto
-{
- ///
- /// 日志级别 LogLevel
- ///
- [EnumDataType(typeof(LogLevel))]
- public LogLevel? Level { get; set; }
-}
diff --git a/Src/Dlhis.Basic/Device/Response/ApiLogResponse.cs b/Src/Dlhis.Basic/Device/Response/ApiLogResponse.cs
deleted file mode 100644
index 38fca5e6..00000000
--- a/Src/Dlhis.Basic/Device/Response/ApiLogResponse.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using Newtonsoft.Json;
-
-namespace Dlhis.Basic.Device.Response;
-
-public class ApiLogResponse
-{
- ///
- /// 时间UTC
- ///
- [JsonIgnore]
- public string Timestamp { get; set; }
-
- ///
- /// 产生时间
- ///
- public DateTime RaiseTime
- {
- get
- {
- return DateTime.Parse(Timestamp).ToLocalTime();
- }
- }
-
- ///
- /// 级别
- ///
- public string Level { get; set; }
-
- ///
- /// 模板
- ///
- [JsonIgnore]
- public string Template { get; set; }
-
- ///
- /// 消息内容
- ///
- public string Message { get; set; }
-
- ///
- /// 异常内容
- ///
- public string Exception { get; set; }
-
- ///
- /// 属性
- ///
- [JsonIgnore]
- public string Properties { get; set; }
-
- ///
- /// 时间
- ///
- [JsonIgnore]
- public DateTime _TS { get; set; }
-}
diff --git a/Src/Dlhis.Basic/Device/Services/IDeviceService.cs b/Src/Dlhis.Basic/Device/Services/IDeviceService.cs
index b6ab81bf..fa3176e7 100644
--- a/Src/Dlhis.Basic/Device/Services/IDeviceService.cs
+++ b/Src/Dlhis.Basic/Device/Services/IDeviceService.cs
@@ -24,6 +24,4 @@ public interface IDeviceService : IScopeDependency
Task> GetRecentNumbersAsync();
- Task> GetLogsAsync(ApiLogRequest request);
-
}
diff --git a/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs b/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs
index d9a06f35..8173bcf9 100644
--- a/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs
+++ b/Src/Dlhis.Basic/Device/Services/Implements/DeviceService.cs
@@ -405,15 +405,5 @@ public class DeviceService : IDeviceService
return list;
}
- public async Task> GetLogsAsync(ApiLogRequest request)
- {
- var logs = await _dbContext.ChangeDb("log").Queryable()
- .WhereIF(request.Search.IsPresent(), x => x.Message.Contains(request.Search))
- .WhereIF(request.Level.HasValue, x => x.Level == request.Level)
- .Select()
- .ToPageListAsync(request);
-
- return logs;
- }
}
diff --git a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs
index fbbced47..b4556880 100644
--- a/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs
+++ b/Src/Dlhis.Canteen/Order/Services/Implements/BalanceService.cs
@@ -388,6 +388,7 @@ public class BalanceService : IBalanceService
obj.LunchNumberOfPeople = first.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Lunch"]).Select(x => x.UserNo).Distinct().Count();
obj.DinnerNumberOfPeople = first.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["Dinner"]).Select(x => x.UserNo).Distinct().Count();
obj.LateNightNumberOfPeople = first.Where(x => x.BusinessShiftCode.ToString() == shiftCodeDict["LateNight"]).Select(x => x.UserNo).Distinct().Count();
+ obj.TotalNumberOfPeople = obj.BreakfastNumberOfPeople + obj.LunchNumberOfPeople + obj.DinnerNumberOfPeople + obj.LateNightNumberOfPeople;
lst.Add(obj);
}
// 分页操作
diff --git a/Src/Dlhis.Common/ApiLog/ApiLogServiceController.cs b/Src/Dlhis.Common/ApiLog/ApiLogServiceController.cs
new file mode 100644
index 00000000..03376a79
--- /dev/null
+++ b/Src/Dlhis.Common/ApiLog/ApiLogServiceController.cs
@@ -0,0 +1,36 @@
+using Dlhis.Common.Request;
+using Dlhis.Common.Response;
+using Dlhis.Common.Services.Implements;
+using Kurisu.Core.DataAccess.Dto;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+
+namespace Dlhis.Common.ApiLog
+{
+ ///
+ /// api日志控制器
+ ///
+ [Authorize]
+ [Route("api/[controller]")]
+ [ApiController]
+ public class ApiLogServiceController : ControllerBase
+ {
+ private readonly IApiLogService _apiLogService;
+
+ public ApiLogServiceController(IApiLogService apiLogService)
+ {
+ _apiLogService = apiLogService;
+ }
+
+ ///
+ /// 获取api日志
+ ///
+ ///
+ [HttpGet("logs")]
+ public async Task> GetLogsAsync([FromQuery] ApiLogRequest request)
+ {
+ return await _apiLogService.GetLogsAsync(request);
+ }
+ }
+}
diff --git a/Src/Dlhis.Common/Program.cs b/Src/Dlhis.Common/Program.cs
index 1bcd1be2..6b0c15e8 100644
--- a/Src/Dlhis.Common/Program.cs
+++ b/Src/Dlhis.Common/Program.cs
@@ -1,4 +1,5 @@
using Kurisu.AspNetCore.Startup;
+using Kurisu.AspNetCore.Utils.Extensions;
using Kurisu.Startup;
class Program
@@ -13,6 +14,6 @@ public class Startup : DefaultStartup
{
public Startup(IConfiguration configuration) : base(configuration)
{
-
+
}
}
\ No newline at end of file
diff --git a/Src/Dlhis.Common/Request/ApiLogRequest.cs b/Src/Dlhis.Common/Request/ApiLogRequest.cs
new file mode 100644
index 00000000..ca4d00cc
--- /dev/null
+++ b/Src/Dlhis.Common/Request/ApiLogRequest.cs
@@ -0,0 +1,14 @@
+using Kurisu.Core.DataAccess.Dto;
+using System.ComponentModel.DataAnnotations;
+
+namespace Dlhis.Common.Request
+{
+ public class ApiLogRequest : PageDto
+ {
+ ///
+ /// 日志级别 LogLevel
+ ///
+ [EnumDataType(typeof(LogLevel))]
+ public LogLevel? Level { get; set; }
+ }
+}
diff --git a/Src/Dlhis.Common/Response/ApiLogResponse.cs b/Src/Dlhis.Common/Response/ApiLogResponse.cs
new file mode 100644
index 00000000..ff51f853
--- /dev/null
+++ b/Src/Dlhis.Common/Response/ApiLogResponse.cs
@@ -0,0 +1,57 @@
+using Newtonsoft.Json;
+
+namespace Dlhis.Common.Response
+{
+ public class ApiLogResponse
+ {
+ ///
+ /// 时间UTC
+ ///
+ [JsonIgnore]
+ public string Timestamp { get; set; }
+
+ ///
+ /// 产生时间
+ ///
+ public DateTime RaiseTime
+ {
+ get
+ {
+ return DateTime.Parse(Timestamp).ToLocalTime();
+ }
+ }
+
+ ///
+ /// 级别
+ ///
+ public string Level { get; set; }
+
+ ///
+ /// 模板
+ ///
+ [JsonIgnore]
+ public string Template { get; set; }
+
+ ///
+ /// 消息内容
+ ///
+ public string Message { get; set; }
+
+ ///
+ /// 异常内容
+ ///
+ public string Exception { get; set; }
+
+ ///
+ /// 属性
+ ///
+ [JsonIgnore]
+ public string Properties { get; set; }
+
+ ///
+ /// 时间
+ ///
+ [JsonIgnore]
+ public DateTime _TS { get; set; }
+ }
+}
diff --git a/Src/Dlhis.Common/Services/ApiLogService.cs b/Src/Dlhis.Common/Services/ApiLogService.cs
new file mode 100644
index 00000000..b25c9ed3
--- /dev/null
+++ b/Src/Dlhis.Common/Services/ApiLogService.cs
@@ -0,0 +1,32 @@
+using Dlhis.Common.Request;
+using Dlhis.Common.Response;
+using Dlhis.Common.Services.Implements;
+using Dlhis.Entity.Common;
+using Kurisu.AspNetCore.Utils.Extensions;
+using Kurisu.Core.DataAccess.Dto;
+using Kurisu.SqlSugar.Extensions;
+using Kurisu.SqlSugar.Services;
+
+namespace Dlhis.Common.Services
+{
+ public class ApiLogService : IApiLogService
+ {
+ private readonly IDbContext _dbContext;
+
+ public ApiLogService(IDbContext dbContext)
+ {
+ _dbContext = dbContext;
+ }
+
+ public async Task> GetLogsAsync(ApiLogRequest request)
+ {
+ var logs = await _dbContext.ChangeDb("log").Queryable()
+ .WhereIF(request.Search.IsPresent(), x => x.Message.Contains(request.Search))
+ .WhereIF(request.Level.HasValue, x => x.Level == request.Level)
+ .Select()
+ .ToPageListAsync(request);
+
+ return logs;
+ }
+ }
+}
diff --git a/Src/Dlhis.Common/Services/Implements/IApiLogService.cs b/Src/Dlhis.Common/Services/Implements/IApiLogService.cs
new file mode 100644
index 00000000..4006c3b1
--- /dev/null
+++ b/Src/Dlhis.Common/Services/Implements/IApiLogService.cs
@@ -0,0 +1,11 @@
+using Dlhis.Common.Request;
+using Dlhis.Common.Response;
+using Kurisu.Core.DataAccess.Dto;
+
+namespace Dlhis.Common.Services.Implements
+{
+ public interface IApiLogService : IScopeDependency
+ {
+ Task> GetLogsAsync(ApiLogRequest request);
+ }
+}
diff --git a/Src/Dlhis.Common/SqlSugarPack.cs b/Src/Dlhis.Common/SqlSugarPack.cs
new file mode 100644
index 00000000..185e346e
--- /dev/null
+++ b/Src/Dlhis.Common/SqlSugarPack.cs
@@ -0,0 +1,48 @@
+using Kurisu.AspNetCore.Startup;
+using Kurisu.SqlSugar.Extensions;
+using SqlSugar;
+
+namespace Dlhis.Common;
+
+public class SqlSugarPack : BaseAppPack
+{
+
+ public override bool IsBeforeUseRouting { get; }
+
+ public override void ConfigureServices(IServiceCollection services)
+ {
+ services.AddSqlSugar(sp =>
+ {
+ var configuration = sp.GetService();
+ return new List
+ {
+ new ConnectionConfig
+ {
+ ConfigId = "face",
+ ConnectionString = configuration.GetSection("SqlSugarOptions:FaceConnectionString").Value,
+ DbType = DbType.MySql,
+ InitKeyType = InitKeyType.Attribute,
+ IsAutoCloseConnection = true,
+ MoreSettings = new ConnMoreSettings
+ {
+ DisableNvarchar = true,
+ }
+ },
+ new ConnectionConfig
+ {
+ ConfigId = "log",
+ ConnectionString = configuration.GetSection("SqlSugarOptions:LogConnectionString").Value,
+ DbType = DbType.MySql,
+ InitKeyType = InitKeyType.Attribute,
+ IsAutoCloseConnection = true,
+ MoreSettings = new ConnMoreSettings
+ {
+ DisableNvarchar = true,
+ }
+
+ }
+ };
+ });
+ }
+
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Common/appsettings.json b/Src/Dlhis.Common/appsettings.json
index 5dffea5e..b73cd02e 100644
--- a/Src/Dlhis.Common/appsettings.json
+++ b/Src/Dlhis.Common/appsettings.json
@@ -8,6 +8,8 @@
"SqlSugarOptions": {
"DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
"SlaveConnectionString": [],
+ "FaceConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=face;charset=utf8mb4;",
+ "LogConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=log;charset=utf8mb4;",
"Timeout": 30,
"SlowSqlTime": 1,
"EnableSqlLog": false
diff --git a/Src/Dlhis.Entity/Basic/Entity/ApiLogEntity.cs b/Src/Dlhis.Entity/Common/ApiLogEntity.cs
similarity index 93%
rename from Src/Dlhis.Entity/Basic/Entity/ApiLogEntity.cs
rename to Src/Dlhis.Entity/Common/ApiLogEntity.cs
index 96ddaa22..70e0849e 100644
--- a/Src/Dlhis.Entity/Basic/Entity/ApiLogEntity.cs
+++ b/Src/Dlhis.Entity/Common/ApiLogEntity.cs
@@ -1,8 +1,8 @@
-using Microsoft.Extensions.Logging;
-using SqlSugar;
+using SqlSugar;
using SqlSugar.DbConvert;
+using Microsoft.Extensions.Logging;
-namespace Dlhis.Entity.Basic.Entity;
+namespace Dlhis.Entity.Common;
///
/// api日志表