using System.Linq; using System.Threading.Tasks; using System.Web.Mvc; using RiskControl.NewService.Service; namespace GasolineBlend.Controllers { public class RRController : BaseController { private readonly RRService _rrService = new RRService(); [HttpPost] public async Task GetRRGraphChain(string mainNode) { var list = await _rrService.GetRRGraphChain(mainNode); var res = list.Select(a => new { label = a.AssociationNode, type = a.Relationship == "上级" ? "top" : "next", id = a.Id }).ToList(); var maxid = list.Max(a => a.Id); res.Add(new {label =mainNode, type="main", id = 0}); res.Add(new {label ="上级", type="topText", id = maxid+1}); res.Add(new {label ="下级", type="nextText", id = maxid+2}); res = res.OrderBy(a => a.id).ToList(); return SuccessNoShow(data: res); } } }