diff --git a/Directory.Build.props b/Directory.Build.props
new file mode 100644
index 0000000000000000000000000000000000000000..30aaeab30c13c0348a9e056db2f2788a6bbe6f19
--- /dev/null
+++ b/Directory.Build.props
@@ -0,0 +1,15 @@
+
+
+ 1
+ 10
+ 0
+ $(MajorVersion).$(MinorVersion).$(PatchVersion)
+ $(Version)
+ $(MSBuildThisFileDirectory).buildnumber
+ 易开元(Easy Open Meta)
+ Service to TS Hotel Management System Project, Development By Easy Open Meta
+ MIT
+ https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
+ https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
+
+
\ No newline at end of file
diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 0000000000000000000000000000000000000000..8cf90ccb5b93c3131bf1b59e2e66c404d2082042
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+ @(BuildNumberLines)
+ 0
+
+ $([System.Int32]::Parse($(CurrentBuildNumber)))
+ $([MSBuild]::Add($(CurrentBuildNumberInt), 1))
+ $(NewBuildNumberInt)
+
+
+
+
+
+
+
+
+ $(MajorVersion).$(MinorVersion).$(NewBuildNumber)
+ $(Version)
+
+
+
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.API/Controllers/Business/Sellthing/SellthingController.cs b/EOM.TSHotelManagement.API/Controllers/Business/Sellthing/SellthingController.cs
index 27ed22be83335c26f187dfa7509ae43adaf615dd..6ece820020ef7f22c59fa85365a67ed9f764d55d 100644
--- a/EOM.TSHotelManagement.API/Controllers/Business/Sellthing/SellthingController.cs
+++ b/EOM.TSHotelManagement.API/Controllers/Business/Sellthing/SellthingController.cs
@@ -38,19 +38,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
[HttpPost]
public BaseResponse UpdateSellThing([FromBody] UpdateSellThingInputDto updateSellThingInputDto)
{
- return sellService.UpdateSellThing(updateSellThingInputDto);
- }
-
- ///
- /// 修改商品信息
- ///
- ///
- ///
- [RequirePermission("goodsmanagement.update")]
- [HttpPost]
- public BaseResponse UpdateSellthing([FromBody] UpdateSellThingInputDto sellThing)
- {
- return sellService.UpdateSellthing(sellThing);
+ return sellService.UpdateSellthing(updateSellThingInputDto);
}
///
diff --git a/EOM.TSHotelManagement.API/Controllers/Util/UtilityController.cs b/EOM.TSHotelManagement.API/Controllers/Util/UtilityController.cs
index b7d37ca639aa529c755abcd980e98d4d2ada75ce..ad71e1ce22ac5b8e6989ddb56a103e88be123904 100644
--- a/EOM.TSHotelManagement.API/Controllers/Util/UtilityController.cs
+++ b/EOM.TSHotelManagement.API/Controllers/Util/UtilityController.cs
@@ -59,6 +59,17 @@ namespace EOM.TSHotelManagement.WebApi.Controllers
return utilService.SelectRequestlogAll(readRequestLogInputDto);
}
+ ///
+ /// 删除时间范围的请求日志
+ ///
+ ///
+ ///
+ [HttpPost]
+ public BaseResponse DeleteRequestlogByRange([FromBody] ReadRequestLogInputDto readRequestLogInputDto)
+ {
+ return utilService.DeleteRequestlogByRange(readRequestLogInputDto);
+ }
+
///
/// 删除时间范围的操作日志
///
diff --git a/EOM.TSHotelManagement.API/EOM.TSHotelManagement.API.csproj b/EOM.TSHotelManagement.API/EOM.TSHotelManagement.API.csproj
index abf8fcd44fdd64ac1e51eecf6ea6e362e5b6c508..4e8ca9d199776ef3b1a3212389728f54a9dac19e 100644
--- a/EOM.TSHotelManagement.API/EOM.TSHotelManagement.API.csproj
+++ b/EOM.TSHotelManagement.API/EOM.TSHotelManagement.API.csproj
@@ -33,7 +33,7 @@
- Always
+ PreserveNewest
diff --git a/EOM.TSHotelManagement.API/Extensions/ApplicationExtensions.cs b/EOM.TSHotelManagement.API/Extensions/ApplicationExtensions.cs
index de7cd5902a624a598b0bf984cb11a6586ec0c307..590b5a5fa9929a1dca59989cbf7ada95e35cf8d3 100644
--- a/EOM.TSHotelManagement.API/Extensions/ApplicationExtensions.cs
+++ b/EOM.TSHotelManagement.API/Extensions/ApplicationExtensions.cs
@@ -2,6 +2,7 @@
using EOM.TSHotelManagement.Data;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.HttpOverrides;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
@@ -43,6 +44,22 @@ namespace EOM.TSHotelManagement.WebApi
{
try
{
+ var enableInitializeDatabase = false;
+ if (Environment.GetEnvironmentVariable(SystemConstant.Env.Code) == SystemConstant.Docker.Code)
+ {
+ enableInitializeDatabase = Environment.GetEnvironmentVariable(SystemConstant.InitializeDatabase.Code).ToLower() == "true";
+ }
+ else
+ {
+ enableInitializeDatabase = app.Configuration.GetSection(SystemConstant.InitializeDatabase.Code).Get();
+ }
+
+ if (!enableInitializeDatabase)
+ {
+ Console.WriteLine("已跳过初始化数据库");
+ return;
+ }
+
using var scope = app.Services.CreateScope();
var initializer = scope.ServiceProvider.GetService();
initializer?.InitializeDatabase();
diff --git a/EOM.TSHotelManagement.API/Program.cs b/EOM.TSHotelManagement.API/Program.cs
index edb1c857afacf4beb74be7d1b2bf1db174478e48..fb4f25e191877af04dc4ab912f8cf5eecdff39a5 100644
--- a/EOM.TSHotelManagement.API/Program.cs
+++ b/EOM.TSHotelManagement.API/Program.cs
@@ -12,13 +12,19 @@ namespace EOM.TSHotelManagement.WebApi
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
+ // 加载多个配置文件
+ builder.Configuration
+ .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
+ .AddJsonFile("appsettings.Application.json", optional: true, reloadOnChange: true)
+ .AddJsonFile("appsettings.Database.json", optional: true, reloadOnChange: true)
+ .AddJsonFile("appsettings.Services.json", optional: true, reloadOnChange: true);
var configuration = builder.Configuration;
- // Autofac
+ // Autofac 容器配置
builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory());
builder.Host.ConfigureContainer(AutofacConfigExtensions.ConfigureAutofacContainer);
- //
+ // 服务配置
builder.Services.ConfigureDataProtection(configuration);
builder.Services.ConfigureQuartz(configuration);
builder.Services.ConfigureAuthentication(configuration);
@@ -29,10 +35,10 @@ namespace EOM.TSHotelManagement.WebApi
builder.Services.AddHttpContextAccessor();
builder.Services.ConfigureXForward();
- // Ӧ
+ // 构建应用
var app = builder.Build();
- // Ӧ
+ // 应用配置
app.ConfigureEnvironment();
app.ConfigureMiddlewares();
diff --git a/EOM.TSHotelManagement.API/Properties/launchSettings.json b/EOM.TSHotelManagement.API/Properties/launchSettings.json
index d725b8c3d3ea930821423f2adea18f2c2d476f89..16697cb70736e9609d31aeb6607df6e7d7caae5f 100644
--- a/EOM.TSHotelManagement.API/Properties/launchSettings.json
+++ b/EOM.TSHotelManagement.API/Properties/launchSettings.json
@@ -1,14 +1,6 @@
{
"profiles": {
- "IIS Express": {
- "commandName": "IISExpress",
- "launchBrowser": true,
- "launchUrl": "swagger/index.html",
- "environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Development"
- }
- },
- "EOM.TSHotelManagement.WebApi": {
+ "Topsy": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger/index.html",
@@ -28,13 +20,5 @@
"publishAllPorts": true
}
},
- "$schema": "http://json.schemastore.org/launchsettings.json",
- "iisSettings": {
- "windowsAuthentication": false,
- "anonymousAuthentication": true,
- "iisExpress": {
- "applicationUrl": "http://localhost:63001",
- "sslPort": 0
- }
- }
+ "$schema": "http://json.schemastore.org/launchsettings.json"
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.API/appsettings.Application.json b/EOM.TSHotelManagement.API/appsettings.Application.json
new file mode 100644
index 0000000000000000000000000000000000000000..1f0c6fada36838e2d5a66c5233e017d07f2a13ad
--- /dev/null
+++ b/EOM.TSHotelManagement.API/appsettings.Application.json
@@ -0,0 +1,22 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft": "Warning",
+ "Microsoft.Hosting.Lifetime": "Information"
+ }
+ },
+ "AllowedOrigins": [
+ "http://localhost:8080",
+ "https://tshotel.oscode.top"
+ ],
+ "AllowedHosts": "*",
+ "JobKeys": [
+ "ReservationExpirationCheckJob"
+ ],
+ "ExpirationSettings": {
+ "NotifyDaysBefore": 3,
+ "CheckIntervalMinutes": 5
+ },
+ "SoftwareVersion": "1.0.0"
+}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.API/appsettings.Database.json b/EOM.TSHotelManagement.API/appsettings.Database.json
new file mode 100644
index 0000000000000000000000000000000000000000..265b3738bbf2d1bad630e77ba186948bfd521cbf
--- /dev/null
+++ b/EOM.TSHotelManagement.API/appsettings.Database.json
@@ -0,0 +1,11 @@
+{
+ "DefaultDatabase": "MariaDB",
+ "ConnectionStrings": {
+ "PgSqlConnectStr": "Host=my_pgsql_host;Port=5432;Username=my_pgsql_user;Password=my_pgsql_password;Database=tshoteldb;",
+ "MySqlConnectStr": "Server=my_mysql_host;Database=tshoteldb;User=my_mysql_user;Password=my_mysql_password;",
+ "MariaDBConnectStr": "Server=localhost;Database=tshoteldb;User=my_mariadb_user;Password=my_mariadb_password;",
+ "SqlServerConnectStr": "Server=my_sqlserver_host;Database=tshoteldb;User Id=my_sqlserver_user;Password=my_sqlserver_password;",
+ "OracleConnectStr": "User Id=my_oracle_user;Password=my_oracle_password;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=my_oracle_host)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=my_oracle_service_name)));"
+ },
+ "InitializeDatabase": true
+}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.API/appsettings.Services.json b/EOM.TSHotelManagement.API/appsettings.Services.json
new file mode 100644
index 0000000000000000000000000000000000000000..7c2ba5c86f09548e840d325f34cc2ac308ac4b81
--- /dev/null
+++ b/EOM.TSHotelManagement.API/appsettings.Services.json
@@ -0,0 +1,23 @@
+{
+ "Jwt": {
+ "Key": "",
+ "ExpiryMinutes": 20
+ },
+ "Mail": {
+ "Enabled": false,
+ "Host": "...",
+ "Port": 465,
+ "UserName": "",
+ "Password": "",
+ "EnableSsl": true,
+ "DisplayName": ""
+ },
+ "Lsky": {
+ "Enabled": false,
+ "BaseAddress": "",
+ "Email": "",
+ "Password": "",
+ "UploadApi": "",
+ "GetTokenApi": ""
+ }
+}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Common/EOM.TSHotelManagement.Common.csproj b/EOM.TSHotelManagement.Common/EOM.TSHotelManagement.Common.csproj
index ae9923076d977f1ac29ed680d0cf389b379b34f9..af3b4bcec6dd88704b53253dac693a3e557dfddc 100644
--- a/EOM.TSHotelManagement.Common/EOM.TSHotelManagement.Common.csproj
+++ b/EOM.TSHotelManagement.Common/EOM.TSHotelManagement.Common.csproj
@@ -4,71 +4,32 @@
net10.0
enable
enable
- True
+ False
x64
True
EOM.TSHotelManagement.Common
- 易开元(Easy Open Meta)
- Service to TS Hotel Management System Project, Development By Easy Open Meta
EOM.TSHOTEL.COMMON
-
- 1
- 10
- 0
-
- $(MSBuildProjectDirectory)\.buildnumber
-
- $(MajorVersion).$(MinorVersion).$(PatchVersion)
- $(Version)
-
- MIT
- https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
- https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
-
-
-
-
-
-
- @(BuildNumberLines)
- 0
-
- $([System.Int32]::Parse($(CurrentBuildNumber)))
- $([MSBuild]::Add($(CurrentBuildNumberInt), 1))
- $(NewBuildNumberInt)
-
-
-
-
-
-
+
+ portable
+
-
- $(MajorVersion).$(MinorVersion).$(NewBuildNumber)
- $(Version)
-
-
+
+ portable
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
diff --git a/EOM.TSHotelManagement.Common/Helper/LogHelper.cs b/EOM.TSHotelManagement.Common/Helper/LogHelper.cs
deleted file mode 100644
index a0fac51c217670b801a196fd1fbaf3ec50489dc6..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Common/Helper/LogHelper.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-using System.IO;
-
-namespace EOM.TSHotelManagement.Common
-{
- public static class LogHelper
- {
- private static readonly string logFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs", "ErrorLog.txt");
-
- static LogHelper()
- {
- var logDirectory = Path.GetDirectoryName(logFilePath);
- if (!Directory.Exists(logDirectory))
- {
- Directory.CreateDirectory(logDirectory);
- }
- }
-
- ///
- /// ¼CRUD־
- ///
- /// Ϣ
- /// 쳣
- public static void LogError(string message, Exception exception)
- {
- try
- {
- using (StreamWriter writer = new StreamWriter(logFilePath, true))
- {
- writer.WriteLine("--------------------------------------------------");
- writer.WriteLine($"ʱ: {DateTime.Now}");
- writer.WriteLine($"Ϣ: {message}");
- writer.WriteLine($"쳣: {exception}");
- writer.WriteLine("--------------------------------------------------");
- writer.WriteLine();
- }
- }
- catch (Exception ex)
- {
- Console.WriteLine($"¼־ʱ쳣: {ex}");
- }
- }
- }
-}
diff --git a/EOM.TSHotelManagement.Contract/Application/NavBar/Dto/DeleteNavBarInputDto.cs b/EOM.TSHotelManagement.Contract/Application/NavBar/Dto/DeleteNavBarInputDto.cs
index 1fd2711902746a6d1af00f9008bfec094ec90f23..0391260df05a1b70c56d512282fbee904885182d 100644
--- a/EOM.TSHotelManagement.Contract/Application/NavBar/Dto/DeleteNavBarInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Application/NavBar/Dto/DeleteNavBarInputDto.cs
@@ -2,10 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteNavBarInputDto : BaseInputDto
+ public class DeleteNavBarInputDto : DeleteDto
{
- [Required(ErrorMessage = "导航栏ID为必填字段")]
- public int NavigationBarId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/Asset/Dto/Asset/DeleteAssetInputDto.cs b/EOM.TSHotelManagement.Contract/Business/Asset/Dto/Asset/DeleteAssetInputDto.cs
index 4db70dbad4cdb10f6c89d4f2c22b1597c245f874..72912f748bf0e99c19d2142b8e8ae50f37bbce33 100644
--- a/EOM.TSHotelManagement.Contract/Business/Asset/Dto/Asset/DeleteAssetInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/Asset/Dto/Asset/DeleteAssetInputDto.cs
@@ -2,10 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteAssetInputDto : BaseInputDto
+ public class DeleteAssetInputDto : DeleteDto
{
- [Required(ErrorMessage = "资产编号为必填字段"), MaxLength(128, ErrorMessage = "资产编号长度不超过128字符")]
- public string AssetNumber { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/Customer/Dto/CustoType/DeleteCustoTypeInputDto.cs b/EOM.TSHotelManagement.Contract/Business/Customer/Dto/CustoType/DeleteCustoTypeInputDto.cs
index 094a42ae1d58f50180590ba6178990637388658d..1973abe72f861c776c7b26c42b10831fee7648a0 100644
--- a/EOM.TSHotelManagement.Contract/Business/Customer/Dto/CustoType/DeleteCustoTypeInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/Customer/Dto/CustoType/DeleteCustoTypeInputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteCustoTypeInputDto : BaseInputDto
+ public class DeleteCustoTypeInputDto : DeleteDto
{
- public int CustomerType { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/Customer/Dto/Customer/DeleteCustomerInputDto.cs b/EOM.TSHotelManagement.Contract/Business/Customer/Dto/Customer/DeleteCustomerInputDto.cs
index 05a7391b5d73ba7101b436e76b8c96f9d2845b32..f819f20e298e551077dd9669a3f9cabd2de2973a 100644
--- a/EOM.TSHotelManagement.Contract/Business/Customer/Dto/Customer/DeleteCustomerInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/Customer/Dto/Customer/DeleteCustomerInputDto.cs
@@ -2,10 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteCustomerInputDto : BaseInputDto
+ public class DeleteCustomerInputDto : DeleteDto
{
- [Required(ErrorMessage = "客户编号为必填字段"), MaxLength(128, ErrorMessage = "客户编号长度不超过128字符")]
- public string CustomerNumber { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/Customer/Dto/PassportType/DeletePassportTypeInputDto.cs b/EOM.TSHotelManagement.Contract/Business/Customer/Dto/PassportType/DeletePassportTypeInputDto.cs
index ff51593bd36b10baf2ebcf20029d143d9e4883fa..705f87d442adeb6e9cbda06d21d55efd2be790df 100644
--- a/EOM.TSHotelManagement.Contract/Business/Customer/Dto/PassportType/DeletePassportTypeInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/Customer/Dto/PassportType/DeletePassportTypeInputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Contract
{
- public class DeletePassportTypeInputDto : BaseInputDto
+ public class DeletePassportTypeInputDto : DeleteDto
{
- public int PassportId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/EnergyManagement/Dto/DeleteEnergyManagementInputDto.cs b/EOM.TSHotelManagement.Contract/Business/EnergyManagement/Dto/DeleteEnergyManagementInputDto.cs
index 3ba6b9cd425f4abb3ba81a776f2f0baa58b0bf4c..5f4f79c95bfeabbeca7cd4e8f1c167b7816c6acf 100644
--- a/EOM.TSHotelManagement.Contract/Business/EnergyManagement/Dto/DeleteEnergyManagementInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/EnergyManagement/Dto/DeleteEnergyManagementInputDto.cs
@@ -2,10 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteEnergyManagementInputDto : BaseInputDto
+ public class DeleteEnergyManagementInputDto : DeleteDto
{
- [Required(ErrorMessage = "信息编号为必填字段")]
- public int InformationId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/News/Dto/DeleteNewsInputDto.cs b/EOM.TSHotelManagement.Contract/Business/News/Dto/DeleteNewsInputDto.cs
index d476ebbeffba0816c9c6b8c1ab463013fe4e6120..88e761ae7a62531b41317104dee501e535cf1ce8 100644
--- a/EOM.TSHotelManagement.Contract/Business/News/Dto/DeleteNewsInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/News/Dto/DeleteNewsInputDto.cs
@@ -2,9 +2,7 @@
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteNewsInputDto : BaseInputDto
+ public class DeleteNewsInputDto : DeleteDto
{
- [Required(ErrorMessage = "新闻编号为必填字段"), MaxLength(128, ErrorMessage = "新闻编号长度不超过128字符")]
- public string NewId { get; set; }
}
}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Contract/Business/PromotionContent/Dto/DeletePromotionContentInputDto.cs b/EOM.TSHotelManagement.Contract/Business/PromotionContent/Dto/DeletePromotionContentInputDto.cs
index 0ee8b0a902e726c002b8a63df7626a48d4d49482..1dbf0391599d10e183d7094c445b36c7a9375416 100644
--- a/EOM.TSHotelManagement.Contract/Business/PromotionContent/Dto/DeletePromotionContentInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/PromotionContent/Dto/DeletePromotionContentInputDto.cs
@@ -2,10 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeletePromotionContentInputDto : BaseInputDto
+ public class DeletePromotionContentInputDto : DeleteDto
{
- [Required(ErrorMessage = "宣传ID为必填字段"), MaxLength(128, ErrorMessage = "宣传ID长度不超过128字符")]
- public string PromotionContentNumber { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/Reser/Dto/DeleteReserInputDto.cs b/EOM.TSHotelManagement.Contract/Business/Reser/Dto/DeleteReserInputDto.cs
index 041e10413dc69d248363307056ad58c56b9e84dd..27d4f54ba3499fa95f49946944b01c7cbd649ccf 100644
--- a/EOM.TSHotelManagement.Contract/Business/Reser/Dto/DeleteReserInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/Reser/Dto/DeleteReserInputDto.cs
@@ -2,10 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteReserInputDto : BaseInputDto
+ public class DeleteReserInputDto : DeleteDto
{
- [Required(ErrorMessage = "预约编号为必填字段"), MaxLength(128, ErrorMessage = "预约编号长度不超过128字符")]
- public string ReservationId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/Room/Dto/Room/DeleteRoomInputDto.cs b/EOM.TSHotelManagement.Contract/Business/Room/Dto/Room/DeleteRoomInputDto.cs
index 6d6ec1f1e4af7ca4c54e44473ee22e22359a6b5d..1dc0dcd4f572fc22f6d108a25ddaafd59424272d 100644
--- a/EOM.TSHotelManagement.Contract/Business/Room/Dto/Room/DeleteRoomInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/Room/Dto/Room/DeleteRoomInputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteRoomInputDto : BaseInputDto
+ public class DeleteRoomInputDto : DeleteDto
{
- public string RoomNumber { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/Room/Dto/RoomState/DeleteRoomStateInputDto.cs b/EOM.TSHotelManagement.Contract/Business/Room/Dto/RoomState/DeleteRoomStateInputDto.cs
index ea68d4abb2cc0c77bc4f8e376b2102a6b60499f0..93f323bfaee2d5c502752fcfb642d3adee9c8d8b 100644
--- a/EOM.TSHotelManagement.Contract/Business/Room/Dto/RoomState/DeleteRoomStateInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/Room/Dto/RoomState/DeleteRoomStateInputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteRoomStateInputDto : BaseInputDto
+ public class DeleteRoomStateInputDto : DeleteDto
{
- public int RoomStateId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/Room/Dto/RoomType/DeleteRoomTypeInputDto.cs b/EOM.TSHotelManagement.Contract/Business/Room/Dto/RoomType/DeleteRoomTypeInputDto.cs
index 651b08c8954e00a405ca805d3a8b5c1b487595de..7d94d97f3fb836d1247444dfc92de08156dd24ad 100644
--- a/EOM.TSHotelManagement.Contract/Business/Room/Dto/RoomType/DeleteRoomTypeInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/Room/Dto/RoomType/DeleteRoomTypeInputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteRoomTypeInputDto : BaseInputDto
+ public class DeleteRoomTypeInputDto : DeleteDto
{
- public int RoomTypeId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/Sellthing/Dto/DeleteSellThingInputDto.cs b/EOM.TSHotelManagement.Contract/Business/Sellthing/Dto/DeleteSellThingInputDto.cs
index d4cf117a23cfeb0967e410f48f387928b8fbe440..75876de916f3cfc835250e93d16b4bf1d6ae2b17 100644
--- a/EOM.TSHotelManagement.Contract/Business/Sellthing/Dto/DeleteSellThingInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/Sellthing/Dto/DeleteSellThingInputDto.cs
@@ -2,20 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteSellThingInputDto : BaseInputDto
+ public class DeleteSellThingInputDto : DeleteDto
{
- [Required(ErrorMessage = "商品编号为必填字段"), MaxLength(128, ErrorMessage = "商品编号长度不超过128字符")]
- public string ProductNumber { get; set; }
-
- [MaxLength(500, ErrorMessage = "商品名称长度不超过500字符")]
- public string ProductName { get; set; }
-
- public decimal ProductPrice { get; set; }
-
- [MaxLength(1000, ErrorMessage = "规格型号长度不超过1000字符")]
- public string Specification { get; set; }
-
- public decimal Stock { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Business/Spend/Dto/Spend/DeleteSpendInputDto.cs b/EOM.TSHotelManagement.Contract/Business/Spend/Dto/Spend/DeleteSpendInputDto.cs
index ec2429559ddee8f918c11e815f45224d418d97aa..20b822bf028322a4cd80668f1d188cea3e007ab0 100644
--- a/EOM.TSHotelManagement.Contract/Business/Spend/Dto/Spend/DeleteSpendInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Business/Spend/Dto/Spend/DeleteSpendInputDto.cs
@@ -2,13 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteSpendInputDto : BaseInputDto
+ public class DeleteSpendInputDto : DeleteDto
{
- [Required(ErrorMessage = "房间编号为必填字段")]
- public string RoomNumber { get; set; }
-
- [Required(ErrorMessage = "客户编号为必填字段")]
- public string CustomerNumber { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/BaseAuditDto.cs b/EOM.TSHotelManagement.Contract/Common/Dto/BaseAuditDto.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/BaseAuditDto.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/BaseAuditDto.cs
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/BaseDto.cs b/EOM.TSHotelManagement.Contract/Common/Dto/BaseDto.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/BaseDto.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/BaseDto.cs
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/BaseInputDto.cs b/EOM.TSHotelManagement.Contract/Common/Dto/BaseInputDto.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/BaseInputDto.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/BaseInputDto.cs
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/BaseOutputDto.cs b/EOM.TSHotelManagement.Contract/Common/Dto/BaseOutputDto.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/BaseOutputDto.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/BaseOutputDto.cs
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/BaseResponse.cs b/EOM.TSHotelManagement.Contract/Common/Dto/BaseResponse.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/BaseResponse.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/BaseResponse.cs
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/BusinessStatusCode.cs b/EOM.TSHotelManagement.Contract/Common/Dto/BusinessStatusCode.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/BusinessStatusCode.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/BusinessStatusCode.cs
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/CsrfTokenDto.cs b/EOM.TSHotelManagement.Contract/Common/Dto/CsrfTokenDto.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/CsrfTokenDto.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/CsrfTokenDto.cs
diff --git a/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/DeleteApplicationVersionInputDto.cs b/EOM.TSHotelManagement.Contract/Common/Dto/DeleteDto.cs
similarity index 32%
rename from EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/DeleteApplicationVersionInputDto.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/DeleteDto.cs
index fc6dad2f92b25709b4e202e4caa06ba71ab91fca..021f809fa2221dee35612a3a0520e6443f2bd8a6 100644
--- a/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/DeleteApplicationVersionInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Common/Dto/DeleteDto.cs
@@ -1,10 +1,9 @@
+using System.Collections.Generic;
+
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteApplicationVersionInputDto : BaseInputDto
+ public abstract class DeleteDto
{
- public int VersionId { get; set; }
+ public List DelIds { get; set; }
}
-}
-
-
-
+}
\ No newline at end of file
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/ListInputDto.cs b/EOM.TSHotelManagement.Contract/Common/Dto/ListInputDto.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/ListInputDto.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/ListInputDto.cs
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/ListOutputDto.cs b/EOM.TSHotelManagement.Contract/Common/Dto/ListOutputDto.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/ListOutputDto.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/ListOutputDto.cs
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/MenuDto.cs b/EOM.TSHotelManagement.Contract/Common/Dto/MenuDto.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/MenuDto.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/MenuDto.cs
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/PagedData.cs b/EOM.TSHotelManagement.Contract/Common/Dto/PagedData.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/PagedData.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/PagedData.cs
diff --git a/EOM.TSHotelManagement.Contract/BaseDto/SingleOutputDto.cs b/EOM.TSHotelManagement.Contract/Common/Dto/SingleOutputDto.cs
similarity index 100%
rename from EOM.TSHotelManagement.Contract/BaseDto/SingleOutputDto.cs
rename to EOM.TSHotelManagement.Contract/Common/Dto/SingleOutputDto.cs
diff --git a/EOM.TSHotelManagement.Contract/EOM.TSHotelManagement.Contract.csproj b/EOM.TSHotelManagement.Contract/EOM.TSHotelManagement.Contract.csproj
index 908b8401c58a1c71f73912fe3ddd3d8908d9c59a..09c4b2adeba1f966a198e578bf2e91b45474c6e0 100644
--- a/EOM.TSHotelManagement.Contract/EOM.TSHotelManagement.Contract.csproj
+++ b/EOM.TSHotelManagement.Contract/EOM.TSHotelManagement.Contract.csproj
@@ -8,52 +8,9 @@
x64
True
EOM.TSHotelManagement.Contract
- 易开元(Easy Open Meta)
- Service to TS Hotel Management System Project, Development By Easy Open Meta
EOM.TSHOTEL.CONTRACT
-
- 1
- 10
- 0
-
- $(MSBuildProjectDirectory)\.buildnumber
-
- $(MajorVersion).$(MinorVersion).$(PatchVersion)
- $(Version)
-
- MIT
- https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
- https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
-
-
-
-
-
-
- @(BuildNumberLines)
- 0
-
- $([System.Int32]::Parse($(CurrentBuildNumber)))
- $([MSBuild]::Add($(CurrentBuildNumberInt), 1))
- $(NewBuildNumberInt)
-
-
-
-
-
-
-
-
- $(MajorVersion).$(MinorVersion).$(NewBuildNumber)
- $(Version)
-
-
-
diff --git a/EOM.TSHotelManagement.Contract/Employee/Dto/Employee/DeleteEmployeeInputDto.cs b/EOM.TSHotelManagement.Contract/Employee/Dto/Employee/DeleteEmployeeInputDto.cs
index ce3db5350e046b4a975bda210c7a7cd7f9efc811..9b51845eefac83f41557e2be943e3f7911f822ac 100644
--- a/EOM.TSHotelManagement.Contract/Employee/Dto/Employee/DeleteEmployeeInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Employee/Dto/Employee/DeleteEmployeeInputDto.cs
@@ -2,11 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteEmployeeInputDto : BaseInputDto
+ public class DeleteEmployeeInputDto : DeleteDto
{
- [Required(ErrorMessage = "员工账号为必填字段")]
- [MaxLength(128, ErrorMessage = "员工账号长度不超过128字符")]
- public string EmployeeId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeCheck/DeleteEmployeeCheckInputDto.cs b/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeCheck/DeleteEmployeeCheckInputDto.cs
index e9eb67ea0f939c3170f514f94c1b1ba220640f9e..d1e0edf4696989fd8795c985e0ce65d44edc5976 100644
--- a/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeCheck/DeleteEmployeeCheckInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeCheck/DeleteEmployeeCheckInputDto.cs
@@ -2,10 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteEmployeeCheckInputDto : BaseInputDto
+ public class DeleteEmployeeCheckInputDto : DeleteDto
{
- [Required(ErrorMessage = "打卡ID为必填字段")]
- public int CheckId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeHistory/DeleteEmployeeHistoryInputDto.cs b/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeHistory/DeleteEmployeeHistoryInputDto.cs
index 39d731eaea1b15044f551f797a0e79a520904d31..6fb9689d0de313b9534470d5075fc4527e3d37e0 100644
--- a/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeHistory/DeleteEmployeeHistoryInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeHistory/DeleteEmployeeHistoryInputDto.cs
@@ -2,10 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteEmployeeHistoryInputDto : BaseInputDto
+ public class DeleteEmployeeHistoryInputDto : DeleteDto
{
- [Required(ErrorMessage = "履历ID为必填字段")]
- public int HistoryId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeePhoto/DeleteEmployeePhotoInputDto.cs b/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeePhoto/DeleteEmployeePhotoInputDto.cs
index 46d79e7f1cda725cdcadddb3259a268272aca2b0..dc2c6270b5392e46bece01529294ad8d81d36029 100644
--- a/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeePhoto/DeleteEmployeePhotoInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeePhoto/DeleteEmployeePhotoInputDto.cs
@@ -2,14 +2,10 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteEmployeePhotoInputDto : ListInputDto
+ public class DeleteEmployeePhotoInputDto
{
- [Required(ErrorMessage = "照片ID为必填字段")]
- public int PhotoId { get; set; }
-
- [Required(ErrorMessage = "员工工号为必填字段")]
- [MaxLength(128, ErrorMessage = "员工工号长度不超过128字符")]
- public string EmployeeId { get; set; }
+ [Required(ErrorMessage = "Employee Id is required")]
+ public int EmployeeId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeRewardPunishment/DeleteEmployeeRewardPunishmentInputDto.cs b/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeRewardPunishment/DeleteEmployeeRewardPunishmentInputDto.cs
index fbc0841fdfa087cf29c007f1f928efa87592ed69..f60047b5936d08d331a16564ab6d3c2e079d2132 100644
--- a/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeRewardPunishment/DeleteEmployeeRewardPunishmentInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Employee/Dto/EmployeeRewardPunishment/DeleteEmployeeRewardPunishmentInputDto.cs
@@ -2,10 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteEmployeeRewardPunishmentInputDto : BaseInputDto
+ public class DeleteEmployeeRewardPunishmentInputDto : DeleteDto
{
- [Required(ErrorMessage = "奖惩ID为必填字段")]
- public int RewardPunishmentId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Employee/Dto/RewardPunishmentType/DeleteRewardPunishmentTypeInputDto.cs b/EOM.TSHotelManagement.Contract/Employee/Dto/RewardPunishmentType/DeleteRewardPunishmentTypeInputDto.cs
index a56f01615e9314e99b726587de4875158d1c91a6..54a362c5458a8274dd5d4379b7eff35d0645d841 100644
--- a/EOM.TSHotelManagement.Contract/Employee/Dto/RewardPunishmentType/DeleteRewardPunishmentTypeInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Employee/Dto/RewardPunishmentType/DeleteRewardPunishmentTypeInputDto.cs
@@ -2,11 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteRewardPunishmentTypeInputDto : BaseInputDto
+ public class DeleteRewardPunishmentTypeInputDto : DeleteDto
{
- [Required(ErrorMessage = "奖惩类型编号为必填字段")]
- [MaxLength(128, ErrorMessage = "奖惩类型编号长度不超过128字符")]
- public string RewardPunishmentTypeId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Administrator/DeleteAdministratorInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Administrator/DeleteAdministratorInputDto.cs
index 1d9ff711716145818e71ae79ff6bcdadf9da6c02..911073c8fe5a585440701387001001528fbf9247 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Administrator/DeleteAdministratorInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Administrator/DeleteAdministratorInputDto.cs
@@ -2,11 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteAdministratorInputDto : BaseInputDto
+ public class DeleteAdministratorInputDto : DeleteDto
{
- [Required(ErrorMessage = "管理员账号为必填字段")]
- [MaxLength(128, ErrorMessage = "管理员账号长度不超过128字符")]
- public string Number { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Administrator/ReadAdministratorOutputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Administrator/ReadAdministratorOutputDto.cs
index c65919c859914f329d7c2cdff93956d67d38d7b8..3bbfad6cf05483d9f5e71a059ca5108992153db1 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Administrator/ReadAdministratorOutputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Administrator/ReadAdministratorOutputDto.cs
@@ -10,14 +10,8 @@
public int IsSuperAdmin { get; set; }
- ///
- /// 锟角凤拷为锟斤拷锟斤拷锟斤拷锟斤拷员锟斤拷锟斤拷 (Is Super Administrator Description)
- ///
public string IsSuperAdminDescription { get; set; }
- ///
- /// 锟斤拷锟斤拷员锟斤拷锟斤拷锟斤拷锟斤拷 (Administrator Type Name)
- ///
public string TypeName { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AdministratorType/DeleteAdministratorTypeInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AdministratorType/DeleteAdministratorTypeInputDto.cs
index 3b29450b108d2ac552ca36b2f860cf20d1214410..580866dd8b548b79f4e440ee4d257634b2dd3d2b 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AdministratorType/DeleteAdministratorTypeInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AdministratorType/DeleteAdministratorTypeInputDto.cs
@@ -2,11 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteAdministratorTypeInputDto : BaseInputDto
+ public class DeleteAdministratorTypeInputDto : DeleteDto
{
- [Required(ErrorMessage = "类型编号为必填字段")]
- [MaxLength(128, ErrorMessage = "类型编号长度不超过128字符")]
- public string TypeId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AppointmentNotice/DeleteAppointmentNoticeInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AppointmentNotice/DeleteAppointmentNoticeInputDto.cs
index e1464ab15978328cdaf74f08b0b13a5e88ab5456..0ad87bc41e7c952653877a74fc89934147ab94c4 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AppointmentNotice/DeleteAppointmentNoticeInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AppointmentNotice/DeleteAppointmentNoticeInputDto.cs
@@ -2,11 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteAppointmentNoticeInputDto : BaseInputDto
+ public class DeleteAppointmentNoticeInputDto : DeleteDto
{
- [Required(ErrorMessage = "公告编号为必填字段")]
- [MaxLength(128, ErrorMessage = "公告编号长度不超过128字符")]
- public string NoticeId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AppointmentNoticeType/DeleteAppointmentNoticeTypeInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AppointmentNoticeType/DeleteAppointmentNoticeTypeInputDto.cs
index bb5b3d171d734767ef50cfa682f64c6c0a6b56ca..38a74bb3ff0fff46e5fb6fca7d7a63df6b8acdc4 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AppointmentNoticeType/DeleteAppointmentNoticeTypeInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/AppointmentNoticeType/DeleteAppointmentNoticeTypeInputDto.cs
@@ -2,10 +2,7 @@
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteAppointmentNoticeTypeInputDto : BaseInputDto
+ public class DeleteAppointmentNoticeTypeInputDto : DeleteDto
{
- [Required(ErrorMessage = "公告类型编号为必填字段")]
- [MaxLength(128, ErrorMessage = "公告类型编号长度不超过128字符")]
- public string NoticeTypeNumber { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Department/DeleteDepartmentInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Department/DeleteDepartmentInputDto.cs
index f1ffe9451873d10e5f0e091689edae910857ab7e..0eb82f4accdf196c011cea864cb8c8f3ec8dac23 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Department/DeleteDepartmentInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Department/DeleteDepartmentInputDto.cs
@@ -2,33 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteDepartmentInputDto : BaseInputDto
+ public class DeleteDepartmentInputDto : DeleteDto
{
- public int? Id { get; set; }
-
- [Required(ErrorMessage = "部门编号为必填字段")]
- [MaxLength(128, ErrorMessage = "部门编号长度不超过128字符")]
- public string DepartmentNumber { get; set; }
-
- [MaxLength(256, ErrorMessage = "部门名称长度不超过256字符")]
- public string DepartmentName { get; set; }
-
- [MaxLength(500, ErrorMessage = "部门描述长度不超过500字符")]
- public string DepartmentDescription { get; set; }
-
- public DateTime DepartmentCreationDate { get; set; }
-
- [MaxLength(128, ErrorMessage = "部门主管长度不超过128字符")]
- public string DepartmentLeader { get; set; }
-
- [MaxLength(200, ErrorMessage = "部门主管姓名长度不超过200字符")]
- public string LeaderName { get; set; }
-
- [MaxLength(128, ErrorMessage = "上级部门编号长度不超过128字符")]
- public string ParentDepartmentNumber { get; set; }
-
- [MaxLength(256, ErrorMessage = "上级部门名称长度不超过256字符")]
- public string ParentDepartmentName { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Menu/DeleteMenuInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Menu/DeleteMenuInputDto.cs
index 4373368888f95374946096c8b30650866ae8d85c..ff102a98ea3c098e5fc0a282f00a04f7a50c99da 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Menu/DeleteMenuInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Menu/DeleteMenuInputDto.cs
@@ -2,19 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteMenuInputDto : BaseInputDto
+ public class DeleteMenuInputDto : DeleteDto
{
- [MaxLength(256, ErrorMessage = "菜单键长度不超过256字符")]
- public string Key { get; set; }
-
- [MaxLength(256, ErrorMessage = "菜单标题长度不超过256字符")]
- public string Title { get; set; }
-
- public string Path { get; set; }
- public int? Parent { get; set; }
-
- [MaxLength(256, ErrorMessage = "菜单图标长度不超过256字符")]
- public string Icon { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Menu/ReadMenuInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Menu/ReadMenuInputDto.cs
index 9b18f6305a7598bfe34dda87ae647bb2c7e8b5de..7b25c1e35d66081ef77018a54d40b01fb3ab6559 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Menu/ReadMenuInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Menu/ReadMenuInputDto.cs
@@ -3,7 +3,7 @@
public class ReadMenuInputDto : ListInputDto
{
public int? Id { get; set; }
-
+ public string? Title { get; set; }
public bool SearchParent { get; set; } = false;
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Nation/DeleteNationInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Nation/DeleteNationInputDto.cs
index f6e5c94751e2d686b6ab3740daf9b165fa070625..d9f9f5fc9756d477258001db2b8e0bfc27cf6e0f 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Nation/DeleteNationInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Nation/DeleteNationInputDto.cs
@@ -2,13 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteNationInputDto : BaseInputDto
+ public class DeleteNationInputDto : DeleteDto
{
- public int NationId { get; set; }
-
- [Required(ErrorMessage = "民族编号为必填字段")]
- [MaxLength(128, ErrorMessage = "民族编号长度不超过128字符")]
- public string NationNumber { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Position/DeletePositionInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Position/DeletePositionInputDto.cs
index 41e705f92bcd4d6a17c9cbde7d705ff03e9121b4..94c45d108ea34b216e6aaf28398e2b70d97ef227 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Position/DeletePositionInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Position/DeletePositionInputDto.cs
@@ -2,11 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeletePositionInputDto : BaseInputDto
+ public class DeletePositionInputDto : DeleteDto
{
- [Required(ErrorMessage = "职位编号为必填字段")]
- [MaxLength(128, ErrorMessage = "职位编号长度不超过128字符")]
- public string PositionNumber { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Qualification/DeleteEducationInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Qualification/DeleteEducationInputDto.cs
index d017157f4244e3d5d1c21e77b18ce5d336e8fc96..a9112f2668a093184fd351b3074d5115a4589d7e 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Qualification/DeleteEducationInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Qualification/DeleteEducationInputDto.cs
@@ -2,11 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteEducationInputDto : BaseInputDto
+ public class DeleteEducationInputDto : DeleteDto
{
- [Required(ErrorMessage = "学历编号为必填字段")]
- [MaxLength(128, ErrorMessage = "学历编号长度不超过128字符")]
- public string EducationNumber { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Role/DeleteRoleInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Role/DeleteRoleInputDto.cs
index 274ecf893ac21af7807aea5d80221bb98d345e61..1888fba59a72f5494b85c3ae8ca1d64126364539 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Role/DeleteRoleInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Role/DeleteRoleInputDto.cs
@@ -2,11 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteRoleInputDto : BaseInputDto
+ public class DeleteRoleInputDto : DeleteDto
{
- [Required(ErrorMessage = "角色编码为必填字段")]
- [MaxLength(128, ErrorMessage = "角色编码长度不超过128字符")]
- public string RoleNumber { get; set; } = null!;
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/SupervisionStatistics/DeleteSupervisionStatisticsInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/SupervisionStatistics/DeleteSupervisionStatisticsInputDto.cs
index 5c71f796c6ee408b6b057453c44c8b4eb25611d0..bf83fdb205ec51762b64fcf42f45825774ad3c58 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/SupervisionStatistics/DeleteSupervisionStatisticsInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/SupervisionStatistics/DeleteSupervisionStatisticsInputDto.cs
@@ -2,26 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteSupervisionStatisticsInputDto : BaseInputDto
+ public class DeleteSupervisionStatisticsInputDto : DeleteDto
{
- [Required(ErrorMessage = "统计编号为必填字段")]
- [MaxLength(128, ErrorMessage = "统计编号长度不超过128字符")]
- public string StatisticsNumber { get; set; }
-
- [MaxLength(128, ErrorMessage = "监督部门长度不超过128字符")]
- public string SupervisingDepartment { get; set; }
-
- [MaxLength(200, ErrorMessage = "监督部门名称长度不超过200字符")]
- public string SupervisingDepartmentName { get; set; }
-
- public string SupervisionProgress { get; set; }
- public string SupervisionLoss { get; set; }
- public int SupervisionScore { get; set; }
-
- [MaxLength(128, ErrorMessage = "监督统计事长度不超过128字符")]
- public string SupervisionStatistician { get; set; }
-
- public string SupervisionAdvice { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/SystemInformation/DeleteSystemInformationInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/SystemInformation/DeleteSystemInformationInputDto.cs
index fd240c9e8cf442674c88a1465b134c2debe28464..dd7eb02a639b1242e8f1958daf8e2b063d7642c5 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/SystemInformation/DeleteSystemInformationInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/SystemInformation/DeleteSystemInformationInputDto.cs
@@ -1,8 +1,7 @@
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteSystemInformationInputDto : BaseInputDto
+ public class DeleteSystemInformationInputDto : DeleteDto
{
- public int InformationId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/VipLevelRule/DeleteVipLevelRuleInputDto.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/VipLevelRule/DeleteVipLevelRuleInputDto.cs
index 7e1f3e0932414e3242a7d3ed1dc6863f20d4f817..7805fe75b32cd0bd098391304e63b7dea89f1072 100644
--- a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/VipLevelRule/DeleteVipLevelRuleInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/VipLevelRule/DeleteVipLevelRuleInputDto.cs
@@ -2,20 +2,8 @@ using System.ComponentModel.DataAnnotations;
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteVipLevelRuleInputDto : BaseInputDto
+ public class DeleteVipLevelRuleInputDto : DeleteDto
{
- public int? Id { get; set; }
-
- [Required(ErrorMessage = "会员规则流水号为必填字段")]
- [MaxLength(128, ErrorMessage = "会员规则流水号长度不超过128字符")]
- public string RuleSerialNumber { get; set; }
-
- [MaxLength(200, ErrorMessage = "会员规则名称长度不超过200字符")]
- public string RuleName { get; set; }
-
- public decimal RuleValue { get; set; }
- public int VipLevelId { get; set; }
- public string VipLevelName { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/CreateApplicationVersionInputDto.cs b/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/CreateApplicationVersionInputDto.cs
deleted file mode 100644
index 3d056bb8b4eab72692fc101badd623db1367cc6b..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/CreateApplicationVersionInputDto.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace EOM.TSHotelManagement.Contract
-{
- public class CreateApplicationVersionInputDto : BaseInputDto
- {
- public string VersionNumber { get; set; }
- public string VersionDescription { get; set; }
- public DateTime ReleaseDate { get; set; }
- }
-}
-
-
-
diff --git a/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/ReadApplicationVersionInputDto.cs b/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/ReadApplicationVersionInputDto.cs
deleted file mode 100644
index 29d03c45c952dba471e4364d3b8624754e4c281f..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/ReadApplicationVersionInputDto.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace EOM.TSHotelManagement.Contract
-{
- public class ReadApplicationVersionInputDto : ListInputDto
- {
- public int? VersionId { get; set; }
- }
-}
-
-
diff --git a/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/ReadApplicationVersionOutputDto.cs b/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/ReadApplicationVersionOutputDto.cs
deleted file mode 100644
index b254f71a8d829198ad9a01d65ee46d7e2ec77c86..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/ReadApplicationVersionOutputDto.cs
+++ /dev/null
@@ -1,12 +0,0 @@
-namespace EOM.TSHotelManagement.Contract
-{
- public class ReadApplicationVersionOutputDto : BaseOutputDto
- {
- public int ApplicationVersionId { get; set; }
- public string VersionNumber { get; set; }
- public string VersionDescription { get; set; }
- public DateTime ReleaseDate { get; set; }
- }
-}
-
-
diff --git a/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/UpdateApplicationVersionInputDto.cs b/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/UpdateApplicationVersionInputDto.cs
deleted file mode 100644
index 4fb8268741100a9ab4d6f710ffb7f72b0cda585b..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Contract/Util/Dto/ApplicationVersion/UpdateApplicationVersionInputDto.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace EOM.TSHotelManagement.Contract
-{
- public class UpdateApplicationVersionInputDto : BaseInputDto
- {
- public int VersionId { get; set; }
- public string VersionNumber { get; set; }
- public string VersionDescription { get; set; }
- public DateTime ReleaseDate { get; set; }
- }
-}
-
-
-
diff --git a/EOM.TSHotelManagement.Contract/Util/Dto/CardCode/DeleteCardCodeInputDto.cs b/EOM.TSHotelManagement.Contract/Util/Dto/CardCode/DeleteCardCodeInputDto.cs
index 854df82e22d0c67d0adfd5f669f15be03ff97baf..a5164bd6fc451134db5779d2f08024aa859a2021 100644
--- a/EOM.TSHotelManagement.Contract/Util/Dto/CardCode/DeleteCardCodeInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Util/Dto/CardCode/DeleteCardCodeInputDto.cs
@@ -1,16 +1,7 @@
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteCardCodeInputDto : BaseInputDto
+ public class DeleteCardCodeInputDto : DeleteDto
{
- public long Id { get; set; }
-
- public string Province { get; set; }
-
- public string City { get; set; }
-
- public string District { get; set; }
-
- public string AreaCode { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Contract/Util/Dto/OperationLog/DeleteOperationLogInputDto.cs b/EOM.TSHotelManagement.Contract/Util/Dto/OperationLog/DeleteOperationLogInputDto.cs
index a783b9787094be940bc2375d4a217843c98b7221..4195e3cb468a8ba9425b7cd878d79b6f1a95740a 100644
--- a/EOM.TSHotelManagement.Contract/Util/Dto/OperationLog/DeleteOperationLogInputDto.cs
+++ b/EOM.TSHotelManagement.Contract/Util/Dto/OperationLog/DeleteOperationLogInputDto.cs
@@ -1,8 +1,8 @@
+
namespace EOM.TSHotelManagement.Contract
{
- public class DeleteOperationLogInputDto : BaseInputDto
+ public class DeleteOperationLogInputDto : DeleteDto
{
- public string OperationId { get; set; }
}
}
diff --git a/EOM.TSHotelManagement.Data/Connector/SqlSugarClientConnector.cs b/EOM.TSHotelManagement.Data/Connector/SqlSugarClientConnector.cs
index 6502185359bf6c25c66a1dbfe9d7b67991a5bd8a..b8e3af9cf97e0e348cf14a35ab33359e8077a9ce 100644
--- a/EOM.TSHotelManagement.Data/Connector/SqlSugarClientConnector.cs
+++ b/EOM.TSHotelManagement.Data/Connector/SqlSugarClientConnector.cs
@@ -60,12 +60,10 @@ namespace EOM.TSHotelManagement.Data
// 优先从环境变量获取
var envValue = Environment.GetEnvironmentVariable(SystemConstant.Env.Code);
- Console.WriteLine($"ASPNETCORE_ENVIRONMENT: {envValue}");
-
+
if (!string.IsNullOrEmpty(envValue) && envValue.ToLower() == SystemConstant.Docker.Code)
{
var envDbName = Environment.GetEnvironmentVariable(SystemConstant.DefaultDatabase.Code);
- Console.WriteLine($"环境变量 DefaultDatabase: {envDbName}");
if (!string.IsNullOrEmpty(envDbName))
{
@@ -75,7 +73,6 @@ namespace EOM.TSHotelManagement.Data
// 从配置文件获取
var configDbName = _configuration[SystemConstant.DefaultDatabase.Code];
- Console.WriteLine($"配置文件 DefaultDatabase: {configDbName}");
return configDbName ?? SystemConstant.MariaDB.Code;
}
@@ -83,15 +80,11 @@ namespace EOM.TSHotelManagement.Data
private string GetConnectionString(string dbName)
{
var envValue = Environment.GetEnvironmentVariable(SystemConstant.Env.Code);
- Console.WriteLine($"连接字符串 - 环境: {envValue}, 数据库: {dbName}");
if (!string.IsNullOrEmpty(envValue) && envValue.ToLower() == "docker")
{
- Console.WriteLine("从环境变量获取连接字符串");
-
var envVarName = $"{dbName}ConnectStr";
var envConnectionString = Environment.GetEnvironmentVariable(envVarName);
- Console.WriteLine($"环境变量 {envVarName}: {envConnectionString ?? "null"}");
if (!string.IsNullOrEmpty(envConnectionString))
{
@@ -101,9 +94,7 @@ namespace EOM.TSHotelManagement.Data
throw new ArgumentException($"Docker环境下未找到环境变量: {envVarName}");
}
- Console.WriteLine("从配置文件获取连接字符串");
var configConnectionString = _configuration.GetConnectionString($"{dbName}ConnectStr");
- Console.WriteLine($"配置文件连接字符串: {configConnectionString ?? "null"}");
return configConnectionString;
}
diff --git a/EOM.TSHotelManagement.Data/DatabaseInitializer/DatabaseInitializer.cs b/EOM.TSHotelManagement.Data/DatabaseInitializer/DatabaseInitializer.cs
index e842efb4dd652bb5a8c7b42ec0cb88910ef0d671..653933deaddbba78a187b11a993d687b8f2a5c20 100644
--- a/EOM.TSHotelManagement.Data/DatabaseInitializer/DatabaseInitializer.cs
+++ b/EOM.TSHotelManagement.Data/DatabaseInitializer/DatabaseInitializer.cs
@@ -121,47 +121,33 @@ namespace EOM.TSHotelManagement.Data
public string GetDatabaseName(IConfiguration config)
{
- Console.WriteLine("=== 开始获取数据库名称 ===");
-
var envCode = Environment.GetEnvironmentVariable(SystemConstant.Env.Code);
- Console.WriteLine($"ASPNETCORE_ENVIRONMENT: {envCode ?? "null"}");
-
var isDocker = !string.IsNullOrEmpty(envCode) && envCode.ToLower() == SystemConstant.Docker.Code;
- Console.WriteLine($"是否为 Docker 环境: {isDocker}");
-
string dbName;
if (isDocker)
{
dbName = Environment.GetEnvironmentVariable(SystemConstant.DefaultDatabase.Code);
- Console.WriteLine($"环境变量 DefaultDatabase: {dbName ?? "null"}");
-
if (string.IsNullOrEmpty(dbName))
{
dbName = config[SystemConstant.DefaultDatabase.Code];
- Console.WriteLine($"配置文件 DefaultDatabase: {dbName ?? "null"}");
-
if (string.IsNullOrEmpty(dbName))
{
dbName = SystemConstant.MariaDB.Code;
- Console.WriteLine($"使用默认数据库: {dbName}");
}
}
}
else
{
dbName = config[SystemConstant.DefaultDatabase.Code] ?? SystemConstant.MariaDB.Code;
- Console.WriteLine($"非Docker环境,使用数据库: {dbName}");
}
var supportedDbs = new[] { SystemConstant.MariaDB.Code, SystemConstant.MySql.Code, SystemConstant.PgSql.Code, SystemConstant.SqlServer.Code, SystemConstant.Oracle.Code, SystemConstant.Sqlite.Code };
if (!supportedDbs.Contains(dbName))
{
- Console.WriteLine($"警告:不支持的数据库类型 '{dbName}',默认使用 MariaDB");
- dbName = "MariaDB";
+ dbName = SystemConstant.MariaDB.Code;
}
- Console.WriteLine($"最终确定的数据库类型: {dbName}");
return dbName;
}
@@ -224,34 +210,24 @@ namespace EOM.TSHotelManagement.Data
private string GetConnectionString(IConfiguration config, string dbName)
{
- Console.WriteLine("=== 开始获取连接字符串 ===");
- Console.WriteLine($"参数 dbName: {dbName}");
-
var env = Environment.GetEnvironmentVariable(SystemConstant.Env.Code);
Console.WriteLine($"ASPNETCORE_ENVIRONMENT: {env}");
if (!string.IsNullOrEmpty(env) && env.ToLower() == "docker")
{
- Console.WriteLine("检测到 Docker 环境,从环境变量获取连接字符串");
-
var envVarName = $"{dbName}ConnectStr";
var connectionString = Environment.GetEnvironmentVariable(envVarName);
- Console.WriteLine($"环境变量 {envVarName}: {connectionString ?? "null"}");
-
if (!string.IsNullOrEmpty(connectionString))
{
var cleanString = connectionString.Trim('"');
- Console.WriteLine($"使用环境变量连接字符串: {cleanString}");
return cleanString;
}
throw new ArgumentException($"Docker 环境变量 {envVarName} 未找到或为空");
}
- Console.WriteLine("从配置文件获取连接字符串");
var configString = config.GetConnectionString($"{dbName}ConnectStr");
- Console.WriteLine($"配置文件连接字符串: {configString ?? "null"}");
if (string.IsNullOrEmpty(configString))
{
diff --git a/EOM.TSHotelManagement.Data/Repository/GenericRepository.cs b/EOM.TSHotelManagement.Data/Repository/GenericRepository.cs
index d5b26cd84c76ad93fee862d871d162b58210afa5..3ae61607dd7bb2e890faf788bc5f45795883e0b5 100644
--- a/EOM.TSHotelManagement.Data/Repository/GenericRepository.cs
+++ b/EOM.TSHotelManagement.Data/Repository/GenericRepository.cs
@@ -198,5 +198,52 @@ namespace EOM.TSHotelManagement.Data
.IgnoreColumns(ignoreAllNullColumns: true)
.ExecuteCommand() > 0;
}
+
+ public bool SoftDeleteRange(List entities)
+ {
+ if (entities == null || !entities.Any())
+ return false;
+
+ var currentUser = GetCurrentUser();
+ var now = DateTime.Now;
+ var hasBaseEntity = false;
+
+ var baseEntities = new List();
+
+ // 更新内存中的实体状态
+ foreach (var entity in entities)
+ {
+ if (entity is BaseEntity baseEntity)
+ {
+ hasBaseEntity = true;
+ baseEntity.IsDelete = 1;
+ baseEntity.DataChgDate = now;
+ baseEntity.DataChgUsr = currentUser;
+ baseEntities.Add(baseEntity);
+ }
+ }
+
+ if (!hasBaseEntity)
+ return false;
+
+ // 分批次处理
+ const int batchSize = 1000;
+ var totalAffected = 0;
+
+ for (int i = 0; i < baseEntities.Count; i += batchSize)
+ {
+ var batch = baseEntities.Skip(i).Take(batchSize).ToList();
+
+ totalAffected += base.Context.Updateable(batch)
+ .UpdateColumns(new[] {
+ nameof(BaseEntity.IsDelete),
+ nameof(BaseEntity.DataChgUsr),
+ nameof(BaseEntity.DataChgDate)
+ })
+ .ExecuteCommand();
+ }
+
+ return totalAffected > 0;
+ }
}
}
diff --git a/EOM.TSHotelManagement.Domain/EOM.TSHotelManagement.Domain.csproj b/EOM.TSHotelManagement.Domain/EOM.TSHotelManagement.Domain.csproj
index 2fd7c6b7e710998bc7659c4c9864462c37898b46..befa5d96705b7aae64858c5e4f3df64f211d4c61 100644
--- a/EOM.TSHotelManagement.Domain/EOM.TSHotelManagement.Domain.csproj
+++ b/EOM.TSHotelManagement.Domain/EOM.TSHotelManagement.Domain.csproj
@@ -8,54 +8,11 @@
x64
True
EOM.TSHotelManagement.Domain
- 易开元(Easy Open Meta)
- Service to TS Hotel Management System Project, Development By Easy Open Meta
EOM.TSHOTEL.DOMAIN
-
- 1
- 10
- 0
-
- $(MSBuildProjectDirectory)\.buildnumber
-
- $(MajorVersion).$(MinorVersion).$(PatchVersion)
- $(Version)
-
- MIT
- https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
- https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
-
-
-
-
-
-
- @(BuildNumberLines)
- 0
-
- $([System.Int32]::Parse($(CurrentBuildNumber)))
- $([MSBuild]::Add($(CurrentBuildNumberInt), 1))
- $(NewBuildNumberInt)
-
-
-
-
-
-
-
-
- $(MajorVersion).$(MinorVersion).$(NewBuildNumber)
- $(Version)
-
-
-
-
-
+
+
diff --git a/EOM.TSHotelManagement.Domain/Util/ApplicationVersion.cs b/EOM.TSHotelManagement.Domain/Util/ApplicationVersion.cs
deleted file mode 100644
index 614c0e5c74b184503ac316f8174904ba81935c41..0000000000000000000000000000000000000000
--- a/EOM.TSHotelManagement.Domain/Util/ApplicationVersion.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using SqlSugar;
-
-namespace EOM.TSHotelManagement.Domain
-{
- ///
- /// 应用版本 (Application Version)
- ///
- [SugarTable("app_version", "应用版本 (Application Version)")]
- public class ApplicationVersion
- {
- ///
- /// 流水号 (Sequence Number)
- ///
- [SugarColumn(ColumnName = "base_versionId", IsIdentity = true, IsPrimaryKey = true, ColumnDescription = "流水号 (Sequence Number)")]
- public int Id { get; set; }
-
- ///
- /// 版本号 (Version Number)
- ///
- [SugarColumn(ColumnName = "base_version", Length = 100, ColumnDescription = "版本号 (Version Number)")]
- public string VersionNumber { get; set; }
- }
-}
diff --git a/EOM.TSHotelManagement.Infrastructure/EOM.TSHotelManagement.Infrastructure.csproj b/EOM.TSHotelManagement.Infrastructure/EOM.TSHotelManagement.Infrastructure.csproj
index 5aa8ab35b3a9cc11cc464b036f8b8cc7cca88614..d6e07bfdc3270ae58329f8dd6cd3d85ee351a183 100644
--- a/EOM.TSHotelManagement.Infrastructure/EOM.TSHotelManagement.Infrastructure.csproj
+++ b/EOM.TSHotelManagement.Infrastructure/EOM.TSHotelManagement.Infrastructure.csproj
@@ -4,59 +4,16 @@
net10.0
enable
enable
- True
+ False
x64
True
EOM.TSHotelManagement.Infrastructure
- 易开元(Easy Open Meta)
- Service to TS Hotel Management System Project, Development By Easy Open Meta
EOM.TSHOTEL.INFRASTRUCTURE
-
- 1
- 10
- 0
-
- $(MSBuildProjectDirectory)\.buildnumber
-
- $(MajorVersion).$(MinorVersion).$(PatchVersion)
- $(Version)
-
- MIT
- https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
- https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
-
-
-
-
-
-
- @(BuildNumberLines)
- 0
-
- $([System.Int32]::Parse($(CurrentBuildNumber)))
- $([MSBuild]::Add($(CurrentBuildNumberInt), 1))
- $(NewBuildNumberInt)
-
-
-
-
-
-
-
-
- $(MajorVersion).$(MinorVersion).$(NewBuildNumber)
- $(Version)
-
-
-
-
-
-
+
+
+
diff --git a/EOM.TSHotelManagement.Migration/EntityBuilder.cs b/EOM.TSHotelManagement.Migration/EntityBuilder.cs
index 4dc2ac94f296756bea3ce248a5711a67f9ace19e..842e7d8e500b3e7426b828bec17467e1b3eb277d 100644
--- a/EOM.TSHotelManagement.Migration/EntityBuilder.cs
+++ b/EOM.TSHotelManagement.Migration/EntityBuilder.cs
@@ -6,7 +6,6 @@ namespace EOM.TSHotelManagement.Migration
{
private readonly Type[] entityTypes =
{
- typeof(ApplicationVersion),
typeof(Administrator),
typeof(AdministratorType),
typeof(AppointmentNotice),
diff --git a/EOM.TSHotelManagement.Service/Application/NavBar/NavBarService.cs b/EOM.TSHotelManagement.Service/Application/NavBar/NavBarService.cs
index b206c04d626892a5505b96000a4f416646de624e..fe14d8f58bd2d4cb4fe794044262f51834236866 100644
--- a/EOM.TSHotelManagement.Service/Application/NavBar/NavBarService.cs
+++ b/EOM.TSHotelManagement.Service/Application/NavBar/NavBarService.cs
@@ -120,29 +120,43 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse DeleteNavBar(DeleteNavBarInputDto input)
{
- var navBar = navBarRepository.GetById(input.NavigationBarId);
- if (navBar == null)
+ // 当DelIds为空列表时,表示删除所有导航条目(全局配置)
+ if (input?.DelIds == null || !input.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var navBars = navBarRepository.GetList(a => input.DelIds.Contains(a.Id));
+
+ if (!navBars.Any())
{
return new BaseResponse
{
Code = BusinessStatusCode.NotFound,
- Message = "导航控件未找到"
+ Message = LocalizationHelper.GetLocalizedString("Navigation Control Not Found", "导航控件未找到")
};
}
- navBar.IsDelete = 1;
- var result = navBarRepository.SoftDelete(navBar);
+
+ // 批量软删除
+ var result = navBarRepository.SoftDeleteRange(navBars);
+
if (!result)
{
return new BaseResponse
{
Code = BusinessStatusCode.InternalServerError,
- Message = "删除失败"
+ Message = LocalizationHelper.GetLocalizedString("Delete failure", "删除失败")
};
}
+
return new BaseResponse
{
Code = BusinessStatusCode.Success,
- Message = "删除成功"
+ Message = LocalizationHelper.GetLocalizedString("Delete successful", "删除成功")
};
}
}
diff --git a/EOM.TSHotelManagement.Service/Business/Asset/AssetService.cs b/EOM.TSHotelManagement.Service/Business/Asset/AssetService.cs
index 47c316403a9375fa15dd24a04fcd9c270765c477..3e211031f3aca27f31cce527761be38613f80de8 100644
--- a/EOM.TSHotelManagement.Service/Business/Asset/AssetService.cs
+++ b/EOM.TSHotelManagement.Service/Business/Asset/AssetService.cs
@@ -175,19 +175,47 @@ namespace EOM.TSHotelManagement.Service
{
try
{
- var dbAsset = assetRepository.GetFirst(a => a.AssetNumber == asset.AssetNumber);
- if (dbAsset.IsNullOrEmpty())
+ if (asset?.DelIds == null || !asset.DelIds.Any())
{
- return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("asset number does not exist.", "资产编号不存在"), Code = BusinessStatusCode.InternalServerError };
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
}
- dbAsset.IsDelete = asset.IsDelete;
- assetRepository.SoftDelete(dbAsset);
+
+ var assets = assetRepository.GetList(a => asset.DelIds.Contains(a.Id));
+
+ if (!assets.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Asset Information Not Found", "资产信息未找到")
+ };
+ }
+
+ var result = assetRepository.SoftDeleteRange(assets);
+
+ if (!result)
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.InternalServerError,
+ Message = LocalizationHelper.GetLocalizedString("Delete failure", "删除失败")
+ };
+ }
+
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.Success,
+ Message = LocalizationHelper.GetLocalizedString("Delete successful", "删除成功")
+ };
}
catch (Exception ex)
{
return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
- return new BaseResponse();
}
}
}
diff --git a/EOM.TSHotelManagement.Service/Business/Customer/CustomerService.cs b/EOM.TSHotelManagement.Service/Business/Customer/CustomerService.cs
index f81b67c9563491ddb51b81fe40b8017d54e8275b..66c1ce16e0f1b40d014955c46d327b0887bc8e62 100644
--- a/EOM.TSHotelManagement.Service/Business/Customer/CustomerService.cs
+++ b/EOM.TSHotelManagement.Service/Business/Customer/CustomerService.cs
@@ -26,6 +26,7 @@ using EOM.TSHotelManagement.Contract;
using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
using jvncorelib.EntityLib;
+using Microsoft.Extensions.Logging;
using SqlSugar;
namespace EOM.TSHotelManagement.Service
@@ -70,6 +71,8 @@ namespace EOM.TSHotelManagement.Service
///
private readonly DataProtectionHelper dataProtector;
+ private readonly ILogger logger;
+
///
///
///
@@ -78,7 +81,7 @@ namespace EOM.TSHotelManagement.Service
///
///
///
- public CustomerService(GenericRepository custoRepository, GenericRepository spendRepository, GenericRepository passPortTypeRepository, GenericRepository custoTypeRepository, GenericRepository roleRepository, GenericRepository userRoleRepository, DataProtectionHelper dataProtectionHelper)
+ public CustomerService(GenericRepository custoRepository, GenericRepository spendRepository, GenericRepository passPortTypeRepository, GenericRepository custoTypeRepository, GenericRepository roleRepository, GenericRepository userRoleRepository, DataProtectionHelper dataProtectionHelper, ILogger logger)
{
this.custoRepository = custoRepository;
this.spendRepository = spendRepository;
@@ -87,6 +90,7 @@ namespace EOM.TSHotelManagement.Service
this.roleRepository = roleRepository;
this.userRoleRepository = userRoleRepository;
this.dataProtector = dataProtectionHelper;
+ this.logger = logger;
}
///
@@ -109,7 +113,7 @@ namespace EOM.TSHotelManagement.Service
var result = custoRepository.Insert(customer);
if (!result)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Insert Customer Failed", "客户信息添加失败"), null);
+ logger.LogError(LocalizationHelper.GetLocalizedString("Insert Customer Failed", "客户信息添加失败"));
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Customer Failed", "客户信息添加失败"));
}
@@ -145,7 +149,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Insert Customer Failed", "客户信息添加失败"), ex);
+ logger.LogError(ex, "Error inserting customer information for customer number {CustomerNumber}", custo.CustomerNumber);
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Customer Failed", "客户信息添加失败"));
}
@@ -178,6 +182,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error updating customer information for customer number {CustomerNumber}", custo.CustomerNumber);
return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -190,31 +195,51 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse DelCustomerInfo(DeleteCustomerInputDto custo)
{
- if (!custoRepository.IsAny(a => a.CustomerNumber == custo.CustomerNumber))
- {
- return new BaseResponse() { Message = LocalizationHelper.GetLocalizedString("customer number does not exist.", "客户编号不存在"), Code = BusinessStatusCode.InternalServerError };
- }
- var occupied = Convert.ToInt32(RoomState.Occupied);
- var isOccupied = custoRepository.Change().IsAny(a => a.CustomerNumber == custo.CustomerNumber && a.RoomStateId == occupied);
- var haveUnSettle = custoRepository.Change().IsAny(a => a.CustomerNumber == custo.CustomerNumber && a.SettlementStatus == ConsumptionConstant.UnSettle.Code);
- if (isOccupied)
- return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Customer is currently occupying a room", "客户当前正在占用房间"));
- if (haveUnSettle)
- return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Customer has unsettled bills", "客户有未结算的账单"));
-
- var result = custoRepository.Update(a => new Customer()
+ try
{
- IsDelete = custo.IsDelete,
- DataChgUsr = custo.DataChgUsr,
- DataChgDate = custo.DataChgDate
- }, a => a.CustomerNumber == custo.CustomerNumber);
+ if (custo?.DelIds == null || !custo.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var customers = custoRepository.GetList(a => custo.DelIds.Contains(a.Id));
+
+ if (!customers.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Customer Information Not Found", "客户信息未找到")
+ };
+ }
+
+ var occupied = Convert.ToInt32(RoomState.Occupied);
+ foreach (var customer in customers)
+ {
+ var isOccupied = custoRepository.Change().IsAny(a => a.CustomerNumber == customer.CustomerNumber && a.RoomStateId == occupied);
+ var haveUnSettle = custoRepository.Change().IsAny(a => a.CustomerNumber == customer.CustomerNumber && a.SettlementStatus == ConsumptionConstant.UnSettle.Code);
+
+ if (isOccupied)
+ return new BaseResponse(BusinessStatusCode.InternalServerError,
+ string.Format(LocalizationHelper.GetLocalizedString("Customer {0} is currently occupying a room", "客户{0}当前正在占用房间"), customer.CustomerNumber));
+
+ if (haveUnSettle)
+ return new BaseResponse(BusinessStatusCode.InternalServerError,
+ string.Format(LocalizationHelper.GetLocalizedString("Customer {0} has unsettled bills", "客户{0}有未结算的账单"), customer.CustomerNumber));
+ }
+
+ // 批量软删除
+ custoRepository.SoftDeleteRange(customers);
- if (result)
- {
return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Customer Success", "客户信息删除成功"));
}
- else
+ catch (Exception)
{
+ logger.LogError("Error deleting customer information for customer IDs {CustomerIds}", string.Join(", ", custo.DelIds));
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Customer Failed", "客户信息删除失败"));
}
}
@@ -245,7 +270,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Update Customer Type Failed", "客户类型更新失败"), ex);
+ logger.LogError(ex, "Error updating customer type for customer number {CustomerNumber}", updateCustomerInputDto.CustomerNumber);
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Type Failed", "客户类型更新失败"));
}
}
diff --git a/EOM.TSHotelManagement.Service/Business/EnergyManagement/EnergyManagementService.cs b/EOM.TSHotelManagement.Service/Business/EnergyManagement/EnergyManagementService.cs
index 5962ecc7e8ff52897941495adfdb76737127b90c..a3a7c57a4a227b04a0222501f51dd7bda31d9535 100644
--- a/EOM.TSHotelManagement.Service/Business/EnergyManagement/EnergyManagementService.cs
+++ b/EOM.TSHotelManagement.Service/Business/EnergyManagement/EnergyManagementService.cs
@@ -25,6 +25,7 @@ using EOM.TSHotelManagement.Common;
using EOM.TSHotelManagement.Contract;
using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
+using Microsoft.Extensions.Logging;
namespace EOM.TSHotelManagement.Service
{
@@ -37,14 +38,12 @@ namespace EOM.TSHotelManagement.Service
/// 水电信息
///
private readonly GenericRepository wtiRepository;
+ private readonly ILogger _logger;
- ///
- ///
- ///
- ///
- public EnergyManagementService(GenericRepository wtiRepository)
+ public EnergyManagementService(GenericRepository wtiRepository, ILogger logger)
{
this.wtiRepository = wtiRepository;
+ _logger = logger;
}
///
@@ -100,7 +99,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Insert Energy Management Failed", "水电信息添加失败"), ex);
+ _logger.LogError(ex, LocalizationHelper.GetLocalizedString("Insert Energy Management Failed", "水电信息添加失败"));
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Energy Management Failed", "水电信息添加失败"));
}
@@ -133,7 +132,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Update Energy Management Failed", "水电费信息更新失败"), ex);
+ _logger.LogError(ex, LocalizationHelper.GetLocalizedString("Update Energy Management Failed", "水电费信息更新失败"));
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Energy Management Failed", "水电费信息更新失败"));
}
}
@@ -146,7 +145,27 @@ namespace EOM.TSHotelManagement.Service
{
try
{
- var result = wtiRepository.SoftDelete(EntityMapper.Map(hydroelectricity));
+ if (hydroelectricity?.DelIds == null || !hydroelectricity.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var energyManagements = wtiRepository.GetList(a => hydroelectricity.DelIds.Contains(a.Id));
+
+ if (!energyManagements.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Energy Management Information Not Found", "水电费信息未找到")
+ };
+ }
+
+ var result = wtiRepository.SoftDeleteRange(energyManagements);
if (result)
{
@@ -159,7 +178,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Delete Energy Management Failed", "水电费信息删除失败"), ex);
+ _logger.LogError(ex, LocalizationHelper.GetLocalizedString("Delete Energy Management Failed", "水电费信息删除失败"));
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Energy Management Failed", "水电费信息删除失败"));
}
}
diff --git a/EOM.TSHotelManagement.Service/Business/News/NewsService.cs b/EOM.TSHotelManagement.Service/Business/News/NewsService.cs
index f72219c1fc37534546dfcdbb43b6204beeb17b82..7c3ea52b5522b0182c2ec87483dc896aba155ec2 100644
--- a/EOM.TSHotelManagement.Service/Business/News/NewsService.cs
+++ b/EOM.TSHotelManagement.Service/Business/News/NewsService.cs
@@ -3,16 +3,19 @@ using EOM.TSHotelManagement.Contract;
using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
using jvncorelib.EntityLib;
+using Microsoft.Extensions.Logging;
namespace EOM.TSHotelManagement.Service
{
public class NewsService : INewsService
{
private readonly GenericRepository _newsRepository;
+ private readonly ILogger _logger;
- public NewsService(GenericRepository newsRepository)
+ public NewsService(GenericRepository newsRepository, ILogger logger)
{
_newsRepository = newsRepository;
+ _logger = logger;
}
///
@@ -156,6 +159,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ _logger.LogError(ex, "添加新闻时发生异常");
return new BaseResponse
{
Code = BusinessStatusCode.InternalServerError,
@@ -206,6 +210,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ _logger.LogError(ex, "更新新闻时发生异常");
return new BaseResponse
{
Code = BusinessStatusCode.InternalServerError,
@@ -226,33 +231,48 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse DeleteNews(DeleteNewsInputDto deleteNewsInputDto)
{
- var news = _newsRepository.AsQueryable().Where(a => a.NewId == deleteNewsInputDto.NewId).Single();
- if (news.IsNullOrEmpty())
+ if (deleteNewsInputDto?.DelIds == null || !deleteNewsInputDto.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var news = _newsRepository.GetList(a => deleteNewsInputDto.DelIds.Contains(a.Id));
+
+ if (!news.Any())
{
return new BaseResponse
{
Code = BusinessStatusCode.NotFound,
- Message = "新闻未找到"
+ Message = LocalizationHelper.GetLocalizedString("News Information Not Found", "新闻信息未找到")
};
}
+
try
{
- news.IsDelete = 1;
- _newsRepository.SoftDelete(news);
+ var result = _newsRepository.SoftDeleteRange(news);
+
+ if (result)
+ {
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete News Success", "新闻信息删除成功"));
+ }
+ else
+ {
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete News Failed", "新闻信息删除失败"));
+ }
}
catch (Exception ex)
{
+ _logger.LogError(ex, "删除新闻时发生异常");
return new BaseResponse
{
Code = BusinessStatusCode.InternalServerError,
Message = $"新闻删除失败: {ex.Message}"
};
}
- return new BaseResponse
- {
- Code = BusinessStatusCode.Success,
- Message = "新闻删除成功"
- };
}
}
}
diff --git a/EOM.TSHotelManagement.Service/Business/PromotionContent/PromotionContentService.cs b/EOM.TSHotelManagement.Service/Business/PromotionContent/PromotionContentService.cs
index 95821da542c6983a644ac135a4ae86b3e004c1bf..cf21da3ae244bdb185769e9f02b031f834731ab6 100644
--- a/EOM.TSHotelManagement.Service/Business/PromotionContent/PromotionContentService.cs
+++ b/EOM.TSHotelManagement.Service/Business/PromotionContent/PromotionContentService.cs
@@ -25,6 +25,7 @@ using EOM.TSHotelManagement.Common;
using EOM.TSHotelManagement.Contract;
using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
+using Microsoft.Extensions.Logging;
namespace EOM.TSHotelManagement.Service
{
@@ -37,14 +38,12 @@ namespace EOM.TSHotelManagement.Service
/// 跑马灯
///
private readonly GenericRepository fontsRepository;
+ private readonly ILogger logger;
- ///
- ///
- ///
- ///
- public PromotionContentService(GenericRepository fontsRepository)
+ public PromotionContentService(GenericRepository fontsRepository, ILogger logger)
{
this.fontsRepository = fontsRepository;
+ this.logger = logger;
}
///
@@ -106,16 +105,11 @@ namespace EOM.TSHotelManagement.Service
try
{
var entity = EntityMapper.Map(createPromotionContentInputDto);
- var result = fontsRepository.Insert(entity);
- if (!result)
- {
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Insert Promotion Content Failed", "宣传联动内容添加失败"), null);
- return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Promotion Content Failed", "宣传联动内容添加失败"));
- }
+ fontsRepository.Insert(entity);
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Insert Promotion Content Failed", "宣传联动内容添加失败"), ex);
+ logger.LogError(ex, LocalizationHelper.GetLocalizedString("Insert Promotion Content Failed", "宣传联动内容添加失败"));
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Insert Promotion Content Failed", "宣传联动内容添加失败"));
}
@@ -131,17 +125,42 @@ namespace EOM.TSHotelManagement.Service
{
try
{
- var font = fontsRepository.GetFirst(a => a.PromotionContentNumber == deletePromotionContentInputDto.PromotionContentNumber && a.IsDelete != 1);
- font.IsDelete = deletePromotionContentInputDto.IsDelete;
- fontsRepository.SoftDelete(font);
+ if (deletePromotionContentInputDto?.DelIds == null || !deletePromotionContentInputDto.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var promotionContents = fontsRepository.GetList(a => deletePromotionContentInputDto.DelIds.Contains(a.Id));
+
+ if (!promotionContents.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Promotion Content Not Found", "宣传联动内容未找到")
+ };
+ }
+
+ var result = fontsRepository.SoftDeleteRange(promotionContents);
+
+ if (result)
+ {
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Promotion Content Success", "宣传联动内容删除成功"));
+ }
+ else
+ {
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Promotion Content Failed", "宣传联动内容删除失败"));
+ }
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Delete Promotion Content Failed", "宣传联动内容删除失败"), ex);
+ logger.LogError(ex, LocalizationHelper.GetLocalizedString("Delete Promotion Content Failed", "宣传联动内容删除失败"));
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Promotion Content Failed", "宣传联动内容删除失败"));
}
-
- return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Promotion Content Success", "宣传联动内容删除成功"));
}
///
@@ -154,16 +173,11 @@ namespace EOM.TSHotelManagement.Service
try
{
var entity = EntityMapper.Map(updatePromotionContentInputDto);
- var result = fontsRepository.Update(entity);
- if (!result)
- {
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Update Promotion Content Failed", "宣传联动内容更新失败"), null);
- return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Promotion Content Failed", "宣传联动内容更新失败"));
- }
+ fontsRepository.Update(entity);
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Update Promotion Content Failed", "宣传联动内容更新失败"), ex);
+ logger.LogError(ex, LocalizationHelper.GetLocalizedString("Update Promotion Content Failed", "宣传联动内容更新失败"));
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Promotion Content Failed", "宣传联动内容更新失败"));
}
diff --git a/EOM.TSHotelManagement.Service/Business/Reser/ReserService.cs b/EOM.TSHotelManagement.Service/Business/Reser/ReserService.cs
index 4253ebbd0d2d3dc34c6ad54562627a0184f24c70..aa8575d1c4f0b16aa48615d4c9b4defb5a5a9c36 100644
--- a/EOM.TSHotelManagement.Service/Business/Reser/ReserService.cs
+++ b/EOM.TSHotelManagement.Service/Business/Reser/ReserService.cs
@@ -25,6 +25,7 @@ using EOM.TSHotelManagement.Common;
using EOM.TSHotelManagement.Contract;
using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
+using Microsoft.Extensions.Logging;
using SqlSugar;
using System.Transactions;
@@ -50,17 +51,14 @@ namespace EOM.TSHotelManagement.Service
///
private readonly DataProtectionHelper dataProtector;
- ///
- ///
- ///
- ///
- ///
- ///
- public ReserService(GenericRepository reserRepository, GenericRepository roomRepository, DataProtectionHelper dataProtectionProvider)
+ private readonly ILogger logger;
+
+ public ReserService(GenericRepository reserRepository, GenericRepository roomRepository, DataProtectionHelper dataProtector, ILogger logger)
{
this.reserRepository = reserRepository;
this.roomRepository = roomRepository;
- this.dataProtector = dataProtectionProvider;
+ this.dataProtector = dataProtector;
+ this.logger = logger;
}
///
@@ -158,30 +156,62 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse DeleteReserInfo(DeleteReserInputDto reser)
{
- var reserInfo = reserRepository.GetFirst(a => a.ReservationId == reser.ReservationId);
- using (TransactionScope scope = new TransactionScope())
+ if (reser?.DelIds == null || !reser.DelIds.Any())
{
- reserInfo.IsDelete = reser.IsDelete;
- var result = reserRepository.SoftDelete(reserInfo);
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var resers = reserRepository.GetList(a => reser.DelIds.Contains(a.Id));
- if (result)
+ if (!resers.Any())
+ {
+ return new BaseResponse
{
- var roomInfo = roomRepository.GetFirst(a => a.RoomNumber == reserInfo.ReservationRoomNumber);
- roomInfo.RoomStateId = (int)RoomState.Vacant;
- roomRepository.Update(roomInfo);
- scope.Complete();
- return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Reser Success", "预约信息删除成功"));
- }
- else
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Reservation Information Not Found", "预约信息未找到")
+ };
+ }
+
+ try
+ {
+ using (TransactionScope scope = new TransactionScope())
{
- return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Reser Failed", "预约信息删除失败"));
+ var roomNumbers = resers.Select(a => a.ReservationRoomNumber).ToList();
+
+ var result = reserRepository.SoftDeleteRange(resers);
+
+ if (result)
+ {
+ var rooms = roomRepository.AsQueryable().Where(a => roomNumbers.Contains(a.RoomNumber)).ToList();
+ rooms = rooms.Select(a =>
+ {
+ a.RoomStateId = (int)RoomState.Vacant;
+ return a;
+ }).ToList();
+ roomRepository.UpdateRange(rooms);
+ scope.Complete();
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Reser Success", "预约信息删除成功"));
+ }
+ else
+ {
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Reser Failed", "预约信息删除失败"));
+ }
}
}
+ catch (Exception ex)
+ {
+ logger.LogError(ex, LocalizationHelper.GetLocalizedString("Delete Reser Failed", "预约信息删除失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Reser Failed", "预约信息删除失败"));
+ }
}
///
- /// 更新预约信息
+ /// 更新预约信息(支持恢复功能)
///
///
///
@@ -189,23 +219,85 @@ namespace EOM.TSHotelManagement.Service
{
string NewTel = dataProtector.EncryptReserData(reser.ReservationPhoneNumber);
reser.ReservationPhoneNumber = NewTel;
+
try
{
- var entity = EntityMapper.Map(reser);
- var result = reserRepository.Update(entity);
- if (result)
+ using (TransactionScope scope = new TransactionScope())
{
- return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Update Customer Success", "预约信息更新成功"));
- }
- else
- {
- return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Failed", "预约信息更新失败"));
+ // 获取原预约(包括软删除的记录)
+ var originalReser = reserRepository.GetFirst(a => a.Id == reser.Id);
+
+ if (originalReser == null)
+ {
+ return new BaseResponse(BusinessStatusCode.NotFound,
+ LocalizationHelper.GetLocalizedString("Reservation not found", "预约信息不存在"));
+ }
+
+ bool isRestoring = originalReser.IsDelete == 1 && reser.IsDelete == 0;
+
+ // 如果是恢复操作
+ if (isRestoring)
+ {
+ // 检查原房间的当前状态
+ var room = roomRepository.GetFirst(a => a.RoomNumber == originalReser.ReservationRoomNumber);
+
+ if (room == null)
+ {
+ return new BaseResponse(BusinessStatusCode.Conflict,
+ LocalizationHelper.GetLocalizedString("Room does not exist, cannot restore reservation",
+ "关联的房间不存在,无法恢复预约"));
+ }
+
+ // 检查房间是否可用
+ if (room.RoomStateId != (int)RoomState.Vacant)
+ {
+ return new BaseResponse(BusinessStatusCode.Conflict,
+ string.Format(LocalizationHelper.GetLocalizedString(
+ "Room {0} is currently occupied, cannot restore reservation",
+ "房间{0}当前已被占用,无法恢复预约"),
+ room.RoomNumber));
+ }
+
+ // 检查时间段冲突(如果有时间字段)
+ var conflictingReservation = reserRepository.GetFirst(r =>
+ r.Id != originalReser.Id &&
+ r.IsDelete == 0 &&
+ r.ReservationRoomNumber == originalReser.ReservationRoomNumber &&
+ r.ReservationStartDate < originalReser.ReservationEndDate &&
+ r.ReservationEndDate > originalReser.ReservationStartDate);
+
+ if (conflictingReservation != null)
+ {
+ return new BaseResponse(BusinessStatusCode.Conflict,
+ LocalizationHelper.GetLocalizedString(
+ "Room is already reserved during this period, cannot restore reservation",
+ "该时间段内房间已被预订,无法恢复预约"));
+ }
+
+ // 恢复预约并更新房间状态
+ var entity = EntityMapper.Map(reser);
+ reserRepository.Update(entity);
+
+ room.RoomStateId = (int)RoomState.Reserved;
+ roomRepository.Update(room);
+ }
+ else
+ {
+ // 普通更新逻辑
+ var entity = EntityMapper.Map(reser);
+ reserRepository.Update(entity);
+ }
+
+ scope.Complete();
+ return new BaseResponse(BusinessStatusCode.Success,
+ LocalizationHelper.GetLocalizedString("Update Reservation Success", "预约信息更新成功"));
}
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Update Customer Failed", "预约信息添加失败"), ex);
- return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Update Customer Failed", "预约信息更新失败"));
+ logger.LogError(ex, LocalizationHelper.GetLocalizedString("Update Customer Failed", "预约信息更新失败"));
+ return new BaseResponse(BusinessStatusCode.InternalServerError,
+ LocalizationHelper.GetLocalizedString("Update Customer Failed", "预约信息更新失败"));
}
}
@@ -221,27 +313,21 @@ namespace EOM.TSHotelManagement.Service
try
{
var entity = EntityMapper.Map(r);
- var result = reserRepository.Insert(entity);
- if (result)
- {
- var room = roomRepository.GetFirst(a => a.RoomNumber == r.ReservationRoomNumber);
- room.RoomStateId = new EnumHelper().GetEnumValue(RoomState.Reserved);
- var updateResult = roomRepository.Update(room);
+ reserRepository.Insert(entity);
- if (!updateResult)
- {
- return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"));
- }
- return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Add Customer Success", "预约信息添加成功"));
- }
- else
+ var room = roomRepository.GetFirst(a => a.RoomNumber == r.ReservationRoomNumber);
+ room.RoomStateId = new EnumHelper().GetEnumValue(RoomState.Reserved);
+ var updateResult = roomRepository.Update(room);
+
+ if (!updateResult)
{
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"));
}
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Add Customer Success", "预约信息添加成功"));
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"), ex);
+ logger.LogError(ex, LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"));
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Add Customer Failed", "预约信息添加失败"));
}
}
diff --git a/EOM.TSHotelManagement.Service/Business/Room/RoomService.cs b/EOM.TSHotelManagement.Service/Business/Room/RoomService.cs
index eb250925bfdb26b810334bebf73b64668502eb28..2e0ab016525a2c526aab7fd6422269d48111359b 100644
--- a/EOM.TSHotelManagement.Service/Business/Room/RoomService.cs
+++ b/EOM.TSHotelManagement.Service/Business/Room/RoomService.cs
@@ -27,6 +27,7 @@ using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
using jvncorelib.CodeLib;
using jvncorelib.EntityLib;
+using Microsoft.Extensions.Logging;
using SqlSugar;
using System.Transactions;
@@ -82,19 +83,9 @@ namespace EOM.TSHotelManagement.Service
///
private readonly UniqueCode uniqueCode;
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public RoomService(GenericRepository roomRepository, GenericRepository spendRepository, GenericRepository roomTypeRepository, GenericRepository energyRepository, GenericRepository custoRepository, GenericRepository custoTypeRepository, GenericRepository vipLevelRuleRepository, GenericRepository reserRepository, UniqueCode uniqueCode)
+ private readonly ILogger logger;
+
+ public RoomService(GenericRepository roomRepository, GenericRepository spendRepository, GenericRepository roomTypeRepository, GenericRepository energyRepository, GenericRepository custoRepository, GenericRepository custoTypeRepository, GenericRepository vipLevelRuleRepository, GenericRepository reserRepository, UniqueCode uniqueCode, ILogger logger)
{
this.roomRepository = roomRepository;
this.spendRepository = spendRepository;
@@ -105,6 +96,7 @@ namespace EOM.TSHotelManagement.Service
this.vipLevelRuleRepository = vipLevelRuleRepository;
this.reserRepository = reserRepository;
this.uniqueCode = uniqueCode;
+ this.logger = logger;
}
///
@@ -354,6 +346,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error updating room info for room number {RoomNumber}", r.RoomNumber);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -376,6 +369,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error updating room info with reservation for room number {RoomNumber}", r.RoomNumber);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -546,14 +540,11 @@ namespace EOM.TSHotelManagement.Service
var entity = EntityMapper.Map(rn);
entity.LastCheckInTime = DateOnly.MinValue;
entity.LastCheckOutTime = DateOnly.MinValue;
- var result = roomRepository.Insert(entity);
- if (!result)
- {
- return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Failed to add room.", "添加房间失败。"), Code = BusinessStatusCode.InternalServerError };
- }
+ roomRepository.Insert(entity);
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error inserting room with room number {RoomNumber}", rn.RoomNumber);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
@@ -574,15 +565,12 @@ namespace EOM.TSHotelManagement.Service
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("This room does not exist.", "房间不存在。"), Code = BusinessStatusCode.InternalServerError };
var entity = EntityMapper.Map(rn);
- var result = roomRepository.Update(entity);
- if (!result)
- {
- return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Failed to update room.", "更新房间失败。"), Code = BusinessStatusCode.InternalServerError };
- }
+ roomRepository.Update(entity);
}
catch (Exception ex)
{
- return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
+ logger.LogError(ex, "Error updating room with room number {RoomNumber}", rn.RoomNumber);
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Failed to update room.", "更新房间失败。"), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -597,17 +585,34 @@ namespace EOM.TSHotelManagement.Service
{
try
{
- var isExist = roomRepository.IsAny(a => a.RoomNumber == rn.RoomNumber);
- if (!isExist)
- return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("This room does not exist.", "房间不存在。"), Code = BusinessStatusCode.InternalServerError };
- roomRepository.Update(EntityMapper.Map(rn));
+ if (rn?.DelIds == null || !rn.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var rooms = roomRepository.GetList(a => rn.DelIds.Contains(a.Id));
+
+ if (!rooms.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Room Information Not Found", "房间信息未找到")
+ };
+ }
+
+ var result = roomRepository.SoftDeleteRange(rooms);
+
+ return new BaseResponse(BusinessStatusCode.Success, LocalizationHelper.GetLocalizedString("Delete Room Success", "房间信息删除成功"));
}
catch (Exception ex)
{
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
-
- return new BaseResponse();
}
///
@@ -725,6 +730,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error transferring room from {OriginalRoomNumber} to {TargetRoomNumber} for customer {CustomerNumber}", transferRoomDto.OriginalRoomNumber, transferRoomDto.TargetRoomNumber, transferRoomDto.CustomerNumber);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -788,6 +794,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error checking out room number {RoomNumber} for customer {CustomerNumber}", checkoutRoomDto.RoomNumber, checkoutRoomDto.CustomerNumber);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -850,6 +857,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error checking in room number {RoomNumber} by reservation ID {ReservationId}", checkinRoomByReservationDto.RoomNumber, checkinRoomByReservationDto.ReservationId);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
diff --git a/EOM.TSHotelManagement.Service/Business/Room/RoomTypeService.cs b/EOM.TSHotelManagement.Service/Business/Room/RoomTypeService.cs
index 2911e5a0772fb42abf48c4eee9d03c3404829d81..b288eb4eb31a400e7632827804c3f6df701d95d5 100644
--- a/EOM.TSHotelManagement.Service/Business/Room/RoomTypeService.cs
+++ b/EOM.TSHotelManagement.Service/Business/Room/RoomTypeService.cs
@@ -25,6 +25,7 @@ using EOM.TSHotelManagement.Common;
using EOM.TSHotelManagement.Contract;
using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
+using Microsoft.Extensions.Logging;
namespace EOM.TSHotelManagement.Service
{
@@ -42,16 +43,13 @@ namespace EOM.TSHotelManagement.Service
/// 客房信息
///
private readonly GenericRepository roomRepository;
+ private readonly ILogger logger;
- ///
- ///
- ///
- ///
- ///
- public RoomTypeService(GenericRepository roomTypeRepository, GenericRepository roomRepository)
+ public RoomTypeService(GenericRepository roomTypeRepository, GenericRepository roomRepository, ILogger logger)
{
this.roomTypeRepository = roomTypeRepository;
this.roomRepository = roomRepository;
+ this.logger = logger;
}
#region 获取所有房间类型
@@ -130,6 +128,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error inserting room type");
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -158,6 +157,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error updating room type");
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -172,12 +172,32 @@ namespace EOM.TSHotelManagement.Service
{
try
{
- var existRoomType = roomTypeRepository.GetFirst(a => a.RoomTypeId == roomType.RoomTypeId && a.IsDelete != 1);
- existRoomType.IsDelete = roomType.IsDelete;
- roomTypeRepository.SoftDelete(existRoomType);
+ if (roomType?.DelIds == null || !roomType.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var roomTypes = roomTypeRepository.GetList(a => roomType.DelIds.Contains(a.Id));
+
+ if (!roomTypes.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Room Type Information Not Found", "房间类型信息未找到")
+ };
+ }
+
+ var result = roomTypeRepository.SoftDeleteRange(roomTypes);
+
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error deleting room type");
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
diff --git a/EOM.TSHotelManagement.Service/Business/Sellthing/ISellService.cs b/EOM.TSHotelManagement.Service/Business/Sellthing/ISellService.cs
index 35d1f783814f0785f81d857f048258679ffad85e..7922687acaef645771d1bff49f0043470afe2193 100644
--- a/EOM.TSHotelManagement.Service/Business/Sellthing/ISellService.cs
+++ b/EOM.TSHotelManagement.Service/Business/Sellthing/ISellService.cs
@@ -36,13 +36,6 @@ namespace EOM.TSHotelManagement.Service
///
ListOutputDto SelectSellThingAll(ReadSellThingInputDto sellThing);
- ///
- /// 修改商品
- ///
- ///
- ///
- BaseResponse UpdateSellThing(UpdateSellThingInputDto updateSellThingInputDto);
-
///
/// 修改商品信息
///
diff --git a/EOM.TSHotelManagement.Service/Business/Sellthing/SellService.cs b/EOM.TSHotelManagement.Service/Business/Sellthing/SellService.cs
index f8c00bb3150debb8288dccd5b41af825b5f6d7ce..371617d8054f05099b89a5916e343302b8fae879 100644
--- a/EOM.TSHotelManagement.Service/Business/Sellthing/SellService.cs
+++ b/EOM.TSHotelManagement.Service/Business/Sellthing/SellService.cs
@@ -26,6 +26,7 @@ using EOM.TSHotelManagement.Contract;
using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
using jvncorelib.EntityLib;
+using Microsoft.Extensions.Logging;
using SqlSugar;
namespace EOM.TSHotelManagement.Service
@@ -44,16 +45,13 @@ namespace EOM.TSHotelManagement.Service
/// 消费情况
///
private readonly GenericRepository spendRepository;
+ private readonly ILogger logger;
- ///
- ///
- ///
- ///
- ///
- public SellService(GenericRepository sellThingRepository, GenericRepository spendRepository)
+ public SellService(GenericRepository sellThingRepository, GenericRepository spendRepository, ILogger logger)
{
this.sellThingRepository = sellThingRepository;
this.spendRepository = spendRepository;
+ this.logger = logger;
}
///
@@ -114,29 +112,6 @@ namespace EOM.TSHotelManagement.Service
};
}
- ///
- /// 更新商品数量
- ///
- ///
- ///
- public BaseResponse UpdateSellThing(UpdateSellThingInputDto updateSellThingInputDto)
- {
- try
- {
- var product = sellThingRepository.GetFirst(a => a.ProductNumber == updateSellThingInputDto.ProductNumber);
- product.Stock = updateSellThingInputDto.Stock;
- product.Specification = updateSellThingInputDto.Specification;
- product.ProductPrice = updateSellThingInputDto.ProductPrice;
- product.ProductName = updateSellThingInputDto.ProductName;
- sellThingRepository.Update(product);
- }
- catch (Exception ex)
- {
- return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
- }
- return new BaseResponse();
- }
-
///
/// 修改商品信息
///
@@ -146,15 +121,17 @@ namespace EOM.TSHotelManagement.Service
{
try
{
- var product = sellThingRepository.GetFirst(a => a.ProductNumber == sellThing.ProductNumber);
- product.ProductName = product.ProductName;
- product.ProductPrice = product.ProductPrice;
+ var product = sellThingRepository.GetFirst(a => a.Id == sellThing.Id);
+ product.ProductName = sellThing.ProductName;
+ product.ProductPrice = sellThing.ProductPrice;
product.Stock = sellThing.Stock;
product.Specification = sellThing.Specification;
+ product.IsDelete = sellThing.IsDelete;
sellThingRepository.Update(product);
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error updating sell thing: {Message}", ex.Message);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -169,12 +146,32 @@ namespace EOM.TSHotelManagement.Service
{
try
{
- var product = sellThingRepository.GetFirst(a => a.ProductNumber == deleteSellThingInputDto.ProductNumber);
- product.IsDelete = deleteSellThingInputDto.IsDelete;
- sellThingRepository.SoftDelete(product);
+ if (deleteSellThingInputDto?.DelIds == null || !deleteSellThingInputDto.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var sellThings = sellThingRepository.GetList(a => deleteSellThingInputDto.DelIds.Contains(a.Id));
+
+ if (!sellThings.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Goods Information Not Found", "商品信息未找到")
+ };
+ }
+
+ var result = sellThingRepository.SoftDeleteRange(sellThings);
+
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error deleting sell thing: {Message}", ex.Message);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -196,7 +193,6 @@ namespace EOM.TSHotelManagement.Service
return new SingleOutputDto() { Data = source };
}
- #region 添加商品
///
/// 添加商品
///
@@ -207,18 +203,14 @@ namespace EOM.TSHotelManagement.Service
try
{
var entity = EntityMapper.Map(st);
- var result = sellThingRepository.Insert(entity);
- if (!result)
- {
- return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("insert sellthing failed.", "商品添加失败"), Code = BusinessStatusCode.InternalServerError };
- }
+ sellThingRepository.Insert(entity);
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error inserting sell thing: {Message}", ex.Message);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
}
- #endregion
}
}
diff --git a/EOM.TSHotelManagement.Service/Business/Spend/SpendService.cs b/EOM.TSHotelManagement.Service/Business/Spend/SpendService.cs
index ec10fb4e02dcce5d9fcbb7b341550018991a3a7a..0971c750ff47f08ccecd44cc8c715aa68f747af8 100644
--- a/EOM.TSHotelManagement.Service/Business/Spend/SpendService.cs
+++ b/EOM.TSHotelManagement.Service/Business/Spend/SpendService.cs
@@ -28,6 +28,7 @@ using EOM.TSHotelManagement.Domain;
using jvncorelib.CodeLib;
using jvncorelib.EntityLib;
using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
using SqlSugar;
using System.Transactions;
@@ -74,7 +75,9 @@ namespace EOM.TSHotelManagement.Service
private readonly IHttpContextAccessor _httpContextAccessor;
- public SpendService(GenericRepository spendRepository, GenericRepository sellThingRepository, GenericRepository roomRepository, GenericRepository customerRepository, GenericRepository custoTypeRepository, GenericRepository operationLogRepository, IHttpContextAccessor httpContextAccessor)
+ private readonly ILogger logger;
+
+ public SpendService(GenericRepository spendRepository, GenericRepository sellThingRepository, GenericRepository roomRepository, GenericRepository customerRepository, GenericRepository custoTypeRepository, GenericRepository operationLogRepository, IHttpContextAccessor httpContextAccessor, ILogger logger)
{
this.spendRepository = spendRepository;
this.sellThingRepository = sellThingRepository;
@@ -83,6 +86,7 @@ namespace EOM.TSHotelManagement.Service
this.custoTypeRepository = custoTypeRepository;
this.operationLogRepository = operationLogRepository;
_httpContextAccessor = httpContextAccessor;
+ this.logger = logger;
}
#region 根据客户编号查询历史消费信息
@@ -257,6 +261,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "撤回客户消费信息失败");
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -362,17 +367,13 @@ namespace EOM.TSHotelManagement.Service
LogContent = logContent,
LoginIpAddress = context.Connection.RemoteIpAddress?.ToString() ?? string.Empty,
OperationAccount = addCustomerSpendInputDto.WorkerNo,
- LogLevel = (int)LogLevel.Warning,
+ LogLevel = (int)Common.LogLevel.Warning,
SoftwareVersion = addCustomerSpendInputDto.SoftwareVersion,
IsDelete = 0,
DataInsUsr = addCustomerSpendInputDto.WorkerNo,
DataInsDate = Convert.ToDateTime(DateTime.Now)
};
- var logResult = operationLogRepository.Insert(log);
- if (!logResult)
- {
- return new BaseResponse() { Message = "操作日志添加失败", Code = BusinessStatusCode.InternalServerError };
- }
+ operationLogRepository.Insert(log);
scope.Complete();
@@ -380,6 +381,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "添加客户消费信息失败");
return new BaseResponse() { Message = $"添加消费记录失败,请稍后重试。{ex.Message}", Code = BusinessStatusCode.InternalServerError };
}
}
@@ -404,6 +406,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "更新消费信息失败");
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
diff --git a/EOM.TSHotelManagement.Service/EOM.TSHotelManagement.Service.csproj b/EOM.TSHotelManagement.Service/EOM.TSHotelManagement.Service.csproj
index 0bb129a7da7f69c0b0d2ae54bd66daeec657fe49..be64ba7f1203062da366e1a9b60b73ac61d5f349 100644
--- a/EOM.TSHotelManagement.Service/EOM.TSHotelManagement.Service.csproj
+++ b/EOM.TSHotelManagement.Service/EOM.TSHotelManagement.Service.csproj
@@ -8,67 +8,24 @@
x64
True
EOM.TSHotelManagement.Service
- 易开元(Easy Open Meta)
- Service to TS Hotel Management System Project, Development By Easy Open Meta
EOM.TSHOTEL.SERVICE
-
- 1
- 10
- 0
-
- $(MSBuildProjectDirectory)\.buildnumber
-
- $(MajorVersion).$(MinorVersion).$(PatchVersion)
- $(Version)
-
- MIT
- https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
- https://gitee.com/java-and-net/topsky-hotel-management-system-web-api
-
-
-
-
-
-
- @(BuildNumberLines)
- 0
-
- $([System.Int32]::Parse($(CurrentBuildNumber)))
- $([MSBuild]::Add($(CurrentBuildNumberInt), 1))
- $(NewBuildNumberInt)
-
-
-
-
-
-
-
-
- $(MajorVersion).$(MinorVersion).$(NewBuildNumber)
- $(Version)
-
-
-
- 1701;1702;8618;
-
+ 1701;1702;8618;
+
-
- 1701;1702;8618;
-
+
+ 1701;1702;8618;
+
-
-
-
-
-
+
+
+
+
+
-
+
diff --git a/EOM.TSHotelManagement.Service/Employee/EmployeeService.cs b/EOM.TSHotelManagement.Service/Employee/EmployeeService.cs
index 3794b8034375ea23e5aeabea9d7ebf8fd5aaaea2..73ed12a1cbf6b509c8029663367acb3fcbb0cc6f 100644
--- a/EOM.TSHotelManagement.Service/Employee/EmployeeService.cs
+++ b/EOM.TSHotelManagement.Service/Employee/EmployeeService.cs
@@ -26,6 +26,7 @@ using EOM.TSHotelManagement.Contract;
using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
using jvncorelib.EntityLib;
+using Microsoft.Extensions.Logging;
using SqlSugar;
using System.Security.Claims;
@@ -46,7 +47,8 @@ namespace EOM.TSHotelManagement.Service
///
///
///
- public class EmployeeService(GenericRepository workerRepository, GenericRepository photoRepository, GenericRepository educationRepository, GenericRepository nationRepository, GenericRepository deptRepository, GenericRepository positionRepository, GenericRepository passportTypeRepository, JWTHelper jWTHelper, MailHelper mailHelper, DataProtectionHelper dataProtectionHelper) : IEmployeeService
+ ///
+ public class EmployeeService(GenericRepository workerRepository, GenericRepository photoRepository, GenericRepository educationRepository, GenericRepository nationRepository, GenericRepository deptRepository, GenericRepository positionRepository, GenericRepository passportTypeRepository, JWTHelper jWTHelper, MailHelper mailHelper, DataProtectionHelper dataProtectionHelper, ILogger logger) : IEmployeeService
{
///
/// 员工信息
@@ -98,6 +100,8 @@ namespace EOM.TSHotelManagement.Service
///
private readonly MailHelper mailHelper = mailHelper;
+ private readonly ILogger logger = logger;
+
///
/// 修改员工信息
///
@@ -129,6 +133,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error updating employee information for EmployeeId: {EmployeeId}", updateEmployeeInputDto.EmployeeId);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -151,6 +156,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error managing employee account for EmployeeId: {EmployeeId}", updateEmployeeInputDto.EmployeeId);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -198,6 +204,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error adding employee: {Message}", ex.Message);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -470,6 +477,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error updating employee password for EmployeeId: {EmployeeId}", updateEmployeeInputDto.EmployeeId);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
@@ -518,6 +526,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error resetting employee password for EmployeeId: {EmployeeId}", updateEmployeeInputDto.EmployeeId);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
diff --git a/EOM.TSHotelManagement.Service/Employee/Photo/EmployeePhotoService.cs b/EOM.TSHotelManagement.Service/Employee/Photo/EmployeePhotoService.cs
index 4edd6b4496b6cd78d8eec5c62166d3c8ec3db5d5..6eb1df1058e131763b371f3bda4e0eb5ccbfefa0 100644
--- a/EOM.TSHotelManagement.Service/Employee/Photo/EmployeePhotoService.cs
+++ b/EOM.TSHotelManagement.Service/Employee/Photo/EmployeePhotoService.cs
@@ -4,6 +4,7 @@ using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
using jvncorelib.EntityLib;
using Microsoft.AspNetCore.Http;
+using Microsoft.Extensions.Logging;
namespace EOM.TSHotelManagement.Service
{
@@ -22,15 +23,13 @@ namespace EOM.TSHotelManagement.Service
///
private readonly LskyHelper lskyHelper;
- ///
- ///
- ///
- ///
- ///
- public EmployeePhotoService(GenericRepository workerPicRepository, LskyHelper lskyHelper)
+ private readonly ILogger logger;
+
+ public EmployeePhotoService(GenericRepository workerPicRepository, LskyHelper lskyHelper, ILogger logger)
{
this.workerPicRepository = workerPicRepository;
this.lskyHelper = lskyHelper;
+ this.logger = logger;
}
///
@@ -146,6 +145,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error inserting employee photo: {Message}", ex.Message);
return new SingleOutputDto { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
}
@@ -183,6 +183,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "Error updating employee photo: {Message}", ex.Message);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
diff --git a/EOM.TSHotelManagement.Service/SystemManagement/Administrator/AdminService.cs b/EOM.TSHotelManagement.Service/SystemManagement/Administrator/AdminService.cs
index a87ae271ce939852af5eb1200ee276ce01359fb8..0a4ba1f2f568aa63a836ed8dc55eabbe72c7f276 100644
--- a/EOM.TSHotelManagement.Service/SystemManagement/Administrator/AdminService.cs
+++ b/EOM.TSHotelManagement.Service/SystemManagement/Administrator/AdminService.cs
@@ -27,6 +27,7 @@ using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
using jvncorelib.EncryptorLib;
using jvncorelib.EntityLib;
+using Microsoft.Extensions.Logging;
using SqlSugar;
using System.Security.Claims;
@@ -82,24 +83,9 @@ namespace EOM.TSHotelManagement.Service
///
private readonly JWTHelper jWTHelper;
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public AdminService(
- GenericRepository adminRepository,
- GenericRepository adminTypeRepository,
- GenericRepository userRoleRepository,
- GenericRepository rolePermissionRepository,
- GenericRepository permissionRepository,
- GenericRepository roleRepository,
- DataProtectionHelper dataProtectionProvider,
- EncryptLib encrypt,
- JWTHelper jWTHelper)
+ private readonly ILogger logger;
+
+ public AdminService(GenericRepository adminRepository, GenericRepository adminTypeRepository, GenericRepository userRoleRepository, GenericRepository rolePermissionRepository, GenericRepository permissionRepository, GenericRepository roleRepository, DataProtectionHelper dataProtector, EncryptLib encrypt, JWTHelper jWTHelper, ILogger logger)
{
this.adminRepository = adminRepository;
this.adminTypeRepository = adminTypeRepository;
@@ -107,9 +93,10 @@ namespace EOM.TSHotelManagement.Service
this.rolePermissionRepository = rolePermissionRepository;
this.permissionRepository = permissionRepository;
this.roleRepository = roleRepository;
- this.dataProtector = dataProtectionProvider;
+ this.dataProtector = dataProtector;
this.encrypt = encrypt;
this.jWTHelper = jWTHelper;
+ this.logger = logger;
}
///
@@ -244,14 +231,11 @@ namespace EOM.TSHotelManagement.Service
createAdministratorInputDto.Password = dataProtector.EncryptAdministratorData(createAdministratorInputDto.Password);
var admin = EntityMapper.Map(createAdministratorInputDto);
- var result = adminRepository.Insert(admin);
- if (!result)
- {
- return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Add Administrator Failed", "添加管理员失败"), Code = BusinessStatusCode.InternalServerError };
- }
+ adminRepository.Insert(admin);
}
catch (Exception ex)
{
+ logger.LogError(ex, "AddAdmin failed for Account: {Account}", createAdministratorInputDto?.Account);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -276,6 +260,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "UpdAdmin failed for Id: {Id}", updateAdministratorInputDto?.Id);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -290,15 +275,43 @@ namespace EOM.TSHotelManagement.Service
{
try
{
- var isSuperAdmin = adminRepository.IsAny(a => a.Number == deleteAdministratorInputDto.Number && a.IsSuperAdmin == 1);
- if (isSuperAdmin)
+ if (deleteAdministratorInputDto?.DelIds == null || !deleteAdministratorInputDto.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var administrators = adminRepository.GetList(a => deleteAdministratorInputDto.DelIds.Contains(a.Id));
+
+ if (!administrators.Any())
{
- return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Super Administrator cannot be deleted", "超级管理员无法删除"), Code = BusinessStatusCode.InternalServerError };
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Administrator Not Found", "管理员未找到")
+ };
}
- adminRepository.SoftDelete(EntityMapper.Map(deleteAdministratorInputDto));
+
+ // cannot be delete if is super admin
+ var admin = administrators.Any(a => a.IsSuperAdmin == 1);
+ if (admin)
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.InternalServerError,
+ Message = LocalizationHelper.GetLocalizedString("Cannot delete super administrator", "无法删除超级管理员")
+ };
+ }
+
+ var result = adminRepository.SoftDeleteRange(administrators);
+
}
catch (Exception ex)
{
+ logger.LogError(ex, "DelAdmin failed for Ids: {DelIds}", deleteAdministratorInputDto?.DelIds);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -350,6 +363,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "AddAdminType failed for TypeId: {TypeId}", createAdministratorTypeInputDto?.TypeId);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -368,6 +382,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "UpdAdminType failed for Id: {Id}", updateAdministratorTypeInputDto?.Id);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -382,12 +397,38 @@ namespace EOM.TSHotelManagement.Service
{
try
{
- var adminType = adminTypeRepository.GetFirst(a => a.TypeId == deleteAdministratorTypeInputDto.TypeId);
- adminType.IsDelete = deleteAdministratorTypeInputDto.IsDelete;
- adminTypeRepository.SoftDelete(adminType);
+ if (deleteAdministratorTypeInputDto?.DelIds == null || !deleteAdministratorTypeInputDto.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var administratorTypes = adminTypeRepository.GetList(a => deleteAdministratorTypeInputDto.DelIds.Contains(a.Id));
+
+ if (!administratorTypes.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Administrator Type Not Found", "管理员类型未找到")
+ };
+ }
+
+ administratorTypes = administratorTypes.Select(a =>
+ {
+ a.IsDelete = 1;
+ return a;
+ }).ToList();
+
+ // 批量软删除
+ adminTypeRepository.SoftDeleteRange(administratorTypes);
}
catch (Exception ex)
{
+ logger.LogError(ex, "DelAdminType failed for Ids: {DelIds}", deleteAdministratorTypeInputDto?.DelIds);
return new BaseResponse { Message = LocalizationHelper.GetLocalizedString(ex.Message, ex.Message), Code = BusinessStatusCode.InternalServerError };
}
return new BaseResponse();
@@ -448,6 +489,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "AssignUserRoles failed for UserNumber: {UserNumber}", input?.UserNumber);
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString($"Assign roles failed: {ex.Message}", $"分配角色失败:{ex.Message}"));
}
}
@@ -601,6 +643,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "ReadUserRolePermissions failed for UserNumber: {UserNumber}", userNumber);
return new ListOutputDto
{
Code = BusinessStatusCode.InternalServerError,
@@ -703,6 +746,7 @@ namespace EOM.TSHotelManagement.Service
}
catch (Exception ex)
{
+ logger.LogError(ex, "AssignUserPermissions failed for UserNumber: {UserNumber}", input?.UserNumber);
return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString($"Assign direct permissions failed: {ex.Message}", $"分配直接权限失败:{ex.Message}"));
}
}
diff --git a/EOM.TSHotelManagement.Service/SystemManagement/Base/BaseService.cs b/EOM.TSHotelManagement.Service/SystemManagement/Base/BaseService.cs
index 787989f6b502e358e98f32194e755009f85061cf..e889fa9ca7ff80b08074ce63de863f025675805a 100644
--- a/EOM.TSHotelManagement.Service/SystemManagement/Base/BaseService.cs
+++ b/EOM.TSHotelManagement.Service/SystemManagement/Base/BaseService.cs
@@ -26,6 +26,7 @@ using EOM.TSHotelManagement.Contract;
using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
using jvncorelib.EntityLib;
+using Microsoft.Extensions.Logging;
using SqlSugar;
namespace EOM.TSHotelManagement.Service
@@ -85,20 +86,9 @@ namespace EOM.TSHotelManagement.Service
///
private readonly GenericRepository appointmentNoticeTypeRepository;
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- ///
- public BaseService(GenericRepository workerRepository, GenericRepository educationRepository, GenericRepository nationRepository, GenericRepository deptRepository, GenericRepository positionRepository, GenericRepository passPortTypeRepository, GenericRepository custoTypeRepository, GenericRepository goodbadTypeRepository, GenericRepository baseRepository, GenericRepository appointmentNoticeTypeRepository)
+ private readonly ILogger logger;
+
+ public BaseService(GenericRepository workerRepository, GenericRepository educationRepository, GenericRepository nationRepository, GenericRepository deptRepository, GenericRepository positionRepository, GenericRepository passPortTypeRepository, GenericRepository custoTypeRepository, GenericRepository goodbadTypeRepository, GenericRepository baseRepository, GenericRepository appointmentNoticeTypeRepository, ILogger logger)
{
this.workerRepository = workerRepository;
this.educationRepository = educationRepository;
@@ -110,6 +100,7 @@ namespace EOM.TSHotelManagement.Service
this.goodbadTypeRepository = goodbadTypeRepository;
this.baseRepository = baseRepository;
this.appointmentNoticeTypeRepository = appointmentNoticeTypeRepository;
+ this.logger = logger;
}
#region 预约类型模块
@@ -285,9 +276,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse AddPosition(CreatePositionInputDto createPositionInputDto)
{
- var position = EntityMapper.Map(createPositionInputDto);
- var result = positionRepository.Insert(position);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var position = EntityMapper.Map(createPositionInputDto);
+ var result = positionRepository.Insert(position);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error adding position");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Add Position Failure","添加职位类型失败") };
+ }
}
///
@@ -297,8 +296,37 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse DelPosition(DeletePositionInputDto deletePositionInputDto)
{
- var result = positionRepository.SoftDelete(EntityMapper.Map(deletePositionInputDto));
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ if (deletePositionInputDto?.DelIds == null || !deletePositionInputDto.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var positions = positionRepository.GetList(a => deletePositionInputDto.DelIds.Contains(a.Id));
+
+ if (!positions.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Position Not Found", "职位未找到")
+ };
+ }
+
+ var result = positionRepository.SoftDeleteRange(positions);
+
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error deleting positions");
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Delete Position Failure", "删除职位类型失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
///
@@ -308,9 +336,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse UpdPosition(UpdatePositionInputDto updatePositionInputDto)
{
- var position = EntityMapper.Map(updatePositionInputDto);
- var result = positionRepository.Update(position);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var position = EntityMapper.Map(updatePositionInputDto);
+ positionRepository.Update(position);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex,"Error updating position with ID {PositionId}", updatePositionInputDto.PositionId);
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Update Position Failure", "删除职位类型失败") };
+ }
}
#endregion
@@ -367,9 +403,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse AddNation(CreateNationInputDto createNationInputDto)
{
- var nation = EntityMapper.Map(createNationInputDto);
- var result = nationRepository.Insert(nation);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var nation = EntityMapper.Map(createNationInputDto);
+ nationRepository.Insert(nation);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error adding nation");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Add Nation Type Failure","添加民族类型失败") };
+ }
}
///
@@ -379,8 +423,37 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse DelNation(DeleteNationInputDto deleteNationInputDto)
{
- var result = nationRepository.SoftDelete(EntityMapper.Map(deleteNationInputDto));
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ if (deleteNationInputDto?.DelIds == null || !deleteNationInputDto.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+
+ var nations = nationRepository.GetList(a => deleteNationInputDto.DelIds.Contains(a.Id));
+
+ if (!nations.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Nation Not Found", "民族类型未找到")
+ };
+ }
+
+ var result = nationRepository.SoftDeleteRange(nations);
+
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error deleting nations");
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Delete Nation Type Failure", "删除民族类型失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
///
@@ -390,9 +463,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse UpdNation(UpdateNationInputDto updateNationInputDto)
{
- var nation = EntityMapper.Map(updateNationInputDto);
- var result = nationRepository.Update(nation);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var nation = EntityMapper.Map(updateNationInputDto);
+ nationRepository.Update(nation);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error updating nation");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Update Nation Type Failure", "更新民族类型失败") };
+ }
}
#endregion
@@ -448,9 +529,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse AddEducation(CreateEducationInputDto createEducationInputDto)
{
- var education = EntityMapper.Map(createEducationInputDto);
- var result = educationRepository.Insert(education);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var education = EntityMapper.Map(createEducationInputDto);
+ educationRepository.Insert(education);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error adding education");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Add Education Type Failure","添加学历类型失败") };
+ }
}
///
@@ -460,8 +549,35 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse DelEducation(DeleteEducationInputDto deleteEducationInputDto)
{
- var result = educationRepository.SoftDelete(EntityMapper.Map(deleteEducationInputDto));
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ if (deleteEducationInputDto?.DelIds == null || !deleteEducationInputDto.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+ var educations = educationRepository.GetList(a => deleteEducationInputDto.DelIds.Contains(a.Id));
+ if (!educations.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Education Not Found", "学历类型未找到")
+ };
+ }
+
+ var result = educationRepository.SoftDeleteRange(educations);
+
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error deleting educations");
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Delete Education Type Failure", "删除学历类型失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
///
@@ -471,9 +587,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse UpdEducation(UpdateEducationInputDto education)
{
- var entity = EntityMapper.Map(education);
- var result = educationRepository.Update(entity);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var entity = EntityMapper.Map(education);
+ educationRepository.Update(entity);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error updating education");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Update Education Type Failure", "更新学历类型失败") };
+ }
}
#endregion
@@ -561,9 +685,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse AddDept(CreateDepartmentInputDto dept)
{
- var department = EntityMapper.Map(dept);
- var result = deptRepository.Insert(department);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var department = EntityMapper.Map(dept);
+ deptRepository.Insert(department);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error adding department");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Add Department Failure","添加部门类型失败") };
+ }
}
///
@@ -573,8 +705,35 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse DelDept(DeleteDepartmentInputDto dept)
{
- var result = deptRepository.SoftDelete(EntityMapper.Map(dept));
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ if (dept?.DelIds == null || !dept.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+ var departments = deptRepository.GetList(a => dept.DelIds.Contains(a.Id));
+ if (!departments.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Department Not Found", "部门类型未找到")
+ };
+ }
+
+ var result = deptRepository.SoftDeleteRange(departments);
+
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error deleting departments");
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Delete Department Failure", "删除部门类型失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
///
@@ -584,9 +743,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse UpdDept(UpdateDepartmentInputDto dept)
{
- var department = EntityMapper.Map(dept);
- var result = deptRepository.Update(department);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var department = EntityMapper.Map(dept);
+ var result = deptRepository.Update(department);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error updating department");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Update Department Failure", "更新部门类型失败") };
+ }
}
#endregion
@@ -661,9 +828,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse InsertCustoType(CreateCustoTypeInputDto custoType)
{
- var custoTypeEntity = EntityMapper.Map(custoType);
- var result = custoTypeRepository.Insert(custoTypeEntity);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var custoTypeEntity = EntityMapper.Map(custoType);
+ custoTypeRepository.Insert(custoTypeEntity);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error adding customer type");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Add Customer Type Failure", "添加客户类型失败") };
+ }
}
///
@@ -673,8 +848,35 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse DeleteCustoType(DeleteCustoTypeInputDto custoType)
{
- var result = custoTypeRepository.SoftDelete(EntityMapper.Map(custoType));
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ if (custoType?.DelIds == null || !custoType.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+ var custoTypes = custoTypeRepository.GetList(a => custoType.DelIds.Contains(a.Id));
+ if (!custoTypes.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Customer Type Not Found", "客户类型未找到")
+ };
+ }
+
+ var result = custoTypeRepository.SoftDeleteRange(custoTypes);
+
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error deleting departments");
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Delete Customer Type Failure", "删除客户类型失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
///
@@ -684,9 +886,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse UpdateCustoType(UpdateCustoTypeInputDto custoType)
{
- var entity = EntityMapper.Map(custoType);
- var result = custoTypeRepository.Update(entity);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var entity = EntityMapper.Map(custoType);
+ custoTypeRepository.Update(entity);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error updating customer type");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Update Customer Type Failure", "更新客户类型失败") };
+ }
}
#endregion
@@ -761,9 +971,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse InsertPassPortType(CreatePassportTypeInputDto passPortType)
{
- var passPortTypeEntity = EntityMapper.Map(passPortType);
- var result = passPortTypeRepository.Insert(passPortTypeEntity);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var passPortTypeEntity = EntityMapper.Map(passPortType);
+ passPortTypeRepository.Insert(passPortTypeEntity);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error adding passport type");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Add Passport Type Failure", "添加证件类型失败") };
+ }
}
///
@@ -773,8 +991,35 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse DeletePassPortType(DeletePassportTypeInputDto portType)
{
- var result = passPortTypeRepository.SoftDelete(EntityMapper.Map(portType));
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ if (portType?.DelIds == null || !portType.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+ var passPortTypes = passPortTypeRepository.GetList(a => portType.DelIds.Contains(a.Id));
+ if (!passPortTypes.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Passport Type Not Found", "证件类型未找到")
+ };
+ }
+
+ var result = passPortTypeRepository.SoftDeleteRange(passPortTypes);
+
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error deleting passport types");
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Delete Passport Type Failure", "删除证件类型失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
///
@@ -784,9 +1029,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse UpdatePassPortType(UpdatePassportTypeInputDto portType)
{
- var entity = EntityMapper.Map(portType);
- var result = passPortTypeRepository.Update(entity);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var entity = EntityMapper.Map(portType);
+ var result = passPortTypeRepository.Update(entity);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error updating passport type");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Update Passport Type Failure", "更新证件类型失败") };
+ }
}
#endregion
@@ -859,22 +1112,57 @@ namespace EOM.TSHotelManagement.Service
///
///
///
- public BaseResponse InsertRewardPunishmentType(CreateRewardPunishmentTypeInputDto gBType)
+ public BaseResponse InsertRewardPunishmentType(CreateRewardPunishmentTypeInputDto request)
{
- var gBTypeEntity = EntityMapper.Map(gBType);
- var result = goodbadTypeRepository.Insert(gBTypeEntity);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var rewardPunishmentType = EntityMapper.Map(request);
+ var result = goodbadTypeRepository.Insert(rewardPunishmentType);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error adding Reward & Punishment type");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Add Reward & Punishment Type Failure", "添加奖惩类型失败") };
+ }
}
///
/// 删除奖惩类型
///
- ///
+ ///
///
- public BaseResponse DeleteRewardPunishmentType(DeleteRewardPunishmentTypeInputDto gBType)
+ public BaseResponse DeleteRewardPunishmentType(DeleteRewardPunishmentTypeInputDto request)
{
- var result = goodbadTypeRepository.SoftDelete(EntityMapper.Map(gBType));
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ if (request?.DelIds == null || !request.DelIds.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+ var rewardPunishmentTypes = goodbadTypeRepository.GetList(a => request.DelIds.Contains(a.Id));
+ if (!rewardPunishmentTypes.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Reward & Punishment Type Not Found", "奖惩类型未找到")
+ };
+ }
+
+ var result = goodbadTypeRepository.SoftDeleteRange(rewardPunishmentTypes);
+
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error deleting Reward & Punishment types");
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Delete Reward & Punishment Type Failure", "删除奖惩类型失败"), Code = BusinessStatusCode.InternalServerError };
+ }
}
///
@@ -884,9 +1172,17 @@ namespace EOM.TSHotelManagement.Service
///
public BaseResponse UpdateRewardPunishmentType(UpdateRewardPunishmentTypeInputDto gBType)
{
- var entity = EntityMapper.Map(gBType);
- var result = goodbadTypeRepository.Update(entity);
- return new BaseResponse { Code = result ? BusinessStatusCode.Success : BusinessStatusCode.InternalServerError };
+ try
+ {
+ var entity = EntityMapper.Map(gBType);
+ var result = goodbadTypeRepository.Update(entity);
+ return new BaseResponse();
+ }
+ catch (Exception ex)
+ {
+ logger.LogError(ex, "Error updating Reward & Punishment type");
+ return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("Update Reward & Punishment Type Failure", "更新奖惩类型失败") };
+ }
}
#endregion
@@ -944,13 +1240,13 @@ namespace EOM.TSHotelManagement.Service
var result = appointmentNoticeTypeRepository.Insert(entity);
if (!result)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("insert appointment notice failed.", "公告类型添加失败"), null);
+ logger.LogError(LocalizationHelper.GetLocalizedString("insert appointment notice failed.", "公告类型添加失败"));
return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("insert appointment notice failed.", "公告类型添加失败") };
}
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("insert appointment notice failed.", "公告类型添加失败"), ex);
+ logger.LogError(ex, "Error inserting appointment notice type");
return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("insert appointment notice failed.", "公告类型添加失败") };
}
@@ -966,19 +1262,33 @@ namespace EOM.TSHotelManagement.Service
{
try
{
- if (!appointmentNoticeTypeRepository.IsAny(a => a.NoticeTypeNumber == deleteAppointmentNoticeTypeInputDto.NoticeTypeNumber))
+ if (deleteAppointmentNoticeTypeInputDto?.DelIds == null || !deleteAppointmentNoticeTypeInputDto.DelIds.Any())
{
- return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("appointment notice number does not already.", "公告类型编号不存在") };
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.BadRequest,
+ Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误")
+ };
+ }
+ var appointmentNoticeTypes = appointmentNoticeTypeRepository.GetList(a => deleteAppointmentNoticeTypeInputDto.DelIds.Contains(a.Id));
+ if (!appointmentNoticeTypes.Any())
+ {
+ return new BaseResponse
+ {
+ Code = BusinessStatusCode.NotFound,
+ Message = LocalizationHelper.GetLocalizedString("Appointment Notice Type Not Found", "公告类型未找到")
+ };
}
- appointmentNoticeTypeRepository.SoftDelete(EntityMapper.Map(deleteAppointmentNoticeTypeInputDto));
+
+ var result = appointmentNoticeTypeRepository.SoftDeleteRange(appointmentNoticeTypes);
+
+ return new BaseResponse();
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("delete appointment notice failed.", "公告类型删除失败"), ex);
- return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("delete appointment notice failed.", "公告类型删除失败") };
+ logger.LogError(ex, "Error deleting appointment notice types");
+ return new BaseResponse { Message = LocalizationHelper.GetLocalizedString("Delete Appointment Notice Type Failure", "删除公告类型失败"), Code = BusinessStatusCode.InternalServerError };
}
-
- return new BaseResponse { Code = BusinessStatusCode.Success, Message = LocalizationHelper.GetLocalizedString("delete appointment notice successful.", "公告类型删除成功") };
}
///
@@ -995,20 +1305,15 @@ namespace EOM.TSHotelManagement.Service
return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("appointment notice number does not already.", "公告类型编号不存在") };
}
var entity = EntityMapper.Map(updateAppointmentNoticeTypeInputDto);
- var result = appointmentNoticeTypeRepository.Update(entity);
- if (!result)
- {
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("update appointment notice failed.", "公告类型更新失败"), null);
- return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("update appointment notice failed.", "公告类型更新失败") };
- }
+ appointmentNoticeTypeRepository.Update(entity);
+
+ return new BaseResponse { Code = BusinessStatusCode.Success, Message = LocalizationHelper.GetLocalizedString("update appointment notice successful.", "公告类型更新成功") };
}
catch (Exception ex)
{
- LogHelper.LogError(LocalizationHelper.GetLocalizedString("update appointment notice failed.", "公告类型更新失败"), ex);
+ logger.LogError(ex, "Error updating appointment notice type");
return new BaseResponse { Code = BusinessStatusCode.InternalServerError, Message = LocalizationHelper.GetLocalizedString("update appointment notice failed.", "公告类型更新失败") };
}
-
- return new BaseResponse { Code = BusinessStatusCode.Success, Message = LocalizationHelper.GetLocalizedString("update appointment notice successful.", "公告类型更新成功") };
}
#endregion
diff --git a/EOM.TSHotelManagement.Service/SystemManagement/Menu/MenuService.cs b/EOM.TSHotelManagement.Service/SystemManagement/Menu/MenuService.cs
index 6984fbc3aa089ba4dcdbb1803db1543586ed5ccd..be429621c61f0bba318619ec9e8c239b0bcb05ea 100644
--- a/EOM.TSHotelManagement.Service/SystemManagement/Menu/MenuService.cs
+++ b/EOM.TSHotelManagement.Service/SystemManagement/Menu/MenuService.cs
@@ -26,6 +26,7 @@ using EOM.TSHotelManagement.Contract;
using EOM.TSHotelManagement.Data;
using EOM.TSHotelManagement.Domain;
using jvncorelib.EntityLib;
+using Microsoft.Extensions.Logging;
using SqlSugar;
namespace EOM.TSHotelManagement.Service
@@ -48,19 +49,9 @@ namespace EOM.TSHotelManagement.Service
private readonly GenericRepository rolePermissionRepository;
private readonly GenericRepository userRoleRepository;
private readonly GenericRepository administratorRepository;
+ private readonly ILogger logger;
- ///
- ///
- ///
- ///
- ///
- public MenuService(
- GenericRepository