|
@@ -1,4 +1,5 @@
|
|
|
using Hotline.Caching.Interfaces;
|
|
|
+using Hotline.Configurations;
|
|
|
using Hotline.File;
|
|
|
using Hotline.FlowEngine.Notifications;
|
|
|
using Hotline.FlowEngine.Workflows;
|
|
@@ -16,6 +17,7 @@ using Hotline.Share.Tools;
|
|
|
using Hotline.Snapshot;
|
|
|
using Hotline.Tools;
|
|
|
using Mapster;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
using Novacode.NETCorePort;
|
|
|
using NPOI.POIFS.Properties;
|
|
|
using SqlSugar;
|
|
@@ -33,6 +35,8 @@ using XF.Utility.EnumExtensions;
|
|
|
using Hotline.Snapshot.IRepository;
|
|
|
using Hotline.Application.Snapshot.Contracts;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
+using Hotline.FlowEngine.WorkflowModules;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
|
|
|
namespace Hotline.Application.Snapshot;
|
|
|
public class SnapshotOrderApplication : IOrderSnapshotApplication, IScopeDependency
|
|
@@ -48,8 +52,10 @@ public class SnapshotOrderApplication : IOrderSnapshotApplication, IScopeDepende
|
|
|
private readonly IFileRepository _fileRepository;
|
|
|
private readonly ISnapshotLabelLogRepository _snapshotLabelLogRepository;
|
|
|
private readonly IRedPackAuditRepository _redPackAuditRepository;
|
|
|
+ private readonly IOptionsSnapshot<AppConfiguration> _appOptions;
|
|
|
+ private readonly ILogger<SnapshotOrderApplication> _logger;
|
|
|
|
|
|
- public SnapshotOrderApplication(IOrderSnapshotRepository orderSnapshotRepository, IOrderRepository orderRepository, ISnapshotOrderPublishRepository snapshotOrderPublishRepository, ISessionContext sessionContext, ISystemSettingCacheManager systemSettingCacheManager, IIndustryCaseRepository industryCaseRepository, ISystemDicDataCacheManager systemDicDataCacheManager, IIndustryRepository industryRepository, IFileRepository fileRepository, ISnapshotLabelLogRepository snapshotLabelLogRepository, IRedPackAuditRepository redPackAuditRepository)
|
|
|
+ public SnapshotOrderApplication(IOrderSnapshotRepository orderSnapshotRepository, IOrderRepository orderRepository, ISnapshotOrderPublishRepository snapshotOrderPublishRepository, ISessionContext sessionContext, ISystemSettingCacheManager systemSettingCacheManager, IIndustryCaseRepository industryCaseRepository, ISystemDicDataCacheManager systemDicDataCacheManager, IIndustryRepository industryRepository, IFileRepository fileRepository, ISnapshotLabelLogRepository snapshotLabelLogRepository, IRedPackAuditRepository redPackAuditRepository, IOptionsSnapshot<AppConfiguration> appOptions, ILogger<SnapshotOrderApplication> logger)
|
|
|
{
|
|
|
_orderSnapshotRepository = orderSnapshotRepository;
|
|
|
_orderRepository = orderRepository;
|
|
@@ -62,6 +68,8 @@ public class SnapshotOrderApplication : IOrderSnapshotApplication, IScopeDepende
|
|
|
_fileRepository = fileRepository;
|
|
|
_snapshotLabelLogRepository = snapshotLabelLogRepository;
|
|
|
_redPackAuditRepository = redPackAuditRepository;
|
|
|
+ _appOptions = appOptions;
|
|
|
+ _logger = logger;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -645,4 +653,33 @@ public class SnapshotOrderApplication : IOrderSnapshotApplication, IScopeDepende
|
|
|
});
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ public async Task<string> GetStartflowAsync(string? orderId, CancellationToken token)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (orderId.IsNullOrEmpty()) return WorkflowModuleConsts.OrderHandle;
|
|
|
+ if (_systemSettingCacheManager.Snapshot == false) return WorkflowModuleConsts.OrderHandle;
|
|
|
+ if (_appOptions.Value.IsZiGong == false) return WorkflowModuleConsts.OrderHandle;
|
|
|
+
|
|
|
+ var order = await _orderSnapshotRepository.Queryable()
|
|
|
+ .LeftJoin<Industry>((snapshot, industry) => snapshot.IndustryId == industry.Id)
|
|
|
+ .Where((snapshot, industry) => snapshot.Id == orderId)
|
|
|
+ .Select((snapshot, industry) => new { snapshot.Id, industry.IndustryType })
|
|
|
+ .FirstAsync(token);
|
|
|
+ if (order == null) return WorkflowModuleConsts.OrderHandle;
|
|
|
+
|
|
|
+ if (order.IndustryType == EIndustryType.Declare) // 作业申报类型
|
|
|
+ {
|
|
|
+ return WorkflowModuleConsts.OrderHandleSnapshot;
|
|
|
+ }
|
|
|
+ return WorkflowModuleConsts.OrderHandle;
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ _logger.LogError("获取随手拍开启流程参数异常", e);
|
|
|
+ return WorkflowModuleConsts.OrderHandle;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|