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 ServiceClient.Response.Householder
{
public class HouseholderItem
{
[JsonProperty("ID")] public int UserId { get; set; }
[JsonProperty("name")] public string Name { get; set; } = "";
[JsonProperty("mobile")] public string Mobile { get; set; } = "";
}
using Newtonsoft.Json;
namespace ServiceClient.Response.Householder
{
public class HouseholderItem
{
[JsonProperty("ID")] public int UserId { get; set; }
[JsonProperty("name")] public string Name { get; set; } = "";
[JsonProperty("mobile")] public string Mobile { get; set; } = "";
}
}

View File

@@ -1,56 +1,56 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Etor.Infrastructure.Common;
using Etor.Infrastructure.Data;
using Etor.Infrastructure.Serializer;
using Etor.Infrastructure.WebApi;
using Newtonsoft.Json;
using ServiceClient;
using ServiceClient.Response.Householder;
namespace ServiceClient.Response.Householder
{
public class QueryAllHouseholdersByOwnerIdResponse
{
[JsonProperty("userData")]
public List<HouseholderItem> HouseholderItems { get; set; } = new List<HouseholderItem>();
}
}
namespace BaseInfoClient.Extension
{
public static class QueryAllHouseholdersByOwnerIdExtension
{
public static async Task<List<HouseholderItem>> QueryAllHouseholdersByOwnerId(this BaseInfoHttpClient client
, int ownerId, bool throwException = false)
{
try
{
var response = await client.CreateHttpClient().GetAsync(
$"{client.BaseUrl}/api/baseinfo/v1/BaseData/GetAllBasePerson?OwnerID={ownerId}&Data.IsGetUser=true");
var content = await response.Content.ReadAsStringAsync();
return content.FromJsonTo<ApiResult<QueryAllHouseholdersByOwnerIdResponse>>().Data.HouseholderItems;
}
catch (Exception e)
{
LogHelper.Error("根据OwnerId获取住户", e);
if (throwException)
{
BusinessException.Throw("获取住户信息失败");
}
else
{
return new List<HouseholderItem>();
}
}
return new List<HouseholderItem>();
}
}
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Etor.Infrastructure.Common;
using Etor.Infrastructure.Data;
using Etor.Infrastructure.Serializer;
using Etor.Infrastructure.WebApi;
using Newtonsoft.Json;
using ServiceClient;
using ServiceClient.Response.Householder;
namespace ServiceClient.Response.Householder
{
public class QueryAllHouseholdersByOwnerIdResponse
{
[JsonProperty("userData")]
public List<HouseholderItem> HouseholderItems { get; set; } = new List<HouseholderItem>();
}
}
namespace BaseInfoClient.Extension
{
public static class QueryAllHouseholdersByOwnerIdExtension
{
public static async Task<List<HouseholderItem>> QueryAllHouseholdersByOwnerId(this BaseInfoHttpClient client
, int ownerId, bool throwException = false)
{
try
{
var response = await client.CreateHttpClient().GetAsync(
$"{client.BaseUrl}/api/baseinfo/v1/BaseData/GetAllBasePerson?OwnerID={ownerId}&Data.IsGetUser=true");
var content = await response.Content.ReadAsStringAsync();
return content.FromJsonTo<ApiResult<QueryAllHouseholdersByOwnerIdResponse>>().Data.HouseholderItems;
}
catch (Exception e)
{
LogHelper.Error("根据OwnerId获取住户", e);
if (throwException)
{
BusinessException.Throw("获取住户信息失败");
}
else
{
return new List<HouseholderItem>();
}
}
return new List<HouseholderItem>();
}
}
}

View File

@@ -1,54 +1,54 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Etor.Infrastructure.Common;
using Etor.Infrastructure.Data;
using Etor.Infrastructure.Serializer;
using Etor.Infrastructure.WebApi;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using ServiceClient;
using ServiceClient.Response.Householder;
namespace ServiceClient.Response.Householder
{
public class QueryHouseholderInfoByUserIdResponse
{
[JsonProperty("userData")] public HouseholderItem HouseholderItem { get; set; }
}
}
namespace BaseInfoClient.Extension
{
public static class QueryHouseholderInfoByUserIdExtension
{
public static async Task<HouseholderItem> QueryHouseholderInfoByUserId(this BaseInfoHttpClient client
, int ownerId, int userId, bool throwException = false)
{
try
{
var response = await client.CreateHttpClient().GetAsync(
$"{client.BaseUrl}/api/baseinfo/v1/BaseData/GetOneBasePerson?OwnerID={ownerId}&Data.userId={userId}");
var content = await response.Content.ReadAsStringAsync();
return content.FromJsonTo<ApiResult<QueryHouseholderInfoByUserIdResponse>>().Data.HouseholderItem;
}
catch (Exception e)
{
LogHelper.Error("根据UserId获取住户", e);
if (throwException)
{
BusinessException.Throw("获取住户信息失败");
}
else
{
return new HouseholderItem();
}
}
return new HouseholderItem();
}
}
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Etor.Infrastructure.Common;
using Etor.Infrastructure.Data;
using Etor.Infrastructure.Serializer;
using Etor.Infrastructure.WebApi;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using ServiceClient;
using ServiceClient.Response.Householder;
namespace ServiceClient.Response.Householder
{
public class QueryHouseholderInfoByUserIdResponse
{
[JsonProperty("userData")] public HouseholderItem HouseholderItem { get; set; }
}
}
namespace BaseInfoClient.Extension
{
public static class QueryHouseholderInfoByUserIdExtension
{
public static async Task<HouseholderItem> QueryHouseholderInfoByUserId(this BaseInfoHttpClient client
, int ownerId, int userId, bool throwException = false)
{
try
{
var response = await client.CreateHttpClient().GetAsync(
$"{client.BaseUrl}/api/baseinfo/v1/BaseData/GetOneBasePerson?OwnerID={ownerId}&Data.userId={userId}");
var content = await response.Content.ReadAsStringAsync();
return content.FromJsonTo<ApiResult<QueryHouseholderInfoByUserIdResponse>>().Data.HouseholderItem;
}
catch (Exception e)
{
LogHelper.Error("根据UserId获取住户", e);
if (throwException)
{
BusinessException.Throw("获取住户信息失败");
}
else
{
return new HouseholderItem();
}
}
return new HouseholderItem();
}
}
}