Browse Source

fixed: address is null

xf 1 year ago
parent
commit
73a8dbd0db

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

@@ -2160,6 +2160,7 @@ public class OrderController : BaseController
     [LogFilter("新增工单")]
     public async Task<string> Add([FromBody] AddOrderDto dto)
     {
+        dto.InitAddress();
         //todo dto validation
 
         if (!string.IsNullOrEmpty(dto.CallId))
@@ -2260,6 +2261,7 @@ public class OrderController : BaseController
     [LogFilter("更新工单")]
     public async Task Update([FromBody] UpdateOrderDto dto)
     {
+        dto.InitAddress();
         var order = await _orderRepository.Queryable()
             .FirstAsync(d => d.Id == dto.Id);
         if (order == null)

+ 1 - 1
src/Hotline.Share/Dtos/Order/OrderStartFlowDto.cs

@@ -11,7 +11,7 @@ namespace Hotline.Share.Dtos.Order
 {
     public class OrderStartFlowDto : StartWorkflowDto<UpdateOrderDto>
     {
-
+        
     }
 
     public class ScreenStartFlowDto : StartWorkflowDto<OrderScreenDto>

+ 9 - 0
src/Hotline.Share/Dtos/Position.cs

@@ -51,4 +51,13 @@ public class Position
     /// 完整地址
     /// </summary>
     public string? FullAddress { get; set; }
+
+    public void InitAddress()
+    {
+        if (string.IsNullOrEmpty(Address))
+        {
+            Address = $"{Province}{City}{County}{Town}";
+            FullAddress = $"{Address}{Street}";
+        }
+    }
 }

+ 0 - 6
src/XF.Domain.Repository/Entity.cs

@@ -252,12 +252,6 @@ public abstract class WorkflowEntity : FullStateEntity, IWorkflow
 
 public abstract class PositionEntity : FullStateEntity
 {
-    public PositionEntity()
-    {
-        Address ??= $"{Province}{City}{County}{Town}";
-        FullAddress ??= $"{Address}{Street}";
-    }
-
     /// <summary>
     /// 经度
     /// </summary>