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
055b9906
Commit
055b9906
authored
Nov 11, 2021
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
61be61c0
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
149 additions
and
71 deletions
+149
-71
RestfulPayment.Offset.cs
Src/Transforms/RestfulPayment.Offset.cs
+110
-70
RestfulPayment.Split.cs
Src/Transforms/RestfulPayment.Split.cs
+1
-1
RestfulPayment.cs
Src/Transforms/RestfulPayment.cs
+38
-0
No files found.
Src/Transforms/RestfulPayment.Offset.cs
View file @
055b9906
...
...
@@ -15,23 +15,33 @@ namespace Kivii.Finances.Transforms
{
public
Guid
Kvid
{
get
;
set
;
}
public
List
<
Guid
>
Kvids
{
get
;
set
;
}
public
string
Remark
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
(
Kvid
==
Guid
.
Empty
).
ThrowIfTrue
(
"请传入要冲账的到账Kvid!"
);
(
Kvid
==
Guid
.
Empty
&&
Kvids
.
IsNullOrEmpty
()).
ThrowIfTrue
(
"请传入要冲账的到账Kvids!"
);
if
(
Kvids
.
IsNullOrEmpty
())
Kvids
=
new
List
<
Guid
>();
if
(
Kvid
!=
Guid
.
Empty
)
Kvids
.
Add
(
Kvid
);
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Payment
>();
var
payment
=
conn
.
SingleById
<
Payment
>(
Kvid
);
if
(
payment
==
null
)
throw
new
Exception
(
"收付款项不存在"
);
if
(
payment
.
Type
!=
PaymentType
.
Bank
&&
payment
.
Type
!=
PaymentType
.
Cash
&&
payment
.
Type
!=
PaymentType
.
Pos
&&
payment
.
Type
!=
PaymentType
.
AliPay
&&
payment
.
Type
!=
PaymentType
.
WeChat
)
throw
new
Exception
(
"非可冲销收款类型!"
);
if
(
payment
.
BizKvid
!=
Guid
.
Empty
)
throw
new
Exception
(
"收付款已关联业务!请先解除关联!"
);
if
(
payment
.
OffsetKvid
!=
Guid
.
Empty
)
throw
new
Exception
(
"收付款已冲账"
);
if
(
payment
.
AmountInvoice
>
0
||
payment
.
AmountSplited
>
0
||
payment
.
AmountUsed
>
0
)
throw
new
Exception
(
$"不可冲账,此到账已开票:
{
payment
.
AmountInvoice
}
元,已认领:
{
payment
.
AmountSplited
}
元,已使用:
{
payment
.
AmountUsed
}
元"
);
var
payment
s
=
conn
.
SelectByIds
<
Payment
>(
Kvids
);
payments
.
ThrowIfNullOrEmpty
(
"收付款项不存在"
);
if
(
payment
s
.
Exists
(
o
=>
o
.
Type
!=
PaymentType
.
Bank
&&
o
.
Type
!=
PaymentType
.
Cash
&&
o
.
Type
!=
PaymentType
.
Pos
&&
o
.
Type
!=
PaymentType
.
AliPay
&&
o
.
Type
!=
PaymentType
.
WeChat
)
)
throw
new
Exception
(
"非可冲销收款类型!"
);
if
(
payment
s
.
Exists
(
o
=>
o
.
BizKvid
!=
Guid
.
Empty
)
)
throw
new
Exception
(
"收付款已关联业务!请先解除关联!"
);
if
(
payment
s
.
Exists
(
o
=>
o
.
OffsetKvid
!=
Guid
.
Empty
)
)
throw
new
Exception
(
"收付款已冲账"
);
(
payments
.
Exists
(
o
=>
o
.
AmountInvoice
>
0
||
o
.
AmountSplited
>
0
||
o
.
AmountUsed
>
0
)).
ThrowIfTrue
(
$"不可冲账,存在到账已开票:
{
payments
.
Sum
(
o
=>
o
.
AmountInvoice
)}
元,已认领:
{
payments
.
Sum
(
o
=>
o
.
AmountSplited
)}
元,已使用:
{
payments
.
Sum
(
o
=>
o
.
AmountUsed
)
}
元"
);
//查询当前项的拆分子项List
if
(
conn
.
Exists
<
Payment
>(
o
=>
o
.
ParentKvid
==
Kvid
&&
o
.
OffsetKvid
==
Guid
.
Empty
))
throw
new
Exception
(
"不可冲账,此到账存在未冲账子项!"
);
if
(
conn
.
Exists
<
InvoiceApply
>(
o
=>
o
.
BizKvid
==
payment
.
Kvid
&&
o
.
OffsetKvid
==
Guid
.
Empty
))
throw
new
Exception
(
"申请开票中,不可冲账!"
);
payment
.
PayeeAccountKvid
.
ThrowIfEmpty
(
"收款账户(PayeeAccountKvid)为空!"
);
payment
.
PayerAccountKvid
.
ThrowIfEmpty
(
"付款账户(PayerAccountKvid)为空!"
);
if
(
conn
.
Exists
<
Payment
>(
o
=>
Sql
.
In
(
o
.
ParentKvid
,
payments
.
ConvertAll
(
p
=>
p
.
Kvid
))
&&
o
.
OffsetKvid
==
Guid
.
Empty
))
throw
new
Exception
(
"不可冲账,此到账存在未冲账子项!"
);
if
(
conn
.
Exists
<
InvoiceApply
>(
o
=>
Sql
.
In
(
o
.
BizKvid
,
payments
.
ConvertAll
(
p
=>
p
.
Kvid
))
&&
o
.
OffsetKvid
==
Guid
.
Empty
))
throw
new
Exception
(
"申请开票中,不可冲账!"
);
(
payments
.
Exists
(
o
=>
o
.
PayeeAccountKvid
==
Guid
.
Empty
)).
ThrowIfTrue
(
"收款账户(PayeeAccountKvid)为空!"
);
(
payments
.
Exists
(
o
=>
o
.
PayerAccountKvid
==
Guid
.
Empty
)).
ThrowIfTrue
(
"付款账户(PayerAccountKvid)为空!"
);
List
<
Payment
>
offsets
=
new
List
<
Payment
>();
List
<
Account
>
accountPayees
=
conn
.
SelectByIds
<
Account
>(
payments
.
ConvertAll
(
p
=>
p
.
PayeeAccountKvid
));
List
<
Account
>
accountPayers
=
conn
.
SelectByIds
<
Account
>(
payments
.
ConvertAll
(
p
=>
p
.
PayerAccountKvid
));
foreach
(
var
payment
in
payments
)
{
var
accountPayee
=
conn
.
SingleById
<
Account
>(
payment
.
PayeeAccountKvid
);
var
accountPayer
=
conn
.
SingleById
<
Account
>(
payment
.
PayerAccountKvid
);
...
...
@@ -39,38 +49,47 @@ namespace Kivii.Finances.Transforms
if
(
accountPayer
==
null
)
accountPayer
=
payment
.
Currency
.
GetBalanceAccount
();
var
offset
=
payment
.
Offset
(
$"冲账:
{
Remark
}
"
);
offsets
.
Add
(
offset
);
}
var
rtns
=
new
RestfulExecutionResponse
<
Payment
>();
rtns
.
Results
=
new
List
<
Payment
>();
using
(
var
trans
=
conn
.
OpenTransaction
())
{
conn
.
UpdateOnly
(
payment
);
rtns
.
Results
.
Add
(
payment
);
conn
.
Insert
(
offset
);
foreach
(
var
item
in
payments
)
{
conn
.
UpdateOnly
(
item
);
rtns
.
Results
.
Add
(
item
);
Account
accountPayee
=
null
;
Account
accountPayer
=
null
;
if
(!
accountPayees
.
IsNullOrEmpty
())
accountPayee
=
accountPayees
.
FirstOrDefault
(
o
=>
o
.
Kvid
==
item
.
PayeeAccountKvid
);
if
(!
accountPayers
.
IsNullOrEmpty
())
accountPayer
=
accountPayers
.
FirstOrDefault
(
o
=>
o
.
Kvid
==
item
.
PayerAccountKvid
);
if
(
accountPayee
==
null
)
accountPayee
=
item
.
Currency
.
GetBalanceAccount
();
if
(
accountPayer
==
null
)
accountPayer
=
item
.
Currency
.
GetBalanceAccount
();
if
(
accountPayee
!=
null
)
{
#
region
新增流水
var
newAccountDetail
=
new
AccountDetail
();
newAccountDetail
.
AccountKvid
=
accountPayee
.
Kvid
;
newAccountDetail
.
BizId
=
payment
.
SerialNumber
;
newAccountDetail
.
BizKvid
=
payment
.
Kvid
;
newAccountDetail
.
BizId
=
item
.
SerialNumber
;
newAccountDetail
.
BizKvid
=
item
.
Kvid
;
newAccountDetail
.
BizType
=
typeof
(
Payment
).
FullName
;
newAccountDetail
.
PayerKvid
=
payment
.
PayeeKvid
;
newAccountDetail
.
PayerName
=
payment
.
PayeeName
;
newAccountDetail
.
PayerKvid
=
item
.
PayeeKvid
;
newAccountDetail
.
PayerName
=
item
.
PayeeName
;
newAccountDetail
.
PayerAccountKvid
=
accountPayee
.
Kvid
;
newAccountDetail
.
PayerAccountName
=
accountPayee
.
Name
;
newAccountDetail
.
PayerAccountSerialNumber
=
accountPayee
.
SerialNumber
;
newAccountDetail
.
PayeeKvid
=
payment
.
PayerKvid
;
newAccountDetail
.
PayeeName
=
payment
.
PayerName
;
newAccountDetail
.
PayeeKvid
=
item
.
PayerKvid
;
newAccountDetail
.
PayeeName
=
item
.
PayerName
;
newAccountDetail
.
PayeeAccountKvid
=
accountPayer
.
Kvid
;
newAccountDetail
.
PayeeAccountName
=
accountPayer
.
Name
;
newAccountDetail
.
PayeeAccountSerialNumber
=
accountPayer
.
SerialNumber
;
newAccountDetail
.
AmountPayment
=
payment
.
Amount
;
newAccountDetail
.
AmountPayment
=
item
.
Amount
;
newAccountDetail
.
Summary
=
"冲账:"
+
Remark
;
#
endregion
newAccountDetail
.
Insert
(
conn
);
...
...
@@ -80,28 +99,32 @@ namespace Kivii.Finances.Transforms
#
region
新增流水
var
accountDetailBalance
=
new
AccountDetail
();
accountDetailBalance
.
AccountKvid
=
accountPayer
.
Kvid
;
accountDetailBalance
.
BizId
=
payment
.
SerialNumber
;
accountDetailBalance
.
BizKvid
=
payment
.
Kvid
;
accountDetailBalance
.
BizId
=
item
.
SerialNumber
;
accountDetailBalance
.
BizKvid
=
item
.
Kvid
;
accountDetailBalance
.
BizType
=
typeof
(
Payment
).
FullName
;
accountDetailBalance
.
PayerKvid
=
payment
.
PayeeKvid
;
accountDetailBalance
.
PayerName
=
payment
.
PayeeName
;
accountDetailBalance
.
PayerKvid
=
item
.
PayeeKvid
;
accountDetailBalance
.
PayerName
=
item
.
PayeeName
;
accountDetailBalance
.
PayerAccountKvid
=
accountPayee
.
Kvid
;
accountDetailBalance
.
PayerAccountName
=
accountPayee
.
Name
;
accountDetailBalance
.
PayerAccountSerialNumber
=
accountPayee
.
SerialNumber
;
accountDetailBalance
.
PayeeKvid
=
payment
.
PayerKvid
;
accountDetailBalance
.
PayeeName
=
payment
.
PayerName
;
accountDetailBalance
.
PayeeKvid
=
item
.
PayerKvid
;
accountDetailBalance
.
PayeeName
=
item
.
PayerName
;
accountDetailBalance
.
PayeeAccountKvid
=
accountPayer
.
Kvid
;
accountDetailBalance
.
PayeeAccountName
=
accountPayer
.
Name
;
accountDetailBalance
.
PayeeAccountSerialNumber
=
accountPayer
.
SerialNumber
;
accountDetailBalance
.
AmountPayment
=
payment
.
Amount
;
accountDetailBalance
.
AmountPayment
=
item
.
Amount
;
accountDetailBalance
.
Summary
=
"冲账:"
+
Remark
;
#
endregion
accountDetailBalance
.
Insert
(
conn
);
}
}
foreach
(
var
item
in
offsets
)
{
conn
.
Insert
(
item
);
}
trans
.
Commit
();
}
return
rtns
;
...
...
@@ -114,65 +137,73 @@ namespace Kivii.Finances.Transforms
{
public
Guid
Kvid
{
get
;
set
;
}
public
List
<
Guid
>
Kvids
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
(
Kvid
==
Guid
.
Empty
).
ThrowIfTrue
(
"请传入要撤销冲账的到账Kvid!"
);
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Payment
>();
var
payment
=
conn
.
SingleById
<
Payment
>(
Kvid
);
if
(
payment
==
null
)
throw
new
Exception
(
"收付款项不存在"
);
if
(
payment
.
Type
!=
PaymentType
.
Bank
&&
payment
.
Type
!=
PaymentType
.
Cash
&&
payment
.
Type
!=
PaymentType
.
Pos
&&
payment
.
Type
!=
PaymentType
.
AliPay
&&
payment
.
Type
!=
PaymentType
.
WeChat
)
throw
new
Exception
(
"不支持的操作类型!"
);
if
(
payment
.
OffsetKvid
==
Guid
.
Empty
)
throw
new
Exception
(
"收付款未冲账,无需撤销"
);
if
(
payment
.
BizKvid
!=
Guid
.
Empty
)
throw
new
Exception
(
"收付款已关联业务!请先解除关联!"
);
payment
.
PayeeAccountKvid
.
ThrowIfEmpty
(
"收款账户(PayeeAccountKvid)为空!"
);
payment
.
PayerAccountKvid
.
ThrowIfEmpty
(
"付款账户(PayerAccountKvid)为空!"
);
var
offset
=
conn
.
SingleById
<
Payment
>(
payment
.
OffsetKvid
);
var
accountPayee
=
conn
.
SingleById
<
Account
>(
payment
.
PayeeAccountKvid
);
var
accountPayer
=
conn
.
SingleById
<
Account
>(
payment
.
PayerAccountKvid
);
if
(
accountPayee
==
null
)
accountPayee
=
payment
.
Currency
.
GetBalanceAccount
();
if
(
accountPayer
==
null
)
accountPayer
=
payment
.
Currency
.
GetBalanceAccount
();
(
Kvid
==
Guid
.
Empty
&&
Kvids
.
IsNullOrEmpty
()).
ThrowIfTrue
(
"请传入要撤销冲账的到账Kvids!"
);
if
(
Kvids
.
IsNullOrEmpty
())
Kvids
=
new
List
<
Guid
>();
if
(
Kvid
!=
Guid
.
Empty
)
Kvids
.
Add
(
Kvid
);
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Payment
>();
var
payments
=
conn
.
SelectByIds
<
Payment
>(
Kvids
);
payments
.
ThrowIfNullOrEmpty
(
"收付款项不存在"
);
if
(
payments
.
Exists
(
o
=>
o
.
Type
!=
PaymentType
.
Bank
&&
o
.
Type
!=
PaymentType
.
Cash
&&
o
.
Type
!=
PaymentType
.
Pos
&&
o
.
Type
!=
PaymentType
.
AliPay
&&
o
.
Type
!=
PaymentType
.
WeChat
))
throw
new
Exception
(
"不支持的操作类型!"
);
(
payments
.
Exists
(
o
=>
o
.
BizKvid
!=
Guid
.
Empty
)).
ThrowIfTrue
(
"收付款已关联业务!请先解除关联!"
);
(
payments
.
Exists
(
o
=>
o
.
Amount
<=
0
)).
ThrowIfTrue
(
"请选择正确的到账流水进行撤销!"
);
(
payments
.
Exists
(
o
=>
o
.
OffsetKvid
==
Guid
.
Empty
)).
ThrowIfTrue
(
"收付款未冲账,无需撤销"
);
(
payments
.
Exists
(
o
=>
o
.
PayeeAccountKvid
==
Guid
.
Empty
)).
ThrowIfTrue
(
"收款账户(PayeeAccountKvid)为空!"
);
(
payments
.
Exists
(
o
=>
o
.
PayerAccountKvid
==
Guid
.
Empty
)).
ThrowIfTrue
(
"付款账户(PayerAccountKvid)为空!"
);
var
offsets
=
conn
.
SelectByIds
<
Payment
>(
payments
.
ConvertAll
(
o
=>
o
.
OffsetKvid
));
List
<
Account
>
accountPayees
=
conn
.
SelectByIds
<
Account
>(
payments
.
ConvertAll
(
p
=>
p
.
PayeeAccountKvid
));
List
<
Account
>
accountPayers
=
conn
.
SelectByIds
<
Account
>(
payments
.
ConvertAll
(
p
=>
p
.
PayerAccountKvid
));
foreach
(
var
item
in
payments
)
{
//payment 取消OffsetKvid
payment
.
OffsetKvid
=
Guid
.
Empty
;
payment
.
AddOnlyProperties
(
o
=>
o
.
OffsetKvid
);
item
.
OffsetKvid
=
Guid
.
Empty
;
item
.
AddOnlyProperties
(
o
=>
o
.
OffsetKvid
);
}
var
rtns
=
new
RestfulExecutionResponse
<
Payment
>();
rtns
.
Results
=
new
List
<
Payment
>();
using
(
var
trans
=
conn
.
OpenTransaction
())
{
conn
.
UpdateOnly
(
payment
);
rtns
.
Results
.
Add
(
payment
);
if
(
offset
!=
null
)
foreach
(
var
item
in
payments
)
{
offset
.
Status
=
-
1
;
offset
.
AddOnlyProperties
(
o
=>
o
.
Status
);
conn
.
UpdateOnly
(
offset
);
}
conn
.
UpdateOnly
(
item
);
rtns
.
Results
.
Add
(
item
);
Account
accountPayee
=
null
;
Account
accountPayer
=
null
;
if
(!
accountPayees
.
IsNullOrEmpty
())
accountPayee
=
accountPayees
.
FirstOrDefault
(
o
=>
o
.
Kvid
==
item
.
PayeeAccountKvid
);
if
(!
accountPayers
.
IsNullOrEmpty
())
accountPayer
=
accountPayers
.
FirstOrDefault
(
o
=>
o
.
Kvid
==
item
.
PayerAccountKvid
);
if
(
accountPayee
==
null
)
accountPayee
=
item
.
Currency
.
GetBalanceAccount
();
if
(
accountPayer
==
null
)
accountPayer
=
item
.
Currency
.
GetBalanceAccount
();
if
(
accountPayee
!=
null
)
{
#
region
新增流水
var
newAccountDetail
=
new
AccountDetail
();
newAccountDetail
.
AccountKvid
=
accountPayee
.
Kvid
;
newAccountDetail
.
BizId
=
payment
.
SerialNumber
;
newAccountDetail
.
BizKvid
=
payment
.
Kvid
;
newAccountDetail
.
BizId
=
item
.
SerialNumber
;
newAccountDetail
.
BizKvid
=
item
.
Kvid
;
newAccountDetail
.
BizType
=
typeof
(
Payment
).
FullName
;
newAccountDetail
.
PayeeKvid
=
payment
.
PayeeKvid
;
newAccountDetail
.
PayeeName
=
payment
.
PayeeName
;
newAccountDetail
.
PayeeKvid
=
item
.
PayeeKvid
;
newAccountDetail
.
PayeeName
=
item
.
PayeeName
;
newAccountDetail
.
PayeeAccountKvid
=
accountPayee
.
Kvid
;
newAccountDetail
.
PayeeAccountName
=
accountPayee
.
Name
;
newAccountDetail
.
PayeeAccountSerialNumber
=
accountPayee
.
SerialNumber
;
newAccountDetail
.
PayerKvid
=
payment
.
PayerKvid
;
newAccountDetail
.
PayerName
=
payment
.
PayerName
;
newAccountDetail
.
PayerKvid
=
item
.
PayerKvid
;
newAccountDetail
.
PayerName
=
item
.
PayerName
;
newAccountDetail
.
PayerAccountKvid
=
accountPayer
.
Kvid
;
newAccountDetail
.
PayerAccountName
=
accountPayer
.
Name
;
newAccountDetail
.
PayerAccountSerialNumber
=
accountPayer
.
SerialNumber
;
newAccountDetail
.
AmountPayment
=
payment
.
Amount
;
newAccountDetail
.
AmountPayment
=
item
.
Amount
;
newAccountDetail
.
Summary
=
"撤销冲账"
;
#
endregion
newAccountDetail
.
Insert
(
conn
);
...
...
@@ -182,28 +213,37 @@ namespace Kivii.Finances.Transforms
#
region
新增流水
var
accountDetailBalance
=
new
AccountDetail
();
accountDetailBalance
.
AccountKvid
=
accountPayer
.
Kvid
;
accountDetailBalance
.
BizId
=
payment
.
SerialNumber
;
accountDetailBalance
.
BizKvid
=
payment
.
Kvid
;
accountDetailBalance
.
BizId
=
item
.
SerialNumber
;
accountDetailBalance
.
BizKvid
=
item
.
Kvid
;
accountDetailBalance
.
BizType
=
typeof
(
Payment
).
FullName
;
accountDetailBalance
.
PayeeKvid
=
payment
.
PayeeKvid
;
accountDetailBalance
.
PayeeName
=
payment
.
PayeeName
;
accountDetailBalance
.
PayeeKvid
=
item
.
PayeeKvid
;
accountDetailBalance
.
PayeeName
=
item
.
PayeeName
;
accountDetailBalance
.
PayeeAccountKvid
=
accountPayee
.
Kvid
;
accountDetailBalance
.
PayeeAccountName
=
accountPayee
.
Name
;
accountDetailBalance
.
PayeeAccountSerialNumber
=
accountPayee
.
SerialNumber
;
accountDetailBalance
.
PayerKvid
=
payment
.
PayerKvid
;
accountDetailBalance
.
PayerName
=
payment
.
PayerName
;
accountDetailBalance
.
PayerKvid
=
item
.
PayerKvid
;
accountDetailBalance
.
PayerName
=
item
.
PayerName
;
accountDetailBalance
.
PayerAccountKvid
=
accountPayer
.
Kvid
;
accountDetailBalance
.
PayerAccountName
=
accountPayer
.
Name
;
accountDetailBalance
.
PayerAccountSerialNumber
=
accountPayer
.
SerialNumber
;
accountDetailBalance
.
AmountPayment
=
payment
.
Amount
;
accountDetailBalance
.
AmountPayment
=
item
.
Amount
;
accountDetailBalance
.
Summary
=
"撤销冲账"
;
#
endregion
accountDetailBalance
.
Insert
(
conn
);
}
}
if
(!
offsets
.
IsNullOrEmpty
())
{
foreach
(
var
item
in
offsets
)
{
item
.
Status
=
-
1
;
item
.
AddOnlyProperties
(
o
=>
o
.
Status
);
conn
.
UpdateOnly
(
item
);
}
}
trans
.
Commit
();
}
return
rtns
;
...
...
Src/Transforms/RestfulPayment.Split.cs
View file @
055b9906
...
...
@@ -151,7 +151,7 @@ namespace Kivii.Finances.Transforms
public
class
PaymentMultiSplit
:
RestfulExecution
<
Payment
>
{
[
ApiMember
(
Description
=
"认领类型,默认为Department,Organization,Member"
)]
public
OwnerType
OwnerType
{
get
;
set
;
}
public
OwnerType
OwnerType
{
get
;
set
;
}
=
OwnerType
.
Department
;
public
List
<
Guid
>
Kvids
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
...
...
Src/Transforms/RestfulPayment.cs
View file @
055b9906
...
...
@@ -173,4 +173,42 @@ namespace Kivii.Finances.Transforms
return
rtns
;
}
}
[
Api
(
Description
=
"作废查询"
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentOffsetQuery
:
RestfulExecution
<
Payment
>
{
#
region
QueryArgs
public
virtual
int
?
Skip
{
get
;
set
;
}
public
virtual
int
?
Take
{
get
;
set
;
}
public
virtual
string
OrderBy
{
get
;
set
;
}
public
string
OrderByDesc
{
get
;
set
;
}
public
virtual
string
Include
{
get
;
set
;
}
public
virtual
string
Fields
{
get
;
set
;
}
public
string
QueryKeys
{
get
;
set
;
}
public
string
QueryValues
{
get
;
set
;
}
#
endregion
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Payment
>();
var
dynamicParams
=
Request
.
GetRequestParams
();
var
autoQuery
=
Request
.
TryResolve
<
IAutoQueryDb
>();
autoQuery
.
IncludeTotal
=
true
;
var
request
=
new
RestfulQuery
<
Payment
>();
request
=
request
.
PopulateWith
(
this
);
var
sqlExpress
=
autoQuery
.
CreateQuery
(
Request
,
conn
,
request
,
dynamicParams
);
sqlExpress
.
Where
(
o
=>
o
.
OffsetKvid
!=
Guid
.
Empty
&&
o
.
Amount
>=
0
&&
Sql
.
In
(
o
.
Type
,
PaymentType
.
AliPay
,
PaymentType
.
WeChat
,
PaymentType
.
Bank
,
PaymentType
.
Cash
,
PaymentType
.
Pos
));
var
rtns
=
autoQuery
.
Execute
(
Request
,
conn
,
request
,
sqlExpress
);
return
rtns
;
}
}
}
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