Commit 89e7a131 by 陶然

处理获取部门账户时的bug

parent dfa19628
......@@ -34,7 +34,7 @@ namespace Kivii.Finances
var conn = KiviiContext.GetOpenedDbConnection<Account>();
//得到所有平衡帐户,并赋值给静态变量,减少数据库操作
var balanceAccounts = conn.Select<Account>(o => o.Type == AccountType.Balance);
var balanceAccounts = conn.Select<Account>(o => o.Type == AccountType.Balance && o.Currency == currency);
foreach (var account in balanceAccounts)
{
_balanceAccounts[KiviiContext.GetUrnKey($"{currency}{KiviiContext.CurrentMember.OrganizationKvid}")] = account;
......@@ -96,7 +96,7 @@ namespace Kivii.Finances
var conn = KiviiContext.GetOpenedDbConnection<Account>();
//得到所有平衡帐户,并赋值给静态变量,减少数据库操作
var bizAccounts = conn.Select<Account>(o => o.Type == AccountType.Discount);
var bizAccounts = conn.Select<Account>(o => o.Type == AccountType.Discount && o.OwnerKvid == ownerKvid);
foreach (var account in bizAccounts)
{
_discountAccounts[KiviiContext.GetUrnKey($"{AccountType.Discount}{account.Currency}{ownerKvid}")] = account;
......@@ -156,7 +156,7 @@ namespace Kivii.Finances
var conn = KiviiContext.GetOpenedDbConnection<Account>();
//得到所有平衡帐户,并赋值给静态变量,减少数据库操作
var bizAccounts = conn.Select<Account>(o => o.Type == AccountType.Biz);
var bizAccounts = conn.Select<Account>(o => o.Type == AccountType.Biz && o.OwnerKvid == ownerKvid);
foreach (var account in bizAccounts)
{
_bizAccounts[KiviiContext.GetUrnKey($"{AccountType.Biz}{account.Currency}{ownerKvid}")] = account;
......
......@@ -154,6 +154,27 @@ namespace Kivii.Finances.Transforms
}
}
[Api(Description = "获取部门业务账户")]
[RequiresAnyRole(SystemRoles.Everyone)]
public class AccountGetBizAccount : RestfulExecution<Account>
{
public CurrencyUnit Currency { get; set; }
public string OwnerName { get; set; }
public Guid OwnerKvid { get; set; }
public override object OnExecution(IRequest req, IResponse res)
{
(Currency == CurrencyUnit.Unsupported).ThrowIfTrue("不支持的货币单位!");
var rtns = new RestfulReadResponse<Account>();
rtns.Result = Currency.GetBizAccount(OwnerKvid, OwnerName);
return rtns;
}
}
[Api(Description = "获取平衡账户")]
[RequiresAnyRole(SystemRoles.Everyone)]
public class AccountGetBalance : RestfulExecution<Account>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment