Browse Source

Merge remote-tracking branch 'origin/dev' into dev

pull/57/head
gdlcf88 6 years ago
parent
commit
213406266a
  1. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj
  2. 1
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/Order.cs
  3. 4
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersMenuContributor.cs
  4. 2
      modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/Index.cshtml
  5. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/cs.json
  6. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/en.json
  7. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/pl.json
  8. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/pt-BR.json
  9. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/sl.json
  10. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/tr.json
  11. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/vi.json
  12. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/zh-Hans.json
  13. 4
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/zh-Hant.json
  14. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp.EShop.Payments.Domain.csproj
  15. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/Pages/EShop/Payments/Payments/Payment/Index.cshtml
  16. 2
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/Pages/EShop/Payments/Refunds/Refund/Index.cshtml
  17. 6
      modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/PaymentsMenuContributor.cs
  18. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductDto.cs
  19. 16
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductSkuDto.cs
  20. 54
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs
  21. 8
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs
  22. 11
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductDiscountManager.cs
  23. 10
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductDiscountProvider.cs
  24. 7
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductPriceProvider.cs
  25. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductRepository.cs
  26. 3
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs
  27. 1
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductAttribute.cs
  28. 22
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductDiscountManager.cs
  29. 41
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Products/ProductRepository.cs
  30. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Categories/Category/Index.cshtml
  31. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/ProductTypes/ProductType/Index.cshtml
  32. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml
  33. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/Index.cshtml
  34. 8
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/ProductsMenuContributor.cs
  35. 4
      modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/StoresMenuContributor.cs
  36. 4
      samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj
  37. 4
      samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj
  38. 4
      samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj
  39. 4
      samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj
  40. 4
      samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EShopSample.EntityFrameworkCore.csproj
  41. 4
      samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSample.HttpApi.Client.csproj
  42. 4
      samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSample.HttpApi.csproj
  43. 4
      samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp.EShop.Orders.Domain.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="0.3.6" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="2.9.0" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="2.9.0" />
<ProjectReference Include="..\..\..\EasyAbp.EShop.Payments\src\EasyAbp.EShop.Payments.Domain.Shared\EasyAbp.EShop.Payments.Domain.Shared.csproj" />

1
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Domain/EasyAbp/EShop/Orders/Orders/Order.cs

