浏览代码

增加小程序首页弹窗接口

qinchaoyue 4 月之前
父节点
当前提交
3a7dc8474c

+ 15 - 7
src/Hotline.Api/Controllers/Snapshot/SnapshotController.cs

@@ -134,9 +134,17 @@ public class SnapshotController : BaseController
     /// <returns></returns>
     [HttpGet("bulletions")]
     [AllowAnonymous]
-    public virtual async Task<IReadOnlyList<BulletinOutDto>> QueryBulletinsAsync([FromQuery] BulletinInDto dto)
+    public async Task<IReadOnlyList<BulletinOutDto>> QueryBulletinsAsync([FromQuery] BulletinInDto dto)
         => await _snapshotApplication.GetBulletinsAsync(dto, HttpContext.RequestAborted);
 
+    /// <summary>
+    /// 获取小程序首页弹窗
+    /// </summary>
+    /// <returns></returns>
+    [HttpGet("bulletions/popup")]
+    public async Task<BulletinOutDto> GetBulletionPopupAsync()
+        => await _snapshotApplication.GetBulletionPopupAsync(HttpContext.RequestAborted);
+
     /// <summary>
     /// 公告详情
     /// </summary>
@@ -144,7 +152,7 @@ public class SnapshotController : BaseController
     /// <returns></returns>
     [HttpGet("bulletions/{id}")]
     [AllowAnonymous]
-    public virtual async Task<BulletinOutDto> QueryBulletionsDetailAsync(string id)
+    public async Task<BulletinOutDto> QueryBulletionsDetailAsync(string id)
         => await _snapshotApplication.GetBulletinsDetailAsync(id);
 
     /// <summary>
@@ -153,7 +161,7 @@ public class SnapshotController : BaseController
     /// <returns></returns>
     [AllowAnonymous]
     [HttpGet("user")]
-    public virtual async Task<SnapshotUserInfoOutDto> GetUserInfo()
+    public async Task<SnapshotUserInfoOutDto> GetUserInfo()
         => await _snapshotApplication.GetSnapshotUserInfoAsync();
 
     /// <summary>
@@ -162,7 +170,7 @@ public class SnapshotController : BaseController
     /// <param name="dto"></param>
     /// <returns></returns>
     [HttpGet("order")]
-    public virtual async Task<IList<OrderOutDto>> QueryOrderListAsync([FromQuery] OrderInDto dto)
+    public async Task<IList<OrderOutDto>> QueryOrderListAsync([FromQuery] OrderInDto dto)
         => await _snapshotApplication.GetSnapshotOrdersAsync(dto, HttpContext.RequestAborted);
 
     /// <summary>
@@ -171,7 +179,7 @@ public class SnapshotController : BaseController
     /// <param name="id"></param>
     /// <returns></returns>
     [HttpGet("order/{id}")]
-    public virtual async Task<OrderPublishDetailOutDto> QueryOrderListAsync([FromQuery] string id)
+    public async Task<OrderPublishDetailOutDto> QueryOrderListAsync([FromQuery] string id)
         => await _snapshotApplication.GetSnapshotOrderDetailAsync(id, HttpContext.RequestAborted);
 
     /// <summary>
@@ -180,7 +188,7 @@ public class SnapshotController : BaseController
     /// <param name="dto"></param>
     /// <returns></returns>
     [HttpGet("redpack")]
-    public virtual async Task<IReadOnlyList<RedPackDateOutDto>> QueryRedPackDateAsync([FromQuery] RedPackDateInDto dto)
+    public async Task<IReadOnlyList<RedPackDateOutDto>> QueryRedPackDateAsync([FromQuery] RedPackDateInDto dto)
         => await _snapshotApplication.GetRedPackDateAsync(dto, HttpContext.RequestAborted);
 
     /// <summary>
@@ -197,7 +205,7 @@ public class SnapshotController : BaseController
     /// <param name="dto"></param>
     /// <returns></returns>
     [HttpGet("redpack/month")]
-    public virtual async Task<IList<RedPackOutDto>> QueryRedPackDateAsync([FromQuery] RedPacksInDto dto)
+    public async Task<IList<RedPackOutDto>> QueryRedPackDateAsync([FromQuery] RedPacksInDto dto)
         => await _snapshotApplication.GetRedPacksAsync(dto, HttpContext.RequestAborted);
 
     /// <summary>

