李昊 4 years ago
parent
commit
048af8c074
62 changed files with 609 additions and 2271 deletions
  1. 8 28
      gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminUtilsController.cs
  2. 39 0
      gx_api/GxPress/Api/GxPress.Api/AppControllers/InboxController.cs
  3. 1 16
      gx_api/GxPress/Api/GxPress.Api/AppControllers/MissiveController.cs
  4. 1 3
      gx_api/GxPress/Api/GxPress.Api/AppControllers/NoticeController.cs
  5. 0 118
      gx_api/GxPress/Api/GxPress.Api/AppControllers/NoticeFolderController.cs
  6. 0 60
      gx_api/GxPress/Api/GxPress.Api/AppControllers/TopicCommentController.cs
  7. 0 249
      gx_api/GxPress/Api/GxPress.Api/AppControllers/TopicController.cs
  8. 0 3
      gx_api/GxPress/Api/GxPress.Api/AppControllers/videoController.cs
  9. 18 0
      gx_api/GxPress/Infrastructure/GxPress.Common/Tools/StringUtils.cs
  10. 9 15
      gx_api/GxPress/Model/GxPress.Entity/NoticeAddressee.cs
  11. 11 14
      gx_api/GxPress/Model/GxPress.Entity/NoticeCc.cs
  12. 50 2
      gx_api/GxPress/Model/GxPress.Entity/Middle/Middle.cs
  13. 0 46
      gx_api/GxPress/Model/GxPress.Entity/Missive/MissiveAddressee.cs
  14. 0 32
      gx_api/GxPress/Model/GxPress.Entity/Missive/MissiveAnalyze.cs
  15. 0 34
      gx_api/GxPress/Model/GxPress.Entity/Missive/MissiveCc.cs
  16. 1 5
      gx_api/GxPress/Model/GxPress.Entity/Notice.cs
  17. 0 37
      gx_api/GxPress/Model/GxPress.Entity/NoticeAnalyze.cs
  18. 0 33
      gx_api/GxPress/Model/GxPress.Entity/Topic/TopicAnalyze.cs
  19. 0 37
      gx_api/GxPress/Model/GxPress.Entity/Topic/TopicComment.cs
  20. 31 0
      gx_api/GxPress/Model/GxPress.EnumConst/FolderTypeConst.cs
  21. 0 18
      gx_api/GxPress/Model/GxPress.Mappings/NoticeAnalyzeMapping.cs
  22. 0 7
      gx_api/GxPress/Model/GxPress.Mappings/TopicMapping.cs
  23. 37 0
      gx_api/GxPress/Model/GxPress.Request/App/Middle/MiddleInsertRequest.cs
  24. 0 3
      gx_api/GxPress/Model/GxPress.Request/App/Missive/MissiveInRequest.cs
  25. 24 0
      gx_api/GxPress/Model/GxPress.Request/Inbox/InboxSearchRequest.cs
  26. 28 15
      gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeAddresseeRepository.cs
  27. 1 1
      gx_api/GxPress/Repository/GxPress.Repository.Implement/AdminVerify/AdminVerifyRepository.cs
  28. 20 15
      gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeCcRepository.cs
  29. 1 1
      gx_api/GxPress/Repository/GxPress.Repository.Implement/FlowAttachment/FlowAttachmentRepository.cs
  30. 1 1
      gx_api/GxPress/Repository/GxPress.Repository.Implement/FolderUserRepository.cs
  31. 1 1
      gx_api/GxPress/Repository/GxPress.Repository.Implement/GroupChatUserRepository.cs
  32. 1 1
      gx_api/GxPress/Repository/GxPress.Repository.Implement/GroupUserRepository.cs
  33. 1 1
      gx_api/GxPress/Repository/GxPress.Repository.Implement/MeetingSummaryTodo/MeetingSummaryTodoRepository.cs
  34. 31 2
      gx_api/GxPress/Repository/GxPress.Repository.Implement/MiddleRepository.cs
  35. 0 127
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Missive/MissiveAddresseeRepository.cs
  36. 0 101
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Missive/MissiveAnalyzeRepository.cs
  37. 0 90
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Missive/MissiveCcRepository.cs
  38. 0 174
      gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeFolderRepository.cs
  39. 21 24
      gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeRepository.cs
  40. 1 1
      gx_api/GxPress/Repository/GxPress.Repository.Implement/OftenContactRepository.cs
  41. 0 139
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Topic/TopicAnalyzeRepository.cs
  42. 0 256
      gx_api/GxPress/Repository/GxPress.Repository.Implement/Topic/TopicCommentRepository.cs
  43. 1 1
      gx_api/GxPress/Repository/GxPress.Repository.Implement/TopicAddresseeRepository.cs
  44. 0 4
      gx_api/GxPress/Repository/GxPress.Repository.Implement/TopicRepository.cs
  45. 3 3
      gx_api/GxPress/Repository/GxPress.Repository.Implement/WorkFlow/FlowTodoRepository.cs
  46. 10 6
      gx_api/GxPress/Repository/GxPress.Repository.Interface/INoticeAddresseeRepository.cs
  47. 5 7
      gx_api/GxPress/Repository/GxPress.Repository.Interface/INoticeCcRepository.cs
  48. 4 1
      gx_api/GxPress/Repository/GxPress.Repository.Interface/IMiddleRepository.cs
  49. 0 57
      gx_api/GxPress/Repository/GxPress.Repository.Interface/INoticeFolderRepository.cs
  50. 0 26
      gx_api/GxPress/Repository/GxPress.Repository.Interface/ITopicAnalyzeRepository.cs
  51. 0 43
      gx_api/GxPress/Repository/GxPress.Repository.Interface/ITopicCommentRepository.cs
  52. 0 40
      gx_api/GxPress/Repository/GxPress.Repository.Interface/Missive/IMissiveAddresseeRepository.cs
  53. 0 42
      gx_api/GxPress/Repository/GxPress.Repository.Interface/Missive/IMissiveAnalyzeRepository.cs
  54. 0 36
      gx_api/GxPress/Repository/GxPress.Repository.Interface/Missive/IMissiveCcRepository.cs
  55. 2 7
      gx_api/GxPress/Service/GxPress.Service.Implement/Collection/CollectionService.cs
  56. 53 0
      gx_api/GxPress/Service/GxPress.Service.Implement/ContentJson/ContentJsonService.cs
  57. 12 2
      gx_api/GxPress/Service/GxPress.Service.Implement/Flow/FlowService.Nodes.cs
  58. 15 11
      gx_api/GxPress/Service/GxPress.Service.Implement/Middle/MiddleService.cs
  59. 70 42
      gx_api/GxPress/Service/GxPress.Service.Implement/Missive/MissiveService.cs
  60. 57 33
      gx_api/GxPress/Service/GxPress.Service.Implement/Notice/NoticeService.Insert.cs
  61. 33 200
      gx_api/GxPress/Service/GxPress.Service.Implement/Notice/NoticeService.cs
  62. 7 0
      gx_api/GxPress/Service/GxPress.Service.Interface/ContentJson/IContentJsonService.cs

File diff suppressed because it is too large
+ 8 - 28
gx_api/GxPress/Api/GxPress.Api/AdminControllers/AdminUtilsController.cs


+ 39 - 0
gx_api/GxPress/Api/GxPress.Api/AppControllers/InboxController.cs

@@ -0,0 +1,39 @@
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using GxPress.Request.Inbox;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using GxPress.Repository.Interface;
+using GxPress.Auth;
+
+namespace GxPress.Api.AppControllers
+{
+    /// <summary>
+    /// 收件箱
+    /// </summary>
+    [Route("api/app/inbox")]
+    [ApiController]
+    [Authorize]
+    public class InboxController : ControllerBase
+    {
+        private readonly IMiddleRepository middleRepository;
+        private readonly ILoginContext _loginContext;
+        public InboxController(IMiddleRepository middleRepository, ILoginContext loginContext)
+        {
+            this.middleRepository = middleRepository;
+            _loginContext = loginContext;
+        }
+
+        /// <summary>
+        /// 搜索
+        /// </summary>
+        /// <param name="request"></param>
+        /// <returns></returns>
+        [HttpPost("search")]
+        public async Task<IEnumerable<Entity.Middle.Middle>> Search(InboxSearchRequest request)
+        {
+            request.UserId = _loginContext.AccountId;
+            return await middleRepository.FindAsync(request);
+        }
+    }
+}

+ 1 - 16
gx_api/GxPress/Api/GxPress.Api/AppControllers/MissiveController.cs

@@ -21,17 +21,15 @@ namespace GxPress.Api.AppControllers
     public class MissiveController : ControllerBase
     {
         private readonly IMissiveRepository _missiveRepository;
-        private readonly IMissiveAnalyzeRepository _missiveAnalyzeRepository;
         private readonly IMissiveService _missiveService;
         private readonly ILoginContext _loginContext;
 
         public MissiveController(IMissiveRepository missiveRepository, IMissiveService missiveService,
-            ILoginContext loginContext, IMissiveAnalyzeRepository missiveAnalyzeRepository)
+            ILoginContext loginContext)
         {
             _missiveRepository = missiveRepository;
             _missiveService = missiveService;
             _loginContext = loginContext;
-            _missiveAnalyzeRepository = missiveAnalyzeRepository;
         }
 
 
@@ -74,19 +72,6 @@ namespace GxPress.Api.AppControllers
             request.UserId = _loginContext.AccountId;
             return await _missiveService.GetMissiveSearchResultAsync(request);
         }
-
-        /// <summary>
-        ///  文章点赞 评论点赞 文章收藏 文章转发 已废弃
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost("analyze")]
-        public async Task<bool> AddMissiveAnalyze([FromBody] MissiveAnalyzeRequest request)
-        {
-            request.UserId = _loginContext.AccountId;
-            return await _missiveAnalyzeRepository.SetMissiveAnalyzeAsync(request);
-        }
-
-
         /// <summary>
         /// 获取站内信详情
         /// </summary>

+ 1 - 3
gx_api/GxPress/Api/GxPress.Api/AppControllers/NoticeController.cs

@@ -20,14 +20,12 @@ namespace GxPress.Api.AppControllers
     public class NoticeController : ControllerBase
     {
         private readonly INoticeRepository _noticeRepository;
-        private readonly INoticeFolderRepository _noticeFolderRepository;
         private readonly INoticeService _noticeService;
         private readonly ILoginContext _loginContext;
 
-        public NoticeController(INoticeRepository noticeRepository, INoticeFolderRepository noticeFolderRepository,INoticeService noticeService, ILoginContext loginContext)
+        public NoticeController(INoticeRepository noticeRepository,INoticeService noticeService, ILoginContext loginContext)
         {
             _noticeRepository = noticeRepository;
-            _noticeFolderRepository = noticeFolderRepository;
             _noticeService = noticeService;
             _loginContext = loginContext;
         }

+ 0 - 118
gx_api/GxPress/Api/GxPress.Api/AppControllers/NoticeFolderController.cs

@@ -1,118 +0,0 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using GxPress.Auth;
-using GxPress.Repository.Interface;
-using GxPress.Request.App.Middle;
-using GxPress.Request.NoticeFolder;
-using GxPress.Result.NoticeFolder;
-using GxPress.Service.Interface.Middle;
-using Microsoft.AspNetCore.Mvc;
-
-namespace GxPress.Api.AppControllers
-{
-    /// <summary>
-    /// 通知文件夹
-    /// </summary>
-    [Route("api/app/notice-folder")]
-    [ApiController]
-    public class NoticeFolderController : ControllerBase
-    {
-
-        private readonly INoticeFolderRepository _noticeFolderRepository;
-        private readonly ILoginContext _loginContext;
-        private readonly IMiddleService _middleService;
-
-        public NoticeFolderController(INoticeFolderRepository noticeFolderRepository, ILoginContext loginContext,
-            IMiddleService middleService)
-        {
-            _noticeFolderRepository = noticeFolderRepository;
-            _loginContext = loginContext;
-            _middleService = middleService;
-        }
-
-        /// <summary>
-        /// 创建通知文件夹
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPut("add")]
-        public async Task<bool> Insert(NoticeFolderInRequest request)
-        {
-            request.UserId = _loginContext.AccountId;
-            var middleInsertRequest = new MiddleInsertRequest
-            {
-                FolderName = request.FolderName,
-                FolderType = 1,
-                ParentId = request.ParentId,
-                UserId = request.UserId
-            };
-            return await _middleService.InsertAsync(middleInsertRequest) > 0;
-
-        }
-
-        ///// <summary>
-        ///// 删除通知文件夹
-        ///// </summary>
-        ///// <param name="id"></param>
-        ///// <returns></returns>
-        //[HttpDelete("{id}")]
-        //public async Task<bool> Delete(int id)
-        //{
-        //    return await _noticeFolderRepository.DeleteAsync(id);
-
-        //}
-
-        ///// <summary>
-        ///// 修改通知文件夹
-        ///// </summary>
-        ///// <param name="request"></param>
-        ///// <returns></returns>
-        //[HttpPost("update")]
-        //public async Task<bool> Update(NoticeFolderUpRequest request)
-        //{
-        //    return await _noticeFolderRepository.UpdateAsync(request);
-        //}
-
-        ///// <summary>
-        ///// 插入通知文件夹
-        ///// </summary>
-        ///// <param name="request"></param>
-        ///// <returns></returns>
-        //[HttpPost("add-notice")]
-        //public async Task<bool> InsertNotice(NoticeFolderInNoticeRequest request)
-        //{
-        //    return await _noticeFolderRepository.InsertNoticeAsync(request);
-        //}
-
-        ///// <summary>
-        ///// 文件夹移除通知
-        ///// </summary>
-        ///// <param name="request"></param>
-        ///// <returns></returns>
-        //[HttpPost("remove-notice")]
-        //public async Task<bool> NoticeFolderDeleteNotice(NoticeFolderDeleteNoticeRequest request)
-        //{
-        //    return await _noticeFolderRepository.NoticeFolderDeleteNoticeAsync(request);
-        //}
-        /// <summary>
-        /// 获取通知文件夹
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost("find")]
-        public async Task<IEnumerable<NoticeFolderFindResult>> GetNoticeFolderByUserId(NoticeFolderFindRequest request)
-        {
-            request.UserId = _loginContext.AccountId;
-            return await _noticeFolderRepository.GetNoticeFolderByUserIdAsync(request);
-        }
-        ///// <summary>
-        ///// 设置文件夹置顶
-        ///// </summary>
-        ///// <param name="request"></param>
-        ///// <returns></returns>
-        //[HttpPost("set-is-top")]
-        //public async Task<bool> SetNoticeFolderIsTop(NoticeFolderFindRequest request)
-        //{
-        //    return await _noticeFolderRepository.SetNoticeFolderIsTopAsync(request);
-        //}
-    }
-}

+ 0 - 60
gx_api/GxPress/Api/GxPress.Api/AppControllers/TopicCommentController.cs

@@ -1,60 +0,0 @@
-using System.Threading.Tasks;
-using GxPress.Auth;
-using GxPress.Common.Page;
-using GxPress.Repository.Interface;
-using GxPress.Request.App.TopicAnalyze;
-using GxPress.Request.App.TopicComment;
-using GxPress.Result.App.TopicComment;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-
-namespace GxPress.Api.AppControllers
-{
-    [Route("api/app/topic-comment")]
-    [ApiController]
-    [Authorize]
-    public class TopicCommentController : ControllerBase
-    {
-        private readonly ITopicCommentRepository _topicCommentRepository;
-        private readonly ITopicAnalyzeRepository _topicAnalyzeRepository;
-        private readonly ILoginContext _loginContext;
-        public TopicCommentController(ITopicCommentRepository topicCommentRepository, ITopicAnalyzeRepository topicAnalyzeRepository, ILoginContext loginContext)
-        {
-            _topicCommentRepository = topicCommentRepository;
-            _topicAnalyzeRepository = topicAnalyzeRepository;
-            _loginContext = loginContext;
-        }
-
-        /// <summary>
-        /// 添加评论
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("add")]
-        public async Task<bool> Add([FromBody] TopicCommentInRequest request)
-        {
-            request.UserId = _loginContext.AccountId;
-            return await _topicCommentRepository.TopicCommentInAsync(request) > 0;
-        }
-        /// <summary>
-        /// 分页显示数据 已废弃
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("list")]
-        public async Task<PagedList<TopicCommentPageResult>> GetPagedList([FromBody] TopicCommentSearchPageRequest request)
-        {
-            return await _topicCommentRepository.GetPagedList(request);
-        }
-        /// <summary>
-        /// 评论点赞 已废弃
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost("laud")]
-        public async Task<bool> AddArticleAnalyze([FromBody] TopicAnalyzeRequest request)
-        {
-            request.UserId = _loginContext.AccountId;
-            return await _topicAnalyzeRepository.SetTopicAnalyzeAsync(request);
-        }
-    }
-}

+ 0 - 249
gx_api/GxPress/Api/GxPress.Api/AppControllers/TopicController.cs

@@ -1,249 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using GxPress.Auth;
-using GxPress.Common.Page;
-using GxPress.Entity.Topic;
-using GxPress.Repository.Interface;
-using GxPress.Repository.Interface.Topic;
-using GxPress.Request.App.Topic;
-using GxPress.Result.App.Topic;
-using GxPress.Service.Interface.Middle;
-using GxPress.Service.Interface.Topic;
-using Microsoft.AspNetCore.Authorization;
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.Extensions.Logging;
-
-namespace GxPress.Api.AppControllers
-{
-    /// <summary>
-    /// APP话题
-    /// </summary>
-    [Route("api/app/topic")]
-    [ApiController]
-    [Authorize]
-    public class TopicController : ControllerBase
-    {
-        private readonly ILogger<TopicController> _logger;
-        private readonly ITopicRepository _topicRepository;
-        private readonly ILoginContext _loginContext;
-        private readonly ITopicService _topicService;
-        private readonly ITopicGroupRepository _topicGroupRepository;
-        private readonly ITopicGroupUserRepository _topicGroupUserRepository;
-        private readonly ITopicAnalyzeRepository _topicAnalyzeRepository;
-        private readonly ITopicCommentRepository _topicCommentRepository;
-        private readonly IMiddleService _middleService;
-
-        public TopicController(ILogger<TopicController> logger, ITopicRepository repository, ILoginContext loginContext,
-            ITopicService topicService, ITopicGroupRepository topicGroupRepository,
-            ITopicGroupUserRepository topicGroupUserRepository, ITopicAnalyzeRepository topicAnalyzeRepository,
-            ITopicCommentRepository topicCommentRepository, IMiddleService middleService)
-        {
-            _logger = logger;
-            _topicRepository = repository;
-            _loginContext = loginContext;
-            _topicService = topicService;
-            _topicGroupRepository = topicGroupRepository;
-            _topicGroupUserRepository = topicGroupUserRepository;
-            _topicAnalyzeRepository = topicAnalyzeRepository;
-            _topicCommentRepository = topicCommentRepository;
-            _middleService = middleService;
-        }
-
-        /// <summary>
-        /// 添加
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("add")]
-        public async Task<bool> Insert(TopicInRequest request)
-        {
-            // request.HtmlContent = StringUtils.RemoveEmoji(request.HtmlContent);
-            // request.Content = StringUtils.RemoveEmoji(request.Content);
-            // request.Title = StringUtils.RemoveEmoji(request.Title);
-            request.UserId = _loginContext.AccountId;
-            return await _topicService.InsertTopicAsync(request);
-        }
-
-        /// <summary>
-        /// 获取话题详情
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("app-detail")]
-        public async Task<TopicDetailResult> GetTopicDetailResult(TopicDetailRequest request)
-        {
-            request.UserId = _loginContext.AccountId;
-            var topicDetail = await _topicService.GetTopicDetailResultAsync(request);
-            return topicDetail;
-        }
-        /// <summary>
-        /// 获取话题详情 web专属
-        /// </summary>
-        /// <param name="id"></param>
-        /// <returns></returns>
-        [HttpGet("web-app-detail/{id}")]
-        [AllowAnonymous]
-        public async Task<TopicDetailResult> GetWebTopicDetailResult(int id)
-        {
-            var request = new TopicDetailRequest
-            {
-                Id = id
-            };
-            var topicDetail = await _topicService.GetTopicDetailResultAsync(request);
-            return topicDetail;
-        }
-
-
-        /// <summary>
-        /// app话题分页列表
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("list-page")]
-        public async Task<PagedList<TopicListPageResult>> GetTopicListPage(TopicPageSearchRequest request)
-        {
-            request.UserId = _loginContext.AccountId;
-            return await _topicService.GetTopicPageAsync(request);
-        }
-
-        /// <summary>
-        /// 获取用户话题分组
-        /// </summary>
-        /// <returns></returns>
-        [HttpPost("group")]
-        public async Task<IEnumerable<TopicGroup>> GetTopicGroups()
-        {
-            return await _topicGroupRepository.GetTopicGroupsAsync(_loginContext.AccountId);
-        }
-
-        /// <summary>
-        /// 添加话题分组
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPut("add-group")]
-        public async Task<bool> InsertTopicGroup(TopicGroupInRequest request)
-        {
-            var topicGroup = new TopicGroup { Name = request.Name, UserId = _loginContext.AccountId };
-            return await _topicGroupRepository.InsertAsync(topicGroup);
-        }
-
-        /// <summary>
-        /// 修改分组名称
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPut("update-group")]
-        public async Task<bool> UpdateGroup(TopicGroupInRequest request)
-        {
-            return await _topicGroupRepository.UpdateAsync(request);
-        }
-
-        /// <summary>
-        /// 根据话题分组Id删除数据
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpDelete("delete_group")]
-        public async Task<bool> DeleteTopicGroup([FromBody] TopicGroupDeRequest request)
-        {
-            return await _topicService.DeleteTopicGroupAsync(request.Ids);
-        }
-
-        /// <summary>
-        /// 根据分组ID查询用户
-        /// </summary>
-        /// <param name="id"></param>
-        /// <returns></returns>
-        [HttpGet("{id}")]
-        public async Task<PagedList<TopicGroupUserResult>> GetTopicGroupUserById(int id)
-        {
-            return await _topicGroupUserRepository.GetTopicGroupUserById(id);
-        }
-
-        /// <summary>
-        /// 添加话题小组成员
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("add-group-user")]
-        public async Task<bool> InsertAsync([FromBody]TopicGroupUserInRequest request)
-        {
-            return await _topicService.InsertTopicGroupUserAsync(request.UserIds.Distinct().ToList(), request.TopicGroupId);
-        }
-
-        /// <summary>
-        /// 根据ID删除话题分组成员
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpDelete("group-user")]
-        public async Task<bool> DeleteUser(TopicGroupDeRequest request)
-        {
-            return await _topicService.DeleteTopicGroupUserAsync(request.Ids);
-        }
-
-        /// <summary>
-        /// 排序
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPut("sort")]
-        public async Task<bool> MoveSort(TopicMoveSortRequest request)
-        {
-
-            return await _topicGroupRepository.MoveSortAsync(request.FirstId, request.SecondId, _loginContext.AccountId);
-        }
-
-        /// <summary>
-        /// 移动到
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPut("move")]
-        public async Task<bool> MoveToGroup(MoveToGroupRequest request)
-        {
-            return await _topicService.MoveToGroupAsync(request);
-        }
-
-        /// <summary>
-        /// 根据分组ID和姓名查询用户
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPost("search")]
-        public async Task<PagedList<TopicGroupUserResult>> SearchTopicGroupUsers(SearchTopicGroupUsersRequest request)
-        {
-            return await _topicGroupUserRepository.SearchTopicGroupUsersAsync(request);
-        }
-
-
-
-        /// <summary>
-        /// 删除话题
-        /// </summary>
-        /// <param name="id"></param>
-        /// <returns></returns>
-        [HttpDelete("{id}")]
-        public async Task<bool> Delete(int id)
-        {
-            return await _topicService.DeleteAsync(id);
-        }
-
-        /// <summary>
-        /// 修改话题
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        [HttpPut("update")]
-        public async Task<bool> Update(TopicUpdateRequest request)
-        {
-            // request.HtmlContent = StringUtils.RemoveEmoji(request.HtmlContent);
-            // request.Content = StringUtils.RemoveEmoji(request.Content);
-            // request.Title = StringUtils.RemoveEmoji(request.Title);
-            request.UserId = _loginContext.AccountId;
-            return await _topicService.UpdateAsync(request);
-        }
-    }
-}

