xf 1 year ago
parent
commit
34aa74af2b

+ 29 - 18
src/Hotline.Api/Controllers/OrderController.cs

@@ -607,20 +607,20 @@ public class OrderController : BaseController
         return rsp;
     }
 
-	/// <summary>
-	/// 甄别详情
-	/// </summary>
-	/// <param name="id"></param>
-	/// <returns></returns>
-	[Permission(EPermission.ScreenEntity)]
-	[HttpGet("screen/{id}")]
-	public async Task<OrderScreen> ScreenEntity(string id)
-	{
-		return await _orderScreenRepository.Queryable()
-			.Includes(x => x.Visit, d=>d.Order)
-			.FirstAsync(x => x.Id == id);
-	}
-	#endregion
+    /// <summary>
+    /// 甄别详情
+    /// </summary>
+    /// <param name="id"></param>
+    /// <returns></returns>
+    [Permission(EPermission.ScreenEntity)]
+    [HttpGet("screen/{id}")]
+    public async Task<OrderScreen> ScreenEntity(string id)
+    {
+        return await _orderScreenRepository.Queryable()
+            .Includes(x => x.Visit, d => d.Order)
+            .FirstAsync(x => x.Id == id);
+    }
+    #endregion
 
     #region 工单督办
 
@@ -637,7 +637,7 @@ public class OrderController : BaseController
             .Includes(x => x.Order)
             .Includes(x => x.CrUser)
             .Includes(x => x.ReUser)
-			.WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Order.Title.Contains(dto.Keyword!) || d.Order.No.Contains(dto.Keyword!))
+            .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Order.Title.Contains(dto.Keyword!) || d.Order.No.Contains(dto.Keyword!))
             .WhereIF(dto.SuperviseState > 0, x => x.State == dto.SuperviseState)
             .WhereIF(dto.CreationTimeStart.HasValue, d => d.CreationTime >= dto.CreationTimeStart)
             .WhereIF(dto.CreationTimeEnd.HasValue, d => d.CreationTime <= dto.CreationTimeEnd)
@@ -741,7 +741,7 @@ public class OrderController : BaseController
             .Includes(x => x.Order)
             .Includes(x => x.CrUser)
             .Includes(x => x.ReUser)
-			.WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Order.Title.Contains(dto.Keyword!) || d.Order.No.Contains(dto.Keyword!))
+            .WhereIF(!string.IsNullOrEmpty(dto.Keyword), d => d.Order.Title.Contains(dto.Keyword!) || d.Order.No.Contains(dto.Keyword!))
             .WhereIF(dto.SuperviseState > 0, x => x.State == dto.SuperviseState)
             .WhereIF(dto.CreationTimeStart.HasValue, d => d.CreationTime >= dto.CreationTimeStart)
             .WhereIF(dto.CreationTimeEnd.HasValue, d => d.CreationTime <= dto.CreationTimeEnd)
@@ -1150,10 +1150,21 @@ public class OrderController : BaseController
 
         var dtos = _mapper.Map<IReadOnlyList<OrderWaitedDto>>(items);
 
-        //todo calc expired description
+        //calc expired description
+        var now = DateTime.Now;
         foreach (var waitedDto in dtos)
         {
-            //waitedDto.ExpiredDescription = 
+            var ts = waitedDto.ExpiredTime - now;
+            if (ts.Value.TotalDays <= 0)
+            {
+                //已超期
+                waitedDto.ExpiredDescription = $"已超期{Math.Abs(ts.Value.TotalDays):F1}天";
+            }
+            else
+            {
+                //未超期
+                waitedDto.ExpiredDescription = $"{ts.Value.TotalDays:F1}天后超期";
+            }
         }
 
         return new PagedDto<OrderWaitedDto>(total, dtos);

+ 4 - 2
src/Hotline.Application/Mappers/OrderMapperConfigs.cs

@@ -65,8 +65,10 @@ public class OrderMapperConfigs : IRegister
             .IgnoreIf((s, d) => s.OrderPublish == null, d => d.ArrangeContent)
             .Map(d => d.PublishState, s => s.OrderPublish.PublishState)
             .Map(d => d.ArrangeContent, s => s.OrderPublish.ArrangeContent)
-            //.Map(d => d.PublishState, s => s.OrderPublish.PublishState)
             ;
-            
+
+        config.ForType<Order, OrderWaitedDto>()
+            .Inherits<Order, OrderDto>();
+
     }
 }