From c8753e3500d5773d3b8e1e27f2304d8510a919c6 Mon Sep 17 00:00:00 2001 From: wyw <571921741@qq.com> Date: Mon, 1 Sep 2025 16:06:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E4=BF=AE=E6=94=B9=E5=9B=9E?= =?UTF-8?q?=203=20=E7=94=A8=E6=88=B7=E6=8E=88=E6=9D=83=20=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Properties/launchSettings.json | 2 +- .../Properties/launchSettings.json | 2 +- .../Controllers/Api/UserController.cs | 92 +++++++++++++++++++ .../Properties/launchSettings.json | 2 +- .../Properties/launchSettings.json | 2 +- .../Properties/launchSettings.json | 2 +- .../Properties/launchSettings.json | 2 +- .../Properties/launchSettings.json | 2 +- .../Properties/launchSettings.json | 2 +- .../Controllers/Api/LoginController.cs | 6 +- .../Properties/launchSettings.json | 2 +- .../Properties/launchSettings.json | 2 +- .../Properties/launchSettings.json | 2 +- .../Properties/launchSettings.json | 2 +- .../Properties/launchSettings.json | 2 +- 15 files changed, 109 insertions(+), 15 deletions(-) diff --git a/APT.MicroApi/APT.BD.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.BD.WebApi/Properties/launchSettings.json index 6af5eba..e7ffaba 100644 --- a/APT.MicroApi/APT.BD.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.BD.WebApi/Properties/launchSettings.json @@ -8,7 +8,7 @@ "ASPNETCORE_ENVIRONMENT": "Test" }, "nativeDebugging": true, - "applicationUrl": "http://localhost:5101" + "applicationUrl": "http://localhost:3101" }, "Docker": { "commandName": "Docker", diff --git a/APT.MicroApi/APT.BS.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.BS.WebApi/Properties/launchSettings.json index 5d811a6..967b31f 100644 --- a/APT.MicroApi/APT.BS.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.BS.WebApi/Properties/launchSettings.json @@ -8,7 +8,7 @@ "ASPNETCORE_ENVIRONMENT": "Test" }, "nativeDebugging": true, - "applicationUrl": "http://localhost:5178" + "applicationUrl": "http://localhost:3178" }, "Docker": { "commandName": "Docker", diff --git a/APT.MicroApi/APT.FM.WebApi/Controllers/Api/UserController.cs b/APT.MicroApi/APT.FM.WebApi/Controllers/Api/UserController.cs index 8c96e44..ac18aea 100644 --- a/APT.MicroApi/APT.FM.WebApi/Controllers/Api/UserController.cs +++ b/APT.MicroApi/APT.FM.WebApi/Controllers/Api/UserController.cs @@ -989,6 +989,98 @@ namespace APT.FM.WebApi.Controllers.Api.FM }); } + + /// + /// 用户权限更新 + /// + /// + /// + [HttpPost, Route("UpdateAuth")] + public JsonActionResult UpdateAuth([FromBody] T_FM_USER entity) + { + return SafeExecute(() => + { + var roleIds = entity.Nav_BelongRoles.Select(role => role.BELONG_ROLE_ID).Distinct().ToList(); + var roleGroup = this.GetEntities(t => roleIds.Contains(t.BELONG_ROLE_ID), new BaseFilter(entity.ORG_ID)); + if (roleGroup != null && roleGroup.Any()) + { + roleGroup.ForEach(role => + { + T_FM_USER_BELONG_ROLE_GROUP belongRole = new T_FM_USER_BELONG_ROLE_GROUP(); + belongRole.USER_ID = entity.ID; + belongRole.BELONG_ROLE_GROUP_ID = (Guid)role.ROLE_GROUP_ID; + belongRole.ORG_ID = entity.ORG_ID; + //roleGroupList.Add(belongRole); + entity.Nav_BelongRoleGroups.Add(belongRole); + }); + } + var belongRoleGroups = entity.Nav_BelongRoleGroups;//roleGroupList; + var belongRoles = entity.Nav_BelongRoles;//roleList; + var belongUserGroups = entity.Nav_BelongUserGroups; + entity.Nav_BelongRoleGroups = null; + entity.Nav_BelongRoles = null; + entity.Nav_BelongUserGroups = null; + if (belongUserGroups != null && belongUserGroups.Count > 0) + belongUserGroups.ForEach(t => t.USER_ID = entity.ID); + if (belongRoleGroups != null && belongRoleGroups.Any()) + belongRoleGroups.ForEach(t => t.USER_ID = entity.ID); + if (belongRoles != null && belongRoles.Any()) + belongRoles.ForEach(t => t.USER_ID = entity.ID); + + List deleteBelongRoleIds = new List(); + List deleteBelongRoleGroupIds = new List(); + List deleteBelongUserGroupsIds = new List(); + + var dbEntity = this.GetEntity(entity.ID.ToString(), new string[] { "Nav_BelongRoleGroups", + "Nav_BelongRoles", "Nav_BelongUserGroups" }); + if (dbEntity != null) + { + if (dbEntity.Nav_BelongRoleGroups != null) + { + dbEntity.Nav_BelongRoleGroups.ForEach(item => + { + if (belongRoleGroups == null || !belongRoleGroups.Any(i => i.ID == item.ID)) + deleteBelongRoleGroupIds.Add(item.ID); + }); + } + if (dbEntity.Nav_BelongRoles != null) + { + dbEntity.Nav_BelongRoles.ForEach(item => + { + if (belongRoles == null || !belongRoles.Any(i => i.ID == item.ID)) + deleteBelongRoleIds.Add(item.ID); + }); + } + if (dbEntity.Nav_BelongUserGroups != null) + { + dbEntity.Nav_BelongUserGroups.ForEach(item => + { + if (belongUserGroups == null || !belongUserGroups.Any(i => i.ID == item.ID)) + deleteBelongUserGroupsIds.Add(item.ID); + }); + } + } + + UnifiedCommit(() => + { + if (deleteBelongRoleIds.Any()) + this.DeleteEntityNoCommit(t => deleteBelongRoleIds.Contains(t.ID)); + if (deleteBelongRoleGroupIds.Any()) + this.DeleteEntityNoCommit(t => deleteBelongRoleGroupIds.Contains(t.ID)); + if (deleteBelongUserGroupsIds.Any()) + this.DeleteEntityNoCommit(t => deleteBelongUserGroupsIds.Contains(t.ID)); + + if (belongRoleGroups != null && belongRoleGroups.Any()) + this.BantchSaveEntityNoCommit(belongRoleGroups); + if (belongRoles != null && belongRoles.Any()) + this.BantchSaveEntityNoCommit(belongRoles); + if (belongUserGroups != null && belongUserGroups.Any()) + this.BantchSaveEntityNoCommit(belongUserGroups); + }); + return true; + }); + } + /// /// 批量删除 /// diff --git a/APT.MicroApi/APT.FM.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.FM.WebApi/Properties/launchSettings.json index c3ffe47..745ac5d 100644 --- a/APT.MicroApi/APT.FM.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.FM.WebApi/Properties/launchSettings.json @@ -8,7 +8,7 @@ "ASPNETCORE_ENVIRONMENT": "Test" }, "nativeDebugging": false, - "applicationUrl": "http://localhost:5107" + "applicationUrl": "http://localhost:3107" }, "Docker": { "commandName": "Docker", diff --git a/APT.MicroApi/APT.FO.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.FO.WebApi/Properties/launchSettings.json index 1dd18c5..15f0d06 100644 --- a/APT.MicroApi/APT.FO.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.FO.WebApi/Properties/launchSettings.json @@ -7,7 +7,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Test" }, - "applicationUrl": "http://localhost:5119", + "applicationUrl": "http://localhost:3119", "nativeDebugging": false }, "Docker": { diff --git a/APT.MicroApi/APT.HM.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.HM.WebApi/Properties/launchSettings.json index 85bb6d0..d3c345f 100644 --- a/APT.MicroApi/APT.HM.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.HM.WebApi/Properties/launchSettings.json @@ -8,7 +8,7 @@ "ASPNETCORE_ENVIRONMENT": "Test" }, "nativeDebugging": true, - "applicationUrl": "http://localhost:5117" + "applicationUrl": "http://localhost:3117" }, "Docker": { "commandName": "Docker", diff --git a/APT.MicroApi/APT.LG.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.LG.WebApi/Properties/launchSettings.json index 65b817f..e2767e7 100644 --- a/APT.MicroApi/APT.LG.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.LG.WebApi/Properties/launchSettings.json @@ -8,7 +8,7 @@ "ASPNETCORE_ENVIRONMENT": "Test" }, "nativeDebugging": false, - "applicationUrl": "http://localhost:5109" + "applicationUrl": "http://localhost:3109" }, "Docker": { "commandName": "Docker", diff --git a/APT.MicroApi/APT.NW.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.NW.WebApi/Properties/launchSettings.json index 1dbd158..6ddd4e2 100644 --- a/APT.MicroApi/APT.NW.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.NW.WebApi/Properties/launchSettings.json @@ -8,7 +8,7 @@ "ASPNETCORE_ENVIRONMENT": "Test" }, "nativeDebugging": false, - "applicationUrl": "http://localhost:5111" + "applicationUrl": "http://localhost:3111" }, "Docker": { "commandName": "Docker", diff --git a/APT.MicroApi/APT.OP.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.OP.WebApi/Properties/launchSettings.json index d62125f..2f1ce8c 100644 --- a/APT.MicroApi/APT.OP.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.OP.WebApi/Properties/launchSettings.json @@ -8,7 +8,7 @@ "ASPNETCORE_ENVIRONMENT": "Test" }, "nativeDebugging": false, - "applicationUrl": "http://localhost:5116" + "applicationUrl": "http://localhost:3116" }, "Docker": { "commandName": "Docker", diff --git a/APT.MicroApi/APT.PF.WebApi/Controllers/Api/LoginController.cs b/APT.MicroApi/APT.PF.WebApi/Controllers/Api/LoginController.cs index 9799ca5..6497cbc 100644 --- a/APT.MicroApi/APT.PF.WebApi/Controllers/Api/LoginController.cs +++ b/APT.MicroApi/APT.PF.WebApi/Controllers/Api/LoginController.cs @@ -221,6 +221,8 @@ namespace APT.PF.WebApiControllers.Api.PF if (string.IsNullOrEmpty(filter.Parameter4) && !filter.OrgId.HasValue && Request.Host.HasValue && Request.Host.Port.HasValue) { + //telnetCode 根据 telnetCode 获取 + var re = Request.Headers; int hostPort = 0; if (re.ContainsKey("Origin")) @@ -275,8 +277,8 @@ namespace APT.PF.WebApiControllers.Api.PF T_FM_USER user = null; if (platformType == (int)PFPlatTypeEnum.后台) { - if (string.IsNullOrEmpty(filter.Parameter4)) - throw new Exception(ErrMsg.FM_NO_ORG); + //if (string.IsNullOrEmpty(filter.Parameter4)) + // throw new Exception(ErrMsg.FM_NO_ORG); if (string.IsNullOrEmpty(userId)) { string userCode = filter.Parameter1; diff --git a/APT.MicroApi/APT.PF.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.PF.WebApi/Properties/launchSettings.json index f48dd32..3670455 100644 --- a/APT.MicroApi/APT.PF.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.PF.WebApi/Properties/launchSettings.json @@ -8,7 +8,7 @@ "ASPNETCORE_ENVIRONMENT": "Test" }, "nativeDebugging": false, - "applicationUrl": "http://localhost:5112" + "applicationUrl": "http://localhost:3112" }, "Docker": { "commandName": "Docker", diff --git a/APT.MicroApi/APT.PP.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.PP.WebApi/Properties/launchSettings.json index 8e34f97..5e66507 100644 --- a/APT.MicroApi/APT.PP.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.PP.WebApi/Properties/launchSettings.json @@ -7,7 +7,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Test" }, - "applicationUrl": "http://localhost:5118", + "applicationUrl": "http://localhost:3118", "nativeDebugging": false }, "Docker": { diff --git a/APT.MicroApi/APT.SC.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.SC.WebApi/Properties/launchSettings.json index 5a40fb5..83863b7 100644 --- a/APT.MicroApi/APT.SC.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.SC.WebApi/Properties/launchSettings.json @@ -8,7 +8,7 @@ "ASPNETCORE_ENVIRONMENT": "Test" }, "nativeDebugging": true, - "applicationUrl": "http://localhost:5179" + "applicationUrl": "http://localhost:3179" }, "Docker": { "commandName": "Docker", diff --git a/APT.MicroApi/APT.SK.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.SK.WebApi/Properties/launchSettings.json index 368ad11..3b219bd 100644 --- a/APT.MicroApi/APT.SK.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.SK.WebApi/Properties/launchSettings.json @@ -7,7 +7,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Test" }, - "applicationUrl": "http://localhost:5180", + "applicationUrl": "http://localhost:3180", "nativeDebugging": false }, "Docker": { diff --git a/APT.MicroApi/APT.UT.WebApi/Properties/launchSettings.json b/APT.MicroApi/APT.UT.WebApi/Properties/launchSettings.json index 0ccd949..c8626f0 100644 --- a/APT.MicroApi/APT.UT.WebApi/Properties/launchSettings.json +++ b/APT.MicroApi/APT.UT.WebApi/Properties/launchSettings.json @@ -8,7 +8,7 @@ "ASPNETCORE_ENVIRONMENT": "Test" }, "nativeDebugging": false, - "applicationUrl": "http://localhost:5177" + "applicationUrl": "http://localhost:3177" }, "Docker": { "commandName": "Docker",