Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Biz.Finances.V2.0
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陶然
Kivii.Biz.Finances.V2.0
Commits
53d42be3
Commit
53d42be3
authored
Jan 11, 2022
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
be93d8bc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
15 additions
and
51 deletions
+15
-51
PaymentExtension.cs
Src/Extensions/PaymentExtension.cs
+2
-2
RestfulPay.cs
Src/Transforms/RestfulPay.cs
+2
-2
RestfulPayment.Accept.cs
Src/Transforms/RestfulPayment.Accept.cs
+3
-39
RestfulPayment.Account.cs
Src/Transforms/RestfulPayment.Account.cs
+2
-2
RestfulPayment.UnBiz.Refund.cs
Src/Transforms/RestfulPayment.UnBiz.Refund.cs
+6
-6
No files found.
Src/Extensions/PaymentExtension.cs
View file @
53d42be3
...
...
@@ -82,8 +82,8 @@ namespace Kivii.Finances
#
endregion
pay
=
new
Pay
();
pay
.
OwnerKvid
=
KiviiContext
.
CurrentMember
.
DepartmentKvid
;
pay
.
OwnerName
=
KiviiContext
.
CurrentMember
.
DepartmentName
;
pay
.
OwnerKvid
=
payment
.
OwnerKvid
;
//
KiviiContext.CurrentMember.DepartmentKvid;
pay
.
OwnerName
=
payment
.
OwnerName
;
//
KiviiContext.CurrentMember.DepartmentName;
pay
.
PayerKvid
=
payment
.
PayerKvid
;
pay
.
PayerName
=
payment
.
PayerName
;
pay
.
FromType
=
PayType
.
Account
;
//付款来源记录 是账户还是Payment
...
...
Src/Transforms/RestfulPay.cs
View file @
53d42be3
...
...
@@ -58,7 +58,7 @@ namespace Kivii.Finances.Transforms
(
payment
.
Currency
!=
currency
).
ThrowIfTrue
(
"存在不相符的货币单位!"
);
if
(
payment
.
Type
!=
PaymentType
.
Split
&&
payment
.
Type
!=
PaymentType
.
Pos
&&
payment
.
Type
!=
PaymentType
.
Cash
&&
payment
.
Type
!=
PaymentType
.
AliPay
&&
payment
.
Type
!=
PaymentType
.
WeChat
)
throw
new
Exception
(
"请选择正确的付款方式!"
);
if
(
payment
.
Amount
-
payment
.
AmountUsed
<
amountSettlement
)
throw
new
Exception
(
$"所选付款方式余额不足,可用余额:
{
payment
.
Amount
-
payment
.
AmountUsed
}
"
);
(
payment
.
AmountInvoice
!=
payment
.
Amount
).
ThrowIfTrue
(
"所选到账尚未开票,请先开票后再分摊!"
);
//
(payment.AmountInvoice != payment.Amount).ThrowIfTrue("所选到账尚未开票,请先开票后再分摊!");
var
dynamicPayPayment
=
settlements
.
Paying
(
payment
,
accountBiz
,
out
var
pays
,
out
var
accountDetail
);
var
trans
=
conn
.
OpenTransaction
();
...
...
@@ -223,7 +223,7 @@ namespace Kivii.Finances.Transforms
payments
.
Exists
(
o
=>
o
.
Currency
!=
currency
).
ThrowIfTrue
(
"存在不相符的货币单位!"
);
if
(
payments
.
Exists
(
o
=>
o
.
Type
!=
PaymentType
.
Split
&&
o
.
Type
!=
PaymentType
.
Pos
&&
o
.
Type
!=
PaymentType
.
Cash
&&
o
.
Type
!=
PaymentType
.
AliPay
&&
o
.
Type
!=
PaymentType
.
WeChat
))
throw
new
Exception
(
"请选择正确的付款方式!"
);
if
(
payments
.
Exists
(
o
=>
(
o
.
Amount
-
o
.
AmountUsed
)
<=
0
))
throw
new
Exception
(
$"所选付款方式余额不足!"
);
if
(
payments
.
Exists
(
o
=>
(
o
.
AmountInvoice
!=
o
.
Amount
)))
throw
new
Exception
(
$"所选付款尚未开票!"
);
//
if (payments.Exists(o => (o.AmountInvoice != o.Amount))) throw new Exception($"所选付款尚未开票!");
}
List
<
Account
>
accounts
=
null
;
...
...
Src/Transforms/RestfulPayment.Accept.cs
View file @
53d42be3
...
...
@@ -10,15 +10,15 @@ using System.Threading.Tasks;
namespace
Kivii.Finances.Transforms
{
[
Api
(
Description
=
"生成到账流水"
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
[
RequiresAnyRole
(
SystemRoles
.
Administrator
,
SystemRoles
.
Manager
,
SystemRoles
.
Configuration
)]
public
class
PaymentAccept
:
RestfulExecution
<
Payment
>
{
public
Payment
Item
{
get
;
set
;
}
public
List
<
Payment
>
Items
{
get
;
set
;
}
[
ApiMember
(
Description
=
"认领类型,默认为Department,Organization,Member"
)]
public
OwnerType
OwnerType
{
get
;
set
;
}
=
OwnerType
.
Organization
;
//
[ApiMember(Description = "认领类型,默认为Department,Organization,Member")]
//
public OwnerType OwnerType { get; set; } = OwnerType.Organization;
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
...
...
@@ -35,42 +35,12 @@ namespace Kivii.Finances.Transforms
var
typePoss
=
Items
.
Where
(
o
=>
o
.
Type
==
PaymentType
.
Pos
).
ToList
();
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Payment
>();
//var allAccountKvids = new List<Guid>();
//allAccountKvids.AddRange(Items.ConvertAll(o => o.PayeeAccountKvid).ToList());
//allAccountKvids.AddRange(Items.ConvertAll(o => o.PayerAccountKvid).ToList());
//allAccountKvids = allAccountKvids.Distinct().ToList();
//var accounts = conn.Select<Account>(o => Sql.In(o.Kvid, allAccountKvids));
//accounts.ThrowIfNullOrEmpty("未找到相关账号!");
var
accountBalance
=
CurrencyUnit
.
CNY
.
GetBalanceAccount
();
var
allAccountDetails
=
new
List
<
AccountDetail
>();
var
allAcceptPayments
=
new
List
<
Payment
>();
var
allAcceptPays
=
new
List
<
Pay
>();
var
ownerKvid
=
Guid
.
Empty
;
var
ownerName
=
string
.
Empty
;
switch
(
OwnerType
)
{
case
OwnerType
.
Department
:
{
ownerKvid
=
KiviiContext
.
CurrentMember
.
DepartmentKvid
;
ownerName
=
KiviiContext
.
CurrentMember
.
DepartmentName
;
break
;
}
case
OwnerType
.
Member
:
{
ownerKvid
=
KiviiContext
.
CurrentMember
.
Kvid
;
ownerName
=
KiviiContext
.
CurrentMember
.
FullName
;
break
;
}
default
:
{
ownerKvid
=
KiviiContext
.
CurrentMember
.
OrganizationKvid
;
ownerName
=
KiviiContext
.
CurrentMember
.
OrganizationName
;
break
;
}
}
//生成银行流水
if
(!
typeBanks
.
IsNullOrEmpty
())
{
...
...
@@ -86,8 +56,6 @@ namespace Kivii.Finances.Transforms
item
.
AmountSplited
=
0
;
item
.
AmountUsed
=
0
;
item
.
OwnerKvid
=
ownerKvid
;
item
.
OwnerName
=
ownerName
;
item
.
OffsetKvid
=
Guid
.
Empty
;
item
.
BizId
=
string
.
Empty
;
item
.
BizType
=
string
.
Empty
;
...
...
@@ -125,8 +93,6 @@ namespace Kivii.Finances.Transforms
item
.
AmountSplited
=
item
.
Amount
;
item
.
AmountUsed
=
0
;
item
.
OwnerKvid
=
ownerKvid
;
item
.
OwnerName
=
ownerName
;
item
.
OffsetKvid
=
Guid
.
Empty
;
item
.
BizId
=
string
.
Empty
;
item
.
BizType
=
string
.
Empty
;
...
...
@@ -163,8 +129,6 @@ namespace Kivii.Finances.Transforms
item
.
AmountSplited
=
item
.
Amount
;
item
.
AmountUsed
=
0
;
item
.
OwnerKvid
=
ownerKvid
;
item
.
OwnerName
=
ownerName
;
item
.
OffsetKvid
=
Guid
.
Empty
;
item
.
BizId
=
string
.
Empty
;
item
.
BizType
=
string
.
Empty
;
...
...
Src/Transforms/RestfulPayment.Account.cs
View file @
53d42be3
...
...
@@ -16,7 +16,7 @@ namespace Kivii.Finances.Transforms
/// 3.非业务收入存入个人现金,刷卡等账户
/// </summary>
[
Api
(
Description
=
"收款转账"
)]
[
RequiresAnyRole
(
SystemRoles
.
Administrator
,
SystemRoles
.
Manager
,
SystemRoles
.
Configuration
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentTransfer
:
RestfulExecution
<
Payment
>
{
public
Guid
AccountKvid
{
get
;
set
;
}
...
...
@@ -105,7 +105,7 @@ namespace Kivii.Finances.Transforms
//(重点测试下2021.09.14)
[
Api
(
Description
=
"收款转账撤销"
)]
[
RequiresAnyRole
(
SystemRoles
.
Administrator
,
SystemRoles
.
Manager
,
SystemRoles
.
Configuration
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentTransferCancel
:
RestfulExecution
<
Payment
>
{
/// <summary>
...
...
Src/Transforms/RestfulPayment.UnBiz.Refund.cs
View file @
53d42be3
...
...
@@ -10,7 +10,7 @@ using System.Threading.Tasks;
namespace
Kivii.Finances.Transforms
{
[
Api
(
Description
=
"非业务处理"
)]
[
RequiresAnyRole
(
SystemRoles
.
Administrator
,
SystemRoles
.
Manager
,
SystemRoles
.
Configuration
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentUnBiz
:
RestfulExecution
<
Payment
>
{
public
decimal
Amount
{
get
;
set
;
}
...
...
@@ -70,7 +70,7 @@ namespace Kivii.Finances.Transforms
}
[
Api
(
Description
=
"批量非业务处理"
)]
[
RequiresAnyRole
(
SystemRoles
.
Administrator
,
SystemRoles
.
Manager
,
SystemRoles
.
Configuration
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentMultiUnBiz
:
RestfulExecution
<
Payment
>
{
public
List
<
Guid
>
Kvids
{
get
;
set
;
}
...
...
@@ -146,7 +146,7 @@ namespace Kivii.Finances.Transforms
}
[
Api
(
Description
=
"撤销非业务处理"
)]
[
RequiresAnyRole
(
SystemRoles
.
Administrator
,
SystemRoles
.
Manager
,
SystemRoles
.
Configuration
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentUnBizCancel
:
RestfulExecution
<
Payment
>
{
public
List
<
Guid
>
Kvids
{
get
;
set
;
}
...
...
@@ -215,7 +215,7 @@ namespace Kivii.Finances.Transforms
}
[
Api
(
Description
=
"退款处理"
)]
[
RequiresAnyRole
(
SystemRoles
.
Administrator
,
SystemRoles
.
Manager
,
SystemRoles
.
Configuration
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentRefund
:
RestfulExecution
<
Payment
>
{
public
decimal
Amount
{
get
;
set
;
}
...
...
@@ -275,7 +275,7 @@ namespace Kivii.Finances.Transforms
}
[
Api
(
Description
=
"批量退款处理"
)]
[
RequiresAnyRole
(
SystemRoles
.
Administrator
,
SystemRoles
.
Manager
,
SystemRoles
.
Configuration
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentMultiRefund
:
RestfulExecution
<
Payment
>
{
public
List
<
Guid
>
Kvids
{
get
;
set
;
}
...
...
@@ -351,7 +351,7 @@ namespace Kivii.Finances.Transforms
}
[
Api
(
Description
=
"撤销退款处理"
)]
[
RequiresAnyRole
(
SystemRoles
.
Administrator
,
SystemRoles
.
Manager
,
SystemRoles
.
Configuration
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentRefundCancel
:
RestfulExecution
<
Payment
>
{
public
List
<
Guid
>
Kvids
{
get
;
set
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment