Browse Source

Merge branch 'develop' of http://132.232.92.186:3000/XinXiBu/OA2023 into develop

yuanrf 1 week ago
parent
commit
73b0520595

+ 4 - 12
OASystem/OASystem.Api/Controllers/GroupsController.cs

@@ -5380,11 +5380,8 @@ FROM
                     }
                 }
             }
-            var gj_jobPostIds = new List<int>() { 22, 32 };
-            var viewPermissionData = await _sqlSugar.Queryable<Sys_Users>()
-                .Where(x => x.IsDel == 0 && ((x.DepId == 7 && gj_jobPostIds.Contains(x.JobPostId)) || x.DepId == 6))
-                .Select(x => new { x.Id, Name = x.CnName })
-                .ToListAsync();
+
+            var viewPermissionData = await _enterExitCostRep.PermissionViewUsersAsync();
             return Ok(JsonView(true, "查询成功!", new
             {
                 GroupNameData = groupNameData.Data,
@@ -5508,7 +5505,6 @@ FROM
             return Ok(JsonView(false));
         }
 
-
         /// <summary>
         /// 团组模块 - 出入境费用 - Add And Update
         /// </summary>
@@ -7527,11 +7523,7 @@ FROM
                 }
             }
 
-            var gj_jobPostIds = new List<int>() { 22, 32 };
-            var viewPermissionData = await _sqlSugar.Queryable<Sys_Users>()
-                .Where(x => x.IsDel == 0 && ((x.DepId == 7 && gj_jobPostIds.Contains(x.JobPostId)) || x.DepId == 6))
-                .Select(x => new { x.Id, Name = x.CnName })
-                .ToListAsync();
+            var viewPermissionData = await _enterExitCostDraftRep.PermissionViewUsersAsync();
 
             return Ok(JsonView(true, "查询成功!", new
             {
@@ -9202,7 +9194,7 @@ FROM
             mobileInfo.Currencys = await EnterExitCostMobileGetCurrencyInit();
             if (eecInfo == null) return Ok(mobileInfo);
             //验证查看、操作权限
-
+           // var isView = await _enterExitCostRep.vi
 
 
 

+ 6 - 0
OASystem/OASystem.Domain/ViewModels/Groups/EnterExitCostDraftView.cs

@@ -12,6 +12,12 @@ namespace OASystem.Domain.ViewModels.Groups
     {
     }
 
+    public class PermissionViewUserview
+    {
+        public int Id { get; set; }
+        public string Name { get; set; }
+    }
+
     /// <summary>
     /// 出入境费用info
     /// </summary>

+ 38 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostDraftRepository.cs

@@ -21,7 +21,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
         private readonly IMapper _mapper;
         private readonly SetDataRepository _setDataRep;
 
-
         public EnterExitCostDraftRepository(SqlSugarClient sqlSugar, IMapper mapper, SetDataRepository setDataRep)
             : base(sqlSugar)
         {
@@ -29,6 +28,22 @@ namespace OASystem.Infrastructure.Repositories.Groups
             _mapper = mapper;
         }
 
+
+        /// <summary>
+        /// 权限用户基础数据
+        /// </summary>
+        /// <returns></returns>
+        public async Task<List<PermissionViewUserview>> PermissionViewUsersAsync()
+        {
+            var gj_jobPostIds = new List<int>() { 22, 32 };
+            var viewPermissionData = await _sqlSugar.Queryable<Sys_Users>()
+                .Where(x => x.IsDel == 0 && ((x.DepId == 7 && gj_jobPostIds.Contains(x.JobPostId)) || x.DepId == 6))
+                .Select(x => new PermissionViewUserview { Id = x.Id, Name = x.CnName })
+                .ToListAsync();
+
+            return viewPermissionData;
+        }
+
         /// <summary>
         /// 出入境费用草稿 --> 权限验证
         /// </summary>
@@ -244,6 +259,28 @@ namespace OASystem.Infrastructure.Repositories.Groups
                         subData.Select(x => { x.Id = 0; return x; }).ToList();
                         dto.DayOtherPriceData.Select(x => { x.Id = 0; return x; }).ToList();
 
+                        //默认添加查看权限
+                        var users = await PermissionViewUsersAsync();
+                        var userIds = users.Select(x => x.Id).ToList();
+                        if (userIds.Any())
+                        {
+                            var permissions = new List<Grp_EnterExitCostDraftPermission>();
+                            foreach (var userId in userIds)
+                            {
+                                permissions.Add(new Grp_EnterExitCostDraftPermission()
+                                {
+                                    DraftId = enterExitId,
+                                    UserId = userId,
+                                    Permission = 1
+                                });
+                            }
+
+                            if (permissions.Any())
+                            {
+                                _sqlSugar.Insertable(permissions).ExecuteReturnIdentity();
+                            }
+                        }
+
                     }
 
                     if (enterExitId > 0)

+ 37 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/EnterExitCostRepository.cs

@@ -32,6 +32,21 @@ namespace OASystem.Infrastructure.Repositories.Groups
             _mapper = mapper;
         }
 
+        /// <summary>
+        /// 权限用户基础数据
+        /// </summary>
+        /// <returns></returns>
+        public async Task<List<PermissionViewUserview>> PermissionViewUsersAsync()
+        {
+            var gj_jobPostIds = new List<int>() { 22, 32 };
+            var viewPermissionData = await _sqlSugar.Queryable<Sys_Users>()
+                .Where(x => x.IsDel == 0 && ((x.DepId == 7 && gj_jobPostIds.Contains(x.JobPostId)) || x.DepId == 6))
+                .Select(x => new PermissionViewUserview { Id = x.Id, Name = x.CnName })
+                .ToListAsync();
+
+            return viewPermissionData;
+        }
+
         /// <summary>
         /// 出入境费用正式 --> 权限验证
         /// </summary>
@@ -355,7 +370,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     else
                     {
                         //效重 根据团组Id 
-
                         var info = _sqlSugar.Queryable<Grp_EnterExitCost>().Where(it => it.IsDel == 0 && it.DiId == dto.DiId).First();
                         if (info != null )
                         {
@@ -373,6 +387,28 @@ namespace OASystem.Infrastructure.Repositories.Groups
                             result.Msg = "添加操作失败!";
                             return result;
                         }
+
+                        //默认添加查看权限
+                        var users = await PermissionViewUsersAsync();
+                        var userIds = users.Select(x => x.Id).ToList();
+                        if (userIds.Any())
+                        {
+                            var permissions = new List<Grp_EnterExitCostDraftPermission>();
+                            foreach (var userId in userIds)
+                            {
+                                permissions.Add(new Grp_EnterExitCostDraftPermission()
+                                {
+                                    DraftId = enterExitId,
+                                    UserId = userId,
+                                    Permission = 1
+                                });
+                            }
+
+                            if (permissions.Any())
+                            {
+                                _sqlSugar.Insertable(permissions).ExecuteReturnIdentity();
+                            }
+                        }
                     }
 
                     if (enterExitId > 0)