Browse Source

合并冲突

qinchaoyue 8 hours ago
parent
commit
adbdcd1ac4

+ 0 - 1
src/Hotline.Api/Controllers/IdentityController.cs

@@ -121,7 +121,6 @@ jxrWXHbT1FB6DqkdOnBbQqS1Azqz5HxLlSyEK3F60e3SgB5iZsDZ
     public async Task<Dictionary<string, object>> GetThirdTokenAsync([FromBody] ThirdTokenInDto dto)
     public async Task<Dictionary<string, object>> GetThirdTokenAsync([FromBody] ThirdTokenInDto dto)
         => await _identityAppService.GetThirdTokenAsync(dto, HttpContext.RequestAborted);
         => await _identityAppService.GetThirdTokenAsync(dto, HttpContext.RequestAborted);
 
 
-
     /// <summary>
     /// <summary>
     /// 第三方登录
     /// 第三方登录
     /// </summary>
     /// </summary>

+ 10 - 1
src/Hotline.Api/Controllers/Snapshot/SnapshotController.cs

@@ -376,7 +376,7 @@ public class SnapshotController : BaseController
     }
     }
 
 
     /// <summary>
     /// <summary>
-    /// 获取消息
+    /// 获取消息集合
     /// </summary>
     /// </summary>
     /// <param name="dto"></param>
     /// <param name="dto"></param>
     /// <returns></returns>
     /// <returns></returns>
@@ -384,6 +384,15 @@ public class SnapshotController : BaseController
     public async Task<IList<GetNotifyOutDto>> GetNotificationAsync([FromQuery] GetNotifyInDto dto)
     public async Task<IList<GetNotifyOutDto>> GetNotificationAsync([FromQuery] GetNotifyInDto dto)
         => await _snapshotApplication.GetNotificationAsync(dto, HttpContext.RequestAborted);
         => await _snapshotApplication.GetNotificationAsync(dto, HttpContext.RequestAborted);
 
 
+    /// <summary>
+    /// 获取消息详情
+    /// </summary>
+    /// <returns></returns>
+    [HttpGet("notification/{id}")]
+    public async Task<BulletinOutDto> GetNotificationDetailsAsync(string id)
+        => await _snapshotApplication.GetNotificationDetailsAsync(id, HttpContext.RequestAborted);
+
+
     #region 积分
     #region 积分
     /// <summary>
     /// <summary>
     /// 积分榜
     /// 积分榜

+ 8 - 0
src/Hotline.Application/Snapshot/Contracts/ISnapshotApplication.cs

@@ -236,4 +236,12 @@ public interface ISnapshotApplication
     Task<int> GetPointsTotalAsync(PointItemsInDto dto, CancellationToken requestAborted);
     Task<int> GetPointsTotalAsync(PointItemsInDto dto, CancellationToken requestAborted);
 
 
     Task<IList<GetNotifyOutDto>> GetNotificationAsync(GetNotifyInDto dto, CancellationToken requestAborted);
     Task<IList<GetNotifyOutDto>> GetNotificationAsync(GetNotifyInDto dto, CancellationToken requestAborted);
+
+    /// <summary>
+    /// 获取通知详情
+    /// </summary>
+    /// <param name="id"></param>
+    /// <param name="requestAborted"></param>
+    /// <returns></returns>
+    Task<BulletinOutDto> GetNotificationDetailsAsync(string id, CancellationToken requestAborted);
 }
 }

File diff suppressed because it is too large
+ 0 - 0
src/Hotline.Application/Snapshot/DefaultSnapshotApplication.cs


+ 46 - 6
src/Hotline.Application/Snapshot/SnapshotApplicationBase.cs

@@ -42,6 +42,7 @@ using Microsoft.Extensions.Options;
 using XF.Utility.MQ;
 using XF.Utility.MQ;
 using System.Threading;
 using System.Threading;
 using BulletinOutDto = Hotline.Share.Dtos.Article.BulletinOutDto;
 using BulletinOutDto = Hotline.Share.Dtos.Article.BulletinOutDto;
+using Hotline.Article;
 using NPOI.SS.Formula.Functions;
 using NPOI.SS.Formula.Functions;
 
 
 namespace Hotline.Application.Snapshot;
 namespace Hotline.Application.Snapshot;
