|
|
|
@ -13,6 +13,7 @@ using Myshipping.Application.Helper;
|
|
|
|
|
using Myshipping.Core;
|
|
|
|
|
using Myshipping.Core.Entity;
|
|
|
|
|
using MySqlX.XDevAPI.Common;
|
|
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
|
using NPOI.SS.Formula.PTG;
|
|
|
|
|
using NPOI.Util;
|
|
|
|
|
using SqlSugar;
|
|
|
|
@ -1760,13 +1761,19 @@ namespace Myshipping.Application
|
|
|
|
|
/// <param name="tenantId">租户ID</param>
|
|
|
|
|
/// <param name="isAvoidCache">是否不从缓存取值</param>
|
|
|
|
|
/// <returns>返回回执</returns>
|
|
|
|
|
[HttpGet("/ServiceWorkFlowBase/GetEnableProjectWithStatusList")]
|
|
|
|
|
public async Task<List<ServiceProjectWithStatusDto>> GetEnableProjectWithStatusList([FromQuery] string tenantId, [FromQuery] bool isAvoidCache = false)
|
|
|
|
|
{
|
|
|
|
|
if(string.IsNullOrWhiteSpace(tenantId))
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Oh($"租户ID不能为空", typeof(InvalidOperationException));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<ServiceProjectWithStatusDto> statusList = _cache.Get<List<ServiceProjectWithStatusDto>>($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}");
|
|
|
|
|
|
|
|
|
|
if (isAvoidCache || statusList == null || statusList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
CreateCacheInfo(tenantId);
|
|
|
|
|
statusList = CreateCacheInfo(tenantId);
|
|
|
|
|
//await _cache.SetAsync($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}", statusList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1775,7 +1782,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private void CreateCacheInfo(string tenantId)
|
|
|
|
|
private List<ServiceProjectWithStatusDto> CreateCacheInfo(string tenantId)
|
|
|
|
|
{
|
|
|
|
|
var statusSKUList = _statusSkuBaseInfoRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.Where(a => !a.IsDeleted && a.IS_ENABLE == 1 && a.TenantId == long.Parse(tenantId)).ToList();
|
|
|
|
@ -1814,8 +1821,75 @@ namespace Myshipping.Application
|
|
|
|
|
arela, act)
|
|
|
|
|
=> new { WF = wf,Project = prj, ARela = arela, Act = act }).ToList();
|
|
|
|
|
|
|
|
|
|
List<ServiceProjectStatusDto> subActList = new List<ServiceProjectStatusDto>();
|
|
|
|
|
|
|
|
|
|
if (list.Any(a => a.ARela.IS_CONTAINS_SUB == 1))
|
|
|
|
|
{
|
|
|
|
|
//如果存在子活动的,需要关联
|
|
|
|
|
var sublist =
|
|
|
|
|
_serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.InnerJoin<ServiceWorkFlowActivitiesSubRelation>((wf, rela)
|
|
|
|
|
=> wf.PK_ID == rela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
|
|
|
|
|
.InnerJoin<ServiceWorkFlowActivitiesInfo>((wf, rela, act)
|
|
|
|
|
=> rela.SUB_SERVICE_ACTIVITIES_ID == act.PK_ID)
|
|
|
|
|
.LeftJoin<ServiceWorkFlowActivitiesTriggerRelation>((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<StatusTriggerConditionInfo>((wf, rela, act, trgrela, trg)
|
|
|
|
|
=> trgrela.STATUS_TRIGGER_ID == trg.PK_ID)
|
|
|
|
|
.Where((wf, rela, act,
|
|
|
|
|
trgrela, trg)
|
|
|
|
|
=> !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();
|
|
|
|
|
|
|
|
|
|
subActList = sublist.GroupBy(a=>a.Rela.SERVICE_ACTIVITIES_ID)
|
|
|
|
|
.Select(a => {
|
|
|
|
|
var currList = a.ToList();
|
|
|
|
|
|
|
|
|
|
var act = currList.FirstOrDefault().Act;
|
|
|
|
|
var rela = currList.FirstOrDefault().Rela;
|
|
|
|
|
var wf = currList.FirstOrDefault().WF;
|
|
|
|
|
|
|
|
|
|
var dto = new ServiceProjectStatusDto
|
|
|
|
|
{
|
|
|
|
|
ActPKId = rela.SERVICE_ACTIVITIES_ID,
|
|
|
|
|
WFPKId = wf.PK_ID,
|
|
|
|
|
HasChild = false,
|
|
|
|
|
SubStatusList = new List<ServiceProjectStatusDto>()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
dto.SubStatusList = currList.Select(e => {
|
|
|
|
|
|
|
|
|
|
var skuInfo = statusSKUList.FirstOrDefault(e => e.PK_ID == act.STATUS_SKU_ID);
|
|
|
|
|
|
|
|
|
|
var itemDto = new ServiceProjectStatusDto
|
|
|
|
|
{
|
|
|
|
|
SkuPKId = act.STATUS_SKU_ID,
|
|
|
|
|
ActPKId = act.PK_ID,
|
|
|
|
|
ShowName = act.SHOW_NAME,
|
|
|
|
|
ActSortNo = e.Rela.SORT_NO,
|
|
|
|
|
WFPKId = wf.PK_ID,
|
|
|
|
|
StatusSKUCode = skuInfo.STATUS_SKU_CODE,
|
|
|
|
|
StatusSKUName = skuInfo.STATUS_SKU_NAME,
|
|
|
|
|
BackgroundColor = skuInfo.BACKGROUND_COLOR,
|
|
|
|
|
SortNo = skuInfo.SORT_NO,
|
|
|
|
|
HasChild = false,
|
|
|
|
|
ParentActPKId = e.Rela.SERVICE_ACTIVITIES_ID,
|
|
|
|
|
SubStatusList = new List<ServiceProjectStatusDto>(),
|
|
|
|
|
TriggerList = new List<string>()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return itemDto;
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
return dto;
|
|
|
|
|
}).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var statusList = list.GroupBy(a
|
|
|
|
|
=> a.Project.PK_ID)
|
|
|
|
|
=> a.WF.PK_ID)
|
|
|
|
|
.Select(a =>
|
|
|
|
|
{
|
|
|
|
|
var currList = a.ToList();
|
|
|
|
@ -1843,18 +1917,29 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
var act = currActList.FirstOrDefault().Act;
|
|
|
|
|
var ARela = currActList.FirstOrDefault().ARela;
|
|
|
|
|
var skuInfo = statusSKUList.FirstOrDefault(e => e.PK_ID == act.STATUS_SKU_ID);
|
|
|
|
|
|
|
|
|
|
var dto = new ServiceProjectStatusDto
|
|
|
|
|
{
|
|
|
|
|
SkuPKId = act.STATUS_SKU_ID,
|
|
|
|
|
ActPKId = act.PK_ID,
|
|
|
|
|
ActShowName = act.SHOW_NAME,
|
|
|
|
|
ShowName = act.SHOW_NAME,
|
|
|
|
|
ActSortNo = ARela.SORT_NO,
|
|
|
|
|
WFPKId = wf.PK_ID,
|
|
|
|
|
StatusSKUCode = skuInfo.STATUS_SKU_CODE,
|
|
|
|
|
StatusSKUName = skuInfo.STATUS_SKU_NAME,
|
|
|
|
|
BackgroundColor = skuInfo.BACKGROUND_COLOR,
|
|
|
|
|
SortNo = skuInfo.SORT_NO,
|
|
|
|
|
HasChild = ARela.IS_CONTAINS_SUB == 1 ? true : false,
|
|
|
|
|
SubStatusList = new List<ServiceProjectStatusDto>(),
|
|
|
|
|
TriggerList = new List<string>()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if(ARela.IS_CONTAINS_SUB == 1)
|
|
|
|
|
{
|
|
|
|
|
dto.SubStatusList = subActList.FirstOrDefault(e=>e.ActPKId == act.PK_ID).SubStatusList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return dto;
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
@ -1864,27 +1949,7 @@ namespace Myshipping.Application
|
|
|
|
|
}).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (list.Any(a=>a.ARela.IS_CONTAINS_SUB == 1))
|
|
|
|
|
{
|
|
|
|
|
//如果存在子活动的,需要关联
|
|
|
|
|
var sublist = _serviceWorkFlowBaseRepository.AsQueryable().Filter(null, true)
|
|
|
|
|
.InnerJoin<ServiceWorkFlowActivitiesSubRelation>((wf, rela)
|
|
|
|
|
=> wf.PK_ID == rela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == rela.WF_VERSION)
|
|
|
|
|
.InnerJoin<ServiceWorkFlowActivitiesInfo>((wf, rela,act)
|
|
|
|
|
=> rela.SERVICE_ACTIVITIES_ID == act.PK_ID)
|
|
|
|
|
.LeftJoin<ServiceWorkFlowActivitiesTriggerRelation>((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<StatusTriggerConditionInfo>((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();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return statusList;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|