浏览代码

Merge branch 'dev' of http://110.188.24.182:10023/Fengwo/hotline into dev
合并冲突

guqiang 1 天之前
父节点
当前提交
561a388ea5

+ 2 - 2
src/Hotline.Api/Controllers/IdentityController.cs

@@ -119,7 +119,7 @@ jxrWXHbT1FB6DqkdOnBbQqS1Azqz5HxLlSyEK3F60e3SgB5iZsDZ
     [AllowAnonymous]
     [HttpPost("third/token")]
     public async Task<Dictionary<string, object>> GetThirdTokenAsync([FromBody] ThirdTokenInDto dto)
-        => await _identityAppService.GetThredTokenAsync(dto, HttpContext.RequestAborted);
+        => await _identityAppService.GetThirdTokenAsync(dto, HttpContext.RequestAborted);
 
 
     /// <summary>
@@ -133,7 +133,7 @@ jxrWXHbT1FB6DqkdOnBbQqS1Azqz5HxLlSyEK3F60e3SgB5iZsDZ
     [AllowAnonymous]
     [HttpPost("third/login")]
     public async Task<Dictionary<string, object>> GetThirdLoginAsync([FromBody] ThirdOpenIdInDto dto)
-            => await _identityAppService.GetThredTokenAsync(dto, HttpContext.RequestAborted);
+            => await _identityAppService.GetThirdTokenAsync(dto, HttpContext.RequestAborted);
 
     /// <summary>
     /// 根据OpenId刷新令牌

+ 1 - 1
src/Hotline.Api/Controllers/Snapshot/BiSnapshotController.cs

@@ -334,6 +334,6 @@ public class BiSnapshotController : BaseController
     /// <param name="dto"></param>
     /// <returns></returns>
     [HttpGet("county_points")]
-    public async Task<IList<SnapshotCountyPointsStatisticsOutDto>> Get([FromQuery] SnapshotCountyPointsStatisticsInDto dto)
+    public async Task<IList<SnapshotCountyPointsStatisticsOutDto>> GetAreaPointsStatistics([FromQuery] SnapshotCountyPointsStatisticsInDto dto)
         => await _biSnapshotApplication.GetAreaPointsStatistics(dto).ToListAsync(HttpContext.RequestAborted);
 }

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

@@ -32,6 +32,7 @@ using XF.Domain.Authentications;
 using XF.Domain.Exceptions;
 using XF.Domain.Filters;
 using XF.Domain.Repository;
+using BulletinOutDto = Hotline.Share.Dtos.Article.BulletinOutDto;
 
 namespace Hotline.Api.Controllers.Snapshot;
 

+ 2 - 2
src/Hotline.Application/Identity/IIdentityAppService.cs

@@ -20,7 +20,7 @@ namespace Hotline.Application.Identity
         /// <param name="dto"></param>
         /// <returns></returns>
         /// <exception cref="UserFriendlyException"></exception>
-        Task<Dictionary<string, object>> GetThredTokenAsync(ThirdTokenInDto dto, CancellationToken token);
+        Task<Dictionary<string, object>> GetThirdTokenAsync(ThirdTokenInDto dto, CancellationToken token);
 
         /// <summary>
         /// 第三方登录
@@ -28,7 +28,7 @@ namespace Hotline.Application.Identity
         /// <param name="dto"></param>
         /// <param name="token"></param>
         /// <returns></returns>
-        Task<Dictionary<string, object>> GetThredTokenAsync(ThirdOpenIdInDto dto, CancellationToken token);
+        Task<Dictionary<string, object>> GetThirdTokenAsync(ThirdOpenIdInDto dto, CancellationToken token);
 
         /// <summary>
         /// 根据OpenId刷新令牌

+ 3 - 3
src/Hotline.Application/Identity/IdentityAppService.cs

@@ -330,7 +330,7 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
     /// <param name="dto"></param>
     /// <returns></returns>
     /// <exception cref="UserFriendlyException"></exception>
