lihao 4 years ago
parent
commit
fd01da249f

+ 6 - 1
gx_api/GxPress/Model/GxPress.Request/App/AdminVerify/AdminVerifyInsertRequest.cs

@@ -6,7 +6,7 @@ namespace GxPress.Request.App.AdminVerify
     /// <summary>
     /// 添加用户成员
     /// </summary>
-   public class AdminVerifyInsertRequest
+    public class AdminVerifyInsertRequest
     {
         /// <summary>
         /// 成员
@@ -34,5 +34,10 @@ namespace GxPress.Request.App.AdminVerify
         /// 来源状态 1申请 2邀请
         /// </summary>
         public int SourceType { get; set; }
+        /// <summary>
+        /// 备注
+        /// </summary>
+        /// <value></value>
+        public string Remark { get; set; }
     }
 }

+ 6 - 2
gx_api/GxPress/Model/GxPress.Request/App/GroupUser/GroupUserInRequest.cs

@@ -12,7 +12,7 @@ namespace GxPress.Request.App.GroupUser
         /// </summary>
         public GroupUserInRequest()
         {
-            UserIds=new List<int>();
+            UserIds = new List<int>();
         }
         /// <summary>
         /// 小组ID
@@ -32,6 +32,10 @@ namespace GxPress.Request.App.GroupUser
         /// 来源状态 1申请 2邀请
         /// </summary>
         public int SourceType { get; set; }
-
+        /// <summary>
+        /// 备注
+        /// </summary>
+        /// <value></value>
+        public string Remark { get; set; }
     }
 }

+ 5 - 0
gx_api/GxPress/Model/GxPress.Result/App/Group/GroupDetailResult.cs

@@ -255,5 +255,10 @@ namespace GxPress.Result.App.Group
         /// </summary>
         /// <value></value>
         public bool IsUser { get; set; }
+        /// <summary>
+        /// 是否需要管理员同意
+        /// </summary>
+        /// <value></value>
+        public bool IsAdmin { get; set; }
     }
 }

+ 3 - 0
gx_api/GxPress/Repository/GxPress.Repository.Implement/GroupRepository.cs

@@ -445,6 +445,7 @@ namespace GxPress.Repository.Implement
                             a.Name,
                             a.AvatarUrl,
                             a.Introduce,
+                            a.IsAdmin,
                             (SELECT 
                                     COUNT(1)
                                 FROM
@@ -468,6 +469,7 @@ namespace GxPress.Repository.Implement
                             a.Name,
                             a.AvatarUrl,
                             a.Introduce,
+                            a.IsAdmin,
                                 (SELECT 
                                         COUNT(1)
                                     FROM
@@ -671,6 +673,7 @@ namespace GxPress.Repository.Implement
                             a.Name,
                             a.AvatarUrl,
                             a.Introduce,
+                            a.IsAdmin,
                             (SELECT 
                                     COUNT(1)
                                 FROM

+ 7 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/AdminVerify/AdminVerifyInsetService.cs

@@ -69,8 +69,13 @@ namespace GxPress.Service.Implement.AdminVerify
                     department = departments.FirstOrDefault(m => m.Id == departmentUsers.FirstOrDefault(n => n.UserId == user.Id).DepartmentId);
                 }
                 var group = await _groupRepository.GetAsync(request.SourceId);
+                var query = Q.NewQuery();
+                query.Where(nameof(Entity.AdminVerify.AdminId), userId);
+                query.Where(nameof(Entity.AdminVerify.SourceType), request.SourceType);
+                query.Where(nameof(Entity.AdminVerify.SourceId), group.Id);
+                query.WhereIn(nameof(Entity.AdminVerify.DisposeType), new List<int> { 0, 1 });
                 //查询是否存在
-                adminVerify = await _adminVerifyRepository.GetAsync(Q.Where(nameof(Entity.AdminVerify.AdminId), userId).Where(nameof(Entity.AdminVerify.SourceType), request.SourceType).Where(nameof(Entity.AdminVerify.SourceId), group.Id).WhereIn(nameof(Entity.AdminVerify.DisposeType), new List<int> { 0, 1 }));
+                adminVerify = await _adminVerifyRepository.GetAsync(query);
                 if (adminVerify != null)
                     continue;
                 adminVerify = new Entity.AdminVerify();
@@ -96,6 +101,7 @@ namespace GxPress.Service.Implement.AdminVerify
                         adminVerifyDto.IsDelete = "";
                         //获取部门
                         adminVerifyDto.Remark = department.Name + "-" + user.Name;
+                        adminVerifyDto.Remark = request.Remark;
                         //await _adminVerifyRepository.InsertAsync(adminVerifyDto);
                         adminVerifys.Add(adminVerifyDto);
                     }

+ 4 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/Group/GroupService.cs

@@ -154,6 +154,8 @@ namespace GxPress.Service.Implement.Group
             //不是管理员添加
             if (request.SourceType == 2 || group.IsAdmin && request.SourceType == 1)
             {
+                if (request.SourceType == 1 && string.IsNullOrWhiteSpace(request.Remark))
+                    throw new BusinessException("请填写备注!");
                 var adminVerifyInsertRequest = new AdminVerifyInsertRequest
                 {
                     AdminId = group.UserId,
@@ -161,7 +163,8 @@ namespace GxPress.Service.Implement.Group
                     VerifyType = GroupTypeConst.Group,
                     SourceId = group.Id,
                     UserId = request.UserId,
-                    SourceType = request.SourceType
+                    SourceType = request.SourceType,
+                    Remark = request.Remark
                 };
                 await _adminVerifyService.InsertAsync(adminVerifyInsertRequest);
                 if (request.SourceType == 2)