修改服务项目

optimize
jianghaiqing 1 year ago
parent 686999c57a
commit 057c556a35

@ -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
{
/// <summary>
/// 追踪查询类型枚举
/// </summary>
public enum TrackingQueryTypeEnum
{
/// <summary>
/// 查询服务项目
/// </summary>
[Description("查询服务项目")]
QUERY_SERVICE_PROJECT,
/// <summary>
/// 查询服务项目和状态
/// </summary>
[Description("查询服务项目和状态")]
QUERY_SERVICE_PROJECT_STATUS,
}
}

@ -31,6 +31,6 @@ namespace Myshipping.Application
/// <summary> /// <summary>
/// 保存完是否直接发送派车 /// 保存完是否直接发送派车
/// </summary> /// </summary>
public bool IsSendDispatch { get; set; } public bool IsSendDispatch { get; set; } = false;
} }
} }

@ -0,0 +1,127 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 服务项目与状态详情
/// </summary>
public class ServiceProjectWithStatusDto
{
/// <summary>
/// 服务项目主键
/// </summary>
public string ProjectPKId { get; set; }
/// <summary>
/// 服务项目代码
/// </summary>
public string ProjectCode { get; set; }
/// <summary>
/// 服务项目名称
/// </summary>
public string ProjectName { get; set; }
/// <summary>
/// 显示顺序号
/// </summary>
public int SortNo { get; set; }
/// <summary>
/// 流程主键
/// </summary>
public string WFPKId { get; set; }
/// <summary>
/// 流程代码
/// </summary>
public string WFCode { get; set; }
/// <summary>
/// 发布版本号
/// </summary>
public string ReleaseVersion { get; set; }
/// <summary>
/// 发布日期
/// </summary>
public DateTime ReleaseDate { get; set; }
/// <summary>
/// 状态代码列表(方便检索)
/// </summary>
public string[] StatusSKUCodeArgs { get; set; }
/// <summary>
/// 状态列表
/// </summary>
public List<ServiceProjectStatusDto> StatusList { get; set; }
}
public class ServiceProjectStatusDto
{
/// <summary>
/// 状态主键
/// </summary>
public string SkuPKId { get; set; }
/// <summary>
/// 活动主键
/// </summary>
public string ActPKId { get; set; }
/// <summary>
/// 活动显示名称
/// </summary>
public string ActShowName { get; set; }
/// <summary>
/// 活动显示顺序号
/// </summary>
public int ActSortNo { get; set; }
/// <summary>
/// 状态代码
/// </summary>
public string StatusSKUCode { get; set; }
/// <summary>
/// 状态名称
/// </summary>
public string StatusSKUName { get; set; }
/// <summary>
/// 显示颜色(背景色)
/// </summary>
public string BackgroundColor { get; set; }
/// <summary>
/// 显示名称
/// </summary>
public string ShowName { get; set; }
/// <summary>
/// 显示顺序号
/// </summary>
public int SortNo { get; set; }
/// <summary>
/// 是否有子状态 true-有子状态 false-没有子状态
/// </summary>
public bool HasChild { get; set; } = false;
/// <summary>
/// 子状态列表
/// </summary>
List<ServiceProjectStatusDto> SubStatusList { get; set; }
/// <summary>
/// 触发器列表
/// </summary>
List<string> TriggerList { get; set; }
}
}

@ -52,5 +52,31 @@ namespace Myshipping.Application
/// 订舱编号 /// 订舱编号
/// </summary> /// </summary>
public string OrderNo { get; set; } public string OrderNo { get; set; }
/// <summary>
/// 查询类型
/// </summary>
public TrackingQueryTypeEnum QueryType { get; set; }
/// <summary>
/// 查询服务项目代码
/// </summary>
public string[] QueryServiceProjectCode { get; set; }
/// <summary>
/// 租户ID
/// </summary>
public string TenantId { get; set; }
/// <summary>
/// 租户名称
/// </summary>
public string TenantName { get; set; }
/// <summary>
/// 强制刷新缓存
/// </summary>
public bool IsReloadCache { get; set; } = false;
} }
} }

