فهرست منبع

发布代办新增查询条件

qinchaoyue 1 هفته پیش
والد
کامیت
60096f28a4

+ 4 - 0
src/Hotline.Api/Controllers/OrderController.cs

@@ -1175,6 +1175,10 @@ public class OrderController : BaseController
     {
         var rsp = new
         {
+            Industry = _systemSettingCacheManager.Snapshot ? await _industryRepository
+                    .Queryable()
+                    .Select(d => new { d.Id, d.Name, }).ToListAsync() 
+                : null,
             ChannelOptions = _sysDicDataCacheManager.GetSysDicDataCache(TimeLimitBaseDataConsts.SourceChannel),
             AcceptTypeOptions = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.AcceptType),
             OrderTags = _sysDicDataCacheManager.GetSysDicDataCache(SysDicTypeConsts.OrderTag)

+ 8 - 0
src/Hotline.Application/OrderApp/OrderApplication.cs

@@ -46,6 +46,7 @@ using Hotline.Share.Enums.Settings;
 using Hotline.Share.Mq;
 using Hotline.Share.Requests;
 using Hotline.Share.Tools;
+using Hotline.Snapshot;
 using Hotline.Snapshot.IRepository;
 using Hotline.Statistics;
 using Hotline.Tools;
@@ -805,6 +806,13 @@ public class OrderApplication : IOrderApplication, IScopeDependency
     public ISugarQueryable<Order> GetPublishOrderList(QueryOrderPublishDto dto)
     {
         var query = _orderRepository.Queryable().Includes(d => d.OrderTags);
+        if (_systemSettingCacheManager.Snapshot)
+        {
+            query = query.LeftJoin<OrderSnapshot>((d, snapshot) => d.Id == snapshot.Id)
+                .WhereIF(dto.IndustryId.NotNullOrEmpty(), (d, snapshot) => snapshot.IndustryId == dto.IndustryId)
+                .WhereIF(dto.IsRectifyDepartment.HasValue, (d, snapshot) => snapshot.IsRectifyDepartment == dto.IsRectifyDepartment)
+                .WhereIF(dto.IsDangerDepartment.HasValue, (d, snapshot) => snapshot.IsDangerDepartment == dto.IsDangerDepartment);
+        }
         if (_appOptions.Value.IsLuZhou)
             query = query.Includes(d => d.FwCallRecord);
         //.Includes(d => d.OrderPublish)

+ 15 - 0
src/Hotline.Share/Dtos/Order/Publish/QueryOrderPublishDto.cs

@@ -162,4 +162,19 @@ public record QueryOrderPublishDto : PagedKeywordRequest
     /// 省来源分类 1:政民互动直派 2:政民互动  3:省12345
     /// </summary>
     public string? ProvinceChannel { get; set; }
+
+    /// <summary>
+    /// 随手拍行业Id
+    /// </summary>
+    public string? IndustryId { get; set; }
+
+    /// <summary>
+    /// 是否整改;
+    /// </summary>
+    public bool? IsRectifyDepartment { get; set; }
+
+    /// <summary>
+    /// 是否存在安全隐患
+    /// </summary>
+    public bool? IsDangerDepartment { get; set; }
 }

+ 17 - 0
test/Hotline.Tests/Application/OrderApplicationTest.cs

@@ -4,8 +4,10 @@ using Hotline.Early;
 using Hotline.Orders;
 using Hotline.Push.FWMessage;
 using Hotline.Push.Notifies;
+using Hotline.Repository.SqlSugar.Extensions;
 using Hotline.Settings;
 using Hotline.Share.Dtos.Order;
+using Hotline.Share.Dtos.Order.Publish;
 using Hotline.Share.Dtos.Settings;
 using Hotline.Share.Enums.Order;
 using Mapster;
@@ -64,4 +66,19 @@ public class OrderApplicationTest
         var b = a.Adapt<SystemDicDataOutDto>();
         b.ShouldNotBeNull();
     }
+
+    [Fact]
+    public async Task GetPublishOrderList_Test()
+    { 
+        var inDto = new QueryOrderPublishDto
+        {
+            StartTime = DateTime.Now.AddDays(-30),
+            EndTime = DateTime.Now,
+            PageSize = 10,
+            PageIndex = 1,
+        };
+
+        var items = await _orderApplication.GetPublishOrderList(inDto).ToPagedListAsync(inDto);
+        items.Total.ShouldNotBe(0);
+    }
 }