@@ -89,8 +90,9 @@ public abstract class SnapshotApplicationBase
     private readonly ISnapshotPointsRecordRepository _pointsRecordRepository;
     private readonly ISnapshotPointsRecordRepository _pointsRecordRepository;
     private readonly IOptionsSnapshot<MqConfiguration> _mqConfiguration;
     private readonly IOptionsSnapshot<MqConfiguration> _mqConfiguration;
     private readonly INotificationReceiverRepository _notificationReceiverRepository;
     private readonly INotificationReceiverRepository _notificationReceiverRepository;
+    private readonly INotificationRepository _notificationRepository;
 
 
-    public SnapshotApplicationBase(IThirdIdentiyService thirdLoginService, IIndustryRepository industryRepository, ISnapshotBulletinRepository bulletinRepository, ISessionContext sessionContext, IRedPackRecordRepository redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IOrderSnapshotRepository orderSnapshotRepository, ISystemSettingCacheManager systemSettingCacheManager, ISystemAreaDomainService systemAreaDomainService, IFileRepository fileRepository, ISystemDicDataCacheManager systemDicDataCacheManager, ISnapshotOrderPublishRepository snapshotOrderPublishRepository, IRepository<WorkflowTrace> workflowTraceRepository, IPractitionerRepository practitionerRepository, IRepository<SystemArea> systemAreaRepository, IVolunteerRepository volunteerRepository, IVolunteerReportRepository volunteerReportRepository, ISystemLogRepository systemLog, IGuiderSystemService guiderSystemService, ICapPublisher capPublisher, Publisher publisher, IFileDomainService fileDomainService, ICommunityInfoRepository communityInfoRepository, IRedPackAuditRepository redPackAuditRepository, IOrderVisitRepository orderVisitRepository, IOrderVisitDetailRepository orderVisitDetailRepository, IRedPackGuiderAuditRepository redPackGuiderAuditRepository, IInviteCodeRecordRepository inviteCodeRecordRepository, IInviteCodeRepository inviteCodeRepository, ICitizenRepository citizenRepository, ISnapshotPointsRecordRepository snapshotPointsRecordRepository, IOptionsSnapshot<MqConfiguration> mqConfiguration, INotificationReceiverRepository notificationReceiverRepository)
+    public SnapshotApplicationBase(IThirdIdentiyService thirdLoginService, IIndustryRepository industryRepository, ISnapshotBulletinRepository bulletinRepository, ISessionContext sessionContext, IRedPackRecordRepository redPackRecordRepository, IRepository<Order> orderRepository, IThirdAccountRepository thirdAccountRepository, IOrderSnapshotRepository orderSnapshotRepository, ISystemSettingCacheManager systemSettingCacheManager, ISystemAreaDomainService systemAreaDomainService, IFileRepository fileRepository, ISystemDicDataCacheManager systemDicDataCacheManager, ISnapshotOrderPublishRepository snapshotOrderPublishRepository, IRepository<WorkflowTrace> workflowTraceRepository, IPractitionerRepository practitionerRepository, IRepository<SystemArea> systemAreaRepository, IVolunteerRepository volunteerRepository, IVolunteerReportRepository volunteerReportRepository, ISystemLogRepository systemLog, IGuiderSystemService guiderSystemService, ICapPublisher capPublisher, Publisher publisher, IFileDomainService fileDomainService, ICommunityInfoRepository communityInfoRepository, IRedPackAuditRepository redPackAuditRepository, IOrderVisitRepository orderVisitRepository, IOrderVisitDetailRepository orderVisitDetailRepository, IRedPackGuiderAuditRepository redPackGuiderAuditRepository, IInviteCodeRecordRepository inviteCodeRecordRepository, IInviteCodeRepository inviteCodeRepository, ICitizenRepository citizenRepository, ISnapshotPointsRecordRepository snapshotPointsRecordRepository, IOptionsSnapshot<MqConfiguration> mqConfiguration, INotificationReceiverRepository notificationReceiverRepository, INotificationRepository notificationRepository)
     {
     {
         _thirdLoginService = thirdLoginService;
         _thirdLoginService = thirdLoginService;
         _industryRepository = industryRepository;
         _industryRepository = industryRepository;
@@ -126,6 +128,7 @@ public abstract class SnapshotApplicationBase
         _pointsRecordRepository = snapshotPointsRecordRepository;
         _pointsRecordRepository = snapshotPointsRecordRepository;
         _mqConfiguration = mqConfiguration;
         _mqConfiguration = mqConfiguration;
         _notificationReceiverRepository = notificationReceiverRepository;
         _notificationReceiverRepository = notificationReceiverRepository;
+        _notificationRepository = notificationRepository;
     }
     }
 
 
     #region 小程序
     #region 小程序