-    public async Task<Dictionary<string, object>> GetThredTokenAsync(ThirdTokenInDto dto, CancellationToken token)
+    public async Task<Dictionary<string, object>> GetThirdTokenAsync(ThirdTokenInDto dto, CancellationToken token)
     {
         var thirdDto = dto.Adapt<ThirdTokenDto>();
         thirdDto = await _thirdAccountDomainFactory.GetThirdParameterAsync(thirdDto, token);
@@ -345,10 +345,10 @@ public class IdentityAppService : IIdentityAppService, IScopeDependency
             ThirdType = dto.ThirdType,
             PhoneNumber = phone.PhoneNumber
         };
-        return await GetThredTokenAsync(inDto, token);
+        return await GetThirdTokenAsync(inDto, token);
     }
 
-    public async Task<Dictionary<string, object>> GetThredTokenAsync(ThirdOpenIdInDto dto, CancellationToken token)
+    public async Task<Dictionary<string, object>> GetThirdTokenAsync(ThirdOpenIdInDto dto, CancellationToken token)
     {
         var thirdAccount = await _thirdAccountRepository.GetByOpenIdAsync(dto.OpenId, token);
 

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

@@ -2,6 +2,7 @@
 using Hotline.Share.Dtos.Article;
 using Hotline.Share.Dtos.Snapshot;
 using Hotline.Snapshot;
+using BulletinOutDto = Hotline.Share.Dtos.Article.BulletinOutDto;
 
 namespace Hotline.Application.Snapshot.Contracts;
 public interface ISnapshotApplication

文件差异内容过多而无法显示
+ 0 - 0
src/Hotline.Application/Snapshot/DefaultSnapshotApplication.cs


+ 28 - 1
src/Hotline.Application/Snapshot/SnapshotApplicationBase.cs

@@ -41,6 +41,7 @@ using Hotline.Settings.Hotspots;
 using Microsoft.Extensions.Options;
 using XF.Utility.MQ;
 using System.Threading;
+using BulletinOutDto = Hotline.Share.Dtos.Article.BulletinOutDto;
 using NPOI.SS.Formula.Functions;
 
 namespace Hotline.Application.Snapshot;
@@ -398,7 +399,7 @@ public abstract class SnapshotApplicationBase
     {
         var items = await _notificationReceiverRepository.Queryable()
             .LeftJoin<Notification>((m , notify) => m.NotificationId == notify.Id)
-            .Where(m => m.ReceiverId == _sessionContext.UserId)
+            .Where((m, notify) => m.ReceiverId == _sessionContext.UserId && dto.NotifyType == notify.NotifyType)
             .Select((m, notify) => new GetNotifyOutDto 
             {
                 NotificationId = m.NotificationId,
@@ -1058,6 +1059,32 @@ public abstract class SnapshotApplicationBase
             item.Insert(0, my);
         }
         outDto.Ranks = item;
+
+
+        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)
+            .OrderByDescending((receiver, notify) => notify.CreationTime)
+            .Select((receiver, notify, bulletin) => new VideoBulletinOutDto
+            {
+                Title = notify.Title,
+                BulletinId = notify.ExternalId,
+                UnReadCount = SqlFunc.AggregateSum(SqlFunc.IIF( receiver.IsRead == false, 1, 0)),
+                SnapshotBulletinTypeName = bulletin.SnapshotBulletinTypeName,
+                VideoCoverImgUrl = bulletin.VideoCoverImgUrl,
+            }).FirstAsync();
+
+        outDto.Bulletins = await _notificationReceiverRepository.Queryable()
+            .LeftJoin<Notification>((receiver, notify) => notify.Id == receiver.NotificationId)
+            .Select((receiver, notify) => new PointsBulletinOutDto 
+            {
+                BulletinId = notify.ExternalId,
+                Title = notify.Title,
+            }, true)
+            .Take(2)
+            .ToListAsync();
+
         return outDto;
     }
     #endregion

+ 1 - 0
src/Hotline.Application/Snapshot/SnapshotBulletinApplication.cs

@@ -103,6 +103,7 @@ public class SnapshotBulletinApplication : ISnapshotBulletinApplication, IScopeD
                             {
                                 inDto.NotifyType = ENotificationType.Video;
                             }
+                            inDto.ExternalId = bulletion.Id;
                             await _notificationDomainService.AddNotifyAsync(inDto, token);
                         });
                 }

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

