|
@@ -33,6 +33,11 @@ using XF.Utility.EnumExtensions;
|
|
|
using Hotline.Snapshot.IRepository;
|
|
|
using Hotline.Application.Snapshot.Contracts;
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
+using Hotline.Configurations;
|
|
|
+using Microsoft.Extensions.Options;
|
|
|
+using Hotline.FlowEngine.WorkflowModules;
|
|
|
+using System.Reflection.Metadata.Ecma335;
|
|
|
+using Microsoft.Extensions.Logging;
|
|
|
|
|
|
namespace Hotline.Application.Snapshot;
|
|
|
public class SnapshotOrderApplication : IOrderSnapshotApplication, IScopeDependency
|
|
@@ -48,8 +53,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 +69,8 @@ public class SnapshotOrderApplication : IOrderSnapshotApplication, IScopeDepende
|
|
|
_fileRepository = fileRepository;
|
|
|
_snapshotLabelLogRepository = snapshotLabelLogRepository;
|
|
|
_redPackAuditRepository = redPackAuditRepository;
|
|
|
+ _appOptions = appOptions;
|
|
|
+ _logger = logger;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -648,4 +657,32 @@ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|