@ -53,7 +53,6 @@ namespace EasyAbp.EShop.Orders.Orders
protected Order()
{
OrderLines = new List<OrderLine>();
}
public Order(

4
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/OrdersMenuContributor.cs

@ -24,7 +24,7 @@ namespace EasyAbp.EShop.Orders.Web
{
var l = context.GetLocalizer<OrdersResource>(); //Add main menu items.
var orderManagementMenuItem = new ApplicationMenuItem("OrderManagement", l["Menu:OrderManagement"]);
var orderManagementMenuItem = new ApplicationMenuItem("EasyAbpEShopOrders", l["Menu:OrderManagement"]);
if (await context.IsGrantedAsync(OrdersPermissions.Orders.Manage))
{
@ -33,7 +33,7 @@ namespace EasyAbp.EShop.Orders.Web
var defaultStore = (await storeAppService.GetDefaultAsync())?.Id;
orderManagementMenuItem.AddItem(
new ApplicationMenuItem("Order", l["Menu:Order"], "/EShop/Orders/Orders/Order?storeId=" + defaultStore)
new ApplicationMenuItem("EasyAbpEShopOrdersOrder", l["Menu:Order"], "/EShop/Orders/Orders/Order?storeId=" + defaultStore)
);
}

2
modules/EasyAbp.EShop.Orders/src/EasyAbp.EShop.Orders.Web/Pages/EShop/Orders/Orders/Order/Index.cshtml

@ -7,7 +7,7 @@
@{
PageLayout.Content.Title = L["Order"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:Order"].Value);
PageLayout.Content.MenuItemName = "Order";
PageLayout.Content.MenuItemName = "EasyAbpEShopOrdersOrder";
var cardTitle = @L["Order"].Value;

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/cs.json

@ -5,7 +5,7 @@
"Permission:Create": "Create",
"Permission:Update": "Update",
"Permission:Delete": "Delete",
"Menu:Payments": "MenuPayments",
"Menu:Payment": "MenuPayments",
"Payment": "Payment",
"PaymentStoreId": "PaymentStoreId",
"CreatePayment": "CreatePayment",
@ -21,7 +21,7 @@
"PaymentItemRefundAmount": "PaymentItemRefundAmount",
"SuccessfullyDeleted": "Successfully deleted",
"Permission:Refunds": "Refunds",
"Menu:Refunds": "MenuRefunds",
"Menu:Refund": "MenuRefunds",
"Refund": "Refund",
"RefundStoreId": "RefundStoreId",
"CreateRefund": "CreateRefund",

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/en.json

@ -6,7 +6,7 @@
"Permission:Create": "Create",
"Permission:Update": "Update",
"Permission:Delete": "Delete",
"Menu:Payments": "MenuPayments",
"Menu:Payment": "MenuPayments",
"Payment": "Payment",
"PaymentStoreId": "PaymentStoreId",
"CreatePayment": "CreatePayment",
@ -22,7 +22,7 @@
"PaymentItemRefundAmount": "PaymentItemRefundAmount",
"SuccessfullyDeleted": "Successfully deleted",
"Permission:Refunds": "Refunds",
"Menu:Refunds": "MenuRefunds",
"Menu:Refund": "MenuRefunds",
"Refund": "Refund",
"RefundStoreId": "RefundStoreId",
"CreateRefund": "CreateRefund",

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/pl.json

@ -5,7 +5,7 @@
"Permission:Create": "Create",
"Permission:Update": "Update",
"Permission:Delete": "Delete",
"Menu:Payments": "MenuPayments",
"Menu:Payment": "MenuPayments",
"Payment": "Payment",
"PaymentStoreId": "PaymentStoreId",
"CreatePayment": "CreatePayment",
@ -21,7 +21,7 @@
"PaymentItemRefundAmount": "PaymentItemRefundAmount",
"SuccessfullyDeleted": "Successfully deleted",
"Permission:Refunds": "Refunds",
"Menu:Refunds": "MenuRefunds",
"Menu:Refund": "MenuRefunds",
"Refund": "Refund",
"RefundStoreId": "RefundStoreId",
"CreateRefund": "CreateRefund",

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/pt-BR.json

@ -5,7 +5,7 @@
"Permission:Create": "Create",
"Permission:Update": "Update",
"Permission:Delete": "Delete",
"Menu:Payments": "MenuPayments",
"Menu:Payment": "MenuPayments",
"Payment": "Payment",
"PaymentStoreId": "PaymentStoreId",
"CreatePayment": "CreatePayment",
@ -21,7 +21,7 @@
"PaymentItemRefundAmount": "PaymentItemRefundAmount",
"SuccessfullyDeleted": "Successfully deleted",
"Permission:Refunds": "Refunds",
"Menu:Refunds": "MenuRefunds",
"Menu:Refund": "MenuRefunds",
"Refund": "Refund",
"RefundStoreId": "RefundStoreId",
"CreateRefund": "CreateRefund",

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/sl.json

@ -6,7 +6,7 @@
"Permission:Create": "Create",
"Permission:Update": "Update",
"Permission:Delete": "Delete",
"Menu:Payments": "MenuPayments",
"Menu:Payment": "MenuPayments",
"Payment": "Payment",
"PaymentStoreId": "PaymentStoreId",
"CreatePayment": "CreatePayment",
@ -22,7 +22,7 @@
"PaymentItemRefundAmount": "PaymentItemRefundAmount",
"SuccessfullyDeleted": "Successfully deleted",
"Permission:Refunds": "Refunds",
"Menu:Refunds": "MenuRefunds",
"Menu:Refund": "MenuRefunds",
"Refund": "Refund",
"RefundStoreId": "RefundStoreId",
"CreateRefund": "CreateRefund",

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/tr.json

@ -6,7 +6,7 @@
"Permission:Create": "Create",
"Permission:Update": "Update",
"Permission:Delete": "Delete",
"Menu:Payments": "MenuPayments",
"Menu:Payment": "MenuPayments",
"Payment": "Payment",
"PaymentStoreId": "PaymentStoreId",
"CreatePayment": "CreatePayment",
@ -22,7 +22,7 @@
"PaymentItemRefundAmount": "PaymentItemRefundAmount",
"SuccessfullyDeleted": "Successfully deleted",
"Permission:Refunds": "Refunds",
"Menu:Refunds": "MenuRefunds",
"Menu:Refund": "MenuRefunds",
"Refund": "Refund",
"RefundStoreId": "RefundStoreId",
"CreateRefund": "CreateRefund",

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/vi.json

@ -5,7 +5,7 @@
"Permission:Create": "Create",
"Permission:Update": "Update",
"Permission:Delete": "Delete",
"Menu:Payments": "MenuPayments",
"Menu:Payment": "MenuPayments",
"Payment": "Payment",
"PaymentStoreId": "PaymentStoreId",
"CreatePayment": "CreatePayment",
@ -21,7 +21,7 @@
"PaymentItemRefundAmount": "PaymentItemRefundAmount",
"SuccessfullyDeleted": "Successfully deleted",
"Permission:Refunds": "Refunds",
"Menu:Refunds": "MenuRefunds",
"Menu:Refund": "MenuRefunds",
"Refund": "Refund",
"RefundStoreId": "RefundStoreId",
"CreateRefund": "CreateRefund",

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/zh-Hans.json

@ -6,7 +6,7 @@
"Permission:Create": "Create",
"Permission:Update": "Update",
"Permission:Delete": "Delete",
"Menu:Payments": "MenuPayments",
"Menu:Payment": "MenuPayments",
"Payment": "Payment",
"PaymentStoreId": "PaymentStoreId",
"CreatePayment": "CreatePayment",
@ -22,7 +22,7 @@
"PaymentItemRefundAmount": "PaymentItemRefundAmount",
"SuccessfullyDeleted": "Successfully deleted",
"Permission:Refunds": "Refunds",
"Menu:Refunds": "MenuRefunds",
"Menu:Refund": "MenuRefunds",
"Refund": "Refund",
"RefundStoreId": "RefundStoreId",
"CreateRefund": "CreateRefund",

4
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain.Shared/EasyAbp/EShop/Payments/Localization/Payments/zh-Hant.json

@ -6,7 +6,7 @@
"Permission:Create": "Create",
"Permission:Update": "Update",
"Permission:Delete": "Delete",
"Menu:Payments": "MenuPayments",
"Menu:Payment": "MenuPayments",
"Payment": "Payment",
"PaymentStoreId": "PaymentStoreId",
"CreatePayment": "CreatePayment",
@ -22,7 +22,7 @@
"PaymentItemRefundAmount": "PaymentItemRefundAmount",
"SuccessfullyDeleted": "Successfully deleted",
"Permission:Refunds": "Refunds",
"Menu:Refunds": "MenuRefunds",
"Menu:Refund": "MenuRefunds",
"Refund": "Refund",
"RefundStoreId": "RefundStoreId",
"CreateRefund": "CreateRefund",

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Domain/EasyAbp.EShop.Payments.Domain.csproj

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="0.3.6" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="2.9.0" />
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="2.9.0" />
<ProjectReference Include="..\..\..\EasyAbp.EShop.Stores\src\EasyAbp.EShop.Stores.Domain.Shared\EasyAbp.EShop.Stores.Domain.Shared.csproj" />

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/Pages/EShop/Payments/Payments/Payment/Index.cshtml

@ -10,7 +10,7 @@
@{
PageLayout.Content.Title = L["Payment"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:Payment"].Value);
PageLayout.Content.MenuItemName = "Payment";
PageLayout.Content.MenuItemName = "EasyAbpEShopPaymentsPayment";
var cardTitle = @L["Payment"].Value;

2
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/Pages/EShop/Payments/Refunds/Refund/Index.cshtml

@ -10,7 +10,7 @@
@{
PageLayout.Content.Title = L["Refund"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:Refund"].Value);
PageLayout.Content.MenuItemName = "Refund";
PageLayout.Content.MenuItemName = "EasyAbpEShopPaymentsRefund";
var cardTitle = @L["Refund"].Value;

6
modules/EasyAbp.EShop.Payments/src/EasyAbp.EShop.Payments.Web/PaymentsMenuContributor.cs

@ -35,7 +35,7 @@ namespace EasyAbp.EShop.Payments.Web
{
var l = context.GetLocalizer<PaymentsResource>(); //Add main menu items.
var paymentManagementMenuItem = new ApplicationMenuItem("PaymentManagement", l["Menu:PaymentManagement"]);
var paymentManagementMenuItem = new ApplicationMenuItem("EasyAbpEShopPayments", l["Menu:PaymentManagement"]);
var storeAppService = context.ServiceProvider.GetRequiredService<IStoreAppService>();
@ -44,13 +44,13 @@ namespace EasyAbp.EShop.Payments.Web
if (await context.IsGrantedAsync(PaymentsPermissions.Payments.Manage))
{
paymentManagementMenuItem.AddItem(
new ApplicationMenuItem("Payments", l["Menu:Payments"], "/EShop/Payments/Payments/Payment?storeId=" + defaultStore)
new ApplicationMenuItem("EasyAbpEShopPaymentsPayment", l["Menu:Payment"], "/EShop/Payments/Payments/Payment?storeId=" + defaultStore)
);
}
if (await context.IsGrantedAsync(PaymentsPermissions.Refunds.Manage))
{
paymentManagementMenuItem.AddItem(
new ApplicationMenuItem("Refunds", l["Menu:Refunds"], "/EShop/Payments/Refunds/Refund?storeId=" + defaultStore)
new ApplicationMenuItem("EasyAbpEShopPaymentsRefund", l["Menu:Refund"], "/EShop/Payments/Refunds/Refund?storeId=" + defaultStore)
);
}

4
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductDto.cs

@ -28,6 +28,10 @@ namespace EasyAbp.EShop.Products.Products.Dtos
public bool IsStatic { get; set; }
public bool IsHidden { get; set; }
public decimal? MinimumPrice { get; set; }
public decimal? MaximumPrice { get; set; }
public ICollection<ProductAttributeDto> ProductAttributes { get; set; }

16
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductSkuDto.cs

@ -13,10 +13,26 @@ namespace EasyAbp.EShop.Products.Products.Dtos
public decimal? OriginalPrice { get; set; }
/// <summary>
/// Price property in the ProductSku entity.
/// </summary>
public decimal Price { get; set; }
/// <summary>
/// Price from IProductDiscountManager
/// </summary>
public decimal DiscountedPrice { get; set; }
/// <summary>
/// Inventory property in the ProductSku entity.
/// </summary>
public int Inventory { get; set; }
/// <summary>
/// Inventory provider's inventory quantity (same as Inventory property if there is no provider).
/// </summary>
public int RealInventory { get; set; }
public int Sold { get; set; }
public int OrderMinQuantity { get; set; }

54
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/Products/ProductAppService.cs

@ -25,6 +25,7 @@ namespace EasyAbp.EShop.Products.Products
protected override string GetListPolicyName { get; set; } = null;
private readonly IProductManager _productManager;
private readonly IProductDiscountManager _productDiscountManager;
private readonly IProductInventoryProvider _productInventoryProvider;
private readonly IAttributeOptionIdsSerializer _attributeOptionIdsSerializer;
private readonly IProductStoreRepository _productStoreRepository;
@ -33,6 +34,7 @@ namespace EasyAbp.EShop.Products.Products
public ProductAppService(
IProductManager productManager,
IProductDiscountManager productDiscountManager,
IProductInventoryProvider productInventoryProvider,
IAttributeOptionIdsSerializer attributeOptionIdsSerializer,
IProductStoreRepository productStoreRepository,
@ -40,6 +42,7 @@ namespace EasyAbp.EShop.Products.Products
IProductRepository repository) : base(repository)
{
_productManager = productManager;
_productDiscountManager = productDiscountManager;
_productInventoryProvider = productInventoryProvider;
_attributeOptionIdsSerializer = attributeOptionIdsSerializer;
_productStoreRepository = productStoreRepository;
@ -50,8 +53,8 @@ namespace EasyAbp.EShop.Products.Products
protected override IQueryable<Product> CreateFilteredQuery(GetProductListDto input)
{
var query = input.CategoryId.HasValue
? _repository.GetQueryable(input.StoreId, input.CategoryId.Value)
: _repository.GetQueryable(input.StoreId);
? _repository.WithDetails(input.StoreId, input.CategoryId.Value)
: _repository.WithDetails(input.StoreId);
return input.ShowHidden ? query : query.Where(x => !x.IsHidden);
}
@ -198,6 +201,7 @@ namespace EasyAbp.EShop.Products.Products
}
await LoadRealInventoriesAsync(product, dto, storeId);
await LoadPricesAsync(product, dto, storeId);
dto.CategoryIds = (await _productCategoryRepository.GetListByProductIdAsync(dto.Id))
.Select(x => x.CategoryId).ToList();
@ -226,18 +230,6 @@ namespace EasyAbp.EShop.Products.Products
return dto;
}
protected virtual async Task<ProductDto> LoadRealInventoriesAsync(Product product, ProductDto productDto, Guid storeId)
{
var inventoryDict = await _productInventoryProvider.GetInventoryDictionaryAsync(product, storeId);
foreach (var productSkuDto in productDto.ProductSkus)
{
productSkuDto.Inventory = inventoryDict[productSkuDto.Id];
}
return productDto;
}
public override async Task<PagedResultDto<ProductDto>> GetListAsync(GetProductListDto input)
{
await CheckGetListPolicyAsync();
@ -250,6 +242,7 @@ namespace EasyAbp.EShop.Products.Products
throw new NotAllowedToGetProductListWithShowHiddenException();
}
// Todo: Products cache.
var query = CreateFilteredQuery(input);
if (!isCurrentUserStoreAdmin)
@ -268,11 +261,42 @@ namespace EasyAbp.EShop.Products.Products
foreach (var product in products)
{
items.Add(await LoadRealInventoriesAsync(product, MapToGetListOutputDto(product), input.StoreId));
var productDto = MapToGetListOutputDto(product);
await LoadRealInventoriesAsync(product, productDto, input.StoreId);
await LoadPricesAsync(product, productDto, input.StoreId);
items.Add(productDto);
}
return new PagedResultDto<ProductDto>(totalCount, items);
}
protected virtual async Task<ProductDto> LoadRealInventoriesAsync(Product product, ProductDto productDto, Guid storeId)
{
var inventoryDict = await _productInventoryProvider.GetInventoryDictionaryAsync(product, storeId);
foreach (var productSkuDto in productDto.ProductSkus)
{
productSkuDto.RealInventory = inventoryDict[productSkuDto.Id];
}
return productDto;
}
protected virtual async Task<ProductDto> LoadPricesAsync(Product product, ProductDto productDto, Guid storeId)
{
foreach (var productSkuDto in productDto.ProductSkus)
{
productSkuDto.DiscountedPrice = await _productDiscountManager.GetDiscountedPriceAsync(product,
product.ProductSkus.Single(sku => sku.Id == productSkuDto.Id), storeId);
}
productDto.MinimumPrice = productDto.ProductSkus.Select(sku => sku.Price).Min();
productDto.MaximumPrice = productDto.ProductSkus.Select(sku => sku.Price).Max();
return productDto;
}
public async Task DeleteAsync(Guid id, Guid storeId)
{

8
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application/EasyAbp/EShop/Products/ProductsApplicationAutoMapperProfile.cs

@ -25,11 +25,15 @@ namespace EasyAbp.EShop.Products
* Alternatively, you can split your mapping configurations
* into multiple profile classes for a better organization. */
CreateMap<Product, ProductDto>()
.Ignore(dto => dto.CategoryIds);
.Ignore(dto => dto.CategoryIds)
.Ignore(dto => dto.MinimumPrice)
.Ignore(dto => dto.MaximumPrice);
CreateMap<ProductDetail, ProductDetailDto>();
CreateMap<ProductAttribute, ProductAttributeDto>();
CreateMap<ProductAttributeOption, ProductAttributeOptionDto>();
CreateMap<ProductSku, ProductSkuDto>();
CreateMap<ProductSku, ProductSkuDto>()
.Ignore(dto => dto.DiscountedPrice)
.Ignore(dto => dto.RealInventory);
CreateMap<CreateUpdateProductDto, Product>(MemberList.Source)
.ForSourceMember(dto => dto.StoreId, opt => opt.DoNotValidate())
.ForSourceMember(dto => dto.CategoryIds, opt => opt.DoNotValidate())

11
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductDiscountManager.cs

@ -0,0 +1,11 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Domain.Services;
namespace EasyAbp.EShop.Products.Products
{
public interface IProductDiscountManager : IDomainService
{
Task<decimal> GetDiscountedPriceAsync(Product product, ProductSku productSku, Guid storeId);
}
}

10
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductDiscountProvider.cs

@ -0,0 +1,10 @@
using System;
using System.Threading.Tasks;
namespace EasyAbp.EShop.Products.Products
{
public interface IProductDiscountProvider
{
Task<decimal> GetDiscountedPriceAsync(Product product, ProductSku productSku, Guid storeId, decimal currentPrice);
}
}

7
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductPriceProvider.cs

@ -1,7 +0,0 @@
namespace EasyAbp.EShop.Products.Products
{
public interface IProductPriceProvider
{
}
}

4
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/IProductRepository.cs

@ -10,5 +10,9 @@ namespace EasyAbp.EShop.Products.Products
IQueryable<Product> GetQueryable(Guid storeId);
IQueryable<Product> WithDetails(Guid storeId, Guid categoryId);
IQueryable<Product> WithDetails(Guid storeId);
}
}

3
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/Product.cs

@ -37,8 +37,6 @@ namespace EasyAbp.EShop.Products.Products
protected Product()
{
ProductAttributes = new List<ProductAttribute>();
ProductSkus = new List<ProductSku>();
}
public Product(
@ -65,6 +63,7 @@ namespace EasyAbp.EShop.Products.Products
IsHidden = isHidden;
MediaResources = mediaResources;
DisplayOrder = displayOrder;
ProductAttributes = new List<ProductAttribute>();
ProductSkus = new List<ProductSku>();
}

1
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductAttribute.cs

@ -19,7 +19,6 @@ namespace EasyAbp.EShop.Products.Products
protected ProductAttribute()
{
ProductAttributeOptions = new List<ProductAttributeOption>();
}
public ProductAttribute(

22
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductDiscountManager.cs

@ -0,0 +1,22 @@
using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Domain.Services;
namespace EasyAbp.EShop.Products.Products
{
public class ProductDiscountManager : DomainService, IProductDiscountManager
{
public async Task<decimal> GetDiscountedPriceAsync(Product product, ProductSku productSku, Guid storeId)
{
var currentPrice = productSku.Price;
foreach (var provider in ServiceProvider.GetServices<IProductDiscountProvider>())
{
currentPrice = await provider.GetDiscountedPriceAsync(product, productSku, storeId, currentPrice);
}
return currentPrice;
}
}
}

41
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.EntityFrameworkCore/EasyAbp/EShop/Products/Products/ProductRepository.cs

@ -22,19 +22,42 @@ namespace EasyAbp.EShop.Products.Products
public IQueryable<Product> GetQueryable(Guid storeId, Guid categoryId)
{
return from product in DbContext.Products
join productStore in DbContext.ProductStores on product.Id equals productStore.ProductId
join productCategory in DbContext.ProductCategories on product.Id equals productCategory.ProductId
where productStore.StoreId == storeId && productCategory.CategoryId == categoryId
select product;
return JoinProductCategories(GetQueryable(storeId), categoryId);
}
public IQueryable<Product> GetQueryable(Guid storeId)
{
return from product in DbContext.Products
join productStore in DbContext.ProductStores on product.Id equals productStore.ProductId
where productStore.StoreId == storeId
select product;
return JoinProductStores(GetQueryable(), storeId);
}
public IQueryable<Product> WithDetails(Guid storeId, Guid categoryId)
{
return JoinProductCategories(WithDetails(storeId), categoryId);
}
public IQueryable<Product> WithDetails(Guid storeId)
{
return JoinProductStores(WithDetails(), storeId);
}
protected virtual IQueryable<Product> JoinProductStores(IQueryable<Product> queryable, Guid storeId)
{
return queryable.Join(
DbContext.ProductStores.Where(productStore => productStore.StoreId == storeId),
product => product.Id,
productStore => productStore.ProductId,
(product, productStore) => product
);
}
protected virtual IQueryable<Product> JoinProductCategories(IQueryable<Product> queryable, Guid categoryId)
{
return queryable.Join(
DbContext.ProductCategories.Where(productCategory => productCategory.CategoryId == categoryId),
product => product.Id,
productCategory => productCategory.ProductId,
(product, productCategory) => product
);
}
}
}

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Categories/Category/Index.cshtml

@ -7,7 +7,7 @@
@{
PageLayout.Content.Title = L["Category"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:Category"].Value);
PageLayout.Content.MenuItemName = "Category";
PageLayout.Content.MenuItemName = "EasyAbpEShopProductsCategory";
}
@section scripts

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/ProductTypes/ProductType/Index.cshtml

@ -7,7 +7,7 @@
@{
PageLayout.Content.Title = L["ProductType"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:ProductType"].Value);
PageLayout.Content.MenuItemName = "ProductType";
PageLayout.Content.MenuItemName = "EasyAbpEShopProductsProductType";
}
@section scripts

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/Product/Index.cshtml

@ -7,7 +7,7 @@
@{
PageLayout.Content.Title = L["Product"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:Product"].Value);
PageLayout.Content.MenuItemName = "Product";
PageLayout.Content.MenuItemName = "EasyAbpEShopProductsProduct";
}
@section scripts

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/Index.cshtml

@ -7,7 +7,7 @@
@{
PageLayout.Content.Title = L["ProductSku"].Value;
PageLayout.Content.BreadCrumb.Add(L["Menu:Product"].Value);
PageLayout.Content.MenuItemName = "Product";
PageLayout.Content.MenuItemName = "EasyAbpEShopProductsProduct";
}
@section scripts

8
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/ProductsMenuContributor.cs

@ -30,19 +30,19 @@ namespace EasyAbp.EShop.Products.Web
{
var l = context.GetLocalizer<ProductsResource>(); //Add main menu items.
var productManagementMenuItem = new ApplicationMenuItem("ProductManagement", l["Menu:ProductManagement"]);
var productManagementMenuItem = new ApplicationMenuItem("EasyAbpEShopProducts", l["Menu:ProductManagement"]);
if (await context.IsGrantedAsync(ProductsPermissions.ProductTypes.Default))
{
productManagementMenuItem.AddItem(
new ApplicationMenuItem("ProductType", l["Menu:ProductType"], "/EShop/Products/ProductTypes/ProductType")
new ApplicationMenuItem("EasyAbpEShopProductsProductType", l["Menu:ProductType"], "/EShop/Products/ProductTypes/ProductType")
);
}
if (await context.IsGrantedAsync(ProductsPermissions.Categories.Default))
{
productManagementMenuItem.AddItem(
new ApplicationMenuItem("Category", l["Menu:Category"], "/EShop/Products/Categories/Category")
new ApplicationMenuItem("EasyAbpEShopProductsCategory", l["Menu:Category"], "/EShop/Products/Categories/Category")
);
}
@ -53,7 +53,7 @@ namespace EasyAbp.EShop.Products.Web
var defaultStore = (await storeAppService.GetDefaultAsync())?.Id;
productManagementMenuItem.AddItem(
new ApplicationMenuItem("Product", l["Menu:Product"], "/EShop/Products/Products/Product?storeId=" + defaultStore)
new ApplicationMenuItem("EasyAbpEShopProductsProduct", l["Menu:Product"], "/EShop/Products/Products/Product?storeId=" + defaultStore)
);
}

4
modules/EasyAbp.EShop.Stores/src/EasyAbp.EShop.Stores.Web/StoresMenuContributor.cs

@ -23,12 +23,12 @@ namespace EasyAbp.EShop.Stores.Web
{
var l = context.GetLocalizer<StoresResource>(); //Add main menu items.
var storeManagementMenuItem = new ApplicationMenuItem("StoreManagement", l["Menu:StoreManagement"]);
var storeManagementMenuItem = new ApplicationMenuItem("EasyAbpEShopStores", l["Menu:StoreManagement"]);
if (await context.IsGrantedAsync(StoresPermissions.Stores.Default))
{
storeManagementMenuItem.AddItem(
new ApplicationMenuItem("Store", l["Menu:Store"], "/EShop/Stores/Stores/Store")
new ApplicationMenuItem("EasyAbpEShopStoresStore", l["Menu:Store"], "/EShop/Stores/Stores/Store")
);
}

4
samples/EShopSample/aspnet-core/src/EShopSample.Application.Contracts/EShopSample.Application.Contracts.csproj

@ -13,8 +13,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Application.Contracts" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Application.Contracts" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.Application.Contracts" Version="0.3.6" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Application.Contracts" Version="0.3.6" />
<PackageReference Include="Volo.Abp.ObjectExtending" Version="2.9.0" />
<PackageReference Include="Volo.Abp.Account.Application.Contracts" Version="2.9.0" />
<PackageReference Include="Volo.Abp.Identity.Application.Contracts" Version="2.9.0" />

4
samples/EShopSample/aspnet-core/src/EShopSample.Application/EShopSample.Application.csproj

@ -14,8 +14,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Application" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Application" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.Application" Version="0.3.6" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Application" Version="0.3.6" />
<PackageReference Include="Volo.Abp.Account.Application" Version="2.9.0" />
<PackageReference Include="Volo.Abp.Identity.Application" Version="2.9.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="2.9.0" />

4
samples/EShopSample/aspnet-core/src/EShopSample.Domain.Shared/EShopSample.Domain.Shared.csproj

@ -8,8 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Domain.Shared" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.Domain.Shared" Version="0.3.6" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Domain.Shared" Version="0.3.6" />
<PackageReference Include="Volo.Abp.Identity.Domain.Shared" Version="2.9.0" />
<PackageReference Include="Volo.Abp.IdentityServer.Domain.Shared" Version="2.9.0" />
<PackageReference Include="Volo.Abp.BackgroundJobs.Domain.Shared" Version="2.9.0" />

4
samples/EShopSample/aspnet-core/src/EShopSample.Domain/EShopSample.Domain.csproj

@ -13,8 +13,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.Domain" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Domain" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.Domain" Version="0.3.6" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Domain" Version="0.3.6" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.DataAnnotations" Version="2.2.0" />
<PackageReference Include="Volo.Abp.Identity.Domain" Version="2.9.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.Domain.Identity" Version="2.9.0" />

4
samples/EShopSample/aspnet-core/src/EShopSample.EntityFrameworkCore/EShopSample.EntityFrameworkCore.csproj

@ -10,8 +10,8 @@
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\integration\EasyAbp.EShop\src\EasyAbp.EShop.EntityFrameworkCore\EasyAbp.EShop.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\EShopSample.Domain\EShopSample.Domain.csproj" />
<PackageReference Include="EasyAbp.PaymentService.EntityFrameworkCore" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.EntityFrameworkCore" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.EntityFrameworkCore" Version="0.3.6" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.EntityFrameworkCore" Version="0.3.6" />
<PackageReference Include="Volo.Abp.EntityFrameworkCore.SqlServer" Version="2.9.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="2.9.0" />
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="2.9.0" />

4
samples/EShopSample/aspnet-core/src/EShopSample.HttpApi.Client/EShopSample.HttpApi.Client.csproj

@ -13,8 +13,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.HttpApi.Client" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.HttpApi.Client" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.HttpApi.Client" Version="0.3.6" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.HttpApi.Client" Version="0.3.6" />
<PackageReference Include="Volo.Abp.Account.HttpApi.Client" Version="2.9.0" />
<PackageReference Include="Volo.Abp.Identity.HttpApi.Client" Version="2.9.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi.Client" Version="2.9.0" />

4
samples/EShopSample/aspnet-core/src/EShopSample.HttpApi/EShopSample.HttpApi.csproj

@ -13,8 +13,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="EasyAbp.PaymentService.HttpApi" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.HttpApi" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.HttpApi" Version="0.3.6" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.HttpApi" Version="0.3.6" />
<PackageReference Include="Volo.Abp.Account.HttpApi" Version="2.9.0" />
<PackageReference Include="Volo.Abp.Identity.HttpApi" Version="2.9.0" />
<PackageReference Include="Volo.Abp.PermissionManagement.HttpApi" Version="2.9.0" />

4
samples/EShopSample/aspnet-core/src/EShopSample.Web/EShopSample.Web.csproj

@ -45,8 +45,8 @@
<ProjectReference Include="..\EShopSample.Application\EShopSample.Application.csproj" />
<ProjectReference Include="..\EShopSample.HttpApi\EShopSample.HttpApi.csproj" />
<ProjectReference Include="..\EShopSample.EntityFrameworkCore.DbMigrations\EShopSample.EntityFrameworkCore.DbMigrations.csproj" />
<PackageReference Include="EasyAbp.PaymentService.Web" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Web" Version="0.3.4" />
<PackageReference Include="EasyAbp.PaymentService.Web" Version="0.3.6" />
<PackageReference Include="EasyAbp.PaymentService.WeChatPay.Web" Version="0.3.6" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic" Version="2.9.0" />
<PackageReference Include="Volo.Abp.Autofac" Version="2.9.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.JwtBearer" Version="2.9.0" />

Loading…
Cancel
Save