@@ -404,12 +407,41 @@ public abstract class SnapshotApplicationBase
             {
             {
                 NotificationId = m.NotificationId,
                 NotificationId = m.NotificationId,
                 Title = notify.Title ,
                 Title = notify.Title ,
-                CreationTime = m.CreationTime
+                CreationTime = m.CreationTime,
+                IsRead = m.IsRead
             }, true)
             }, true)
             .ToFixedListAsync(dto, requestAborted);
             .ToFixedListAsync(dto, requestAborted);
         return items;
         return items;
     }
     }
 
 
+    /// <summary>
+    /// 获取通知详情
+    /// </summary>
+    /// <param name="id"></param>
+    /// <param name="requestAborted"></param>
+    /// <returns></returns>
+    public async Task<BulletinOutDto> GetNotificationDetailsAsync(string id, CancellationToken token)
+    {
+        var outDto = await _notificationRepository.Queryable()
+            .LeftJoin<SnapshotBulletin>((notify, bulletin) => notify.ExternalId == bulletin.Id)
+            .Where((notify, bulletin) => notify.Id == id)
+            .Select((notify, bulletin) => new BulletinOutDto
+            {
+                Id = bulletin.Id,
+                Title = bulletin.Title,
+                CreationTime = bulletin.CreationTime,
+                Content = bulletin.Content,
+                VideoPath = bulletin.VideoPath
+            })
+            .FirstAsync(token);
+        await _notificationReceiverRepository.Updateable()
+            .SetColumns(m => m.IsRead, true)
+            .Where(m => m.NotificationId == id && m.ReceiverId == _sessionContext.UserId)
+            .ExecuteCommandAsync(token);
+
+        return outDto;
+    }
+
     /// <summary>
     /// <summary>
     /// 获取工单详情
     /// 获取工单详情
     /// </summary>
     /// </summary>
@@ -1064,7 +1096,7 @@ public abstract class SnapshotApplicationBase
         outDto.VideoBulletin = await _notificationReceiverRepository.Queryable()
         outDto.VideoBulletin = await _notificationReceiverRepository.Queryable()
             .LeftJoin<Notification>((receiver, notify) => notify.Id == receiver.NotificationId)
             .LeftJoin<Notification>((receiver, notify) => notify.Id == receiver.NotificationId)
             .LeftJoin<SnapshotBulletin>((receiver, notify, bulletin) => bulletin.Id == notify.ExternalId)
             .LeftJoin<SnapshotBulletin>((receiver, notify, bulletin) => bulletin.Id == notify.ExternalId)
