This commit is contained in:
“wanyongkang”
2020-12-28 14:55:48 +08:00
parent c2ec7392cb
commit 40a40b6d36
305 changed files with 20629 additions and 20629 deletions

View File

@@ -1,13 +1,13 @@
using Newtonsoft.Json;
namespace BaseInfoClient.Response.Build
{
public class BuildItem
{
[JsonProperty("projectCode")] public int ProjectCode { get; set; }
[JsonProperty("buildCode")] public string BuildCode { get; set; } = "";
[JsonProperty("name")] public string Name { get; set; } = "";
}
using Newtonsoft.Json;
namespace BaseInfoClient.Response.Build
{
public class BuildItem
{
[JsonProperty("projectCode")] public int ProjectCode { get; set; }
[JsonProperty("buildCode")] public string BuildCode { get; set; } = "";
[JsonProperty("name")] public string Name { get; set; } = "";
}
}

View File

@@ -1,55 +1,55 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using BaseInfoClient.Response.Build;
using Etor.Infrastructure.Common;
using Etor.Infrastructure.Data;
using Etor.Infrastructure.Serializer;
using Etor.Infrastructure.WebApi;
using Newtonsoft.Json;
using ServiceClient;
namespace BaseInfoClient.Response.Build
{
public class QueryAllBuildsByOwnerIdResponse
{
[JsonProperty("buildData")] public List<BuildItem> BuildItems { get; set; } = new List<BuildItem>();
}
}
namespace BaseInfoClient.Extension
{
public static class QuerAllyBuildsByOwnerIdExtension
{
public static async Task<List<BuildItem>> QueryAllBuildsByOwnerIdAsync(this BaseInfoHttpClient client, int ownerId,
bool throwException = false)
{
try
{
var response = await client.CreateHttpClient().GetAsync(
$"{client.BaseUrl}/api/baseinfo/v1/BaseData/GetAllBaseProject?OwnerID={ownerId}&Data.IsGetBuild=true");
var content = await response.Content.ReadAsStringAsync();
return content.FromJsonTo<ApiResult<QueryAllBuildsByOwnerIdResponse>>().Data.BuildItems;
}
catch (Exception e)
{
LogHelper.Error("根据OwnerId获取楼宇", e);
if (throwException)
{
BusinessException.Throw("获取楼宇信息失败");
}
else
{
return new List<BuildItem>();
}
}
return new List<BuildItem>();
}
}
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using BaseInfoClient.Response.Build;
using Etor.Infrastructure.Common;
using Etor.Infrastructure.Data;
using Etor.Infrastructure.Serializer;
using Etor.Infrastructure.WebApi;
using Newtonsoft.Json;
using ServiceClient;
namespace BaseInfoClient.Response.Build
{
public class QueryAllBuildsByOwnerIdResponse
{
[JsonProperty("buildData")] public List<BuildItem> BuildItems { get; set; } = new List<BuildItem>();
}
}
namespace BaseInfoClient.Extension
{
public static class QuerAllyBuildsByOwnerIdExtension
{
public static async Task<List<BuildItem>> QueryAllBuildsByOwnerIdAsync(this BaseInfoHttpClient client, int ownerId,
bool throwException = false)
{
try
{
var response = await client.CreateHttpClient().GetAsync(
$"{client.BaseUrl}/api/baseinfo/v1/BaseData/GetAllBaseProject?OwnerID={ownerId}&Data.IsGetBuild=true");
var content = await response.Content.ReadAsStringAsync();
return content.FromJsonTo<ApiResult<QueryAllBuildsByOwnerIdResponse>>().Data.BuildItems;
}
catch (Exception e)
{
LogHelper.Error("根据OwnerId获取楼宇", e);
if (throwException)
{
BusinessException.Throw("获取楼宇信息失败");
}
else
{
return new List<BuildItem>();
}
}
return new List<BuildItem>();
}
}
}