+ 9 - 1
src/Hotline.Application.Tests/Application/SnapshotApplicationTest.cs

@@ -64,6 +64,14 @@ public class SnapshotApplicationTest : TestBase
         result.Industrys.First().DisplayOrder.ShouldBe(1, "排序异常");
     }
 
+    [Fact]
+    public async Task GetBulletionPopup_Test()
+    { 
+        var item = await _snapshotApplication.GetBulletionPopupAsync(CancellationToken.None);
+        item.ShouldNotBeNull();
+    }
+
+
     /// <summary>
     /// 添加随手拍公告
     /// </summary>
@@ -269,7 +277,7 @@ public class SnapshotApplicationTest : TestBase
     {
         var orderSnapshot = await _orderSnapshotRepository.Queryable()
             .OrderByDescending(m => m.CreationTime).FirstAsync();
-        var order = await _orderRepository.GetAsync(orderSnapshot.Id);
+        var order = await _orderRepository.GetAsync("08dd18e0-1c9e-4aa5-8dc6-f639e8d1b3ea");
         var token = new ThirdTokenDto { AppId = "TAjYAYuA", Secret = "c01eb299b9d784bf55681af4da86bab6ba428101" };
         var result = await _guiderSystemService.PostOrder(order, orderSnapshot, token);
         result.ShouldNotBeNull();

+ 5 - 0
src/Hotline.Application/Snapshot/ISnapshotApplication.cs

@@ -161,4 +161,9 @@ public interface ISnapshotApplication
     /// <param name="dto"></param>
     /// <returns></returns>
     Task SaveInvitationCodeAsync(SaveInvitationCodeInDto dto);
+
+    /// <summary>
+    /// 获取小程序首页弹窗
+    /// </summary>
+    Task<BulletinOutDto> GetBulletionPopupAsync(CancellationToken requestAborted);
 }

+ 19 - 0
src/Hotline.Application/Snapshot/SnapshotApplicationBase.cs

@@ -113,6 +113,25 @@ public abstract class SnapshotApplicationBase
         };
     }
 
+    /// <summary>
+    /// 获取小程序首页弹窗
+    /// </summary>
+    public async Task<BulletinOutDto> GetBulletionPopupAsync(CancellationToken requestAborted)
+    { 
+        var item = await _bulletinRepository.Queryable()
+            .Where(m => m.BulletinState == EBulletinState.ReviewPass)
+            .Where(m => m.BulletinTime <= DateTime.Now && m.IsPopup == true)
+            .OrderByDescending(m => m.CreationTime)
+            .Select(m => new BulletinOutDto
+            {
+                Id = m.Id,
+                Title = m.Title,
+                Content = m.Content
+            })
+            .FirstAsync(requestAborted);
+        return item;
+    }
+
     /// <summary>
     /// 获取行业集合
     /// </summary>

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

