|
|
|
@ -343,17 +343,26 @@ public class ClientInfoService : ServiceBase, IClientInfoService
|
|
|
|
|
ShortName = model.ShortName,
|
|
|
|
|
Description = model.CNName,
|
|
|
|
|
Tel = model.Tel,
|
|
|
|
|
IsOverdueDeduction = model.IsCustomer,
|
|
|
|
|
IsMortgageLastOrder = model.IsCustomer,
|
|
|
|
|
Note = "系统导入",
|
|
|
|
|
ClientTag = new InfoClientTag { IsController = model.IsCustomer },
|
|
|
|
|
AccountDates = []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var dicValues = dicList.FindAll(x => model.AttributeNames.Contains(x.Name));
|
|
|
|
|
foreach (var item in dicValues)
|
|
|
|
|
if (model.AttributeNames.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
var dicValue = item.Value.ToUpperCamelCase();
|
|
|
|
|
PropertyExtensions.SetPropertyValue(client.ClientTag, dicValue, true);
|
|
|
|
|
client.ClientTag.IsOther = model.IsSupplier;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var dicValues = dicList.FindAll(x => model.AttributeNames.Contains(x.Name));
|
|
|
|
|
foreach (var item in dicValues)
|
|
|
|
|
{
|
|
|
|
|
var dicValue = item.Value.ToUpperCamelCase();
|
|
|
|
|
PropertyExtensions.SetPropertyValue(client.ClientTag, dicValue, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
client.AccountDates.Add(new InfoClientAccountDate
|
|
|
|
|
{
|
|
|
|
@ -604,7 +613,8 @@ public class ClientInfoService : ServiceBase, IClientInfoService
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<List<ClientUsage>>> GetUsageAsync(params long[] ids)
|
|
|
|
|
{
|
|
|
|
|
var list = await TenantDb.Queryable<InfoClient>().ClearFilter<ISharedOrgId>().Where(x => ids.Contains(x.Id))
|
|
|
|
|
TenantDb.QueryFilter.Clear<ISharedOrgId>();
|
|
|
|
|
var list = await TenantDb.Queryable<InfoClient>().Where(x => ids.Contains(x.Id))
|
|
|
|
|
.Select(c => new ClientUsage
|
|
|
|
|
{
|
|
|
|
|
Id = c.Id,
|
|
|
|
@ -721,21 +731,16 @@ public class ClientInfoService : ServiceBase, IClientInfoService
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<ClientInfoRes>> GetAsync(string id)
|
|
|
|
|
public async Task<DataResult<ClientInfoRes>> GetAsync(long id)
|
|
|
|
|
{
|
|
|
|
|
var entity = await TenantDb.Queryable<InfoClient>().ClearFilter<ISharedOrgId>()
|
|
|
|
|
.Where(a => a.Id == long.Parse(id))
|
|
|
|
|
.FirstAsync();
|
|
|
|
|
TenantDb.QueryFilter.Clear<ISharedOrgId>();
|
|
|
|
|
var entity = await TenantDb.Queryable<InfoClient>().Where(a => a.Id == id).FirstAsync();
|
|
|
|
|
if (entity == null)
|
|
|
|
|
return DataResult<ClientInfoRes>.Success(null);
|
|
|
|
|
|
|
|
|
|
var data = entity.Adapt<ClientInfoRes>();
|
|
|
|
|
data.ServiceItemCodes = entity.ServiceItem?.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
|
|
|
|
|
|
var tag = await TenantDb.Queryable<InfoClientTag>().Select<ClientTagRes>()
|
|
|
|
|
.FirstAsync(a => a.ClientId == long.Parse(id));
|
|
|
|
|
data.ClientTag = tag;
|
|
|
|
|
|
|
|
|
|
data.ClientTag = await TenantDb.Queryable<InfoClientTag>().Select<ClientTagRes>().FirstAsync(a => a.ClientId == id);
|
|
|
|
|
data.InvoiceHeaders ??= await TenantDb.Queryable<InvoiceHeader>().Where(x => x.RelativeId == data.Id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
return DataResult<ClientInfoRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
|
|
|
|
|