+ 0 - 3
gx_api/GxPress/Api/GxPress.Api/AppControllers/videoController.cs

@@ -1,8 +1,5 @@
 using System;
 using System.IO;
-using System.Net;
-using System.Net.Http;
-using System.Net.Http.Headers;
 using GxPress.Service.Interface.Video;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Hosting;

+ 18 - 0
gx_api/GxPress/Infrastructure/GxPress.Common/Tools/StringUtils.cs

@@ -113,6 +113,24 @@ namespace GxPress.Common.Tools
             return builder.ToString();
         }
 
+
+        public static string ObjectCollectionToString(IEnumerable<string> collection, int length)
+        {
+            var builder = new StringBuilder();
+            if (collection != null)
+            {
+                int i = 0;
+                foreach (var obj in collection)
+                {
+                    builder.Append(obj.Trim()).Append(",");
+                    if (i >= length)
+                        break;
+                        i++;
+                }
+                if (builder.Length != 0) builder.Remove(builder.Length - 1, 1);
+            }
+            return builder.ToString();
+        }
         public static string ObjectCollectionToString(IEnumerable<string> collection, string charValue)
         {
             if (collection.Count() == 0)

+ 9 - 15
gx_api/GxPress/Model/GxPress.Entity/NoticeAddressee.cs

@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
 using GxPress.EnumConst;
-using Datory;
 using Datory.Annotations;
 
 namespace GxPress.Entity
@@ -10,15 +6,19 @@ namespace GxPress.Entity
     /// <summary>
     /// 通知收件人
     /// </summary>
-    [DataTable("tede_notice_addressee")]
-    public class NoticeAddressee : Datory.Entity
+    [DataTable("tede_addressee")]
+    public class Addressee : Datory.Entity
     {
         /// <summary>
-        /// 通知ID
+        /// 来源ID
         /// </summary>
         [DataColumn]
-        public int NoticeId { get; set; }
-
+        public int SourceId { get; set; }
+        /// <summary>
+        /// 来源类型
+        /// </summary>
+        [DataColumn]
+        public int SourceType { get; set; }
         /// <summary>
         /// 收件人
         /// </summary>
@@ -43,12 +43,6 @@ namespace GxPress.Entity
         [DataColumn]
         public NoticeTypeConst NoticeAddresseeType { get; set; }
 
-        /// <summary>
-        /// 文件夹ID
-        /// </summary>
-        [DataColumn]
-        public int NoticeFolderId { get; set; }
-
 
         /// <summary>
         /// 是否置顶

+ 11 - 14
gx_api/GxPress/Model/GxPress.Entity/NoticeCc.cs

@@ -1,8 +1,3 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using GxPress.EnumConst;
-using Datory;
 using Datory.Annotations;
 
 namespace GxPress.Entity
@@ -10,14 +5,20 @@ namespace GxPress.Entity
     /// <summary>
     /// 通知抄送
     /// </summary>
-    [DataTable("tede_notice_cc")]
-    public class NoticeCc : Datory.Entity
+    [DataTable("tede_cc")]
+    public class Cc : Datory.Entity
     {
         /// <summary>
-        /// 通知ID
+        /// 来源ID
         /// </summary>
         [DataColumn]
-        public int NoticeId { get; set; }
+        public int SourceId { get; set; }
+
+         /// <summary>
+        /// 来源类型
+        /// </summary>
+        [DataColumn]
+        public int SourceType { get; set; }
         /// <summary>
         /// 抄送人ID
         /// </summary>
@@ -33,10 +34,6 @@ namespace GxPress.Entity
         /// </summary>
         [DataColumn]
         public bool IsRead { get; set; }
-        /// <summary>
-        /// 抄送人 1 接收 2 草稿
-        /// </summary>
-        [DataColumn]
-        public NoticeTypeConst NoticeCcType { get; set; }
+       
     }
 }

+ 50 - 2
gx_api/GxPress/Model/GxPress.Entity/Middle/Middle.cs

@@ -15,7 +15,7 @@ namespace GxPress.Entity.Middle
         [DataColumn]
         public string FolderName { get; set; }
         /// <summary>
-        /// 文件夹类型 1 通知 2话题 3 收藏 4笔记 5 普通站内信 6匿名站内信 7小组 10信源
+        /// 文件夹类型 2话题 3 收藏 4笔记 5通知 6站内信 7小组  12 收藏文件夹 13笔记文件夹 14工作流审批  21 新版话题 100 文章 300 文件 301图片 400会议纪要 500会议详情 601 财务报表 602人事报表 603 出版报表 20我审批的 30我发出的 40抄送我的 10信源聊天
         /// </summary>
         [DataColumn]
         public int FolderType { get; set; }
@@ -97,7 +97,55 @@ namespace GxPress.Entity.Middle
         /// 是否上传
         /// </summary>
         /// <value></value>
-         [DataColumn]
+        [DataColumn]
         public bool IsUpload { get; set; }
+        /// <summary>
+        /// 标题
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Title { get; set; }
+
+        /// <summary>
+        /// 长标题标题
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string TitleLong { get; set; }
+
+        /// <summary>
+        /// 长标题 长内容
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string Content { get; set; }
+
+        /// <summary>
+        /// 收件人
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string AddressUser { get; set; }
+
+        /// <summary>
+        /// 抄送人
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string CcUser { get; set; }
+
+        /// <summary>
+        /// 完整收件人
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string AddressUserComplete { get; set; }
+
+        /// <summary>
+        /// 完整抄送人
+        /// </summary>
+        /// <value></value>
+        [DataColumn]
+        public string CcUserComplete { get; set; }
     }
 }

+ 0 - 46
gx_api/GxPress/Model/GxPress.Entity/Missive/MissiveAddressee.cs

@@ -1,46 +0,0 @@
-using System.Data;
-using Datory.Annotations;
-
-namespace GxPress.Entity.Missive
-{
-    /// <summary>
-    /// 站内信收件人
-    /// </summary>
-    [DataTable("tede_missive_addressee")]
-    public class MissiveAddressee : Datory.Entity
-    {
-        /// <summary>
-        /// 站内信ID
-        /// </summary>
-        [DataColumn]
-        public int MissiveId { get; set; }
-
-        /// <summary>
-        /// 收件人
-        /// </summary>
-        [DataColumn]
-        public int UserId { get; set; }
-
-        /// <summary>
-        /// 收件人姓名
-        /// </summary>
-        [DataColumn]
-        public string UserName { get; set; }
-        /// <summary>
-        /// 是否阅读
-        /// </summary>
-        [DataColumn]
-        public bool IsRead { get; set; }
-
-         /// <summary>
-        /// 是否管理
-        /// </summary>
-        [DataColumn]
-        public bool IsAdmin { get; set; }
-         /// <summary>
-        /// 是否删除
-        /// </summary>
-        [DataColumn]
-        public bool IsDelete { get; set; }
-    }
-}

+ 0 - 32
gx_api/GxPress/Model/GxPress.Entity/Missive/MissiveAnalyze.cs

@@ -1,32 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Datory.Annotations;
-
-namespace GxPress.Entity.Missive
-{
-    /// <summary>
-    /// 站内信分析包含了 收藏 点赞 转发 
-    /// </summary>
-    [DataTable("tede_missive_analyze")]
-    public class MissiveAnalyze : Datory.Entity
-    {
-        /// <summary>
-        ///站内信ID
-        /// </summary>
-        [DataColumn]
-        public int MissiveId { get; set; }
-
-        /// <summary>
-        /// 用户ID
-        /// </summary>
-        [DataColumn]
-        public int UserId { get; set; }
-
-        /// <summary>
-        /// 类型ID (1 点赞,2评论点赞,3收藏,4转发)
-        /// </summary>
-        [DataColumn]
-        public int AnalyzeType { get; set; }
-    }
-}

+ 0 - 34
gx_api/GxPress/Model/GxPress.Entity/Missive/MissiveCc.cs

@@ -1,34 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using Datory.Annotations;
-using GxPress.EnumConst;
-
-namespace GxPress.Entity.Missive
-{
-    /// <summary>
-    /// 抄送人
-    /// </summary>
-    [DataTable(("tede_missive_cc"))]
-    public class MissiveCc : Datory.Entity
-    {
-
-        /// <summary>
-        /// 站内信ID
-        /// </summary>
-        [DataColumn]
-        public int MissiveId { get; set; }
-
-        /// <summary>
-        /// 收件人
-        /// </summary>
-        [DataColumn]
-        public int UserId { get; set; }
-
-        /// <summary>
-        /// 收件人姓名
-        /// </summary>
-        [DataColumn]
-        public string UserName { get; set; }
-    }
-}

+ 1 - 5
gx_api/GxPress/Model/GxPress.Entity/Notice.cs

@@ -51,11 +51,7 @@ namespace GxPress.Entity
         [DataColumn]
         public bool IsDelete { get; set; }
 
-        /// <summary>
-        /// 文件夹ID
-        /// </summary>
-        [DataColumn]
-        public int NoticeFolderId { get; set; }
+
 
         /// <summary>
         /// 是否置顶

+ 0 - 37
gx_api/GxPress/Model/GxPress.Entity/NoticeAnalyze.cs

@@ -1,37 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Text;
-using Datory;
-using Datory.Annotations;
-
-namespace GxPress.Entity
-{
-    /// <summary>
-    /// 通知的分析包含了 收藏 点赞 转发 评论点赞
-    /// </summary>
-    [DataTable("tede_notice_analyze")]
-   public class NoticeAnalyze:Datory.Entity
-    {
-        /// <summary>
-        /// 文章ID
-        /// </summary>
-        [DataColumn]
-        public int NoticeId { get; set; }
-        /// <summary>
-        /// 评论ID
-        /// </summary>
-        [DataColumn]
-        public int NoticeCommentId { get; set; }
-        /// <summary>
-        /// 用户ID
-        /// </summary>
-        [DataColumn]
-        public int UserId { get; set; }
-        /// <summary>
-        /// 类型ID (1 通知点赞,2评论点赞,3收藏,4转发)
-        /// </summary>
-        [DataColumn]
-        public int AnalyzeType { get; set; }
-    }
-}

+ 0 - 33
gx_api/GxPress/Model/GxPress.Entity/Topic/TopicAnalyze.cs

@@ -1,33 +0,0 @@
-using Datory;
-using Datory.Annotations;
-
-namespace GxPress.Entity.Topic
-{
-    /// <summary>
-    /// 话题的分析包含了 收藏 点赞 转发 评论点赞
-    /// </summary>
-    [DataTable("tede_topic_analyze")]
-   public class TopicAnalyze:Datory.Entity
-    {
-        /// <summary>
-        /// 话题ID
-        /// </summary>
-        [DataColumn]
-        public int TopicId { get; set; }
-        /// <summary>
-        /// 评论ID
-        /// </summary>
-        [DataColumn]
-        public int TopicCommentId { get; set; }
-        /// <summary>
-        /// 用户ID
-        /// </summary>
-        [DataColumn]
-        public int UserId { get; set; }
-        /// <summary>
-        /// 类型ID (1 话题点赞,2话题评论点赞,3话题收藏,4话题转发)
-        /// </summary>
-        [DataColumn]
-        public int AnalyzeType { get; set; }
-    }
-}

+ 0 - 37
gx_api/GxPress/Model/GxPress.Entity/Topic/TopicComment.cs

@@ -1,37 +0,0 @@
-using Datory;
-using Datory.Annotations;
-
-namespace GxPress.Entity.Topic
-{
-    /// <summary>
-    /// 话题评论
-    /// </summary>
-    [DataTable("tede_topic_comment")]
-    public class TopicComment:Datory.Entity
-    {
-        /// <summary>
-        /// 话题ID
-        /// </summary>
-        [DataColumn] public int TopicId { get; set; }
-        /// <summary>
-        /// 用户ID
-        /// </summary>
-        [DataColumn] public int UserId { get; set; }
-        /// <summary>
-        /// 内容
-        /// </summary>
-        [DataColumn] public string Content { get; set; }
-        /// <summary>
-        /// 点赞次数
-        /// </summary>
-        [DataColumn] public int Laud { get; set; }
-        /// <summary>
-        /// 父级ID
-        /// </summary>
-        [DataColumn] public int Pid { get; set; }
-        /// <summary>
-        /// 是否讨论
-        /// </summary>
-        [DataColumn] public bool IsUnderstand { get; set; }
-    }
-}

+ 31 - 0
gx_api/GxPress/Model/GxPress.EnumConst/FolderTypeConst.cs

@@ -0,0 +1,31 @@
+namespace GxPress.EnumConst
+{
+    /// <summary>
+    /// 文件夹类型 2话题 3 收藏 4笔记 5通知 6站内信 7小组  12 收藏文件夹 13笔记文件夹 14工作流审批  21 新版话题 100 文章 300 文件 301图片 400会议纪要 500会议详情 601 财务报表 602人事报表 603 出版报表 20我审批的 30我发出的 40抄送我的 10信源聊天
+    /// </summary>
+    public enum FolderTypeConst
+    {
+        GroupTopic = 2,
+        Collction = 3,
+        Note = 4,
+        Notice = 5,
+        Missive = 6,
+        Group = 7,
+        CollctionFolder = 12,
+        NoteFolder = 13,
+        WorkFlow = 14,
+        Topic = 21,
+        Article = 100,
+        File = 300,
+        Image = 301,
+        Meeting = 500,
+        MeetingSummary = 400,
+        Finance = 601,
+        HumanAffairs = 602,
+        Publish = 603,
+        Approval = 20,
+        Submitted = 30,
+        Cc = 40,
+        Chat = 10
+    }
+}

+ 0 - 18
gx_api/GxPress/Model/GxPress.Mappings/NoticeAnalyzeMapping.cs

@@ -1,18 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using AutoMapper;
-using GxPress.Entity;
-using GxPress.Result.Notice;
-
-namespace GxPress.Mappings
-{
-    class NoticeAnalyzeMapping : Profile
-    {
-        public NoticeAnalyzeMapping()
-        {
-            CreateMap<NoticeAnalyze, NoticePraisePageResult>();
-        }
-
-    }
-}

+ 0 - 7
gx_api/GxPress/Model/GxPress.Mappings/TopicMapping.cs

@@ -1,11 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
 using AutoMapper;
-using GxPress.Entity;
 using GxPress.Entity.Topic;
 using GxPress.Result.App.Topic;
-using GxPress.Result.User;
 
 namespace GxPress.Mappings
 {
@@ -16,8 +11,6 @@ namespace GxPress.Mappings
             CreateMap<Topic, TopicListPageResult>();
 
             CreateMap<Topic, TopicDetailResult>();
-
-            CreateMap<TopicAnalyze, TopicPraisePageResult>();
         }
     }
 }

+ 37 - 0
gx_api/GxPress/Model/GxPress.Request/App/Middle/MiddleInsertRequest.cs

@@ -117,5 +117,42 @@ namespace GxPress.Request.App.Middle
         /// 是否阅读
         /// </summary>
         public bool IsRead { get; set; }
+        /// <summary>
+        /// 标题
+        /// </summary>
+        /// <value></value>
+        public string Title { get; set; }
+
+        /// <summary>
+        /// 长标题标题
+        /// </summary>
+        /// <value></value>
+        public string TitleLong { get; set; }
+
+        /// <summary>
+        /// 长标题 长内容
+        /// </summary>
+        /// <value></value>
+        public string Content { get; set; }
+        /// <summary>
+        /// 收件人
+        /// </summary>
+        /// <value></value>
+        public string AddressUser { get; set; }
+        /// <summary>
+        /// 抄送人
+        /// </summary>
+        /// <value></value>
+        public string CcUser { get; set; }
+        /// <summary>
+        /// 完整收件人
+        /// </summary>
+        /// <value></value>
+        public string AddressUserComplete { get; set; }
+        /// <summary>
+        /// 完整抄送人
+        /// </summary>
+        /// <value></value>
+        public string CcUserComplete { get; set; }
     }
 }

+ 0 - 3
gx_api/GxPress/Model/GxPress.Request/App/Missive/MissiveInRequest.cs

@@ -1,7 +1,4 @@
-using System;
 using System.Collections.Generic;
-using System.Text;
-using Datory.Annotations;
 using GxPress.EnumConst;
 
 namespace GxPress.Request.App.Missive

+ 24 - 0
gx_api/GxPress/Model/GxPress.Request/Inbox/InboxSearchRequest.cs

@@ -0,0 +1,24 @@
+namespace GxPress.Request.Inbox
+{
+    /// <summary>
+    /// 收件箱
+    /// </summary>
+    public class InboxSearchRequest
+    {
+        /// <summary>
+        /// 文件夹类型 2话题 3 收藏 4笔记 5通知 6站内信 7小组  12 收藏文件夹 13笔记文件夹 14工作流审批  21 新版话题 100 文章 300 文件 301图片 400会议纪要 500会议详情 601 财务报表 602人事报表 603 出版报表 20我审批的 30我发出的 40抄送我的 10信源聊天
+        /// </summary>
+        /// <value></value>
+        public int Type { get; set; }
+        /// <summary>
+        /// 搜索字段
+        /// </summary>
+        /// <value></value>
+        public string KeyWord { get; set; }
+        /// <summary>
+        /// 用户ID
+        /// </summary>
+        /// <value></value>
+        public int UserId { get; set; }
+    }
+}

+ 28 - 15
gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeAddresseeRepository.cs

@@ -4,7 +4,6 @@ using AutoMapper;
 using GxPress.Common.AppOptions;
 using GxPress.Common.Tools;
 using GxPress.Entity;
-using GxPress.Repository.Interface;
 using Microsoft.Extensions.Options;
 using Datory;
 using GxPress.Request.Notice;
@@ -12,11 +11,15 @@ using SqlKata;
 using GxPress.Result.Notice;
 using Dapper;
 using System;
