|
@@ -42,6 +42,7 @@ using Microsoft.Extensions.Options;
|
|
|
using XF.Utility.MQ;
|
|
|
using System.Threading;
|
|
|
using BulletinOutDto = Hotline.Share.Dtos.Article.BulletinOutDto;
|
|
|
+using Hotline.Article;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
|
namespace Hotline.Application.Snapshot;
|
|
@@ -89,8 +90,9 @@ public abstract class SnapshotApplicationBase
|
|
|
private readonly ISnapshotPointsRecordRepository _pointsRecordRepository;
|
|
|
private readonly IOptionsSnapshot<MqConfiguration> _mqConfiguration;
|
|
|
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;
|
|
|
_industryRepository = industryRepository;
|
|
@@ -126,6 +128,7 @@ public abstract class SnapshotApplicationBase
|
|
|
_pointsRecordRepository = snapshotPointsRecordRepository;
|
|
|
_mqConfiguration = mqConfiguration;
|
|
|
_notificationReceiverRepository = notificationReceiverRepository;
|
|
|
+ _notificationRepository = notificationRepository;
|
|
|
}
|
|
|
|
|
|
#region 小程序
|
|
@@ -410,6 +413,34 @@ public abstract class SnapshotApplicationBase
|
|
|
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>
|
|
@@ -1064,7 +1095,7 @@ public abstract class SnapshotApplicationBase
|
|
|
outDto.VideoBulletin = await _notificationReceiverRepository.Queryable()
|
|
|
.LeftJoin<Notification>((receiver, notify) => notify.Id == receiver.NotificationId)
|
|
|
.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
|
|
|
{
|
|
|
notify.Title,
|
|
@@ -1087,7 +1118,10 @@ public abstract class SnapshotApplicationBase
|
|
|
{
|
|
|
Items = await _notificationReceiverRepository.Queryable()
|
|
|
.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,
|
|
|
Title = notify.Title,
|
|
@@ -1095,8 +1129,13 @@ public abstract class SnapshotApplicationBase
|
|
|
.Take(2)
|
|
|
.ToListAsync(),
|
|
|
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;
|