mirror of https://github.com/EasyAbp/EShop.git
13 changed files with 4938 additions and 2 deletions
@ -0,0 +1,13 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using EasyAbp.EShop.Orders.Orders.Dtos; |
|||
using EasyAbp.EShop.Products.Products.Dtos; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public interface IOrderExtraFeeProvider |
|||
{ |
|||
Task<OrderExtraFeeInfoModel> GetAsync(Guid customerUserId, CreateOrderDto input, Dictionary<Guid, ProductDto> productDict); |
|||
} |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
using JetBrains.Annotations; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public class OrderExtraFeeInfoModel |
|||
{ |
|||
[NotNull] |
|||
public string Name { get; set; } |
|||
|
|||
[CanBeNull] |
|||
public string Key { get; set; } |
|||
|
|||
public decimal Fee { get; set; } |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public class DuplicateOrderExtraFeeException : BusinessException |
|||
{ |
|||
public DuplicateOrderExtraFeeException(string extraFeeName, string extraFeeKey) |
|||
: base("DuplicateOrderExtraFee", $"The extra fee {extraFeeName} (key: {extraFeeKey}) is existed.") |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,12 @@ |
|||
using Volo.Abp; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public class InvalidOrderExtraFeeException : BusinessException |
|||
{ |
|||
public InvalidOrderExtraFeeException(decimal extraFee) |
|||
: base("InvalidExtraFee", $"The extra fee {extraFee} is invalid.") |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,40 @@ |
|||
using System; |
|||
using JetBrains.Annotations; |
|||
using Volo.Abp.Domain.Entities; |
|||
|
|||
namespace EasyAbp.EShop.Orders.Orders |
|||
{ |
|||
public class OrderExtraFee : Entity |
|||
{ |
|||
public virtual Guid OrderId { get; protected set; } |
|||
|
|||
[NotNull] |
|||
public virtual string Name { get; protected set; } |
|||
|
|||
[CanBeNull] |
|||
public virtual string Key { get; protected set; } |
|||
|
|||
public virtual decimal Fee { get; protected set; } |
|||
|
|||
protected OrderExtraFee() |
|||
{ |
|||
} |
|||
|
|||
public OrderExtraFee( |
|||
Guid orderId, |
|||
[NotNull] string name, |
|||
[CanBeNull] string key, |
|||
decimal fee) |
|||
{ |
|||
OrderId = orderId; |
|||
Name = name; |
|||
Key = key; |
|||
Fee = fee; |
|||
} |
|||
|
|||
public override object[] GetKeys() |
|||
{ |
|||
return new object[] {OrderId, Name, Key}; |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,37 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace EShopSample.Migrations |
|||
{ |
|||
public partial class AddedOrderExtraFee : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.CreateTable( |
|||
name: "EasyAbpEShopOrdersOrderExtraFees", |
|||
columns: table => new |
|||
{ |
|||
OrderId = table.Column<Guid>(nullable: false), |
|||
Name = table.Column<string>(nullable: false), |
|||
Key = table.Column<string>(nullable: false), |
|||
Fee = table.Column<decimal>(type: "decimal(20,8)", nullable: false) |
|||
}, |
|||
constraints: table => |
|||
{ |
|||
table.PrimaryKey("PK_EasyAbpEShopOrdersOrderExtraFees", x => new { x.OrderId, x.Name, x.Key }); |
|||
table.ForeignKey( |
|||
name: "FK_EasyAbpEShopOrdersOrderExtraFees_EasyAbpEShopOrdersOrders_OrderId", |
|||
column: x => x.OrderId, |
|||
principalTable: "EasyAbpEShopOrdersOrders", |
|||
principalColumn: "Id", |
|||
onDelete: ReferentialAction.Cascade); |
|||
}); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropTable( |
|||
name: "EasyAbpEShopOrdersOrderExtraFees"); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue