@@ -100,6 +100,19 @@ | |||
<!-- ================== 默认密码 ================== --> | |||
<add key="defaultpwd" value="123456" /> | |||
<add key="defaultpwdeight" value="abc123**" /> | |||
<!-- ================== 长阳智慧大脑数据采集 ================== --> | |||
<!--接口地址--> | |||
<add key="CYInsUrl" value="http://202.205.188.198:9000" /> | |||
<!--授权类型--> | |||
<add key="CYGrant_type" value="bjquanjiang" /> | |||
<!--客户标识--> | |||
<add key="CYClient_id" value="bjquanjiang" /> | |||
<!--用户名--> | |||
<add key="CYUsername" value="bjquanjiang" /> | |||
<!--密码--> | |||
<add key="CYPassword" value="bjquanjiang" /> | |||
<!-- ================== 统一身份认证公钥密钥 ================== --> | |||
<add key="SSOPublicSecret" value="bjquanjiang" /> | |||
<add key="SSOUserSecret" value="123456789" /> | |||
@@ -0,0 +1,50 @@ | |||
using Learun.Util; | |||
using System; | |||
using System.Data; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-06-22 10:04 | |||
/// 描 述:计算项目管理 | |||
/// </summary> | |||
public class DataCollectionBLL : DataCollectionIBLL | |||
{ | |||
private DataCollectionService dataCollectionService = new DataCollectionService(); | |||
#region 获取数据 | |||
///// <summary> | |||
///// 获取页面显示列表数据 | |||
///// </summary> | |||
///// <param name="pagination">分页参数</param> | |||
///// <param name="queryJson">查询参数</param> | |||
///// <returns></returns> | |||
//public IEnumerable<CalculateProjectEntity> 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 | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
using Learun.Util; | |||
using System.Data; | |||
using System.Collections.Generic; | |||
namespace Learun.Application.TwoDevelopment.LR_Desktop | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-06-22 10:04 | |||
/// 描 述:计算项目管理 | |||
/// </summary> | |||
public interface DataCollectionIBLL | |||
{ | |||
#region 获取数据 | |||
///// <summary> | |||
///// 获取页面显示列表数据 | |||
///// </summary> | |||
///// <param name="queryJson">查询参数</param> | |||
///// <returns></returns> | |||
//IEnumerable<CalculateProjectEntity> GetPageList(Pagination pagination, string queryJson); | |||
#endregion | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 | |||
/// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 | |||
/// 创 建:超级管理员 | |||
/// 日 期:2021-06-22 10:04 | |||
/// 描 述:计算项目管理 | |||
/// </summary> | |||
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<InsResult>(login_res_str); | |||
var login_data = login_res.data; | |||
access_token = ((dynamic)login_data).access_token; | |||
} | |||
///// <summary> | |||
///// 获取CalculateProject表实体数据 | |||
///// </summary> | |||
///// <param name="keyValue">主键</param> | |||
///// <returns></returns> | |||
//public CalculateProjectEntity GetCalculateProjectEntity(string keyValue) | |||
//{ | |||
// try | |||
// { | |||
// return this.BaseRepository("CollegeMIS").FindEntity<CalculateProjectEntity>(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; } | |||
} | |||
} | |||
} |
@@ -347,6 +347,9 @@ | |||
<Compile Include="LR_CodeDemo\WorkOrder\WorkOrderBLL.cs" /> | |||
<Compile Include="LR_CodeDemo\WorkOrder\WorkOrderIBLL.cs" /> | |||
<Compile Include="LR_CodeDemo\WorkOrder\WorkOrderService.cs" /> | |||
<Compile Include="LR_Desktop\DataCollection\DataCollectionBLL.cs" /> | |||
<Compile Include="LR_Desktop\DataCollection\DataCollectionIBLL.cs" /> | |||
<Compile Include="LR_Desktop\DataCollection\DataCollectionService.cs" /> | |||
<Compile Include="LR_Desktop\QualityReportChild\QualityReportChildBLL.cs" /> | |||
<Compile Include="LR_Desktop\QualityReportChild\QualityReportChildEntity.cs" /> | |||
<Compile Include="LR_Desktop\QualityReportChild\QualityReportChildIBLL.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; | |||
} | |||
} | |||
} |