From 7d3fa5bf98f2a328879932934426ad533e61e21a Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Tue, 12 Jul 2022 11:27:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=BF=E9=98=B3=E6=99=BA=E6=85=A7=E5=A4=A7?= =?UTF-8?q?=E8=84=91=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../XmlConfig/system.config | 13 +++ .../DataCollection/DataCollectionBLL.cs | 50 +++++++++++ .../DataCollection/DataCollectionIBLL.cs | 27 ++++++ .../DataCollection/DataCollectionService.cs | 84 +++++++++++++++++++ .../Learun.Application.TwoDevelopment.csproj | 3 + .../Learun.Util/Web/HttpMethods.cs | 30 +++++++ 6 files changed, 207 insertions(+) create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionBLL.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionIBLL.cs create mode 100644 Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionService.cs diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config index 71d955007..324830c7c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/XmlConfig/system.config @@ -100,6 +100,19 @@ + + + + + + + + + + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionBLL.cs new file mode 100644 index 000000000..565683b97 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionBLL.cs @@ -0,0 +1,50 @@ +using Learun.Util; +using System; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.LR_Desktop +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2021-06-22 10:04 + /// 描 述:计算项目管理 + /// + public class DataCollectionBLL : DataCollectionIBLL + { + private DataCollectionService dataCollectionService = new DataCollectionService(); + + #region 获取数据 + + ///// + ///// 获取页面显示列表数据 + ///// + ///// 分页参数 + ///// 查询参数 + ///// + //public IEnumerable GetPageList(Pagination pagination, string queryJson) + //{ + // try + // { + // return calculateProjectService.GetPageList(pagination, queryJson); + // } + // catch (Exception ex) + // { + // if (ex is ExceptionEx) + // { + // throw; + // } + // else + // { + // throw ExceptionEx.ThrowBusinessException(ex); + // } + // } + //} + + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionIBLL.cs new file mode 100644 index 000000000..693d86b20 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionIBLL.cs @@ -0,0 +1,27 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.LR_Desktop +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2021-06-22 10:04 + /// 描 述:计算项目管理 + /// + public interface DataCollectionIBLL + { + #region 获取数据 + + ///// + ///// 获取页面显示列表数据 + ///// + ///// 查询参数 + ///// + //IEnumerable GetPageList(Pagination pagination, string queryJson); + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionService.cs new file mode 100644 index 000000000..759a7fae5 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LR_Desktop/DataCollection/DataCollectionService.cs @@ -0,0 +1,84 @@ +using Dapper; +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Text; +using Newtonsoft.Json; + +namespace Learun.Application.TwoDevelopment.LR_Desktop +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2021-06-22 10:04 + /// 描 述:计算项目管理 + /// + public class DataCollectionService : RepositoryFactory + { + #region 获取数据 + //接口地址 + private static string InsUrl = ConfigurationManager.AppSettings["CYInsUrl"]; + //客户标识 + private static string client_id = ConfigurationManager.AppSettings["CYClient_id"]; + //用户名 + private static string username = ConfigurationManager.AppSettings["CYUsername"]; + //密码 + private static string password = ConfigurationManager.AppSettings["CYPassword"]; + + //令牌 + private string access_token; + //刷新密钥 + private string client_secret; + //刷新令牌 + private string refresh_token; + + private DataCollectionService() + { + //用户授权 + var login_url = InsUrl + "/prod-api/api/web/collect/oauth2/login"; + var login_param = "{\"grant_type\":" + "" + ",\"client_id\":\"" + client_id + "\",\"username\":\"" + username + "\",\"password\":\"" + password + "\"}"; + var login_res_str = HttpMethods.Post(login_url, login_param); + var login_res = JsonConvert.DeserializeObject(login_res_str); + var login_data = login_res.data; + access_token = ((dynamic)login_data).access_token; + + } + + ///// + ///// 获取CalculateProject表实体数据 + ///// + ///// 主键 + ///// + //public CalculateProjectEntity GetCalculateProjectEntity(string keyValue) + //{ + // try + // { + // return this.BaseRepository("CollegeMIS").FindEntity(keyValue); + // } + // catch (Exception ex) + // { + // if (ex is ExceptionEx) + // { + // throw; + // } + // else + // { + // throw ExceptionEx.ThrowServiceException(ex); + // } + // } + //} + + #endregion + + public class InsResult + { + public int code { get; set; } + public string msg { get; set; } + public object data { get; set; } + } + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index d929dbe1b..eaf8dab73 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj @@ -347,6 +347,9 @@ + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Web/HttpMethods.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Web/HttpMethods.cs index a177705c6..33403c314 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Web/HttpMethods.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Web/HttpMethods.cs @@ -152,6 +152,7 @@ namespace Learun.Util public static string HttpPosts(string url, string json, WebHeaderCollection header) { string result = ""; + try { HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); @@ -183,5 +184,34 @@ namespace Learun.Util } } + + public static string HttpPostConnect(string url, string json,string connect) + { + string result = ""; + HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); + req.Method = "POST"; + req.ContentType = "application/json;charset=UTF-8"; + req.Headers.Add("Connect", connect); + + byte[] data = Encoding.UTF8.GetBytes(json);//把字符串转换为字节 + + req.ContentLength = data.Length; //请求长度 + + using (Stream reqStream = req.GetRequestStream()) //获取 + { + reqStream.Write(data, 0, data.Length);//向当前流中写入字节 + reqStream.Close(); //关闭当前流 + } + + HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); //响应结果 + Stream stream = resp.GetResponseStream(); + //获取响应内容 + using (StreamReader reader = new StreamReader(stream, Encoding.UTF8)) + { + result = reader.ReadToEnd(); + } + return result; + } + } }