diff --git a/Myshipping.Application/Enum/TrackingQueryTypeEnum.cs b/Myshipping.Application/Enum/TrackingQueryTypeEnum.cs
new file mode 100644
index 00000000..3aba5277
--- /dev/null
+++ b/Myshipping.Application/Enum/TrackingQueryTypeEnum.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Myshipping.Application
+{
+ ///
+ /// 追踪查询类型枚举
+ ///
+ public enum TrackingQueryTypeEnum
+ {
+ ///
+ /// 查询服务项目
+ ///
+ [Description("查询服务项目")]
+ QUERY_SERVICE_PROJECT,
+ ///
+ /// 查询服务项目和状态
+ ///
+ [Description("查询服务项目和状态")]
+ QUERY_SERVICE_PROJECT_STATUS,
+ }
+}
diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskMessageInfoDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskMessageInfoDto.cs
index 7476cdfb..7d4c2320 100644
--- a/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskMessageInfoDto.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/TaskMessageInfoDto.cs
@@ -201,6 +201,11 @@ namespace Myshipping.Application
///
public string Humidity { get; set; }
+ ///
+ /// 货描
+ ///
+ public string GoodsDescription { get; set; }
+
///
/// 箱信息列表
///
diff --git a/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TruckPageDto.cs b/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TruckPageDto.cs
index 566a09df..b74051af 100644
--- a/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TruckPageDto.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/Dtos/Truck/TruckPageDto.cs
@@ -31,6 +31,6 @@ namespace Myshipping.Application
///
/// 保存完是否直接发送派车
///
- public bool IsSendDispatch { get; set; }
+ public bool IsSendDispatch { get; set; } = false;
}
}
diff --git a/Myshipping.Application/Service/TaskManagePlat/TaskManageCompareMapper.cs b/Myshipping.Application/Service/TaskManagePlat/TaskManageCompareMapper.cs
index 04e97c6a..24c550d1 100644
--- a/Myshipping.Application/Service/TaskManagePlat/TaskManageCompareMapper.cs
+++ b/Myshipping.Application/Service/TaskManagePlat/TaskManageCompareMapper.cs
@@ -34,7 +34,8 @@ namespace Myshipping.Application
.Map(dest => dest.Destination, src => src.DESTINATION)
.Map(dest => dest.PKGs, src => src.PKGS)
.Map(dest => dest.KGs, src => src.KGS)
- .Map(dest => dest.CBM, src => src.CBM);
+ .Map(dest => dest.CBM, src => src.CBM)
+ .Map(dest => dest.GoodsDescription, src => src.DESCRIPTION);
config.ForType()
diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs
new file mode 100644
index 00000000..dbb00811
--- /dev/null
+++ b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs
@@ -0,0 +1,127 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Myshipping.Application
+{
+ ///
+ /// 服务项目与状态详情
+ ///
+ public class ServiceProjectWithStatusDto
+ {
+ ///
+ /// 服务项目主键
+ ///
+ public string ProjectPKId { get; set; }
+
+ ///
+ /// 服务项目代码
+ ///
+ public string ProjectCode { get; set; }
+
+ ///
+ /// 服务项目名称
+ ///
+ public string ProjectName { get; set; }
+
+ ///
+ /// 显示顺序号
+ ///
+ public int SortNo { get; set; }
+
+ ///
+ /// 流程主键
+ ///
+ public string WFPKId { get; set; }
+
+ ///
+ /// 流程代码
+ ///
+ public string WFCode { get; set; }
+
+ ///
+ /// 发布版本号
+ ///
+ public string ReleaseVersion { get; set; }
+
+ ///
+ /// 发布日期
+ ///
+ public DateTime ReleaseDate { get; set; }
+
+ ///
+ /// 状态代码列表(方便检索)
+ ///
+ public string[] StatusSKUCodeArgs { get; set; }
+
+ ///
+ /// 状态列表
+ ///
+ public List StatusList { get; set; }
+ }
+
+ public class ServiceProjectStatusDto
+ {
+ ///
+ /// 状态主键
+ ///
+ public string SkuPKId { get; set; }
+
+ ///
+ /// 活动主键
+ ///
+ public string ActPKId { get; set; }
+
+ ///
+ /// 活动显示名称
+ ///
+ public string ActShowName { get; set; }
+
+ ///
+ /// 活动显示顺序号
+ ///
+ public int ActSortNo { get; set; }
+
+ ///
+ /// 状态代码
+ ///
+ public string StatusSKUCode { get; set; }
+
+ ///
+ /// 状态名称
+ ///
+ public string StatusSKUName { get; set; }
+
+ ///
+ /// 显示颜色(背景色)
+ ///
+ public string BackgroundColor { get; set; }
+
+ ///
+ /// 显示名称
+ ///
+ public string ShowName { get; set; }
+
+ ///
+ /// 显示顺序号
+ ///
+ public int SortNo { get; set; }
+
+ ///
+ /// 是否有子状态 true-有子状态 false-没有子状态
+ ///
+ public bool HasChild { get; set; } = false;
+
+ ///
+ /// 子状态列表
+ ///
+ public List SubStatusList { get; set; }
+
+ ///
+ /// 触发器列表
+ ///
+ public List TriggerList { get; set; }
+ }
+}
diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingQueryMessageInfo.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingQueryMessageInfo.cs
index 42b73403..7836633e 100644
--- a/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingQueryMessageInfo.cs
+++ b/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingQueryMessageInfo.cs
@@ -52,5 +52,31 @@ namespace Myshipping.Application
/// 订舱编号
///
public string OrderNo { get; set; }
+
+ ///
+ /// 查询类型
+ ///
+ public TrackingQueryTypeEnum QueryType { get; set; }
+
+ ///
+ /// 查询服务项目代码
+ ///
+ public string[] QueryServiceProjectCode { get; set; }
+
+ ///
+ /// 租户ID
+ ///
+ public string TenantId { get; set; }
+
+ ///
+ /// 租户名称
+ ///
+ public string TenantName { get; set; }
+
+ ///
+ /// 强制刷新缓存
+ ///
+ public bool IsReloadCache { get; set; } = false;
+
}
}
diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingSystemMapper.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingSystemMapper.cs
index 6c47a4e4..cb9bdbc5 100644
--- a/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingSystemMapper.cs
+++ b/Myshipping.Application/Service/TrackingSystem/Dtos/TrackingSystemMapper.cs
@@ -70,6 +70,14 @@ namespace Myshipping.Application
.Map(dest => dest.StatusSKUName, src => src.STATUS_SKU_NAME)
.Map(dest => dest.SortNo, src => src.SORT_NO);
+ config.ForType()
+ .Map(dest => dest.SkuPKId, src => src.PK_ID)
+ .Map(dest => dest.StatusSKUCode, src => src.STATUS_SKU_CODE)
+ .Map(dest => dest.StatusSKUName, src => src.STATUS_SKU_NAME)
+ .Map(dest => dest.SortNo, src => src.SORT_NO)
+ .Map(dest => dest.BackgroundColor, src => src.BACKGROUND_COLOR);
+
+
config.ForType()
.Map(dest => dest.PKId, src => src.PK_ID)
.Map(dest => dest.StatusSKUCode, src => src.STATUS_SKU_CODE)
diff --git a/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowBaseService.cs b/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowBaseService.cs
index 7b2c0626..a589c6ca 100644
--- a/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowBaseService.cs
+++ b/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowBaseService.cs
@@ -113,5 +113,21 @@ namespace Myshipping.Application
/// 最大返回行数(默认15)
/// 返回回执
Task QueryActivitiesList(string queryItem, int topNum = 15);
+
+ ///
+ /// 检索可用的服务项目列表
+ ///
+ /// 租户ID
+ /// 是否不从缓存取值
+ /// 返回回执
+ Task> GetEnableProjectList(string tenantId, bool isAvoidCache = false);
+
+ ///
+ /// 检索可用的服务项目和状态列表
+ ///
+ /// 租户ID
+ /// 是否不从缓存取值
+ /// 返回回执
+ Task> GetEnableProjectWithStatusList(string tenantId, bool isAvoidCache = false);
}
}
diff --git a/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs
index fd069ba9..8ac5b1bb 100644
--- a/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs
+++ b/Myshipping.Application/Service/TrackingSystem/Interface/IServiceWorkFlowManageService.cs
@@ -41,5 +41,13 @@ namespace Myshipping.Application
/// 服务流程报文详情
/// 返回回执
Task CancelStatus(TrackingMessageInfo info);
+
+ ///
+ /// 查询当前租户下可用服务项目与状态详情
+ ///
+ /// 查询服务项目请求报文
+ /// 返回回执
+ Task QueryServiceInfo(TrackingQueryMessageInfo info);
+
}
}
diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs
index 9924d66e..36298f2b 100644
--- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs
+++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs
@@ -7,6 +7,7 @@ using Mapster;
using Microsoft.AspNetCore.Mvc;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using Myshipping.Application.Entity;
using Myshipping.Application.Helper;
using Myshipping.Core;
@@ -38,8 +39,16 @@ namespace Myshipping.Application
private readonly SqlSugarRepository _serviceWorkFlowActivitiesSubRelationRepository;
private readonly SqlSugarRepository _serviceWorkFlowReleaseInfoRepository;
private readonly SqlSugarRepository _serviceWorkFlowActivitiesTriggerRelationRepository;
+ private readonly SqlSugarRepository _statusSkuBaseInfoRepository;
private readonly ILogger _logger;
+
+ private readonly ICache _cache;
+ private readonly CacheOptions _cacheOptions;
+
+ const string CONST_CACHE_ENABLE_PROJECT = "service_project_list_enable";
+ const string CONST_CACHE_ENABLE_PROJECT_STATUS = "service_project_status_list_enable";
+
public ServiceWorkFlowBaseService(SqlSugarRepository serviceWorkFlowBaseRepository,
ILogger logger,
SqlSugarRepository serviceWorkFlowActivitiesInfoRepository,
@@ -47,7 +56,9 @@ namespace Myshipping.Application
SqlSugarRepository serviceWorkFlowActivitiesRelationRepository,
SqlSugarRepository serviceWorkFlowActivitiesSubRelationRepository,
SqlSugarRepository serviceWorkFlowActivitiesTriggerRelationRepository,
- SqlSugarRepository serviceWorkFlowReleaseInfoRepository)
+ SqlSugarRepository serviceWorkFlowReleaseInfoRepository,
+ SqlSugarRepository statusSkuBaseInfoRepository,
+ IOptions cacheOptions, Func resolveNamed)
{
_serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository;
_serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository;
@@ -58,6 +69,10 @@ namespace Myshipping.Application
_serviceWorkFlowActivitiesSubRelationRepository = serviceWorkFlowActivitiesSubRelationRepository;
_serviceWorkFlowReleaseInfoRepository = serviceWorkFlowReleaseInfoRepository;
_serviceWorkFlowActivitiesTriggerRelationRepository = serviceWorkFlowActivitiesTriggerRelationRepository;
+ _statusSkuBaseInfoRepository = statusSkuBaseInfoRepository;
+
+ _cacheOptions = cacheOptions.Value;
+ _cache = resolveNamed(_cacheOptions.CacheType.ToString(), default) as ICache;
}
///
@@ -1702,5 +1717,174 @@ namespace Myshipping.Application
return result;
}
#endregion
+
+ #region 检索可用的服务项目列表
+ ///
+ /// 检索可用的服务项目列表
+ ///
+ /// 租户ID
+ /// 是否不从缓存取值
+ /// 返回回执
+ [HttpGet("/ServiceWorkFlowBase/GetEnableProjectList")]
+ public async Task> GetEnableProjectList([FromQuery]string tenantId, [FromQuery] bool isAvoidCache = false)
+ {
+ List projectList = _cache.Get>($"{CONST_CACHE_ENABLE_PROJECT}_{tenantId}");
+
+ if (isAvoidCache || projectList == null || projectList.Count == 0)
+ {
+ var list = _serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
+ .InnerJoin((wf, rela)
+ => wf.PK_ID == rela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
+ .InnerJoin((wf, rela, prj)
+ => rela.SERVICE_PROJECT_ID == prj.PK_ID)
+ .Where((wf, rela, prj)
+ => !string.IsNullOrWhiteSpace(wf.RELEASE_VERSION) && wf.BELONG_TENANT_ID == long.Parse(tenantId)
+ && wf.IS_ENABLE == 1 && !wf.IsDeleted)
+ .Select((wf, rela, prj)
+ => prj).ToList();
+
+ projectList = list.Select(a => a.Adapt())
+ .Distinct().OrderBy(a => a.SortNo).ToList();
+
+ await _cache.SetAsync($"{CONST_CACHE_ENABLE_PROJECT}_{tenantId}", projectList);
+ }
+
+ return projectList;
+ }
+ #endregion
+
+ #region 检索可用的服务项目和状态列表
+ ///
+ /// 检索可用的服务项目和状态列表
+ ///
+ /// 租户ID
+ /// 是否不从缓存取值
+ /// 返回回执
+ public async Task> GetEnableProjectWithStatusList([FromQuery] string tenantId, [FromQuery] bool isAvoidCache = false)
+ {
+ List statusList = _cache.Get>($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}");
+
+ if (isAvoidCache || statusList == null || statusList.Count == 0)
+ {
+ CreateCacheInfo(tenantId);
+ //await _cache.SetAsync($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}", statusList);
+ }
+
+ return statusList;
+
+ }
+ #endregion
+
+ private void CreateCacheInfo(string tenantId)
+ {
+ var statusSKUList = _statusSkuBaseInfoRepository.AsQueryable().Filter(null, true)
+ .Where(a => !a.IsDeleted && a.IS_ENABLE == 1 && a.TenantId == long.Parse(tenantId)).ToList();
+
+ /* 读取当前租户可用的已发布的流程详情,并写入缓存。
+ *
+ 1、流程关联服务项目。
+ 2、流程关联流程活动。
+ 3、流程关联流程活动的子活动。
+ 4、活动关联状态。
+ 5、活动关联触发器。
+ 6、写入缓存。
+ */
+ var list = _serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
+ .InnerJoin((wf, rela)
+ => wf.PK_ID == rela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
+ .InnerJoin((wf, rela, prj)
+ => rela.SERVICE_PROJECT_ID == prj.PK_ID)
+ .InnerJoin((wf, rela, prj,
+ arela)
+ => wf.PK_ID == arela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == arela.WF_VERSION)
+ .InnerJoin((wf, rela, prj,
+ arela, act)
+ => arela.SERVICE_ACTIVITIES_ID == act.PK_ID)
+ .LeftJoin((wf, rela, prj,
+ arela, act, trgrela)
+ => wf.PK_ID == trgrela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == trgrela.WF_VERSION && act.PK_ID == trgrela.SERVICE_ACTIVITIES_ID)
+ .LeftJoin((wf, rela, prj,
+ arela, act, trgrela, trg)
+ => trgrela.STATUS_TRIGGER_ID == trg.PK_ID)
+ .Where((wf, rela, prj,
+ arela, act)
+ => !string.IsNullOrWhiteSpace(wf.RELEASE_VERSION) && wf.BELONG_TENANT_ID == long.Parse(tenantId)
+ && wf.IS_ENABLE == 1 && !wf.IsDeleted)
+ .Select((wf, rela, prj,
+ arela, act)
+ => new { WF = wf,Project = prj, ARela = arela, Act = act }).ToList();
+
+ var statusList = list.GroupBy(a
+ => a.Project.PK_ID)
+ .Select(a =>
+ {
+ var currList = a.ToList();
+
+ var wf = currList.FirstOrDefault().WF;
+ var project = currList.FirstOrDefault().Project;
+
+ ServiceProjectWithStatusDto baseDto = new ServiceProjectWithStatusDto
+ {
+ ProjectPKId = project.PK_ID,
+ ProjectCode = project.SERVICE_PROJECT_CODE,
+ ProjectName = project.SERVICE_PROJECT_NAME,
+ SortNo = project.SORT_NO,
+ WFPKId = wf.PK_ID,
+ WFCode = wf.SERVICE_WORKFLOW_CODE,
+ ReleaseVersion = wf.RELEASE_VERSION,
+ ReleaseDate = wf.PUBLISH_DATE.Value,
+ StatusList = new List()
+ };
+
+ baseDto.StatusList = currList
+ .GroupBy(b => b.Act.PK_ID)
+ .Select(c => {
+ var currActList = c.ToList();
+
+ var act = currActList.FirstOrDefault().Act;
+ var ARela = currActList.FirstOrDefault().ARela;
+
+ var dto = new ServiceProjectStatusDto
+ {
+ SkuPKId = act.STATUS_SKU_ID,
+ ActPKId = act.PK_ID,
+ ActShowName = act.SHOW_NAME,
+ ActSortNo = ARela.SORT_NO,
+ HasChild = ARela.IS_CONTAINS_SUB == 1 ? true : false,
+ SubStatusList = new List(),
+ TriggerList = new List()
+ };
+
+ return dto;
+
+ }).ToList();
+
+ return baseDto;
+
+ }).ToList();
+
+
+ if (list.Any(a=>a.ARela.IS_CONTAINS_SUB == 1))
+ {
+ //如果存在子活动的,需要关联
+ var sublist = _serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
+ .InnerJoin((wf, rela)
+ => wf.PK_ID == rela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
+ .InnerJoin((wf, rela,act)
+ => rela.SERVICE_ACTIVITIES_ID == act.PK_ID)
+ .LeftJoin((wf, rela,act, trgrela)
+ => wf.PK_ID == trgrela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == trgrela.WF_VERSION && act.PK_ID == trgrela.SERVICE_ACTIVITIES_ID)
+ .LeftJoin((wf, rela, act, trgrela, trg)
+ => trgrela.STATUS_TRIGGER_ID == trg.PK_ID)
+ .Where((wf, rela, prj,
+ arela, act)
+ => !string.IsNullOrWhiteSpace(wf.RELEASE_VERSION) && wf.BELONG_TENANT_ID == long.Parse(tenantId)
+ && wf.IS_ENABLE == 1 && !wf.IsDeleted)
+ .Select((wf, rela, act)
+ => new { WF = wf, Rela = rela, Act = act }).ToList();
+
+
+ }
+ }
}
}
diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs
index 07aba9eb..f5f36a18 100644
--- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs
+++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowManageService.cs
@@ -4,14 +4,17 @@ using Furion.DynamicApiController;
using Furion.FriendlyException;
using Furion.JsonSerialization;
using Google.Protobuf.Collections;
+using Mapster;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using Myshipping.Application.Entity;
using Myshipping.Core;
using Myshipping.Core.Entity;
using NPOI.OpenXmlFormats.Vml;
using NPOI.SS.Formula.Functions;
+using NPOI.SS.Formula.PTG;
using Org.BouncyCastle.Asn1.Tsp;
using Org.BouncyCastle.Ocsp;
using StackExchange.Profiling.Internal;
@@ -44,9 +47,16 @@ namespace Myshipping.Application
private readonly SqlSugarRepository _sysUserRepository;
private readonly SqlSugarRepository _serviceProjectBaseInfoRepository;
private readonly SqlSugarRepository _serviceWorkFlowRunLogInfoRepository;
+ private readonly ICache _cache;
+ private readonly CacheOptions _cacheOptions;
private readonly IServiceWorkFlowBaseService _serviceWorkFlowBaseService;
+ const string CONST_CACHE_ENABLE_PROJECT = "service_project_list_enable";
+ const string CONST_CACHE_ENABLE_PROJECT_STATUS = "service_project_status_list_enable";
+ const string CONST_CACHE_ENABLE_STATUS = "service_status_list_enable";
+
+
public ServiceWorkFlowManageService(SqlSugarRepository serviceWorkFlowBaseRepository,
ILogger logger,
SqlSugarRepository serviceWorkFlowActivitiesInfoRepository,
@@ -59,7 +69,8 @@ namespace Myshipping.Application
SqlSugarRepository statusSkuBaseInfoRepository,
IServiceWorkFlowBaseService serviceWorkFlowBaseService, SqlSugarRepository sysUserRepository,
SqlSugarRepository serviceProjectBaseInfoRepository,
- SqlSugarRepository serviceWorkFlowRunLogInfoRepository)
+ SqlSugarRepository serviceWorkFlowRunLogInfoRepository,
+ IOptions cacheOptions, Func resolveNamed)
{
_serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository;
_serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository;
@@ -76,6 +87,9 @@ namespace Myshipping.Application
_sysUserRepository = sysUserRepository;
_serviceProjectBaseInfoRepository = serviceProjectBaseInfoRepository;
_serviceWorkFlowRunLogInfoRepository = serviceWorkFlowRunLogInfoRepository;
+
+ _cacheOptions = cacheOptions.Value;
+ _cache = resolveNamed(_cacheOptions.CacheType.ToString(), default) as ICache;
}
#region 推送状态
@@ -998,6 +1012,70 @@ namespace Myshipping.Application
return userTendDto;
}
#endregion
+
+ ///
+ /// 查询当前租户下可用服务项目与状态详情
+ ///
+ /// 查询服务项目请求报文
+ /// 返回回执
+ [HttpPost("/ServiceWorkFlowManage/QueryServiceInfo")]
+ public async Task QueryServiceInfo([FromBody] TrackingQueryMessageInfo info)
+ {
+ TaskManageOrderResultDto result = new TaskManageOrderResultDto();
+
+ string batchNo = IDGen.NextID().ToString();
+
+ _logger.LogInformation("批次={no} 查询当前租户下可用服务项目 msg={msg}", batchNo, JSON.Serialize(info));
+
+ try
+ {
+ /*
+ 1、检索按照租户检索已经发布的服务流程。
+ 2、根据枚举 info.Main.QueryType来判断返回哪些数据。
+ 3、只返回服务项目。
+ 4、只返回服务项目下的服务状态。
+ 5、优先通过缓存获取结果。
+ */
+
+ if (info.Main.QueryType == TrackingQueryTypeEnum.QUERY_SERVICE_PROJECT)
+ {
+ var projectList = await _serviceWorkFlowBaseService.GetEnableProjectList(info.Main.TenantId);
+
+ if (info.Main.QueryServiceProjectCode != null && info.Main.QueryServiceProjectCode.Length > 0)
+ {
+ result.ext = projectList.Where(a => info.Main.QueryServiceProjectCode.Contains(a.ServiceProjectCode))
+ .OrderBy(a => a.SortNo).ToList();
+ }
+ else
+ {
+ result.ext = projectList;
+ }
+ }
+ else if (info.Main.QueryType == TrackingQueryTypeEnum.QUERY_SERVICE_PROJECT_STATUS)
+ {
+ var statusList = await _serviceWorkFlowBaseService.GetEnableProjectList(info.Main.TenantId);
+
+ if (info.Main.QueryServiceProjectCode != null && info.Main.QueryServiceProjectCode.Length > 0)
+ {
+ result.ext = statusList.Where(a => info.Main.QueryServiceProjectCode.Contains(a.ServiceProjectCode))
+ .OrderBy(a => a.SortNo).ToList();
+ }
+ else
+ {
+ result.ext = statusList;
+ }
+ }
+
+ result.succ = true;
+ }
+ catch (Exception ex)
+ {
+ result.succ = false;
+ result.msg = $"查询服务项目失败,原因:{ex.Message}";
+ }
+
+ return result;
+ }
}
}