Browse Source

Fix the missing part by rename to `FlashSalePlan` and `FlashSaleResult`

pull/184/head
Jadyn 4 years ago
parent
commit
28c4b7b640
  1. 1
      plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/EasyAbp/EShop/Orders/Orders/CreateFlashSaleOrderEventHandler.cs
  2. 27
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanAppService.cs
  3. 3
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanCacheInvalidator.cs
  4. 2
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanCacheItem.cs
  5. 2
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/ProductIsNotInThisStoreException.cs
  6. 2
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/ProductSkuIsNotFoundException.cs
  7. 3
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/RelatedFlashSaleResultsExistException.cs
  8. 3
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/UnexpectedInventoryStrategyException.cs
  9. 15
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSaleResults/FlashSaleResultAppService.cs
  10. 1
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesApplicationAutoMapperProfile.cs
  11. 2
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/CreateFlashSaleOrderCompleteEto.cs
  12. 16
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSaleResults/CreateFlashSaleOrderCompleteEventHandler.cs
  13. 2
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlan/index.js
  14. 2
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSaleResults/FlashSaleResult/Index.cshtml
  15. 2
      plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSaleResults/FlashSaleResult/Index.cshtml.cs
  16. 1
      plugins/FlashSales/src/EasyAbp.EShop.Products.Plugins.FlashSales.Application/EasyAbp/EShop/Products/Products/FlashSaleReduceInventoryEventHandler.cs

1
plugins/FlashSales/src/EasyAbp.EShop.Orders.Plugins.FlashSales.Application/EasyAbp/EShop/Orders/Orders/CreateFlashSaleOrderEventHandler.cs

@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using EasyAbp.EShop.Orders.Orders.Dtos;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
using EasyAbp.EShop.Products.ProductDetails.Dtos;
using EasyAbp.EShop.Products.Products.Dtos;
using Volo.Abp.DependencyInjection;

27
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanAppService.cs