+using GxPress.Repository.Interface;
+using GxPress.Result.App.Missive;
+using GxPress.Request.App.Missive;
+
 namespace GxPress.Repository.Implement
 {
-    public class NoticeAddresseeRepository : INoticeAddresseeRepository
+    public class NoticeAddresseeRepository : IAddresseeRepository
     {
-        private readonly Repository<NoticeAddressee> _repository;
+        private readonly Repository<Addressee> _repository;
         private readonly IMapper _mapper;
         private readonly string _connectionString;
         private readonly string _databaseTypeStr;
@@ -26,7 +29,7 @@ namespace GxPress.Repository.Implement
             _connectionString = dbOptionsAccessor.CurrentValue.ConnectionString;
             var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
             var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
-            _repository = new Repository<NoticeAddressee>(database);
+            _repository = new Repository<Addressee>(database);
             _mapper = mapper;
         }
 
@@ -38,17 +41,22 @@ namespace GxPress.Repository.Implement
         /// </summary>
         /// <param name="noticeId"></param>
         /// <returns></returns>
-        public async Task<IEnumerable<NoticeAddressee>> GetNoticeAddresseeByNoticeIdAsync(int noticeId)
+        public async Task<IEnumerable<Addressee>> GetNoticeAddresseeByNoticeIdAsync(int noticeId)
         {
-            return await _repository.GetAllAsync(Q.Where(nameof(NoticeAddressee.NoticeId), noticeId));
+            return await _repository.GetAllAsync(Q.Where(nameof(Addressee.SourceId), noticeId));
         }
 
-        public async Task<bool> DeleteAsync(int noticeId)
+        public async Task<bool> DeleteAsync(int noticeId, int sourceType, int isAdmin)
         {
-            return await _repository.DeleteAsync(Q.Where(nameof(NoticeAddressee.NoticeId), noticeId)) > 0;
+            var query = new SqlKata.Query();
+            if (isAdmin == 0)
+                query.Where(nameof(Addressee.IsAdmin), false);
+            if (isAdmin == 1)
+                query.Where(nameof(Addressee.IsAdmin), true);
+            return await _repository.DeleteAsync(Q.Where(nameof(Addressee.SourceId), noticeId).Where(nameof(Addressee.SourceType), sourceType)) > 0;
         }
 
-        public async Task<int> InsertAsync(NoticeAddressee noticeAddressee)
+        public async Task<int> InsertAsync(Addressee noticeAddressee)
         {
             return await _repository.InsertAsync(noticeAddressee);
         }
@@ -57,11 +65,11 @@ namespace GxPress.Repository.Implement
         /// </summary>
         /// <param name="noticeAddressees"></param>
         /// <returns></returns>
-        public async Task<bool> InsertAsync(List<NoticeAddressee> noticeAddressees)
+        public async Task<bool> InsertAsync(List<Addressee> noticeAddressees)
         {
             if (noticeAddressees.Count == 0)
                 return false;
-            var sql = "INSERT INTO `ccpph`.`tede_notice_addressee`(`Guid`,`CreatedDate`,`LastModifiedDate`,`NoticeId`,`UserId`,`UserName`,`IsRead`,`NoticeAddresseeType`,`NoticeFolderId`,`IsTop`,`IsAdmin`,`IsDelete`)VALUES";
+            var sql = "INSERT INTO `tede_addressee`(`Guid`,`CreatedDate`,`LastModifiedDate`,`SourceId`,`SourceType`,`UserId`,`UserName`,`IsRead`,`NoticeAddresseeType`,`IsTop`,`IsAdmin`,`IsDelete`)VALUES";
             foreach (var item in noticeAddressees)
             {
                 var guId = Guid.NewGuid().ToString();
@@ -70,13 +78,13 @@ namespace GxPress.Repository.Implement
                 var isTop = item.IsTop == true ? 1 : 0;
                 var isAdmin = item.IsAdmin == true ? 1 : 0;
                 var isDelete = item.IsDelete == true ? 1 : 0;
-                sql += $"('{guId}','{createdDate}','{createdDate}',{item.NoticeId},{item.UserId},'',{isRead},{item.NoticeAddresseeType.GetHashCode()},{item.NoticeFolderId},{isTop},{isAdmin},{isDelete}),";
+                sql += $"('{guId}','{createdDate}','{createdDate}',{item.SourceId},{item.SourceType},{item.UserId},'',{isRead},{item.NoticeAddresseeType.GetHashCode()},{isTop},{isAdmin},{isDelete}),";
             }
             sql = sql.Remove(sql.Length - 1, 1);
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
-            var items = await connection.ExecuteScalarAsync<int>(sql);
+            var items = await connection.ExecuteAsync(sql);
             return items > 0;
         }
         /// <summary>
@@ -131,7 +139,7 @@ namespace GxPress.Repository.Implement
             return await _repository.CountAsync(query);
         }
 
-        public async Task<IEnumerable<NoticeAddressee>> GetAllAsync(Query query)
+        public async Task<IEnumerable<Addressee>> GetAllAsync(Query query)
         {
             return await _repository.GetAllAsync(query);
         }
@@ -141,9 +149,14 @@ namespace GxPress.Repository.Implement
             return await _repository.UpdateAsync(query) > 0;
         }
 
-         public async Task<bool> ExistsAsync(Query query)
+        public async Task<bool> ExistsAsync(Query query)
         {
             return await _repository.ExistsAsync(query);
         }
+
+        public Task<IEnumerable<MissiveReadListResult>> GetMissiveReadListAsync(MissiveReadListRequest request)
+        {
+            throw new NotImplementedException();
+        }
     }
 }

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/AdminVerify/AdminVerifyRepository.cs

@@ -49,7 +49,7 @@ namespace GxPress.Repository.Implement.AdminVerify
 
         public async Task<bool> InsertAsync(List<Entity.AdminVerify> adminVerifys)
         {
-            string sql = @"INSERT INTO `ccpph`.`tede_admin_verify`(`Guid`,`CreatedDate`,`LastModifiedDate`,`VerifyType`,`DisposeType`,
+            string sql = @"INSERT INTO `tede_admin_verify`(`Guid`,`CreatedDate`,`LastModifiedDate`,`VerifyType`,`DisposeType`,
 `AdminId`,`UserId`,`SourceId`,`Name`,`AvatarUrl`,`Remark`,`SourceType`,`SourceName`,`IsDelete`)VALUES";
             if (adminVerifys.Count == 0)
                 return false;

+ 20 - 15
gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeCcRepository.cs

