11 changed files with 185 additions and 176 deletions
@ -0,0 +1,28 @@ |
|||
using BBWY.Server.Business; |
|||
using BBWY.Server.Model.Dto; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
|
|||
namespace BBWY.Server.API.Controllers |
|||
{ |
|||
public class AfterSaleOrderController : BaseApiController |
|||
{ |
|||
private AfterSaleOrderBusiness afterSaleOrderBusiness; |
|||
|
|||
public AfterSaleOrderController(IHttpContextAccessor httpContextAccessor, AfterSaleOrderBusiness afterSaleOrderBusiness) : base(httpContextAccessor) |
|||
{ |
|||
this.afterSaleOrderBusiness = afterSaleOrderBusiness; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 获取服务单列表
|
|||
/// </summary>
|
|||
/// <param name="request"></param>
|
|||
/// <returns></returns>
|
|||
[HttpPost] |
|||
public AfterSaleOrderListResponse GetAfterSaleOrderList([FromBody] SearchAfterSaleOrderRequest request) |
|||
{ |
|||
return afterSaleOrderBusiness.GetAfterSaleOrderList(request); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,74 @@ |
|||
using BBWY.Common.Models; |
|||
using BBWY.Server.Model.Db; |
|||
using BBWY.Server.Model.Dto; |
|||
using BBWY.Server.Model.Dto.Request; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using Yitter.IdGenerator; |
|||
|
|||
namespace BBWY.Server.Business |
|||
{ |
|||
public class AfterSaleOrderBusiness : BaseBusiness, IDenpendency |
|||
{ |
|||
public AfterSaleOrderBusiness(IFreeSql fsql, NLog.ILogger logger, IIdGenerator idGenerator) : base(fsql, logger, idGenerator) |
|||
{ |
|||
|
|||
} |
|||
|
|||
public AfterSaleOrderListResponse GetAfterSaleOrderList(SearchAfterSaleOrderRequest request) |
|||
{ |
|||
var select = fsql.Select<AfterSaleOrder, OrderSku>().InnerJoin((aso, osku) => aso.SkuId == osku.SkuId); |
|||
if (!string.IsNullOrEmpty(request.ServiceId)) |
|||
{ |
|||
select = select.Where((aso, osku) => aso.ServiceId == request.ServiceId); |
|||
} |
|||
else |
|||
{ |
|||
select = select.WhereIf(request.StartDate != null, (aso, osku) => aso.ApplyTime >= request.StartDate) |
|||
.WhereIf(request.EndDate != null, (aso, osku) => aso.ApplyTime <= request.EndDate) |
|||
.WhereIf(!string.IsNullOrEmpty(request.Spu), (aso, osku) => aso.ProductId == request.Spu) |
|||
.WhereIf(!string.IsNullOrEmpty(request.Sku), (aso, osku) => aso.SkuId == request.Sku) |
|||
.WhereIf(!string.IsNullOrEmpty(request.OrderId), (aso, osku) => aso.OrderId == request.OrderId); |
|||
} |
|||
select = select.Where((aso, osku) => aso.ShopId == request.ShopId) |
|||
.OrderByDescending((aso, osku) => aso.CreateTime) |
|||
.Count(out var total) |
|||
.Page(request.PageIndex, request.PageSize); |
|||
|
|||
var list = select.ToList((aso, osku) => new AfterSaleOrderResponse |
|||
{ |
|||
Id = aso.Id, |
|||
ApplyTime = aso.ApplyTime, |
|||
ConsumableAmount = aso.ConsumableAmount, |
|||
CreateTime = aso.CreateTime, |
|||
DeliveryExpressFreight = aso.DeliveryExpressFreight, |
|||
FirstFreight = aso.FirstFreight, |
|||
InStorageAmount = aso.InStorageAmount, |
|||
Logo = osku.Logo, |
|||
OrderId = aso.OrderId, |
|||
OutStorageAmount = aso.OutStorageAmount, |
|||
ProductHealth = aso.ProductHealth, |
|||
ProductId = aso.ProductId, |
|||
ProductResult = aso.ProductResult, |
|||
RefundAmount = aso.RefundAmount, |
|||
RefundInStorageAmount = aso.RefundInStorageAmount, |
|||
RefundPurchaseAmount = aso.RefundPurchaseAmount, |
|||
RefundTime = aso.RefundTime, |
|||
ReissueAfterSaleAmount = aso.ReissueAfterSaleAmount, |
|||
ReissueFreight = aso.ReissueFreight, |
|||
ReissueProductAmount = aso.ReissueProductAmount, |
|||
ServiceId = aso.ServiceId, |
|||
ServiceResult = aso.ServiceResult, |
|||
ShopId = aso.ShopId, |
|||
SkuId = aso.SkuId, |
|||
Title = osku.Title |
|||
}); |
|||
return new AfterSaleOrderListResponse() |
|||
{ |
|||
Count = total, |
|||
Items = list |
|||
}; |
|||
} |
|||
} |
|||
} |
@ -1,131 +0,0 @@ |
|||
using FreeSql.DatabaseModel;using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Reflection; |
|||
using System.Threading.Tasks; |
|||
using Newtonsoft.Json; |
|||
using FreeSql.DataAnnotations; |
|||
|
|||
namespace BBWY.Server.Model.Db { |
|||
|
|||
[JsonObject(MemberSerialization.OptIn), Table(Name = "aftersaleorder", DisableSyncStructure = true)] |
|||
public partial class Aftersaleorder { |
|||
|
|||
[JsonProperty, Column(IsPrimary = true)] |
|||
public long Id { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 耗材费
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "decimal(18,2)")] |
|||
public decimal? ConsumableAmount { get; set; } = 0.00M; |
|||
|
|||
[JsonProperty, Column(DbType = "datetime")] |
|||
public DateTime? CreateTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 发货快递费
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "decimal(18,2)")] |
|||
public decimal? DeliveryExpressFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 头程费
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "decimal(18,2)")] |
|||
public decimal? FirstFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 入仓操作费
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "decimal(18,2)")] |
|||
public decimal? InStorageAmount { get; set; } = 0.00M; |
|||
|
|||
[JsonProperty, Column(StringLength = 50)] |
|||
public string OrderId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 出仓操作费
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "decimal(18,2)")] |
|||
public decimal? OutStorageAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 商品情况
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "int(1)")] |
|||
public int? ProductHealth { get; set; } |
|||
|
|||
[JsonProperty, Column(StringLength = 50)] |
|||
public string ProductId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 商品处理方式
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "int(255)")] |
|||
public int? ProductResult { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 退款金额
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "decimal(20,2)")] |
|||
public decimal? RefundAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 退货入仓操作费
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "decimal(18,2)")] |
|||
public decimal? RefundInStorageAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 退款采购成本
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "decimal(18,2)")] |
|||
public decimal? RefundPurchaseAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 退款时间
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "datetime")] |
|||
public DateTime? RefundTime { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 售后补发成本
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "decimal(20,2)")] |
|||
public decimal? ReissueAfterSaleAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 补发快递费
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "decimal(20,2)")] |
|||
public decimal? ReissueFreight { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 补发货款成本
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "decimal(20,2)")] |
|||
public decimal? ReissueProductAmount { get; set; } = 0.00M; |
|||
|
|||
/// <summary>
|
|||
/// 服务单号
|
|||
/// </summary>
|
|||
[JsonProperty] |
|||
public long? ServiceId { get; set; } |
|||
|
|||
/// <summary>
|
|||
/// 服务单处理结果
|
|||
/// </summary>
|
|||
[JsonProperty, Column(DbType = "int(1)")] |
|||
public int? ServiceResult { get; set; } |
|||
|
|||
[JsonProperty] |
|||
public long? ShopId { get; set; } |
|||
|
|||
[JsonProperty, Column(StringLength = 50)] |
|||
public string SkuId { get; set; } |
|||
|
|||
} |
|||
|
|||
} |
@ -0,0 +1,27 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class SearchAfterSaleOrderRequest |
|||
{ |
|||
public long ShopId { get; set; } |
|||
|
|||
public string OrderId { get; set; } |
|||
|
|||
public DateTime? StartDate { get; set; } |
|||
|
|||
public DateTime? EndDate { get; set; } |
|||
|
|||
public string Spu { get; set; } |
|||
|
|||
public string Sku { get; set; } |
|||
|
|||
public string ServiceId { get; set; } |
|||
|
|||
public int PageIndex { get; set; } |
|||
|
|||
public int PageSize { get; set; } |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class AfterSaleOrderListResponse |
|||
{ |
|||
public long Count { get; set; } |
|||
|
|||
public IList<AfterSaleOrderResponse> Items { get; set; } |
|||
} |
|||
} |
@ -1,11 +1,11 @@ |
|||
using BBWY.Server.Model.Db; |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace BBWY.Server.Model.Dto |
|||
{ |
|||
public class AfterSaleOrderResponse : AfterSaleOrder |
|||
{ |
|||
public string Logo { get; set; } |
|||
|
|||
public string Title { get; set; } |
|||
} |
|||
} |
Loading…
Reference in new issue