@ -70,6 +70,14 @@ namespace Myshipping.Application
.Map(dest => dest.StatusSKUName, src => src.STATUS_SKU_NAME) .Map(dest => dest.StatusSKUName, src => src.STATUS_SKU_NAME)
.Map(dest => dest.SortNo, src => src.SORT_NO); .Map(dest => dest.SortNo, src => src.SORT_NO);
config.ForType<StatusSkuBaseInfo, ServiceProjectStatusDto>()
.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<StatusSkuBaseInfo, StatusSkuBaseShowDto>() config.ForType<StatusSkuBaseInfo, StatusSkuBaseShowDto>()
.Map(dest => dest.PKId, src => src.PK_ID) .Map(dest => dest.PKId, src => src.PK_ID)
.Map(dest => dest.StatusSKUCode, src => src.STATUS_SKU_CODE) .Map(dest => dest.StatusSKUCode, src => src.STATUS_SKU_CODE)

@ -113,5 +113,21 @@ namespace Myshipping.Application
/// <param name="topNum">最大返回行数默认15</param> /// <param name="topNum">最大返回行数默认15</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> QueryActivitiesList(string queryItem, int topNum = 15); Task<TaskManageOrderResultDto> QueryActivitiesList(string queryItem, int topNum = 15);
/// <summary>
/// 检索可用的服务项目列表
/// </summary>
/// <param name="tenantId">租户ID</param>
/// <param name="isAvoidCache">是否不从缓存取值</param>
/// <returns>返回回执</returns>
Task<List<ServiceProjectBaseDto>> GetEnableProjectList(string tenantId, bool isAvoidCache = false);
/// <summary>
/// 检索可用的服务项目和状态列表
/// </summary>
/// <param name="tenantId">租户ID</param>
/// <param name="isAvoidCache">是否不从缓存取值</param>
/// <returns>返回回执</returns>
Task<List<ServiceProjectWithStatusDto>> GetEnableProjectWithStatusList(string tenantId, bool isAvoidCache = false);
} }
} }

@ -41,5 +41,13 @@ namespace Myshipping.Application
/// <param name="info">服务流程报文详情</param> /// <param name="info">服务流程报文详情</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> CancelStatus(TrackingMessageInfo info); Task<TaskManageOrderResultDto> CancelStatus(TrackingMessageInfo info);
/// <summary>
/// 查询当前租户下可用服务项目与状态详情
/// </summary>
/// <param name="info">查询服务项目请求报文</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> QueryServiceInfo(TrackingQueryMessageInfo info);
} }
} }