@@ -12,19 +12,19 @@ using Dapper;
 
 namespace GxPress.Repository.Implement
 {
-    public class NoticeCcRepository : INoticeCcRepository
+    public class CcRepository : ICcRepository
     {
-        private readonly Repository<NoticeCc> _repository;
+        private readonly Repository<Cc> _repository;
         private readonly IMapper _mapper;
         private readonly string _connectionString;
         private readonly string _databaseTypeStr;
-        public NoticeCcRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
+        public CcRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
         {
             _databaseTypeStr = dbOptionsAccessor.CurrentValue.DatabaseType;
             _connectionString = dbOptionsAccessor.CurrentValue.ConnectionString;
             var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
             var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
-            _repository = new Repository<NoticeCc>(database);
+            _repository = new Repository<Cc>(database);
             _mapper = mapper;
         }
 
@@ -36,42 +36,47 @@ namespace GxPress.Repository.Implement
         /// </summary>
         /// <param name="noticeId"></param>
         /// <returns></returns>
-        public async Task<IEnumerable<NoticeCc>> GetNoticeCcByNoticeIdAsync(int noticeId)
+        public async Task<IEnumerable<Cc>> GetNoticeCcByNoticeIdAsync(int noticeId, int sourceType)
         {
-            return await _repository.GetAllAsync(Q.Where(nameof(NoticeCc.NoticeId), noticeId));
+            return await _repository.GetAllAsync(Q.Where(nameof(Cc.SourceId), noticeId).Where(nameof(Cc.SourceType), sourceType));
         }
-
-        public async Task<bool> DeleteAsync(int noticeId)
+        /// <summary>
+        /// 删除
+        /// </summary>
+        /// <param name="sourceId"></param>
+        /// <param name="sourceType"></param>
+        /// <returns></returns>
+        public async Task<bool> DeleteAsync(int sourceId, int sourceType)
         {
-            return await _repository.DeleteAsync(Q.Where(nameof(NoticeCc.NoticeId), noticeId)) > 0;
+            return await _repository.DeleteAsync(Q.Where(nameof(Cc.SourceId), sourceId).Where(nameof(Cc.SourceType), sourceType)) > 0;
         }
 
-        public async Task<int> InsertAsync(NoticeCc noticeCc)
+        public async Task<int> InsertAsync(Cc cc)
         {
-            return await _repository.InsertAsync(noticeCc);
+            return await _repository.InsertAsync(cc);
         }
         /// <summary>
         /// 添加通知抄送人
         /// </summary>
         /// <param name="noticeCcs"></param>
         /// <returns></returns>
-        public async Task<bool> InsertAsync(List<NoticeCc> noticeCcs)
+        public async Task<bool> InsertAsync(List<Cc> noticeCcs)
         {
             if (noticeCcs.Count == 0)
                 return false;
-            var sql = "INSERT INTO `ccpph`.`tede_notice_cc`(`Guid`,`CreatedDate`,`LastModifiedDate`,`NoticeId`,`UserId`,`UserName`,`IsRead`,`NoticeCcType`)VALUES";
+            var sql = "INSERT INTO `tede_cc`(`Guid`,`CreatedDate`,`LastModifiedDate`,`SourceId`,`SourceType`,`UserId`,`UserName`,`IsRead`)VALUES";
             foreach (var item in noticeCcs)
             {
                 var guId = Guid.NewGuid().ToString();
                 var createdDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                 var isRead = item.IsRead == true ? 1 : 0;
-                sql += $"('{guId}','{createdDate}','{createdDate}',{item.NoticeId},{item.UserId},'',{isRead},{item.NoticeCcType.GetHashCode()}),";
+                sql += $"('{guId}','{createdDate}','{createdDate}',{item.SourceId},{item.SourceType},{item.UserId},'',{isRead}),";
             }
             sql = sql.Remove(sql.Length - 1, 1);
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
-            var items = await connection.ExecuteScalarAsync<int>(sql);
+            var items = await connection.ExecuteAsync(sql);
             return items > 0;
         }
     }

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/FlowAttachment/FlowAttachmentRepository.cs

@@ -101,7 +101,7 @@ namespace GxPress.Repository.Implement.FlowAttachment
         {
             if (flowAttachments.Count == 0)
                 return false;
-            var sql = "INSERT INTO `ccpph`.`tede_flow_attachment`(`Guid`,`CreatedDate`,`LastModifiedDate`,`TypeId`,`SoureId`,`Url`,`Title`,`FlowId`,`Size`,`SoureTypeId`)VALUES";
+            var sql = "INSERT INTO `tede_flow_attachment`(`Guid`,`CreatedDate`,`LastModifiedDate`,`TypeId`,`SoureId`,`Url`,`Title`,`FlowId`,`Size`,`SoureTypeId`)VALUES";
             foreach (var item in flowAttachments)
             {
                 var guId = Guid.NewGuid().ToString();

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/FolderUserRepository.cs

@@ -45,7 +45,7 @@ namespace GxPress.Repository.Implement
         {
             if (folderUsers.Count == 0)
                 return false;
-            string sql = $@"INSERT INTO `ccpph`.`tede_folder_user`(`Guid`,`CreatedDate`,`LastModifiedDate`,`MiddleId`,`UserId`,`UserName`) VALUES";
+            string sql = $@"INSERT INTO `tede_folder_user`(`Guid`,`CreatedDate`,`LastModifiedDate`,`MiddleId`,`UserId`,`UserName`) VALUES";
             foreach (var item in folderUsers)
             {
                 var guid = Guid.NewGuid().ToString();

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/GroupChatUserRepository.cs

@@ -93,7 +93,7 @@ namespace GxPress.Repository.Implement
         {
             if (groupChatUsers.Count == 0 || groupChatUsers == null)
                 return false;
-            string sql = $@"INSERT INTO `ccpph`.`tede_group_chat_user`(`Guid`,`CreatedDate`,`LastModifiedDate`,`GroupChatId`,`UserId`,`IsDisturb`,`IsTop`,`ImId`,`IsAdmin`,`GroupChatImId`)VALUES";
+            string sql = $@"INSERT INTO `tede_group_chat_user`(`Guid`,`CreatedDate`,`LastModifiedDate`,`GroupChatId`,`UserId`,`IsDisturb`,`IsTop`,`ImId`,`IsAdmin`,`GroupChatImId`)VALUES";
             var guId = Guid.NewGuid().ToString();
             var nowTime = System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
             foreach (var item in groupChatUsers)

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/GroupUserRepository.cs

@@ -105,7 +105,7 @@ namespace GxPress.Repository.Implement
 
         public async Task<bool> InsertAsync(List<GroupUser> groupUsers)
         {
-            string sql = @"INSERT INTO `ccpph`.`tede_group_user`
+            string sql = @"INSERT INTO `tede_group_user`
                                                             (`Guid`,
                                                             `CreatedDate`,
                                                             `LastModifiedDate`,

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/MeetingSummaryTodo/MeetingSummaryTodoRepository.cs

@@ -74,7 +74,7 @@ namespace GxPress.Repository.Implement.MeetingSummaryTodo
         {
             if (flowAttachments.Count == 0)
                 return false;
-            var sql = "INSERT INTO `ccpph`.`tede_meeting_summary_todo`(`Guid`,`CreatedDate`,`LastModifiedDate`,`MeetingSummaryId`,`UserId`,`IsAdmin`,`TypeId`)VALUES";
+            var sql = "INSERT INTO `tede_meeting_summary_todo`(`Guid`,`CreatedDate`,`LastModifiedDate`,`MeetingSummaryId`,`UserId`,`IsAdmin`,`TypeId`)VALUES";
             foreach (var item in flowAttachments)
             {
                 var guId = Guid.NewGuid().ToString();

+ 31 - 2
gx_api/GxPress/Repository/GxPress.Repository.Implement/MiddleRepository.cs

@@ -13,6 +13,7 @@ using SqlKata;
 using Datory;
 using GxPress.Request.App.Middle;
 using System;
+using GxPress.Request.Inbox;
 
 namespace GxPress.Repository.Implement
 {
@@ -58,7 +59,7 @@ namespace GxPress.Repository.Implement
         {
             if (middles.Count == 0)
                 return false;
-            var sql = "INSERT INTO `ccpph`.`tede_middle`(`Guid`,`CreatedDate`,`LastModifiedDate`,`FolderName`,`FolderType`,`IsTop`,`RoleId`,`Sort`,`MiddleId`,`ParentId`,`UserId`,`MiddleSonId`,`IsRead`,`NoticeAddresseeType`,`IsAdmin`,`IsDelete`,`AttributeValue`,`IsDefault`,`IsUpload`)VALUES";
+            var sql = "INSERT INTO `tede_middle`(`Guid`,`CreatedDate`,`LastModifiedDate`,`FolderName`,`FolderType`,`IsTop`,`RoleId`,`Sort`,`MiddleId`,`ParentId`,`UserId`,`MiddleSonId`,`IsRead`,`NoticeAddresseeType`,`IsAdmin`,`IsDelete`,`AttributeValue`,`IsDefault`,`IsUpload`,`Title`,`TitleLong`,`Content`,`AddressUser`,`CcUser`,`AddressUserComplete`,`CcUserComplete`)VALUES";
             foreach (var item in middles)
             {
                 var guId = Guid.NewGuid().ToString();
@@ -67,7 +68,7 @@ namespace GxPress.Repository.Implement
                 var isDefault = item.IsDefault == true ? 1 : 0;
                 var isDelete = item.IsDelete == true ? 1 : 0;
                 var isAdmin = item.IsAdmin == true ? 1 : 0;
-                sql += $"('{guId}','{createdDate}','{createdDate}','{item.FolderName}',{item.FolderType},{item.IsTop},{item.RoleId},{item.Sort},{item.MiddleId},{item.ParentId},{item.UserId},{item.MiddleSonId},{isRead},{item.NoticeAddresseeType.GetHashCode()},{isAdmin},{isDelete},{item.AttributeValue},{isDefault},0),";
+                sql += $"('{guId}','{createdDate}','{createdDate}','{item.FolderName}',{item.FolderType},{item.IsTop},{item.RoleId},{item.Sort},{item.MiddleId},{item.ParentId},{item.UserId},{item.MiddleSonId},{isRead},{item.NoticeAddresseeType.GetHashCode()},{isAdmin},{isDelete},{item.AttributeValue},{isDefault},0,'{item.Title}','{item.TitleLong}','{item.Content}','{item.AddressUser}','{item.CcUser}','{item.AddressUserComplete}','{item.CcUserComplete}'),";
             }
             sql = sql.Remove(sql.Length - 1, 1);
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
@@ -101,6 +102,11 @@ namespace GxPress.Repository.Implement
             return await _repository.DeleteAsync(query) > 0;
         }
 
+
+        public async Task<bool> DeleteAsync(int middleId, int folderTypeId)
+        {
+            return await _repository.DeleteAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), middleId).Where(nameof(Entity.Middle.Middle.FolderType), folderTypeId)) > 0;
+        }
         public async Task<Middle> GetMiddleAsync(Query query)
         {
             return await _repository.GetAsync(query);
@@ -239,5 +245,28 @@ namespace GxPress.Repository.Implement
         {
             return await _repository.GetAllAsync(query);
         }
+
+        public async Task<IEnumerable<Middle>> FindAsync(InboxSearchRequest request)
+        {
+            var query = new SqlKata.Query();
+            if (request.Type > 0)
+            {
+                query.Where(nameof(Middle.FolderType), request.Type);
+            }
+            else
+            {
+                var listType = new List<int> { GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode(), GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode(), GxPress.EnumConst.FolderTypeConst.Submitted.GetHashCode(), GxPress.EnumConst.FolderTypeConst.Approval.GetHashCode(), GxPress.EnumConst.FolderTypeConst.Cc.GetHashCode() };
+                query.WhereIn(nameof(Middle.FolderType), listType);
+            }
+            if (!string.IsNullOrWhiteSpace(request.KeyWord))
+            {
+                query.OrWhere(nameof(Middle.TitleLong), request.KeyWord);
+                query.OrWhere(nameof(Middle.AddressUserComplete), request.KeyWord);
+                query.OrWhere(nameof(Middle.CcUserComplete), request.KeyWord);
+                query.OrWhere(nameof(Middle.Content), request.KeyWord);
+            }
+            query.Where(nameof(Middle.UserId), request.UserId);
+            return await _repository.GetAllAsync(query);
+        }
     }
 }

+ 0 - 127
gx_api/GxPress/Repository/GxPress.Repository.Implement/Missive/MissiveAddresseeRepository.cs

@@ -1,127 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using AutoMapper;
-using Dapper;
-using Datory;
-using GxPress.Common.AppOptions;
-using GxPress.Common.Tools;
-using GxPress.Entity;
-using GxPress.Entity.Missive;
-using GxPress.Repository.Interface.Missive;
-using GxPress.Request.App.Missive;
-using GxPress.Result.App.Missive;
-using Microsoft.Extensions.Options;
-using SqlKata;
-
-namespace GxPress.Repository.Implement.Missive
-{
-    public class MissiveAddresseeRepository : IMissiveAddresseeRepository
-    {
-        private readonly Repository<MissiveAddressee> _repository;
-        private readonly IMapper _mapper;
-        private readonly string _connectionString;
-        private readonly string _databaseTypeStr;
-        public MissiveAddresseeRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
-        {
-            _databaseTypeStr = dbOptionsAccessor.CurrentValue.DatabaseType;
-            _connectionString = dbOptionsAccessor.CurrentValue.ConnectionString;
-            var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
-            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
-            _repository = new Repository<MissiveAddressee>(database);
-            _mapper = mapper;
-        }
-
-        public IDatabase Database => _repository.Database;
-        public string TableName => _repository.TableName;
-        public List<TableColumn> TableColumns => _repository.TableColumns;
-
-        public async Task<int> InsertAsync(MissiveAddressee missiveAddressee)
-        {
-            return await _repository.InsertAsync(missiveAddressee);
-        }
-        /// <summary>
-        /// list 添加站内信收件人
-        /// </summary>
-        /// <param name="missiveAddressees"></param>
-        /// <returns></returns>
-        public async Task<bool> InsertAsync(List<MissiveAddressee> missiveAddressees)
-        {
-            if (missiveAddressees.Count == 0)
-                return false;
-            var sql = "INSERT INTO `ccpph`.`tede_missive_addressee`(`Guid`,`CreatedDate`,`LastModifiedDate`,`MissiveId`,`UserId`,`UserName`,`IsRead`,`IsAdmin`,`IsDelete`)VALUES";
-            foreach (var item in missiveAddressees)
-            {
-                var guId = Guid.NewGuid().ToString();
-                var createdDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
-                var isRead = item.IsRead == true ? 1 : 0;
-                var isAdmin = item.IsAdmin == true ? 1 : 0;
-                var isDelete = item.IsDelete == true ? 1 : 0;
-                sql += $"('{guId}','{createdDate}','{createdDate}',{item.MissiveId},{item.UserId},'',{isRead},{isAdmin},{isDelete}),";
-            }
-            sql = sql.Remove(sql.Length - 1, 1);
-            var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
-            var database = new Database(databaseType, _connectionString);
-            var connection = database.GetConnection();
-            var items = await connection.ExecuteScalarAsync<int>(sql);
-            return items > 0;
-        }
-        public async Task<MissiveAddressee> GetAsync(int id)
-        {
-            return await _repository.GetAsync(id);
-        }
-
-        public async Task<bool> UpdateAsync(MissiveAddressee missiveAddressee)
-        {
-            return await _repository.UpdateAsync(missiveAddressee);
-        }
-
-        public async Task<bool> DeleteAsync(Query query)
-        {
-            return await _repository.DeleteAsync(query) > 0;
-        }
-
-        public async Task<bool> UpdateAsync(Query query)
-        {
-            return await _repository.UpdateAsync(query) > 0;
-        }
-
-        public async Task<IEnumerable<MissiveAddressee>> GetAllAsync(Query query)
-        {
-            return await _repository.GetAllAsync(query);
-        }
-        /// <summary>
-        /// 获取站内信已读未读数据
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<IEnumerable<MissiveReadListResult>> GetMissiveReadListAsync(MissiveReadListRequest request)
-        {
-            var databaseType = _databaseTypeStr.ToEnum<DatabaseType>(DatabaseType.MySql);
-            var database = new Database(databaseType, _connectionString);
-            var connection = database.GetConnection();
-            var sqlValue = "";
-            if (request.ReadType > 0)
-            {
-                if (request.ReadType == 2)
-                    request.ReadType = 0;
-                sqlValue += $" and a.IsRead={request.ReadType} ";
-            }
-            if (!string.IsNullOrWhiteSpace(request.Key))
-                sqlValue += $" and b.Name like '%{request.Key}%'";
-            var sql = $"SELECT a.*,b.Id,b.Name,b.AvatarUrl,c.Name FROM ccpph.tede_missive_addressee a inner join ccpph.tede_user b on a.UserId=b.Id inner join ccpph.tede_department c on c.Id=b.DepartmentId where a.MissiveId={request.MissiveId} {sqlValue} order by a.LastModifiedDate desc";
-            var items = await connection
-              .QueryAsync<MissiveReadListResult, User, Department, MissiveReadListResult>(sql,
-                  (missiveReadListResult, user, department) =>
-                  {
-                      missiveReadListResult.AvatarUrl = user == null ? "" : StringUtils.AddDomainMin(user.AvatarUrl);
-                      missiveReadListResult.DepartmentName = department == null ? "" : department.Name;
-                      missiveReadListResult.Name = user == null ? "" : user.Name;
-                      //missiveReadListResult.UserId=user == null ? 0 : user.Id;
-                      return missiveReadListResult;
-                  },
-                  splitOn: "Id,Name");
-            return items;
-        }
-    }
-}

+ 0 - 101
gx_api/GxPress/Repository/GxPress.Repository.Implement/Missive/MissiveAnalyzeRepository.cs

@@ -1,101 +0,0 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using AutoMapper;
-using Datory;
-using GxPress.Common.AppOptions;
-using GxPress.Common.Tools;
-using GxPress.Entity.Missive;
-using GxPress.Repository.Interface.Missive;
-using GxPress.Request.App.Missive;
-using Microsoft.Extensions.Options;
-using SqlKata;
-
-namespace GxPress.Repository.Implement.Missive
-{
-    public class MissiveAnalyzeRepository : IMissiveAnalyzeRepository
-    {
-        private readonly Repository<MissiveAnalyze> _repository;
-        private readonly IMapper _mapper;
-        private readonly string _connectionString;
-        private readonly string _databaseTypeStr;
-        public MissiveAnalyzeRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
-        {
-            _databaseTypeStr = dbOptionsAccessor.CurrentValue.DatabaseType;
-            _connectionString = dbOptionsAccessor.CurrentValue.ConnectionString;
-            var databaseType =
-                StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
-            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
-            _repository = new Repository<MissiveAnalyze>(database);
-            _mapper = mapper;
-        }
-        public IDatabase Database => _repository.Database;
-        public string TableName => _repository.TableName;
-        public List<TableColumn> TableColumns => _repository.TableColumns;
-        public async Task<int> InsertAsync(MissiveAnalyze missiveAnalyze)
-        {
-            return await _repository.InsertAsync(missiveAnalyze);
-        }
-
-        public async Task<MissiveAnalyze> GetAsync(int id)
-        {
-            return await _repository.GetAsync(id);
-        }
-
-        public async Task<MissiveAnalyze> GetAsync(Query query)
-        {
-            return await _repository.GetAsync(query);
-        }
-
-        public async Task<bool> UpdateAsync(MissiveAnalyze missiveAnalyze)
-        {
-            return await _repository.UpdateAsync(missiveAnalyze);
-        }
-
-        public async Task<bool> DeleteAsync(Query query)
-        {
-            return await _repository.DeleteAsync(query) > 0;
-        }
-
-        public async Task<bool> UpdateAsync(Query query)
-        {
-            return await _repository.UpdateAsync(query) > 0;
-        }
-
-        public async Task<IEnumerable<MissiveAnalyze>> GetAllAsync(Query query)
-        {
-            return await _repository.GetAllAsync(query);
-        }
-
-        public async Task<int> GetCount(Query query)
-        {
-            return await _repository.CountAsync(query);
-        }
-
-        /// <summary>
-        /// 设置 点赞 转发 收藏
-        /// </summary>
-        /// /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<bool> SetMissiveAnalyzeAsync(MissiveAnalyzeRequest request)
-        {
-            var topicAnalyze = await _repository.GetAsync(Q
-                .Where(nameof(MissiveAnalyze.AnalyzeType), request.MissiveAnalyzeType)
-                .Where(nameof(MissiveAnalyze.MissiveId), request.MissiveId)
-                .Where(nameof(MissiveAnalyze.UserId), request.UserId));
-            if (topicAnalyze != null && topicAnalyze.Id > 0)
-                return await _repository.DeleteAsync(topicAnalyze.Id);
-            var missiveAnalyze = new MissiveAnalyze
-            {
-                AnalyzeType = request.MissiveAnalyzeType,
-                MissiveId = request.MissiveId,
-                UserId = request.UserId
-            };
-            return await InsertAsync(missiveAnalyze) > 0;
-        }
-       
-        public async Task<int> CountAsync(SqlKata.Query query)
-        {
-            return await _repository.CountAsync(query);
-        }
-    }
-}

+ 0 - 90
gx_api/GxPress/Repository/GxPress.Repository.Implement/Missive/MissiveCcRepository.cs

@@ -1,90 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using AutoMapper;
-using Dapper;
-using Datory;
-using GxPress.Common.AppOptions;
-using GxPress.Common.Tools;
-using GxPress.Entity.Missive;
-using GxPress.Repository.Interface.Missive;
-using Microsoft.Extensions.Caching.Distributed;
-using Microsoft.Extensions.Options;
-using SqlKata;
-
-namespace GxPress.Repository.Implement.Missive
-{
-    public class MissiveCcRepository : IMissiveCcRepository
-    {
-        private readonly Repository<MissiveCc> _repository;
-        private readonly IMapper _mapper;
-        private readonly IDistributedCache _cache;
-        private readonly string _connectionString;
-        private readonly string _databaseTypeStr;
-        public MissiveCcRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper, IDistributedCache cache)
-        {
-            _databaseTypeStr = dbOptionsAccessor.CurrentValue.DatabaseType;
-            _connectionString = dbOptionsAccessor.CurrentValue.ConnectionString;
-            var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
-            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
-            _repository = new Repository<MissiveCc>(database);
-            _mapper = mapper;
-            _cache = cache;
-        }
-
-        public IDatabase Database => _repository.Database;
-        public string TableName => _repository.TableName;
-        public List<TableColumn> TableColumns => _repository.TableColumns;
-        public async Task<int> InsertAsync(MissiveCc missiveCc)
-        {
-            return await _repository.InsertAsync(missiveCc);
-        }
-        /// <summary>
-        /// list 添加站内信抄送人
-        /// </summary>
-        /// <param name="missiveCcs"></param>
-        /// <returns></returns>
-        public async Task<bool> InsertAsync(List<MissiveCc> missiveCcs)
-        {
-            if (missiveCcs.Count == 0)
-                return false;
-            var sql = "INSERT INTO `ccpph`.`tede_missive_cc`(`Guid`,`CreatedDate`,`LastModifiedDate`,`MissiveId`,`UserId`,`UserName`)VALUES";
-            foreach (var item in missiveCcs)
-            {
-                var guId = Guid.NewGuid().ToString();
-                var createdDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
-                sql += $"('{guId}','{createdDate}','{createdDate}',{item.MissiveId},{item.UserId},''),";
-            }
-            sql = sql.Remove(sql.Length - 1, 1);
-            var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
-            var database = new Database(databaseType, _connectionString);
-            var connection = database.GetConnection();
-            var items = await connection.ExecuteScalarAsync<int>(sql);
-            return items > 0;
-        }
-        public async Task<MissiveCc> GetAsync(int id)
-        {
-            return await _repository.GetAsync(id);
-        }
-
-        public async Task<bool> UpdateAsync(MissiveCc missiveCc)
-        {
-            return await _repository.UpdateAsync(missiveCc);
-        }
-
-        public async Task<bool> DeleteAsync(Query query)
-        {
-            return await _repository.DeleteAsync(query) > 0;
-        }
-
-        public async Task<bool> UpdateAsync(Query query)
-        {
-            return await _repository.UpdateAsync(query) > 0;
-        }
-
-        public async Task<IEnumerable<MissiveCc>> GetAllAsync(Query query)
-        {
-            return await _repository.GetAllAsync(query);
-        }
-    }
-}

+ 0 - 174
gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeFolderRepository.cs

@@ -1,174 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Transactions;
-using AutoMapper;
-using GxPress.Common.AppOptions;
-using GxPress.Common.Exceptions;
-using GxPress.Common.Tools;
-using GxPress.Entity;
-using GxPress.Repository.Interface;
-using GxPress.Request.NoticeFolder;
-using GxPress.Result.NoticeFolder;
-using Microsoft.Extensions.Options;
-using Datory;
-
-namespace GxPress.Repository.Implement
-{
-    public class NoticeFolderRepository : INoticeFolderRepository
-    {
-        private readonly Repository<NoticeFolder> _repository;
-        private readonly Repository<User> _userRepository;
-        private readonly Repository<NoticeAddressee> _noticeAddresseeRepository;
-        private readonly Repository<Notice> _noticeRepository;
-        private readonly IMapper _mapper;
-
-        public NoticeFolderRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
-        {
-            var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
-            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
-            _repository = new Repository<NoticeFolder>(database);
-            _userRepository = new Repository<User>(database);
-            _noticeAddresseeRepository = new Repository<NoticeAddressee>(database);
-            _noticeRepository = new Repository<Notice>(database);
-            _mapper = mapper;
-        }
-
-        public IDatabase Database => _repository.Database;
-        public string TableName => _repository.TableName;
-        public List<TableColumn> TableColumns => _repository.TableColumns;
-
-        /// <summary>
-        /// 添加文件夹
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<bool> InsertAsync(NoticeFolderInRequest request)
-        {
-            if (string.IsNullOrEmpty(request.FolderName))
-            {
-                throw new BusinessException("文件夹名称不能为空");
-            }
-
-            var user = await _userRepository.GetAsync(request.UserId);
-            if (user == null)
-                throw new BusinessException("用户不存在");
-            var noticeFolder = new NoticeFolder
-            {
-                FolderName = request.FolderName, ParentId = request.ParentId, UserId = request.UserId,IsTop = false
-            };
-            return await _repository.InsertAsync(noticeFolder) > 0;
-        }
-
-        /// <summary>
-        /// 删除文件夹
-        /// </summary>
-        /// <param name="id"></param>
-        /// <returns></returns>
-        public async Task<bool> DeleteAsync(int id)
-        {
-            try
-            {
-                //获取文件夹下面的所有通知
-                using (TransactionScope transactionScope = new TransactionScope())
-                {
-
-                    //修改收件人
-                    await _noticeAddresseeRepository.UpdateAsync(Q.Set(nameof(NoticeAddressee.NoticeFolderId), 0)
-                        .Where(nameof(NoticeAddressee.NoticeFolderId), id));
-                    //主通知
-                    await _noticeRepository.UpdateAsync(Q.Set(nameof(Notice.NoticeFolderId), 0)
-                        .Where(nameof(NoticeAddressee.NoticeFolderId), id));
-                    await _repository.DeleteAsync(id);
-                    transactionScope.Complete();
-                }
-            }
-            catch (Exception e)
-            {
-                throw new BusinessException(e.Message);
-            }
-
-            return true;
-
-        }
-
-        /// <summary>
-        /// 修改文件夹
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<bool> UpdateAsync(NoticeFolderUpRequest request)
-        {
-            var noticeFolder = await _repository.GetAsync(request.NoticeFolderId);
-            if (noticeFolder == null)
-                throw new BusinessException("文件夹不存在");
-            noticeFolder.FolderName = request.FolderName;
-            return await _repository.UpdateAsync(noticeFolder);
-        }
-
-        /// <summary>
-        /// 文件夹中添加通知
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<bool> InsertNoticeAsync(NoticeFolderInNoticeRequest request)
-        {
-            var noticeAddressee = await _noticeAddresseeRepository.GetAsync(request.NoticeAddresseeId);
-            noticeAddressee.NoticeFolderId = request.NoticeFolderId;
-            return await _noticeAddresseeRepository.UpdateAsync(noticeAddressee);
-        }
-
-        /// <summary>
-        /// 文件夹移除通知
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<bool> NoticeFolderDeleteNoticeAsync(NoticeFolderDeleteNoticeRequest request)
-        {
-            var noticeAddressee = await _noticeAddresseeRepository.GetAsync(request.NoticeAddresseeId);
-            noticeAddressee.NoticeFolderId = 0;
-            return await _noticeAddresseeRepository.UpdateAsync(noticeAddressee);
-        }
-        /// <summary>
-        /// 是否置顶文件夹
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<bool> SetNoticeFolderIsTopAsync(NoticeFolderFindRequest request)
-        {
-            var noticeFolder = await _repository.GetAsync(request.NoticeFolderId);
-            noticeFolder.IsTop = !noticeFolder.IsTop;
-            return await _repository.UpdateAsync(noticeFolder);
-        }
-
-        /// <summary>
-        /// 根据用户ID获取文件夹
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<IEnumerable<NoticeFolderFindResult>> GetNoticeFolderByUserIdAsync(
-            NoticeFolderFindRequest request)
-        {
-            //获取通知文件夹
-            var noticeFolders = await _repository.GetAllAsync(Q.Where(nameof(NoticeFolder.UserId), request.UserId)
-                .Where(nameof(NoticeFolder.ParentId), request.NoticeFolderId).OrderByDesc(nameof(NoticeFolder.IsTop),nameof(NoticeFolder.LastModifiedDate)));
-            var noticeFolderFindResults = noticeFolders.Select(n => _mapper.Map<NoticeFolderFindResult>(n)).ToList();
-            //获取文件夹通知数量
-            foreach (var noticeFolderFindResult in noticeFolderFindResults)
-            {
-                //获取文件夹通知数量
-                var noticeCount =
-                    await _repository.CountAsync(
-                        Q.Where(nameof(NoticeFolder.ParentId), noticeFolderFindResult.Id));
-                //
-                var noticeAddresseeCount =
-                    await _noticeAddresseeRepository.CountAsync(
-                        Q.Where(nameof(NoticeAddressee.NoticeFolderId), noticeFolderFindResult.Id).Where(nameof(NoticeAddressee.IsDelete),false));
-                noticeFolderFindResult.FileCount = noticeCount + noticeAddresseeCount;
-            }
-
-            return noticeFolderFindResults;
-        }
-    }
-}

+ 21 - 24
gx_api/GxPress/Repository/GxPress.Repository.Implement/NoticeRepository.cs

@@ -25,10 +25,9 @@ namespace GxPress.Repository.Implement
     public class NoticeRepository : INoticeRepository
     {
         private readonly Repository<Notice> _repository;
-        private readonly Repository<NoticeAddressee> _noticeAddresseeRepository;
-        private readonly Repository<NoticeCc> _noticeCcRepository;
+        private readonly Repository<Addressee> _noticeAddresseeRepository;
+        private readonly Repository<Cc> _noticeCcRepository;
         private readonly Repository<User> _userRepository;
-        private readonly Repository<NoticeAnalyze> _noticeAnalyzeRepository;
         private readonly Repository<Middle> _middleRepository;
         private readonly Repository<Entity.AdminVerify> _adminVerifyRepository;
         private readonly IMapper _mapper;
@@ -42,10 +41,9 @@ namespace GxPress.Repository.Implement
                 StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
             var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
             _repository = new Repository<Notice>(database);
-            _noticeAddresseeRepository = new Repository<NoticeAddressee>(database);
-            _noticeCcRepository = new Repository<NoticeCc>(database);
+            _noticeAddresseeRepository = new Repository<Addressee>(database);
+            _noticeCcRepository = new Repository<Cc>(database);
             _userRepository = new Repository<User>(database);
-            _noticeAnalyzeRepository = new Repository<NoticeAnalyze>(database);
             _middleRepository = new Repository<Middle>(database);
             _adminVerifyRepository = new Repository<Entity.AdminVerify>(database);
             _mapper = mapper;
@@ -89,7 +87,6 @@ namespace GxPress.Repository.Implement
                         UserName = userEntity.Name,
                         HtmlContent = request.HtmlContent,
                         SourceId = request.SoureId,
-                        NoticeFolderId = request.FolderId,
                         IsDelete = false,
                         IsTop = true
                     };
@@ -115,27 +112,27 @@ namespace GxPress.Repository.Implement
             var query = Q.NewQuery();
             if (request.UserId > 0)
             {
-                query.Where(nameof(NoticeAddressee.UserId), request.UserId);
+                query.Where(nameof(Addressee.UserId), request.UserId);
             }
 
             if (request.SearchType == 0)
             {
-                query.Where(nameof(NoticeAddressee.UserId), request.UserId);
+                query.Where(nameof(Addressee.UserId), request.UserId);
             }
 
             if (request.SearchType == 1)
             {
-                query.Where(nameof(NoticeAddressee.IsAdmin), true);
+                query.Where(nameof(Addressee.IsAdmin), true);
             }
 
             if (request.SearchType == 2)
             {
-                query.Where(nameof(NoticeAddressee.NoticeAddresseeType), NoticeTypeConst.Draft);
+                query.Where(nameof(Addressee.NoticeAddresseeType), NoticeTypeConst.Draft);
             }
 
             if (request.SearchType == 3)
             {
-                query.Where(nameof(NoticeAddressee.IsDelete), true);
+                query.Where(nameof(Addressee.IsDelete), true);
             }
 
             if (!string.IsNullOrEmpty(request.Keyword))
@@ -189,12 +186,12 @@ namespace GxPress.Repository.Implement
 
                 //阅读数量
                 noticeListPageResultEntity.ReadCount = await _noticeAddresseeRepository.CountAsync(
-                    Q.Where(nameof(NoticeAddressee.NoticeId), notice.Id)
-                        .Where(nameof(NoticeAddressee.IsRead), true).Where(nameof(NoticeAddressee.IsAdmin), false));
+                    Q.Where(nameof(Addressee.SourceId), notice.Id)
+                        .Where(nameof(Addressee.IsRead), true).Where(nameof(Addressee.IsAdmin), false));
                 //收件人数量
                 noticeListPageResultEntity.AllCount = await _noticeAddresseeRepository.CountAsync(
-                    Q.Where(nameof(NoticeAddressee.NoticeId), notice.Id)
-                        .Where(nameof(NoticeAddressee.IsAdmin), false));
+                    Q.Where(nameof(Addressee.SourceId), notice.Id)
+                        .Where(nameof(Addressee.IsAdmin), false));
                 noticeListPageResults.Add(noticeListPageResultEntity);
             }
 
@@ -222,9 +219,9 @@ namespace GxPress.Repository.Implement
                     //通知
                     await _repository.DeleteAsync(id);
                     //抄送
-                    await _noticeCcRepository.DeleteAsync(Q.Where(nameof(NoticeCc.NoticeId), id));
+                    await _noticeCcRepository.DeleteAsync(Q.Where(nameof(Cc.SourceId), id));
                     //收件人
-                    await _noticeAddresseeRepository.DeleteAsync(Q.Where(nameof(NoticeAddressee.NoticeId), id));
+                    await _noticeAddresseeRepository.DeleteAsync(Q.Where(nameof(Addressee.SourceId), id));
                     transactionScope.Complete();
                 }
             }
@@ -253,8 +250,8 @@ namespace GxPress.Repository.Implement
                     //notice.IsDelete = true; 
                     //await _repository.UpdateAsync(notice);
                     //
-                    await _noticeAddresseeRepository.UpdateAsync(Q.Set(nameof(NoticeAddressee.IsDelete), true)
-                        .WhereIn(nameof(NoticeAddressee.Id), request.MiddleIds));
+                    await _noticeAddresseeRepository.UpdateAsync(Q.Set(nameof(Addressee.IsDelete), true)
+                        .WhereIn(nameof(Addressee.Id), request.MiddleIds));
                     transactionScope.Complete();
                 }
 
@@ -279,8 +276,8 @@ namespace GxPress.Repository.Implement
                 using (TransactionScope transactionScope = new TransactionScope())
                 {
                     //
-                    await _noticeAddresseeRepository.UpdateAsync(Q.Set(nameof(NoticeAddressee.IsDelete), false)
-                        .Where(nameof(NoticeAddressee.Id), request.MiddleIds));
+                    await _noticeAddresseeRepository.UpdateAsync(Q.Set(nameof(Addressee.IsDelete), false)
+                        .Where(nameof(Addressee.Id), request.MiddleIds));
                     transactionScope.Complete();
                 }
 
@@ -475,7 +472,7 @@ namespace GxPress.Repository.Implement
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
             var items = await connection
