增加集团报表

This commit is contained in:
2024-10-25 18:17:05 +08:00
parent 6ca0a319b1
commit d02a7a1abc
22 changed files with 2251 additions and 2062 deletions
+38 -32
View File
@@ -11,7 +11,7 @@ using System.Threading.Tasks;
namespace BLL
{
public static class ServerService
public static class ServerService
{
public static Model.TokenItem GetCNCECToken()
{
@@ -30,47 +30,53 @@ namespace BLL
Console.WriteLine(response.Content);
var responeData = JsonConvert.DeserializeObject<Model.ResponeData>(response.Content.ToString());
TokenItem tokenItem = new TokenItem();
if (responeData.code==1&&string .IsNullOrEmpty(responeData.message) )
if (responeData.code == 1 && string.IsNullOrEmpty(responeData.message))
{
var token = JsonConvert.DeserializeObject<Model.TokenItem>(responeData.data.ToString());
tokenItem.Token=token.Token.ToString();
tokenItem.ExpiryTime= token.ExpiryTime.ToString();
tokenItem.Token = token.Token.ToString();
tokenItem.ExpiryTime = token.ExpiryTime.ToString();
SysConstSetService.SetToken(tokenItem.Token);
SysConstSetService.SetTokenExpirationTime(tokenItem.ExpiryTime);
}
return tokenItem;
}
public static Model.ReturnData PushCNCEC(string JsonBody,string apiurl)
{
Model.ReturnData responeData = new Model.ReturnData();
string CNCECPath = SysConstSetService.CNCECPath;
if (string.IsNullOrEmpty(CNCECPath))
{
responeData.code = 0;
responeData.message = "接口地址为空,请配置!";
return responeData;
}
string baseurl = CNCECPath + apiurl;
var client = new RestClient(baseurl);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var tokenItem = GetToken();
request.AddHeader("token", tokenItem.Token);
request.AddJsonBody(JsonBody);
IRestResponse response = client.Execute(request);
APICommonService.SaveSysHttpLog("api_Out", baseurl, response.Content);
var returnData = JsonConvert.DeserializeObject<Model.ResponeData>(response.Content.ToString());
if (returnData.code == 0)
}
public static Model.ReturnData PushCNCEC(string JsonBody, string apiurl)
{
try
{
responeData.code = 0;
Model.ReturnData responeData = new Model.ReturnData();
string CNCECPath = SysConstSetService.CNCECPath;
//string CNCECPath = "http://localhost:7143";
if (string.IsNullOrEmpty(CNCECPath))
{
responeData.code = 0;
responeData.message = "接口地址为空,请配置!";
return responeData;
}
string baseurl = CNCECPath + apiurl;
var client = new RestClient(baseurl);
client.Timeout = -1;
var request = new RestRequest(Method.POST);
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
var tokenItem = GetToken();
request.AddHeader("token", tokenItem.Token);
request.AddJsonBody(JsonBody);
IRestResponse response = client.Execute(request);
APICommonService.SaveSysHttpLog("api_Out", baseurl, response.Content);
var returnData = JsonConvert.DeserializeObject<Model.ResponeData>(response.Content.ToString());
responeData.code = returnData.code;
responeData.message = returnData.message;
return responeData;
}
return responeData;
catch (Exception ex)
{
throw;
}
}
public static Model.TokenItem GetToken()
{
@@ -81,7 +87,7 @@ namespace BLL
{
//DateTime.Parse(SysConstSetService.CNCECTTokenExTime).AddMinutes(-10) > DateTime.Now
tokenItem = GetCNCECToken();
}
}
else if (DateTime.Parse(SysConstSetService.CNCECTTokenExTime).AddMinutes(-10) < DateTime.Now)
{
tokenItem = GetCNCECToken();
@@ -99,7 +99,7 @@ namespace BLL
{
return (from x in Funs.DB.Environmental_EnergyReportItem
where x.EnergyReportId == EnergyReportId
orderby x.SortIndex
orderby x.SortIndex,x.SortUnit
select x).ToList();
}
@@ -141,38 +141,39 @@ namespace BLL
{
var q = (from x in Funs.DB.Environmental_EnergyReportItem
where x.EnergyReportId == EnergyReportId
orderby x.SortIndex
orderby x.SortIndex,x.SortUnit
select x).ToList();
List<Model.Environmental_EnergyReportItem> newItems = new List<Model.Environmental_EnergyReportItem>();
foreach (var item in q)
{
Model.Environmental_EnergyReportItem newItem = new Model.Environmental_EnergyReportItem();
//List<Model.Environmental_EnergyReportItem> newItems = new List<Model.Environmental_EnergyReportItem>();
//foreach (var item in q)
//{
// Model.Environmental_EnergyReportItem newItem = new Model.Environmental_EnergyReportItem();
newItem.EnergyReportItemId = item.EnergyReportItemId;
newItem.EnergyReportId = item.EnergyReportId;
newItem.SortIndex = item.SortIndex;
newItem.BusinessCategory = item.BusinessCategory;
newItem.Throughput_BasePeriod = item.Throughput_BasePeriod;
newItem.Throughput_LastPeriod = item.Throughput_LastPeriod;
newItem.Throughput_ThisPeriod = item.Throughput_ThisPeriod;
newItem.Throughput_UnitOfMeasurement = item.Throughput_UnitOfMeasurement;
newItem.Yield_BasePeriod = item.Yield_BasePeriod;
newItem.Yield_LastPeriod = item.Yield_LastPeriod;
newItem.Yield_ThisPeriod = item.Yield_ThisPeriod;
newItem.Yield_UnitOfMeasurement = item.Yield_UnitOfMeasurement;
newItem.OutputValue_BasePeriod = item.OutputValue_BasePeriod;
newItem.OutputValue_LastYear = item.OutputValue_LastYear;
newItem.OutputValue_ThisYear = item.OutputValue_ThisYear;
newItem.OperationScale_BasePeriod = item.OperationScale_BasePeriod;
newItem.OperationScale_LastYear = item.OperationScale_LastYear;
newItem.OperationScale_ThisYear = item.OperationScale_ThisYear;
newItem.OperationScale_UnitOfMeasurement = item.OperationScale_UnitOfMeasurement;
newItem.ServiceOperatingIncome_BasePeriod = item.ServiceOperatingIncome_BasePeriod;
newItem.ServiceOperatingIncome_LastYear = item.ServiceOperatingIncome_LastYear;
newItem.ServiceOperatingIncome_ThisYear = item.ServiceOperatingIncome_ThisYear;
newItems.Add(newItem);
}
return newItems;
// newItem.EnergyReportItemId = item.EnergyReportItemId;
// newItem.EnergyReportId = item.EnergyReportId;
// newItem.SortIndex = item.SortIndex;
// newItem.BusinessCategory = item.BusinessCategory;
// newItem.Throughput_BasePeriod = item.Throughput_BasePeriod;
// newItem.Throughput_LastPeriod = item.Throughput_LastPeriod;
// newItem.Throughput_ThisPeriod = item.Throughput_ThisPeriod;
// newItem.Throughput_UnitOfMeasurement = item.Throughput_UnitOfMeasurement;
// newItem.Yield_BasePeriod = item.Yield_BasePeriod;
// newItem.Yield_LastPeriod = item.Yield_LastPeriod;
// newItem.Yield_ThisPeriod = item.Yield_ThisPeriod;
// newItem.Yield_UnitOfMeasurement = item.Yield_UnitOfMeasurement;
// newItem.OutputValue_BasePeriod = item.OutputValue_BasePeriod;
// newItem.OutputValue_LastYear = item.OutputValue_LastYear;
// newItem.OutputValue_ThisYear = item.OutputValue_ThisYear;
// newItem.OperationScale_BasePeriod = item.OperationScale_BasePeriod;
// newItem.OperationScale_LastYear = item.OperationScale_LastYear;
// newItem.OperationScale_ThisYear = item.OperationScale_ThisYear;
// newItem.OperationScale_UnitOfMeasurement = item.OperationScale_UnitOfMeasurement;
// newItem.ServiceOperatingIncome_BasePeriod = item.ServiceOperatingIncome_BasePeriod;
// newItem.ServiceOperatingIncome_LastYear = item.ServiceOperatingIncome_LastYear;
// newItem.ServiceOperatingIncome_ThisYear = item.ServiceOperatingIncome_ThisYear;
// newItems.Add(newItem);
//}
return q;
}
public static void AddEnvironmental_EnergyReportItem(Model.Environmental_EnergyReportItem newtable)
{