-            .Where((receiver, notify) => receiver.ReceiverId == _sessionContext.UserId)
+            .Where((receiver, notify, bulletin) => receiver.ReceiverId == _sessionContext.UserId && bulletin.Shape == EBulletinShape.Video)
             .GroupBy((receiver, notify, bulletin) => new 
             .GroupBy((receiver, notify, bulletin) => new 
             {
             {
                 notify.Title,
                 notify.Title,
@@ -1087,7 +1119,10 @@ public abstract class SnapshotApplicationBase
         {
         {
             Items = await _notificationReceiverRepository.Queryable()
             Items = await _notificationReceiverRepository.Queryable()
                 .LeftJoin<Notification>((receiver, notify) => notify.Id == receiver.NotificationId)
                 .LeftJoin<Notification>((receiver, notify) => notify.Id == receiver.NotificationId)
-                .Select((receiver, notify) => new PointsBulletinItemsOutDto
+                .LeftJoin<SnapshotBulletin>((receiver, notify, bulletin) => bulletin.Id == notify.ExternalId)
+                .Where((receiver, notify, bulletin) => bulletin.Shape == EBulletinShape.Message)
+                .GroupBy((receiver, notify, bulletin) => new { notify.ExternalId, notify.Title})
+                .Select((receiver, notify, bulletin) => new PointsBulletinItemsOutDto
                 {
                 {
                     BulletinId = notify.ExternalId,
                     BulletinId = notify.ExternalId,
                     Title = notify.Title,
                     Title = notify.Title,
@@ -1095,8 +1130,13 @@ public abstract class SnapshotApplicationBase
                 .Take(2)
                 .Take(2)
                 .ToListAsync(),
                 .ToListAsync(),
             UnReadCount = await _notificationReceiverRepository.Queryable()
             UnReadCount = await _notificationReceiverRepository.Queryable()
-            .Where(m => m.IsRead == false && m.ReceiverId == _sessionContext.UserId)
-            .CountAsync()
+                .LeftJoin<Notification>((receiver, notify) => notify.Id == receiver.NotificationId)
+                .LeftJoin<SnapshotBulletin>((receiver, notify, bulletin) => bulletin.Id == notify.ExternalId)
+                .Where((receiver, notify, bulletin) => receiver.IsRead == false 
+                && receiver.ReceiverId == _sessionContext.UserId 
+                && bulletin.Shape == EBulletinShape.Message)
+                .GroupBy((receiver, notify, bulletin) => new { receiver.ReceiverId, receiver.NotificationId})
+                .CountAsync()
         };
         };
 
 
         return outDto;
         return outDto;

File diff suppressed because it is too large
+ 0 - 0
src/Hotline.Application/Snapshot/ZiGongSnapshotApplication.cs


+ 5 - 0
src/Hotline.Share/Dtos/Article/BulletinDto.cs

@@ -586,6 +586,11 @@ namespace Hotline.Share.Dtos.Article
         /// </summary>
         /// </summary>
         public string Content { get; set; }
         public string Content { get; set; }
 
 
+        /// <summary>
+        /// 视频地址
+        /// </summary>
+        public string? VideoPath { get; set; }
+
         public DateTime CreationTime { get; set; }
         public DateTime CreationTime { get; set; }
     }
     }
 }
 }

+ 5 - 0
src/Hotline.Share/Dtos/Snapshot/NotifyDto.cs

@@ -63,4 +63,9 @@ public class GetNotifyOutDto
     /// 创建时间
     /// 创建时间
     /// </summary>
     /// </summary>
     public DateTime CreationTime { get; set; }
     public DateTime CreationTime { get; set; }
+
+    /// <summary>
+    /// 是否已读
+    /// </summary>
+    public bool IsRead { get; set; }
 }
 }

+ 5 - 0
src/Hotline.Share/Dtos/Snapshot/SnapshotBulletinDto.cs

@@ -288,6 +288,11 @@ public class AddSnapshotBulletinInDto
     /// </summary>
     /// </summary>
     public string? VideoPath { get; set; }
     public string? VideoPath { get; set; }
 
 
+    /// <summary>
+    /// 视频名称
+    /// </summary>
+    public string? VideoName { get; set; }
+
     /// <summary>
     /// <summary>
     /// 视频封面
     /// 视频封面
     /// </summary>
     /// </summary>

+ 23 - 0
src/Hotline/SeedData/SystemMenuSeedData.cs

@@ -0,0 +1,23 @@
+using Hotline.Settings;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XF.Domain.Entities;
+
+namespace Hotline.SeedData;
+
+public class SystemMenuSeedData : ISeedData<SystemDicData>
+{
+    public IEnumerable<SystemDicData> HasData()
+    {
+        return new List<SystemDicData>();
+    }
+
+    public IEnumerable<SystemMenu> GetData()
+    {
+         throw new  NotImplementedException();
+        //return [new() { Id = }];
+    }
+}

+ 5 - 0
src/Hotline/Snapshot/SnapshotBulletin.cs

@@ -195,5 +195,10 @@ public class SnapshotBulletin : CreationEntity
     [SugarColumn(ColumnDescription = "视频封面")]
     [SugarColumn(ColumnDescription = "视频封面")]
     public string? VideoCoverImgUrl { get; set; }
     public string? VideoCoverImgUrl { get; set; }
 
 
+    /// <summary>
+    /// 视频名称
+    /// </summary>
+    [SugarColumn(ColumnDescription = "视频封面")]
+    public string? VideoName { get; set; }
 }
 }
 
 

Some files were not shown because too many files changed in this diff