From d6ae263adb0e32fd3c4496cbc0c180d63ced763e Mon Sep 17 00:00:00 2001
From: WX <wx036@qq.com>
Date: 星期六, 09 十二月 2023 20:47:54 +0800
Subject: [PATCH] 图谱接口需求

---
 GasolineBlend/GasolineBlend.csproj                          |    1 
 RiskControl.NewService/RiskControl.NewService.csproj        |    2 +
 RiskControl.NewService/Entity/RiskControlRR/RRGraphChain.cs |   25 ++++++++++++
 RiskControl.NewService/Service/RRService.cs                 |   17 ++++++++
 GasolineBlend/Controllers/RRController.cs                   |   30 +++++++++++++++
 5 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/GasolineBlend/Controllers/RRController.cs b/GasolineBlend/Controllers/RRController.cs
new file mode 100644
index 0000000..e72b2ba
--- /dev/null
+++ b/GasolineBlend/Controllers/RRController.cs
@@ -0,0 +1,30 @@
+锘縰sing 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<ActionResult> 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);
+        }
+    }
+}
\ No newline at end of file
diff --git a/GasolineBlend/GasolineBlend.csproj b/GasolineBlend/GasolineBlend.csproj
index 6307d36..9e0bc39 100644
--- a/GasolineBlend/GasolineBlend.csproj
+++ b/GasolineBlend/GasolineBlend.csproj
@@ -328,6 +328,7 @@
     <Compile Include="Controllers\PageRouteController.cs" />
     <Compile Include="Controllers\PjrzController.cs" />
     <Compile Include="Controllers\PjrzDataCountController.cs" />
+    <Compile Include="Controllers\RRController.cs" />
     <Compile Include="Controllers\UseController.cs" />
     <Compile Include="Controllers\PayController.cs" />
     <Compile Include="Controllers\ProjectController.cs" />
diff --git a/RiskControl.NewService/Entity/RiskControlRR/RRGraphChain.cs b/RiskControl.NewService/Entity/RiskControlRR/RRGraphChain.cs
new file mode 100644
index 0000000..ba187b1
--- /dev/null
+++ b/RiskControl.NewService/Entity/RiskControlRR/RRGraphChain.cs
@@ -0,0 +1,25 @@
+锘縰sing SqlSugar;
+
+namespace RiskControl.NewService.Entity.RiskControlRR
+{
+    public class RRGraphChain
+    {
+        /// <summary>
+        ///  
+        ///</summary>
+        [SugarColumn(ColumnName = "Id", IsPrimaryKey = true, IsIdentity = true)]
+        public int Id { get; set; }
+        /// <summary>
+        /// 涓績鐐�
+        /// </summary>
+        public string MainNode { get; set; }
+        /// <summary>
+        /// 鍏宠仈鑺傜偣
+        /// </summary>
+        public string AssociationNode { get; set; }
+        /// <summary>
+        /// 鍏崇郴
+        /// </summary>
+        public string Relationship { get; set; }
+    }
+}
\ No newline at end of file
diff --git a/RiskControl.NewService/RiskControl.NewService.csproj b/RiskControl.NewService/RiskControl.NewService.csproj
index 8b33a8b..dc15a07 100644
--- a/RiskControl.NewService/RiskControl.NewService.csproj
+++ b/RiskControl.NewService/RiskControl.NewService.csproj
@@ -160,6 +160,7 @@
     <Compile Include="Entity\CreditRatingReportStar.cs" />
     <Compile Include="Entity\QccDbEntity\SysCompanyOriginalName.cs" />
     <Compile Include="Entity\RiskControlRR\PayErrLog.cs" />
+    <Compile Include="Entity\RiskControlRR\RRGraphChain.cs" />
     <Compile Include="Entity\RiskControlRR\UseOrder.cs" />
     <Compile Include="Entity\RiskControlRR\PayOrder.cs" />
     <Compile Include="Entity\RiskControlRR\PayRechargeAmount.cs" />
@@ -558,6 +559,7 @@
     <Compile Include="Service\IndustryChainService.cs" />
     <Compile Include="Service\LeaseProjService.cs" />
     <Compile Include="Service\PjrzService.cs" />
+    <Compile Include="Service\RRService.cs" />
     <Compile Include="Service\UseService.cs" />
     <Compile Include="Service\SmartInvestAlarmService.cs" />
     <Compile Include="Service\LeaseAlarmService.cs" />
diff --git a/RiskControl.NewService/Service/RRService.cs b/RiskControl.NewService/Service/RRService.cs
new file mode 100644
index 0000000..57d3355
--- /dev/null
+++ b/RiskControl.NewService/Service/RRService.cs
@@ -0,0 +1,17 @@
+锘縰sing System.Collections.Generic;
+using System.Threading.Tasks;
+using RiskControl.NewService.Entity.RiskControlRR;
+
+namespace RiskControl.NewService.Service
+{
+    public class RRService : DbContext
+    {
+        public async Task<List<RRGraphChain>> GetRRGraphChain(string mainNode)
+        {
+            var list = await RiskControlRRDb.Queryable<RRGraphChain>()
+                .Where(a => a.MainNode == mainNode)
+                .ToListAsync();
+            return list;
+        }
+    }
+}
\ No newline at end of file

--
Gitblit v1.8.0