@ -7,6 +7,7 @@ using Mapster;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Myshipping.Application.Entity; using Myshipping.Application.Entity;
using Myshipping.Application.Helper; using Myshipping.Application.Helper;
using Myshipping.Core; using Myshipping.Core;
@ -38,8 +39,16 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<ServiceWorkFlowActivitiesSubRelation> _serviceWorkFlowActivitiesSubRelationRepository; private readonly SqlSugarRepository<ServiceWorkFlowActivitiesSubRelation> _serviceWorkFlowActivitiesSubRelationRepository;
private readonly SqlSugarRepository<ServiceWorkFlowReleaseInfo> _serviceWorkFlowReleaseInfoRepository; private readonly SqlSugarRepository<ServiceWorkFlowReleaseInfo> _serviceWorkFlowReleaseInfoRepository;
private readonly SqlSugarRepository<ServiceWorkFlowActivitiesTriggerRelation> _serviceWorkFlowActivitiesTriggerRelationRepository; private readonly SqlSugarRepository<ServiceWorkFlowActivitiesTriggerRelation> _serviceWorkFlowActivitiesTriggerRelationRepository;
private readonly SqlSugarRepository<StatusSkuBaseInfo> _statusSkuBaseInfoRepository;
private readonly ILogger<ServiceWorkFlowBaseService> _logger; private readonly ILogger<ServiceWorkFlowBaseService> _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<ServiceWorkFlowBaseInfo> serviceWorkFlowBaseRepository, public ServiceWorkFlowBaseService(SqlSugarRepository<ServiceWorkFlowBaseInfo> serviceWorkFlowBaseRepository,
ILogger<ServiceWorkFlowBaseService> logger, ILogger<ServiceWorkFlowBaseService> logger,
SqlSugarRepository<ServiceWorkFlowActivitiesInfo> serviceWorkFlowActivitiesInfoRepository, SqlSugarRepository<ServiceWorkFlowActivitiesInfo> serviceWorkFlowActivitiesInfoRepository,
@ -47,7 +56,9 @@ namespace Myshipping.Application
SqlSugarRepository<ServiceWorkFlowActivitiesRelation> serviceWorkFlowActivitiesRelationRepository, SqlSugarRepository<ServiceWorkFlowActivitiesRelation> serviceWorkFlowActivitiesRelationRepository,
SqlSugarRepository<ServiceWorkFlowActivitiesSubRelation> serviceWorkFlowActivitiesSubRelationRepository, SqlSugarRepository<ServiceWorkFlowActivitiesSubRelation> serviceWorkFlowActivitiesSubRelationRepository,
SqlSugarRepository<ServiceWorkFlowActivitiesTriggerRelation> serviceWorkFlowActivitiesTriggerRelationRepository, SqlSugarRepository<ServiceWorkFlowActivitiesTriggerRelation> serviceWorkFlowActivitiesTriggerRelationRepository,
SqlSugarRepository<ServiceWorkFlowReleaseInfo> serviceWorkFlowReleaseInfoRepository) SqlSugarRepository<ServiceWorkFlowReleaseInfo> serviceWorkFlowReleaseInfoRepository,
SqlSugarRepository<StatusSkuBaseInfo> statusSkuBaseInfoRepository,
IOptions<CacheOptions> cacheOptions, Func<string, ISingleton, object> resolveNamed)
{ {
_serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository; _serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository;
_serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository; _serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository;
@ -58,6 +69,10 @@ namespace Myshipping.Application
_serviceWorkFlowActivitiesSubRelationRepository = serviceWorkFlowActivitiesSubRelationRepository; _serviceWorkFlowActivitiesSubRelationRepository = serviceWorkFlowActivitiesSubRelationRepository;
_serviceWorkFlowReleaseInfoRepository = serviceWorkFlowReleaseInfoRepository; _serviceWorkFlowReleaseInfoRepository = serviceWorkFlowReleaseInfoRepository;
_serviceWorkFlowActivitiesTriggerRelationRepository = serviceWorkFlowActivitiesTriggerRelationRepository; _serviceWorkFlowActivitiesTriggerRelationRepository = serviceWorkFlowActivitiesTriggerRelationRepository;
_statusSkuBaseInfoRepository = statusSkuBaseInfoRepository;
_cacheOptions = cacheOptions.Value;
_cache = resolveNamed(_cacheOptions.CacheType.ToString(), default) as ICache;
} }
/// <summary> /// <summary>
@ -1702,5 +1717,231 @@ namespace Myshipping.Application
return result; return result;
} }
#endregion #endregion
#region 检索可用的服务项目列表
/// <summary>
/// 检索可用的服务项目列表
/// </summary>
/// <param name="tenantId">租户ID</param>
/// <param name="isAvoidCache">是否不从缓存取值</param>
/// <returns>返回回执</returns>
public async Task<List<ServiceProjectBaseDto>> GetEnableProjectList(string tenantId, bool isAvoidCache = false)
{
List<ServiceProjectBaseDto> projectList = _cache.Get<List<ServiceProjectBaseDto>>($"{CONST_CACHE_ENABLE_PROJECT}_{tenantId}");
if (isAvoidCache || projectList == null || projectList.Count == 0)
{
var list = _serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
.InnerJoin<ServiceWorkFlowProjectRelation>((wf, rela)
=> wf.PK_ID == rela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
.InnerJoin<ServiceProjectBaseInfo>((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<ServiceProjectBaseDto>())
.Distinct().OrderBy(a => a.SortNo).ToList();
await _cache.SetAsync($"{CONST_CACHE_ENABLE_PROJECT}_{tenantId}", projectList);
}
return projectList;
}
#endregion
#region 检索可用的服务项目和状态列表
/// <summary>
/// 检索可用的服务项目和状态列表
/// </summary>
/// <param name="tenantId">租户ID</param>
/// <param name="isAvoidCache">是否不从缓存取值</param>
/// <returns>返回回执</returns>
public async Task<List<ServiceProjectWithStatusDto>> GetEnableProjectWithStatusList(string tenantId, bool isAvoidCache = false)
{
List<ServiceProjectWithStatusDto> statusList = _cache.Get<List<ServiceProjectWithStatusDto>>($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}");
if (isAvoidCache || statusList == null || statusList.Count == 0)
{
var list = _serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
.InnerJoin<ServiceWorkFlowProjectRelation>((wf, rela)
=> wf.PK_ID == rela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
.InnerJoin<ServiceProjectBaseInfo>((wf, rela, prj)
=> rela.SERVICE_PROJECT_ID == prj.PK_ID)
.InnerJoin<ServiceWorkFlowActivitiesRelation>((wf, rela, prj,
arela)
=> wf.PK_ID == arela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == arela.WF_VERSION)
.InnerJoin<ServiceWorkFlowActivitiesInfo>((wf, rela, prj,
arela, act)
=> arela.SERVICE_ACTIVITIES_ID == act.PK_ID)
.LeftJoin<ServiceWorkFlowActivitiesSubRelation>((wf, rela, prj,
arela, act, srela)
=> wf.PK_ID == srela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == srela.WF_VERSION)
.LeftJoin<ServiceWorkFlowActivitiesInfo>((wf, rela, prj,
arela, act, srela, sact)
=> srela.SERVICE_ACTIVITIES_ID == act.PK_ID)
.Where((wf, rela, prj,
arela, act, srela, sact)
=> !string.IsNullOrWhiteSpace(wf.RELEASE_VERSION) && wf.BELONG_TENANT_ID == long.Parse(tenantId)
&& wf.IS_ENABLE == 1 && !wf.IsDeleted)
.Select((wf, rela, prj,
arela, act, srela, sact)
=> new { Project = prj, ARela = arela, Act = act, SRela = srela, SAct = sact }).ToList();
var statusSKUList = _statusSkuBaseInfoRepository.AsQueryable().Filter(null, true)
.Where(a => !a.IsDeleted && a.IS_ENABLE == 1 && a.TenantId == long.Parse(tenantId)).ToList();
statusList = list.GroupBy(a
=> a.Project.PK_ID)
.Select(a =>
{
var currList = a.ToList();
var prjDto = a.FirstOrDefault().Project.Adapt<ServiceProjectWithStatusDto>();
/*
currList.GroupBy(b=>b.Act.PK_ID)
.Select(c => {
var currActList = c.ToList();
var actDto = c.FirstOrDefault().Act;
})
var actList = currList
.OrderBy(b=>b.ARela.SORT_NO)
.Select(b
=>
{
b.
})
.Distinct().ToList();
b.Act.Adapt<ServiceWorkFlowActivitiesDto>()
if (currList.Any(b=>b.SAct != null))
{
var subList = currList
.OrderBy(b => b.SRela.SORT_NO)
.Where(b =>
b.SAct != null)
.Select(b =>
{
return new { SRela = b.SRela, SAct = b.SAct };
})
.Distinct().ToList();
}
prjDto.statusList = actList.GroupJoin(statusSKUList, l => l.STATUS_SKU_ID,
r => r.PK_ID, (l, r) => {
ServiceProjectStatusDto statusDto = new ServiceProjectStatusDto();
var sku = r.FirstOrDefault();
if(sku != null) {
statusDto = sku.Adapt<ServiceProjectStatusDto>();
}
statusDto.ShowName = l.SHOW_NAME;
statusDto.ShowSortNo =
});
*/
return prjDto;
}).ToList();
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<ServiceWorkFlowProjectRelation>((wf, rela)
=> wf.PK_ID == rela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
.InnerJoin<ServiceProjectBaseInfo>((wf, rela, prj)
=> rela.SERVICE_PROJECT_ID == prj.PK_ID)
.InnerJoin<ServiceWorkFlowActivitiesRelation>((wf, rela, prj,
arela)
=> wf.PK_ID == arela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == arela.WF_VERSION)
.InnerJoin<ServiceWorkFlowActivitiesInfo>((wf, rela, prj,
arela, act)
=> arela.SERVICE_ACTIVITIES_ID == act.PK_ID)
.LeftJoin<ServiceWorkFlowActivitiesSubRelation>((wf, rela, prj,
arela, act, srela)
=> wf.PK_ID == srela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == srela.WF_VERSION)
.LeftJoin<ServiceWorkFlowActivitiesInfo>((wf, rela, prj,
arela, act, srela, sact)
=> srela.SERVICE_ACTIVITIES_ID == act.PK_ID)
.Where((wf, rela, prj,
arela, act, srela, sact)
=> !string.IsNullOrWhiteSpace(wf.RELEASE_VERSION) && wf.BELONG_TENANT_ID == long.Parse(tenantId)
&& wf.IS_ENABLE == 1 && !wf.IsDeleted)
.Select((wf, rela, prj,
arela, act, srela, sact)
=> new { WF = wf,Project = prj, ARela = arela, Act = act, SRela = srela, SAct = sact }).ToList();
var statusList = list.GroupBy(a
=> a.Project.PK_ID)
.Select(a =>
{
var currList = a.ToList();
var wf = a.FirstOrDefault().WF;
var project = a.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<ServiceProjectStatusDto>()
};
baseDto.StatusList = currList
.GroupBy(b => b.Act.PK_ID)
.Select(c => {
var currActList = c.ToList();
var act = c.FirstOrDefault().Act;
var dto = new ServiceProjectStatusDto();
return dto;
}).ToList();
return baseDto;
}).ToList();
}
} }
} }