@@ -29,6 +29,8 @@ public class AddNotifyInDto
     /// </summary>
     public ENotificationType NotifyType { get; set; }
 
+    public string ExternalId { get; set; }
+
     /// <summary>
     /// 用户
     /// </summary>

+ 51 - 0
src/Hotline.Share/Dtos/Snapshot/PointsDto.cs

@@ -115,6 +115,57 @@ public class PointsRankOutDto
     /// 排行
     /// </summary>
     public IList<PointsRankUserDto> Ranks { get; set; }
+
+    /// <summary>
+    /// 视频公告
+    /// </summary>
+    public VideoBulletinOutDto VideoBulletin { get; set; }
+
+    /// <summary>
+    /// 通知公告
+    /// </summary>
+    public IList<PointsBulletinOutDto> Bulletins { get; set; }
+}
+
+public class PointsBulletinOutDto
+{
+    /// <summary>
+    /// Id
+    /// </summary>
+    public string BulletinId { get; set; }
+
+    /// <summary>
+    /// 标题
+    /// </summary>
+    public string Title { get; set; }
+}
+
+public class VideoBulletinOutDto
+{
+    /// <summary>
+    /// Id
+    /// </summary>
+    public string BulletinId { get; set; }
+
+    /// <summary>
+    /// 标题
+    /// </summary>
+    public string Title { get; set; }
+
+    /// <summary>
+    /// 栏目
+    /// </summary>
+    public string SnapshotBulletinTypeName { get; set; }
+
+    /// <summary>
+    /// 视频封面
+    /// </summary>
+    public string VideoCoverImgUrl { get; set; }
+
+    /// <summary>
+    /// 未读个数
+    /// </summary>
+    public int UnReadCount { get; set; }
 }
 
 public class PointsRankUserDto

+ 7 - 0
src/Hotline/Snapshot/Notification.cs

@@ -1,4 +1,5 @@
 using Hotline.Share.Enums.Snapshot;
+using SqlSugar;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -24,4 +25,10 @@ public class Notification : CreationSoftDeleteEntity
     /// 类型
     /// </summary>
     public ENotificationType NotifyType { get; set; }
+
+    /// <summary>
+    /// 外部业务唯一标识
+    /// </summary>
+    [SugarColumn(ColumnDescription = "外部业务唯一标识")]
+    public string? ExternalId { get; set; }
 }

+ 14 - 3
src/Hotline/Snapshot/Services/SnapshotPointsDomainService.cs

@@ -1,4 +1,5 @@
-using Hotline.Share.Enums.Snapshot;
+using Hotline.Orders;
+using Hotline.Share.Enums.Snapshot;
 using Hotline.Snapshot.Contracts;
 using Hotline.Snapshot.IRepository;
 using System;
@@ -27,11 +28,21 @@ public class SnapshotPointsDomainService : ISnapshotPointsDomainService, IScopeD
         if (status == null) return;
         var order = await _orderSnapshotRepository.Queryable()
             .LeftJoin<Industry>((snapshot, industry) => snapshot.IndustryId == industry.Id)
+            .LeftJoin<Order>((snapshot, industry, order) => order.Id == snapshot.Id)
             .Where((snapshot, industry) => snapshot.Id == orderId)
