diff --git a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs index c706f7f5..dbb00811 100644 --- a/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs +++ b/Myshipping.Application/Service/TrackingSystem/Dtos/ServiceProjectWithStatusDto.cs @@ -117,11 +117,11 @@ namespace Myshipping.Application /// /// 子状态列表 /// - List SubStatusList { get; set; } + public List SubStatusList { get; set; } /// /// 触发器列表 /// - List TriggerList { get; set; } + public List TriggerList { get; set; } } } diff --git a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs index aeb92a16..36298f2b 100644 --- a/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs +++ b/Myshipping.Application/Service/TrackingSystem/ServiceWorkFlowBaseService.cs @@ -1725,7 +1725,8 @@ namespace Myshipping.Application /// 租户ID /// 是否不从缓存取值 /// 返回回执 - public async Task> GetEnableProjectList(string tenantId, bool isAvoidCache = false) + [HttpGet("/ServiceWorkFlowBase/GetEnableProjectList")] + public async Task> GetEnableProjectList([FromQuery]string tenantId, [FromQuery] bool isAvoidCache = false) { List projectList = _cache.Get>($"{CONST_CACHE_ENABLE_PROJECT}_{tenantId}"); @@ -1759,103 +1760,14 @@ namespace Myshipping.Application /// 租户ID /// 是否不从缓存取值 /// 返回回执 - public async Task> GetEnableProjectWithStatusList(string tenantId, bool isAvoidCache = false) + 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) { - 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, srela) - => wf.PK_ID == srela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == srela.WF_VERSION) - .LeftJoin((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(); - /* - 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() - - 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(); - } - - statusDto.ShowName = l.SHOW_NAME; - statusDto.ShowSortNo = - }); - */ - return prjDto; - - - }).ToList(); - - await _cache.SetAsync($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}", statusList); + CreateCacheInfo(tenantId); + //await _cache.SetAsync($"{CONST_CACHE_ENABLE_PROJECT_STATUS}_{tenantId}", statusList); } return statusList; @@ -1888,31 +1800,31 @@ namespace Myshipping.Application .InnerJoin((wf, rela, prj, arela, act) => arela.SERVICE_ACTIVITIES_ID == act.PK_ID) - .LeftJoin((wf, rela, prj, - arela, act, srela) - => wf.PK_ID == srela.SERVICE_WORKFLOW_ID && wf.RELEASE_VERSION == srela.WF_VERSION) - .LeftJoin((wf, rela, prj, - arela, act, srela, sact) - => srela.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, srela, sact) + 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, srela, sact) - => new { WF = wf,Project = prj, ARela = arela, Act = act, SRela = srela, SAct = sact }).ToList(); + 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 = a.FirstOrDefault().WF; - var project = a.FirstOrDefault().Project; + var wf = currList.FirstOrDefault().WF; + var project = currList.FirstOrDefault().Project; - ServiceProjectWithStatusDto baseDto = new ServiceProjectWithStatusDto { + ServiceProjectWithStatusDto baseDto = new ServiceProjectWithStatusDto + { ProjectPKId = project.PK_ID, ProjectCode = project.SERVICE_PROJECT_CODE, ProjectName = project.SERVICE_PROJECT_NAME, @@ -1929,10 +1841,19 @@ namespace Myshipping.Application .Select(c => { var currActList = c.ToList(); - var act = c.FirstOrDefault().Act; - - var dto = new ServiceProjectStatusDto(); + 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; @@ -1942,6 +1863,28 @@ namespace Myshipping.Application }).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(); + + + } } } }