@@ -12,13 +12,25 @@ namespace Hotline.Snapshot;
 [Description("随手拍公告")]
 public class SnapshotBulletin : CreationEntity
 {
+    /// <summary>
+    /// 标题
+    /// </summary>
     public string Title { get; set; }
 
+    /// <summary>
+    /// 内容
+    /// </summary>
     [SugarColumn(ColumnDataType = "text")]
     public string Content { get; set; }
 
+    /// <summary>
+    /// 字典中添加类型Id
+    /// </summary>
     public string SnapshotBulletinTypeId { get; set; }
 
+    /// <summary>
+    /// 系统字典中添加类型名称
+    /// </summary>
     public string SnapshotBulletinTypeName { get; set; }
 
     /// <summary>
@@ -62,6 +74,17 @@ public class SnapshotBulletin : CreationEntity
     /// </summary>
     public bool? IsArrive { get; set; }
 
+    /// <summary>
+    /// 是否弹窗
+    /// </summary>
+    [SugarColumn(DefaultValue = "f")]
+    public bool IsPopup { get; set; }
+
+    /// <summary>
+    /// 通知时间
+    /// </summary>
+    public DateTime? BulletinTime { get; set; }
+
     /// <summary>
     /// 阅读量+1
     /// </summary>

+ 34 - 2
src/TianQue.Sdk/Models/AcceptInfo.cs

@@ -22,11 +22,23 @@ public class AcceptInfo
     [MaxLength(20)]
     public long OrgId { get; set; }
 
+    /// <summary>
+    /// 经度
+    /// </summary>
+    [Required]
+    public string Lon { get; set; }
+
+    /// <summary>
+    /// 维度
+    /// </summary>
+    [Required]
+    public string Lat { get; set; }
+
     /// <summary>
     /// 部门编码
     /// </summary>
-    [MaxLength(20)]
-    public string DepartmentNo { get; set; }
+    //[MaxLength(20)]
+    //public string DepartmentNo { get; set; }
 
     /// <summary>
     /// 诉求类型名称
@@ -70,6 +82,26 @@ public class AcceptInfo
     /// 反映人信息
     /// </summary>
     public IList<PersonInfo> PersonList { get; set; }
+
+    /// <summary>
+    /// 正式/测试
+    /// </summary>
+    public bool Prod { get; set; } = false;
+
+    /// <summary>
+    /// 热点分类(大类)
+    /// </summary>
+    public string RootCategoryInfo { get; set; }
+
+    /// <summary>
+    /// 热点分类(小类)
+    /// </summary>
+    public string CategoryInfo { get; set; }
+
+    /// <summary>
+    /// 截止时间
+    /// </summary>
+    public DateTime DeadLine { get; set; }
 }
 
 public class PersonInfo

+ 5 - 1
src/TianQue.Sdk/TQHttpClient.cs

@@ -66,7 +66,11 @@ public class TQHttpClient
         {
             var headers = new Dictionary<string, object> { { "_timeStamp", DateTime.Now.ToUnixTimeMilliseconds() }, { "_nonce", SignUtils.GenerateNonce() } };
             var sortedDic = new SortedDictionary<string, object>(data.ToDictionary());
-            var body = sortedDic.ToJson(new JsonSerializerSettings {ContractResolver = new CamelCasePropertyNamesContractResolver()});
+            var body = sortedDic.ToJson(new JsonSerializerSettings {
+                NullValueHandling = NullValueHandling.Ignore,
+                ContractResolver = new CamelCasePropertyNamesContractResolver(),
+                DateFormatString = "yyyy-MM-dd HH:mm:ss.fff"
+            });
             var postJsonSign = SignUtils.Sign(AppSecret, headers, body);
             headers.Add("_sign", postJsonSign);
             headers.Add("_appKey", AppKey);

+ 7 - 1
src/TianQue.Sdk/TiqnQueService.cs

@@ -50,12 +50,18 @@ public class TiqnQueService : IGuiderSystemService, IScopeDependency
         var acceptInfo = order.Adapt<AcceptInfo>();
         acceptInfo.ReplyCode = order.No!; // 唯一标识
         acceptInfo.OrgId = order.ActualHandleOrgAreaCode.NotNullOrEmpty() ? long.Parse(order.ActualHandleOrgAreaCode) : 0; // 区域Id
-        acceptInfo.DepartmentNo = order.ActualHandleOrgCode!; // 部门编码
+        // acceptInfo.DepartmentNo = order.ActualHandleOrgCode!; // 部门编码
         acceptInfo.TypeName = order.AcceptType!; // 诉求类型名称
         acceptInfo.OccurDate = order.CreationTime; // 事发时间
         acceptInfo.DetailAddress = order.FullAddress!; // 详细地址
         acceptInfo.Topic = order.Title!; // 线索主题
         acceptInfo.DetailContent = order.Content!; // 详细内容
+        acceptInfo.Lon = order.Longitude.ToString(); // 经度
+        acceptInfo.Lat = order.Latitude.ToString(); // 纬度
+        acceptInfo.RootCategoryInfo = order.HotspotName!; // 热点分类(大类)
+        acceptInfo.CategoryInfo = order.HotspotSpliceName!; // 热点分类(小类)
+        acceptInfo.DeadLine = DateTime.Now.AddDays(15); // 截止时间
+        acceptInfo.Prod = false; // 正式/测试
 
         // 反映人信息
         acceptInfo.PersonList = new List<PersonInfo>