-            .Select((snapshot, industry) => new { snapshot.Id, industry.ReportPoints , industry.ArgeePoints , industry.RefusePoints,  industry.Name,
-                snapshot.CreatorId})
+            .Select((snapshot, industry, order) => new 
+            {
+                snapshot.Id,
+                industry.ReportPoints,
+                industry.ArgeePoints, 
+                industry.RefusePoints,
+                industry.Name,
+                snapshot.CreatorId,
+                order.HotspotId
+            })
             .FirstAsync();
         if (order == null) return;
+        if (order.HotspotId != null && order.HotspotId.StartsWith("18") == true) return;
         
         if (order.ReportPoints.HasValue == false)
             throw new UserFriendlyException($"{order.Name} 行业未配置积分");

+ 35 - 3
test/Hotline.Tests/Application/OrderSnapshotApplicationTest.cs

@@ -11,6 +11,7 @@ using Hotline.Repository.SqlSugar.Snapshot;
 using Hotline.Settings;
 using Hotline.Share.Dtos;
 using Hotline.Share.Dtos.Snapshot;
+using Hotline.Share.Enums.CallCenter;
 using Hotline.Share.Enums.Snapshot;
 using Hotline.Share.Requests;
 using Hotline.Share.Tools;
@@ -112,6 +113,37 @@ public class OrderSnapshotApplicationTest : TestBase
             });
     }
 
+    [Theory]
+    [InlineData(true)]
+    [InlineData(false)]
+    public async Task SnapshotOrder_AddPoints_Test(bool 是受理范围)
+    {
+        var order = _orderServiceMock.CreateSnapshotOrder(SetWeiXin, "安全隐患")
+            .StepHandle(async order =>
+            {
+                if (是受理范围 == false)
+                {
+                    var entity = _orderRepository.Get(order.Id);
+                    entity.HotspotId = "181301";
+                    await _orderRepository.UpdateAsync(entity);
+                }
+            })
+            .办理到一级部门(SetZuoXi)
+            .办理到归档(Set一级部门, data =>
+            {
+                data.CompliantType = ECompliantType.First;
+                data.VerifyType = "现场";
+                data.IsCheckList = true;
+            }).GetCreateResult();
+        var points = await _pointsRecordRepository.Queryable()
+            .Where(m => m.OrderId == order.Id && m.Direction == EPointsDirection.In && m.Source == EPointsSource.Report)
+            .FirstAsync();
+        if (是受理范围)
+            points.ShouldNotBeNull();
+        else
+            points.ShouldBeNull();
+    }
+
     /// <summary>
     /// 随手拍网格员超时:
     /// </summary>
@@ -267,7 +299,7 @@ public class OrderSnapshotApplicationTest : TestBase
                 baseData.AuditTypeCode.ShouldNotBeNull();
                 baseData.Amount.ShouldNotBeNull();
 
-                var specialRedAuditItems = await _redPackApplication.GetRedPackSpecialAuditItems(new SnapshotOrderAuditItemsInDto() { PageIndex = 1, PageSize = 10 , No = order.No, Status = 1}).ToListAsync();
+                var specialRedAuditItems = await _redPackApplication.GetRedPackSpecialAuditItems(new SnapshotOrderAuditItemsInDto() { PageIndex = 1, PageSize = 10, No = order.No, Status = 1 }).ToListAsync();
                 var specialRedAudit = specialRedAuditItems.FirstOrDefault();
                 specialRedAudit.ShouldNotBeNull();
                 var a = _systemDicDataCacheManager.SnapshotReplenishType.First();
@@ -288,7 +320,7 @@ public class OrderSnapshotApplicationTest : TestBase
                 };
 
                 await _redPackApplication.UpdateRedPackSpecialRecordAsync(inDto); // 补充发放