@ -4,14 +4,17 @@ using Furion.DynamicApiController;
using Furion.FriendlyException; using Furion.FriendlyException;
using Furion.JsonSerialization; using Furion.JsonSerialization;
using Google.Protobuf.Collections; using Google.Protobuf.Collections;
using Mapster;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Myshipping.Application.Entity; using Myshipping.Application.Entity;
using Myshipping.Core; using Myshipping.Core;
using Myshipping.Core.Entity; using Myshipping.Core.Entity;
using NPOI.OpenXmlFormats.Vml; using NPOI.OpenXmlFormats.Vml;
using NPOI.SS.Formula.Functions; using NPOI.SS.Formula.Functions;
using NPOI.SS.Formula.PTG;
using Org.BouncyCastle.Asn1.Tsp; using Org.BouncyCastle.Asn1.Tsp;
using Org.BouncyCastle.Ocsp; using Org.BouncyCastle.Ocsp;
using StackExchange.Profiling.Internal; using StackExchange.Profiling.Internal;
@ -44,9 +47,16 @@ namespace Myshipping.Application
private readonly SqlSugarRepository<SysUser> _sysUserRepository; private readonly SqlSugarRepository<SysUser> _sysUserRepository;
private readonly SqlSugarRepository<ServiceProjectBaseInfo> _serviceProjectBaseInfoRepository; private readonly SqlSugarRepository<ServiceProjectBaseInfo> _serviceProjectBaseInfoRepository;
private readonly SqlSugarRepository<ServiceWorkFlowRunLogInfo> _serviceWorkFlowRunLogInfoRepository; private readonly SqlSugarRepository<ServiceWorkFlowRunLogInfo> _serviceWorkFlowRunLogInfoRepository;
private readonly ICache _cache;
private readonly CacheOptions _cacheOptions;
private readonly IServiceWorkFlowBaseService _serviceWorkFlowBaseService; 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<ServiceWorkFlowBaseInfo> serviceWorkFlowBaseRepository, public ServiceWorkFlowManageService(SqlSugarRepository<ServiceWorkFlowBaseInfo> serviceWorkFlowBaseRepository,
ILogger<ServiceWorkFlowManageService> logger, ILogger<ServiceWorkFlowManageService> logger,
SqlSugarRepository<ServiceWorkFlowActivitiesInfo> serviceWorkFlowActivitiesInfoRepository, SqlSugarRepository<ServiceWorkFlowActivitiesInfo> serviceWorkFlowActivitiesInfoRepository,
@ -59,7 +69,8 @@ namespace Myshipping.Application
SqlSugarRepository<StatusSkuBaseInfo> statusSkuBaseInfoRepository, SqlSugarRepository<StatusSkuBaseInfo> statusSkuBaseInfoRepository,
IServiceWorkFlowBaseService serviceWorkFlowBaseService, SqlSugarRepository<SysUser> sysUserRepository, IServiceWorkFlowBaseService serviceWorkFlowBaseService, SqlSugarRepository<SysUser> sysUserRepository,
SqlSugarRepository<ServiceProjectBaseInfo> serviceProjectBaseInfoRepository, SqlSugarRepository<ServiceProjectBaseInfo> serviceProjectBaseInfoRepository,
SqlSugarRepository<ServiceWorkFlowRunLogInfo> serviceWorkFlowRunLogInfoRepository) SqlSugarRepository<ServiceWorkFlowRunLogInfo> serviceWorkFlowRunLogInfoRepository,
IOptions<CacheOptions> cacheOptions, Func<string, ISingleton, object> resolveNamed)
{ {
_serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository; _serviceWorkFlowBaseRepository = serviceWorkFlowBaseRepository;
_serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository; _serviceWorkFlowActivitiesInfoRepository = serviceWorkFlowActivitiesInfoRepository;
@ -76,6 +87,9 @@ namespace Myshipping.Application
_sysUserRepository = sysUserRepository; _sysUserRepository = sysUserRepository;
_serviceProjectBaseInfoRepository = serviceProjectBaseInfoRepository; _serviceProjectBaseInfoRepository = serviceProjectBaseInfoRepository;
_serviceWorkFlowRunLogInfoRepository = serviceWorkFlowRunLogInfoRepository; _serviceWorkFlowRunLogInfoRepository = serviceWorkFlowRunLogInfoRepository;
_cacheOptions = cacheOptions.Value;
_cache = resolveNamed(_cacheOptions.CacheType.ToString(), default) as ICache;
} }
#region 推送状态 #region 推送状态
@ -998,6 +1012,70 @@ namespace Myshipping.Application
return userTendDto; return userTendDto;
} }
#endregion #endregion
/// <summary>
/// 查询当前租户下可用服务项目与状态详情
/// </summary>
/// <param name="info">查询服务项目请求报文</param>
/// <returns>返回回执</returns>
[HttpPost("/ServiceWorkFlowManage/QueryServiceInfo")]
public async Task<TaskManageOrderResultDto> 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;
}
} }
} }

Loading…
Cancel
Save