using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEAWCS_QuartzJob.Models;
|
using WIDESEAWCS_QuartzJob.Repository;
|
using WIDESEAWCS_QuartzJob.Service;
|
|
namespace WIDESEAWCS_Tasks
|
{
|
public class RouterExtension : IRouterExtension
|
{
|
private readonly IRouterRepository _routerRepository;
|
|
public RouterExtension(IRouterRepository routerRepository)
|
{
|
_routerRepository = routerRepository;
|
}
|
|
public List<Dt_Router> GetEndPoint(string startPoint, int routeType)
|
{
|
List<Dt_Router> routers = new List<Dt_Router>();
|
try
|
{
|
List<Dt_Router> dt_Routers = _routerRepository.QueryData(x => x.StartPosi == startPoint && x.InOutType == routeType);
|
foreach (var item in dt_Routers)
|
{
|
if (item.IsEnd && !routers.Any(x => x.Id == item.Id))
|
{
|
routers.Add(item);
|
}
|
else
|
{
|
List<Dt_Router> tempRouters = GetEndPoint(item.NextPosi, routeType);
|
foreach (var router in tempRouters)
|
{
|
//如果下一个路由的起点和终点都匹配,则添加到路由列表中
|
if (router.IsEnd && !routers.Any(x => x.Id == router.Id))
|
{
|
routers.Add(router);
|
}
|
}
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
|
}
|
|
return routers;
|
}
|
}
|
}
|