diff --git a/.env.example b/.env.example index ec34523b416f003159509cf039ba40b3dd7f2329..f08c4a0fefdb105f090b9d0c6e8dab7557660c92 100644 --- a/.env.example +++ b/.env.example @@ -31,6 +31,14 @@ JobKeys__2=RedisServiceCheckJob ExpirationSettings__NotifyDaysBefore=3 ExpirationSettings__CheckIntervalMinutes=5 +# Idempotency +Idempotency__Enabled=true +Idempotency__EnforceKey=false +Idempotency__MaxKeyLength=128 +Idempotency__InProgressTtlSeconds=120 +Idempotency__CompletedTtlHours=24 +Idempotency__PersistFailureResponse=false + # Mail service Mail__Enabled=false Mail__Host=smtp.example.com diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000000000000000000000000000000000..239c7996e69bbf7e22a461e468b556d102a24ea0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,18 @@ +# Normalize text files and keep line endings consistent in the repository. +* text=auto eol=lf + +# Keep Windows command scripts in CRLF for best compatibility. +*.bat text eol=crlf +*.cmd text eol=crlf + +# Common binary assets. +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary +*.pdf binary +*.zip binary +*.7z binary +*.dll binary +*.exe binary diff --git a/EOM.TSHotelManagement.API/Authorization/CustomAuthorizationMiddlewareResultHandler.cs b/EOM.TSHotelManagement.API/Authorization/CustomAuthorizationMiddlewareResultHandler.cs index 729578de7f426b183fc4c7d38213900e3cbc7201..b952fc362644e766dcc0abadc1669efbd8af623f 100644 --- a/EOM.TSHotelManagement.API/Authorization/CustomAuthorizationMiddlewareResultHandler.cs +++ b/EOM.TSHotelManagement.API/Authorization/CustomAuthorizationMiddlewareResultHandler.cs @@ -16,7 +16,7 @@ namespace EOM.TSHotelManagement.WebApi.Authorization { if (authorizeResult.Challenged || authorizeResult.Forbidden) { - var response = new BaseResponse(BusinessStatusCode.Unauthorized, + var response = new BaseResponse(BusinessStatusCode.PermissionDenied, LocalizationHelper.GetLocalizedString("PermissionDenied", "该账户缺少权限,请联系管理员添加")); context.Response.StatusCode = StatusCodes.Status200OK; @@ -35,4 +35,4 @@ namespace EOM.TSHotelManagement.WebApi.Authorization await _defaultHandler.HandleAsync(next, context, policy, authorizeResult); } } -} \ No newline at end of file +} diff --git a/EOM.TSHotelManagement.API/Controllers/Application/NavBar/NavBarController.cs b/EOM.TSHotelManagement.API/Controllers/Application/NavBar/NavBarController.cs index 55060f86f38bbe281bf880d5e787d70fed4000be..57b813db3841eda46cbef96b141570180b401a1b 100644 --- a/EOM.TSHotelManagement.API/Controllers/Application/NavBar/NavBarController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Application/NavBar/NavBarController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -28,7 +28,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 导航控件列表 /// /// - [RequirePermission("navbar.view")] + [RequirePermission("navbar.navbarlist")] [HttpGet] public ListOutputDto NavBarList() { @@ -39,7 +39,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("navbar.create")] + [RequirePermission("navbar.addnavbar")] [HttpPost] public BaseResponse AddNavBar([FromBody] CreateNavBarInputDto input) { @@ -50,7 +50,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("navbar.update")] + [RequirePermission("navbar.updatenavbar")] [HttpPost] public BaseResponse UpdateNavBar([FromBody] UpdateNavBarInputDto input) { @@ -61,7 +61,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("navbar.delete")] + [RequirePermission("navbar.deletenavbar")] [HttpPost] public BaseResponse DeleteNavBar([FromBody] DeleteNavBarInputDto input) { diff --git a/EOM.TSHotelManagement.API/Controllers/Business/Asset/AssetController.cs b/EOM.TSHotelManagement.API/Controllers/Business/Asset/AssetController.cs index dc322ea2b8d6466a69e3cf25e647360ed8955932..b4f37412436d742b4dea294e6351366501c2e606 100644 --- a/EOM.TSHotelManagement.API/Controllers/Business/Asset/AssetController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Business/Asset/AssetController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -29,7 +29,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("internalfinance.create")] + [RequirePermission("internalfinance.addassetinfo")] [HttpPost] public BaseResponse AddAssetInfo([FromBody] CreateAssetInputDto asset) { @@ -40,7 +40,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询资产信息 /// /// - [RequirePermission("internalfinance.view")] + [RequirePermission("internalfinance.selectassetinfoall")] [HttpGet] public ListOutputDto SelectAssetInfoAll([FromQuery] ReadAssetInputDto asset) { @@ -52,7 +52,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("internalfinance.update")] + [RequirePermission("internalfinance.updassetinfo")] [HttpPost] public BaseResponse UpdAssetInfo([FromBody] UpdateAssetInputDto asset) { @@ -64,7 +64,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("internalfinance.delete")] + [RequirePermission("internalfinance.delassetinfo")] [HttpPost] public BaseResponse DelAssetInfo([FromBody] DeleteAssetInputDto asset) { diff --git a/EOM.TSHotelManagement.API/Controllers/Business/Customer/CustomerController.cs b/EOM.TSHotelManagement.API/Controllers/Business/Customer/CustomerController.cs index 68cf567c87f89fa5ca7c9b36909fa9d6989c293c..67fb2b8fcd1e18ff33772c994b61949e1baeab45 100644 --- a/EOM.TSHotelManagement.API/Controllers/Business/Customer/CustomerController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Business/Customer/CustomerController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -29,7 +29,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("customer.create")] + [RequirePermission("customer.insertcustomerinfo")] [HttpPost] public BaseResponse InsertCustomerInfo([FromBody] CreateCustomerInputDto custo) { @@ -41,7 +41,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("customer.update")] + [RequirePermission("customer.updcustomerinfo")] [HttpPost] public BaseResponse UpdCustomerInfo([FromBody] UpdateCustomerInputDto custo) { @@ -53,7 +53,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("customer.delete")] + [RequirePermission("customer.delcustomerinfo")] [HttpPost] public BaseResponse DelCustomerInfo([FromBody] DeleteCustomerInputDto custo) { @@ -65,7 +65,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("customer.update")] + [RequirePermission("customer.updcustomertypebycustono")] [HttpPost] public BaseResponse UpdCustomerTypeByCustoNo([FromBody] UpdateCustomerInputDto updateCustomerInputDto) { @@ -76,7 +76,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询所有客户信息 /// /// - [RequirePermission("customer.view")] + [RequirePermission("customer.selectcustomers")] [HttpGet] public ListOutputDto SelectCustomers(ReadCustomerInputDto custo) { @@ -87,7 +87,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询指定客户信息 /// /// - [RequirePermission("customer.view")] + [RequirePermission("customer.selectcustobyinfo")] [HttpGet] public SingleOutputDto SelectCustoByInfo([FromQuery] ReadCustomerInputDto custo) { diff --git a/EOM.TSHotelManagement.API/Controllers/Business/EnergyManagement/EnergyManagementController.cs b/EOM.TSHotelManagement.API/Controllers/Business/EnergyManagement/EnergyManagementController.cs index 4de9ff34804a6b72a61b939e16c59415b7aedfb3..8400acbc378046e457e51745b203296e497261e1 100644 --- a/EOM.TSHotelManagement.API/Controllers/Business/EnergyManagement/EnergyManagementController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Business/EnergyManagement/EnergyManagementController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -29,7 +29,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// Dto /// 符合条件的水电费信息列表 - [RequirePermission("hydroelectricinformation.view")] + [RequirePermission("hydroelectricinformation.selectenergymanagementinfo")] [HttpGet] public ListOutputDto SelectEnergyManagementInfo([FromQuery] ReadEnergyManagementInputDto readEnergyManagementInputDto) { @@ -42,7 +42,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("hydroelectricinformation.create")] + [RequirePermission("hydroelectricinformation.insertenergymanagementinfo")] [HttpPost] public BaseResponse InsertEnergyManagementInfo([FromBody] CreateEnergyManagementInputDto w) { @@ -55,7 +55,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 包含要修改的数据,以及WtiNo作为查询条件 /// - [RequirePermission("hydroelectricinformation.update")] + [RequirePermission("hydroelectricinformation.updateenergymanagementinfo")] [HttpPost] public BaseResponse UpdateEnergyManagementInfo([FromBody] UpdateEnergyManagementInputDto w) { @@ -69,7 +69,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("hydroelectricinformation.delete")] + [RequirePermission("hydroelectricinformation.deleteenergymanagementinfo")] [HttpPost] public BaseResponse DeleteEnergyManagementInfo([FromBody] DeleteEnergyManagementInputDto deleteEnergyManagementInputDto) { diff --git a/EOM.TSHotelManagement.API/Controllers/Business/PromotionContent/PromotionContentController.cs b/EOM.TSHotelManagement.API/Controllers/Business/PromotionContent/PromotionContentController.cs index 56fb09bfa186ef41bdd68bd68717a25d837532f8..df89586595bb7675671d2bf0b74cdbb3571437e9 100644 --- a/EOM.TSHotelManagement.API/Controllers/Business/PromotionContent/PromotionContentController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Business/PromotionContent/PromotionContentController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -28,7 +28,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询所有宣传联动内容 /// /// - [RequirePermission("promotioncontent.view")] + [RequirePermission("promotioncontent.selectpromotioncontentall")] [HttpGet] public ListOutputDto SelectPromotionContentAll([FromQuery] ReadPromotionContentInputDto readPromotionContentInputDto) { @@ -39,7 +39,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询所有宣传联动内容(跑马灯) /// /// - [RequirePermission("promotioncontent.view")] + [RequirePermission("promotioncontent.selectpromotioncontents")] [HttpGet] public ListOutputDto SelectPromotionContents() { @@ -51,7 +51,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("promotioncontent.create")] + [RequirePermission("promotioncontent.addpromotioncontent")] [HttpPost] public BaseResponse AddPromotionContent([FromBody] CreatePromotionContentInputDto createPromotionContentInputDto) { @@ -63,7 +63,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("promotioncontent.delete")] + [RequirePermission("promotioncontent.deletepromotioncontent")] [HttpPost] public BaseResponse DeletePromotionContent([FromBody] DeletePromotionContentInputDto deletePromotionContentInputDto) { @@ -75,7 +75,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("promotioncontent.update")] + [RequirePermission("promotioncontent.updatepromotioncontent")] [HttpPost] public BaseResponse UpdatePromotionContent([FromBody] UpdatePromotionContentInputDto updatePromotionContentInputDto) { diff --git a/EOM.TSHotelManagement.API/Controllers/Business/Reser/ReserController.cs b/EOM.TSHotelManagement.API/Controllers/Business/Reser/ReserController.cs index 0f0f0f9327363853978106018f37045202e33515..06d75583e318f4b0faaad149337566a5b0f1a28e 100644 --- a/EOM.TSHotelManagement.API/Controllers/Business/Reser/ReserController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Business/Reser/ReserController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -28,7 +28,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 获取所有预约信息 /// /// - [RequirePermission("resermanagement.view")] + [RequirePermission("resermanagement.selectreserall")] [HttpGet] public ListOutputDto SelectReserAll(ReadReserInputDto readReserInputDto) { @@ -40,7 +40,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("resermanagement.view")] + [RequirePermission("resermanagement.selectreserinfobyroomno")] [HttpGet] public SingleOutputDto SelectReserInfoByRoomNo([FromQuery] ReadReserInputDto readReserInputDto) { @@ -52,7 +52,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("resermanagement.delete")] + [RequirePermission("resermanagement.deletereserinfo")] [HttpPost] public BaseResponse DeleteReserInfo([FromBody] DeleteReserInputDto reser) { @@ -64,7 +64,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("resermanagement.update")] + [RequirePermission("resermanagement.updatereserinfo")] [HttpPost] public BaseResponse UpdateReserInfo([FromBody] UpdateReserInputDto r) { @@ -76,7 +76,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("resermanagement.create")] + [RequirePermission("resermanagement.inserreserinfo")] [HttpPost] public BaseResponse InserReserInfo([FromBody] CreateReserInputDto r) { @@ -87,7 +87,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询所有预约类型 /// /// - [RequirePermission("resermanagement.view")] + [RequirePermission("resermanagement.selectresertypeall")] [HttpGet] public ListOutputDto SelectReserTypeAll() { diff --git a/EOM.TSHotelManagement.API/Controllers/Business/Room/RoomController.cs b/EOM.TSHotelManagement.API/Controllers/Business/Room/RoomController.cs index 63796c000596bc0672ee8c78ea5286a086edeb48..5d85905d13667946ca0123b1bf49aa483c69651a 100644 --- a/EOM.TSHotelManagement.API/Controllers/Business/Room/RoomController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Business/Room/RoomController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -22,7 +22,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.selectroombyroomstate")] [HttpGet] public ListOutputDto SelectRoomByRoomState([FromQuery] ReadRoomInputDto inputDto) { @@ -33,7 +33,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 根据房间状态来查询可使用的房间 /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.selectcanuseroomall")] [HttpGet] public ListOutputDto SelectCanUseRoomAll() { @@ -44,7 +44,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 获取所有房间信息 /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.selectroomall")] [HttpGet] public ListOutputDto SelectRoomAll([FromQuery] ReadRoomInputDto readRoomInputDto) { @@ -56,7 +56,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.selectroombytypename")] [HttpGet] public ListOutputDto SelectRoomByTypeName([FromQuery] ReadRoomInputDto inputDto) { @@ -68,7 +68,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.selectroombyroomno")] [HttpGet] public SingleOutputDto SelectRoomByRoomNo([FromQuery] ReadRoomInputDto inputDto) { @@ -80,7 +80,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.daybyroomno")] [HttpGet] public SingleOutputDto DayByRoomNo([FromQuery] ReadRoomInputDto inputDto) { @@ -92,7 +92,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.update")] + [RequirePermission("roommanagement.updateroominfo")] [HttpPost] public BaseResponse UpdateRoomInfo([FromBody] UpdateRoomInputDto inputDto) { @@ -104,7 +104,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.update")] + [RequirePermission("roommanagement.updateroominfowithreser")] [HttpPost] public BaseResponse UpdateRoomInfoWithReser([FromBody] UpdateRoomInputDto inputDto) { @@ -115,7 +115,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询可入住房间数量 /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.selectcanuseroomallbyroomstate")] [HttpGet] public SingleOutputDto SelectCanUseRoomAllByRoomState() { @@ -126,7 +126,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询已入住房间数量 /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.selectnotuseroomallbyroomstate")] [HttpGet] public SingleOutputDto SelectNotUseRoomAllByRoomState() { @@ -138,7 +138,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.selectroombyroomprice")] [HttpGet] public object SelectRoomByRoomPrice([FromQuery] ReadRoomInputDto inputDto) { @@ -149,7 +149,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询脏房数量 /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.selectnotclearroomallbyroomstate")] [HttpGet] public SingleOutputDto SelectNotClearRoomAllByRoomState() { @@ -160,7 +160,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询维修房数量 /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.selectfixingroomallbyroomstate")] [HttpGet] public SingleOutputDto SelectFixingRoomAllByRoomState() { @@ -171,7 +171,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询预约房数量 /// /// - [RequirePermission("roommanagement.view")] + [RequirePermission("roommanagement.selectreservedroomallbyroomstate")] [HttpGet] public SingleOutputDto SelectReservedRoomAllByRoomState() { @@ -183,7 +183,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.update")] + [RequirePermission("roommanagement.updateroomstatebyroomno")] [HttpPost] public BaseResponse UpdateRoomStateByRoomNo([FromBody] UpdateRoomInputDto inputDto) { @@ -195,7 +195,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.create")] + [RequirePermission("roommanagement.insertroom")] [HttpPost] public BaseResponse InsertRoom([FromBody] CreateRoomInputDto inputDto) { @@ -207,7 +207,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.update")] + [RequirePermission("roommanagement.updateroom")] [HttpPost] public BaseResponse UpdateRoom([FromBody] UpdateRoomInputDto inputDto) { @@ -219,7 +219,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.delete")] + [RequirePermission("roommanagement.deleteroom")] [HttpPost] public BaseResponse DeleteRoom([FromBody] DeleteRoomInputDto inputDto) { @@ -231,7 +231,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.update")] + [RequirePermission("roommanagement.transferroom")] [HttpPost] public BaseResponse TransferRoom([FromBody] TransferRoomDto transferRoomDto) { @@ -243,7 +243,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.update")] + [RequirePermission("roommanagement.checkoutroom")] [HttpPost] public BaseResponse CheckoutRoom([FromBody] CheckoutRoomDto checkoutRoomDto) { @@ -255,7 +255,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roommanagement.update")] + [RequirePermission("roommanagement.checkinroombyreservation")] [HttpPost] public BaseResponse CheckinRoomByReservation([FromBody] CheckinRoomByReservationDto checkinRoomByReservationDto) { diff --git a/EOM.TSHotelManagement.API/Controllers/Business/Room/RoomTypeController.cs b/EOM.TSHotelManagement.API/Controllers/Business/Room/RoomTypeController.cs index 4574853d43609c04b3e026a18a562edaf111f0af..0d6e7fe109ed665374349de4eff02303b92b5cea 100644 --- a/EOM.TSHotelManagement.API/Controllers/Business/Room/RoomTypeController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Business/Room/RoomTypeController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -22,7 +22,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roomconfig.view")] + [RequirePermission("roomconfig.selectroomtypesall")] [HttpGet] public ListOutputDto SelectRoomTypesAll([FromQuery] ReadRoomTypeInputDto inputDto) { @@ -34,7 +34,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roomconfig.view")] + [RequirePermission("roomconfig.selectroomtypebyroomno")] [HttpGet] public SingleOutputDto SelectRoomTypeByRoomNo([FromQuery] ReadRoomTypeInputDto inputDto) { @@ -46,7 +46,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roomconfig.create")] + [RequirePermission("roomconfig.insertroomtype")] [HttpPost] public BaseResponse InsertRoomType([FromBody] CreateRoomTypeInputDto inputDto) { @@ -58,7 +58,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roomconfig.update")] + [RequirePermission("roomconfig.updateroomtype")] [HttpPost] public BaseResponse UpdateRoomType([FromBody] UpdateRoomTypeInputDto inputDto) { @@ -70,7 +70,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("roomconfig.delete")] + [RequirePermission("roomconfig.deleteroomtype")] [HttpPost] public BaseResponse DeleteRoomType([FromBody] DeleteRoomTypeInputDto inputDto) { diff --git a/EOM.TSHotelManagement.API/Controllers/Business/Sellthing/SellthingController.cs b/EOM.TSHotelManagement.API/Controllers/Business/Sellthing/SellthingController.cs index 6ece820020ef7f22c59fa85365a67ed9f764d55d..85d0125bd8ee3c9d2cf35846c4cc41a8e58e640e 100644 --- a/EOM.TSHotelManagement.API/Controllers/Business/Sellthing/SellthingController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Business/Sellthing/SellthingController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -22,7 +22,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("goodsmanagement.view")] + [RequirePermission("goodsmanagement.selectsellthingall")] [HttpGet] public ListOutputDto SelectSellThingAll([FromQuery] ReadSellThingInputDto sellThing = null) { @@ -34,7 +34,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("goodsmanagement.update")] + [RequirePermission("goodsmanagement.updatesellthing")] [HttpPost] public BaseResponse UpdateSellThing([FromBody] UpdateSellThingInputDto updateSellThingInputDto) { @@ -42,11 +42,11 @@ namespace EOM.TSHotelManagement.WebApi.Controllers } /// - /// 撤回客户消费信息 + /// 删除商品信息 /// /// /// - [RequirePermission("goodsmanagement.delete")] + [RequirePermission("goodsmanagement.deletesellthing")] [HttpPost] public BaseResponse DeleteSellthing([FromBody] DeleteSellThingInputDto deleteSellThingInputDto) { @@ -58,7 +58,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("goodsmanagement.view")] + [RequirePermission("goodsmanagement.selectsellthingbynameandprice")] [HttpGet] public SingleOutputDto SelectSellThingByNameAndPrice([FromQuery] ReadSellThingInputDto readSellThingInputDto) { @@ -70,7 +70,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("goodsmanagement.create")] + [RequirePermission("goodsmanagement.insertsellthing")] [HttpPost] public BaseResponse InsertSellThing([FromBody] CreateSellThingInputDto st) { diff --git a/EOM.TSHotelManagement.API/Controllers/Business/Spend/SpendController.cs b/EOM.TSHotelManagement.API/Controllers/Business/Spend/SpendController.cs index ed91fddab292566f3316f1e5a8fcc67060776c60..1cf5bfd797b3b149a9538b344fa2979aa26cf6d2 100644 --- a/EOM.TSHotelManagement.API/Controllers/Business/Spend/SpendController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Business/Spend/SpendController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -22,7 +22,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("customerspend.view")] + [RequirePermission("customerspend.selectspendbyroomno")] [HttpGet] public ListOutputDto SelectSpendByRoomNo([FromQuery] ReadSpendInputDto inputDto) { @@ -34,7 +34,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("customerspend.view")] + [RequirePermission("customerspend.selethistoryspendinfoall")] [HttpGet] public ListOutputDto SeletHistorySpendInfoAll([FromQuery] ReadSpendInputDto inputDto) { @@ -45,7 +45,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询消费的所有信息 /// /// - [RequirePermission("customerspend.view")] + [RequirePermission("customerspend.selectspendinfoall")] [HttpGet] public ListOutputDto SelectSpendInfoAll([FromQuery] ReadSpendInputDto readSpendInputDto) { @@ -57,7 +57,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("customerspend.view")] + [RequirePermission("customerspend.sumconsumptionamount")] [HttpGet] public SingleOutputDto SumConsumptionAmount([FromQuery] ReadSpendInputDto inputDto) { @@ -69,7 +69,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("customerspend.delete")] + [RequirePermission("customerspend.undocustomerspend")] [HttpPost] public BaseResponse UndoCustomerSpend([FromBody] UpdateSpendInputDto updateSpendInputDto) { @@ -81,7 +81,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("customerspend.create")] + [RequirePermission("customerspend.addcustomerspend")] [HttpPost] public BaseResponse AddCustomerSpend([FromBody] AddCustomerSpendInputDto addCustomerSpendInputDto) { @@ -93,7 +93,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("customerspend.update")] + [RequirePermission("customerspend.updspendinfo")] [HttpPost] public BaseResponse UpdSpendInfo([FromBody] UpdateSpendInputDto inputDto) { diff --git a/EOM.TSHotelManagement.API/Controllers/Dashboard/DashboardController.cs b/EOM.TSHotelManagement.API/Controllers/Dashboard/DashboardController.cs index 13bb8ccf64a766e850278ad9828eed6ecead5362..5268b049b9b9be6ba5d4fc3680c24f00c6daa85b 100644 --- a/EOM.TSHotelManagement.API/Controllers/Dashboard/DashboardController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Dashboard/DashboardController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -18,7 +18,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 获取房间统计信息 /// /// - [RequirePermission("dashboard.view")] + [RequirePermission("dashboard.roomstatistics")] [HttpGet] public SingleOutputDto RoomStatistics() { @@ -29,7 +29,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 获取业务统计信息 /// /// - [RequirePermission("dashboard.view")] + [RequirePermission("dashboard.businessstatistics")] [HttpGet] public SingleOutputDto BusinessStatistics() { @@ -40,7 +40,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 获取后勤统计信息 /// /// - [RequirePermission("dashboard.view")] + [RequirePermission("dashboard.logisticsstatistics")] [HttpGet] public SingleOutputDto LogisticsStatistics() { @@ -51,7 +51,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 获取人事统计信息 /// /// - [RequirePermission("dashboard.view")] + [RequirePermission("dashboard.humanresourcesstatistics")] [HttpGet] public SingleOutputDto HumanResourcesStatistics() { diff --git a/EOM.TSHotelManagement.API/Controllers/Employee/Check/EmployeeCheckController.cs b/EOM.TSHotelManagement.API/Controllers/Employee/Check/EmployeeCheckController.cs index da0585b8d05d0b49234fc46fa1e3f6bb6bb2cea2..175e481df3c3fda63772eb6e6620cad308328902 100644 --- a/EOM.TSHotelManagement.API/Controllers/Employee/Check/EmployeeCheckController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Employee/Check/EmployeeCheckController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -22,7 +22,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.view")] + [RequirePermission("staffmanagement.selectcheckinfobyemployeeid")] [HttpGet] public ListOutputDto SelectCheckInfoByEmployeeId([FromQuery] ReadEmployeeCheckInputDto inputDto) { @@ -34,7 +34,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.view")] + [RequirePermission("staffmanagement.selectworkercheckdaysumbyemployeeid")] [HttpGet] public SingleOutputDto SelectWorkerCheckDaySumByEmployeeId([FromQuery] ReadEmployeeCheckInputDto inputDto) { @@ -46,7 +46,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.view")] + [RequirePermission("staffmanagement.selecttodaycheckinfobyworkerno")] [HttpGet] public SingleOutputDto SelectToDayCheckInfoByWorkerNo([FromQuery] ReadEmployeeCheckInputDto inputDto) { @@ -58,7 +58,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.create")] + [RequirePermission("staffmanagement.addcheckinfo")] [HttpPost] public BaseResponse AddCheckInfo([FromBody] CreateEmployeeCheckInputDto workerCheck) { diff --git a/EOM.TSHotelManagement.API/Controllers/Employee/EmployeeController.cs b/EOM.TSHotelManagement.API/Controllers/Employee/EmployeeController.cs index 85007ae45cb6eff0b0d43a61ac97666aaffc1cc1..4d8a9227c9ecf6efb8849d86aaf07fe43a80fa1b 100644 --- a/EOM.TSHotelManagement.API/Controllers/Employee/EmployeeController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Employee/EmployeeController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Authorization; @@ -24,7 +24,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.update")] + [RequirePermission("staffmanagement.updateemployee")] [HttpPost] public BaseResponse UpdateEmployee([FromBody] UpdateEmployeeInputDto worker) { @@ -36,7 +36,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.status")] + [RequirePermission("staffmanagement.manageremployeeaccount")] [HttpPost] public BaseResponse ManagerEmployeeAccount([FromBody] UpdateEmployeeInputDto worker) { @@ -48,7 +48,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.create")] + [RequirePermission("staffmanagement.addemployee")] [HttpPost] public BaseResponse AddEmployee([FromBody] CreateEmployeeInputDto worker) { @@ -60,7 +60,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.view")] + [RequirePermission("staffmanagement.selectemployeeall")] [HttpGet] public ListOutputDto SelectEmployeeAll([FromQuery] ReadEmployeeInputDto inputDto) { @@ -72,7 +72,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.view")] + [RequirePermission("staffmanagement.selectemployeeinfobyemployeeid")] [HttpGet] public SingleOutputDto SelectEmployeeInfoByEmployeeId([FromQuery] ReadEmployeeInputDto inputDto) { @@ -96,7 +96,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 获取当前员工账号的 2FA 状态 /// /// - [RequirePermission("staffmanagement.get2fa")] + [RequirePermission("staffmanagement.gettwofactorstatus")] [HttpGet] public SingleOutputDto GetTwoFactorStatus() { @@ -107,7 +107,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 生成当前员工账号的 2FA 绑定信息 /// /// - [RequirePermission("staffmanagement.generate2fa")] + [RequirePermission("staffmanagement.generatetwofactorsetup")] [HttpPost] public SingleOutputDto GenerateTwoFactorSetup() { @@ -119,7 +119,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.enable2fa")] + [RequirePermission("staffmanagement.enabletwofactor")] [HttpPost] public SingleOutputDto EnableTwoFactor([FromBody] TwoFactorCodeInputDto inputDto) { @@ -131,7 +131,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.disable2fa")] + [RequirePermission("staffmanagement.disabletwofactor")] [HttpPost] public BaseResponse DisableTwoFactor([FromBody] TwoFactorCodeInputDto inputDto) { @@ -143,7 +143,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.recovery2fa")] + [RequirePermission("staffmanagement.regeneratetwofactorrecoverycodes")] [HttpPost] public SingleOutputDto RegenerateTwoFactorRecoveryCodes([FromBody] TwoFactorCodeInputDto inputDto) { @@ -155,7 +155,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.reset")] + [RequirePermission("staffmanagement.updateemployeeaccountpassword")] [HttpPost] public BaseResponse UpdateEmployeeAccountPassword([FromBody] UpdateEmployeeInputDto updateEmployeeInputDto) { @@ -166,7 +166,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.update")] + [RequirePermission("staffmanagement.resetemployeeaccountpassword")] [HttpPost] public BaseResponse ResetEmployeeAccountPassword([FromBody] UpdateEmployeeInputDto updateEmployeeInputDto) { diff --git a/EOM.TSHotelManagement.API/Controllers/Employee/History/EmployeeHistoryController.cs b/EOM.TSHotelManagement.API/Controllers/Employee/History/EmployeeHistoryController.cs index 68ddde5fe49a7e1f7f83c4895d0ce1ae3cc31b94..26c4c8b1da808f09dd0bef2f2404f72e26eb0f08 100644 --- a/EOM.TSHotelManagement.API/Controllers/Employee/History/EmployeeHistoryController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Employee/History/EmployeeHistoryController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -22,7 +22,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.create")] + [RequirePermission("staffmanagement.addhistorybyemployeeid")] [HttpPost] public BaseResponse AddHistoryByEmployeeId([FromBody] CreateEmployeeHistoryInputDto workerHistory) { @@ -34,7 +34,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.view")] + [RequirePermission("staffmanagement.selecthistorybyemployeeid")] [HttpGet] public ListOutputDto SelectHistoryByEmployeeId([FromQuery] ReadEmployeeHistoryInputDto inputDto) { diff --git a/EOM.TSHotelManagement.API/Controllers/Employee/Photo/EmployeePhotoController.cs b/EOM.TSHotelManagement.API/Controllers/Employee/Photo/EmployeePhotoController.cs index 4583b993a3ff74db20a6922f54571689a7a9d0cf..3f39185d41cfabf44d180dfa32a7df3d27cd28b2 100644 --- a/EOM.TSHotelManagement.API/Controllers/Employee/Photo/EmployeePhotoController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Employee/Photo/EmployeePhotoController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Http; @@ -23,7 +23,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.view")] + [RequirePermission("staffmanagement.employeephoto")] [HttpGet] public SingleOutputDto EmployeePhoto([FromQuery] ReadEmployeePhotoInputDto inputDto) { @@ -36,7 +36,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.create")] + [RequirePermission("staffmanagement.insertworkerphoto")] [HttpPost] public SingleOutputDto InsertWorkerPhoto([FromForm] CreateEmployeePhotoInputDto inputDto, IFormFile file) { @@ -48,7 +48,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.delete")] + [RequirePermission("staffmanagement.deleteworkerphoto")] [HttpPost] public BaseResponse DeleteWorkerPhoto([FromBody] DeleteEmployeePhotoInputDto inputDto) { @@ -60,7 +60,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("staffmanagement.update")] + [RequirePermission("staffmanagement.updateworkerphoto")] [HttpPost] public BaseResponse UpdateWorkerPhoto([FromBody] UpdateEmployeePhotoInputDto inputDto) { diff --git a/EOM.TSHotelManagement.API/Controllers/SystemManagement/Administrator/AdminController.cs b/EOM.TSHotelManagement.API/Controllers/SystemManagement/Administrator/AdminController.cs index 15e0112f0088aef526cb439638129970d2c5a546..936525e118bba37380f802bcb6cfd1739ce09b52 100644 --- a/EOM.TSHotelManagement.API/Controllers/SystemManagement/Administrator/AdminController.cs +++ b/EOM.TSHotelManagement.API/Controllers/SystemManagement/Administrator/AdminController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Contract.SystemManagement.Dto.Permission; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; @@ -44,7 +44,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 获取当前管理员账号的 2FA 状态 /// /// - [RequirePermission("system:admin:get2fa")] + [RequirePermission("system:admin:gettwofactorstatus")] [HttpGet] public SingleOutputDto GetTwoFactorStatus() { @@ -55,7 +55,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 生成当前管理员账号的 2FA 绑定信息 /// /// - [RequirePermission("system:admin:generate2fa")] + [RequirePermission("system:admin:generatetwofactorsetup")] [HttpPost] public SingleOutputDto GenerateTwoFactorSetup() { @@ -67,7 +67,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:admin:enable2fa")] + [RequirePermission("system:admin:enabletwofactor")] [HttpPost] public SingleOutputDto EnableTwoFactor([FromBody] TwoFactorCodeInputDto inputDto) { @@ -79,7 +79,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:admin:disable2fa")] + [RequirePermission("system:admin:disabletwofactor")] [HttpPost] public BaseResponse DisableTwoFactor([FromBody] TwoFactorCodeInputDto inputDto) { @@ -91,7 +91,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:admin:recovery2fa")] + [RequirePermission("system:admin:regeneratetwofactorrecoverycodes")] [HttpPost] public SingleOutputDto RegenerateTwoFactorRecoveryCodes([FromBody] TwoFactorCodeInputDto inputDto) { @@ -102,7 +102,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 获取所有管理员列表 /// /// - [RequirePermission("system:admin:list")] + [RequirePermission("system:admin:getalladminlist")] [HttpGet] public ListOutputDto GetAllAdminList(ReadAdministratorInputDto readAdministratorInputDto) { @@ -114,7 +114,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:admin:create")] + [RequirePermission("system:admin:addadmin")] [HttpPost] public BaseResponse AddAdmin([FromBody] CreateAdministratorInputDto admin) { @@ -126,7 +126,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:admin:update")] + [RequirePermission("system:admin:updadmin")] [HttpPost] public BaseResponse UpdAdmin([FromBody] UpdateAdministratorInputDto updateAdministratorInputDto) { @@ -138,7 +138,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:admin:delete")] + [RequirePermission("system:admin:deladmin")] [HttpPost] public BaseResponse DelAdmin([FromBody] DeleteAdministratorInputDto deleteAdministratorInputDto) { @@ -149,7 +149,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 获取所有管理员类型 /// /// - [RequirePermission("system:admintype:list")] + [RequirePermission("system:admintype:getalladmintypes")] [HttpGet] public ListOutputDto GetAllAdminTypes(ReadAdministratorTypeInputDto readAdministratorTypeInputDto) { @@ -161,7 +161,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:admintype:create")] + [RequirePermission("system:admintype:addadmintype")] [HttpPost] public BaseResponse AddAdminType([FromBody] CreateAdministratorTypeInputDto createAdministratorTypeInputDto) { @@ -173,7 +173,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:admintype:update")] + [RequirePermission("system:admintype:updadmintype")] [HttpPost] public BaseResponse UpdAdminType([FromBody] UpdateAdministratorTypeInputDto updateAdministratorTypeInputDto) { @@ -185,7 +185,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:admintype:delete")] + [RequirePermission("system:admintype:deladmintype")] [HttpPost] public BaseResponse DelAdminType([FromBody] DeleteAdministratorTypeInputDto deleteAdministratorTypeInputDto) { @@ -197,7 +197,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:user:assign")] + [RequirePermission("system:user:admin:assignuserroles")] [HttpPost] public BaseResponse AssignUserRoles([FromBody] AssignUserRolesInputDto input) { @@ -207,31 +207,31 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 读取指定用户已分配的角色编码集合 /// - /// 用户编码 + /// 用户编码请求体 /// 角色编码集合(RoleNumber 列表) - [RequirePermission("system:user:assign.view")] - [HttpGet] - public ListOutputDto ReadUserRoles([FromQuery] string userNumber) + [RequirePermission("system:user:admin.readuserroles")] + [HttpPost] + public ListOutputDto ReadUserRoles([FromBody] ReadByUserNumberInputDto input) { - return adminService.ReadUserRoles(userNumber); + return adminService.ReadUserRoles(input.UserNumber); } /// /// 读取指定用户的“角色-权限”明细(来自 RolePermission 关联,并联到 Permission 得到权限码与名称) /// - /// 用户编码 + /// 用户编码请求体 /// 明细列表(包含 RoleNumber、PermissionNumber、PermissionName、MenuKey) - [RequirePermission("system:user:assign.view")] - [HttpGet] - public ListOutputDto ReadUserRolePermissions([FromQuery] string userNumber) + [RequirePermission("system:user:admin.readuserrolepermissions")] + [HttpPost] + public ListOutputDto ReadUserRolePermissions([FromBody] ReadByUserNumberInputDto input) { - return adminService.ReadUserRolePermissions(userNumber); + return adminService.ReadUserRolePermissions(input.UserNumber); } /// /// 为指定用户分配“直接权限”(通过专属角色 R-USER-{UserNumber} 写入 RolePermission,全量覆盖) /// - [RequirePermission("system:user:assign")] + [RequirePermission("system:user:admin:assignuserpermissions")] [HttpPost] public BaseResponse AssignUserPermissions([FromBody] AssignUserPermissionsInputDto input) { @@ -241,11 +241,11 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 读取指定用户的“直接权限”(仅来自专属角色 R-USER-{UserNumber} 的权限编码列表) /// - [RequirePermission("system:user:assign.view")] - [HttpGet] - public ListOutputDto ReadUserDirectPermissions([FromQuery] string userNumber) + [RequirePermission("system:user:admin.readuserdirectpermissions")] + [HttpPost] + public ListOutputDto ReadUserDirectPermissions([FromBody] ReadByUserNumberInputDto input) { - return adminService.ReadUserDirectPermissions(userNumber); + return adminService.ReadUserDirectPermissions(input.UserNumber); } /// diff --git a/EOM.TSHotelManagement.API/Controllers/SystemManagement/Base/BaseController.cs b/EOM.TSHotelManagement.API/Controllers/SystemManagement/Base/BaseController.cs index 5d299c779130f3c3bf5133c306c7acc554fe6102..7c626b89c7ec33d81b35b25d79174771cda3c6b5 100644 --- a/EOM.TSHotelManagement.API/Controllers/SystemManagement/Base/BaseController.cs +++ b/EOM.TSHotelManagement.API/Controllers/SystemManagement/Base/BaseController.cs @@ -1,5 +1,6 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; +using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; namespace EOM.TSHotelManagement.WebApi.Controllers @@ -67,6 +68,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers #region 职位模块 + [RequirePermission("position.view")] [HttpGet] public ListOutputDto SelectPositionAll([FromQuery] ReadPositionInputDto position = null) { @@ -79,18 +81,21 @@ namespace EOM.TSHotelManagement.WebApi.Controllers return baseService.SelectPosition(position); } + [RequirePermission("position.create")] [HttpPost] public BaseResponse AddPosition([FromBody] CreatePositionInputDto position) { return baseService.AddPosition(position); } + [RequirePermission("position.delete")] [HttpPost] public BaseResponse DelPosition([FromBody] DeletePositionInputDto position) { return baseService.DelPosition(position); } + [RequirePermission("position.update")] [HttpPost] public BaseResponse UpdPosition([FromBody] UpdatePositionInputDto position) { @@ -101,6 +106,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers #region 民族模块 + [RequirePermission("nation.view")] [HttpGet] public ListOutputDto SelectNationAll([FromQuery] ReadNationInputDto nation = null) { @@ -113,18 +119,21 @@ namespace EOM.TSHotelManagement.WebApi.Controllers return baseService.SelectNation(nation); } + [RequirePermission("nation.create")] [HttpPost] public BaseResponse AddNation([FromBody] CreateNationInputDto nation) { return baseService.AddNation(nation); } + [RequirePermission("nation.delete")] [HttpPost] public BaseResponse DelNation([FromBody] DeleteNationInputDto nation) { return baseService.DelNation(nation); } + [RequirePermission("nation.update")] [HttpPost] public BaseResponse UpdNation([FromBody] UpdateNationInputDto nation) { @@ -135,6 +144,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers #region 学历模块 + [RequirePermission("qualification.view")] [HttpGet] public ListOutputDto SelectEducationAll([FromQuery] ReadEducationInputDto education = null) { @@ -147,18 +157,21 @@ namespace EOM.TSHotelManagement.WebApi.Controllers return baseService.SelectEducation(education); } + [RequirePermission("qualification.create")] [HttpPost] public BaseResponse AddEducation([FromBody] CreateEducationInputDto education) { return baseService.AddEducation(education); } + [RequirePermission("qualification.delete")] [HttpPost] public BaseResponse DelEducation([FromBody] DeleteEducationInputDto education) { return baseService.DelEducation(education); } + [RequirePermission("qualification.update")] [HttpPost] public BaseResponse UpdEducation([FromBody] UpdateEducationInputDto education) { @@ -169,6 +182,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers #region 部门模块 + [RequirePermission("department.view")] [HttpGet] public ListOutputDto SelectDeptAllCanUse() { @@ -181,24 +195,28 @@ namespace EOM.TSHotelManagement.WebApi.Controllers return baseService.SelectDeptAll(readDepartmentInputDto); } + [RequirePermission("department.view")] [HttpGet] public SingleOutputDto SelectDept([FromQuery] ReadDepartmentInputDto dept) { return baseService.SelectDept(dept); } + [RequirePermission("department.create")] [HttpPost] public BaseResponse AddDept([FromBody] CreateDepartmentInputDto dept) { return baseService.AddDept(dept); } + [RequirePermission("department.delete")] [HttpPost] public BaseResponse DelDept([FromBody] DeleteDepartmentInputDto dept) { return baseService.DelDept(dept); } + [RequirePermission("department.update")] [HttpPost] public BaseResponse UpdDept([FromBody] UpdateDepartmentInputDto dept) { @@ -209,6 +227,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers #region 客户类型模块 + [RequirePermission("customertype.view")] [HttpGet] public ListOutputDto SelectCustoTypeAllCanUse() { @@ -221,24 +240,28 @@ namespace EOM.TSHotelManagement.WebApi.Controllers return baseService.SelectCustoTypeAll(readCustoTypeInputDto); } + [RequirePermission("customertype.view")] [HttpGet] public SingleOutputDto SelectCustoTypeByTypeId([FromQuery] ReadCustoTypeInputDto custoType) { return baseService.SelectCustoTypeByTypeId(custoType); } + [RequirePermission("customertype.create")] [HttpPost] public BaseResponse InsertCustoType([FromBody] CreateCustoTypeInputDto custoType) { return baseService.InsertCustoType(custoType); } + [RequirePermission("customertype.delete")] [HttpPost] public BaseResponse DeleteCustoType([FromBody] DeleteCustoTypeInputDto custoType) { return baseService.DeleteCustoType(custoType); } + [RequirePermission("customertype.update")] [HttpPost] public BaseResponse UpdateCustoType([FromBody] UpdateCustoTypeInputDto custoType) { @@ -249,6 +272,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers #region 证件类型模块 + [RequirePermission("passport.view")] [HttpGet] public ListOutputDto SelectPassPortTypeAllCanUse() { @@ -261,24 +285,28 @@ namespace EOM.TSHotelManagement.WebApi.Controllers return baseService.SelectPassPortTypeAll(readPassportTypeInputDto); } + [RequirePermission("passport.view")] [HttpGet] public SingleOutputDto SelectPassPortTypeByTypeId([FromQuery] ReadPassportTypeInputDto passPortType) { return baseService.SelectPassPortTypeByTypeId(passPortType); } + [RequirePermission("passport.create")] [HttpPost] public BaseResponse InsertPassPortType([FromBody] CreatePassportTypeInputDto passPortType) { return baseService.InsertPassPortType(passPortType); } + [RequirePermission("passport.delete")] [HttpPost] public BaseResponse DeletePassPortType([FromBody] DeletePassportTypeInputDto portType) { return baseService.DeletePassPortType(portType); } + [RequirePermission("passport.update")] [HttpPost] public BaseResponse UpdatePassPortType([FromBody] UpdatePassportTypeInputDto portType) { @@ -333,6 +361,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询所有公告类型 /// /// + [RequirePermission("noticetype.view")] [HttpGet] public ListOutputDto SelectAppointmentNoticeTypeAll([FromQuery] ReadAppointmentNoticeTypeInputDto readAppointmentNoticeTypeInputDto) { @@ -344,6 +373,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// + [RequirePermission("noticetype.create")] [HttpPost] public BaseResponse CreateAppointmentNoticeType([FromBody] CreateAppointmentNoticeTypeInputDto createAppointmentNoticeTypeInputDto) { @@ -355,6 +385,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// + [RequirePermission("noticetype.delete")] [HttpPost] public BaseResponse DeleteAppointmentNoticeType([FromBody] DeleteAppointmentNoticeTypeInputDto deleteAppointmentNoticeTypeInputDto) { @@ -366,6 +397,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// + [RequirePermission("noticetype.update")] [HttpPost] public BaseResponse UpdateAppointmentNoticeType([FromBody] UpdateAppointmentNoticeTypeInputDto updateAppointmentNoticeTypeInputDto) { diff --git a/EOM.TSHotelManagement.API/Controllers/SystemManagement/CustomerPermission/CustomerPermissionController.cs b/EOM.TSHotelManagement.API/Controllers/SystemManagement/CustomerPermission/CustomerPermissionController.cs index 8595ee3de1eac64aaee39f685c3a10e70325cb30..d10377924aad9985b6c9b76ef398e24b120b8fee 100644 --- a/EOM.TSHotelManagement.API/Controllers/SystemManagement/CustomerPermission/CustomerPermissionController.cs +++ b/EOM.TSHotelManagement.API/Controllers/SystemManagement/CustomerPermission/CustomerPermissionController.cs @@ -11,11 +11,11 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 客户组权限分配接口(与管理员一致的 5 个接口) /// 前端将调用: - /// - POST /Customer/AssignUserRoles - /// - GET /Customer/ReadUserRoles?userNumber=... - /// - GET /Customer/ReadUserRolePermissions?userNumber=... - /// - POST /Customer/AssignUserPermissions - /// - GET /Customer/ReadUserDirectPermissions?userNumber=... + /// - POST /CustomerPermission/AssignUserRoles + /// - POST /CustomerPermission/ReadUserRoles + /// - POST /CustomerPermission/ReadUserRolePermissions + /// - POST /CustomerPermission/AssignUserPermissions + /// - POST /CustomerPermission/ReadUserDirectPermissions /// public class CustomerPermissionController : ControllerBase { @@ -31,7 +31,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 为客户分配角色(全量覆盖) /// - [RequirePermission("system:user:assign")] + [RequirePermission("system:user:customer:assignuserroles")] [HttpPost] public BaseResponse AssignUserRoles([FromBody] AssignUserRolesInputDto input) { @@ -43,11 +43,11 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 读取客户已分配的角色编码集合 /// - [RequirePermission("system:user:assign.view")] - [HttpGet] - public ListOutputDto ReadUserRoles([FromQuery] string userNumber) + [RequirePermission("system:user:customer.readuserroles")] + [HttpPost] + public ListOutputDto ReadUserRoles([FromBody] ReadByUserNumberInputDto input) { - return customerPermService.ReadUserRoles(userNumber); + return customerPermService.ReadUserRoles(input.UserNumber); } /// filename OR language.declaration() @@ -55,11 +55,11 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 读取客户“角色-权限”明细 /// - [RequirePermission("system:user:assign.view")] - [HttpGet] - public ListOutputDto ReadUserRolePermissions([FromQuery] string userNumber) + [RequirePermission("system:user:customer.readuserrolepermissions")] + [HttpPost] + public ListOutputDto ReadUserRolePermissions([FromBody] ReadByUserNumberInputDto input) { - return customerPermService.ReadUserRolePermissions(userNumber); + return customerPermService.ReadUserRolePermissions(input.UserNumber); } /// filename OR language.declaration() @@ -67,7 +67,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 为客户分配“直接权限”(R-USER-{UserNumber} 全量覆盖) /// - [RequirePermission("system:user:assign")] + [RequirePermission("system:user:customer:assignuserpermissions")] [HttpPost] public BaseResponse AssignUserPermissions([FromBody] AssignUserPermissionsInputDto input) { @@ -79,11 +79,11 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 读取客户“直接权限”权限编码集合(来自 R-USER-{UserNumber}) /// - [RequirePermission("system:user:assign.view")] - [HttpGet] - public ListOutputDto ReadUserDirectPermissions([FromQuery] string userNumber) + [RequirePermission("system:user:customer.readuserdirectpermissions")] + [HttpPost] + public ListOutputDto ReadUserDirectPermissions([FromBody] ReadByUserNumberInputDto input) { - return customerPermService.ReadUserDirectPermissions(userNumber); + return customerPermService.ReadUserDirectPermissions(input.UserNumber); } } -} \ No newline at end of file +} diff --git a/EOM.TSHotelManagement.API/Controllers/SystemManagement/EmployeePermission/EmployeeController.cs b/EOM.TSHotelManagement.API/Controllers/SystemManagement/EmployeePermission/EmployeeController.cs index 24ee02060222cb5415bcc3649b49445d56b30341..05f3b05ae6e7fd09b91cc346cff28d114cd905a0 100644 --- a/EOM.TSHotelManagement.API/Controllers/SystemManagement/EmployeePermission/EmployeeController.cs +++ b/EOM.TSHotelManagement.API/Controllers/SystemManagement/EmployeePermission/EmployeeController.cs @@ -11,11 +11,11 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 员工组权限分配接口(与管理员一致的 5 个接口) /// 前端将调用: - /// - POST /Employee/AssignUserRoles - /// - GET /Employee/ReadUserRoles?userNumber=... - /// - GET /Employee/ReadUserRolePermissions?userNumber=... - /// - POST /Employee/AssignUserPermissions - /// - GET /Employee/ReadUserDirectPermissions?userNumber=... + /// - POST /EmployeePermission/AssignUserRoles + /// - POST /EmployeePermission/ReadUserRoles + /// - POST /EmployeePermission/ReadUserRolePermissions + /// - POST /EmployeePermission/AssignUserPermissions + /// - POST /EmployeePermission/ReadUserDirectPermissions /// public class EmployeePermissionController : ControllerBase { @@ -31,7 +31,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 为员工分配角色(全量覆盖) /// - [RequirePermission("system:user:assign")] + [RequirePermission("system:user:employee:assignuserroles")] [HttpPost] public BaseResponse AssignUserRoles([FromBody] AssignUserRolesInputDto input) { @@ -43,11 +43,11 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 读取员工已分配的角色编码集合 /// - [RequirePermission("system:user:assign.view")] - [HttpGet] - public ListOutputDto ReadUserRoles([FromQuery] string userNumber) + [RequirePermission("system:user:employee.readuserroles")] + [HttpPost] + public ListOutputDto ReadUserRoles([FromBody] ReadByUserNumberInputDto input) { - return employeePermService.ReadUserRoles(userNumber); + return employeePermService.ReadUserRoles(input.UserNumber); } /// filename OR language.declaration() @@ -55,11 +55,11 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 读取员工“角色-权限”明细 /// - [RequirePermission("system:user:assign.view")] - [HttpGet] - public ListOutputDto ReadUserRolePermissions([FromQuery] string userNumber) + [RequirePermission("system:user:employee.readuserrolepermissions")] + [HttpPost] + public ListOutputDto ReadUserRolePermissions([FromBody] ReadByUserNumberInputDto input) { - return employeePermService.ReadUserRolePermissions(userNumber); + return employeePermService.ReadUserRolePermissions(input.UserNumber); } /// filename OR language.declaration() @@ -67,7 +67,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 为员工分配“直接权限”(R-USER-{UserNumber} 全量覆盖) /// - [RequirePermission("system:user:assign")] + [RequirePermission("system:user:employee:assignuserpermissions")] [HttpPost] public BaseResponse AssignUserPermissions([FromBody] AssignUserPermissionsInputDto input) { @@ -79,11 +79,11 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 读取员工“直接权限”权限编码集合(来自 R-USER-{UserNumber}) /// - [RequirePermission("system:user:assign.view")] - [HttpGet] - public ListOutputDto ReadUserDirectPermissions([FromQuery] string userNumber) + [RequirePermission("system:user:employee.readuserdirectpermissions")] + [HttpPost] + public ListOutputDto ReadUserDirectPermissions([FromBody] ReadByUserNumberInputDto input) { - return employeePermService.ReadUserDirectPermissions(userNumber); + return employeePermService.ReadUserDirectPermissions(input.UserNumber); } } -} \ No newline at end of file +} diff --git a/EOM.TSHotelManagement.API/Controllers/SystemManagement/Menu/MenuController.cs b/EOM.TSHotelManagement.API/Controllers/SystemManagement/Menu/MenuController.cs index b191d5a57290b6a0756f9c2912a9e3d9dc60e20d..3e3fdb0378891def4d99d03be5169dec8b77a34e 100644 --- a/EOM.TSHotelManagement.API/Controllers/SystemManagement/Menu/MenuController.cs +++ b/EOM.TSHotelManagement.API/Controllers/SystemManagement/Menu/MenuController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -21,7 +21,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询所有菜单信息 /// /// - [RequirePermission("menumanagement.view")] + [RequirePermission("menumanagement.selectmenuall")] [HttpGet] public ListOutputDto SelectMenuAll(ReadMenuInputDto readMenuInputDto) { @@ -32,7 +32,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 构建菜单树 /// /// - [RequirePermission("menumanagement.view")] + [RequirePermission("menumanagement.buildmenuall")] [HttpPost] public ListOutputDto BuildMenuAll([FromBody] BaseInputDto baseInputDto) { @@ -44,7 +44,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("menumanagement.create")] + [RequirePermission("menumanagement.insertmenu")] [HttpPost] public BaseResponse InsertMenu([FromBody] CreateMenuInputDto menu) { @@ -56,7 +56,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("menumanagement.update")] + [RequirePermission("menumanagement.updatemenu")] [HttpPost] public BaseResponse UpdateMenu([FromBody] UpdateMenuInputDto menu) { @@ -68,7 +68,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("menumanagement.delete")] + [RequirePermission("menumanagement.deletemenu")] [HttpPost] public BaseResponse DeleteMenu([FromBody] DeleteMenuInputDto menu) { diff --git a/EOM.TSHotelManagement.API/Controllers/SystemManagement/Permission/PermissionController.cs b/EOM.TSHotelManagement.API/Controllers/SystemManagement/Permission/PermissionController.cs index cb317314ce9cfd42779162b32a8f7743015ffe31..26e414bbba4c94e03be936d7623b6d019a637521 100644 --- a/EOM.TSHotelManagement.API/Controllers/SystemManagement/Permission/PermissionController.cs +++ b/EOM.TSHotelManagement.API/Controllers/SystemManagement/Permission/PermissionController.cs @@ -22,11 +22,11 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 查询条件 /// 权限列表 - [RequirePermission("system:user:assign.view")] - [HttpGet] - public ListOutputDto SelectPermissionList([FromQuery] ReadPermissionInputDto input) + [RequirePermission("system:user:assign.selectpermissionlist")] + [HttpPost] + public ListOutputDto SelectPermissionList([FromBody] ReadPermissionInputDto input) { return _permissionAppService.SelectPermissionList(input); } } -} \ No newline at end of file +} diff --git a/EOM.TSHotelManagement.API/Controllers/SystemManagement/Role/RoleController.cs b/EOM.TSHotelManagement.API/Controllers/SystemManagement/Role/RoleController.cs index 312e9f1737daa3e32b16e27c8414c3977394537d..fd271e2d3675c9899459762a7c9ed377c2c38dbf 100644 --- a/EOM.TSHotelManagement.API/Controllers/SystemManagement/Role/RoleController.cs +++ b/EOM.TSHotelManagement.API/Controllers/SystemManagement/Role/RoleController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Contract.SystemManagement.Dto.Permission; using EOM.TSHotelManagement.Contract.SystemManagement.Dto.Role; using EOM.TSHotelManagement.Service; @@ -21,7 +21,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:role:list")] + [RequirePermission("system:role:selectrolelist")] [HttpGet] public ListOutputDto SelectRoleList([FromQuery] ReadRoleInputDto readRoleInputDto) { @@ -33,7 +33,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:role:create")] + [RequirePermission("system:role:insertrole")] [HttpPost] public BaseResponse InsertRole([FromBody] CreateRoleInputDto createRoleInputDto) { @@ -45,7 +45,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:role:update")] + [RequirePermission("system:role:updaterole")] [HttpPost] public BaseResponse UpdateRole([FromBody] UpdateRoleInputDto updateRoleInputDto) { @@ -57,7 +57,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:role:delete")] + [RequirePermission("system:role:deleterole")] [HttpPost] public BaseResponse DeleteRole([FromBody] DeleteRoleInputDto deleteRoleInputDto) { @@ -69,7 +69,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("system:role:grant")] + [RequirePermission("system:role:grantrolepermissions")] [HttpPost] public BaseResponse GrantRolePermissions([FromBody] GrantRolePermissionsInputDto input) { @@ -79,30 +79,30 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// 读取指定角色已授予的权限编码集合 /// - /// 角色编码 - [RequirePermission("system:role:list")] - [HttpGet] - public ListOutputDto ReadRolePermissions([FromQuery] string roleNumber) + /// 角色编码请求体 + [RequirePermission("system:role:readrolepermissions")] + [HttpPost] + public ListOutputDto ReadRolePermissions([FromBody] ReadByRoleNumberInputDto input) { - return _roleAppService.ReadRolePermissions(roleNumber); + return _roleAppService.ReadRolePermissions(input.RoleNumber); } /// /// 读取隶属于指定角色的管理员用户编码集合 /// - /// 角色编码 - [RequirePermission("system:role:list")] - [HttpGet] - public ListOutputDto ReadRoleUsers([FromQuery] string roleNumber) + /// 角色编码请求体 + [RequirePermission("system:role:readroleusers")] + [HttpPost] + public ListOutputDto ReadRoleUsers([FromBody] ReadByRoleNumberInputDto input) { - return _roleAppService.ReadRoleUsers(roleNumber); + return _roleAppService.ReadRoleUsers(input.RoleNumber); } /// /// 为角色分配管理员(全量覆盖) /// /// 包含角色编码与管理员编码集合 - [RequirePermission("system:role:grant")] + [RequirePermission("system:role:assignroleusers")] [HttpPost] public BaseResponse AssignRoleUsers([FromBody] AssignRoleUsersInputDto input) { diff --git a/EOM.TSHotelManagement.API/Controllers/SystemManagement/SupervisionStatistics/SupervisionStatisticsController.cs b/EOM.TSHotelManagement.API/Controllers/SystemManagement/SupervisionStatistics/SupervisionStatisticsController.cs index 21c43568c883103f141863611327fade076d616d..b9351b7dd1e9ae70e4c9111e60b4b328c969228e 100644 --- a/EOM.TSHotelManagement.API/Controllers/SystemManagement/SupervisionStatistics/SupervisionStatisticsController.cs +++ b/EOM.TSHotelManagement.API/Controllers/SystemManagement/SupervisionStatistics/SupervisionStatisticsController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -22,7 +22,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("supervisioninfo.view")] + [RequirePermission("supervisioninfo.selectsupervisionstatisticsall")] [HttpGet] public ListOutputDto SelectSupervisionStatisticsAll([FromQuery] ReadSupervisionStatisticsInputDto inputDto) { @@ -34,7 +34,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("supervisioninfo.create")] + [RequirePermission("supervisioninfo.insertsupervisionstatistics")] [HttpPost] public BaseResponse InsertSupervisionStatistics([FromBody] CreateSupervisionStatisticsInputDto inputDto) { @@ -46,7 +46,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("supervisioninfo.update")] + [RequirePermission("supervisioninfo.updatesupervisionstatistics")] [HttpPost] public BaseResponse UpdateSupervisionStatistics([FromBody] UpdateSupervisionStatisticsInputDto inputDto) { @@ -58,7 +58,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("supervisioninfo.delete")] + [RequirePermission("supervisioninfo.deletesupervisionstatistics")] [HttpPost] public BaseResponse DeleteSupervisionStatistics([FromBody] DeleteSupervisionStatisticsInputDto inputDto) { diff --git a/EOM.TSHotelManagement.API/Controllers/SystemManagement/VipRule/VipRuleController.cs b/EOM.TSHotelManagement.API/Controllers/SystemManagement/VipRule/VipRuleController.cs index e1ace8be91be11c221d4d150330ec881ddcfe94c..460c37fb084ec54e9b5fe70dd2a6ead2c20776b6 100644 --- a/EOM.TSHotelManagement.API/Controllers/SystemManagement/VipRule/VipRuleController.cs +++ b/EOM.TSHotelManagement.API/Controllers/SystemManagement/VipRule/VipRuleController.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; @@ -22,7 +22,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("viplevel.view")] + [RequirePermission("viplevel.selectviprulelist")] [HttpGet] public ListOutputDto SelectVipRuleList([FromQuery] ReadVipLevelRuleInputDto inputDto) { @@ -34,7 +34,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("viplevel.view")] + [RequirePermission("viplevel.selectviprule")] [HttpGet] public SingleOutputDto SelectVipRule([FromQuery] ReadVipLevelRuleInputDto inputDto) { @@ -46,7 +46,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("viplevel.create")] + [RequirePermission("viplevel.addviprule")] [HttpPost] public BaseResponse AddVipRule([FromBody] CreateVipLevelRuleInputDto inputDto) { @@ -58,7 +58,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("viplevel.delete")] + [RequirePermission("viplevel.delviprule")] [HttpPost] public BaseResponse DelVipRule([FromBody] DeleteVipLevelRuleInputDto inputDto) { @@ -70,7 +70,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// - [RequirePermission("viplevel.update")] + [RequirePermission("viplevel.updviprule")] [HttpPost] public BaseResponse UpdVipRule([FromBody] UpdateVipLevelRuleInputDto inputDto) { diff --git a/EOM.TSHotelManagement.API/Controllers/Util/UtilityController.cs b/EOM.TSHotelManagement.API/Controllers/Util/UtilityController.cs index ad71e1ce22ac5b8e6989ddb56a103e88be123904..e89edacbe94723ce3fab4d8d1905da409cd864dc 100644 --- a/EOM.TSHotelManagement.API/Controllers/Util/UtilityController.cs +++ b/EOM.TSHotelManagement.API/Controllers/Util/UtilityController.cs @@ -1,5 +1,6 @@ -using EOM.TSHotelManagement.Contract; +using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Service; +using EOM.TSHotelManagement.WebApi.Authorization; using Microsoft.AspNetCore.Mvc; namespace EOM.TSHotelManagement.WebApi.Controllers @@ -42,6 +43,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// 查询所有操作日志 /// /// + [RequirePermission("operationlog.view")] [HttpGet] public ListOutputDto SelectOperationlogAll([FromQuery] ReadOperationLogInputDto readOperationLogInputDto) { @@ -53,6 +55,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// + [RequirePermission("requestlog.view")] [HttpGet] public ListOutputDto SelectRequestlogAll([FromQuery] ReadRequestLogInputDto readRequestLogInputDto) { @@ -64,6 +67,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// + [RequirePermission("requestlog.delete")] [HttpPost] public BaseResponse DeleteRequestlogByRange([FromBody] ReadRequestLogInputDto readRequestLogInputDto) { @@ -75,6 +79,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// + [RequirePermission("operationlog.delete")] [HttpPost] public BaseResponse DeleteOperationlogByRange([FromBody] ReadOperationLogInputDto readOperationLogInputDto) { @@ -86,6 +91,7 @@ namespace EOM.TSHotelManagement.WebApi.Controllers /// /// /// + [RequirePermission("operationlog.delete")] [HttpPost] public BaseResponse DeleteOperationlog([FromBody] DeleteOperationLogInputDto deleteOperationLogInputDto) { diff --git a/EOM.TSHotelManagement.API/Extensions/ApplicationExtensions.cs b/EOM.TSHotelManagement.API/Extensions/ApplicationExtensions.cs index 590b5a5fa9929a1dca59989cbf7ada95e35cf8d3..f3342a52482ace48f38036a44b7503bd6eb1b8d0 100644 --- a/EOM.TSHotelManagement.API/Extensions/ApplicationExtensions.cs +++ b/EOM.TSHotelManagement.API/Extensions/ApplicationExtensions.cs @@ -33,6 +33,7 @@ namespace EOM.TSHotelManagement.WebApi app.UseAuthorization(); app.UseAntiforgery(); app.UseRequestLogging(); + app.UseIdempotencyKey(); } /// @@ -103,4 +104,4 @@ namespace EOM.TSHotelManagement.WebApi }); } } -} \ No newline at end of file +} diff --git a/EOM.TSHotelManagement.API/Extensions/AutofacConfigExtensions.cs b/EOM.TSHotelManagement.API/Extensions/AutofacConfigExtensions.cs index cc3ded21df517902e120b2591ffb5c33e5b9a224..84ce7c60f661ee206e2d9435ab7d3e8cdfd624ad 100644 --- a/EOM.TSHotelManagement.API/Extensions/AutofacConfigExtensions.cs +++ b/EOM.TSHotelManagement.API/Extensions/AutofacConfigExtensions.cs @@ -27,6 +27,8 @@ namespace EOM.TSHotelManagement.WebApi builder.RegisterType() .InstancePerDependency(); + builder.RegisterType() + .InstancePerDependency(); builder.RegisterType().AsSelf().SingleInstance(); builder.RegisterType().AsSelf().InstancePerLifetimeScope(); diff --git a/EOM.TSHotelManagement.API/Extensions/MiddlewareExtensions.cs b/EOM.TSHotelManagement.API/Extensions/MiddlewareExtensions.cs index 7e7f5d4774e745563d235ed5a2af40704b8f6153..c895ba40a813dc498bb531ac762448f09eb765d0 100644 --- a/EOM.TSHotelManagement.API/Extensions/MiddlewareExtensions.cs +++ b/EOM.TSHotelManagement.API/Extensions/MiddlewareExtensions.cs @@ -4,6 +4,12 @@ namespace EOM.TSHotelManagement.WebApi { public static class MiddlewareExtensions { + public static IApplicationBuilder UseIdempotencyKey( + this IApplicationBuilder builder) + { + return builder.UseMiddleware(); + } + public static IApplicationBuilder UseRequestLogging( this IApplicationBuilder builder) { diff --git a/EOM.TSHotelManagement.API/Extensions/ServiceExtensions.cs b/EOM.TSHotelManagement.API/Extensions/ServiceExtensions.cs index a753ecefa627196a74486ca673ec3bba508556b2..f5239ed9280e3fc87d6b215de4be00008c8784c0 100644 --- a/EOM.TSHotelManagement.API/Extensions/ServiceExtensions.cs +++ b/EOM.TSHotelManagement.API/Extensions/ServiceExtensions.cs @@ -1,5 +1,6 @@ -using EOM.TSHotelManagement.Common; +using EOM.TSHotelManagement.Common; using EOM.TSHotelManagement.Infrastructure; +using EOM.TSHotelManagement.Service; using EOM.TSHotelManagement.WebApi.Authorization; using EOM.TSHotelManagement.WebApi.Filters; using jvncorelib.CodeLib; @@ -13,6 +14,7 @@ using Microsoft.AspNetCore.HttpOverrides; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.IdentityModel.Tokens; using NSwag; using NSwag.Generation.Processors.Security; @@ -22,6 +24,8 @@ using System.IO; using System.Linq; using System.Text; using System.Text.Json.Serialization; +using System.Threading; +using System.Threading.Tasks; namespace EOM.TSHotelManagement.WebApi { @@ -136,6 +140,8 @@ namespace EOM.TSHotelManagement.WebApi services.Configure(configuration.GetSection("CsrfToken")); services.AddSingleton(); services.AddSingleton(); + services.AddSingleton(); + services.AddHostedService(); // RBAC: 注册基于权限码的动态策略提供者与处理器 services.AddSingleton(); @@ -268,4 +274,20 @@ namespace EOM.TSHotelManagement.WebApi }); } } + internal sealed class DeleteConcurrencyHelperWarmupService : IHostedService + { + public DeleteConcurrencyHelperWarmupService(DeleteConcurrencyHelper helper) + { + } + + public Task StartAsync(CancellationToken cancellationToken) + { + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) + { + return Task.CompletedTask; + } + } } diff --git a/EOM.TSHotelManagement.API/Filters/IdempotencyKeyMiddleware.cs b/EOM.TSHotelManagement.API/Filters/IdempotencyKeyMiddleware.cs new file mode 100644 index 0000000000000000000000000000000000000000..c343372b8888e1718d6d02b52696b675171e00b8 --- /dev/null +++ b/EOM.TSHotelManagement.API/Filters/IdempotencyKeyMiddleware.cs @@ -0,0 +1,643 @@ +using EOM.TSHotelManagement.Common; +using EOM.TSHotelManagement.Contract; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; +using StackExchange.Redis; +using System; +using System.Collections.Concurrent; +using System.IO; +using System.Linq; +using System.Security.Claims; +using System.Security.Cryptography; +using System.Text; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; + +namespace EOM.TSHotelManagement.WebApi +{ + public class IdempotencyKeyMiddleware + { + private const string IdempotencyHeaderName = "Idempotency-Key"; + private const string TenantHeaderName = "X-Tenant-Id"; + private const string ReplayHeaderName = "X-Idempotent-Replay"; + private const string InProgressStatus = "IN_PROGRESS"; + private const string CompletedStatus = "COMPLETED"; + private const string DefaultContentType = "application/json; charset=utf-8"; + + private static readonly ConcurrentDictionary MemoryStore = new(); + private static long _memoryRequestCount; + + private readonly RequestDelegate _next; + private readonly ILogger _logger; + private readonly RedisHelper _redisHelper; + private readonly bool _enabled; + private readonly bool _enforceKey; + private readonly bool _persistFailureResponse; + private readonly int _maxKeyLength; + private readonly TimeSpan _inProgressTtl; + private readonly TimeSpan _completedTtl; + private readonly bool _useRedis; + + public IdempotencyKeyMiddleware( + RequestDelegate next, + IConfiguration configuration, + ILogger logger, + RedisHelper redisHelper) + { + _next = next; + _logger = logger; + _redisHelper = redisHelper; + + var section = configuration.GetSection("Idempotency"); + _enabled = section.GetValue("Enabled") ?? true; + _enforceKey = section.GetValue("EnforceKey") ?? false; + _persistFailureResponse = section.GetValue("PersistFailureResponse") ?? false; + _maxKeyLength = Math.Max(16, section.GetValue("MaxKeyLength") ?? 128); + + var inProgressSeconds = section.GetValue("InProgressTtlSeconds") ?? 120; + var completedHours = section.GetValue("CompletedTtlHours") ?? 24; + _inProgressTtl = TimeSpan.FromSeconds(Math.Clamp(inProgressSeconds, 30, 600)); + _completedTtl = TimeSpan.FromHours(Math.Clamp(completedHours, 1, 168)); + + _useRedis = ResolveRedisEnabled(configuration); + } + + public async Task InvokeAsync(HttpContext context) + { + if (!_enabled || !IsWriteMethod(context.Request.Method)) + { + await _next(context); + return; + } + + var idempotencyKey = context.Request.Headers[IdempotencyHeaderName].ToString().Trim(); + if (string.IsNullOrWhiteSpace(idempotencyKey)) + { + if (_enforceKey) + { + await WriteBusinessErrorAsync( + context, + StatusCodes.Status428PreconditionRequired, + BusinessStatusCode.IdempotencyKeyMissing, + LocalizationHelper.GetLocalizedString( + "Missing Idempotency-Key header.", + "缺少 Idempotency-Key 请求头。")); + return; + } + + _logger.LogWarning("Write request missing Idempotency-Key. Method={Method}, Path={Path}", context.Request.Method, context.Request.Path); + await _next(context); + return; + } + + if (idempotencyKey.Length > _maxKeyLength) + { + await WriteBusinessErrorAsync( + context, + StatusCodes.Status400BadRequest, + BusinessStatusCode.IdempotencyKeyMissing, + LocalizationHelper.GetLocalizedString( + $"Idempotency-Key exceeds max length {_maxKeyLength}.", + $"Idempotency-Key 长度超过最大限制 {_maxKeyLength}。")); + return; + } + + var requestHash = await ComputeRequestHashAsync(context.Request); + var scopeKey = BuildScopeKey(context, idempotencyKey); + + var acquireResult = await AcquireAsync(scopeKey, requestHash); + if (acquireResult.Decision == IdempotencyDecision.PayloadConflict) + { + await WriteBusinessErrorAsync( + context, + StatusCodes.Status409Conflict, + BusinessStatusCode.IdempotencyKeyPayloadConflict, + LocalizationHelper.GetLocalizedString( + "Idempotency-Key was reused with a different payload.", + "Idempotency-Key 被复用且请求体不一致。")); + return; + } + + if (acquireResult.Decision == IdempotencyDecision.InProgress) + { + await WriteBusinessErrorAsync( + context, + StatusCodes.Status409Conflict, + BusinessStatusCode.IdempotencyRequestInProgress, + LocalizationHelper.GetLocalizedString( + "A request with the same Idempotency-Key is still in progress.", + "相同 Idempotency-Key 的请求仍在处理中。")); + return; + } + + if (acquireResult.Decision == IdempotencyDecision.Replay && acquireResult.Record != null) + { + await ReplayResponseAsync(context, acquireResult.Record); + return; + } + + await ExecuteAndStoreAsync(context, scopeKey, requestHash); + } + + private async Task ExecuteAndStoreAsync(HttpContext context, string scopeKey, string requestHash) + { + var originalResponseBody = context.Response.Body; + + try + { + using var responseBuffer = new MemoryStream(); + context.Response.Body = responseBuffer; + + await _next(context); + + responseBuffer.Seek(0, SeekOrigin.Begin); + var responseBody = await new StreamReader(responseBuffer, Encoding.UTF8, leaveOpen: true).ReadToEndAsync(); + responseBuffer.Seek(0, SeekOrigin.Begin); + await responseBuffer.CopyToAsync(originalResponseBody); + + var shouldPersist = _persistFailureResponse || IsSuccessStatusCode(context.Response.StatusCode); + if (shouldPersist) + { + var completedRecord = new IdempotencyRecord + { + Status = CompletedStatus, + RequestHash = requestHash, + HttpStatus = context.Response.StatusCode, + ResponseBody = responseBody, + ContentType = context.Response.ContentType, + CreatedAt = DateTimeOffset.UtcNow, + UpdatedAt = DateTimeOffset.UtcNow + }; + + await SaveCompletedAsync(scopeKey, completedRecord); + } + else + { + await ReleaseAsync(scopeKey); + } + } + catch + { + await ReleaseAsync(scopeKey); + throw; + } + finally + { + context.Response.Body = originalResponseBody; + } + } + + private async Task ReplayResponseAsync(HttpContext context, IdempotencyRecord record) + { + context.Response.Headers[ReplayHeaderName] = "true"; + context.Response.StatusCode = record.HttpStatus ?? StatusCodes.Status200OK; + context.Response.ContentType = string.IsNullOrWhiteSpace(record.ContentType) ? DefaultContentType : record.ContentType; + + if (!string.IsNullOrEmpty(record.ResponseBody)) + { + await context.Response.WriteAsync(record.ResponseBody); + } + } + + private async Task AcquireAsync(string scopeKey, string requestHash) + { + if (_useRedis) + { + try + { + return await AcquireFromRedisAsync(scopeKey, requestHash); + } + catch (Exception ex) + { + _logger.LogError(ex, "Idempotency acquire failed on Redis, fallback to memory store. Scope={Scope}", scopeKey); + } + } + + return AcquireFromMemory(scopeKey, requestHash); + } + + private async Task SaveCompletedAsync(string scopeKey, IdempotencyRecord record) + { + if (_useRedis) + { + try + { + await SaveCompletedToRedisAsync(scopeKey, record); + return; + } + catch (Exception ex) + { + _logger.LogError(ex, "Idempotency save-completed failed on Redis, fallback to memory store. Scope={Scope}", scopeKey); + } + } + + SaveCompletedToMemory(scopeKey, record); + } + + private async Task ReleaseAsync(string scopeKey) + { + if (_useRedis) + { + try + { + await ReleaseFromRedisAsync(scopeKey); + return; + } + catch (Exception ex) + { + _logger.LogError(ex, "Idempotency release failed on Redis, fallback to memory store. Scope={Scope}", scopeKey); + } + } + + ReleaseFromMemory(scopeKey); + } + + private async Task AcquireFromRedisAsync(string scopeKey, string requestHash) + { + var now = DateTimeOffset.UtcNow; + var inProgressRecord = new IdempotencyRecord + { + Status = InProgressStatus, + RequestHash = requestHash, + CreatedAt = now, + UpdatedAt = now + }; + + var db = _redisHelper.GetDatabase(); + var inserted = await db.StringSetAsync( + scopeKey, + JsonSerializer.Serialize(inProgressRecord), + _inProgressTtl, + when: When.NotExists); + + if (inserted) + { + return AcquireResult.Proceed(); + } + + var existingValue = await db.StringGetAsync(scopeKey); + if (existingValue.IsNullOrEmpty) + { + inserted = await db.StringSetAsync( + scopeKey, + JsonSerializer.Serialize(inProgressRecord), + _inProgressTtl, + when: When.NotExists); + + return inserted ? AcquireResult.Proceed() : AcquireResult.InProgress(); + } + + var existingRecord = DeserializeRecord(existingValue); + return ResolveDecision(existingRecord, requestHash); + } + + private async Task SaveCompletedToRedisAsync(string scopeKey, IdempotencyRecord record) + { + var db = _redisHelper.GetDatabase(); + await db.StringSetAsync(scopeKey, JsonSerializer.Serialize(record), _completedTtl); + } + + private async Task ReleaseFromRedisAsync(string scopeKey) + { + var db = _redisHelper.GetDatabase(); + await db.KeyDeleteAsync(scopeKey); + } + + private AcquireResult AcquireFromMemory(string scopeKey, string requestHash) + { + PruneMemoryStoreIfNeeded(); + + while (true) + { + var now = DateTimeOffset.UtcNow; + if (!MemoryStore.TryGetValue(scopeKey, out var cacheItem)) + { + var inProgressRecord = new IdempotencyRecord + { + Status = InProgressStatus, + RequestHash = requestHash, + CreatedAt = now, + UpdatedAt = now + }; + + var inserted = MemoryStore.TryAdd(scopeKey, new IdempotencyCacheItem + { + Record = inProgressRecord, + ExpiresAt = now.Add(_inProgressTtl) + }); + + if (inserted) + { + return AcquireResult.Proceed(); + } + + continue; + } + + if (cacheItem.ExpiresAt <= now) + { + MemoryStore.TryRemove(scopeKey, out _); + continue; + } + + return ResolveDecision(cacheItem.Record, requestHash); + } + } + + private void SaveCompletedToMemory(string scopeKey, IdempotencyRecord record) + { + var expiresAt = DateTimeOffset.UtcNow.Add(_completedTtl); + MemoryStore.AddOrUpdate( + scopeKey, + _ => new IdempotencyCacheItem + { + Record = record, + ExpiresAt = expiresAt + }, + (_, _) => new IdempotencyCacheItem + { + Record = record, + ExpiresAt = expiresAt + }); + } + + private void ReleaseFromMemory(string scopeKey) + { + MemoryStore.TryRemove(scopeKey, out _); + } + + private static AcquireResult ResolveDecision(IdempotencyRecord record, string requestHash) + { + if (record == null) + { + return AcquireResult.InProgress(); + } + + if (!string.Equals(record.RequestHash, requestHash, StringComparison.Ordinal)) + { + return AcquireResult.PayloadConflict(); + } + + if (string.Equals(record.Status, CompletedStatus, StringComparison.OrdinalIgnoreCase)) + { + return AcquireResult.Replay(record); + } + + return AcquireResult.InProgress(); + } + + private static async Task ComputeRequestHashAsync(HttpRequest request) + { + if (!IsJsonContentType(request.ContentType)) + { + return ComputeSha256Hex(string.Empty); + } + + if (request.ContentLength.HasValue && request.ContentLength.Value == 0) + { + return ComputeSha256Hex(string.Empty); + } + + request.EnableBuffering(); + request.Body.Seek(0, SeekOrigin.Begin); + using var reader = new StreamReader(request.Body, Encoding.UTF8, detectEncodingFromByteOrderMarks: false, leaveOpen: true); + var body = await reader.ReadToEndAsync(); + request.Body.Seek(0, SeekOrigin.Begin); + + var canonicalBody = CanonicalizeBody(body); + return ComputeSha256Hex(canonicalBody); + } + + private static string CanonicalizeBody(string body) + { + if (string.IsNullOrWhiteSpace(body)) + { + return string.Empty; + } + + try + { + using var document = JsonDocument.Parse(body); + using var buffer = new MemoryStream(); + using (var writer = new Utf8JsonWriter(buffer)) + { + WriteCanonicalJson(writer, document.RootElement); + } + + return Encoding.UTF8.GetString(buffer.ToArray()); + } + catch + { + return body.Trim(); + } + } + + private static void WriteCanonicalJson(Utf8JsonWriter writer, JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.Object: + writer.WriteStartObject(); + foreach (var property in element.EnumerateObject().OrderBy(p => p.Name, StringComparer.Ordinal)) + { + writer.WritePropertyName(property.Name); + WriteCanonicalJson(writer, property.Value); + } + writer.WriteEndObject(); + return; + case JsonValueKind.Array: + writer.WriteStartArray(); + foreach (var item in element.EnumerateArray()) + { + WriteCanonicalJson(writer, item); + } + writer.WriteEndArray(); + return; + default: + element.WriteTo(writer); + return; + } + } + + private static string BuildScopeKey(HttpContext context, string idempotencyKey) + { + var tenantId = ResolveTenantId(context); + var userId = ResolveUserId(context); + var method = context.Request.Method.ToUpperInvariant(); + var normalizedPath = NormalizePath(context.Request.Path.Value); + + var scope = $"{tenantId}:{userId}:{method}:{normalizedPath}:{idempotencyKey}"; + return $"idem:{ComputeSha256Hex(scope)}"; + } + + private static string ResolveTenantId(HttpContext context) + { + var tenantId = context.Request.Headers[TenantHeaderName].ToString(); + if (!string.IsNullOrWhiteSpace(tenantId)) + { + return tenantId.Trim().ToLowerInvariant(); + } + + var tenantClaim = context.User?.FindFirst("tenantId")?.Value + ?? context.User?.FindFirst("tid")?.Value + ?? "default"; + + return tenantClaim.Trim().ToLowerInvariant(); + } + + private static string ResolveUserId(HttpContext context) + { + var userId = context.User?.FindFirst(ClaimTypes.SerialNumber)?.Value + ?? context.User?.FindFirst(ClaimTypes.NameIdentifier)?.Value + ?? context.User?.Identity?.Name + ?? "anonymous"; + + return userId.Trim().ToLowerInvariant(); + } + + private static string NormalizePath(string path) + { + if (string.IsNullOrWhiteSpace(path)) + { + return "/"; + } + + var normalized = path.Trim().ToLowerInvariant(); + if (normalized.Length > 1) + { + normalized = normalized.TrimEnd('/'); + } + + return string.IsNullOrWhiteSpace(normalized) ? "/" : normalized; + } + + private static bool ResolveRedisEnabled(IConfiguration configuration) + { + var redisSection = configuration.GetSection("Redis"); + var enable = redisSection.GetValue("Enable"); + if (enable.HasValue) + { + return enable.Value; + } + + return redisSection.GetValue("Enabled"); + } + + private static bool IsWriteMethod(string method) + { + return HttpMethods.IsPost(method) + || HttpMethods.IsPut(method) + || HttpMethods.IsPatch(method); + } + + private static bool IsSuccessStatusCode(int statusCode) + { + return statusCode >= 200 && statusCode < 300; + } + + private static bool IsJsonContentType(string contentType) + { + return !string.IsNullOrWhiteSpace(contentType) + && contentType.Contains("json", StringComparison.OrdinalIgnoreCase); + } + + private static string ComputeSha256Hex(string input) + { + var bytes = SHA256.HashData(Encoding.UTF8.GetBytes(input)); + return Convert.ToHexString(bytes).ToLowerInvariant(); + } + + private static IdempotencyRecord DeserializeRecord(RedisValue value) + { + if (value.IsNullOrEmpty) + { + return null; + } + + try + { + return JsonSerializer.Deserialize(value.ToString()); + } + catch + { + return null; + } + } + + private static void PruneMemoryStoreIfNeeded() + { + if (Interlocked.Increment(ref _memoryRequestCount) % 200 != 0) + { + return; + } + + var now = DateTimeOffset.UtcNow; + foreach (var kvp in MemoryStore) + { + if (kvp.Value.ExpiresAt <= now) + { + MemoryStore.TryRemove(kvp.Key, out _); + } + } + } + + private static async Task WriteBusinessErrorAsync(HttpContext context, int httpStatus, int businessCode, string message) + { + context.Response.StatusCode = httpStatus; + context.Response.ContentType = DefaultContentType; + + var response = new BaseResponse(businessCode, message); + var payload = JsonSerializer.Serialize(response, new JsonSerializerOptions + { + PropertyNamingPolicy = null, + DictionaryKeyPolicy = null + }); + + await context.Response.WriteAsync(payload); + } + + private sealed class IdempotencyCacheItem + { + public IdempotencyRecord Record { get; set; } + public DateTimeOffset ExpiresAt { get; set; } + } + + private sealed class IdempotencyRecord + { + public string Status { get; set; } + public string RequestHash { get; set; } + public int? HttpStatus { get; set; } + public string ResponseBody { get; set; } + public string ContentType { get; set; } + public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset UpdatedAt { get; set; } + } + + private enum IdempotencyDecision + { + Proceed = 0, + Replay = 1, + InProgress = 2, + PayloadConflict = 3 + } + + private sealed class AcquireResult + { + private AcquireResult(IdempotencyDecision decision, IdempotencyRecord record = null) + { + Decision = decision; + Record = record; + } + + public IdempotencyDecision Decision { get; } + public IdempotencyRecord Record { get; } + + public static AcquireResult Proceed() => new AcquireResult(IdempotencyDecision.Proceed); + public static AcquireResult Replay(IdempotencyRecord record) => new AcquireResult(IdempotencyDecision.Replay, record); + public static AcquireResult InProgress() => new AcquireResult(IdempotencyDecision.InProgress); + public static AcquireResult PayloadConflict() => new AcquireResult(IdempotencyDecision.PayloadConflict); + } + } +} diff --git a/EOM.TSHotelManagement.API/appsettings.Application.json b/EOM.TSHotelManagement.API/appsettings.Application.json index 8fd1da27f0554832b0a122d5f4409662a2f469da..b77796a8dd15e4a5d466c257ffb92b47f94e8cc8 100644 --- a/EOM.TSHotelManagement.API/appsettings.Application.json +++ b/EOM.TSHotelManagement.API/appsettings.Application.json @@ -20,5 +20,13 @@ "NotifyDaysBefore": 3, "CheckIntervalMinutes": 5 }, + "Idempotency": { + "Enabled": true, + "EnforceKey": false, + "MaxKeyLength": 128, + "InProgressTtlSeconds": 120, + "CompletedTtlHours": 24, + "PersistFailureResponse": false + }, "SoftwareVersion": "1.0.0" -} \ No newline at end of file +} diff --git a/EOM.TSHotelManagement.Contract/Business/News/Dto/ReadNewsOuputDto.cs b/EOM.TSHotelManagement.Contract/Business/News/Dto/ReadNewsOuputDto.cs index 07bc449c37fa8ca13b20b2f67c585c32dd7e0f0d..eab1283c75be207580078517f5f0e6be44a20da4 100644 --- a/EOM.TSHotelManagement.Contract/Business/News/Dto/ReadNewsOuputDto.cs +++ b/EOM.TSHotelManagement.Contract/Business/News/Dto/ReadNewsOuputDto.cs @@ -1,8 +1,7 @@ -namespace EOM.TSHotelManagement.Contract +namespace EOM.TSHotelManagement.Contract { - public class ReadNewsOuputDto : BaseDto + public class ReadNewsOuputDto : BaseOutputDto { - public int? Id { get; set; } public string NewId { get; set; } public string NewsTitle { get; set; } @@ -18,4 +17,4 @@ public string NewsStatusDescription { get; set; } public string NewsImage { get; set; } } -} \ No newline at end of file +} diff --git a/EOM.TSHotelManagement.Contract/Common/Dto/BusinessStatusCode.cs b/EOM.TSHotelManagement.Contract/Common/Dto/BusinessStatusCode.cs index 81618cac3623e1eee5c5f102268fe9a910d52807..70fda34ac4f3ce03e1c3caf4fb497ce8640fe743 100644 --- a/EOM.TSHotelManagement.Contract/Common/Dto/BusinessStatusCode.cs +++ b/EOM.TSHotelManagement.Contract/Common/Dto/BusinessStatusCode.cs @@ -1,4 +1,4 @@ -namespace EOM.TSHotelManagement.Contract +namespace EOM.TSHotelManagement.Contract { public static class BusinessStatusCode { @@ -55,6 +55,11 @@ /// public const int Unauthorized = 1401; + /// + /// 权限不足 + /// + public const int PermissionDenied = 1402; + /// /// 禁止访问(无权限) /// @@ -80,6 +85,22 @@ /// public const int Conflict = 1409; + // 16xx Idempotency + /// + /// 缺少幂等键 + /// + public const int IdempotencyKeyMissing = 1601; + + /// + /// 幂等键复用但请求体不一致 + /// + public const int IdempotencyKeyPayloadConflict = 1602; + + /// + /// 相同幂等键请求正在处理中 + /// + public const int IdempotencyRequestInProgress = 1603; + // 5xx Server Errors /// /// 服务器内部错误 diff --git a/EOM.TSHotelManagement.Contract/Common/Dto/DeleteDto.cs b/EOM.TSHotelManagement.Contract/Common/Dto/DeleteDto.cs index 021f809fa2221dee35612a3a0520e6443f2bd8a6..f3d1fa313234b771dac7a5cf1576bf7c89cb657a 100644 --- a/EOM.TSHotelManagement.Contract/Common/Dto/DeleteDto.cs +++ b/EOM.TSHotelManagement.Contract/Common/Dto/DeleteDto.cs @@ -4,6 +4,12 @@ namespace EOM.TSHotelManagement.Contract { public abstract class DeleteDto { - public List DelIds { get; set; } + public List DelIds { get; set; } } -} \ No newline at end of file + + public class DeleteItemDto + { + public int Id { get; set; } + public int RowVersion { get; set; } + } +} diff --git a/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Permission/SensitiveReadInputDtos.cs b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Permission/SensitiveReadInputDtos.cs new file mode 100644 index 0000000000000000000000000000000000000000..bb5d7efe081c38f1ad78a6bc299f1f01da8b8823 --- /dev/null +++ b/EOM.TSHotelManagement.Contract/SystemManagement/Dto/Permission/SensitiveReadInputDtos.cs @@ -0,0 +1,24 @@ +using System.ComponentModel.DataAnnotations; + +namespace EOM.TSHotelManagement.Contract +{ + /// + /// Request body for reading data by user number. + /// + public class ReadByUserNumberInputDto : BaseInputDto + { + [Required(ErrorMessage = "UserNumber is required.")] + [MaxLength(128, ErrorMessage = "UserNumber cannot exceed 128 characters.")] + public string UserNumber { get; set; } = null!; + } + + /// + /// Request body for reading data by role number. + /// + public class ReadByRoleNumberInputDto : BaseInputDto + { + [Required(ErrorMessage = "RoleNumber is required.")] + [MaxLength(128, ErrorMessage = "RoleNumber cannot exceed 128 characters.")] + public string RoleNumber { get; set; } = null!; + } +} diff --git a/EOM.TSHotelManagement.Data/DatabaseInitializer/DatabaseInitializer.cs b/EOM.TSHotelManagement.Data/DatabaseInitializer/DatabaseInitializer.cs index 6367387a8b95bb02169d5fe42e697040cc708542..e86d9cf0e9153c4b339c74707da7d2c2f630dc36 100644 --- a/EOM.TSHotelManagement.Data/DatabaseInitializer/DatabaseInitializer.cs +++ b/EOM.TSHotelManagement.Data/DatabaseInitializer/DatabaseInitializer.cs @@ -16,8 +16,15 @@ namespace EOM.TSHotelManagement.Data private readonly IConfiguration _configuration; private readonly string _initialAdminEncryptedPassword; private readonly string _initialEmployeeEncryptedPassword; + private readonly IDataProtector _adminPasswordProtector; + private readonly IDataProtector _employeePasswordProtector; private const string AdminProtectorPurpose = "AdminInfoProtector"; private const string EmployeeProtectorPurpose = "EmployeeInfoProtector"; + private const string DataProtectionPayloadPrefix = "CfDJ8"; + private const string DefaultAdminAccount = "admin"; + private const string DefaultEmployeeId = "WK010"; + private const string DefaultAdminPassword = "admin"; + private const string DefaultEmployeePassword = "WK010"; public DatabaseInitializer( ISqlSugarClient client, @@ -28,12 +35,10 @@ namespace EOM.TSHotelManagement.Data _client = client; _connector = connector; _configuration = configuration; - _initialAdminEncryptedPassword = dataProtectionProvider - .CreateProtector(AdminProtectorPurpose) - .Protect("admin"); - _initialEmployeeEncryptedPassword = dataProtectionProvider - .CreateProtector(EmployeeProtectorPurpose) - .Protect("WK010"); + _adminPasswordProtector = dataProtectionProvider.CreateProtector(AdminProtectorPurpose); + _employeePasswordProtector = dataProtectionProvider.CreateProtector(EmployeeProtectorPurpose); + _initialAdminEncryptedPassword = _adminPasswordProtector.Protect(DefaultAdminPassword); + _initialEmployeeEncryptedPassword = _employeePasswordProtector.Protect(DefaultEmployeePassword); } #region initlize database @@ -312,7 +317,9 @@ namespace EOM.TSHotelManagement.Data try { - var entityBuilder = new EntityBuilder(_initialAdminEncryptedPassword); + EnsureDefaultAccountPasswordsEncrypted(db); + + var entityBuilder = new EntityBuilder(_initialAdminEncryptedPassword, _initialEmployeeEncryptedPassword); var entitiesToAdd = new List(); var sortedEntities = entityBuilder.GetEntityDatas() @@ -591,6 +598,56 @@ namespace EOM.TSHotelManagement.Data Console.WriteLine($"administrator password:admin"); } } + + private void EnsureDefaultAccountPasswordsEncrypted(ISqlSugarClient db) + { + try + { + var admin = db.Queryable() + .First(a => a.Account == DefaultAdminAccount && a.IsDelete != 1); + if (admin != null && !IsProtectedValue(admin.Password, _adminPasswordProtector)) + { + var source = string.IsNullOrWhiteSpace(admin.Password) ? DefaultAdminPassword : admin.Password; + admin.Password = _adminPasswordProtector.Protect(source); + admin.DataChgUsr = "System"; + admin.DataChgDate = DateTime.Now; + db.Updateable(admin) + .UpdateColumns(a => new { a.Password, a.DataChgUsr, a.DataChgDate }) + .ExecuteCommand(); + Console.WriteLine("Auto-fixed admin password encryption during initialization."); + } + + var employee = db.Queryable() + .First(a => a.EmployeeId == DefaultEmployeeId && a.IsDelete != 1); + if (employee != null && !IsProtectedValue(employee.Password, _employeePasswordProtector)) + { + var source = string.IsNullOrWhiteSpace(employee.Password) ? DefaultEmployeePassword : employee.Password; + employee.Password = _employeePasswordProtector.Protect(source); + employee.DataChgUsr = "System"; + employee.DataChgDate = DateTime.Now; + db.Updateable(employee) + .UpdateColumns(a => new { a.Password, a.DataChgUsr, a.DataChgDate }) + .ExecuteCommand(); + Console.WriteLine("Auto-fixed employee password encryption during initialization."); + } + } + catch (Exception ex) + { + Console.WriteLine($"Ensure default account password encryption skipped: {ex.Message}"); + } + } + + private static bool IsProtectedValue(string? value, IDataProtector protector) + { + if (string.IsNullOrWhiteSpace(value)) + { + return false; + } + + _ = protector; + return value.StartsWith(DataProtectionPayloadPrefix, StringComparison.Ordinal); + } #endregion } } + diff --git a/EOM.TSHotelManagement.Data/Repository/GenericRepository.cs b/EOM.TSHotelManagement.Data/Repository/GenericRepository.cs index 2c06278ee3a88330946c8b0d195b66e302567de9..415449c1f36aea27d5911dd554c870cd14d5ccec 100644 --- a/EOM.TSHotelManagement.Data/Repository/GenericRepository.cs +++ b/EOM.TSHotelManagement.Data/Repository/GenericRepository.cs @@ -84,37 +84,21 @@ namespace EOM.TSHotelManagement.Data .Select(it => it.PropertyName) .ToList(); - var updateable = base.Context.Updateable(entity) - .IgnoreColumns(true, false); - - if (rowVersionWhere != null) + var primaryKeyWhere = BuildUpdateWhereExpression(entity, primaryKeys); + if (primaryKeyWhere == null) { - updateable = updateable.Where(rowVersionWhere); - } - - if (primaryKeys.Count <= 1) - { - return updateable.ExecuteCommand() > 0; + _log.LogWarning("Unable to build primary-key WHERE for entity type {EntityType}. Update aborted to avoid accidental mass update.", typeof(T).Name); + return false; } - var idProperty = entity.GetType().GetProperty("Id"); - if (idProperty != null) - { - var idValue = Convert.ToInt64(idProperty.GetValue(entity)); - - if (idValue == 0) - { - var otherPrimaryKeys = primaryKeys.Where(pk => pk != "Id").ToList(); - var primaryKeyWhere = BuildPrimaryKeyWhereExpression(entity, otherPrimaryKeys); + var finalWhere = rowVersionWhere == null + ? primaryKeyWhere + : AndAlso(primaryKeyWhere, rowVersionWhere); - if (primaryKeyWhere != null) - { - return updateable.Where(primaryKeyWhere).ExecuteCommand() > 0; - } - } - } - - return updateable.ExecuteCommand() > 0; + return base.Context.Updateable(entity) + .IgnoreColumns(true, false) + .Where(finalWhere) + .ExecuteCommand() > 0; } public override bool UpdateRange(List updateObjs) @@ -323,5 +307,65 @@ namespace EOM.TSHotelManagement.Data ? null : Expression.Lambda>(whereExpression, parameter); } + + private static Expression>? BuildUpdateWhereExpression(T entity, List primaryKeys) + { + if (entity == null || primaryKeys == null || primaryKeys.Count == 0) + { + return null; + } + + // Prefer identity-style Id when provided. + var idProperty = entity.GetType().GetProperty("Id"); + if (idProperty != null) + { + var idRawValue = idProperty.GetValue(entity); + if (idRawValue != null) + { + var idValue = Convert.ToInt64(idRawValue); + if (idValue > 0) + { + return BuildEqualsLambda("Id", idValue); + } + } + } + + // Fallback to non-Id primary keys when Id is absent/invalid. + var nonIdPrimaryKeys = primaryKeys.Where(pk => !pk.Equals("Id", StringComparison.OrdinalIgnoreCase)).ToList(); + var fallbackWhere = BuildPrimaryKeyWhereExpression(entity, nonIdPrimaryKeys); + if (fallbackWhere != null) + { + return fallbackWhere; + } + + // Last chance: use all primary keys if available. + return BuildPrimaryKeyWhereExpression(entity, primaryKeys); + } + + private static Expression> AndAlso(Expression> left, Expression> right) + { + var parameter = Expression.Parameter(typeof(T), "it"); + var leftBody = new ReplaceParameterVisitor(left.Parameters[0], parameter).Visit(left.Body); + var rightBody = new ReplaceParameterVisitor(right.Parameters[0], parameter).Visit(right.Body); + var andBody = Expression.AndAlso(leftBody!, rightBody!); + return Expression.Lambda>(andBody, parameter); + } + + private sealed class ReplaceParameterVisitor : ExpressionVisitor + { + private readonly ParameterExpression _oldParameter; + private readonly ParameterExpression _newParameter; + + public ReplaceParameterVisitor(ParameterExpression oldParameter, ParameterExpression newParameter) + { + _oldParameter = oldParameter; + _newParameter = newParameter; + } + + protected override Expression VisitParameter(ParameterExpression node) + { + return node == _oldParameter ? _newParameter : base.VisitParameter(node); + } + } } } diff --git a/EOM.TSHotelManagement.Infrastructure/Factory/RedisConfigFactory.cs b/EOM.TSHotelManagement.Infrastructure/Factory/RedisConfigFactory.cs index 415087eedb3958bea489b16aec96fbf7a19767c8..981eeafaadc5f92b953104d26cce9ed66041c6e7 100644 --- a/EOM.TSHotelManagement.Infrastructure/Factory/RedisConfigFactory.cs +++ b/EOM.TSHotelManagement.Infrastructure/Factory/RedisConfigFactory.cs @@ -17,10 +17,14 @@ namespace EOM.TSHotelManagement.Infrastructure public RedisConfig GetRedisConfig() { var redisSection = _configuration.GetSection("Redis"); + var enable = redisSection.GetValue("Enable") + ?? redisSection.GetValue("Enabled") + ?? false; + var redisConfig = new RedisConfig { ConnectionString = redisSection.GetValue("ConnectionString"), - Enable = redisSection.GetValue("Enable") + Enable = enable }; return redisConfig; } diff --git a/EOM.TSHotelManagement.Migration/EntityBuilder.cs b/EOM.TSHotelManagement.Migration/EntityBuilder.cs index 58c50668d06128608732c6ccf558f9635e3a00e1..0851d3c174cd82b856ec86945f7026a9d6eb98d6 100644 --- a/EOM.TSHotelManagement.Migration/EntityBuilder.cs +++ b/EOM.TSHotelManagement.Migration/EntityBuilder.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Domain; +using EOM.TSHotelManagement.Domain; namespace EOM.TSHotelManagement.Migration { @@ -8,7 +8,7 @@ namespace EOM.TSHotelManagement.Migration { if (string.IsNullOrWhiteSpace(initialAdminEncryptedPassword) || string.IsNullOrWhiteSpace(initialEmployeeEncryptedPassword)) { - return; + throw new ArgumentException("Initial encrypted passwords for administrator and employee are required."); } var admin = entityDatas @@ -89,7 +89,7 @@ namespace EOM.TSHotelManagement.Migration { Number = "1263785187301658678", Account = "admin", - Password = "admin", + Password = string.Empty, Name = "Administrator", Type = "Admin", IsSuperAdmin = 1, @@ -101,7 +101,7 @@ namespace EOM.TSHotelManagement.Migration { Key = "home", Title = "首页", - Path = "/home", + Path = "/", Parent = null, Icon = "HomeOutlined", IsDelete = 0, @@ -483,6 +483,17 @@ namespace EOM.TSHotelManagement.Migration DataInsDate = DateTime.Now, }, new Menu // 36 + { + Key = "my", + Title = "我的", + Path = "/home", + Parent = 1, + Icon = "HomeOutlined", + IsDelete = 0, + DataInsUsr = "System", + DataInsDate = DateTime.Now, + }, + new Menu // 37 { Key = "dashboard", Title = "仪表盘", @@ -493,7 +504,7 @@ namespace EOM.TSHotelManagement.Migration DataInsUsr = "System", DataInsDate = DateTime.Now, }, - new Menu // 37 + new Menu // 38 { Key = "promotioncontent", Title = "宣传联动内容", @@ -504,7 +515,7 @@ namespace EOM.TSHotelManagement.Migration DataInsUsr = "System", DataInsDate = DateTime.Now, }, - new Menu // 38 + new Menu // 39 { Key = "requestlog", Title = "请求日志", @@ -596,7 +607,7 @@ namespace EOM.TSHotelManagement.Migration EmployeeId = "WK010", EmployeeName = "阿杰", DateOfBirth = DateOnly.FromDateTime(new DateTime(1999,7,20,0,0,0)), - Password="WK010", + Password = string.Empty, Department = "D-000001", Position = "P-000001", EducationLevel = "E-000001", @@ -653,181 +664,183 @@ namespace EOM.TSHotelManagement.Migration } , - // ===== Permission seeds for button-level authorization (MenuKey-scoped) ===== - // Basic (基础信息管理) - new Permission { PermissionNumber = "position.view", PermissionName = "职位-查看", Module = "basic", Description = "职位管理-查看", MenuKey = "position", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "position.create", PermissionName = "职位-新增", Module = "basic", Description = "职位管理-新增", MenuKey = "position", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "position.update", PermissionName = "职位-编辑", Module = "basic", Description = "职位管理-编辑", MenuKey = "position", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "position.delete", PermissionName = "职位-删除", Module = "basic", Description = "职位管理-删除", MenuKey = "position", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "nation.view", PermissionName = "民族-查看", Module = "basic", Description = "民族管理-查看", MenuKey = "nation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "nation.create", PermissionName = "民族-新增", Module = "basic", Description = "民族管理-新增", MenuKey = "nation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "nation.update", PermissionName = "民族-编辑", Module = "basic", Description = "民族管理-编辑", MenuKey = "nation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "nation.delete", PermissionName = "民族-删除", Module = "basic", Description = "民族管理-删除", MenuKey = "nation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "qualification.view", PermissionName = "学历-查看", Module = "basic", Description = "学历管理-查看", MenuKey = "qualification", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "qualification.create", PermissionName = "学历-新增", Module = "basic", Description = "学历管理-新增", MenuKey = "qualification", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "qualification.update", PermissionName = "学历-编辑", Module = "basic", Description = "学历管理-编辑", MenuKey = "qualification", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "qualification.delete", PermissionName = "学历-删除", Module = "basic", Description = "学历管理-删除", MenuKey = "qualification", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "department.view", PermissionName = "部门-查看", Module = "basic", Description = "部门管理-查看", MenuKey = "department", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "department.create", PermissionName = "部门-新增", Module = "basic", Description = "部门管理-新增", MenuKey = "department", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "department.update", PermissionName = "部门-编辑", Module = "basic", Description = "部门管理-编辑", MenuKey = "department", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "department.delete", PermissionName = "部门-删除", Module = "basic", Description = "部门管理-删除", MenuKey = "department", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "noticetype.view", PermissionName = "公告类型-查看", Module = "basic", Description = "公告类型管理-查看", MenuKey = "noticetype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "noticetype.create", PermissionName = "公告类型-新增", Module = "basic", Description = "公告类型管理-新增", MenuKey = "noticetype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "noticetype.update", PermissionName = "公告类型-编辑", Module = "basic", Description = "公告类型管理-编辑", MenuKey = "noticetype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "noticetype.delete", PermissionName = "公告类型-删除", Module = "basic", Description = "公告类型管理-删除", MenuKey = "noticetype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "passport.view", PermissionName = "证件-查看", Module = "basic", Description = "证件类型管理-查看", MenuKey = "passport", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "passport.create", PermissionName = "证件-新增", Module = "basic", Description = "证件类型管理-新增", MenuKey = "passport", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "passport.update", PermissionName = "证件-编辑", Module = "basic", Description = "证件类型管理-编辑", MenuKey = "passport", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "passport.delete", PermissionName = "证件-删除", Module = "basic", Description = "证件类型管理-删除", MenuKey = "passport", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "promotioncontent.view", PermissionName = "宣传联动-查看", Module = "basic", Description = "宣传联动内容-查看", MenuKey = "promotioncontent", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "promotioncontent.create", PermissionName = "宣传联动-新增", Module = "basic", Description = "宣传联动内容-新增", MenuKey = "promotioncontent", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "promotioncontent.update", PermissionName = "宣传联动-编辑", Module = "basic", Description = "宣传联动内容-编辑", MenuKey = "promotioncontent", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "promotioncontent.delete", PermissionName = "宣传联动-删除", Module = "basic", Description = "宣传联动内容-删除", MenuKey = "promotioncontent", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - // Finance (财务信息管理) - new Permission { PermissionNumber = "internalfinance.view", PermissionName = "内部资产-查看", Module = "finance", Description = "内部资产管理-查看", MenuKey = "internalfinance", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "internalfinance.create", PermissionName = "内部资产-新增", Module = "finance", Description = "内部资产管理-新增", MenuKey = "internalfinance", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "internalfinance.update", PermissionName = "内部资产-编辑", Module = "finance", Description = "内部资产管理-编辑", MenuKey = "internalfinance", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "internalfinance.delete", PermissionName = "内部资产-删除", Module = "finance", Description = "内部资产管理-删除", MenuKey = "internalfinance", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - // Nav Bar (导航栏管理) - new Permission { PermissionNumber = "navbar.view", PermissionName = "导航栏-查看", Module = "client", Description = "导航栏管理-查看", MenuKey = "navbar", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "navbar.create", PermissionName = "导航栏-新增", Module = "client", Description = "导航栏管理-新增", MenuKey = "navbar", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "navbar.update", PermissionName = "导航栏-编辑", Module = "client", Description = "导航栏管理-编辑", MenuKey = "navbar", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "navbar.delete", PermissionName = "导航栏-删除", Module = "client", Description = "导航栏管理-删除", MenuKey = "navbar", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - // Hydroelectricity (水电信息管理) - new Permission { PermissionNumber = "hydroelectricinformation.view", PermissionName = "水电信息-查看", Module = "hydroelectricity", Description = "水电信息管理-查看", MenuKey = "hydroelectricinformation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "hydroelectricinformation.create", PermissionName = "水电信息-新增", Module = "hydroelectricity", Description = "水电信息管理-新增", MenuKey = "hydroelectricinformation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "hydroelectricinformation.update", PermissionName = "水电信息-编辑", Module = "hydroelectricity", Description = "水电信息管理-编辑", MenuKey = "hydroelectricinformation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "hydroelectricinformation.delete", PermissionName = "水电信息-删除", Module = "hydroelectricity", Description = "水电信息管理-删除", MenuKey = "hydroelectricinformation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - // Supervision (监管统计管理) - new Permission { PermissionNumber = "supervisioninfo.view", PermissionName = "监管情况-查看", Module = "supervision", Description = "监管情况-查看", MenuKey = "supervisioninfo", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "supervisioninfo.create", PermissionName = "监管情况-新增", Module = "supervision", Description = "监管情况-新增", MenuKey = "supervisioninfo", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "supervisioninfo.update", PermissionName = "监管情况-编辑", Module = "supervision", Description = "监管情况-编辑", MenuKey = "supervisioninfo", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "supervisioninfo.delete", PermissionName = "监管情况-删除", Module = "supervision", Description = "监管情况-删除", MenuKey = "supervisioninfo", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - // Room information (客房信息管理) - new Permission { PermissionNumber = "resermanagement.view", PermissionName = "预约-查看", Module = "room", Description = "预约管理-查看", MenuKey = "resermanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "resermanagement.create", PermissionName = "预约-新增", Module = "room", Description = "预约管理-新增", MenuKey = "resermanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "resermanagement.update", PermissionName = "预约-编辑", Module = "room", Description = "预约管理-编辑", MenuKey = "resermanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "resermanagement.delete", PermissionName = "预约-删除", Module = "room", Description = "预约管理-删除", MenuKey = "resermanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "roommap.view", PermissionName = "房态图-查看", Module = "room", Description = "房态图一览-查看", MenuKey = "roommap", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "roommanagement.view", PermissionName = "客房-查看", Module = "room", Description = "客房管理-查看", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "roommanagement.create", PermissionName = "客房-新增", Module = "room", Description = "客房管理-新增", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "roommanagement.update", PermissionName = "客房-编辑", Module = "room", Description = "客房管理-编辑", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "roommanagement.delete", PermissionName = "客房-删除", Module = "room", Description = "客房管理-删除", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "roomconfig.view", PermissionName = "客房配置-查看", Module = "room", Description = "客房配置-查看", MenuKey = "roomconfig", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "roomconfig.create", PermissionName = "客房配置-新增", Module = "room", Description = "客房配置-新增", MenuKey = "roomconfig", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "roomconfig.update", PermissionName = "客房配置-编辑", Module = "room", Description = "客房配置-编辑", MenuKey = "roomconfig", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "roomconfig.delete", PermissionName = "客房配置-删除", Module = "room", Description = "客房配置-删除", MenuKey = "roomconfig", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - // Customer management (客户管理) - new Permission { PermissionNumber = "viplevel.view", PermissionName = "会员等级-查看", Module = "customer", Description = "会员等级规则-查看", MenuKey = "viplevel", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "viplevel.create", PermissionName = "会员等级-新增", Module = "customer", Description = "会员等级规则-新增", MenuKey = "viplevel", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "viplevel.update", PermissionName = "会员等级-编辑", Module = "customer", Description = "会员等级规则-编辑", MenuKey = "viplevel", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "viplevel.delete", PermissionName = "会员等级-删除", Module = "customer", Description = "会员等级规则-删除", MenuKey = "viplevel", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "customer.view", PermissionName = "客户-查看", Module = "customer", Description = "客户信息管理-查看", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "customer.create", PermissionName = "客户-新增", Module = "customer", Description = "客户信息管理-新增", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "customer.update", PermissionName = "客户-编辑", Module = "customer", Description = "客户信息管理-编辑", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "customer.delete", PermissionName = "客户-删除", Module = "customer", Description = "客户信息管理-删除", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "customerspend.view", PermissionName = "消费记录-查看", Module = "customer", Description = "客户消费账单-查看", MenuKey = "customerspend", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "customerspend.create", PermissionName = "消费记录-新增", Module = "customer", Description = "客户消费账单-新增", MenuKey = "customerspend", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "customerspend.update", PermissionName = "消费记录-编辑", Module = "customer", Description = "客户消费账单-编辑", MenuKey = "customerspend", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "customerspend.delete", PermissionName = "消费记录-删除", Module = "customer", Description = "客户消费账单-删除", MenuKey = "customerspend", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "customertype.view", PermissionName = "客户类型-查看", Module = "customer", Description = "客户类型管理-查看", MenuKey = "customertype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "customertype.create", PermissionName = "客户类型-新增", Module = "customer", Description = "客户类型管理-新增", MenuKey = "customertype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "customertype.update", PermissionName = "客户类型-编辑", Module = "customer", Description = "客户类型管理-编辑", MenuKey = "customertype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "customertype.delete", PermissionName = "客户类型-删除", Module = "customer", Description = "客户类型管理-删除", MenuKey = "customertype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - // Human resource (酒店人事管理) - new Permission { PermissionNumber = "staffmanagement.view", PermissionName = "员工-查看", Module = "humanresource", Description = "员工管理-查看", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "staffmanagement.create", PermissionName = "员工-新增", Module = "humanresource", Description = "员工管理-新增", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "staffmanagement.update", PermissionName = "员工-编辑", Module = "humanresource", Description = "员工管理-编辑", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "staffmanagement.delete", PermissionName = "员工-删除", Module = "humanresource", Description = "员工管理-删除", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "staffmanagement.reset", PermissionName = "员工-重置密码", Module = "humanresource", Description = "员工管理-重置密码", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "staffmanagement.status", PermissionName = "员工-状态", Module = "humanresource", Description = "员工管理-状态", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "staffmanagement.get2fa", PermissionName = "员工-读取2FA状态", Module = "humanresource", Description = "员工管理-读取2FA状态", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "staffmanagement.generate2fa", PermissionName = "员工-生成2FA绑定信息", Module = "humanresource", Description = "员工管理-生成2FA绑定信息", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "staffmanagement.enable2fa", PermissionName = "员工-启用2FA", Module = "humanresource", Description = "员工管理-启用2FA", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "staffmanagement.disable2fa", PermissionName = "员工-关闭2FA", Module = "humanresource", Description = "员工管理-关闭2FA", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "staffmanagement.recovery2fa", PermissionName = "员工-重置恢复备用码", Module = "humanresource", Description = "员工管理-重置2FA恢复备用码", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - // Material management (酒店物资管理) - new Permission { PermissionNumber = "goodsmanagement.view", PermissionName = "商品-查看", Module = "material", Description = "商品管理-查看", MenuKey = "goodsmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "goodsmanagement.create", PermissionName = "商品-新增", Module = "material", Description = "商品管理-新增", MenuKey = "goodsmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "goodsmanagement.update", PermissionName = "商品-编辑", Module = "material", Description = "商品管理-编辑", MenuKey = "goodsmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "goodsmanagement.delete", PermissionName = "商品-删除", Module = "material", Description = "商品管理-删除", MenuKey = "goodsmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - // Operation management (行为操作管理) - new Permission { PermissionNumber = "operationlog.view", PermissionName = "操作日志-查看", Module = "operation", Description = "操作日志-查看", MenuKey = "operationlog", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "operationlog.delete", PermissionName = "操作日志-删除", Module = "operation", Description = "操作日志-删除", MenuKey = "operationlog", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "requestlog.view", PermissionName = "请求日志-查看", Module = "operation", Description = "请求日志-查看", MenuKey = "requestlog", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "requestlog.delete", PermissionName = "请求日志-删除", Module = "operation", Description = "请求日志-删除", MenuKey = "requestlog", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - // System management (系统管理) - new Permission { PermissionNumber = "administratormanagement.view", PermissionName = "管理员-查看", Module = "system", Description = "管理员管理-查看", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "administratormanagement.create", PermissionName = "管理员-新增", Module = "system", Description = "管理员管理-新增", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "administratormanagement.update", PermissionName = "管理员-编辑", Module = "system", Description = "管理员管理-编辑", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "administratormanagement.delete", PermissionName = "管理员-删除", Module = "system", Description = "管理员管理-删除", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "menumanagement.view", PermissionName = "菜单-查看", Module = "system", Description = "菜单管理-查看", MenuKey = "menumanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "menumanagement.create", PermissionName = "菜单-新增", Module = "system", Description = "菜单管理-新增", MenuKey = "menumanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "menumanagement.update", PermissionName = "菜单-编辑", Module = "system", Description = "菜单管理-编辑", MenuKey = "menumanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "menumanagement.delete", PermissionName = "菜单-删除", Module = "system", Description = "菜单管理-删除", MenuKey = "menumanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "rolemanagement.view", PermissionName = "角色-查看", Module = "system", Description = "角色管理-查看", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "rolemanagement.create", PermissionName = "角色-新增", Module = "system", Description = "角色管理-新增", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "rolemanagement.update", PermissionName = "角色-编辑", Module = "system", Description = "角色管理-编辑", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "rolemanagement.delete", PermissionName = "角色-删除", Module = "system", Description = "角色管理-删除", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "rolemanagement.grant", PermissionName = "角色-授予权限", Module = "system", Description = "角色管理-授予权限", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "admintypemanagement.view", PermissionName = "管理员类型-查看", Module = "system", Description = "管理员类型管理-查看", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "admintypemanagement.create", PermissionName = "管理员类型-新增", Module = "system", Description = "管理员类型管理-新增", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "admintypemanagement.update", PermissionName = "管理员类型-编辑", Module = "system", Description = "管理员类型管理-编辑", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "admintypemanagement.delete", PermissionName = "管理员类型-删除", Module = "system", Description = "管理员类型管理-删除", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - // System management v2 (match API RequirePermission) - new Permission { PermissionNumber = "system:role:list", PermissionName = "角色-列表/读取", Module = "system", Description = "角色管理-查询/读取", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:role:create", PermissionName = "角色-新增(API)", Module = "system", Description = "角色管理-新增(接口)", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:role:update", PermissionName = "角色-编辑(API)", Module = "system", Description = "角色管理-编辑(接口)", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:role:delete", PermissionName = "角色-删除(API)", Module = "system", Description = "角色管理-删除(接口)", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:role:grant", PermissionName = "角色-授予权限(API)", Module = "system", Description = "角色管理-授予权限/关联管理员(接口)", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "system:admin:list", PermissionName = "管理员-列表/读取", Module = "system", Description = "管理员管理-查询/读取", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:admin:create", PermissionName = "管理员-新增(API)", Module = "system", Description = "管理员管理-新增(接口)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:admin:update", PermissionName = "管理员-编辑(API)", Module = "system", Description = "管理员管理-编辑(接口)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:admin:delete", PermissionName = "管理员-删除(API)", Module = "system", Description = "管理员管理-删除(接口)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:admin:get2fa", PermissionName = "管理员-读取2FA状态(API)", Module = "system", Description = "管理员2FA-读取状态(接口)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:admin:generate2fa", PermissionName = "管理员-生成2FA绑定信息(API)", Module = "system", Description = "管理员2FA-生成绑定信息(接口)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:admin:enable2fa", PermissionName = "管理员-启用2FA(API)", Module = "system", Description = "管理员2FA-启用(接口)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:admin:disable2fa", PermissionName = "管理员-关闭2FA(API)", Module = "system", Description = "管理员2FA-关闭(接口)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:admin:recovery2fa", PermissionName = "管理员-重置恢复备用码(API)", Module = "system", Description = "管理员2FA-重置恢复备用码(接口)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "system:admintype:list", PermissionName = "管理员类型-列表/读取", Module = "system", Description = "管理员类型管理-查询/读取", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:admintype:create", PermissionName = "管理员类型-新增(API)", Module = "system", Description = "管理员类型管理-新增(接口)", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:admintype:update", PermissionName = "管理员类型-编辑(API)", Module = "system", Description = "管理员类型管理-编辑(接口)", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:admintype:delete", PermissionName = "管理员类型-删除(API)", Module = "system", Description = "管理员类型管理-删除(接口)", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - - new Permission { PermissionNumber = "system:user:assign", PermissionName = "用户-分配角色/权限", Module = "system", Description = "管理员-分配角色/直接权限(接口)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "system:user:assign.view", PermissionName = "用户-读取角色/权限", Module = "system", Description = "管理员-读取角色/直接权限(接口)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - // Misc pages - new Permission { PermissionNumber = "dashboard.view", PermissionName = "仪表盘-查看", Module = "home", Description = "仪表盘-查看", MenuKey = "dashboard", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, - new Permission { PermissionNumber = "home.view", PermissionName = "首页-查看", Module = "home", Description = "首页-查看", MenuKey = "home", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now } + // ===== Permission seeds synced from controller [RequirePermission] ===== + new Permission { PermissionNumber = "customer.delcustomerinfo", PermissionName = "删除客户信息", Module = "customer", Description = "删除客户信息", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customer.insertcustomerinfo", PermissionName = "添加客户信息", Module = "customer", Description = "添加客户信息", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customer.selectcustobyinfo", PermissionName = "查询指定客户信息", Module = "customer", Description = "查询指定客户信息", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customer.selectcustomers", PermissionName = "查询所有客户信息", Module = "customer", Description = "查询所有客户信息", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customer.updcustomerinfo", PermissionName = "更新客户信息", Module = "customer", Description = "更新客户信息", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customer.updcustomertypebycustono", PermissionName = "更新客户类型(即会员等级)", Module = "customer", Description = "更新客户类型(即会员等级)", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customerspend.addcustomerspend", PermissionName = "添加客户消费信息", Module = "customerspend", Description = "添加客户消费信息", MenuKey = "customerspend", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customerspend.selectspendbyroomno", PermissionName = "根据房间编号查询消费信息", Module = "customerspend", Description = "根据房间编号查询消费信息", MenuKey = "customerspend", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customerspend.selectspendinfoall", PermissionName = "查询消费的所有信息", Module = "customerspend", Description = "查询消费的所有信息", MenuKey = "customerspend", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customerspend.selethistoryspendinfoall", PermissionName = "根据客户编号查询历史消费信息", Module = "customerspend", Description = "根据客户编号查询历史消费信息", MenuKey = "customerspend", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customerspend.sumconsumptionamount", PermissionName = "根据房间编号、入住时间到当前时间查询消费总金额", Module = "customerspend", Description = "根据房间编号、入住时间到当前时间查询消费总金额", MenuKey = "customerspend", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customerspend.undocustomerspend", PermissionName = "撤回客户消费信息", Module = "customerspend", Description = "撤回客户消费信息", MenuKey = "customerspend", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customerspend.updspendinfo", PermissionName = "更新消费信息", Module = "customerspend", Description = "更新消费信息", MenuKey = "customerspend", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customertype.create", PermissionName = "获取所有房间状态", Module = "customertype", Description = "获取所有房间状态", MenuKey = "customertype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customertype.delete", PermissionName = "获取所有房间状态", Module = "customertype", Description = "获取所有房间状态", MenuKey = "customertype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customertype.update", PermissionName = "获取所有房间状态", Module = "customertype", Description = "获取所有房间状态", MenuKey = "customertype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "customertype.view", PermissionName = "获取所有房间状态", Module = "customertype", Description = "获取所有房间状态", MenuKey = "customertype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "dashboard.businessstatistics", PermissionName = "获取业务统计信息", Module = "dashboard", Description = "获取业务统计信息", MenuKey = "dashboard", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "dashboard.humanresourcesstatistics", PermissionName = "获取人事统计信息", Module = "dashboard", Description = "获取人事统计信息", MenuKey = "dashboard", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "dashboard.logisticsstatistics", PermissionName = "获取后勤统计信息", Module = "dashboard", Description = "获取后勤统计信息", MenuKey = "dashboard", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "dashboard.roomstatistics", PermissionName = "获取房间统计信息", Module = "dashboard", Description = "获取房间统计信息", MenuKey = "dashboard", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "department.create", PermissionName = "获取所有房间状态", Module = "department", Description = "获取所有房间状态", MenuKey = "department", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "department.delete", PermissionName = "获取所有房间状态", Module = "department", Description = "获取所有房间状态", MenuKey = "department", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "department.update", PermissionName = "获取所有房间状态", Module = "department", Description = "获取所有房间状态", MenuKey = "department", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "department.view", PermissionName = "获取所有房间状态", Module = "department", Description = "获取所有房间状态", MenuKey = "department", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "goodsmanagement.deletesellthing", PermissionName = "删除商品信息", Module = "goodsmanagement", Description = "删除商品信息", MenuKey = "goodsmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "goodsmanagement.insertsellthing", PermissionName = "添加商品", Module = "goodsmanagement", Description = "添加商品", MenuKey = "goodsmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "goodsmanagement.selectsellthingall", PermissionName = "查询所有商品", Module = "goodsmanagement", Description = "查询所有商品", MenuKey = "goodsmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "goodsmanagement.selectsellthingbynameandprice", PermissionName = "根据商品名称和价格查询商品编号", Module = "goodsmanagement", Description = "根据商品名称和价格查询商品编号", MenuKey = "goodsmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "goodsmanagement.updatesellthing", PermissionName = "修改商品", Module = "goodsmanagement", Description = "修改商品", MenuKey = "goodsmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "hydroelectricinformation.deleteenergymanagementinfo", PermissionName = "根据房间编号、使用时间删除水电费信息 替换了 DeleteWtiInfoByRoomNoAndDateTime", Module = "hydroelectricinformation", Description = "根据房间编号、使用时间删除水电费信息 替换了 DeleteWtiInfoByRoomNoAndDateTime", MenuKey = "hydroelectricinformation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "hydroelectricinformation.insertenergymanagementinfo", PermissionName = "添加水电费信息 替换了 InsertWtiInfo", Module = "hydroelectricinformation", Description = "添加水电费信息 替换了 InsertWtiInfo", MenuKey = "hydroelectricinformation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "hydroelectricinformation.selectenergymanagementinfo", PermissionName = "根据条件查询水电费信息 替换了 SelectWtiInfoByRoomNo, SelectWtiInfoByRoomNoAndTime, ListWtiInfoByRoomNo, SelectWtiInfoAll", Module = "hydroelectricinformation", Description = "根据条件查询水电费信息 替换了 SelectWtiInfoByRoomNo, SelectWtiInfoByRoomNoAndTime, ListWtiInfoByRoomNo, SelectWtiInfoAll", MenuKey = "hydroelectricinformation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "hydroelectricinformation.updateenergymanagementinfo", PermissionName = "修改水电费信息 替换了 UpdateWtiInfo 和 UpdateWtiInfoByRoomNoAndDateTime", Module = "hydroelectricinformation", Description = "修改水电费信息 替换了 UpdateWtiInfo 和 UpdateWtiInfoByRoomNoAndDateTime", MenuKey = "hydroelectricinformation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "internalfinance.addassetinfo", PermissionName = "添加资产信息", Module = "internalfinance", Description = "添加资产信息", MenuKey = "internalfinance", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "internalfinance.delassetinfo", PermissionName = "删除资产信息", Module = "internalfinance", Description = "删除资产信息", MenuKey = "internalfinance", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "internalfinance.selectassetinfoall", PermissionName = "查询资产信息", Module = "internalfinance", Description = "查询资产信息", MenuKey = "internalfinance", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "internalfinance.updassetinfo", PermissionName = "更新资产信息", Module = "internalfinance", Description = "更新资产信息", MenuKey = "internalfinance", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "menumanagement.buildmenuall", PermissionName = "构建菜单树", Module = "menumanagement", Description = "构建菜单树", MenuKey = "menumanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "menumanagement.deletemenu", PermissionName = "删除菜单", Module = "menumanagement", Description = "删除菜单", MenuKey = "menumanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "menumanagement.insertmenu", PermissionName = "插入菜单", Module = "menumanagement", Description = "插入菜单", MenuKey = "menumanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "menumanagement.selectmenuall", PermissionName = "查询所有菜单信息", Module = "menumanagement", Description = "查询所有菜单信息", MenuKey = "menumanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "menumanagement.updatemenu", PermissionName = "更新菜单", Module = "menumanagement", Description = "更新菜单", MenuKey = "menumanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "nation.create", PermissionName = "获取所有房间状态", Module = "nation", Description = "获取所有房间状态", MenuKey = "nation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "nation.delete", PermissionName = "获取所有房间状态", Module = "nation", Description = "获取所有房间状态", MenuKey = "nation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "nation.update", PermissionName = "获取所有房间状态", Module = "nation", Description = "获取所有房间状态", MenuKey = "nation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "nation.view", PermissionName = "获取所有房间状态", Module = "nation", Description = "获取所有房间状态", MenuKey = "nation", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "navbar.addnavbar", PermissionName = "添加导航控件", Module = "navbar", Description = "添加导航控件", MenuKey = "navbar", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "navbar.deletenavbar", PermissionName = "删除导航控件", Module = "navbar", Description = "删除导航控件", MenuKey = "navbar", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "navbar.navbarlist", PermissionName = "导航控件列表", Module = "navbar", Description = "导航控件列表", MenuKey = "navbar", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "navbar.updatenavbar", PermissionName = "更新导航控件", Module = "navbar", Description = "更新导航控件", MenuKey = "navbar", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "noticetype.create", PermissionName = "添加公告类型", Module = "noticetype", Description = "添加公告类型", MenuKey = "noticetype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "noticetype.delete", PermissionName = "删除公告类型", Module = "noticetype", Description = "删除公告类型", MenuKey = "noticetype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "noticetype.update", PermissionName = "更新公告类型", Module = "noticetype", Description = "更新公告类型", MenuKey = "noticetype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "noticetype.view", PermissionName = "查询所有公告类型", Module = "noticetype", Description = "查询所有公告类型", MenuKey = "noticetype", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "operationlog.delete", PermissionName = "删除时间范围的操作日志", Module = "operationlog", Description = "删除时间范围的操作日志", MenuKey = "operationlog", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "operationlog.view", PermissionName = "查询所有操作日志", Module = "operationlog", Description = "查询所有操作日志", MenuKey = "operationlog", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "passport.create", PermissionName = "获取所有房间状态", Module = "passport", Description = "获取所有房间状态", MenuKey = "passport", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "passport.delete", PermissionName = "获取所有房间状态", Module = "passport", Description = "获取所有房间状态", MenuKey = "passport", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "passport.update", PermissionName = "获取所有房间状态", Module = "passport", Description = "获取所有房间状态", MenuKey = "passport", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "passport.view", PermissionName = "获取所有房间状态", Module = "passport", Description = "获取所有房间状态", MenuKey = "passport", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "position.create", PermissionName = "获取所有房间状态", Module = "position", Description = "获取所有房间状态", MenuKey = "position", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "position.delete", PermissionName = "获取所有房间状态", Module = "position", Description = "获取所有房间状态", MenuKey = "position", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "position.update", PermissionName = "获取所有房间状态", Module = "position", Description = "获取所有房间状态", MenuKey = "position", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "position.view", PermissionName = "获取所有房间状态", Module = "position", Description = "获取所有房间状态", MenuKey = "position", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "promotioncontent.addpromotioncontent", PermissionName = "添加宣传联动内容", Module = "promotioncontent", Description = "添加宣传联动内容", MenuKey = "promotioncontent", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "promotioncontent.deletepromotioncontent", PermissionName = "删除宣传联动内容", Module = "promotioncontent", Description = "删除宣传联动内容", MenuKey = "promotioncontent", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "promotioncontent.selectpromotioncontentall", PermissionName = "查询所有宣传联动内容", Module = "promotioncontent", Description = "查询所有宣传联动内容", MenuKey = "promotioncontent", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "promotioncontent.selectpromotioncontents", PermissionName = "查询所有宣传联动内容(跑马灯)", Module = "promotioncontent", Description = "查询所有宣传联动内容(跑马灯)", MenuKey = "promotioncontent", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "promotioncontent.updatepromotioncontent", PermissionName = "更新宣传联动内容", Module = "promotioncontent", Description = "更新宣传联动内容", MenuKey = "promotioncontent", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "qualification.create", PermissionName = "获取所有房间状态", Module = "qualification", Description = "获取所有房间状态", MenuKey = "qualification", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "qualification.delete", PermissionName = "获取所有房间状态", Module = "qualification", Description = "获取所有房间状态", MenuKey = "qualification", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "qualification.update", PermissionName = "获取所有房间状态", Module = "qualification", Description = "获取所有房间状态", MenuKey = "qualification", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "qualification.view", PermissionName = "获取所有房间状态", Module = "qualification", Description = "获取所有房间状态", MenuKey = "qualification", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "requestlog.delete", PermissionName = "删除时间范围的请求日志", Module = "requestlog", Description = "删除时间范围的请求日志", MenuKey = "requestlog", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "requestlog.view", PermissionName = "查询所有请求日志", Module = "requestlog", Description = "查询所有请求日志", MenuKey = "requestlog", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "resermanagement.deletereserinfo", PermissionName = "删除预约信息", Module = "resermanagement", Description = "删除预约信息", MenuKey = "resermanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "resermanagement.inserreserinfo", PermissionName = "添加预约信息", Module = "resermanagement", Description = "添加预约信息", MenuKey = "resermanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "resermanagement.selectreserall", PermissionName = "获取所有预约信息", Module = "resermanagement", Description = "获取所有预约信息", MenuKey = "resermanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "resermanagement.selectreserinfobyroomno", PermissionName = "根据房间编号获取预约信息", Module = "resermanagement", Description = "根据房间编号获取预约信息", MenuKey = "resermanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "resermanagement.selectresertypeall", PermissionName = "查询所有预约类型", Module = "resermanagement", Description = "查询所有预约类型", MenuKey = "resermanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "resermanagement.updatereserinfo", PermissionName = "更新预约信息", Module = "resermanagement", Description = "更新预约信息", MenuKey = "resermanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roomconfig.deleteroomtype", PermissionName = "删除房间状态", Module = "roomconfig", Description = "删除房间状态", MenuKey = "roomconfig", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roomconfig.insertroomtype", PermissionName = "添加房间状态", Module = "roomconfig", Description = "添加房间状态", MenuKey = "roomconfig", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roomconfig.selectroomtypebyroomno", PermissionName = "根据房间编号查询房间类型名称", Module = "roomconfig", Description = "根据房间编号查询房间类型名称", MenuKey = "roomconfig", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roomconfig.selectroomtypesall", PermissionName = "获取所有房间类型", Module = "roomconfig", Description = "获取所有房间类型", MenuKey = "roomconfig", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roomconfig.updateroomtype", PermissionName = "更新房间状态", Module = "roomconfig", Description = "更新房间状态", MenuKey = "roomconfig", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.checkinroombyreservation", PermissionName = "根据预约信息办理入住", Module = "roommanagement", Description = "根据预约信息办理入住", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.checkoutroom", PermissionName = "退房操作", Module = "roommanagement", Description = "退房操作", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.daybyroomno", PermissionName = "根据房间编号查询截止到今天住了多少天", Module = "roommanagement", Description = "根据房间编号查询截止到今天住了多少天", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.deleteroom", PermissionName = "删除房间", Module = "roommanagement", Description = "删除房间", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.insertroom", PermissionName = "添加房间", Module = "roommanagement", Description = "添加房间", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.selectcanuseroomall", PermissionName = "根据房间状态来查询可使用的房间", Module = "roommanagement", Description = "根据房间状态来查询可使用的房间", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.selectcanuseroomallbyroomstate", PermissionName = "查询可入住房间数量", Module = "roommanagement", Description = "查询可入住房间数量", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.selectfixingroomallbyroomstate", PermissionName = "查询维修房数量", Module = "roommanagement", Description = "查询维修房数量", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.selectnotclearroomallbyroomstate", PermissionName = "查询脏房数量", Module = "roommanagement", Description = "查询脏房数量", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.selectnotuseroomallbyroomstate", PermissionName = "查询已入住房间数量", Module = "roommanagement", Description = "查询已入住房间数量", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.selectreservedroomallbyroomstate", PermissionName = "查询预约房数量", Module = "roommanagement", Description = "查询预约房数量", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.selectroomall", PermissionName = "获取所有房间信息", Module = "roommanagement", Description = "获取所有房间信息", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.selectroombyroomno", PermissionName = "根据房间编号查询房间信息", Module = "roommanagement", Description = "根据房间编号查询房间信息", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.selectroombyroomprice", PermissionName = "根据房间编号查询房间价格", Module = "roommanagement", Description = "根据房间编号查询房间价格", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.selectroombyroomstate", PermissionName = "根据房间状态获取相应状态的房间信息", Module = "roommanagement", Description = "根据房间状态获取相应状态的房间信息", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.selectroombytypename", PermissionName = "获取房间分区的信息", Module = "roommanagement", Description = "获取房间分区的信息", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.transferroom", PermissionName = "转房操作", Module = "roommanagement", Description = "转房操作", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.updateroom", PermissionName = "更新房间", Module = "roommanagement", Description = "更新房间", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.updateroominfo", PermissionName = "根据房间编号修改房间信息(入住)", Module = "roommanagement", Description = "根据房间编号修改房间信息(入住)", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.updateroominfowithreser", PermissionName = "根据房间编号修改房间信息(预约)", Module = "roommanagement", Description = "根据房间编号修改房间信息(预约)", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "roommanagement.updateroomstatebyroomno", PermissionName = "根据房间编号更改房间状态", Module = "roommanagement", Description = "根据房间编号更改房间状态", MenuKey = "roommanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.addcheckinfo", PermissionName = "添加员工打卡数据", Module = "staffmanagement", Description = "添加员工打卡数据", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.addemployee", PermissionName = "添加员工信息", Module = "staffmanagement", Description = "添加员工信息", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.addhistorybyemployeeid", PermissionName = "根据工号添加员工履历", Module = "staffmanagement", Description = "根据工号添加员工履历", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.deleteworkerphoto", PermissionName = "删除员工照片", Module = "staffmanagement", Description = "删除员工照片", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.disabletwofactor", PermissionName = "关闭当前员工账号 2FA", Module = "staffmanagement", Description = "关闭当前员工账号 2FA", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.employeephoto", PermissionName = "查询员工照片", Module = "staffmanagement", Description = "查询员工照片", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.enabletwofactor", PermissionName = "启用当前员工账号 2FA", Module = "staffmanagement", Description = "启用当前员工账号 2FA", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.generatetwofactorsetup", PermissionName = "生成当前员工账号的 2FA 绑定信息", Module = "staffmanagement", Description = "生成当前员工账号的 2FA 绑定信息", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.gettwofactorstatus", PermissionName = "获取当前员工账号的 2FA 状态", Module = "staffmanagement", Description = "获取当前员工账号的 2FA 状态", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.insertworkerphoto", PermissionName = "添加员工照片", Module = "staffmanagement", Description = "添加员工照片", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.manageremployeeaccount", PermissionName = "员工账号禁/启用", Module = "staffmanagement", Description = "员工账号禁/启用", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.regeneratetwofactorrecoverycodes", PermissionName = "重置当前员工账号恢复备用码", Module = "staffmanagement", Description = "重置当前员工账号恢复备用码", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.resetemployeeaccountpassword", PermissionName = "重置员工账号密码", Module = "staffmanagement", Description = "重置员工账号密码", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.selectcheckinfobyemployeeid", PermissionName = "根据员工编号查询其所有的打卡记录", Module = "staffmanagement", Description = "根据员工编号查询其所有的打卡记录", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.selectemployeeall", PermissionName = "获取所有工作人员信息", Module = "staffmanagement", Description = "获取所有工作人员信息", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.selectemployeeinfobyemployeeid", PermissionName = "根据登录名称查询员工信息", Module = "staffmanagement", Description = "根据登录名称查询员工信息", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.selecthistorybyemployeeid", PermissionName = "根据工号查询履历信息", Module = "staffmanagement", Description = "根据工号查询履历信息", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.selecttodaycheckinfobyworkerno", PermissionName = "查询今天员工是否已签到", Module = "staffmanagement", Description = "查询今天员工是否已签到", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.selectworkercheckdaysumbyemployeeid", PermissionName = "查询员工签到天数", Module = "staffmanagement", Description = "查询员工签到天数", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.updateemployee", PermissionName = "修改员工信息", Module = "staffmanagement", Description = "修改员工信息", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.updateemployeeaccountpassword", PermissionName = "修改员工账号密码", Module = "staffmanagement", Description = "修改员工账号密码", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "staffmanagement.updateworkerphoto", PermissionName = "更新员工照片", Module = "staffmanagement", Description = "更新员工照片", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "supervisioninfo.deletesupervisionstatistics", PermissionName = "删除监管统计信息", Module = "supervisioninfo", Description = "删除监管统计信息", MenuKey = "supervisioninfo", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "supervisioninfo.insertsupervisionstatistics", PermissionName = "插入监管统计信息", Module = "supervisioninfo", Description = "插入监管统计信息", MenuKey = "supervisioninfo", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "supervisioninfo.selectsupervisionstatisticsall", PermissionName = "查询所有监管统计信息", Module = "supervisioninfo", Description = "查询所有监管统计信息", MenuKey = "supervisioninfo", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "supervisioninfo.updatesupervisionstatistics", PermissionName = "更新监管统计信息", Module = "supervisioninfo", Description = "更新监管统计信息", MenuKey = "supervisioninfo", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admin:addadmin", PermissionName = "添加管理员", Module = "system", Description = "添加管理员", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admin:deladmin", PermissionName = "删除管理员", Module = "system", Description = "删除管理员", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admin:disabletwofactor", PermissionName = "关闭当前管理员账号 2FA", Module = "system", Description = "关闭当前管理员账号 2FA", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admin:enabletwofactor", PermissionName = "启用当前管理员账号 2FA", Module = "system", Description = "启用当前管理员账号 2FA", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admin:generatetwofactorsetup", PermissionName = "生成当前管理员账号的 2FA 绑定信息", Module = "system", Description = "生成当前管理员账号的 2FA 绑定信息", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admin:getalladminlist", PermissionName = "获取所有管理员列表", Module = "system", Description = "获取所有管理员列表", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admin:gettwofactorstatus", PermissionName = "获取当前管理员账号的 2FA 状态", Module = "system", Description = "获取当前管理员账号的 2FA 状态", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admin:regeneratetwofactorrecoverycodes", PermissionName = "重置当前管理员账号恢复备用码", Module = "system", Description = "重置当前管理员账号恢复备用码", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admin:updadmin", PermissionName = "更新管理员", Module = "system", Description = "更新管理员", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admintype:addadmintype", PermissionName = "添加管理员类型", Module = "system", Description = "添加管理员类型", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admintype:deladmintype", PermissionName = "删除管理员类型", Module = "system", Description = "删除管理员类型", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admintype:getalladmintypes", PermissionName = "获取所有管理员类型", Module = "system", Description = "获取所有管理员类型", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:admintype:updadmintype", PermissionName = "更新管理员类型", Module = "system", Description = "更新管理员类型", MenuKey = "admintypemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:role:assignroleusers", PermissionName = "为角色分配管理员(全量覆盖)", Module = "system", Description = "为角色分配管理员(全量覆盖)", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:role:deleterole", PermissionName = "删除角色", Module = "system", Description = "删除角色", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:role:grantrolepermissions", PermissionName = "为角色授予权限(全量覆盖)", Module = "system", Description = "为角色授予权限(全量覆盖)", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:role:insertrole", PermissionName = "添加角色", Module = "system", Description = "添加角色", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:role:readrolepermissions", PermissionName = "读取指定角色已授予的权限编码集合", Module = "system", Description = "读取指定角色已授予的权限编码集合", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:role:readroleusers", PermissionName = "读取隶属于指定角色的管理员用户编码集合", Module = "system", Description = "读取隶属于指定角色的管理员用户编码集合", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:role:selectrolelist", PermissionName = "查询角色列表", Module = "system", Description = "查询角色列表", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:role:updaterole", PermissionName = "更新角色", Module = "system", Description = "更新角色", MenuKey = "rolemanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:admin.readuserdirectpermissions", PermissionName = "读取指定用户的“直接权限”(仅来自专属角色 R-USER-{UserNumber} 的权限编码列表)", Module = "system", Description = "读取指定用户的“直接权限”(仅来自专属角色 R-USER-{UserNumber} 的权限编码列表)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:admin.readuserrolepermissions", PermissionName = "读取指定用户的“角色-权限”明细(来自 RolePermission 关联,并联到 Permission 得到权限码与名称)", Module = "system", Description = "读取指定用户的“角色-权限”明细(来自 RolePermission 关联,并联到 Permission 得到权限码与名称)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:admin.readuserroles", PermissionName = "读取指定用户已分配的角色编码集合", Module = "system", Description = "读取指定用户已分配的角色编码集合", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:admin:assignuserpermissions", PermissionName = "为指定用户分配“直接权限”(通过专属角色 R-USER-{UserNumber} 写入 RolePermission,全量覆盖)", Module = "system", Description = "为指定用户分配“直接权限”(通过专属角色 R-USER-{UserNumber} 写入 RolePermission,全量覆盖)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:admin:assignuserroles", PermissionName = "为用户分配角色(全量覆盖)", Module = "system", Description = "为用户分配角色(全量覆盖)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:assign.selectpermissionlist", PermissionName = "查询权限列表(支持条件过滤与分页/忽略分页)", Module = "system", Description = "查询权限列表(支持条件过滤与分页/忽略分页)", MenuKey = "administratormanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:customer.readuserdirectpermissions", PermissionName = "读取客户“直接权限”权限编码集合(来自 R-USER-{UserNumber})", Module = "system", Description = "读取客户“直接权限”权限编码集合(来自 R-USER-{UserNumber})", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:customer.readuserrolepermissions", PermissionName = "读取客户“角色-权限”明细", Module = "system", Description = "读取客户“角色-权限”明细", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:customer.readuserroles", PermissionName = "读取客户已分配的角色编码集合", Module = "system", Description = "读取客户已分配的角色编码集合", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:customer:assignuserpermissions", PermissionName = "为客户分配“直接权限”(R-USER-{UserNumber} 全量覆盖)", Module = "system", Description = "为客户分配“直接权限”(R-USER-{UserNumber} 全量覆盖)", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:customer:assignuserroles", PermissionName = "为客户分配角色(全量覆盖)", Module = "system", Description = "为客户分配角色(全量覆盖)", MenuKey = "customer", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:employee.readuserdirectpermissions", PermissionName = "读取员工“直接权限”权限编码集合(来自 R-USER-{UserNumber})", Module = "system", Description = "读取员工“直接权限”权限编码集合(来自 R-USER-{UserNumber})", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:employee.readuserrolepermissions", PermissionName = "读取员工“角色-权限”明细", Module = "system", Description = "读取员工“角色-权限”明细", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:employee.readuserroles", PermissionName = "读取员工已分配的角色编码集合", Module = "system", Description = "读取员工已分配的角色编码集合", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:employee:assignuserpermissions", PermissionName = "为员工分配“直接权限”(R-USER-{UserNumber} 全量覆盖)", Module = "system", Description = "为员工分配“直接权限”(R-USER-{UserNumber} 全量覆盖)", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "system:user:employee:assignuserroles", PermissionName = "为员工分配角色(全量覆盖)", Module = "system", Description = "为员工分配角色(全量覆盖)", MenuKey = "staffmanagement", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "viplevel.addviprule", PermissionName = "添加会员等级规则", Module = "viplevel", Description = "添加会员等级规则", MenuKey = "viplevel", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "viplevel.delviprule", PermissionName = "删除会员等级规则", Module = "viplevel", Description = "删除会员等级规则", MenuKey = "viplevel", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "viplevel.selectviprule", PermissionName = "查询会员等级规则", Module = "viplevel", Description = "查询会员等级规则", MenuKey = "viplevel", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "viplevel.selectviprulelist", PermissionName = "查询会员等级规则列表", Module = "viplevel", Description = "查询会员等级规则列表", MenuKey = "viplevel", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, + new Permission { PermissionNumber = "viplevel.updviprule", PermissionName = "更新会员等级规则", Module = "viplevel", Description = "更新会员等级规则", MenuKey = "viplevel", ParentNumber = null, IsDelete = 0, DataInsUsr = "System", DataInsDate = DateTime.Now }, }; public Type[] EntityTypes => entityTypes; diff --git a/EOM.TSHotelManagement.Service/Application/NavBar/NavBarService.cs b/EOM.TSHotelManagement.Service/Application/NavBar/NavBarService.cs index e3f4b6f02fc87e734d9c4dade560e99b361ec225..da3cf709bae56ab21c1337b8bb8d30e5868849e8 100644 --- a/EOM.TSHotelManagement.Service/Application/NavBar/NavBarService.cs +++ b/EOM.TSHotelManagement.Service/Application/NavBar/NavBarService.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Common; +using EOM.TSHotelManagement.Common; using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Data; using EOM.TSHotelManagement.Domain; @@ -127,7 +127,8 @@ namespace EOM.TSHotelManagement.Service }; } - var navBars = navBarRepository.GetList(a => input.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(input); + var navBars = navBarRepository.GetList(a => delIds.Contains(a.Id)); if (!navBars.Any()) { @@ -138,6 +139,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(input, navBars, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 批量软删除 var result = navBarRepository.SoftDeleteRange(navBars); diff --git a/EOM.TSHotelManagement.Service/Business/Asset/AssetService.cs b/EOM.TSHotelManagement.Service/Business/Asset/AssetService.cs index 636ede335059c7f4a86f3d6572af1827cf1b4bf9..a3763018cf880abe5dd1c5499b902cdaee90d6f1 100644 --- a/EOM.TSHotelManagement.Service/Business/Asset/AssetService.cs +++ b/EOM.TSHotelManagement.Service/Business/Asset/AssetService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -184,7 +184,8 @@ namespace EOM.TSHotelManagement.Service }; } - var assets = assetRepository.GetList(a => asset.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(asset); + var assets = assetRepository.GetList(a => delIds.Contains(a.Id)); if (!assets.Any()) { @@ -195,6 +196,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(asset, assets, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + var result = assetRepository.SoftDeleteRange(assets); if (!result) diff --git a/EOM.TSHotelManagement.Service/Business/Customer/CustomerService.cs b/EOM.TSHotelManagement.Service/Business/Customer/CustomerService.cs index 68fc2203d0bc73b3d61d645f70ec01f7cb188821..ef10f0c3b96c7d885fe4ac1cd3db9821dc8c859e 100644 --- a/EOM.TSHotelManagement.Service/Business/Customer/CustomerService.cs +++ b/EOM.TSHotelManagement.Service/Business/Customer/CustomerService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -216,7 +216,8 @@ namespace EOM.TSHotelManagement.Service }; } - var customers = custoRepository.GetList(a => custo.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(custo); + var customers = custoRepository.GetList(a => delIds.Contains(a.Id)); if (!customers.Any()) { @@ -227,6 +228,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(custo, customers, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + var occupied = Convert.ToInt32(RoomState.Occupied); foreach (var customer in customers) { @@ -249,7 +255,7 @@ namespace EOM.TSHotelManagement.Service } catch (Exception) { - logger.LogError("Error deleting customer information for customer IDs {CustomerIds}", string.Join(", ", custo.DelIds)); + logger.LogError("Error deleting customer information for customer IDs {CustomerIds}", string.Join(", ", custo.DelIds.Select(x => x.Id))); return new BaseResponse(BusinessStatusCode.InternalServerError, LocalizationHelper.GetLocalizedString("Delete Customer Failed", "客户信息删除失败")); } } @@ -363,10 +369,11 @@ namespace EOM.TSHotelManagement.Service IdCardNumber = dataProtector.SafeDecryptCustomerData(source.IdCardNumber), CustomerAddress = source.CustomerAddress ?? "", DataInsUsr = source.DataInsUsr, - DataInsDate = source.DataInsDate, - DataChgUsr = source.DataChgUsr, - DataChgDate = source.DataChgDate, - IsDelete = source.IsDelete + DataInsDate = source.DataInsDate, + DataChgUsr = source.DataChgUsr, + DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, + IsDelete = source.IsDelete }; }); customerOutputDtos = dtoArray.ToList(); @@ -395,6 +402,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }); }); diff --git a/EOM.TSHotelManagement.Service/Business/EnergyManagement/EnergyManagementService.cs b/EOM.TSHotelManagement.Service/Business/EnergyManagement/EnergyManagementService.cs index b404337c5a850e61db618160e1481d07bc2eef77..09b7d43600ff470f018fc574968e52da1ceac2b2 100644 --- a/EOM.TSHotelManagement.Service/Business/EnergyManagement/EnergyManagementService.cs +++ b/EOM.TSHotelManagement.Service/Business/EnergyManagement/EnergyManagementService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -154,7 +154,8 @@ namespace EOM.TSHotelManagement.Service }; } - var energyManagements = wtiRepository.GetList(a => hydroelectricity.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(hydroelectricity); + var energyManagements = wtiRepository.GetList(a => delIds.Contains(a.Id)); if (!energyManagements.Any()) { @@ -165,6 +166,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(hydroelectricity, energyManagements, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + var result = wtiRepository.SoftDeleteRange(energyManagements); if (result) diff --git a/EOM.TSHotelManagement.Service/Business/News/NewsService.cs b/EOM.TSHotelManagement.Service/Business/News/NewsService.cs index 18e9a5a96b55a4b8df18d6a59723fac28b761c85..fa5322c0e54275b9840ace79edfcbdef4304dd1e 100644 --- a/EOM.TSHotelManagement.Service/Business/News/NewsService.cs +++ b/EOM.TSHotelManagement.Service/Business/News/NewsService.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Common; +using EOM.TSHotelManagement.Common; using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Data; using EOM.TSHotelManagement.Domain; @@ -237,7 +237,8 @@ namespace EOM.TSHotelManagement.Service }; } - var news = _newsRepository.GetList(a => deleteNewsInputDto.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(deleteNewsInputDto); + var news = _newsRepository.GetList(a => delIds.Contains(a.Id)); if (!news.Any()) { @@ -247,6 +248,11 @@ namespace EOM.TSHotelManagement.Service Message = LocalizationHelper.GetLocalizedString("News Information Not Found", "新闻信息未找到") }; } + + if (DeleteConcurrencyHelper.HasDeleteConflict(deleteNewsInputDto, news, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } try { diff --git a/EOM.TSHotelManagement.Service/Business/PromotionContent/PromotionContentService.cs b/EOM.TSHotelManagement.Service/Business/PromotionContent/PromotionContentService.cs index af380947a2d030a21ba49f1ccf3d4452c113055f..025f1ba2883d13e1b312c16f2ceb9af40c2ae69f 100644 --- a/EOM.TSHotelManagement.Service/Business/PromotionContent/PromotionContentService.cs +++ b/EOM.TSHotelManagement.Service/Business/PromotionContent/PromotionContentService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -93,6 +93,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }; }); @@ -112,6 +113,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }); }); @@ -184,7 +186,8 @@ namespace EOM.TSHotelManagement.Service }; } - var promotionContents = fontsRepository.GetList(a => deletePromotionContentInputDto.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(deletePromotionContentInputDto); + var promotionContents = fontsRepository.GetList(a => delIds.Contains(a.Id)); if (!promotionContents.Any()) { @@ -195,6 +198,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(deletePromotionContentInputDto, promotionContents, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + var result = fontsRepository.SoftDeleteRange(promotionContents); if (result) diff --git a/EOM.TSHotelManagement.Service/Business/Reser/ReserService.cs b/EOM.TSHotelManagement.Service/Business/Reser/ReserService.cs index 25edadae227ceffaac76231733048cf1fa89851d..888c7e0eb59d27c639973223fcece540b03c14a2 100644 --- a/EOM.TSHotelManagement.Service/Business/Reser/ReserService.cs +++ b/EOM.TSHotelManagement.Service/Business/Reser/ReserService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -123,6 +123,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }; }); @@ -148,6 +149,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }); }); @@ -211,7 +213,8 @@ namespace EOM.TSHotelManagement.Service }; } - var resers = reserRepository.GetList(a => reser.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(reser); + var resers = reserRepository.GetList(a => delIds.Contains(a.Id)); if (!resers.Any()) { @@ -222,6 +225,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(reser, resers, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + try { using (TransactionScope scope = new TransactionScope()) diff --git a/EOM.TSHotelManagement.Service/Business/Room/RoomService.cs b/EOM.TSHotelManagement.Service/Business/Room/RoomService.cs index c7c1f4ef4aeef3bf4492fe3c94c2b216a2bdb11b..c32440a4b44173882417295604260679207949e1 100644 --- a/EOM.TSHotelManagement.Service/Business/Room/RoomService.cs +++ b/EOM.TSHotelManagement.Service/Business/Room/RoomService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -227,6 +227,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }; }); @@ -256,6 +257,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }); }); @@ -610,7 +612,8 @@ namespace EOM.TSHotelManagement.Service }; } - var rooms = roomRepository.GetList(a => rn.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(rn); + var rooms = roomRepository.GetList(a => delIds.Contains(a.Id)); if (!rooms.Any()) { @@ -621,6 +624,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(rn, rooms, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 如果房间存在预约信息,则不允许删除 var roomNumbers = rooms.Select(a => a.RoomNumber).ToList(); var hasReservation = reserRepository.IsAny(a => roomNumbers.Contains(a.ReservationRoomNumber) && a.IsDelete != 1 && a.ReservationEndDate >= DateOnly.FromDateTime(DateTime.Today)); diff --git a/EOM.TSHotelManagement.Service/Business/Room/RoomTypeService.cs b/EOM.TSHotelManagement.Service/Business/Room/RoomTypeService.cs index bf099227d4860cd9ea3f6ffa6bf8c4ccb144d318..ebfadc02d561d37aa2b48284f76c78baa580dc97 100644 --- a/EOM.TSHotelManagement.Service/Business/Room/RoomTypeService.cs +++ b/EOM.TSHotelManagement.Service/Business/Room/RoomTypeService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -103,6 +103,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }; }); @@ -124,6 +125,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }); }); @@ -233,7 +235,8 @@ namespace EOM.TSHotelManagement.Service }; } - var roomTypes = roomTypeRepository.GetList(a => roomType.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(roomType); + var roomTypes = roomTypeRepository.GetList(a => delIds.Contains(a.Id)); if (!roomTypes.Any()) { @@ -244,6 +247,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(roomType, roomTypes, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 检查是否有房间关联到这些房间类型 var roomTypeIds = roomTypes.Select(rt => rt.RoomTypeId).ToList(); var associatedRooms = roomRepository.IsAny(r => roomTypeIds.Contains(r.RoomTypeId) && r.IsDelete != 1); diff --git a/EOM.TSHotelManagement.Service/Business/Sellthing/ISellService.cs b/EOM.TSHotelManagement.Service/Business/Sellthing/ISellService.cs index 7922687acaef645771d1bff49f0043470afe2193..5fdc58085d79d09f784f7eb16f8184a76ee956fa 100644 --- a/EOM.TSHotelManagement.Service/Business/Sellthing/ISellService.cs +++ b/EOM.TSHotelManagement.Service/Business/Sellthing/ISellService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -44,7 +44,7 @@ namespace EOM.TSHotelManagement.Service BaseResponse UpdateSellthing(UpdateSellThingInputDto sellThing); /// - /// 撤回客户消费信息 + /// 删除商品信息 /// /// /// @@ -64,4 +64,4 @@ namespace EOM.TSHotelManagement.Service /// BaseResponse InsertSellThing(CreateSellThingInputDto st); } -} \ No newline at end of file +} diff --git a/EOM.TSHotelManagement.Service/Business/Sellthing/SellService.cs b/EOM.TSHotelManagement.Service/Business/Sellthing/SellService.cs index dcc5e44450ee00b26d7c011e15432b9c131c7cf2..2ec8f4d75bb4f2eac0201b5dd0eaa3bef38587ae 100644 --- a/EOM.TSHotelManagement.Service/Business/Sellthing/SellService.cs +++ b/EOM.TSHotelManagement.Service/Business/Sellthing/SellService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -119,6 +119,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }; }); @@ -141,6 +142,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }); }); @@ -208,7 +210,8 @@ namespace EOM.TSHotelManagement.Service }; } - var sellThings = sellThingRepository.GetList(a => deleteSellThingInputDto.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(deleteSellThingInputDto); + var sellThings = sellThingRepository.GetList(a => delIds.Contains(a.Id)); if (!sellThings.Any()) { @@ -219,6 +222,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(deleteSellThingInputDto, sellThings, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + var result = sellThingRepository.SoftDeleteRange(sellThings); } diff --git a/EOM.TSHotelManagement.Service/Common/DeleteConcurrencyHelper.cs b/EOM.TSHotelManagement.Service/Common/DeleteConcurrencyHelper.cs new file mode 100644 index 0000000000000000000000000000000000000000..bbd9b6fe3f6c46f3650751f06bae08887324dd54 --- /dev/null +++ b/EOM.TSHotelManagement.Service/Common/DeleteConcurrencyHelper.cs @@ -0,0 +1,164 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Claims; +using System.Threading; +using EOM.TSHotelManagement.Contract; +using Microsoft.AspNetCore.Http; + +namespace EOM.TSHotelManagement.Service +{ + public class DeleteConcurrencyHelper + { + private static IHttpContextAccessor? _httpContextAccessor; + + public DeleteConcurrencyHelper(IHttpContextAccessor httpContextAccessor) + { + _httpContextAccessor = httpContextAccessor; + } + + public static List GetDeleteIds(DeleteDto deleteDto) + { + return deleteDto?.DelIds? + .Select(x => x.Id) + .Distinct() + .ToList() ?? new List(); + } + + public static bool HasDeleteConflict( + DeleteDto deleteDto, + IEnumerable entities, + Func idSelector, + Func rowVersionSelector, + Func? isAuthorizedId = null) + { + if (deleteDto?.DelIds == null || deleteDto.DelIds.Count == 0) + { + return false; + } + + var expectedVersionGroups = deleteDto.DelIds + .GroupBy(x => x.Id) + .ToList(); + + if (expectedVersionGroups.Any(g => g.Select(x => (long)x.RowVersion).Distinct().Count() > 1)) + { + return true; + } + + var expectedVersions = expectedVersionGroups + .ToDictionary(g => g.Key, g => (long)g.First().RowVersion); + + var entityList = (entities ?? Enumerable.Empty()).ToList(); + isAuthorizedId ??= BuildDefaultAuthorizationPredicate(entityList, idSelector); + + if (isAuthorizedId != null && expectedVersions.Keys.Any(id => !isAuthorizedId(id))) + { + return true; + } + + var actualVersions = entityList + .GroupBy(idSelector) + .ToDictionary(g => g.Key, g => rowVersionSelector(g.First())); + + if (expectedVersions.Count != actualVersions.Count) + { + return true; + } + + foreach (var item in expectedVersions) + { + if (!actualVersions.TryGetValue(item.Key, out var actualVersion)) + { + return true; + } + + if (actualVersion != item.Value) + { + return true; + } + } + + return false; + } + + private static Func? BuildDefaultAuthorizationPredicate( + IEnumerable entities, + Func idSelector) + { + var (currentUserNumber, isSuperAdmin) = GetCurrentUserContext(); + if (isSuperAdmin) + { + return _ => true; + } + + if (string.IsNullOrWhiteSpace(currentUserNumber)) + { + return null; + } + + var ownerProperty = typeof(TEntity).GetProperty("DataInsUsr"); + if (ownerProperty == null || ownerProperty.PropertyType != typeof(string)) + { + return null; + } + + var ownerById = entities + .GroupBy(idSelector) + .ToDictionary( + g => g.Key, + g => ownerProperty.GetValue(g.First())?.ToString()); + + return id => + { + if (!ownerById.TryGetValue(id, out var owner)) + { + return false; + } + + return string.IsNullOrWhiteSpace(owner) + || string.Equals(owner, currentUserNumber, StringComparison.OrdinalIgnoreCase); + }; + } + + private static (string? UserNumber, bool IsSuperAdmin) GetCurrentUserContext() + { + ClaimsPrincipal? user = null; + + try + { + user = _httpContextAccessor?.HttpContext?.User; + } + catch + { + // ignored + } + + user ??= Thread.CurrentPrincipal as ClaimsPrincipal; + if (user == null) + { + return (null, false); + } + + var userNumber = user.FindFirst(ClaimTypes.SerialNumber)?.Value + ?? user.FindFirst("serialnumber")?.Value + ?? user.FindFirst(ClaimTypes.NameIdentifier)?.Value; + + var isSuperAdminClaim = user.FindFirst("is_super_admin")?.Value + ?? user.FindFirst("isSuperAdmin")?.Value + ?? user.FindFirst("issuperadmin")?.Value; + + return (userNumber, ParseBooleanLikeValue(isSuperAdminClaim)); + } + + private static bool ParseBooleanLikeValue(string? value) + { + if (string.IsNullOrWhiteSpace(value)) + { + return false; + } + + return value == "1" || value.Equals("true", StringComparison.OrdinalIgnoreCase); + } + } +} diff --git a/EOM.TSHotelManagement.Service/Employee/EmployeeService.cs b/EOM.TSHotelManagement.Service/Employee/EmployeeService.cs index 6355b7f3a09a6f71bb19b83d492597e65878686c..205f18924d32a39375da08fdc0a64a19a2d9800e 100644 --- a/EOM.TSHotelManagement.Service/Employee/EmployeeService.cs +++ b/EOM.TSHotelManagement.Service/Employee/EmployeeService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -282,6 +282,7 @@ namespace EOM.TSHotelManagement.Service var source = employees[i]; dtoArray[i] = new ReadEmployeeOutputDto { + Id = source.Id, EmployeeId = source.EmployeeId, EmployeeName = source.EmployeeName, Gender = source.Gender, @@ -312,6 +313,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }; }); @@ -324,6 +326,7 @@ namespace EOM.TSHotelManagement.Service { data.Add(new ReadEmployeeOutputDto { + Id = source.Id, EmployeeId = source.EmployeeId, EmployeeName = source.EmployeeName, Gender = source.Gender, @@ -354,6 +357,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }); }); diff --git a/EOM.TSHotelManagement.Service/SystemManagement/Administrator/AdminService.cs b/EOM.TSHotelManagement.Service/SystemManagement/Administrator/AdminService.cs index c494ca895708248b7f9c9de05479f3f368d158e3..6ad64760ef5fa594d9687a9862abc6c1a36853be 100644 --- a/EOM.TSHotelManagement.Service/SystemManagement/Administrator/AdminService.cs +++ b/EOM.TSHotelManagement.Service/SystemManagement/Administrator/AdminService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -194,7 +194,8 @@ namespace EOM.TSHotelManagement.Service existingAdmin.UserToken = jWTHelper.GenerateJWT(new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.Name, existingAdmin.Name), - new Claim(ClaimTypes.SerialNumber, existingAdmin.Number) + new Claim(ClaimTypes.SerialNumber, existingAdmin.Number), + new Claim("is_super_admin", existingAdmin.IsSuperAdmin.ToString()) })); var source = EntityMapper.Map(existingAdmin); @@ -307,6 +308,7 @@ namespace EOM.TSHotelManagement.Service var source = administrators[i]; dtoArray[i] = new ReadAdministratorOutputDto { + Id = source.Id, Number = source.Number, Account = source.Account, Password = source.Password, @@ -319,6 +321,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }; }); @@ -331,6 +334,7 @@ namespace EOM.TSHotelManagement.Service { result.Add(new ReadAdministratorOutputDto { + Id = source.Id, Number = source.Number, Account = source.Account, Password = source.Password, @@ -343,6 +347,7 @@ namespace EOM.TSHotelManagement.Service DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }); }); @@ -437,7 +442,8 @@ namespace EOM.TSHotelManagement.Service }; } - var administrators = adminRepository.GetList(a => deleteAdministratorInputDto.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(deleteAdministratorInputDto); + var administrators = adminRepository.GetList(a => delIds.Contains(a.Id)); if (!administrators.Any()) { @@ -448,6 +454,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(deleteAdministratorInputDto, administrators, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // cannot be delete if is super admin var admin = administrators.Any(a => a.IsSuperAdmin == 1); if (admin) @@ -511,12 +522,14 @@ namespace EOM.TSHotelManagement.Service var source = administratorTypes[i]; dtoArray[i] = new ReadAdministratorTypeOutputDto { + Id = source.Id, TypeId = source.TypeId, TypeName = source.TypeName, DataInsUsr = source.DataInsUsr, DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }; }); @@ -529,12 +542,14 @@ namespace EOM.TSHotelManagement.Service { result.Add(new ReadAdministratorTypeOutputDto { + Id = source.Id, TypeId = source.TypeId, TypeName = source.TypeName, DataInsUsr = source.DataInsUsr, DataInsDate = source.DataInsDate, DataChgUsr = source.DataChgUsr, DataChgDate = source.DataChgDate, + RowVersion = source.RowVersion, IsDelete = source.IsDelete }); }); @@ -606,7 +621,8 @@ namespace EOM.TSHotelManagement.Service }; } - var administratorTypes = adminTypeRepository.GetList(a => deleteAdministratorTypeInputDto.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(deleteAdministratorTypeInputDto); + var administratorTypes = adminTypeRepository.GetList(a => delIds.Contains(a.Id)); if (!administratorTypes.Any()) { @@ -617,6 +633,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(deleteAdministratorTypeInputDto, administratorTypes, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // cannot be delete if have administrators var haveAdmin = adminRepository.IsAny(a => administratorTypes.Select(a => a.TypeId).Contains(a.Type) && a.IsDelete != 1); if (haveAdmin) diff --git a/EOM.TSHotelManagement.Service/SystemManagement/Base/BaseService.cs b/EOM.TSHotelManagement.Service/SystemManagement/Base/BaseService.cs index 3959c66acf42f01aed3f2c1ddb9ae6320c87501e..23dd1d28e2022abc9d4896a1f01fc90cd95c8eb2 100644 --- a/EOM.TSHotelManagement.Service/SystemManagement/Base/BaseService.cs +++ b/EOM.TSHotelManagement.Service/SystemManagement/Base/BaseService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -316,7 +316,8 @@ namespace EOM.TSHotelManagement.Service }; } - var positions = positionRepository.GetList(a => deletePositionInputDto.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(deletePositionInputDto); + var positions = positionRepository.GetList(a => delIds.Contains(a.Id)); if (!positions.Any()) { @@ -327,6 +328,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(deletePositionInputDto, positions, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 当前职位下是否有员工 var positionNumbers = positions.Select(a => a.PositionNumber).ToList(); var employeeCount = workerRepository.AsQueryable().Count(a => positionNumbers.Contains(a.Position)); @@ -459,7 +465,8 @@ namespace EOM.TSHotelManagement.Service }; } - var nations = nationRepository.GetList(a => deleteNationInputDto.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(deleteNationInputDto); + var nations = nationRepository.GetList(a => delIds.Contains(a.Id)); if (!nations.Any()) { @@ -470,6 +477,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(deleteNationInputDto, nations, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 当前民族类型下是否有员工 var nationNumbers = nations.Select(a => a.NationNumber).ToList(); var employeeCount = workerRepository.AsQueryable().Count(a => nationNumbers.Contains(a.Ethnicity)); @@ -600,7 +612,8 @@ namespace EOM.TSHotelManagement.Service Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误") }; } - var educations = educationRepository.GetList(a => deleteEducationInputDto.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(deleteEducationInputDto); + var educations = educationRepository.GetList(a => delIds.Contains(a.Id)); if (!educations.Any()) { return new BaseResponse @@ -610,6 +623,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(deleteEducationInputDto, educations, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 当前学历类型下是否有员工 var educationNumbers = educations.Select(a => a.EducationNumber).ToList(); var employeeCount = workerRepository.AsQueryable().Count(a => educationNumbers.Contains(a.EducationLevel)); @@ -772,7 +790,8 @@ namespace EOM.TSHotelManagement.Service Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误") }; } - var departments = deptRepository.GetList(a => dept.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(dept); + var departments = deptRepository.GetList(a => delIds.Contains(a.Id)); if (!departments.Any()) { return new BaseResponse @@ -782,6 +801,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(dept, departments, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 当前部门类型下是否有员工 var departmentNumbers = departments.Select(a => a.DepartmentNumber).ToList(); var employeeCount = workerRepository.AsQueryable().Count(a => departmentNumbers.Contains(a.Department)); @@ -931,7 +955,8 @@ namespace EOM.TSHotelManagement.Service Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误") }; } - var custoTypes = custoTypeRepository.GetList(a => custoType.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(custoType); + var custoTypes = custoTypeRepository.GetList(a => delIds.Contains(a.Id)); if (!custoTypes.Any()) { return new BaseResponse @@ -941,6 +966,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(custoType, custoTypes, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 当前客户类型下是否有客户 var customerTypeNumbers = custoTypes.Select(a => a.CustomerType).ToList(); var customerCount = customerRepository.AsQueryable().Count(a => customerTypeNumbers.Contains(a.CustomerType)); @@ -1090,7 +1120,8 @@ namespace EOM.TSHotelManagement.Service Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误") }; } - var passPortTypes = passPortTypeRepository.GetList(a => portType.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(portType); + var passPortTypes = passPortTypeRepository.GetList(a => delIds.Contains(a.Id)); if (!passPortTypes.Any()) { return new BaseResponse @@ -1100,6 +1131,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(portType, passPortTypes, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 当前证件类型下是否有客户 var passportTypeNumbers = passPortTypes.Select(a => a.PassportId).ToList(); var customerCount = customerRepository.AsQueryable().Count(a => passportTypeNumbers.Contains(a.PassportId)); @@ -1260,7 +1296,8 @@ namespace EOM.TSHotelManagement.Service Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误") }; } - var rewardPunishmentTypes = goodbadTypeRepository.GetList(a => request.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(request); + var rewardPunishmentTypes = goodbadTypeRepository.GetList(a => delIds.Contains(a.Id)); if (!rewardPunishmentTypes.Any()) { return new BaseResponse @@ -1270,6 +1307,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(request, rewardPunishmentTypes, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + var result = goodbadTypeRepository.SoftDeleteRange(rewardPunishmentTypes); return new BaseResponse(); @@ -1390,7 +1432,8 @@ namespace EOM.TSHotelManagement.Service Message = LocalizationHelper.GetLocalizedString("Parameters Invalid", "参数错误") }; } - var appointmentNoticeTypes = appointmentNoticeTypeRepository.GetList(a => deleteAppointmentNoticeTypeInputDto.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(deleteAppointmentNoticeTypeInputDto); + var appointmentNoticeTypes = appointmentNoticeTypeRepository.GetList(a => delIds.Contains(a.Id)); if (!appointmentNoticeTypes.Any()) { return new BaseResponse @@ -1400,6 +1443,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(deleteAppointmentNoticeTypeInputDto, appointmentNoticeTypes, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 当前公告类型下是否有公告 var noticeTypeNumbers = appointmentNoticeTypes.Select(a => a.NoticeTypeNumber).ToList(); var appointmentNoticeCount = appointmentNoticeRepository.AsQueryable().Count(a => noticeTypeNumbers.Contains(a.NoticeType)); diff --git a/EOM.TSHotelManagement.Service/SystemManagement/Menu/MenuService.cs b/EOM.TSHotelManagement.Service/SystemManagement/Menu/MenuService.cs index 8eda14278ccc6656ac3f042a06d4e9ca07aaa1d4..e774e304d08abf16358bd2aeeb9efad266eb8d0d 100644 --- a/EOM.TSHotelManagement.Service/SystemManagement/Menu/MenuService.cs +++ b/EOM.TSHotelManagement.Service/SystemManagement/Menu/MenuService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -305,7 +305,8 @@ namespace EOM.TSHotelManagement.Service }; } - var menus = menuRepository.GetList(a => input.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(input); + var menus = menuRepository.GetList(a => delIds.Contains(a.Id)); if (!menus.Any()) { @@ -316,6 +317,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(input, menus, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + var result = menuRepository.SoftDeleteRange(menus); return new BaseResponse(); diff --git a/EOM.TSHotelManagement.Service/SystemManagement/Notice/NoticeService.cs b/EOM.TSHotelManagement.Service/SystemManagement/Notice/NoticeService.cs index ce33c798d53535c9cddcd018def2674e8a081933..4d11897848a943434e8cc8f21faea5844618c0ab 100644 --- a/EOM.TSHotelManagement.Service/SystemManagement/Notice/NoticeService.cs +++ b/EOM.TSHotelManagement.Service/SystemManagement/Notice/NoticeService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -141,7 +141,8 @@ namespace EOM.TSHotelManagement.Service }; } - var appointmentNotices = noticeRepository.GetList(a => input.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(input); + var appointmentNotices = noticeRepository.GetList(a => delIds.Contains(a.Id)); if (!appointmentNotices.Any()) { @@ -152,6 +153,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(input, appointmentNotices, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + var result = noticeRepository.SoftDeleteRange(appointmentNotices); return new BaseResponse(); diff --git a/EOM.TSHotelManagement.Service/SystemManagement/Permission/PermissionAppService.cs b/EOM.TSHotelManagement.Service/SystemManagement/Permission/PermissionAppService.cs index bb4c791df59e9eef4efc8fe4747c086cf0150759..6b3ad3517ddbd9258ed0fbd7c7517615573ca267 100644 --- a/EOM.TSHotelManagement.Service/SystemManagement/Permission/PermissionAppService.cs +++ b/EOM.TSHotelManagement.Service/SystemManagement/Permission/PermissionAppService.cs @@ -48,11 +48,13 @@ namespace EOM.TSHotelManagement.Service var outputItems = list.Select(p => new ReadPermissionOutputDto { + Id = p.Id, PermissionNumber = p.PermissionNumber, PermissionName = p.PermissionName, Module = p.Module, MenuKey = p.MenuKey, - Description = p.Description + Description = p.Description, + RowVersion = p.RowVersion }).ToList(); return new ListOutputDto diff --git a/EOM.TSHotelManagement.Service/SystemManagement/Role/RoleAppService.cs b/EOM.TSHotelManagement.Service/SystemManagement/Role/RoleAppService.cs index 434900e5036f9c17d3d251c765412977e50d1f24..390b67c33b0d122b5dc2e8ed6d9f3b52354cb7f5 100644 --- a/EOM.TSHotelManagement.Service/SystemManagement/Role/RoleAppService.cs +++ b/EOM.TSHotelManagement.Service/SystemManagement/Role/RoleAppService.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Common; +using EOM.TSHotelManagement.Common; using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Contract.SystemManagement.Dto.Permission; using EOM.TSHotelManagement.Contract.SystemManagement.Dto.Role; @@ -59,7 +59,8 @@ namespace EOM.TSHotelManagement.Service }; } - var roles = roleRepository.GetList(a => deleteRoleInputDto.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(deleteRoleInputDto); + var roles = roleRepository.GetList(a => delIds.Contains(a.Id)); if (!roles.Any()) { @@ -70,6 +71,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(deleteRoleInputDto, roles, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 如果角色组存在关联的权限映射或用户绑定,则不允许删除 var roleNumbers = roles.Select(r => r.RoleNumber).ToList(); var hasRolePermissions = rolePermissionRepository.IsAny(rp => roleNumbers.Contains(rp.RoleNumber) && rp.IsDelete != 1); diff --git a/EOM.TSHotelManagement.Service/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs b/EOM.TSHotelManagement.Service/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs index 2d79fb2dc8921d9550b894339b0404b21544e4c7..1b370db4567c385fbfd1af5c233af6a8a2c52444 100644 --- a/EOM.TSHotelManagement.Service/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs +++ b/EOM.TSHotelManagement.Service/SystemManagement/SupervisionStatistics/SupervisionStatisticsService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -154,7 +154,8 @@ namespace EOM.TSHotelManagement.Service }; } - var supervisionStatistics = checkInfoRepository.GetList(a => input.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(input); + var supervisionStatistics = checkInfoRepository.GetList(a => delIds.Contains(a.Id)); if (!supervisionStatistics.Any()) { @@ -165,6 +166,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(input, supervisionStatistics, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 批量软删除 var result = checkInfoRepository.SoftDeleteRange(supervisionStatistics); diff --git a/EOM.TSHotelManagement.Service/SystemManagement/VipRule/VipRuleAppService.cs b/EOM.TSHotelManagement.Service/SystemManagement/VipRule/VipRuleAppService.cs index 69bfcb20efa850584b1391286d794520d4118170..2de9ecbc0a179364462ba2ff20184837917b5735 100644 --- a/EOM.TSHotelManagement.Service/SystemManagement/VipRule/VipRuleAppService.cs +++ b/EOM.TSHotelManagement.Service/SystemManagement/VipRule/VipRuleAppService.cs @@ -1,4 +1,4 @@ -/* +/* * MIT License *Copyright (c) 2021 易开元(Easy-Open-Meta) @@ -154,7 +154,8 @@ namespace EOM.TSHotelManagement.Service }; } - var vipLevelRules = vipRuleRepository.GetList(a => vipRule.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(vipRule); + var vipLevelRules = vipRuleRepository.GetList(a => delIds.Contains(a.Id)); if (!vipLevelRules.Any()) { @@ -165,6 +166,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(vipRule, vipLevelRules, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + // 批量软删除 vipRuleRepository.SoftDeleteRange(vipLevelRules); return new BaseResponse(); diff --git a/EOM.TSHotelManagement.Service/Util/UtilService.cs b/EOM.TSHotelManagement.Service/Util/UtilService.cs index 57e29a1f39135d153b95e81533aad31b67e6583a..1f04c1e665382f2f9780c89bbde0a7867c515f8c 100644 --- a/EOM.TSHotelManagement.Service/Util/UtilService.cs +++ b/EOM.TSHotelManagement.Service/Util/UtilService.cs @@ -1,4 +1,4 @@ -using EOM.TSHotelManagement.Common; +using EOM.TSHotelManagement.Common; using EOM.TSHotelManagement.Contract; using EOM.TSHotelManagement.Data; using EOM.TSHotelManagement.Domain; @@ -210,7 +210,8 @@ namespace EOM.TSHotelManagement.Service }; } - var operationLogs = operationLogRepository.GetList(a => deleteOperationLogInputDto.DelIds.Contains(a.Id)); + var delIds = DeleteConcurrencyHelper.GetDeleteIds(deleteOperationLogInputDto); + var operationLogs = operationLogRepository.GetList(a => delIds.Contains(a.Id)); if (!operationLogs.Any()) { @@ -221,6 +222,11 @@ namespace EOM.TSHotelManagement.Service }; } + if (DeleteConcurrencyHelper.HasDeleteConflict(deleteOperationLogInputDto, operationLogs, a => a.Id, a => a.RowVersion)) + { + return BaseResponseFactory.ConcurrencyConflict(); + } + operationLogRepository.Delete(operationLogs); return new BaseResponse(); } diff --git a/README.en.md b/README.en.md index 84bc2da09a86b8d67011ab32687d69a7843df847..8620ff004e74da1de2fb9bd7c35e65155756132f 100644 --- a/README.en.md +++ b/README.en.md @@ -142,7 +142,7 @@ cp .env.example .env # Windows PowerShell: # Copy-Item .env.example .env -# 2) Edit .env (database connection, JWT key, mail settings, etc.) +# 2) Edit .env (database connection, JWT key, idempotency policy, mail settings, etc.) # 3) Start service docker compose up -d @@ -199,6 +199,12 @@ docker run -d \ |Redis__Enabled|Enable Redis|N|false|true/false| |Redis__ConnectionString|Redis ConnectString|N|N/A|N/A| |Redis__DefaultDatabase|Default Database of Redis|N|0|0| +|Idempotency__Enabled|Enable Idempotency-Key middleware|N|true|true/false| +|Idempotency__EnforceKey|Require Idempotency-Key for write requests|N|false|true/false| +|Idempotency__MaxKeyLength|Maximum Idempotency-Key length|N|128|integer >= 16| +|Idempotency__InProgressTtlSeconds|TTL for in-progress record (seconds)|N|120|30~600| +|Idempotency__CompletedTtlHours|TTL for completed record (hours)|N|24|1~168| +|Idempotency__PersistFailureResponse|Persist failed responses (non-2xx)|N|false|true/false| > ⚠️ **Security Advisory**: In production environments, do not directly pass password-like parameters in plaintext via the `-e` flag. It is recommended to utilise Docker Secrets or environment variable injection tools (such as HashiCorp Vault) for protection. diff --git a/README.md b/README.md index 3b1322897bdd80859c29c8d8682a1d802ae5989c..d05c6e047ebcbdd9744c2a29ac891ea13d1a8e78 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ cp .env.example .env # Windows PowerShell 可用: # Copy-Item .env.example .env -# 2) 按需修改 .env(数据库连接、JWT 密钥、邮箱等) +# 2) 按需修改 .env(数据库连接、JWT 密钥、幂等策略、邮箱等) # 3) 启动 docker compose up -d @@ -199,6 +199,12 @@ docker run -d \ |Redis__Enabled|是否启用Redis服务|N|false|true/false| |Redis__ConnectionString|Redis连接字符串|N|N/A|N/A| |Redis__DefaultDatabase|默认数据库|N|0|0| +|Idempotency__Enabled|是否启用幂等键中间件|N|true|true/false| +|Idempotency__EnforceKey|是否强制写请求必须携带 Idempotency-Key|N|false|true/false| +|Idempotency__MaxKeyLength|Idempotency-Key 最大长度|N|128|>=16 的整数| +|Idempotency__InProgressTtlSeconds|处理中记录 TTL(秒)|N|120|30~600| +|Idempotency__CompletedTtlHours|完成记录 TTL(小时)|N|24|1~168| +|Idempotency__PersistFailureResponse|是否缓存失败响应(非2xx)|N|false|true/false| > ⚠️ **安全提醒**:生产环境中请勿直接通过 `-e` 明文传入密码类参数,推荐使用 Docker Secrets 或环境变量注入工具(如 HashiCorp Vault)进行保护。