diff --git a/Myshipping.Application/Entity/ExpressDeliveryOrder.cs b/Myshipping.Application/Entity/ExpressDeliveryOrder.cs index 1e6241a0..a165d7ee 100644 --- a/Myshipping.Application/Entity/ExpressDeliveryOrder.cs +++ b/Myshipping.Application/Entity/ExpressDeliveryOrder.cs @@ -28,10 +28,6 @@ namespace Myshipping.Application.Entity /// public string CurrentStateDesc { get; set; } /// - /// 快递状态 - /// - public string State { get; set; } - /// /// 快递公司 /// public string KDCompany { get; set; } diff --git a/Myshipping.Application/Service/ExpressDelivery/ExpressDeliveryService.cs b/Myshipping.Application/Service/ExpressDelivery/ExpressDeliveryService.cs index 1d65b1a0..9a9295a4 100644 --- a/Myshipping.Application/Service/ExpressDelivery/ExpressDeliveryService.cs +++ b/Myshipping.Application/Service/ExpressDelivery/ExpressDeliveryService.cs @@ -257,6 +257,48 @@ namespace Myshipping.Application return await Get(entity.Id); } + /// + /// 获取当前登陆人的寄件信息(最后一次寄件信息或登陆人的个人信息) + /// + [HttpGet("GetSenderInfo")] + public async Task GetSenderInfo() + { + var order = await _orderRep.AsQueryable() + .Where(o => o.CreatedUserId == UserManager.UserId) + .OrderBy(o => o.Id, OrderByType.Desc) + .FirstAsync(); + + // 如果当前登陆人没有创建过快递订单,则只返回当前登陆人所在公司;否则返回最新一条快递单的寄件人信息 + if (order != null) + { + return new + { + expressDeliveryAddressDto = new ExpressDeliveryAddressDto() + { + Address = order.FJAddress, + City = order.FJCity, + Company = order.FJCompany, + People = order.FJPeople, + Province = order.FJProvince, + ProvinceId = order.FJProvinceId, + Tel = order.FJTel, + Type = 2 + } + }; + } + else + { + return new + { + expressDeliveryAddressDto = new ExpressDeliveryAddressDto() + { + Company = UserManager.TENANT_NAME, + People = UserManager.Name, + Type = 2 + } + }; + } + } /// /// 删除单据