李昊 4 years ago
parent
commit
7c50b547b9

+ 3 - 2
GxPress/Repository/GxPress.Repository.Implement/AddressBookGroupRepository.cs

@@ -271,7 +271,7 @@ namespace GxPress.Repository.Implement
                     continue;
                 foreach (var item in addressBookGroupUsers)
                 {
-                    var user = await _userRepository.GetAsync(item.UserId);
+                    var user = await _userRepository.GetAsync(Q.Where(nameof(User.Id), item.UserId).Where(nameof(User.IsDelete), false));
                     users.Add(user);
                 }
 
@@ -300,7 +300,8 @@ namespace GxPress.Repository.Implement
             return users;
         }
 
-        public async Task<List<AddressBookGroup>> GetAllAsync(SqlKata.Query query){
+        public async Task<List<AddressBookGroup>> GetAllAsync(SqlKata.Query query)
+        {
             return await _repository.GetAllAsync(query);
         }
     }

+ 12 - 12
GxPress/Repository/GxPress.Repository.Implement/UserRepository.cs

@@ -738,9 +738,9 @@ namespace GxPress.Repository.Implement
                     notInUserIds += ")";
                 }
             }
-            var sql = $"select * from ccpph.tede_user  where  (Name like '%{request.Key}%' or Phone like '%{request.Key}%' or Email like '%{request.Key}%') {notInUserIds}";
+            var sql = $"select * from tede_user  where  (Name like '%{request.Key}%' or Phone like '%{request.Key}%' or Email like '%{request.Key}%') {notInUserIds}";
             if (request.SearchType == 2 && !string.IsNullOrWhiteSpace(request.Key) && request.DepartmentId > 0)
-                sql = $"select a.* from ccpph.tede_user a inner join ccpph.tede_address_book_group_user c on a.Id=c.UserId where c.AddressBookGroupId={request.DepartmentId} and (a.Name like '%{request.Key}%' or a.Phone like '%{request.Key}%' or a.Email like '%{request.Key}%') {notInUserIds}";
+                sql = $"select a.* from tede_user a inner join tede_address_book_group_user c on a.Id=c.UserId where c.AddressBookGroupId={request.DepartmentId} and (a.Name like '%{request.Key}%' or a.Phone like '%{request.Key}%' or a.Email like '%{request.Key}%') {notInUserIds}";
             if (request.SearchType == 1 && !string.IsNullOrWhiteSpace(request.Key) && request.DepartmentId > 0)
             {
                 //递归获取部门Id
@@ -750,7 +750,7 @@ namespace GxPress.Repository.Implement
                     departmentValue += $"{item.Id},";
                 departmentValue = departmentValue.Remove(departmentValue.Length - 1, 1);
                 departmentValue += ")";
-                sql = $"select * from ccpph.tede_user where DepartmentId in {departmentValue} and (Name like '%{request.Key}%' or Phone like '%{request.Key}%' or Email like '%{request.Key}%') {notInUserIds}";
+                sql = $"select * from tede_user where DepartmentId in {departmentValue} and (Name like '%{request.Key}%' or Phone like '%{request.Key}%' or Email like '%{request.Key}%') {notInUserIds}";
             }
             sql += " and IsDelete=0";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
