From 5f2b8120848615d0427912c961d44372e1a5d589 Mon Sep 17 00:00:00 2001
From: chenzx <m15572880737@163.com>
Date: 星期四, 12 十二月 2024 19:45:42 +0800
Subject: [PATCH] czx20141212接口更新
---
.vs/PolicyControl/FileContentIndex/38bcb322-498b-4d31-ae00-a86beb0906ad.vsidx | 0
GasolineBlend.BLL/TreeDiagramRecordBLL.cs | 4
GasolineBlend.Entity/StockDataPage.cs | 41 ++++++++++
GasolineBlend.DAL/StockDataDAL.cs | 24 ++++++
GasolineBlend.BLL/StockDataBLL.cs | 24 ++++++
GasolineBlend.DAL/TreeDiagramRecordDAL.cs | 16 ++-
.vs/PolicyControl/FileContentIndex/8a4e2975-9fed-4b2f-ac5a-c87c346e1299.vsidx | 0
GasolineBlend.Entity/TreeDiagramRecord.cs | 4 +
GasolineBlend/Controllers/TreeDiagramRecord.cs | 51 ++++++++----
GasolineBlend/Controllers/StockDataController.cs | 35 ++++++++
.vs/PolicyControl/FileContentIndex/6c8460c3-9804-4bbc-a78b-0578aabdf329.vsidx | 0
.vs/PolicyControl/FileContentIndex/913507dd-72bf-4c9c-a867-18de68b289dd.vsidx | 0
12 files changed, 172 insertions(+), 27 deletions(-)
diff --git a/.vs/PolicyControl/FileContentIndex/38bcb322-498b-4d31-ae00-a86beb0906ad.vsidx b/.vs/PolicyControl/FileContentIndex/38bcb322-498b-4d31-ae00-a86beb0906ad.vsidx
new file mode 100644
index 0000000..96478a7
--- /dev/null
+++ b/.vs/PolicyControl/FileContentIndex/38bcb322-498b-4d31-ae00-a86beb0906ad.vsidx
Binary files differ
diff --git a/.vs/PolicyControl/FileContentIndex/6c8460c3-9804-4bbc-a78b-0578aabdf329.vsidx b/.vs/PolicyControl/FileContentIndex/6c8460c3-9804-4bbc-a78b-0578aabdf329.vsidx
new file mode 100644
index 0000000..bdc4101
--- /dev/null
+++ b/.vs/PolicyControl/FileContentIndex/6c8460c3-9804-4bbc-a78b-0578aabdf329.vsidx
Binary files differ
diff --git a/.vs/PolicyControl/FileContentIndex/8a4e2975-9fed-4b2f-ac5a-c87c346e1299.vsidx b/.vs/PolicyControl/FileContentIndex/8a4e2975-9fed-4b2f-ac5a-c87c346e1299.vsidx
new file mode 100644
index 0000000..82a0b52
--- /dev/null
+++ b/.vs/PolicyControl/FileContentIndex/8a4e2975-9fed-4b2f-ac5a-c87c346e1299.vsidx
Binary files differ
diff --git a/.vs/PolicyControl/FileContentIndex/913507dd-72bf-4c9c-a867-18de68b289dd.vsidx b/.vs/PolicyControl/FileContentIndex/913507dd-72bf-4c9c-a867-18de68b289dd.vsidx
new file mode 100644
index 0000000..cb3dbbb
--- /dev/null
+++ b/.vs/PolicyControl/FileContentIndex/913507dd-72bf-4c9c-a867-18de68b289dd.vsidx
Binary files differ
diff --git a/GasolineBlend.BLL/StockDataBLL.cs b/GasolineBlend.BLL/StockDataBLL.cs
new file mode 100644
index 0000000..eb6327f
--- /dev/null
+++ b/GasolineBlend.BLL/StockDataBLL.cs
@@ -0,0 +1,24 @@
+锘縰sing GasolineBlend.DAL;
+using GasolineBlend.Entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GasolineBlend.BLL
+{
+ public class StockDataBLL
+ {
+ private StockDataDAL _acc = new StockDataDAL();
+ /// <summary>
+ /// 鑾峰彇鐢ㄧ泭淇℃墭缃戣褰曟暟鎹�
+ /// </summary>
+ /// <returns></returns>
+ public List<StockDataPage> GetStockDataList(string CompanyName)
+ {
+ return _acc.GetStockDataList(CompanyName);
+ }
+
+ }
+}
diff --git a/GasolineBlend.BLL/TreeDiagramRecordBLL.cs b/GasolineBlend.BLL/TreeDiagramRecordBLL.cs
index 55b00ff..e53b049 100644
--- a/GasolineBlend.BLL/TreeDiagramRecordBLL.cs
+++ b/GasolineBlend.BLL/TreeDiagramRecordBLL.cs
@@ -17,9 +17,9 @@
/// 鑾峰彇鐢ㄧ泭淇℃墭缃戣褰曟暟鎹�
/// </summary>
/// <returns></returns>
- public List<TreeDiagramRecord> GetTreeDiagramRecordIsName(string CompanyName)
+ public List<TreeDiagramRecord> GetTreeDiagramRecordIsName(string CompanyName, int UserId)
{
- return _acc.GetTreeDiagramRecordIsName(CompanyName);
+ return _acc.GetTreeDiagramRecordIsName(CompanyName, UserId);
}
public bool AddTreeDiagramRecord(TreeDiagramRecord treeDiagramRecord)
diff --git a/GasolineBlend.DAL/StockDataDAL.cs b/GasolineBlend.DAL/StockDataDAL.cs
new file mode 100644
index 0000000..436687e
--- /dev/null
+++ b/GasolineBlend.DAL/StockDataDAL.cs
@@ -0,0 +1,24 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Dapper;
+using GasolineBlend.Entity;
+using MySql.Data.MySqlClient;
+
+namespace GasolineBlend.DAL
+{
+ public class StockDataDAL : BaseMySQLDAL
+ {
+ public List<StockDataPage> GetStockDataList(string CompanyName)
+ {
+ using (IDbConnection connection = new MySqlConnection(connectionString))
+ {
+ var sql = $"SELECT id,tickersymbol,stocktype,stockname,chinesename,city,secondaryindustry from stockdata WHERE chinesename like '%{CompanyName}%' LIMIT 1;";
+ return connection.Query<StockDataPage>(sql).ToList();
+ }
+ }
+ }
+}
diff --git a/GasolineBlend.DAL/TreeDiagramRecordDAL.cs b/GasolineBlend.DAL/TreeDiagramRecordDAL.cs
index ac1be69..6387c29 100644
--- a/GasolineBlend.DAL/TreeDiagramRecordDAL.cs
+++ b/GasolineBlend.DAL/TreeDiagramRecordDAL.cs
@@ -16,11 +16,11 @@
{
public class TreeDiagramRecordDAL : BaseMySQLDAL
{
- public List<TreeDiagramRecord> GetTreeDiagramRecordIsName(string CompanyName)
+ public List<TreeDiagramRecord> GetTreeDiagramRecordIsName(string CompanyName, int UserId)
{
using (IDbConnection connection = new MySqlConnection(connectionString))
{
- var sql = $"select * from treediagramrecord WHERE companyname='{CompanyName}';";
+ var sql = $"select * from treediagramrecord WHERE companyname='{CompanyName}' and UserId ='{UserId}';";
return connection.Query<TreeDiagramRecord>(sql).ToList();
}
}
@@ -29,13 +29,14 @@
using (IDbConnection connection = new MySqlConnection(connectionString))
{
var sql = @"
- INSERT INTO treediagramrecord (companyname, content, modificationtime)
- VALUES ( @CompanyName, @Content,NOW())";
+ INSERT INTO treediagramrecord (companyname, content,userid, modificationtime)
+ VALUES ( @CompanyName, @Content,@UserId,NOW())";
var parameters = new
{
CompanyName = treeDiagramRecord.CompanyName,
- Content = treeDiagramRecord.Content
+ Content = treeDiagramRecord.Content,
+ UserId = treeDiagramRecord.UserId
};
connection.Open(); // 鎵撳紑鏁版嵁搴撹繛鎺�
@@ -51,12 +52,13 @@
update treediagramrecord
set content=@Content,
modificationtime=NOW()
- where companyname=@CompanyName";
+ where companyname=@CompanyName and userid =@UserId";
var parameters = new
{
CompanyName = treeDiagramRecord.CompanyName,
- Content = treeDiagramRecord.Content
+ Content = treeDiagramRecord.Content,
+ UserId = treeDiagramRecord.UserId
};
connection.Open(); // 鎵撳紑鏁版嵁搴撹繛鎺�
diff --git a/GasolineBlend.Entity/StockDataPage.cs b/GasolineBlend.Entity/StockDataPage.cs
new file mode 100644
index 0000000..f298583
--- /dev/null
+++ b/GasolineBlend.Entity/StockDataPage.cs
@@ -0,0 +1,41 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GasolineBlend.Entity
+{
+ public class StockDataPage
+ {
+ /// <summary>
+ /// 搴忓彿
+ /// </summary>
+ public int Id { get; set; }
+ /// <summary>
+ /// 鑲$エ浠g爜
+ /// </summary>
+ public string TickerSymbol { get; set; }
+ /// <summary>
+ /// 鑲$エ绫诲瀷
+ /// </summary>
+ public string StockType { get; set; }
+ /// <summary>
+ /// 鑲$エ鍚嶇О
+ /// </summary>
+ public string StockName { get; set; }
+ /// <summary>
+ /// 鍩庡競
+ /// </summary>
+ public string City { get; set; }
+ /// <summary>
+ /// 涓枃鍚嶇О
+ /// </summary>
+ public string ChineseName { get; set; }
+ /// <summary>
+ /// 鍖�
+ /// </summary>
+ public string SecondaryIndustry { get; set; }
+
+ }
+}
diff --git a/GasolineBlend.Entity/TreeDiagramRecord.cs b/GasolineBlend.Entity/TreeDiagramRecord.cs
index 2f9b9a1..432b021 100644
--- a/GasolineBlend.Entity/TreeDiagramRecord.cs
+++ b/GasolineBlend.Entity/TreeDiagramRecord.cs
@@ -21,6 +21,10 @@
/// </summary>
public string Content { get; set; }
/// <summary>
+ /// 鎻愮ず璇�
+ /// </summary>
+ public int UserId { get; set; }
+ /// <summary>
///淇敼鏃堕棿
/// </summary>
public DateTime ModificationTime { get; set; }
diff --git a/GasolineBlend/Controllers/StockDataController.cs b/GasolineBlend/Controllers/StockDataController.cs
new file mode 100644
index 0000000..2b88c93
--- /dev/null
+++ b/GasolineBlend/Controllers/StockDataController.cs
@@ -0,0 +1,35 @@
+锘縰sing CommonHelper;
+using GasolineBlend.BLL;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.Mvc;
+
+
+namespace GasolineBlend.Controllers
+{
+ public class StockDataController : BaseController
+ {
+ private StockDataBLL _acc = new StockDataBLL();
+ /// <summary>
+ ///鑾峰彇涓婂競鍏徃鍒楄〃鏁版嵁
+ /// </summary>
+ /// <param name="CompanyName"></param>
+ /// <returns></returns>
+ [HttpPost]
+ public ActionResult GetStockDataList(string CompanyName)
+ {
+ try
+ {
+ var list = _acc.GetStockDataList(CompanyName);
+ return SuccessNoShow(data: list);
+ }
+ catch (Exception e)
+ {
+ LogHelper.Write(Level.Error, "鑾峰彇鍦板尯鍒楄〃鏁版嵁 GetStockDataList", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
+ return Error();
+ }
+ }
+ }
+}
diff --git a/GasolineBlend/Controllers/TreeDiagramRecord.cs b/GasolineBlend/Controllers/TreeDiagramRecord.cs
index 605cd83..659639e 100644
--- a/GasolineBlend/Controllers/TreeDiagramRecord.cs
+++ b/GasolineBlend/Controllers/TreeDiagramRecord.cs
@@ -24,16 +24,20 @@
{
try
{
- var list = _acc.GetTreeDiagramRecordIsName(CompanyName);
- if (list != null && list.Count > 0)
+ if (OperatorProvider.Instance?.Current?.UserId != null)
{
- return SuccessNoShow(data: list);
+ var list = _acc.GetTreeDiagramRecordIsName(CompanyName, OperatorProvider.Instance.Current.UserId);
+ if (list != null && list.Count > 0)
+ {
+ return SuccessNoShow(data: list);
+ }
+ return SuccessNoShow(data: null);
}
return SuccessNoShow(data: null);
}
catch (Exception e)
{
- LogHelper.Write(Level.Error, "鑾峰彇鍦板尯鏅鸿兘浣撴暟鎹� GetTreeDiagramRecordIsId", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
+ LogHelper.Write(Level.Error, "鑾峰彇鏍戠姸鍥炬暟鎹� GetTreeDiagramRecordIsId", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
return Error();
}
}
@@ -48,17 +52,22 @@
{
try
{
- var list = _acc.GetTreeDiagramRecordIsName(treeDiagramRecord.CompanyName);
- if (list.Count == 0)
+ if (OperatorProvider.Instance?.Current?.UserId != null)
{
- bool isAdd = _acc.AddTreeDiagramRecord(treeDiagramRecord);
- return isAdd ? SuccessNoShow() : Error();
+ treeDiagramRecord.UserId = OperatorProvider.Instance.Current.UserId;
+ var list = _acc.GetTreeDiagramRecordIsName(treeDiagramRecord.CompanyName, treeDiagramRecord.UserId);
+ if (list.Count == 0)
+ {
+ bool isAdd = _acc.AddTreeDiagramRecord(treeDiagramRecord);
+ return isAdd ? SuccessNoShow() : Error();
+ }
+ return SuccessNoShow(data: null);
}
return SuccessNoShow(data: null);
}
catch (Exception e)
{
- LogHelper.Write(Level.Error, "娣诲姞鏅鸿兘浣� AddTreeDiagramRecord" +
+ LogHelper.Write(Level.Error, "娣诲姞鏍戠姸鍥炬暟鎹� AddTreeDiagramRecord" +
"" +
"", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
return Error();
@@ -75,20 +84,26 @@
{
try
{
- var list = _acc.GetTreeDiagramRecordIsName(treeDiagramRecord.CompanyName);
- if (list != null && list.Count != 0)
+ if (OperatorProvider.Instance?.Current?.UserId != null)
{
- bool isUpdata = _acc.UpdateTreeDiagramRecord(treeDiagramRecord);
- return isUpdata ? SuccessNoShow() : Error();
- }
- else {
- bool isUpdata = _acc.AddTreeDiagramRecord(treeDiagramRecord);
- }
+ treeDiagramRecord.UserId = OperatorProvider.Instance.Current.UserId;
+ var list = _acc.GetTreeDiagramRecordIsName(treeDiagramRecord.CompanyName, treeDiagramRecord.UserId);
+ if (list != null && list.Count != 0)
+ {
+ bool isUpdata = _acc.UpdateTreeDiagramRecord(treeDiagramRecord);
+ return isUpdata ? SuccessNoShow() : Error();
+ }
+ else
+ {
+ bool isUpdata = _acc.AddTreeDiagramRecord(treeDiagramRecord);
+ }
+ return SuccessNoShow(data: null);
+ }
return SuccessNoShow(data: null);
}
catch (Exception e)
{
- LogHelper.Write(Level.Error, "淇敼鏅鸿兘浣� UpdateTreeDiagramRecord" +
+ LogHelper.Write(Level.Error, "淇敼鏍戠姸鍥炬暟鎹� UpdateTreeDiagramRecord" +
"" +
"", e, OperatorProvider.Instance.Current == null ? "GuestEx" : OperatorProvider.Instance.Current.LoginName);
return Error();
--
Gitblit v1.8.0