-                .QueryAsync<NoticeListPageResult, Notice, User, NoticeAddressee, NoticeListPageResult>(sql,
+                .QueryAsync<NoticeListPageResult, Notice, User, Addressee, NoticeListPageResult>(sql,
                     (noticeListPageResult, notice, user, noticeAddressee) =>
                     {
                         noticeListPageResult.Title = notice != null ? notice.Title : "";
@@ -484,7 +481,7 @@ namespace GxPress.Repository.Implement
                         noticeListPageResult.SourceId = notice != null ? notice.SourceId : 0;
                         noticeListPageResult.AvatarUrl = user != null ? StringUtils.AddDomainMin(user.AvatarUrl) : "";
                         noticeListPageResult.NoticeAddresseeId = noticeAddressee?.Id ?? 0;
-                        noticeListPageResult.NoticeId = noticeAddressee?.NoticeId ?? 0;
+                        noticeListPageResult.NoticeId = noticeAddressee?.SourceId ?? 0;
                         return noticeListPageResult;
                     },
                     splitOn: "Id,Name,Id");

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/OftenContactRepository.cs

@@ -247,7 +247,7 @@ namespace GxPress.Repository.Implement
         {
             if (oftenContacts.Count == 0 || oftenContacts == null)
                 return false;
-            string sql = @"INSERT INTO `ccpph`.`tede_often_contact`(`Guid`,`CreatedDate`,`LastModifiedDate`,`UserId`,`ContactUserId`,`IndividualGroupId`,`UpdateTime`,`ChatType`,`IsBlack`,`IsTop`,`IsDelete`)VALUES";
+            string sql = @"INSERT INTO `tede_often_contact`(`Guid`,`CreatedDate`,`LastModifiedDate`,`UserId`,`ContactUserId`,`IndividualGroupId`,`UpdateTime`,`ChatType`,`IsBlack`,`IsTop`,`IsDelete`)VALUES";
             foreach (var item in oftenContacts)
             {
                 var guId = Guid.NewGuid().ToString();

+ 0 - 139
gx_api/GxPress/Repository/GxPress.Repository.Implement/Topic/TopicAnalyzeRepository.cs

@@ -1,139 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using AutoMapper;
-using GxPress.Common.AppOptions;
-using GxPress.Common.Exceptions;
-using GxPress.Common.Page;
-using GxPress.Common.Tools;
-using GxPress.Entity;
-using GxPress.Entity.Topic;
-using GxPress.Repository.Interface;
-using GxPress.Request.App.TopicAnalyze;
-using GxPress.Result.App.Topic;
-using Microsoft.Extensions.Options;
-using Datory;
-using SqlKata;
-
-namespace GxPress.Repository.Implement
-{
-    public class TopicAnalyzeRepository: ITopicAnalyzeRepository
-    {
-        private readonly Repository<TopicAnalyze> _repository;
-        private readonly Repository<User> _userRepository;
-        private readonly Repository<TopicComment> _topicCommentRepository;
-        private readonly Repository<Entity.Topic.Topic> _topicRepository;
-        private readonly Repository<Department> _departmentRepository;
-        private readonly IMapper _mapper;
-
-        public TopicAnalyzeRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
-        {
-            var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
-            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
-            _repository = new Repository<TopicAnalyze>(database);
-            _userRepository = new Repository<User>(database);
-            _topicCommentRepository = new Repository<TopicComment>(database);
-            _topicRepository = new Repository<Entity.Topic.Topic>(database);
-            _departmentRepository=new Repository<Department>(database);
-            _mapper = mapper;
-        }
-
-        public IDatabase Database => _repository.Database;
-        public string TableName => _repository.TableName;
-        public List<TableColumn> TableColumns => _repository.TableColumns;
-
-        /// <summary>
-        /// 设置 点赞 转发 收藏
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<bool> SetTopicAnalyzeAsync(TopicAnalyzeRequest request)
-        {
-            var user = await _userRepository.GetAsync(request.UserId);
-            if (user == null) throw new BusinessException("不存在该账号");
-            var topicAnalyze = await _repository.GetAsync(Q.Where(nameof(TopicAnalyze.AnalyzeType), request.TopicAnalyzeType)
-                .Where(nameof(TopicAnalyze.TopicId), request.TopicId).Where(nameof(TopicAnalyze.TopicCommentId),request.TopicCommentId)
-                .Where(nameof(TopicAnalyze.UserId), request.UserId));
-            if (topicAnalyze != null && topicAnalyze.Id > 0)
-                //throw new BusinessException("你已经点赞过了~!");
-                return await _repository.DeleteAsync(topicAnalyze.Id);
-            //查询该用户是否已经点赞过
-            if (request.TopicAnalyzeType == 2)
-            {
-                if(request.TopicCommentId==0)
-                   throw new BusinessException("评论Id必传!");
-                //没有点赞则新增数据点赞条数
-                var comment = await _topicCommentRepository.GetAsync(request.TopicCommentId);
-                comment.Laud++;
-                await _topicCommentRepository.UpdateAsync(comment);
-            }
-            return await InsertAsync(request);
-        }
-
-        /// <summary>
-        /// 添加
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<bool> InsertAsync(TopicAnalyzeRequest request)
-        {
-            var topicAnalyze = new TopicAnalyze()
-            {
-                AnalyzeType = request.TopicAnalyzeType,
-                TopicId = request.TopicId,
-                TopicCommentId = request.TopicCommentId,
-                UserId = request.UserId
-            };
-            return await _repository.InsertAsync(topicAnalyze) > 0;
-        }
-        /// <summary>
-        /// 获取文章点赞数据
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<PagedList<TopicPraisePageResult>> GetTopicPraisePageAsync(TopicPraisePageSearchRequest request)
-        {
-            var query = Q.NewQuery();
-            query.Where(nameof(TopicAnalyze.AnalyzeType), 1).Where(nameof(TopicAnalyze.TopicId), request.TopicId);
-              if(request.Sort=="desc")
-                query.OrderByDesc(nameof(TopicAnalyze.CreatedDate));
-            var pagedList = new PagedList<TopicPraisePageResult>
-            {
-                Total = await _repository.CountAsync(query)
-            };
-            var list = await _repository.GetAllAsync(query.ForPage(request.Page, request.PerPage));
-            var items = list.Select(user => _mapper.Map<TopicPraisePageResult>(user)).ToList();
-            //获取文章名称
-            var topic = await _topicRepository.GetAsync(request.TopicId);
-            foreach (var item in items)
-            {
-                //获取用户
-                var user = await _userRepository.GetAsync(item.UserId);
-                item.TopicName = topic.Title;
-                item.UserName = user.Name;
-                item.Signature = user.Signature;
-                item.AvatarUrl =StringUtils.AddDomain(user.AvatarUrl);
-                //获取部门
-                var department = await _departmentRepository.GetAsync(user.DepartmentId);
-                item.DepartmentName = department != null ? department.Name : "";
-            }
-            pagedList.Items = items;
-            return pagedList;
-        }
-
-        public async Task<int> CountAsync(Query query)
-        {
-            return await _repository.CountAsync(query);
-        }
-
-        public async Task<TopicAnalyze> GetAsync(Query query)
-        {
-            return await _repository.GetAsync(query);
-        }
-
-        public async Task<bool> DeleteAsync(int id)
-        {
-            return await _repository.DeleteAsync(id);
-        }
-    }
-}

+ 0 - 256
gx_api/GxPress/Repository/GxPress.Repository.Implement/Topic/TopicCommentRepository.cs

@@ -1,256 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using AutoMapper;
-using GxPress.Common.AppOptions;
-using GxPress.Common.Exceptions;
-using GxPress.Common.Page;
-using GxPress.Common.Tools;
-using GxPress.Entity;
-using GxPress.Entity.Topic;
-using GxPress.Repository.Interface;
-using GxPress.Request.App.TopicComment;
-using GxPress.Result.App.TopicComment;
-using Microsoft.Extensions.Options;
-using Datory;
-using SqlKata;
-
-namespace GxPress.Repository.Implement
-{
-    public class TopicCommentRepository : ITopicCommentRepository
-    {
-        private readonly Repository<TopicComment> _repository;
-        private readonly Repository<TopicAnalyze> _topicAnalyzeRepository;
-        private readonly Repository<Entity.Topic.Topic> _topicRepository;
-        private readonly Repository<User> _userRepository;
-        private readonly IMapper _mapper;
-
-        public TopicCommentRepository(IOptionsMonitor<DatabaseOptions> dbOptionsAccessor, IMapper mapper)
-        {
-            var databaseType = StringUtils.ToEnum<DatabaseType>(dbOptionsAccessor.CurrentValue.DatabaseType, DatabaseType.MySql);
-            var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
-            _repository = new Repository<TopicComment>(database);
-            _topicRepository = new Repository<Entity.Topic.Topic>(database);
-            _userRepository = new Repository<User>(database);
-            _topicAnalyzeRepository = new Repository<TopicAnalyze>(database);
-            _mapper = mapper;
-        }
-
-        public IDatabase Database => _repository.Database;
-        public string TableName => _repository.TableName;
-        public List<TableColumn> TableColumns => _repository.TableColumns;
-        /// <summary>
-        /// 添加话题评论
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<int> TopicCommentInAsync(TopicCommentInRequest request)
-        {
-            //查询文章是否存在
-            var article = _topicRepository.ExistsAsync(Q.Where(nameof(Entity.Topic.Topic.Id), request.TopicId));
-            if (await article == false)
-                throw new BusinessException("该话题不存在");
-            //查询用户
-            var user = _userRepository.ExistsAsync(Q.Where(nameof(User.Id), request.UserId));
-            if (await user == false)
-                throw new BusinessException("该用户不存在");
-            var topicComment = new TopicComment
-            {
-                TopicId = request.TopicId,
-                Content = request.Content,
-                UserId = request.UserId,
-                Pid = request.Pid
-            };
-            //是否被回复
-            if (request.Pid > 0)
-            {
-                //查询他的上级pid=0
-                var commentEntity = await _repository.GetAsync(request.Pid);
-                if (commentEntity.Pid > 0)
-                {
-                    topicComment.IsUnderstand = true;
-                }
-            }
-
-            return await _repository.InsertAsync(topicComment);
-        }
-        /// <summary>
-        /// 分页列表
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<PagedList<TopicCommentPageResult>> GetPagedList(TopicCommentSearchPageRequest request)
-        {
-            var pagedList = new PagedList<TopicCommentPageResult>
-            {
-                Total = await GetCountAsync(request.TopicId)
-            };
-            request.Total=pagedList.Total;
-            var list = await GetPageListAsync(request);
-            pagedList.Items = list;
-            return pagedList;
-        }
-        /// <summary>
-        /// 总页数
-        /// </summary>
-        /// <param name="topicId"></param>
-        /// <returns></returns>
-        public async Task<int> GetCountAsync(int topicId)
-        {
-            return await _repository.CountAsync(Q.Where(nameof(TopicComment.TopicId), topicId)
-                .Where(nameof(Comment.Pid), 0));
-        }
-        /// <summary>
-        /// 获取分页数据
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<IEnumerable<TopicCommentPageResult>> GetPageListAsync(TopicCommentSearchPageRequest request)
-        {
-            List<TopicCommentPageResult> commentPageResults = new List<TopicCommentPageResult>();
-            var query = new SqlKata.Query();
-            query.Where(nameof(TopicComment.TopicId), request.TopicId).Where(nameof(TopicComment.Pid), 0);
-            if (string.IsNullOrEmpty(request.Sort))
-                query.OrderByDesc(nameof(TopicComment.CreatedDate));
-            if (!string.IsNullOrEmpty(request.Sort) && request.Sort == "asc")
-                query.OrderBy(nameof(TopicComment.CreatedDate));
-            if (!string.IsNullOrEmpty(request.Sort) && request.Sort == "desc")
-                query.OrderByDesc(nameof(TopicComment.CreatedDate));
-            var commentList = await _repository.GetAllAsync(query.ForPage(request.Page, request.PerPage));
-            var i = 1;
-            foreach (var item in commentList)
-            {
-                //获取当前用户信息
-                var user = _userRepository.GetAsync(item.UserId).Result;
-                TopicCommentPageResult commentPageResult = new TopicCommentPageResult
-                {
-                    TopicId = item.TopicId,
-                    AvatarUrl = StringUtils.AddDomainMin(user.AvatarUrl),
-                    Name = user.Name,
-                    Content = item.Content,
-                    CreatedTime = item.CreatedDate,
-                    LaudCount = item.Laud,
-                    UserId = item.UserId,
-                    //是否点赞
-                    IsLaud = await IsLaudCommentAsync(item.Id, item.UserId)
-                };
-                if (request.Sort == "asc")
-                    commentPageResult.FloorCount = $"第{((request.Page - 1) * request.PerPage) + i}楼";
-                else
-                    commentPageResult.FloorCount = $"第{((request.Total - (request.Page - 1) * request.PerPage) - (i - 1))}楼";
-                //计算点赞数量
-                //计算被回复数据
-                List<TopicCommentReplyResult> commentReplyResults = new List<TopicCommentReplyResult>();
-                commentPageResult.TopicCommentReplyResults = await GetTopicCommentReplyResultByPid(item.Id, commentReplyResults);
-                commentPageResult.Id = item.Id;
-                commentPageResults.Add(commentPageResult);
-                i++;
-            }
-
-            return commentPageResults;
-        }
-        /// <summary>
-        /// 当前用户是否点赞该评论
-        /// </summary>
-        /// <param name="commentId"></param>
-        /// <param name="userId"></param>
-        /// <returns></returns>
-
-        public async Task<bool> IsLaudCommentAsync(int commentId, int userId)
-        {
-            return await _topicAnalyzeRepository.CountAsync(Q.Where(nameof(TopicAnalyze.TopicCommentId), commentId)
-                       .Where(nameof(TopicAnalyze.UserId), userId).Where(nameof(TopicAnalyze.AnalyzeType), 2)) > 0;
-        }
-
-        /// <summary>
-        /// 递归查询父级下面的所有回复
-        /// </summary>
-        public async Task<List<TopicCommentReplyResult>> GetTopicCommentReplyResultByPid(int pid,
-            List<TopicCommentReplyResult> topicCommentReplyResults)
-        {
-            var result = _repository.GetAllAsync(Q.Where(nameof(TopicComment.Pid), pid)).Result.ToList();
-            if (result.Count == 0)
-                return topicCommentReplyResults;
-            foreach (var item in result)
-            {
-                TopicCommentReplyResult topicCommentReplyResult = new TopicCommentReplyResult
-                {
-                    Id = item.Id,
-                    Content = item.Content,
-                    CreatedTime = item.CreatedDate
-                };
-                var user = _userRepository.GetAsync(item.UserId).Result;
-                topicCommentReplyResult.Name = user.Name;
-                if (item.IsUnderstand)
-                {
-                    var comment = _repository.GetAsync(Q.Where(nameof(Comment.Id), item.Pid)).Result;
-                    user = _userRepository.GetAsync(comment.UserId).Result;
-                    topicCommentReplyResult.ReplyName = user.Name;
-                    topicCommentReplyResult.ReplyUserId=user.Id;
-                }
-
-                topicCommentReplyResult.IsUnderstand = item.IsUnderstand;
-                topicCommentReplyResult.UserId = item.UserId;
-                topicCommentReplyResults.Add(topicCommentReplyResult);
-                topicCommentReplyResults = await GetTopicCommentReplyResultByPid(item.Id, topicCommentReplyResults);
-
-            }
-
-            return topicCommentReplyResults;
-        }
-
-
-        /// <summary>
-        /// 删除评论
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<bool> DeleteTopicCommentAsync(TopicCommentDeleteRequest request)
-        {
-            //查询评论数据
-            var topicCommentEntity = _repository.GetAsync(Q.Where(nameof(TopicComment.TopicId), request.TopicId)
-                .Where(nameof(TopicComment.Id), request.CommentId)).Result;
-            if (topicCommentEntity.Id == 0)
-                throw new BusinessException("该评论不存在!");
-            //递归删除
-            var commentList = new List<TopicComment> { topicCommentEntity };
-            commentList = await GetTopicCommentByParentId(topicCommentEntity.Id, commentList);
-            //删除
-            foreach (var item in commentList)
-            {
-                await _repository.DeleteAsync(item.Id);
-            }
-
-            return true;
-        }
-        /// <summary>
-        /// 递归删除
-        /// </summary>
-        /// <param name="id"></param>
-        /// <param name="lists"></param>
-        /// <returns></returns>
-        public async Task<List<TopicComment>> GetTopicCommentByParentId(int id, List<TopicComment> lists)
-        {
-            var topicComment = await _repository.GetAsync(Q.Where(nameof(TopicComment.Pid), id));
-            if (topicComment == null)
-                return lists;
-            lists.Add(topicComment);
-            await GetTopicCommentByParentId(topicComment.Id, lists);
-            return lists;
-        }
-        /// <summary>
-        /// 获取评论数量
-        /// </summary>
-        /// <param name="topicId"></param>
-        /// <returns></returns>
-        public async Task<int> GetTopicCommentCountAsync(int topicId)
-        {
-            return await _repository.CountAsync(Q.Where(nameof(TopicComment.TopicId), topicId));
-        }
-
-        public async Task<int> CountAsync(Query query)
-        {
-            return await _repository.CountAsync(query);
-        }
-    }
-}

+ 1 - 1
gx_api/GxPress/Repository/GxPress.Repository.Implement/TopicAddresseeRepository.cs

@@ -45,7 +45,7 @@ namespace GxPress.Repository.Implement
         /// <returns></returns>
         public async Task<bool> InsertAsync(IEnumerable<TopicAddressee> request)
         {
-            var sql = "INSERT INTO `ccpph`.`tede_topic_addressee`(`Guid`,`CreatedDate`,`LastModifiedDate`,`TopicId`,`UserId`,`UserName`,`IsRead`,`IsAdmin`,`IsUpload`)VALUES";
+            var sql = "INSERT INTO `tede_topic_addressee`(`Guid`,`CreatedDate`,`LastModifiedDate`,`TopicId`,`UserId`,`UserName`,`IsRead`,`IsAdmin`,`IsUpload`)VALUES";
             if (request.Count() == 0)
                 return true;
             foreach (var item in request)

+ 0 - 4
gx_api/GxPress/Repository/GxPress.Repository.Implement/TopicRepository.cs

@@ -23,9 +23,7 @@ namespace GxPress.Repository.Implement
     {
         private readonly Repository<Entity.Topic.Topic> _repository;
         private readonly Repository<TopicAddressee> _topicAddresseeRepository;
-        private readonly Repository<TopicComment> _topicCommentRepository;
         private readonly Repository<User> _userRepository;
-        private readonly Repository<TopicAnalyze> _topicAnalyzeRepository;
         private readonly IMapper _mapper;
         private readonly string _connectionString;
         private readonly string _databaseTypeStr;
@@ -39,9 +37,7 @@ namespace GxPress.Repository.Implement
             var database = new Database(databaseType, dbOptionsAccessor.CurrentValue.ConnectionString);
             _repository = new Repository<Entity.Topic.Topic>(database);
             _topicAddresseeRepository = new Repository<TopicAddressee>(database);
-            _topicCommentRepository = new Repository<TopicComment>(database);
             _userRepository = new Repository<User>(database);
-            _topicAnalyzeRepository = new Repository<TopicAnalyze>(database);
             _groupUserRepository = new Repository<GroupUser>(database);
             _visitRepository = new Repository<Entity.Visit.Visit>(database);
             _mapper = mapper;

+ 3 - 3
gx_api/GxPress/Repository/GxPress.Repository.Implement/WorkFlow/FlowTodoRepository.cs

@@ -692,7 +692,7 @@ namespace GxPress.Repository.Implement.WorkFlow
 
         public async Task<bool> UpdateSortAsync(FlowTodo todo)
         {
-            string sql = $"UPDATE `ccpph`.`tede_flow_todo` SET `Sort` = {todo.Sort} WHERE `Id` = {todo.Id}";
+            string sql = $"UPDATE `tede_flow_todo` SET `Sort` = {todo.Sort} WHERE `Id` = {todo.Id}";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
@@ -706,7 +706,7 @@ namespace GxPress.Repository.Implement.WorkFlow
 
         public async Task<bool> UpdateReadAsync(int userId, int flowId)
         {
-            string sql = $"UPDATE `ccpph`.`tede_flow_todo` SET `IsRead` = 1  WHERE `FlowId` = {flowId} and `UserId`={userId} ";
+            string sql = $"UPDATE `tede_flow_todo` SET `IsRead` = 1  WHERE `FlowId` = {flowId} and `UserId`={userId} ";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();
@@ -716,7 +716,7 @@ namespace GxPress.Repository.Implement.WorkFlow
 
         public async Task<bool> UpdateFlowReadAsync(int userId, int flowId)
         {
-            string sql = $"UPDATE `ccpph`.`tede_flow` SET `IsRead` = 1 WHERE `Id` = {flowId} and `UserId`={userId}";
+            string sql = $"UPDATE `tede_flow` SET `IsRead` = 1 WHERE `Id` = {flowId} and `UserId`={userId}";
             var databaseType = StringUtils.ToEnum<DatabaseType>(_databaseTypeStr, DatabaseType.MySql);
             var database = new Database(databaseType, _connectionString);
             var connection = database.GetConnection();

+ 10 - 6
gx_api/GxPress/Repository/GxPress.Repository.Interface/INoticeAddresseeRepository.cs

@@ -5,34 +5,36 @@ using Datory;
 using GxPress.Request.Notice;
 using GxPress.Result.Notice;
 using SqlKata;
+using GxPress.Result.App.Missive;
+using GxPress.Request.App.Missive;
 
 namespace GxPress.Repository.Interface
 {
     /// <summary>
     /// 收件人
     /// </summary>
-    public interface INoticeAddresseeRepository : IRepository
+    public interface IAddresseeRepository : IRepository
     {
         /// <summary>
         /// 根据通知ID获取抄送人
         /// </summary>
         /// <param name="noticeId"></param>
         /// <returns></returns>
-        Task<IEnumerable<NoticeAddressee>> GetNoticeAddresseeByNoticeIdAsync(int noticeId);
+        Task<IEnumerable<Addressee>> GetNoticeAddresseeByNoticeIdAsync(int noticeId);
 
-        Task<bool> DeleteAsync(int noticeId);
-        Task<int> InsertAsync(NoticeAddressee noticeAddressee);
+        Task<bool> DeleteAsync(int noticeId, int sourceType, int isAdmin);
+        Task<int> InsertAsync(Addressee noticeAddressee);
         /// <summary>
         /// 插入收件人
         /// </summary>
         /// <param name="noticeAddressees"></param>
         /// <returns></returns>
-        Task<bool> InsertAsync(List<NoticeAddressee> noticeAddressees);
+        Task<bool> InsertAsync(List<Addressee> noticeAddressees);
         Task<IEnumerable<NoticeReadListResult>> GetNoticeAddresseeByUserIdIdAsync(NoticeReadListRequest request);
 
         Task<int> CountAsync(SqlKata.Query query);
 
-        Task<IEnumerable<NoticeAddressee>> GetAllAsync(SqlKata.Query query);
+        Task<IEnumerable<Addressee>> GetAllAsync(SqlKata.Query query);
 
         Task<bool> UpdateAsync(SqlKata.Query query);
         /// <summary>
@@ -42,5 +44,7 @@ namespace GxPress.Repository.Interface
         /// <returns></returns>
         Task<IEnumerable<User>> GetUserByNoticeIdAsync(int noticeId);
         Task<bool> ExistsAsync(Query query);
+
+        Task<IEnumerable<MissiveReadListResult>> GetMissiveReadListAsync(MissiveReadListRequest request);
     }
 }

+ 5 - 7
gx_api/GxPress/Repository/GxPress.Repository.Interface/INoticeCcRepository.cs

@@ -1,6 +1,4 @@
-using System;
 using System.Collections.Generic;
-using System.Text;
 using System.Threading.Tasks;
 using GxPress.Entity;
 using Datory;
@@ -10,23 +8,23 @@ namespace GxPress.Repository.Interface
     /// <summary>
     /// 抄送人
     /// </summary>
-    public interface INoticeCcRepository : IRepository
+    public interface ICcRepository : IRepository
     {
         /// <summary>
         /// 根据通知ID获取抄送人
         /// </summary>
         /// <param name="noticeId"></param>
         /// <returns></returns>
-        Task<IEnumerable<NoticeCc>> GetNoticeCcByNoticeIdAsync(int noticeId);
+        Task<IEnumerable<Cc>> GetNoticeCcByNoticeIdAsync(int noticeId,int sourceType);
 
-        Task<bool> DeleteAsync(int noticeId);
+        Task<bool> DeleteAsync(int sourceId, int sourceType);
 
-        Task<int> InsertAsync(NoticeCc noticeCc);
+        Task<int> InsertAsync(Cc noticeCc);
          /// <summary>
         /// 添加通知抄送人
         /// </summary>
         /// <param name="noticeCcs"></param>
         /// <returns></returns>
-       Task<bool> InsertAsync(List<NoticeCc> noticeCcs);
+       Task<bool> InsertAsync(List<Cc> noticeCcs);
     }
 }

+ 4 - 1
gx_api/GxPress/Repository/GxPress.Repository.Interface/IMiddleRepository.cs

@@ -7,6 +7,7 @@ using GxPress.Request.Notice;
 using SqlKata;
 using Datory;
 using GxPress.Request.App.Middle;
+using GxPress.Request.Inbox;
 
 namespace GxPress.Repository.Interface
 {
@@ -32,7 +33,7 @@ namespace GxPress.Repository.Interface
         /// <param name="request"></param>
         /// <returns></returns>
         Task<bool> DeleteAsync(NoticeDeRequest request);
-
+        Task<bool> DeleteAsync(int middleId, int folderTypeId);
         /// <summary>
         /// 阅读
         /// </summary>
@@ -80,5 +81,7 @@ namespace GxPress.Repository.Interface
         /// <param name="id"></param>
         /// <returns></returns>
         Task<IEnumerable<Middle>> GetMiddleChildrenAsync(int id);
+
+        Task<IEnumerable<Middle>> FindAsync(InboxSearchRequest request);
     }
 }

+ 0 - 57
gx_api/GxPress/Repository/GxPress.Repository.Interface/INoticeFolderRepository.cs

@@ -1,57 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using GxPress.Entity;
-using GxPress.Request.NoticeFolder;
-using GxPress.Result.NoticeFolder;
-using Datory;
-
-namespace GxPress.Repository.Interface
-{
-    public interface INoticeFolderRepository : IRepository
-    {
-        /// <summary>
-        /// 创建通知文件夹
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        Task<bool> InsertAsync(NoticeFolderInRequest request);
-        /// <summary>
-        /// 删除通知文件夹
-        /// </summary>
-        /// <param name="id"></param>
-        /// <returns></returns>
-        Task<bool> DeleteAsync(int id);
-        /// <summary>
-        /// 修改通知文件夹
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        Task<bool> UpdateAsync(NoticeFolderUpRequest request);
-        /// <summary>
-        /// 插入通知文件夹
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        Task<bool> InsertNoticeAsync(NoticeFolderInNoticeRequest request);
-        /// <summary>
-        /// 文件夹移除通知
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        Task<bool> NoticeFolderDeleteNoticeAsync(NoticeFolderDeleteNoticeRequest request);
-        /// <summary>
-        /// 根据用户ID获取文件夹
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        Task<IEnumerable<NoticeFolderFindResult>> GetNoticeFolderByUserIdAsync(NoticeFolderFindRequest request);
-        /// <summary>
-        /// 设置文件夹置顶
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        Task<bool> SetNoticeFolderIsTopAsync(NoticeFolderFindRequest request);
-    }
-}

+ 0 - 26
gx_api/GxPress/Repository/GxPress.Repository.Interface/ITopicAnalyzeRepository.cs

@@ -1,26 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using GxPress.Common.Page;
-using GxPress.Request.App.TopicAnalyze;
-using GxPress.Request.NoticeAnalyze;
-using GxPress.Result.App.Topic;
-using GxPress.Result.Notice;
-using Datory;
-using GxPress.Entity.Topic;
-
-namespace GxPress.Repository.Interface
-{
-  public  interface ITopicAnalyzeRepository:IRepository
-    {
-        Task<bool> SetTopicAnalyzeAsync(TopicAnalyzeRequest request);
-        Task<PagedList<TopicPraisePageResult>> GetTopicPraisePageAsync(TopicPraisePageSearchRequest request);
-
-        Task<int> CountAsync(SqlKata.Query query);
-
-        Task<TopicAnalyze> GetAsync(SqlKata.Query query);
-
-        Task<bool> DeleteAsync(int id);
-    }
-}

+ 0 - 43
gx_api/GxPress/Repository/GxPress.Repository.Interface/ITopicCommentRepository.cs

@@ -1,43 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using GxPress.Common.Page;
-using GxPress.Request.App.TopicComment;
-using GxPress.Result.App.TopicComment;
-using Datory;
-
-namespace GxPress.Repository.Interface
-{
-    public interface ITopicCommentRepository : IRepository
-    {
-        /// <summary>
-        /// 添加文章评论
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        Task<int> TopicCommentInAsync(TopicCommentInRequest request);
-
-        Task<PagedList<TopicCommentPageResult>> GetPagedList(TopicCommentSearchPageRequest request);
-
-        Task<int> GetCountAsync(int articleId);
-
-        Task<IEnumerable<TopicCommentPageResult>> GetPageListAsync(TopicCommentSearchPageRequest request);
-
-        Task<List<TopicCommentReplyResult>> GetTopicCommentReplyResultByPid(int pid, List<TopicCommentReplyResult> TopicCommentReplyResults);
-        /// <summary>
-        /// 删除评论
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        Task<bool> DeleteTopicCommentAsync(TopicCommentDeleteRequest request);
-        /// <summary>
-        /// 获取文章的评论条数
-        /// </summary>
-        /// <param name="TopicId"></param>
-        /// <returns></returns>
-        Task<int> GetTopicCommentCountAsync(int TopicId);
-
-        Task<int> CountAsync(SqlKata.Query query);
-    }
-}

+ 0 - 40
gx_api/GxPress/Repository/GxPress.Repository.Interface/Missive/IMissiveAddresseeRepository.cs

@@ -1,40 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using Datory;
-using GxPress.Entity.Missive;
-using GxPress.Request.App.Missive;
-using GxPress.Result.App.Missive;
-
-namespace GxPress.Repository.Interface.Missive
-{
-    public interface IMissiveAddresseeRepository : IRepository
-    {
-        Task<int> InsertAsync(MissiveAddressee missiveAddressee);
-
-        Task<MissiveAddressee> GetAsync(int id);
-
-        Task<bool> UpdateAsync(MissiveAddressee missiveAddressee);
-
-        Task<bool> DeleteAsync(SqlKata.Query query);
-
-        Task<bool> UpdateAsync(SqlKata.Query query);
-
-
-        Task<IEnumerable<MissiveAddressee>> GetAllAsync(SqlKata.Query query);
-
-          /// <summary>
-        /// 获取站内信已读未读数据
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-       Task<IEnumerable<MissiveReadListResult>> GetMissiveReadListAsync(MissiveReadListRequest request);
-        /// <summary>
-        /// list 添加站内信收件人
-        /// </summary>
-        /// <param name="missiveAddressees"></param>
-        /// <returns></returns>
-        Task<bool> InsertAsync(List<MissiveAddressee> missiveAddressees);
-    }
-}

+ 0 - 42
gx_api/GxPress/Repository/GxPress.Repository.Interface/Missive/IMissiveAnalyzeRepository.cs

@@ -1,42 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using Datory;
-using GxPress.Entity.Missive;
-using GxPress.Request.App.Missive;
-using GxPress.Result.App.Missive;
-using SqlKata;
-
-namespace GxPress.Repository.Interface.Missive
-{
-    public interface IMissiveAnalyzeRepository : IRepository
-    {
-        Task<MissiveAnalyze> GetAsync(int id);
-
-        Task<MissiveAnalyze> GetAsync(SqlKata.Query query);
-        Task<bool> UpdateAsync(MissiveAnalyze missiveAnalyze);
-
-
-        Task<bool> DeleteAsync(Query query);
-
-
-        Task<bool> UpdateAsync(Query query);
-
-
-        Task<IEnumerable<MissiveAnalyze>> GetAllAsync(Query query);
-
-        Task<int> GetCount(Query query);
-
-        /// <summary>
-        /// 设置 点赞 转发 收藏
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        Task<bool> SetMissiveAnalyzeAsync(MissiveAnalyzeRequest request);
-
-        Task<int> CountAsync(SqlKata.Query query);
-
-       
-    }
-}

+ 0 - 36
gx_api/GxPress/Repository/GxPress.Repository.Interface/Missive/IMissiveCcRepository.cs

@@ -1,36 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-using System.Threading.Tasks;
-using Datory;
-using GxPress.Entity.Missive;
-using SqlKata;
-
-namespace GxPress.Repository.Interface.Missive
-{
-    public interface IMissiveCcRepository : IRepository
-    {
-        Task<int> InsertAsync(MissiveCc missiveCc);
-
-
-        Task<MissiveCc> GetAsync(int id);
-
-
-        Task<bool> UpdateAsync(MissiveCc missiveCc);
-
-
-        Task<bool> DeleteAsync(Query query);
-
-
-        Task<bool> UpdateAsync(Query query);
-
-
-        Task<IEnumerable<MissiveCc>> GetAllAsync(Query query);
-        /// <summary>
-        /// list 添加站内信抄送人
-        /// </summary>
-        /// <param name="missiveCcs"></param>
-        /// <returns></returns>
-        Task<bool> InsertAsync(List<MissiveCc> missiveCcs);
-    }
-}

+ 2 - 7
gx_api/GxPress/Service/GxPress.Service.Implement/Collection/CollectionService.cs

@@ -33,14 +33,12 @@ namespace GxPress.Service.Implement.Collection
         private readonly IMiddleService _middleService;
         private readonly IArticleRepository _articleRepository;
         private readonly ITopicRepository _topicRepository;
-        private readonly ITopicAnalyzeRepository _topicAnalyzeRepository;
         private readonly IMiddleRepository _middleRepository;
         private readonly INoteRepository _noteRepository;
         private readonly IUserRepository _userRepository;
         private readonly IArticleService _articleService;
         private readonly INoticeRepository _noticeRepository;
         private readonly IMissiveRepository _missiveRepository;
-        private readonly IMissiveAnalyzeRepository _missiveAnalyzeRepository;
         private readonly IGroupRepository _groupRepository;
         private readonly IMeetingSummaryRepository _meetingSummaryRepository;
         private readonly IMapper _mapper;
@@ -50,9 +48,8 @@ namespace GxPress.Service.Implement.Collection
         private readonly IUserMiddleService _userMiddleService;
         public CollectionService(ICollectionRepository collectionRepository, IMiddleService middleService,
             IArticleRepository articleRepository, ITopicRepository topicRepository, IMiddleRepository middleRepository,
-            INoteRepository noteRepository, IUserRepository userRepository, IArticleService articleService,
-            ITopicAnalyzeRepository topicAnalyzeRepository, INoticeRepository noticeRepository,
-            IMissiveRepository missiveRepository, IMissiveAnalyzeRepository missiveAnalyzeRepository, IMapper mapper,
+            INoteRepository noteRepository, IUserRepository userRepository, IArticleService articleService, INoticeRepository noticeRepository,
+            IMissiveRepository missiveRepository,  IMapper mapper,
             IGroupRepository groupRepository, IMeetingSummaryRepository meetingSummaryRepository, IFolderUserRepository folderUserRepository, IAnalyzeService analyzeService, IFileLibraryRepository fileLibraryRepository, IUserMiddleService userMiddleService)
         {
             _collectionRepository = collectionRepository;
@@ -63,9 +60,7 @@ namespace GxPress.Service.Implement.Collection
             _noteRepository = noteRepository;
             _userRepository = userRepository;
             _articleService = articleService;
-            _topicAnalyzeRepository = topicAnalyzeRepository;
             _noticeRepository = noticeRepository;
-            _missiveAnalyzeRepository = missiveAnalyzeRepository;
             _missiveRepository = missiveRepository;
             _mapper = mapper;
             _groupRepository = groupRepository;

+ 53 - 0
gx_api/GxPress/Service/GxPress.Service.Implement/ContentJson/ContentJsonService.cs

@@ -0,0 +1,53 @@
+using System.Collections.Generic;
+using System.Linq;
+using GxPress.EnumConst;
+using GxPress.Result;
+using GxPress.Service.Interface.ContentJson;
+using Newtonsoft.Json;
+
+namespace GxPress.Service.Implement.ContentJson
+{
+    public class ContentJsonService : IContentJsonService
+    {
+        public string GetTitile(string title, string content)
+        {
+            if (string.IsNullOrWhiteSpace(title))
+            {
+                var data = JsonConvert.DeserializeObject<List<ContentJsonData>>(content);
+                if (data.Count > 0)
+                {
+                    var first = data.First();
+                    if (first.TypeValue == OldTextEditorTypeConst.Text.GetHashCode() && !string.IsNullOrWhiteSpace(first.Text))
+                        title = first.Text;
+                    else
+                    {
+                        foreach (var contentJsonData in data)
+                        {
+                            //是否是文本
+                            if (contentJsonData.TypeValue == OldTextEditorTypeConst.Text.GetHashCode())
+                                continue;
+                            else if (contentJsonData.TypeValue == OldTextEditorTypeConst.Image.GetHashCode())
+                            {
+                                title = "[图片]";
+                                break;
+                            }
+                            else if (contentJsonData.TypeValue == OldTextEditorTypeConst.File.GetHashCode())
+                            {
+                                title = "[附件]";
+                                break;
+                            }
+                            else
+                            {
+                                title = "[附件]";
+                                break;
+                            }
+                        }
+                    }
+                }
+            }
+            if (title.Length > 50)
+                title = title.Remove(50, title.Length - 50);
+            return title;
+        }
+    }
+}

+ 12 - 2
gx_api/GxPress/Service/GxPress.Service.Implement/Flow/FlowService.Nodes.cs

@@ -308,7 +308,12 @@ namespace GxPress.Service.Implement
 
 
         }
-
+        /// <summary>
+        /// 抄送人
+        /// </summary>
+        /// <param name="userIdList"></param>
+        /// <param name="flow"></param>
+        /// <returns></returns>
         private async Task TaskCarbonCopyAsync(IEnumerable<int> userIdList, FlowDto flow)
         {
             foreach (var userId in userIdList)
@@ -326,7 +331,12 @@ namespace GxPress.Service.Implement
                 await _flowTodoRepository.InsertAsync(todo);
             }
         }
-
+        /// <summary>
+        /// 审核人
+        /// </summary>
+        /// <param name="userIdList"></param>
+        /// <param name="flow"></param>
+        /// <returns></returns>
         private async Task TaskApproverCheckAsync(IEnumerable<int> userIdList, FlowDto flow)
         {
             foreach (var userId in userIdList)

+ 15 - 11
gx_api/GxPress/Service/GxPress.Service.Implement/Middle/MiddleService.cs

@@ -35,14 +35,12 @@ namespace GxPress.Service.Implement.Middle
         private readonly IAnalyzeRepository _analyzeRepository;
         private readonly INoticeRepository _noticeRepository;
         private readonly IUserMiddleService _userMiddleService;
-        private readonly INoticeAddresseeRepository _noticeAddresseeRepository;
-        private readonly IMissiveAddresseeRepository _missiveAddresseeRepository;
+        private readonly IAddresseeRepository _addresseeRepository;
         private readonly IRecordFolderRepository recordFolderRepository;
         private readonly IAnalyzeService analyzeService;
         public MiddleService(IMiddleRepository middleRepository, IFolderUserRepository folderUserRepository,
             IUserRepository userRepository, ICollectionRepository collectionRepository, INoteRepository noteRepository,
-            IMissiveRepository missiveRepository, IGroupRepository groupRepository,
-            IMissiveAnalyzeRepository missiveAnalyzeRepository, INoticeRepository noticeRepository, IAnalyzeRepository analyzeRepository, IUserMiddleService userMiddleService, INoticeAddresseeRepository noticeAddresseeRepository, IMissiveAddresseeRepository missiveAddresseeRepository, IRecordFolderRepository recordFolderRepository, IAnalyzeService analyzeService)
+            IMissiveRepository missiveRepository, IGroupRepository groupRepository, INoticeRepository noticeRepository, IAnalyzeRepository analyzeRepository, IUserMiddleService userMiddleService, IAddresseeRepository addresseeRepository, IRecordFolderRepository recordFolderRepository, IAnalyzeService analyzeService)
         {
             _middleRepository = middleRepository;
             _folderUserRepository = folderUserRepository;
@@ -54,8 +52,7 @@ namespace GxPress.Service.Implement.Middle
             _noticeRepository = noticeRepository;
             _analyzeRepository = analyzeRepository;
             _userMiddleService = userMiddleService;
-            _noticeAddresseeRepository = noticeAddresseeRepository;
-            _missiveAddresseeRepository = missiveAddresseeRepository;
+            _addresseeRepository = addresseeRepository;
             this.recordFolderRepository = recordFolderRepository;
             this.analyzeService = analyzeService;
         }
@@ -211,8 +208,15 @@ namespace GxPress.Service.Implement.Middle
                 MiddleSonId = request.MiddleSonId,
                 IsAdmin = request.IsAdmin,
                 NoticeAddresseeType = request.NoticeAddresseeType,
+                Title=request.Title,
                 IsRead = false,
-                IsUpload = false
+                IsUpload = false,
+                TitleLong=request.TitleLong,
+                Content=request.Content,
+                AddressUser=request.AddressUser,
+                CcUser=request.CcUser,
+                CcUserComplete=request.CcUserComplete,
+                AddressUserComplete=request.AddressUserComplete
             };
             if (request.AttributeValue == 0)
                 middle.AttributeValue = 1;
@@ -333,7 +337,7 @@ namespace GxPress.Service.Implement.Middle
                             var analyze = await analyzeService.GetAnalyzeAsync(analyzeRequest);
                             if (analyze != null)
                                 await _analyzeRepository.DeleteAsync(analyze.Id);
-                            await _noticeAddresseeRepository.UpdateAsync(Q.Where(nameof(Entity.NoticeAddressee.UserId), request.UserId).WhereIn(nameof(Entity.NoticeAddressee.NoticeId), ids).Set(nameof(Entity.NoticeAddressee.IsDelete), true));
+                            await _addresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Addressee.UserId), request.UserId).WhereIn(nameof(Entity.Addressee.SourceId), ids).Set(nameof(Entity.Addressee.IsDelete), true));
                         }
                         //删除站内信收藏
                         if (item.CollectionType == 6)