-                specialRedAuditItems = await _redPackApplication.GetRedPackSpecialAuditItems(new SnapshotOrderAuditItemsInDto() { PageIndex = 1, PageSize = 10 , Status = 1, No = order.No}).ToListAsync();
+                specialRedAuditItems = await _redPackApplication.GetRedPackSpecialAuditItems(new SnapshotOrderAuditItemsInDto() { PageIndex = 1, PageSize = 10, Status = 1, No = order.No }).ToListAsync();
                 specialRedAudit = specialRedAuditItems.First();
                 specialRedAudit.ShouldNotBeNull();
                 specialRedAudit.BankCardNo.ShouldBe(inDto.BankCardNo);
@@ -329,7 +361,7 @@ public class OrderSnapshotApplicationTest : TestBase
                 }); // 添加备注
 
                 SetWeiXin();
-                redPackItems =  await _snapshotApplication.GetRedPacksAsync(new RedPacksInDto() { Status = ERedPackPickupStatus.Received }, CancellationToken.None);
+                redPackItems = await _snapshotApplication.GetRedPacksAsync(new RedPacksInDto() { Status = ERedPackPickupStatus.Received }, CancellationToken.None);
                 redPackRecord = redPackItems.Where(m => m.OrderId == order.Id).FirstOrDefault();
                 redPackRecord.ShouldNotBeNull();
                 redPackRecord.Amount.ShouldBe(11);

+ 2 - 2
test/Hotline.Tests/Application/SnapshotApplicationTest.cs

@@ -251,7 +251,7 @@ public class SnapshotApplicationTest : TestBase
     [Fact]
     public async Task RefreshTokenAsync()
     {
-        var token = await _identityAppService.GetThredTokenAsync(new ThirdTokenInDto(), CancellationToken.None);
+        var token = await _identityAppService.GetThirdTokenAsync(new ThirdTokenInDto(), CancellationToken.None);
         var newToken = await _identityAppService.RefreshTokenAsync(token["OpenId"].ToString(), CancellationToken.None);
         newToken.ShouldNotBeNull();
         newToken["OpenId"].ShouldBe(token["OpenId"].ToString());
@@ -265,7 +265,7 @@ public class SnapshotApplicationTest : TestBase
     [Fact]
     public async Task GetThirdToken_Test()
     {
-        var result = await _identityAppService.GetThredTokenAsync(new ThirdTokenInDto { AppType = EAppType.Snapshot, ThirdType = EThirdType.WeChat, LoginCode = "0c3Adhll2zDMBe413rnl2KvEym2AdhlH" }, CancellationToken.None);
+        var result = await _identityAppService.GetThirdTokenAsync(new ThirdTokenInDto { AppType = EAppType.Snapshot, ThirdType = EThirdType.WeChat,   LoginCode = "0c3Adhll2zDMBe413rnl2KvEym2AdhlH" }, CancellationToken.None);
         result["PhoneNumber"].ToString().ShouldNotBeNullOrEmpty();
     }
 

+ 2 - 0
test/Hotline.Tests/Mock/Interfaces/IOrderServiceStartWorkflow.cs

@@ -13,4 +13,6 @@ public interface IOrderServiceStartWorkflow
     CreateOrderOutDto GetCreateResult();
     OrderServiceMock 办理到一级部门(Action action = null);
     OrderServiceMock 办理到归档(Action action = null);
+
+    IOrderServiceStartWorkflow StepHandle(Func<CreateOrderOutDto, Task> handle);
 }

+ 6 - 0
test/Hotline.Tests/Mock/OrderServiceStartWorkflow.cs

@@ -46,6 +46,12 @@ public class OrderServiceStartWorkflow : IOrderServiceStartWorkflow
         return _orderServiceMock.CreateOrderOutDto;
     }
 
+    public IOrderServiceStartWorkflow StepHandle(Func<CreateOrderOutDto, Task> handle)
+    {
+        handle(_orderServiceMock.CreateOrderOutDto).GetAwaiter().GetResult();
+        return this;
+    }
+
     public OrderServiceMock 办理到一级部门(Action action = null)
     {
         action?.Invoke();

部分文件因为文件数量过多而无法显示