@@ -775,7 +775,7 @@ namespace GxPress.Repository.Implement
         }
         public async Task<List<Entity.Department>> GetUpDepartmentAsync(int id, List<Department> departments)
         {
-            var sql = $"select * from ccpph.tede_department where Id={id}";
+            var sql = $"select * from tede_department where Id={id}";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
@@ -788,7 +788,7 @@ namespace GxPress.Repository.Implement
         }
         public async Task<List<Entity.Department>> GetDepartmentAsync(int pid, List<Department> departments)
         {
-            var sql = $"select * from ccpph.tede_department where ParentId={pid}";
+            var sql = $"select * from tede_department where ParentId={pid}";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
@@ -824,7 +824,7 @@ namespace GxPress.Repository.Implement
         }
         public async Task<IEnumerable<Entity.User>> GetAllUserIm()
         {
-            string sql = "SELECT * FROM ccpph.tede_user where ImId is null or ImId='' and IsDelete=0";
+            string sql = "SELECT * FROM tede_user where ImId is null or ImId='' and IsDelete=0";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
@@ -863,14 +863,14 @@ namespace GxPress.Repository.Implement
         public async Task<UserCountResult> GetUserCountAsync(int userId)
         {
             var result = new UserCountResult();
-            string sql = $"select count(1) from ccpph.tede_middle where FolderType=1 and UserId={userId} and MiddleId in (select NoticeId from ccpph.tede_notice_addressee where UserId={userId} and IsRead=0 and IsDelete=0)";
+            string sql = $"select count(1) from tede_middle where FolderType=1 and UserId={userId} and MiddleId in (select NoticeId from tede_notice_addressee where UserId={userId} and IsRead=0 and IsDelete=0)";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
             var noticeCount = await connection.ExecuteScalarAsync<int>(sql);
-            sql = $"select count(1) from ccpph.tede_middle where FolderType=5 and UserId={userId} and MiddleId in (select MissiveId from ccpph.tede_missive_addressee where UserId={userId} and IsDelete=0 and IsRead=0)";
+            sql = $"select count(1) from tede_middle where FolderType=5 and UserId={userId} and MiddleId in (select MissiveId from tede_missive_addressee where UserId={userId} and IsDelete=0 and IsRead=0)";
             var missiveCount = await connection.ExecuteScalarAsync<int>(sql);
-            sql = $"SELECT count(1) FROM ccpph.tede_admin_verify where AdminId={userId} and DisposeType=0";
+            sql = $"SELECT count(1) FROM tede_admin_verify where AdminId={userId} and DisposeType=0";
             noticeCount += await connection.ExecuteScalarAsync<int>(sql);
             result.noticeCount = noticeCount;
             result.missiveCount = missiveCount;
@@ -895,7 +895,7 @@ namespace GxPress.Repository.Implement
                 strSql = strSql.Remove(strSql.Length - 1, 1);
                 strSql += ")";
             }
-            string sql = $" select * from ccpph.tede_user where Id in( SELECT UserId FROM ccpph.tede_flow_todo where FlowId={flowId} and Type='{type}' {strSql}) and IsDelete=0";
+            string sql = $" select * from tede_user where Id in( SELECT UserId FROM tede_flow_todo where FlowId={flowId} and Type='{type}' {strSql}) and IsDelete=0";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
@@ -907,7 +907,7 @@ namespace GxPress.Repository.Implement
 
         public async Task<List<JobUserResult>> ElasticSearchUser()
         {
-            var sql = "select * from ccpph.tede_user where IsUpload=0 and IsDelete=0 limit 0,100";
+            var sql = "select * from tede_user where IsUpload=0 and IsDelete=0 limit 0,100";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
@@ -927,7 +927,7 @@ namespace GxPress.Repository.Implement
         //    var connection = database.GetConnection();
 
         //    var result = connection.Query<UserDetail, Department, UserDetail>(
-        //        "SELECT a.*,b.Name FROM ccpph.tede_user a inner join ccpph.tede_department b on a.DepartmentId=b.Id where a.id=@Id;",
+        //        "SELECT a.*,b.Name FROM tede_user a inner join tede_department b on a.DepartmentId=b.Id where a.id=@Id;",
         //        (userDetail,department) =>
         //        {
         //            userDetail.DepartmentName = department.Name;

+ 3 - 2
GxPress/Service/GxPress.Service.Implement/IM/IMService.Chatgroups.cs

@@ -67,7 +67,7 @@ namespace GxPress.Service.Implement.IM
                     result.GroupChatImId = request.GroupChatImId;
                     //创建群写入数据库
                     request.UserIds = new List<int>();
-                   
+
                     await _groupChatRepository.InsertAsync(request);
                     return result;
                 }
@@ -77,7 +77,8 @@ namespace GxPress.Service.Implement.IM
                     throw new BusinessException("owner用户不存在");
                 if (response.StatusCode == HttpStatusCode.TooManyRequests)
                     throw new BusinessException("接口被限流");
-                result.Success = false;
+                throw new BusinessException(tokenJson);
+                //result.Success = false;
             }
             catch (Exception e)
             {