@@ -342,7 +346,7 @@ namespace GxPress.Service.Implement.Middle
                             var analyze = await analyzeService.GetAnalyzeAsync(analyzeRequest);
                             if (analyze != null)
                                 await _analyzeRepository.DeleteAsync(analyze.Id);
-                            await _missiveAddresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Missive.MissiveAddressee.UserId), request.UserId).WhereIn(nameof(Entity.Missive.MissiveAddressee.MissiveId), ids).Set(nameof(Entity.Missive.MissiveAddressee.IsDelete), true));
+                            await _addresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Addressee.UserId), request.UserId).WhereIn(nameof(Entity.Addressee.SourceId), ids).Set(nameof(Entity.Addressee.IsDelete), true));
                         }
                         //删除收藏会议
                         if (item.CollectionType == 8)
@@ -387,10 +391,10 @@ namespace GxPress.Service.Implement.Middle
                 //     await _missiveRepository.DeleteAsync(Q.WhereIn(nameof(Entity.Missive.Missive.Id), middles.Select(n => n.MiddleId)));
                 //删除通知
                 if (request.FolderType == 1)
-                    await _noticeAddresseeRepository.UpdateAsync(Q.Where(nameof(Entity.NoticeAddressee.UserId), request.UserId).WhereIn(nameof(Entity.NoticeAddressee.NoticeId), ids).Set(nameof(Entity.NoticeAddressee.IsDelete), true).Set(nameof(Entity.NoticeAddressee.IsRead), true));
+                    await _addresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Addressee.UserId), request.UserId).WhereIn(nameof(Entity.Addressee.SourceId), ids).Set(nameof(Entity.Addressee.IsDelete), true).Set(nameof(Entity.Addressee.IsRead), true));
                 //删除站内信
                 if (request.FolderType == 5)