@ -1,7 +1,6 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans.Dtos;
using EasyAbp.EShop.Plugins.FlashSales.FlashSaleResults;
using EasyAbp.EShop.Plugins.FlashSales.Permissions;
@ -20,7 +19,7 @@ using Volo.Abp.Domain.Repositories;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Users;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
[Authorize]
public class FlashSalePlanAppService :
@ -48,7 +47,7 @@ public class FlashSalePlanAppService :
protected IAbpDistributedLock DistributedLock { get; }
protected IFlashSalePlanHasher FlashSalesPlanHasher { get; }
protected IFlashSalePlanHasher FlashSalePlanHasher { get; }
public FlashSalePlanAppService(
IFlashSalePlanRepository flashSalePlanRepository,
@ -58,7 +57,7 @@ public class FlashSalePlanAppService :
IDistributedEventBus distributedEventBus,
IFlashSaleResultRepository flashSaleResultRepository,
IAbpDistributedLock distributedLock,
IFlashSalePlanHasher flashSalesPlanHasher)
IFlashSalePlanHasher flashSalePlanHasher)
: base(flashSalePlanRepository)
{
FlashSalePlanRepository = flashSalePlanRepository;
@ -68,7 +67,7 @@ public class FlashSalePlanAppService :
DistributedEventBus = distributedEventBus;
FlashSaleResultRepository = flashSaleResultRepository;
DistributedLock = distributedLock;
FlashSalesPlanHasher = flashSalesPlanHasher;
FlashSalePlanHasher = flashSalePlanHasher;
}
public override async Task<FlashSalePlanDto> GetAsync(Guid id)
@ -127,7 +126,7 @@ public class FlashSalePlanAppService :
await ValidateCreateOrUpdateProductAsync(input.ProductId, product, input.ProductSkuId, productSku, flashSalePlan.StoreId);
if (await ExistRelatedFlashSalesResultsAsync(id) && (input.ProductId != flashSalePlan.ProductId || input.ProductSkuId != flashSalePlan.ProductSkuId))
if (await ExistRelatedFlashSaleResultsAsync(id) && (input.ProductId != flashSalePlan.ProductId || input.ProductSkuId != flashSalePlan.ProductSkuId))
{
throw new RelatedFlashSaleResultsExistException(id);
}
@ -149,7 +148,7 @@ public class FlashSalePlanAppService :
await CheckMultiStorePolicyAsync(flashSalePlan.StoreId, DeletePolicyName);
if (await ExistRelatedFlashSalesResultsAsync(id))
if (await ExistRelatedFlashSaleResultsAsync(id))
{
throw new RelatedFlashSaleResultsExistException(id);
}
@ -229,7 +228,7 @@ public class FlashSalePlanAppService :
var userId = CurrentUser.GetId();
var result = await CreatePendingFlashSalesResultAsync(plan, userId);
var result = await CreatePendingFlashSaleResultAsync(plan, userId);
var flashSalesReduceInventoryEto = await PrepareFlashSalesReduceInventoryEtoAsync(plan, result.Id, input, userId, now, cacheHashToken);
@ -276,8 +275,8 @@ public class FlashSalePlanAppService :
{
return await DistributedCache.GetOrAddAsync(id, async () =>
{
var flashSalesPlan = await FlashSalePlanRepository.GetAsync(id);
return ObjectMapper.Map<FlashSalePlan, FlashSalePlanCacheItem>(flashSalesPlan);
var flashSalePlan = await FlashSalePlanRepository.GetAsync(id);
return ObjectMapper.Map<FlashSalePlan, FlashSalePlanCacheItem>(flashSalePlan);
});
}
@ -298,7 +297,7 @@ public class FlashSalePlanAppService :
protected virtual async Task SetCacheHashTokenAsync(FlashSalePlanCacheItem plan, ProductDto product, ProductSkuDto productSku)
{
var hashToken = await FlashSalesPlanHasher.HashAsync(plan.LastModificationTime, product.LastModificationTime, productSku.LastModificationTime);
var hashToken = await FlashSalePlanHasher.HashAsync(plan.LastModificationTime, product.LastModificationTime, productSku.LastModificationTime);
await TokenDistributedCache.SetStringAsync(await GetCacheKeyAsync(plan), hashToken, new DistributedCacheEntryOptions()
{
@ -313,12 +312,12 @@ public class FlashSalePlanAppService :
return false;
}
var hashToken = await FlashSalesPlanHasher.HashAsync(plan.LastModificationTime, product.LastModificationTime, productSku.LastModificationTime);
var hashToken = await FlashSalePlanHasher.HashAsync(plan.LastModificationTime, product.LastModificationTime, productSku.LastModificationTime);
return cacheHashToken == hashToken;
}
protected virtual async Task<FlashSaleResult> CreatePendingFlashSalesResultAsync(FlashSalePlanCacheItem plan, Guid userId)
protected virtual async Task<FlashSaleResult> CreatePendingFlashSaleResultAsync(FlashSalePlanCacheItem plan, Guid userId)
{
var lockKey = $"create-flash-sales-order-{plan.Id}-{userId}";
@ -380,7 +379,7 @@ public class FlashSalePlanAppService :
return Task.CompletedTask;
}
protected virtual async Task<bool> ExistRelatedFlashSalesResultsAsync(Guid planId)
protected virtual async Task<bool> ExistRelatedFlashSaleResultsAsync(Guid planId)
{
return await FlashSaleResultRepository.AnyAsync(x => x.PlanId == planId);
}

3
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanCacheInvalidator.cs

@ -1,13 +1,12 @@
using System;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.EventBus;
using Volo.Abp.Uow;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
public class FlashSalePlanCacheInvalidator : ILocalEventHandler<EntityChangedEventData<FlashSalePlan>>, ITransientDependency
{

2
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlanCacheItem.cs

@ -1,7 +1,7 @@
using System;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans.Dtos;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
[Serializable]
public class FlashSalePlanCacheItem : FlashSalePlanDto

2
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/ProductIsNotInThisStoreException.cs

@ -1,7 +1,7 @@
using System;
using Volo.Abp;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
public class ProductIsNotInThisStoreException : BusinessException
{

2
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/ProductSkuIsNotFoundException.cs

@ -1,7 +1,7 @@
using System;
using Volo.Abp;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
public class ProductSkuIsNotFoundException : BusinessException
{

3
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/RelatedFlashSaleResultsExistException.cs

@ -1,8 +1,7 @@
using System;
using System.Runtime.Serialization;
using Volo.Abp;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
[Serializable]
public class RelatedFlashSaleResultsExistException : BusinessException

3
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/UnexpectedInventoryStrategyException.cs

@ -1,7 +1,8 @@
using EasyAbp.EShop.Products.Products;
using Volo.Abp;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
public class UnexpectedInventoryStrategyException : BusinessException
{
public UnexpectedInventoryStrategyException(InventoryStrategy expectedInventoryStrategy) : base(FlashSalesErrorCodes.UnexpectedInventoryStrategy)

15
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSaleResults/FlashSaleResultAppService.cs

@ -1,13 +1,12 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.FlashSales.FlashSaleResults;
using EasyAbp.EShop.Plugins.FlashSales.FlashSaleResults.Dtos;
using EasyAbp.EShop.Plugins.FlashSales.Permissions;
using EasyAbp.EShop.Stores.Stores;
using Volo.Abp.Application.Dtos;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesResults;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSaleResults;
public class FlashSaleResultAppService :
MultiStoreCrudAppService<FlashSaleResult, FlashSaleResultDto, Guid, FlashSaleResultGetListInput>,
@ -19,22 +18,22 @@ public class FlashSaleResultAppService :
protected IFlashSaleResultRepository FlashSaleResultRepository { get; }
public FlashSaleResultAppService(IFlashSaleResultRepository flashSalesResultRepository) : base(flashSalesResultRepository)
public FlashSaleResultAppService(IFlashSaleResultRepository flashSaleResultRepository) : base(flashSaleResultRepository)
{
}
public override async Task<FlashSaleResultDto> GetAsync(Guid id)
{
var flashSalesResult = await GetEntityByIdAsync(id);
var flashSaleResult = await GetEntityByIdAsync(id);
await CheckMultiStorePolicyAsync(flashSalesResult.StoreId, GetPolicyName);
await CheckMultiStorePolicyAsync(flashSaleResult.StoreId, GetPolicyName);
if (flashSalesResult.UserId != CurrentUser.Id)
if (flashSaleResult.UserId != CurrentUser.Id)
{
await CheckMultiStorePolicyAsync(flashSalesResult.StoreId, FlashSalesPermissions.FlashSaleResult.Manage);
await CheckMultiStorePolicyAsync(flashSaleResult.StoreId, FlashSalesPermissions.FlashSaleResult.Manage);
}
return await MapToGetOutputDtoAsync(flashSalesResult);
return await MapToGetOutputDtoAsync(flashSaleResult);
}
public override async Task<PagedResultDto<FlashSaleResultDto>> GetListAsync(FlashSaleResultGetListInput input)

1
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Application/EasyAbp/EShop/Plugins/FlashSales/FlashSalesApplicationAutoMapperProfile.cs

@ -3,7 +3,6 @@ using EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans.Dtos;
using EasyAbp.EShop.Plugins.FlashSales.FlashSaleResults;
using EasyAbp.EShop.Plugins.FlashSales.FlashSaleResults.Dtos;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
namespace EasyAbp.EShop.Plugins.FlashSales;

2
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain.Shared/EasyAbp/EShop/Plugins/FlashSales/FlashSalePlans/CreateFlashSaleOrderCompleteEto.cs

@ -2,7 +2,7 @@
using Volo.Abp.MultiTenancy;
using Volo.Abp.ObjectExtending;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
namespace EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
public class CreateFlashSaleOrderCompleteEto : ExtensibleObject, IMultiTenant
{

16
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Domain/EasyAbp/EShop/Plugins/FlashSales/FlashSaleResults/CreateFlashSaleOrderCompleteEventHandler.cs

@ -1,5 +1,5 @@
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus.Distributed;
using Volo.Abp.Guids;
@ -9,29 +9,29 @@ namespace EasyAbp.EShop.Plugins.FlashSales.FlashSaleResults;
public class CreateFlashSaleOrderCompleteEventHandler : IDistributedEventHandler<CreateFlashSaleOrderCompleteEto>, ITransientDependency
{
protected IFlashSaleResultRepository FlashSalesResultRepository { get; }
protected IFlashSaleResultRepository FlashSaleResultRepository { get; }
protected IGuidGenerator GuidGenerator { get; }
public CreateFlashSaleOrderCompleteEventHandler(IFlashSaleResultRepository flashSalesResultRepository, IGuidGenerator guidGenerator)
public CreateFlashSaleOrderCompleteEventHandler(IFlashSaleResultRepository flashSaleResultRepository, IGuidGenerator guidGenerator)
{
FlashSalesResultRepository = flashSalesResultRepository;
FlashSaleResultRepository = flashSaleResultRepository;
GuidGenerator = guidGenerator;
}
[UnitOfWork]
public virtual async Task HandleEventAsync(CreateFlashSaleOrderCompleteEto eventData)
{
var flashSalesResult = await FlashSalesResultRepository.GetAsync(eventData.PendingResultId);
var flashSaleResult = await FlashSaleResultRepository.GetAsync(eventData.PendingResultId);
if (eventData.Success)
{
flashSalesResult.MarkAsSuccessful(eventData.OrderId.Value);
flashSaleResult.MarkAsSuccessful(eventData.OrderId.Value);
}
else
{
flashSalesResult.MarkAsFailed(eventData.Reason);
flashSaleResult.MarkAsFailed(eventData.Reason);
}
await FlashSalesResultRepository.UpdateAsync(flashSalesResult, autoSave: true);
await FlashSaleResultRepository.UpdateAsync(flashSaleResult, autoSave: true);
}
}

2
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSalePlans/FlashSalePlan/index.js

@ -35,7 +35,7 @@ $(function () {
text: l('Delete'),
visible: abp.auth.isGranted('EasyAbp.EShop.Plugins.FlashSales.FlashSalePlan.Delete'),
confirmMessage: function (data) {
return l('FlashSalesPlanDeletionConfirmationMessage', data.record.id);
return l('FlashSalePlanDeletionConfirmationMessage', data.record.id);
},
action: function (data) {
service.delete(data.record.id)

2
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSaleResults/FlashSaleResult/Index.cshtml

@ -3,7 +3,7 @@
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Mvc.Localization
@using Volo.Abp.AspNetCore.Mvc.UI.Layout
@using EasyAbp.EShop.Plugins.FlashSales.Web.Pages.EShop.Plugins.FlashSales.FlashSaleResults.FlashSalesResult
@using EasyAbp.EShop.Plugins.FlashSales.Web.Pages.EShop.Plugins.FlashSales.FlashSaleResults.FlashSaleResult
@using EasyAbp.EShop.Plugins.FlashSales.Localization
@using EasyAbp.EShop.Plugins.FlashSales.Web.Menus

2
plugins/FlashSales/src/EasyAbp.EShop.Plugins.FlashSales.Web/Pages/EShop/Plugins/FlashSales/FlashSaleResults/FlashSaleResult/Index.cshtml.cs

@ -1,7 +1,7 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace EasyAbp.EShop.Plugins.FlashSales.Web.Pages.EShop.Plugins.FlashSales.FlashSaleResults.FlashSalesResult;
namespace EasyAbp.EShop.Plugins.FlashSales.Web.Pages.EShop.Plugins.FlashSales.FlashSaleResults.FlashSaleResult;
public class IndexModel : PageModel
{

1
plugins/FlashSales/src/EasyAbp.EShop.Products.Plugins.FlashSales.Application/EasyAbp/EShop/Products/Products/FlashSaleReduceInventoryEventHandler.cs

@ -2,7 +2,6 @@
using System.Threading.Tasks;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalePlans;
using EasyAbp.EShop.Plugins.FlashSales.FlashSaleResults;
using EasyAbp.EShop.Plugins.FlashSales.FlashSalesPlans;
using EasyAbp.EShop.Products.ProductDetails;
using Volo.Abp.DependencyInjection;
using Volo.Abp.EventBus.Distributed;

Loading…
Cancel
Save