|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
|
using DS.Module.SqlSugar;
|
|
|
|
|
using DS.Module.UserModule;
|
|
|
|
|
using DS.WMS.Core.Fee.Entity;
|
|
|
|
|
using DS.WMS.Core.Invoice.Dtos;
|
|
|
|
|
using DS.WMS.Core.Invoice.Entity;
|
|
|
|
|
using DS.WMS.Core.Invoice.Interface;
|
|
|
|
|
using DS.WMS.Core.TaskPlat.Dtos;
|
|
|
|
|
using MathNet.Numerics.Distributions;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Invoice.Method
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 银行流水相关
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class BankStatementService : IBankStatementService
|
|
|
|
|
{
|
|
|
|
|
private readonly IServiceProvider _serviceProvider;
|
|
|
|
|
private readonly ISaasDbService saasService;
|
|
|
|
|
private readonly IUser user;
|
|
|
|
|
private readonly ISqlSugarClient db;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 初始化
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="serviceProvider"></param>
|
|
|
|
|
public BankStatementService(IServiceProvider serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
_serviceProvider = serviceProvider;
|
|
|
|
|
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
|
|
|
|
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
|
|
|
|
user = _serviceProvider.GetRequiredService<IUser>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取银行流水列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
/// <exception cref="NotImplementedException"></exception>
|
|
|
|
|
public async Task<DataResult<List<GetBankStatementOutPut>>> GetBankStatementList(PageRequest<GetBankStatementInput> request)
|
|
|
|
|
{
|
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
var resultstr = tenantDb.Queryable<BankStatement>()
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where(t => t.OrgId == user.OrgId).ToSql();
|
|
|
|
|
|
|
|
|
|
var result = await tenantDb.Queryable<BankStatement>()
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Where(t => t.OrgId == user.OrgId)
|
|
|
|
|
|
|
|
|
|
.Select(t => new GetBankStatementOutPut
|
|
|
|
|
{
|
|
|
|
|
Id = t.Id,
|
|
|
|
|
},true)
|
|
|
|
|
.ToQueryPageAsync(request.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取银行账号列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<List<GetBankAccountListOutput>>> GetBankAccountList()
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
var list = tenantDb.Queryable<BankStatement>()
|
|
|
|
|
.Where(t => t.OrgId == user.OrgId)
|
|
|
|
|
.GroupBy(it => new { it.BankName, it.AccountId }) //可以多字段
|
|
|
|
|
.Select(it => new GetBankAccountListOutput
|
|
|
|
|
{
|
|
|
|
|
BankName = it.BankName,
|
|
|
|
|
AccountId = it.AccountId
|
|
|
|
|
|
|
|
|
|
}).ToList();
|
|
|
|
|
return DataResult<List<GetBankAccountListOutput>>.Success(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|