-                    await _missiveAddresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Missive.MissiveAddressee.UserId), request.UserId).WhereIn(nameof(Entity.Missive.MissiveAddressee.MissiveId), ids).Set(nameof(Entity.Missive.MissiveAddressee.IsDelete), true).Set(nameof(Entity.Missive.MissiveAddressee.IsRead), true));
+                    await _addresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Addressee.UserId), request.UserId).WhereIn(nameof(Entity.Addressee.SourceId), ids).Set(nameof(Entity.Addressee.IsDelete), true).Set(nameof(Entity.Addressee.IsRead), true));
                 if (request.FolderType == 1 || request.FolderType == 5)
                 {
                     foreach (var item in middles)

+ 70 - 42
gx_api/GxPress/Service/GxPress.Service.Implement/Missive/MissiveService.cs

@@ -22,35 +22,38 @@ using Newtonsoft.Json;
 using IMapper = AutoMapper.IMapper;
 using System;
 using System.Transactions;
+using GxPress.Entity;
+using GxPress.Service.Interface.ContentJson;
+
 namespace GxPress.Service.Implement.Missive
 {
     public partial class MissiveService : IMissiveService
     {
         private readonly IMissiveRepository _missiveRepository;
-        private readonly IMissiveAddresseeRepository _missiveAddresseeRepository;
-        private readonly IMissiveCcRepository _missiveCcRepository;
-        private readonly IMissiveAnalyzeRepository _missiveAnalyzeRepository;
         private readonly IUserRepository _userRepository;
         private readonly IMiddleService _middleService;
         private readonly IMapper _mapper;
         private readonly IMiddleRepository _middleRepository;
         private readonly IAnalyzeService _analyzeService;
         private readonly IUserMiddleService _userMiddleService;
+
+        private readonly IAddresseeRepository _addresseeRepository;
+        private readonly ICcRepository _ccRepository;
+        private readonly IContentJsonService _contentJsonService;
         public MissiveService(IMissiveRepository missiveRepository,
-            IMissiveAddresseeRepository missiveAddresseeRepository, IMissiveCcRepository missiveCcRepository,
-            IMissiveAnalyzeRepository missiveAnalyzeRepository, IUserRepository userRepository,
-            IMiddleService middleService, IMapper mapper, IMiddleRepository middleRepository, IAnalyzeService analyzeService, IUserMiddleService userMiddleService)
+            IUserRepository userRepository,
+            IMiddleService middleService, IMapper mapper, IMiddleRepository middleRepository, IAnalyzeService analyzeService, IUserMiddleService userMiddleService, IAddresseeRepository addresseeRepository, ICcRepository ccRepository, IContentJsonService contentJsonService)
         {
             _missiveRepository = missiveRepository;
-            _missiveAddresseeRepository = missiveAddresseeRepository;
-            _missiveCcRepository = missiveCcRepository;
-            _missiveAnalyzeRepository = missiveAnalyzeRepository;
             _userRepository = userRepository;
             _middleService = middleService;
             _mapper = mapper;
             _middleRepository = middleRepository;
             _analyzeService = analyzeService;
             _userMiddleService = userMiddleService;
+            _addresseeRepository = addresseeRepository;
+            _ccRepository = ccRepository;
+            _contentJsonService = contentJsonService;
         }
 
         /// <summary>
@@ -68,7 +71,7 @@ namespace GxPress.Service.Implement.Missive
                 missive = await _missiveRepository.GetAsync(request.Id);
                 if (missive != null)
                 {
-                    middle = await _middleRepository.GetMiddleAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), missive.Id).Where(nameof(Entity.Middle.Middle.FolderType), 5));
+                    middle = await _middleRepository.GetMiddleAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), missive.Id).Where(nameof(Entity.Middle.Middle.FolderType), GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode()));
                 }
             }
             //收件人
@@ -86,7 +89,7 @@ namespace GxPress.Service.Implement.Missive
                             //删除草稿
                             await _missiveRepository.DeleteAsync(Q.Where(nameof(Entity.Missive.Missive.Id), request.Id));
                             //删除middle
-                            await _middleRepository.DeleteAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), request.Id).Where(nameof(Entity.Middle.Middle.FolderType), 5));
+                            await _middleRepository.DeleteAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), request.Id).Where(nameof(Entity.Middle.Middle.FolderType), GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode()));
                             missive = await _missiveRepository.GetAsync(Q.Where(nameof(Entity.Missive.Missive.Id), missive.SourceId));
                             if (missive != null)
                                 request.Id = missive.Id;
@@ -126,27 +129,31 @@ namespace GxPress.Service.Implement.Missive
                         SendUserId = request.UserId
                     };
                     request.Id = await _missiveRepository.InsertAsync(missive);
-                    var missiveAddressee = new MissiveAddressee
+                    var addressee = new Addressee
                     {
-                        MissiveId = request.Id,
+                        SourceId = request.Id,
                         UserId = request.UserId,
                         UserName = "",
                         IsAdmin = true,
                         IsRead = true,
-                        IsDelete = false
+                        IsDelete = false,
+                        SourceType = GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode()
                     };
-                    await _missiveAddresseeRepository.InsertAsync(missiveAddressee);
+                    await _addresseeRepository.InsertAsync(addressee);
                     //插入中间件
                     var result = new MiddleInsertTypeRequest
                     {
                         MiddleSonId = 0,
                         FolderId = request.FolderId,
-                        FolderType = 5,
+                        FolderType = GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode(),
                         MiddleId = request.Id,
                         UserId = request.UserId,
                         AttributeValue = 1,
                         NoticeAddresseeType = request.MissiveAttributeType,
                         IsAdmin = true,
+                        Title = _contentJsonService.GetTitile(request.Title, request.Content),
+                        TitleLong = request.Title,
+                        Content = request.Content,
                     };
                     await _middleService.InsertAsync(result);
                     transactionScope.Complete();
@@ -177,12 +184,15 @@ namespace GxPress.Service.Implement.Missive
                     {
                         MiddleSonId = 0,
                         FolderId = request.FolderId,
-                        FolderType = 5,
+                        FolderType = GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode(),
                         MiddleId = missiveId,
                         UserId = request.UserId,
                         AttributeValue = 1,
                         NoticeAddresseeType = request.MissiveAttributeType,
                         IsAdmin = true,
+                        Title = _contentJsonService.GetTitile(request.Title, request.Content),
+                        TitleLong = request.Title,
+                        Content = request.Content,
                     };
                     await _middleService.InsertAsync(result);
                     request.Id = missiveId;
@@ -201,10 +211,12 @@ namespace GxPress.Service.Implement.Missive
         /// <returns></returns>
         private async Task<bool> SendMissive(MissiveInRequest request, int missiveId)
         {
+            var addresseeUsers = new List<User>();
+            var ccUsers = new List<User>();
             //删除收件人
-            await _missiveAddresseeRepository.DeleteAsync(Q.Where(nameof(MissiveAddressee.MissiveId), missiveId).Where(nameof(MissiveAddressee.IsAdmin), false));
+            await _addresseeRepository.DeleteAsync(missiveId, GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode(), 0);
             //删除抄送人
-            await _missiveCcRepository.DeleteAsync(Q.Where(nameof(MissiveCc.MissiveId), missiveId));
+            await _ccRepository.DeleteAsync(missiveId, GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode());
             //获取收件人
             request.MissiveAddresseeUserIds = request.MissiveAddresseeUserIds.Distinct().ToList();
             //获取抄送人
@@ -223,8 +235,8 @@ namespace GxPress.Service.Implement.Missive
                 }
                 await _userMiddleService.AddUserMiddleAsync(request.AddresseeUserMiddles);
                 //获取用户
-                var users = await _userMiddleService.FindUsersAsync(request.AddresseeUserMiddles, request.UserId);
-                request.MissiveAddresseeUserIds = users.Select(n => n.Id).ToList();
+                addresseeUsers = await _userMiddleService.FindUsersAsync(request.AddresseeUserMiddles, request.UserId);
+                request.MissiveAddresseeUserIds = addresseeUsers.Select(n => n.Id).ToList();
             }
             if (request.CcUserMiddles.Count > 0)
             {
@@ -234,8 +246,8 @@ namespace GxPress.Service.Implement.Missive
                     item.MiddleType = 40;
                 }
                 await _userMiddleService.AddUserMiddleAsync(request.CcUserMiddles);
-                var users = await _userMiddleService.FindUsersAsync(request.CcUserMiddles, request.UserId);
-                request.MissiveCcUserIds = users.Select(n => n.Id).ToList();
+                ccUsers = await _userMiddleService.FindUsersAsync(request.CcUserMiddles, request.UserId);
+                request.MissiveCcUserIds = ccUsers.Select(n => n.Id).ToList();
                 //添加抄送人
                 request.MissiveAddresseeUserIds.AddRange(request.MissiveCcUserIds);
             }
@@ -243,22 +255,23 @@ namespace GxPress.Service.Implement.Missive
             request.MissiveAddresseeUserIds = request.MissiveAddresseeUserIds.Distinct().ToList();
             request.MissiveCcUserIds.Remove(request.UserId);
             request.MissiveAddresseeUserIds.Remove(request.UserId);
-            var missiveAddressees = new List<MissiveAddressee>();
+            var addressees = new List<Addressee>();
             var middles = new List<Entity.Middle.Middle>();
-            var missiveCcs = new List<Entity.Missive.MissiveCc>();
+            var ccs = new List<Entity.Cc>();
             //添加收件人
             foreach (var userId in request.MissiveAddresseeUserIds)
             {
-                var missiveAddressee = new MissiveAddressee
+                var addressee = new Addressee
                 {
-                    MissiveId = missiveId,
+                    SourceId = missiveId,
                     UserId = userId,
                     UserName = "",
                     IsAdmin = false,
                     IsRead = false,
-                    IsDelete = false
+                    IsDelete = false,
+                    SourceType = GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode()
                 };
-                missiveAddressees.Add(missiveAddressee);
+                addressees.Add(addressee);
                 // await _missiveAddresseeRepository.InsertAsync(missiveAddressee);
                 //如果是发送
                 if (request.MissiveAttributeType == NoticeTypeConst.Send)
@@ -266,7 +279,7 @@ namespace GxPress.Service.Implement.Missive
                     var middle = new Entity.Middle.Middle
                     {
                         MiddleId = missiveId,
-                        FolderType = 5,
+                        FolderType = GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode(),
                         IsTop = false,
                         AttributeValue = 1,
                         ParentId = 0,
@@ -274,7 +287,14 @@ namespace GxPress.Service.Implement.Missive
                         MiddleSonId = 0,
                         IsAdmin = false,
                         NoticeAddresseeType = request.MissiveAttributeType,
-                        IsRead = false
+                        IsRead = false,
+                        Title = _contentJsonService.GetTitile(request.Title, request.Content),
+                        TitleLong = request.Title,
+                        Content = request.Content,
+                        AddressUserComplete = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name)),
+                        AddressUser = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name), 10),
+                        CcUserComplete = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name)),
+                        CcUser = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name), 10),
                     };
                     middles.Add(middle);
                 }
@@ -282,18 +302,26 @@ namespace GxPress.Service.Implement.Missive
             //抄送人
             foreach (var userId in request.MissiveCcUserIds)
             {
-                var missiveCc = new MissiveCc
+                var cc = new Cc
                 {
-                    MissiveId = missiveId,
+                    SourceId = missiveId,
                     UserId = userId,
-                    UserName = ""
+                    UserName = "",
+                    SourceType = GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode()
                 };
-                missiveCcs.Add(missiveCc);
+                ccs.Add(cc);
             }
             //插入
-            await _missiveAddresseeRepository.InsertAsync(missiveAddressees);
-            await _missiveCcRepository.InsertAsync(missiveCcs);
+            await _addresseeRepository.InsertAsync(addressees);
+            await _ccRepository.InsertAsync(ccs);
             await _middleRepository.InsertAsync(middles);
+            //
+            var middleModel = await _middleRepository.GetMiddleAsync(Q.Where(nameof(Entity.Middle.Middle.FolderType), GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode()).Where(nameof(Entity.Middle.Middle.MiddleId), missiveId));
+            middleModel.AddressUserComplete = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name));
+            middleModel.AddressUser = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name), 10);
+            middleModel.CcUserComplete = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name));
+            middleModel.CcUser = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name), 10);
+            await _middleRepository.UpdateAsync(middleModel);
             return true;
         }
 
@@ -306,7 +334,7 @@ namespace GxPress.Service.Implement.Missive
         public async Task<MissiveInfoResult> GetMissiveInfoAsync(int missiveId, int userId)
         {
             //修改阅读
-            await _missiveAddresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Missive.MissiveAddressee.MissiveId), missiveId).Where(nameof(Entity.Missive.MissiveAddressee.UserId), userId).Set(nameof(MissiveAddressee.IsRead), true));
+            await _addresseeRepository.UpdateAsync(Q.Where(nameof(Entity.Addressee.SourceId), missiveId).Where(nameof(Entity.Addressee.UserId), userId).Set(nameof(Addressee.IsRead), true));
             var result = new MissiveInfoResult
             {
                 Items = await GetResult(new List<MissiveInfo>(), missiveId, userId)
@@ -405,7 +433,7 @@ namespace GxPress.Service.Implement.Missive
                 missiveInfoResult.MissiveSendType = middle.NoticeAddresseeType.GetHashCode();
             //获取当前站内信的用户数据
             var missiveAddressees =
-                await _missiveAddresseeRepository.GetAllAsync(Q.Where(nameof(MissiveAddressee.MissiveId), missiveId));
+                await _addresseeRepository.GetAllAsync(Q.Where(nameof(Addressee.SourceId), missiveId));
             var users = await _userRepository.FindAllUserAsync(Q.WhereIn(nameof(Entity.User.Id), missiveAddressees.Select(n => n.UserId)));
             missiveInfoResult.AddresseeUsers = users.Select(n => new UserResult { Name = n.Name, Id = n.Id }).ToList();
             //获取当前站内信的抄送人用户数据
@@ -546,13 +574,13 @@ namespace GxPress.Service.Implement.Missive
                 }
             }
             //获取抄送人
-            var missiveCcs = await _missiveCcRepository.GetAllAsync(Q.Where(nameof(MissiveCc.MissiveId), id));
+            var missiveCcs = await _ccRepository.GetNoticeCcByNoticeIdAsync(id, GxPress.EnumConst.FolderTypeConst.Missive.GetHashCode());
             var missiveCcList = new List<MissiveCcUser>();
             foreach (var missiveCc in missiveCcs)
                 missiveCcList.Add(new MissiveCcUser { Id = missiveCc.UserId, Name = missiveCc.UserName });
             //获取收件人
             var missiveAddresseeList = new List<MissiveAddresseeUser>();
-            var missiveAddresss = await _missiveAddresseeRepository.GetAllAsync(Q.Where(nameof(MissiveAddressee.MissiveId), id));
+            var missiveAddresss = await _addresseeRepository.GetAllAsync(Q.Where(nameof(Addressee.SourceId), id));
             foreach (var missiveAddress in missiveAddresss)
                 missiveAddresseeList.Add(new MissiveAddresseeUser { Id = missiveAddress.UserId, Name = missiveAddress.UserName });
             result.Data = JsonConvert.DeserializeObject<List<ContentJsonData>>(result.Content);
@@ -575,7 +603,7 @@ namespace GxPress.Service.Implement.Missive
         /// <returns></returns>
         public async Task<IEnumerable<MissiveReadListResult>> GetMissiveReadListAsync(MissiveReadListRequest request)
         {
-            return await _missiveAddresseeRepository.GetMissiveReadListAsync(request);
+            return await _addresseeRepository.GetMissiveReadListAsync(request);
         }
     }
 }

+ 57 - 33
gx_api/GxPress/Service/GxPress.Service.Implement/Notice/NoticeService.Insert.cs

@@ -9,6 +9,7 @@ using GxPress.EnumConst;
 using System.Linq;
 using System.Collections.Generic;
 using Datory;
+using Aliyun.Acs.Core.Utils;
 
 namespace GxPress.Service.Implement.Notice
 {
@@ -28,23 +29,28 @@ namespace GxPress.Service.Implement.Notice
                     if (userEntity == null)
                         throw new BusinessException("用户不存在");
                     var noticeId = 0;
+                    var middleId = 0;
+                    var addresseeUsers = new List<User>();
+                    var ccUsers = new List<User>();
                     if (request.Id == 0)
                     {
                         noticeId = await _noticeRepository.InsertAsync(request);
                         var middleInsertTypes = new MiddleInsertTypeRequest
                         {
-                            FolderId = 0,
+                            FolderId = request.FolderId,
                             MiddleId = noticeId,
-                            FolderType = 1,
+                            FolderType = GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode(),
                             UserId = request.UserId,
                             MiddleSonId = 0,
                             NoticeAddresseeType = request.NoticeType,
                             AttributeValue = 1,
-                            IsAdmin = true
+                            Title = _contentJsonService.GetTitile(request.Title, request.Content),
+                            IsAdmin = true,
+                            TitleLong = request.Title,
+                            Content = request.Content,
                         };
-                        middleInsertTypes.FolderId = request.FolderId;
                         //添加自己
-                        await _middleService.InsertAsync(middleInsertTypes);
+                        middleId = await _middleService.InsertAsync(middleInsertTypes);
                     }
                     else
                     {
@@ -59,12 +65,12 @@ namespace GxPress.Service.Implement.Notice
                         //删除middle
                         await _middleRepository.DeleteAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), noticeId).Where(nameof(Entity.Middle.Middle.FolderType), 1).Where(nameof(Entity.Middle.Middle.IsAdmin), false));
                         //删除收件人
-                        await _noticeAddresseeRepository.DeleteAsync(noticeId);
+                        await _addresseeRepository.DeleteAsync(noticeId, GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode(), 2);
                         //删除抄送人
-                        await _noticeCcRepository.DeleteAsync(noticeId);
+                        await _ccRepository.DeleteAsync(noticeId, GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode());
                         //删除userMiddle
-                        await _userMiddleService.DeleteAsync(noticeId,10);
-                        await _userMiddleService.DeleteAsync(noticeId,20);
+                        await _userMiddleService.DeleteAsync(noticeId, 10);
+                        await _userMiddleService.DeleteAsync(noticeId, 20);
                     }
                     //判断是不是新版通知
                     if (request.AddresseeUserMiddles.Count > 0)
@@ -78,8 +84,8 @@ namespace GxPress.Service.Implement.Notice
                         }
                         await _userMiddleService.AddUserMiddleAsync(request.AddresseeUserMiddles);
                         //获取用户
-                        var users = await _userMiddleService.FindUsersAsync(request.AddresseeUserMiddles, request.UserId);
-                        request.NoticeAddresseeUserIds = users.Select(n => n.Id).ToList();
+                        addresseeUsers = await _userMiddleService.FindUsersAsync(request.AddresseeUserMiddles, request.UserId);
+                        request.NoticeAddresseeUserIds = addresseeUsers.Select(n => n.Id).ToList();
                     }
                     if (request.CcUserMiddles.Count > 0)
                     {
@@ -91,32 +97,33 @@ namespace GxPress.Service.Implement.Notice
                             item.MiddleType = 20;
                         }
                         await _userMiddleService.AddUserMiddleAsync(request.CcUserMiddles);
-                        var users = await _userMiddleService.FindUsersAsync(request.CcUserMiddles, request.UserId);
-                        request.NoticeCcUserIds = users.Select(n => n.Id).ToList();
+                        ccUsers = await _userMiddleService.FindUsersAsync(request.CcUserMiddles, request.UserId);
+                        request.NoticeCcUserIds = ccUsers.Select(n => n.Id).ToList();
                         //添加抄送人
                         request.NoticeAddresseeUserIds.AddRange(request.NoticeCcUserIds);
                     }
 
                     //创建人
-                    var noticeAddresseeEntity = new NoticeAddressee
+                    var addresseeEntity = new Addressee
                     {
-                        NoticeId = noticeId,
+                        SourceId = noticeId,
                         UserId = request.UserId,
                         UserName = userEntity.Name,
                         IsAdmin = true,
                         NoticeAddresseeType = request.NoticeType,
                         IsTop = false,
-                        IsRead = true
+                        IsRead = true,
+                        SourceType = GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode()
                     };
-                    var noticeAddresseeId = await _noticeAddresseeRepository.InsertAsync(noticeAddresseeEntity);
+                    var noticeAddresseeId = await _addresseeRepository.InsertAsync(addresseeEntity);
                     request.NoticeAddresseeUserIds = request.NoticeAddresseeUserIds.Distinct().ToList();
                     request.NoticeAddresseeUserIds.AddRange(request.NoticeCcUserIds);
                     //通知收件人
-                    var noticeAddressees = new List<NoticeAddressee>();
+                    var addressees = new List<Addressee>();
                     //中间件
                     var middles = new List<Entity.Middle.Middle>();
                     //抄送人
-                    var noticeCcs = new List<NoticeCc>();
+                    var ccs = new List<Cc>();
                     //收件人
                     if (request.NoticeType == NoticeTypeConst.Send)
                     {
@@ -124,14 +131,15 @@ namespace GxPress.Service.Implement.Notice
                         {
                             if (noticeAddresseeUserId == request.UserId)
                                 continue;
-                            var noticeAddressee = new NoticeAddressee
+                            var noticeAddressee = new Addressee
                             {
-                                NoticeId = noticeId,
+                                SourceId = noticeId,
                                 UserId = noticeAddresseeUserId,
                                 NoticeAddresseeType = request.NoticeType,
-                                IsRead = false
+                                IsRead = false,
+                                SourceType = GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode()
                             };
-                            noticeAddressees.Add(noticeAddressee);
+                            addressees.Add(noticeAddressee);
                         }
                     }
                     request.NoticeCcUserIds = request.NoticeCcUserIds.Distinct().ToList();
