diff --git a/EOM.TSHotelManager.Application/Business/Customer/CustoService.cs b/EOM.TSHotelManager.Application/Business/Customer/CustoService.cs index 5a56b51c337c91926121f7f2671518179c34a6ce..70ae768817bb2d2f42f43b942734f75026077b5f 100644 --- a/EOM.TSHotelManager.Application/Business/Customer/CustoService.cs +++ b/EOM.TSHotelManager.Application/Business/Customer/CustoService.cs @@ -26,7 +26,7 @@ using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using CK.Common; -using EncryptTools.Core; +using EOM.Encrypt; using EOM.TSHotelManager.Core; using EOM.TSHotelManager.EntityFramework; using Npgsql; @@ -63,7 +63,10 @@ namespace EOM.TSHotelManager.Application /// private readonly PgRepository custoTypeRepository; - Encrypt encrypt = new Encrypt(); + /// + /// 加密 + /// + private readonly EOM.Encrypt.Encrypt encrypt; /// /// @@ -73,13 +76,15 @@ namespace EOM.TSHotelManager.Application /// /// /// - public CustoService(PgRepository custoRepository, PgRepository spendRepository, PgRepository sexTypeRepository, PgRepository passPortTypeRepository, PgRepository custoTypeRepository) + /// + public CustoService(PgRepository custoRepository, PgRepository spendRepository, PgRepository sexTypeRepository, PgRepository passPortTypeRepository, PgRepository custoTypeRepository, EOM.Encrypt.Encrypt encrypt) { this.custoRepository = custoRepository; this.spendRepository = spendRepository; this.sexTypeRepository = sexTypeRepository; this.passPortTypeRepository = passPortTypeRepository; this.custoTypeRepository = custoTypeRepository; + this.encrypt = encrypt; } #region 添加客户信息 diff --git a/EOM.TSHotelManager.Application/Business/Reser/ReserService.cs b/EOM.TSHotelManager.Application/Business/Reser/ReserService.cs index 179764118e4cfc7ac0249882bcb36819f31d1ef3..58716aa31bd54225ee100849c8f31954c2ea833d 100644 --- a/EOM.TSHotelManager.Application/Business/Reser/ReserService.cs +++ b/EOM.TSHotelManager.Application/Business/Reser/ReserService.cs @@ -21,7 +21,7 @@ *SOFTWARE. * */ -using EncryptTools.Core; +using EOM.Encrypt; using EOM.TSHotelManager.Common; using EOM.TSHotelManager.Core; using EOM.TSHotelManager.EntityFramework; @@ -40,7 +40,21 @@ namespace EOM.TSHotelManager.Application /// private readonly PgRepository reserRepository; - Encrypt encrypt = new Encrypt(); + /// + /// 加密 + /// + private readonly EOM.Encrypt.Encrypt encrypt; + + /// + /// + /// + /// + /// + public ReserService(PgRepository reserRepository, EOM.Encrypt.Encrypt encrypt) + { + this.reserRepository = reserRepository; + this.encrypt = encrypt; + } /// /// 获取所有预约信息 @@ -97,7 +111,7 @@ namespace EOM.TSHotelManager.Application /// public bool InserReserInfo(Reser r) { - var cryStr = encrypt.Encryption(r.CustoTel); + var cryStr = encrypt.Encryption(r.CustoTel, EncryptionLevel.Enhanced); r.CustoTel = cryStr; return reserRepository.Insert(r); } diff --git a/EOM.TSHotelManager.Application/EOM.TSHotelManager.Application.csproj b/EOM.TSHotelManager.Application/EOM.TSHotelManager.Application.csproj index fb379c19dbf35d3163efa49d22d082d0b39a396e..e2a2d102eb907284e61f771a939a2c6af3a4027a 100644 --- a/EOM.TSHotelManager.Application/EOM.TSHotelManager.Application.csproj +++ b/EOM.TSHotelManager.Application/EOM.TSHotelManager.Application.csproj @@ -15,10 +15,6 @@ 1701;1702;8618; - - - - @@ -29,6 +25,9 @@ ..\Library\CK.Common.dll + + ..\Library\EOM.Encrypt.dll + diff --git a/EOM.TSHotelManager.Application/Worker/Picture/WorkerPicService.cs b/EOM.TSHotelManager.Application/Worker/Picture/WorkerPicService.cs index f231388084d521f2bf31c9a426ab13ac716b0279..49194476cbbf7be849994f133b10cdf5b3a162d8 100644 --- a/EOM.TSHotelManager.Application/Worker/Picture/WorkerPicService.cs +++ b/EOM.TSHotelManager.Application/Worker/Picture/WorkerPicService.cs @@ -1,4 +1,4 @@ -using EncryptTools.Core; +using EOM.Encrypt; using EOM.TSHotelManager.Common; using EOM.TSHotelManager.Core; using EOM.TSHotelManager.EntityFramework; @@ -21,17 +21,22 @@ namespace EOM.TSHotelManager.Application /// private readonly PgRepository workerPicRepository; + /// + /// 加密 + /// + private readonly EOM.Encrypt.Encrypt encrypt; + /// /// /// /// - public WorkerPicService(PgRepository workerPicRepository) + /// + public WorkerPicService(PgRepository workerPicRepository, EOM.Encrypt.Encrypt encrypt) { this.workerPicRepository = workerPicRepository; + this.encrypt = encrypt; } - Encrypt encrypt = new Encrypt(); - /// /// 查询员工照片 /// diff --git a/EOM.TSHotelManager.Application/Worker/WorkerService.cs b/EOM.TSHotelManager.Application/Worker/WorkerService.cs index e711697ffb14450cd94558277ef4ef9a2eeef093..36354df5641591a8a470a630be63212c617245e6 100644 --- a/EOM.TSHotelManager.Application/Worker/WorkerService.cs +++ b/EOM.TSHotelManager.Application/Worker/WorkerService.cs @@ -21,7 +21,7 @@ *SOFTWARE. * */ -using EncryptTools.Core; +using EOM.Encrypt; using EOM.TSHotelManager.Common; using EOM.TSHotelManager.Core; using EOM.TSHotelManager.EntityFramework; @@ -67,9 +67,9 @@ namespace EOM.TSHotelManager.Application private readonly PgRepository positionRepository; /// - /// 实例化信息加密插件 + /// 加密 /// - Encrypt encrypt = new Encrypt(); + private readonly EOM.Encrypt.Encrypt encrypt; /// /// @@ -80,7 +80,8 @@ namespace EOM.TSHotelManager.Application /// /// /// - public WorkerService(PgRepository workerRepository, PgRepository sexTypeRepository, PgRepository educationRepository, PgRepository nationRepository, PgRepository deptRepository, PgRepository positionRepository) + /// + public WorkerService(PgRepository workerRepository, PgRepository sexTypeRepository, PgRepository educationRepository, PgRepository nationRepository, PgRepository deptRepository, PgRepository positionRepository, EOM.Encrypt.Encrypt encrypt) { this.workerRepository = workerRepository; this.sexTypeRepository = sexTypeRepository; @@ -88,6 +89,7 @@ namespace EOM.TSHotelManager.Application this.nationRepository = nationRepository; this.deptRepository = deptRepository; this.positionRepository = positionRepository; + this.encrypt = encrypt; } #region 修改员工信息 @@ -102,13 +104,13 @@ namespace EOM.TSHotelManager.Application var sourceTelStr = string.Empty; if (!string.IsNullOrEmpty(worker.WorkerTel)) { - sourceTelStr = encrypt.Encryption(worker.WorkerTel); + sourceTelStr = encrypt.Encryption(worker.WorkerTel,EncryptionLevel.Enhanced); } //加密身份证 var sourceIdStr = string.Empty; if (!string.IsNullOrEmpty(worker.CardId)) { - sourceIdStr = encrypt.Encryption(worker.CardId); + sourceIdStr = encrypt.Encryption(worker.CardId, EncryptionLevel.Enhanced); } worker.WorkerTel = sourceTelStr; worker.CardId = sourceIdStr; @@ -281,12 +283,15 @@ namespace EOM.TSHotelManager.Application return w; } - if (!encrypt.Compare(w.WorkerPwd, worker.WorkerPwd)) + var frontEncryed = encrypt.Encryption(w.WorkerPwd, EncryptionLevel.Enhanced); + var backEncryed = encrypt.Encryption(worker.WorkerPwd, EncryptionLevel.Enhanced); + + if (!encrypt.Compare(frontEncryed, backEncryed)) { w = null; return w; } - + w.WorkerPwd = ""; //性别类型 var sexType = sexTypeRepository.GetSingle(a => a.sexId == w.WorkerSex); w.WorkerSexName = string.IsNullOrEmpty(sexType.sexName) ? "" : sexType.sexName; diff --git a/EOM.TSHotelManager.Application/Zero/Admin/AdminService.cs b/EOM.TSHotelManager.Application/Zero/Admin/AdminService.cs index c6d8a0561b8b3c01c8b29f7edc0884fb3a339dff..d413ab1fe10faf9b5262408475dd221d0a886769 100644 --- a/EOM.TSHotelManager.Application/Zero/Admin/AdminService.cs +++ b/EOM.TSHotelManager.Application/Zero/Admin/AdminService.cs @@ -22,10 +22,11 @@ * */ using CK.Common; -using EncryptTools.Core; +using EOM.Encrypt; using EOM.TSHotelManager.Common; using EOM.TSHotelManager.Core; using EOM.TSHotelManager.EntityFramework; +using SqlSugar.DistributedSystem.Snowflake; using System; using System.Collections.Generic; using System.Linq; @@ -47,17 +48,22 @@ namespace EOM.TSHotelManager.Application /// private readonly PgRepository adminTypeRepository; - Encrypt encrypt = new Encrypt(); + /// + /// 加密 + /// + private readonly EOM.Encrypt.Encrypt encrypt; /// /// /// /// /// - public AdminService(PgRepository adminRepository, PgRepository adminTypeRepository) + /// + public AdminService(PgRepository adminRepository, PgRepository adminTypeRepository, EOM.Encrypt.Encrypt encrypt) { this.adminRepository = adminRepository; this.adminTypeRepository = adminTypeRepository; + this.encrypt = encrypt; } #region 根据超管密码查询员工类型和权限 @@ -79,11 +85,16 @@ namespace EOM.TSHotelManager.Application admins = null; return admins; } - if (!encrypt.Compare(admins.AdminPassword, admin.AdminPassword)) + + var frontEncryed = encrypt.Encryption(admins.AdminPassword, EncryptionLevel.Enhanced); + var backEncryed = encrypt.Encryption(admin.AdminPassword, EncryptionLevel.Enhanced); + + if (!encrypt.Compare(frontEncryed, backEncryed)) { admins = null; return admins; } + admins.AdminPassword = ""; return admins; } #endregion @@ -134,7 +145,7 @@ namespace EOM.TSHotelManager.Application /// public bool UpdateNewPwdByOldPwd(Admin admin) { - admin.AdminPassword = encrypt.Encryption(admin.AdminPassword); + admin.AdminPassword = encrypt.Encryption(admin.AdminPassword, EncryptionLevel.Enhanced); return adminRepository.Update(a => new Admin() { AdminPassword = admin.AdminPassword, @@ -169,7 +180,7 @@ namespace EOM.TSHotelManager.Application /// public bool AddAdmin(Admin admin) { - admin.AdminPassword = encrypt.Encryption(admin.AdminPassword); + admin.AdminPassword = encrypt.Encryption(admin.AdminPassword, EncryptionLevel.Enhanced); bool result = adminRepository.Insert(admin); return result; } diff --git a/EOM.TSHotelManager.WebApi/Controllers/Worker/WorkerController.cs b/EOM.TSHotelManager.WebApi/Controllers/Worker/WorkerController.cs new file mode 100644 index 0000000000000000000000000000000000000000..d527b4267b3f832de48606c195ab51f9aa0935aa --- /dev/null +++ b/EOM.TSHotelManager.WebApi/Controllers/Worker/WorkerController.cs @@ -0,0 +1,117 @@ +using EOM.TSHotelManager.Application; +using EOM.TSHotelManager.Core; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; + +namespace EOM.TSHotelManager.WebApi.Controllers +{ + /// + /// 员工信息控制器 + /// + public class WorkerController : ControllerBase + { + /// + /// 员工信息 + /// + private readonly IWorkerService workerService; + + /// + /// + /// + /// + public WorkerController(IWorkerService workerService) + { + this.workerService = workerService; + } + + /// + /// 修改员工信息 + /// + /// + /// + [HttpPost] + public bool UpdateWorker([FromBody]Worker worker) + { + return workerService.UpdateWorker(worker); + } + + /// + /// 员工账号禁/启用 + /// + /// + /// + [HttpPost] + public bool ManagerWorkerAccount([FromBody]Worker worker) + { + return workerService.ManagerWorkerAccount(worker); + } + + /// + /// 更新员工职位和部门 + /// + /// + /// + [HttpPost] + + public bool UpdateWorkerPositionAndClub([FromBody]Worker worker) + { + return workerService.UpdateWorkerPositionAndClub(worker); + } + + /// + /// 添加员工信息 + /// + /// + /// + [HttpPost] + public bool AddWorker(Worker worker) + { + return workerService.AddWorker(worker); + } + + /// + /// 获取所有工作人员信息 + /// + /// + [HttpGet] + public List SelectWorkerAll() + { + return workerService.SelectWorkerAll(); + } + + /// + /// 根据登录名称查询员工信息 + /// + /// + /// + [HttpGet] + public Worker SelectWorkerInfoByWorkerId([FromQuery]string? workerId) + { + return workerService.SelectWorkerInfoByWorkerId(workerId); + } + + /// + /// 根据登录名称、密码查询员工信息 + /// + /// + /// + [HttpPost] + public Worker SelectWorkerInfoByWorkerIdAndWorkerPwd([FromBody]Worker worker) + { + return workerService.SelectWorkerInfoByWorkerIdAndWorkerPwd(worker); + } + + /// + /// 根据员工编号和密码修改密码 + /// + /// + /// + /// + [HttpPost] + public bool UpdWorkerPwdByWorkNo([FromBody]string? workId, string? workPwd) + { + return workerService.UpdWorkerPwdByWorkNo(workId, workPwd); + } + } +} diff --git a/EOM.TSHotelManager.WebApi/EOM.TSHotelManager.WebApi.csproj b/EOM.TSHotelManager.WebApi/EOM.TSHotelManager.WebApi.csproj index cbf388878bdadac2096beb6ea68e8690a1229d33..e831fc17cbce0b61d3c65e6882e03fec26cb7ab6 100644 --- a/EOM.TSHotelManager.WebApi/EOM.TSHotelManager.WebApi.csproj +++ b/EOM.TSHotelManager.WebApi/EOM.TSHotelManager.WebApi.csproj @@ -31,7 +31,9 @@ - + + ..\Library\EOM.Encrypt.dll + diff --git a/EOM.TSHotelManager.WebApi/EOM.TSHotelManager.WebApi.xml b/EOM.TSHotelManager.WebApi/EOM.TSHotelManager.WebApi.xml index 48f3b925adaa35fa6202d6d010bb9c45a369facb..46ab6b892f18b24ebef9c52ab62a653d3e431279 100644 --- a/EOM.TSHotelManager.WebApi/EOM.TSHotelManager.WebApi.xml +++ b/EOM.TSHotelManager.WebApi/EOM.TSHotelManager.WebApi.xml @@ -714,6 +714,78 @@ + + + 员工信息控制器 + + + + + 员工信息 + + + + + + + + + + + 修改员工信息 + + + + + + + 员工账号禁/启用 + + + + + + + 更新员工职位和部门 + + + + + + + 添加员工信息 + + + + + + + 获取所有工作人员信息 + + + + + + 根据登录名称查询员工信息 + + + + + + + 根据登录名称、密码查询员工信息 + + + + + + + 根据员工编号和密码修改密码 + + + + + 管理员控制器 @@ -1247,18 +1319,6 @@ - - - Mvc扩展方法 - - - - - 扩展方法 - - - - @@ -1277,6 +1337,18 @@ + + + Mvc扩展方法 + + + + + 扩展方法 + + + + 全局路由前缀配置 diff --git a/EOM.TSHotelManager.WebApi/MvcOptionsExtensions.cs b/EOM.TSHotelManager.WebApi/Router_Extension/MvcOptionsExtensions.cs similarity index 100% rename from EOM.TSHotelManager.WebApi/MvcOptionsExtensions.cs rename to EOM.TSHotelManager.WebApi/Router_Extension/MvcOptionsExtensions.cs diff --git a/EOM.TSHotelManager.WebApi/RouteConvention.cs b/EOM.TSHotelManager.WebApi/Router_Extension/RouteConvention.cs similarity index 97% rename from EOM.TSHotelManager.WebApi/RouteConvention.cs rename to EOM.TSHotelManager.WebApi/Router_Extension/RouteConvention.cs index 42eb6dd7ab47f93768ff9932159dcc1a87725f39..a97e035db60978aa7fab3e33b7e7e2a3c1d429ba 100644 --- a/EOM.TSHotelManager.WebApi/RouteConvention.cs +++ b/EOM.TSHotelManager.WebApi/Router_Extension/RouteConvention.cs @@ -7,7 +7,7 @@ namespace EOM.TSHotelManager.WebApi /// /// 全局路由前缀配置 /// - public class RouteConvention:IApplicationModelConvention + public class RouteConvention : IApplicationModelConvention { /// /// 定义一个路由前缀变量 diff --git a/EOM.TSHotelManager.WebApi/Startup.cs b/EOM.TSHotelManager.WebApi/Startup.cs index 3d7e3b410cc0f6dc1df46b8aa80d139a4875e86c..7cf2a6d42f2d5448a57163c698fb8d97d8fef441 100644 --- a/EOM.TSHotelManager.WebApi/Startup.cs +++ b/EOM.TSHotelManager.WebApi/Startup.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; using Autofac; -using EncryptTools.Core; +using EOM.Encrypt; using EOM.TSHotelManager.EntityFramework; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -126,6 +126,11 @@ namespace EOM.TSHotelManager.WebApi .AsImplementedInterfaces() .InstancePerDependency() .PropertiesAutowired(); + + //עӽ + var encryptionService = Assembly.LoadFrom(Path.Combine(AppContext.BaseDirectory, "EOM.Encrypt.dll")); + builder.RegisterAssemblyTypes(encryptionService) + .PropertiesAutowired(); } catch (Exception ex) { diff --git a/Library/EOM.Encrypt.dll b/Library/EOM.Encrypt.dll new file mode 100644 index 0000000000000000000000000000000000000000..447e57bd0cef09ee0300a754bcdabf57ff575b3d Binary files /dev/null and b/Library/EOM.Encrypt.dll differ