|
@@ -3,6 +3,7 @@ using Fw.Utility.UnifyResponse;
|
|
|
using Hotline.Api.Filter;
|
|
|
using Hotline.Application.Snapshot.Contracts;
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
+using Hotline.Caching.Services;
|
|
|
using Hotline.File;
|
|
|
using Hotline.Orders;
|
|
|
using Hotline.Repository.SqlSugar.Snapshot;
|
|
@@ -53,8 +54,9 @@ public class SnapshotController : BaseController
|
|
|
private readonly IThirdAccountRepository _thirdAccountRepository;
|
|
|
private readonly ILogger<SnapshotController> _logger;
|
|
|
private readonly IRepository<SystemWebPageSetting> _webPageRepository;
|
|
|
+ private readonly ISystemSettingCacheManager _systemSettingCacheManager;
|
|
|
|
|
|
- public SnapshotController(IRepository<Order> orderRepository, ISnapshotApplication snapshotApplication, ISystemAreaDomainService systemAreaDomainService, IIndustryRepository industryRepository, IOrderDomainService orderDomainService, IFileRepository fileRepository, IOrderSnapshotRepository orderSnapshotRepository, ISystemDicDataCacheManager systemDicDataCacheManager, ISessionContext sessionContext, IThirdAccountRepository thirdAccountRepository, ILogger<SnapshotController> logger, IRepository<SystemWebPageSetting> webPageRepository)
|
|
|
+ public SnapshotController(IRepository<Order> orderRepository, ISnapshotApplication snapshotApplication, ISystemAreaDomainService systemAreaDomainService, IIndustryRepository industryRepository, IOrderDomainService orderDomainService, IFileRepository fileRepository, IOrderSnapshotRepository orderSnapshotRepository, ISystemDicDataCacheManager systemDicDataCacheManager, ISessionContext sessionContext, IThirdAccountRepository thirdAccountRepository, ILogger<SnapshotController> logger, IRepository<SystemWebPageSetting> webPageRepository, ISystemSettingCacheManager systemSettingCacheManager)
|
|
|
{
|
|
|
_orderRepository = orderRepository;
|
|
|
_snapshotApplication = snapshotApplication;
|
|
@@ -68,6 +70,7 @@ public class SnapshotController : BaseController
|
|
|
_thirdAccountRepository = thirdAccountRepository;
|
|
|
_logger = logger;
|
|
|
_webPageRepository = webPageRepository;
|
|
|
+ _systemSettingCacheManager = systemSettingCacheManager;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -107,6 +110,11 @@ public class SnapshotController : BaseController
|
|
|
[LogFilterAlpha("添加随手拍工单")]
|
|
|
public async Task<AddSnapshotOrderOutDto> AddOrderAsync([FromBody] AddSnapshotOrderInDto dto)
|
|
|
{
|
|
|
+ var minute = _systemSettingCacheManager.SnapshotIntervalMinutes;
|
|
|
+ var timeout = await _orderRepository.Queryable().Where(m => m.CreatorId == _sessionContext.UserId
|
|
|
+ && DateTime.Now.AddMinutes(-minute) < m.CreationTime)
|
|
|
+ .AnyAsync();
|
|
|
+ if (timeout) throw UserFriendlyException.SameMessage($"请{minute}分钟后再提交工单");
|
|
|
var ssp = _systemDicDataCacheManager.SourceChannel.FirstOrDefault(m => m.DicDataName == "随手拍")
|
|
|
?? throw UserFriendlyException.SameMessage("请添加[随手拍]来源.");
|
|
|
var order = dto.Adapt<Order>();
|