@@ -142,21 +150,21 @@ namespace GxPress.Service.Implement.Notice
                         {
                             if (noticeCcUserId == 0)
                                 continue;
-                            var noticeCc = new NoticeCc
+                            var cc = new Cc
                             {
                                 UserId = noticeCcUserId,
-                                NoticeId = noticeId,
-                                NoticeCcType = request.NoticeType
+                                SourceId = noticeId,
+                                SourceType = GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode()
                             };
-                            noticeCcs.Add(noticeCc);
+                            ccs.Add(cc);
                         }
                     }
                     //添加收件人
-                    await _noticeAddresseeRepository.InsertAsync(noticeAddressees);
+                    await _addresseeRepository.InsertAsync(addressees);
                     //添加草送人
-                    await _noticeCcRepository.InsertAsync(noticeCcs);
+                    await _ccRepository.InsertAsync(ccs);
                     //查询添加的收件人
-                    var noticeAddresseelist = await _noticeAddresseeRepository.GetAllAsync(Q.Where(nameof(Entity.NoticeAddressee.NoticeId), noticeId));
+                    var noticeAddresseelist = await _addresseeRepository.GetAllAsync(Q.Where(nameof(Entity.Addressee.SourceId), noticeId));
                     if (request.NoticeType == NoticeTypeConst.Send)
                     {
                         foreach (var item in noticeAddresseelist)
@@ -166,7 +174,7 @@ namespace GxPress.Service.Implement.Notice
                             var middle = new Entity.Middle.Middle
                             {
                                 MiddleId = noticeId,
-                                FolderType = 1,
+                                FolderType = GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode(),
                                 IsTop = false,
                                 AttributeValue = 1,
                                 ParentId = 0,
@@ -174,12 +182,28 @@ namespace GxPress.Service.Implement.Notice
                                 MiddleSonId = item.Id,
                                 IsAdmin = false,
                                 NoticeAddresseeType = request.NoticeType,
-                                IsRead = false
+                                Title = _contentJsonService.GetTitile(request.Title, request.Content),
+                                IsRead = false,
+                                TitleLong = request.Title,
+                                Content = request.Content,
+                                AddressUserComplete = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name)),
+                                AddressUser = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name), 10),
+                                CcUserComplete = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name)),
+                                CcUser = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name), 10),
                             };
                             middles.Add(middle);
                         }
                     }
-
+                    //修改middler
+                    if (middleId > 0)
+                    {
+                        var middle = await _middleRepository.GetMiddleAsync(middleId);
+                        middle.AddressUserComplete = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name));
+                        middle.AddressUser = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name), 10);
+                        middle.CcUserComplete = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name));
+                        middle.CcUser = Common.Tools.StringUtils.ObjectCollectionToString(addresseeUsers.Select(n => n.Name), 10);
+                        await _middleRepository.UpdateAsync(middle);
+                    }
                     //添加文件
                     if (request.NoticeType == NoticeTypeConst.Send)
                         //添加收件人

+ 33 - 200
gx_api/GxPress/Service/GxPress.Service.Implement/Notice/NoticeService.cs

@@ -12,7 +12,6 @@ using GxPress.Entity;
 using GxPress.EnumConst;
 using GxPress.Repository.Interface;
 using GxPress.Request.Analyze;
-using GxPress.Request.App.Middle;
 using GxPress.Request.Notice;
 using GxPress.Result;
 using GxPress.Result.Notice;
@@ -22,6 +21,7 @@ using GxPress.Service.Interface.Notice;
 using GxPress.Service.Interface.Visit;
 using Newtonsoft.Json;
 using GxPress.Service.Interface.UserMiddle;
+using GxPress.Service.Interface.ContentJson;
 
 namespace GxPress.Service.Implement.Notice
 {
@@ -29,8 +29,8 @@ namespace GxPress.Service.Implement.Notice
     {
         private readonly IUserRepository _userRepository;
         private readonly INoticeRepository _noticeRepository;
-        private readonly INoticeCcRepository _noticeCcRepository;
-        private readonly INoticeAddresseeRepository _noticeAddresseeRepository;
+        private readonly ICcRepository _ccRepository;
+        private readonly IAddresseeRepository _addresseeRepository;
         private readonly IDepartmentRepository _departmentRepository;
         private readonly IMiddleService _middleService;
         private readonly IMiddleRepository _middleRepository;
@@ -39,15 +39,16 @@ namespace GxPress.Service.Implement.Notice
         private readonly IVisitService _visitService;
         private readonly ICommentRepository _commentRepository;
         private readonly IUserMiddleService _userMiddleService;
+        private readonly IContentJsonService _contentJsonService;
         public NoticeService(IUserRepository userRepository, IMapper mapper, INoticeRepository noticeRepository,
-            INoticeCcRepository noticeCcRepository, INoticeAddresseeRepository noticeAddresseeRepository,
+            ICcRepository ccRepository, IAddresseeRepository addresseeRepository,
             IDepartmentRepository departmentRepository, IMiddleService middleService,
-            IMiddleRepository middleRepository, IAnalyzeService analyzeService, ICommentRepository commentRepository, IVisitService visitService, IUserMiddleService userMiddleService)
+            IMiddleRepository middleRepository, IAnalyzeService analyzeService, ICommentRepository commentRepository, IVisitService visitService, IUserMiddleService userMiddleService, IContentJsonService contentJsonService)
         {
             _noticeRepository = noticeRepository;
             _userRepository = userRepository;
-            _noticeAddresseeRepository = noticeAddresseeRepository;
-            _noticeCcRepository = noticeCcRepository;
+            _addresseeRepository = addresseeRepository;
+            _ccRepository = ccRepository;
             _departmentRepository = departmentRepository;
             _mapper = mapper;
             _middleService = middleService;
@@ -56,6 +57,7 @@ namespace GxPress.Service.Implement.Notice
             _commentRepository = commentRepository;
             _visitService = visitService;
             _userMiddleService = userMiddleService;
+            _contentJsonService = contentJsonService;
         }
         /// <summary>
         /// 获取通知的点赞列表
@@ -82,21 +84,21 @@ namespace GxPress.Service.Implement.Notice
             //获取用户
             var user = await _userRepository.GetAsync(result.UserId);
             result.UserName = user.Name;
-            result.AllCount = await _noticeAddresseeRepository.CountAsync(Q.Where(nameof(NoticeAddressee.NoticeId), id));
-            result.ReadCount = await _noticeAddresseeRepository.CountAsync(Q.Where(nameof(NoticeAddressee.NoticeId), id).Where(nameof(NoticeAddressee.IsRead), true));
+            result.AllCount = await _addresseeRepository.CountAsync(Q.Where(nameof(Addressee.SourceId), id));
+            result.ReadCount = await _addresseeRepository.CountAsync(Q.Where(nameof(Addressee.SourceId), id).Where(nameof(Addressee.IsRead), true));
             //获取收件人
             var noticeAddresseeList =
-                await _noticeAddresseeRepository.GetUserByNoticeIdAsync(id);
+                await _addresseeRepository.GetUserByNoticeIdAsync(id);
             result.NoticeAddresseeNames = noticeAddresseeList.Select(n => n.Name).ToList();
-            var IsRead = await _noticeAddresseeRepository.ExistsAsync(Q.Where(nameof(Entity.Middle.Middle.IsRead), true)
-                  .Where(nameof(NoticeAddressee.NoticeId), id)
-                  .Where(nameof(NoticeAddressee.UserId), userId));
+            var IsRead = await _addresseeRepository.ExistsAsync(Q.Where(nameof(Entity.Middle.Middle.IsRead), true)
+                  .Where(nameof(Addressee.SourceId), id)
+                  .Where(nameof(Addressee.UserId), userId));
             //修改阅读量
             if (IsRead == false)
             {
-                if (await _noticeAddresseeRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.IsRead), true)
-                    .Where(nameof(NoticeAddressee.NoticeId), id)
-                    .Where(nameof(NoticeAddressee.UserId), userId)))
+                if (await _addresseeRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.IsRead), true)
+                    .Where(nameof(Addressee.SourceId), id)
+                    .Where(nameof(Addressee.UserId), userId)))
                     result.ReadCount++;
             }
             //修改访问量
@@ -147,9 +149,9 @@ namespace GxPress.Service.Implement.Notice
             var notice = await _noticeRepository.GetAsync(id);
             var result = _mapper.Map<NoticeEditDetailResult>(notice);
             //抄送人
-            var noticeCcList = await _noticeCcRepository.GetNoticeCcByNoticeIdAsync(id);
+            var noticeCcList = await _ccRepository.GetNoticeCcByNoticeIdAsync(id, GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode());
             //收件人
-            var noticeAddressee = await _noticeAddresseeRepository.GetNoticeAddresseeByNoticeIdAsync(id);
+            var noticeAddressee = await _addresseeRepository.GetNoticeAddresseeByNoticeIdAsync(id);
             //获取新版
             result.AddresseeUserMiddles = await _userMiddleService.FindUserMiddlesAsync(10, id);
             result.CcUserMiddles = await _userMiddleService.FindUserMiddlesAsync(20, id);
@@ -200,18 +202,18 @@ namespace GxPress.Service.Implement.Notice
             var user = await _userRepository.GetAsync(result.UserId);
             result.UserName = user.Name;
             result.AllCount =
-                await _noticeAddresseeRepository.CountAsync(Q.Where(nameof(NoticeAddressee.NoticeId), id));
-            result.ReadCount = await _noticeAddresseeRepository.CountAsync(Q
-                .Where(nameof(NoticeAddressee.NoticeId), id).Where(nameof(NoticeAddressee.IsRead), true));
+                await _addresseeRepository.CountAsync(Q.Where(nameof(Addressee.SourceId), id));
+            result.ReadCount = await _addresseeRepository.CountAsync(Q
+                .Where(nameof(Addressee.SourceId), id).Where(nameof(Addressee.IsRead), true));
             //获取收件人
             var noticeAddresseeList =
-                await _noticeAddresseeRepository.GetAllAsync(Q.Where(nameof(NoticeAddressee.NoticeId), id)
+                await _addresseeRepository.GetAllAsync(Q.Where(nameof(Addressee.SourceId), id)
                     .Where(nameof(Entity.Middle.Middle.IsAdmin), false));
             result.NoticeAddresseeNames = noticeAddresseeList.Select(n => n.UserName).ToList();
             //修改阅读量
-            await _noticeAddresseeRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.IsRead), true)
-                .Where(nameof(NoticeAddressee.NoticeId), id)
-                .Where(nameof(NoticeAddressee.UserId), userId));
+            await _addresseeRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.IsRead), true)
+                .Where(nameof(Addressee.SourceId), id)
+                .Where(nameof(Addressee.UserId), userId));
             //修改middle的阅读
             await _middleRepository.UpdateAsync(Q.Set(nameof(Entity.Middle.Middle.IsRead), true).Where(nameof(Entity.Middle.Middle.UserId), userId).Where(nameof(Entity.Middle.Middle.MiddleId), id).Where(nameof(Entity.Middle.Middle.FolderType), 1));
             var analyzeRequest = new Request.App.Analyze.AnalyzeRequest();
@@ -276,7 +278,7 @@ namespace GxPress.Service.Implement.Notice
                             //删除
                             await _noticeRepository.DeleteAsync(Q.Where(nameof(Entity.Notice.Id), notice.Id));
                             //删除middle
-                            await _middleRepository.DeleteAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), notice.Id).Where(nameof(Entity.Middle.Middle.FolderType), 1));
+                            await _middleRepository.DeleteAsync(notice.Id, GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode());
                             if (notice.SourceId > 0)
                             {
                                 var noticeSource = await _noticeRepository.GetAsync(notice.SourceId);
@@ -313,124 +315,7 @@ namespace GxPress.Service.Implement.Notice
             }
             return true;
         }
-        /// <summary>
-        /// 发送通知
-        /// </summary>
-        /// <param name="request"></param>
-        /// <returns></returns>
-        public async Task<bool> SendNoticeAsync(NoticeUpRequest request)
-        {
-            if (request.AddresseeUserMiddles.Count > 0)
-            {
-                await _userMiddleService.DeleteAsync(Q.Where(nameof(Entity.UserMiddle.UserMiddle.MiddleType), 10).Where(nameof(Entity.UserMiddle.UserMiddle.DataSourceId), request.Id));
-                foreach (var item in request.AddresseeUserMiddles)
-                {
-                    item.DataSourceId = request.Id;
-                    item.MiddleType = 10;
-                }
-                await _userMiddleService.AddUserMiddleAsync(request.AddresseeUserMiddles);
-                var users = await _userMiddleService.FindUsersAsync(request.AddresseeUserMiddles, request.UserId);
-                request.NoticeAddresseeUserIds = users.Select(n => n.Id).ToList();
-                request.NoticeAddresseeUserIds.Remove(request.UserId);
-            }
-            if (request.CcUserMiddles.Count > 0)
-            {
-                await _userMiddleService.DeleteAsync(Q.Where(nameof(Entity.UserMiddle.UserMiddle.MiddleType), 20).Where(nameof(Entity.UserMiddle.UserMiddle.DataSourceId), request.Id));
-                foreach (var item in request.CcUserMiddles)
-                {
-                    item.DataSourceId = request.Id;
-                    item.MiddleType = 20;
-                }
-                await _userMiddleService.AddUserMiddleAsync(request.CcUserMiddles);
-                var users = await _userMiddleService.FindUsersAsync(request.CcUserMiddles, request.UserId);
-                request.NoticeCcUserIds = users.Select(n => n.Id).ToList();
-                request.NoticeCcUserIds.Remove(request.UserId);
-            }
-            if (request.NoticeAddresseeUserIds.Count > 0)
-            {
-                //删除接收人
-                await _noticeAddresseeRepository.DeleteAsync(request.Id);
-                //删除middle
-                await _middleRepository.DeleteAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), request.Id).Where(nameof(Entity.Middle.Middle.FolderType), 1));
-                if (request.NoticeType == NoticeTypeConst.Send)
-                {
-                    var userEntity = await _userRepository.GetAsync(request.UserId);
-                    //创建人
-                    var noticeAddresseeEntity = new NoticeAddressee
-                    {
-                        NoticeId = request.Id,
-                        UserId = request.UserId,
-                        UserName = userEntity.Name,
-                        IsAdmin = true,
-                        NoticeAddresseeType = request.NoticeType,
-                        IsTop = false
-                    };
-                    var noticeAddresseeId = await _noticeAddresseeRepository.InsertAsync(noticeAddresseeEntity);
-                    //添加文件
-                    var middleInsertTypes = new MiddleInsertTypeRequest
-                    {
-                        FolderId = 0,
-                        MiddleId = request.Id,
-                        FolderType = 1,
-                        UserId = request.UserId,
-                        MiddleSonId = noticeAddresseeId,
-                        NoticeAddresseeType = request.NoticeType,
-                        AttributeValue = 1,
-                        IsAdmin = true
-                    };
-                    await _middleService.InsertAsync(middleInsertTypes);
-                }
-                //收件人
-                foreach (var noticeAddresseeUserId in request.NoticeAddresseeUserIds)
-                {
-                    var user = await _userRepository.GetAsync(noticeAddresseeUserId);
-                    if (user.Id == request.UserId)
-                        continue;
-                    var noticeAddressee = new NoticeAddressee
-                    {
-                        NoticeId = request.Id,
-                        UserId = noticeAddresseeUserId,
-                        UserName = user.Name,
-                        NoticeAddresseeType = request.NoticeType
-                    };
-                    var noticeAddresseeId = await _noticeAddresseeRepository.InsertAsync(noticeAddressee);
-                    if (request.NoticeType == NoticeTypeConst.Send)
-                    {
-                        //添加文件
-                        var middleInsertType = new MiddleInsertTypeRequest
-                        {
-                            FolderId = 0,
-                            MiddleId = request.Id,
-                            FolderType = 1,
-                            UserId = noticeAddresseeUserId,
-                            MiddleSonId = noticeAddresseeId,
-                            AttributeValue = 1
-                        };
-                        await _middleService.InsertAsync(middleInsertType);
-                    }
-                }
-            }
-            if (request.NoticeCcUserIds.Count > 0)
-            {
-                //删除抄送人
-                await _noticeCcRepository.DeleteAsync(request.Id);
-                //创建
-                //抄送
-                foreach (var noticeCcUserId in request.NoticeCcUserIds)
-                {
-                    var user = await _userRepository.GetAsync(noticeCcUserId);
-                    var noticeCc = new NoticeCc
-                    {
-                        UserId = noticeCcUserId,
-                        NoticeId = request.Id,
-                        UserName = user.Name,
-                        NoticeCcType = request.NoticeType
-                    };
-                    await _noticeCcRepository.InsertAsync(noticeCc);
-                }
-            }
-            return true;
-        }
+       
         /// <summary>
         /// 根据已读未读查询通知数据
         /// </summary>
@@ -438,7 +323,7 @@ namespace GxPress.Service.Implement.Notice
         /// <returns></returns>
         public async Task<IEnumerable<NoticeReadListResult>> NoticeReadListAsync(NoticeReadListRequest request)
         {
-            var noticeReadListResults = await _noticeAddresseeRepository.GetNoticeAddresseeByUserIdIdAsync(request);
+            var noticeReadListResults = await _addresseeRepository.GetNoticeAddresseeByUserIdIdAsync(request);
             return noticeReadListResults;
         }
 
@@ -452,59 +337,7 @@ namespace GxPress.Service.Implement.Notice
             var result = await _noticeRepository.GetNoticeListPageAsync(request);
             foreach (var item in result.Items)
             {
-                // var userMiddles = await _userMiddleService.FindUserMiddlesAsync(10, item.MiddleId);
-                // item.EnjoyUser = StringUtils.ObjectCollectionToString(userMiddles.Select(n => n.SourceName).ToList(), "、");
-                //分析title
-                if (string.IsNullOrWhiteSpace(item.Title))
-                {
-                    var data = JsonConvert.DeserializeObject<List<ContentJsonData>>(item.Content);
-                    if (data.Count > 0)
-                    {
-                        var first = data.First();
-                        if (first.TypeValue == OldTextEditorTypeConst.Text.GetHashCode() && !string.IsNullOrWhiteSpace(first.Text))
-                            item.Title = first.Text;
-                        else
-                        {
-                            foreach (var contentJsonData in data)
-                            {
-                                //是否是文本
-                                if (contentJsonData.TypeValue == OldTextEditorTypeConst.Text.GetHashCode())
-                                    continue;
-                                else if (contentJsonData.TypeValue == OldTextEditorTypeConst.Image.GetHashCode())
-                                {
-                                    item.Title = "[图片]";
-                                    break;
-                                }
-                                else if (contentJsonData.TypeValue == OldTextEditorTypeConst.File.GetHashCode())
-                                {
-                                    item.Title = "[附件]";
-                                    break;
-                                }
-                                else
-                                {
-                                    item.Title = "[附件]";
-                                    break;
-                                }
-                            }
-                            // //图片 文件类型
-                            // var typeList = new List<int> { OldTextEditorTypeConst.Image.GetHashCode(), OldTextEditorTypeConst.File.GetHashCode() };
-                            // if (data.Any(n => (n.TypeValue == OldTextEditorTypeConst.Image.GetHashCode() && n.TypeValue == OldTextEditorTypeConst.File.GetHashCode())))
-                            //     item.Title = "[图片][附件]";
-                            // else
-                            // {
-                            //     if (data.Any(n => n.TypeValue == OldTextEditorTypeConst.Image.GetHashCode()))
-                            //         item.Title = "[图片]";
-                            //     else if (data.Any(n => n.TypeValue == OldTextEditorTypeConst.File.GetHashCode()))
-                            //         item.Title = "[附件]";
-                            //     else
-                            //     {
-                            //         if (data.Any(n => !typeList.Contains(n.TypeValue)))
-                            //             item.Title = "[附件]";
-                            //     }
-                            // }
-                        }
-                    }
-                }
+                item.Title = _contentJsonService.GetTitile(item.Title, item.Content);
                 if (item.IsDelete == true)
                     item.NoticeStatus = 0;
                 else if (item.NoticeAddresseeType == NoticeTypeConst.Draft)
@@ -527,9 +360,9 @@ namespace GxPress.Service.Implement.Notice
                 using (TransactionScope transactionScope = new TransactionScope())
                 {
                     //删除middle
-                    await _middleRepository.DeleteAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), id).Where(nameof(Entity.Middle.Middle.FolderType), 1).Where(nameof(Entity.Middle.Middle.IsAdmin), false));
+                    await _middleRepository.DeleteAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), id).Where(nameof(Entity.Middle.Middle.FolderType),GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode()).Where(nameof(Entity.Middle.Middle.IsAdmin), false));
                     //修改为草稿箱
-                    await _middleRepository.UpdateAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), id).Where(nameof(Entity.Middle.Middle.FolderType), 1).Where(nameof(Entity.Middle.Middle.IsAdmin), true).Set(nameof(Entity.Middle.Middle.NoticeAddresseeType), 2));
+                    await _middleRepository.UpdateAsync(Q.Where(nameof(Entity.Middle.Middle.MiddleId), id).Where(nameof(Entity.Middle.Middle.FolderType), GxPress.EnumConst.FolderTypeConst.Notice.GetHashCode()).Where(nameof(Entity.Middle.Middle.IsAdmin), true).Set(nameof(Entity.Middle.Middle.NoticeAddresseeType), 2));
                     //修改
                     await _noticeRepository.UpdateAsync(Q.Where(nameof(Entity.Notice.Id), id).Set(nameof(Entity.Notice.NoticeType), NoticeTypeConst.Draft.GetHashCode()));
                     transactionScope.Complete();

+ 7 - 0
gx_api/GxPress/Service/GxPress.Service.Interface/ContentJson/IContentJsonService.cs

@@ -0,0 +1,7 @@
+namespace GxPress.Service.Interface.ContentJson
+{
+    public interface IContentJsonService:IService
+    {
+        string GetTitile(string title, string content);
+    }
+}