数据穿透
This commit is contained in:
@@ -3,7 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Collections;
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
@@ -962,5 +963,160 @@ namespace BLL
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 获取集团单位列表
|
||||
|
||||
/// <summary>
|
||||
/// 获取集团单位列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.BaseInfoItem> getUnitLists()
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
List<Model.BaseInfoItem> list = new List<Model.BaseInfoItem>();
|
||||
try
|
||||
{
|
||||
string baseurl = $"{SysConstSetService.CNCECPath}/api/Unit/getUnitLists";
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
responeData.code = Funs.GetNewIntOrZero(obj["code"].ToString());
|
||||
responeData.message = obj["message"].ToString();
|
||||
if (responeData.code == 1)
|
||||
{
|
||||
JArray getData = JArray.Parse(obj["data"].ToString());
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
foreach (var item in getData)
|
||||
{
|
||||
var q = new Model.BaseInfoItem();
|
||||
q.BaseInfoId = item["BaseInfoId"].ToString();
|
||||
q.BaseInfoName = item["BaseInfoName"].ToString();
|
||||
q.BaseInfoCode = item["BaseInfoCode"].ToString();
|
||||
list.Add(q);
|
||||
}
|
||||
}
|
||||
responeData.message = "获取成功:集团单位数" + getData.Count().ToString() + "条";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "获取失败:" + ex.Message;
|
||||
ErrLogInfo.WriteLog("获取集团单位列表!", ex);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据单位获取项目列表
|
||||
|
||||
/// <summary>
|
||||
/// 获取集团单位列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<Model.BaseInfoItem> getProjectListByUnitId(string userId)
|
||||
{
|
||||
var responeData = new Model.ResponeData();
|
||||
List<Model.BaseInfoItem> list = new List<Model.BaseInfoItem>();
|
||||
try
|
||||
{
|
||||
string baseurl = $"{SysConstSetService.CNCECPath}/api/Unit/getProjectListByUnitId?unitId=" + userId + "&projectName=" + "&pageIndex=0" ;
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
responeData.code = Funs.GetNewIntOrZero(obj["code"].ToString());
|
||||
responeData.message = obj["message"].ToString();
|
||||
if (responeData.code == 1)
|
||||
{
|
||||
JArray getData = JArray.Parse(obj["data"].ToString());
|
||||
if (getData.Count() > 0)
|
||||
{
|
||||
foreach (var item in getData)
|
||||
{
|
||||
var q = new Model.BaseInfoItem();
|
||||
q.BaseInfoId = item["BaseInfoId"].ToString();
|
||||
q.BaseInfoName = item["BaseInfoName"].ToString();
|
||||
q.BaseInfoCode = item["BaseInfoCode"].ToString();
|
||||
list.Add(q);
|
||||
}
|
||||
}
|
||||
responeData.message = "获取成功:集团项目数" + getData.Count().ToString() + "条";
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = "获取失败:" + ex.Message;
|
||||
ErrLogInfo.WriteLog("获取集团项目数!", ex);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 根据单位id获取单位信息列表
|
||||
|
||||
/// <summary>
|
||||
/// 获取集团单位列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string getUnitApiUrlByUnitId(string userId)
|
||||
{
|
||||
string url = "";
|
||||
try
|
||||
{
|
||||
string baseurl = $"{SysConstSetService.CNCECPath}/api/Unit/getUnitApiUrlByUnitId?unitId=" + userId;
|
||||
string contenttype = "application/json;charset=unicode";
|
||||
Hashtable newToken = new Hashtable
|
||||
{
|
||||
{ "token", ServerService.GetToken().Token }
|
||||
};
|
||||
var strJosn = APIGetHttpService.Http(baseurl, "GET", contenttype, newToken, null);
|
||||
if (!string.IsNullOrEmpty(strJosn))
|
||||
{
|
||||
JObject obj = JObject.Parse(strJosn);
|
||||
if (Funs.GetNewIntOrZero(obj["code"].ToString()) == 1)
|
||||
{
|
||||
if (obj["data"] != null)
|
||||
{
|
||||
JObject dataObj = obj["data"] as JObject;
|
||||
if (dataObj != null && dataObj["BaseInfoCode"] != null)
|
||||
{
|
||||
url = dataObj["BaseInfoCode"].ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ErrLogInfo.WriteLog("获取失败!", ex);
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user