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
54f6810d
Commit
54f6810d
authored
Nov 28, 2022
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增今日到账操作统计
parent
5d1b0a1f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
Kivii.Biz.Finances.V2.0.csproj
Src/Kivii.Biz.Finances.V2.0.csproj
+1
-0
RestfulPayment.Statistic.cs
Src/Transforms/RestfulPayment.Statistic.cs
+60
-0
No files found.
Src/Kivii.Biz.Finances.V2.0.csproj
View file @
54f6810d
...
...
@@ -95,6 +95,7 @@
<Compile
Include=
"Transforms\RestfulPayment.cs"
/>
<Compile
Include=
"Transforms\RestfulPayment.Offset.cs"
/>
<Compile
Include=
"Transforms\RestfulPayment.Split.cs"
/>
<Compile
Include=
"Transforms\RestfulPayment.Statistic.cs"
/>
<Compile
Include=
"Transforms\RestfulPayment.UnBiz.Refund.cs"
/>
<Compile
Include=
"Transforms\RestfulPolicy.cs"
/>
<Compile
Include=
"Transforms\RestfulSettlement.cs"
/>
...
...
Src/Transforms/RestfulPayment.Statistic.cs
0 → 100644
View file @
54f6810d
using
Kivii.Finances.Entities
;
using
Kivii.Linq
;
using
Kivii.Web
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Kivii.Finances.Transforms
{
[
Api
(
Description
=
"今日到账操作统计"
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentAcceptStatistic
:
RestfulExecution
<
Payment
>
{
public
DateTime
BeginTime
{
get
;
set
;
}
//日期筛选为创建日期,默认统计今日导入系统中的流水信息
public
DateTime
EndTime
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
int
monthDay
=
DateTime
.
DaysInMonth
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
);
if
(
BeginTime
==
DateTime
.
MinValue
)
BeginTime
=
DateTime
.
Now
;
if
(
EndTime
==
DateTime
.
MinValue
)
EndTime
=
DateTime
.
Now
;
var
beginTime
=
DateTime
.
Parse
(
BeginTime
.
ToString
(
"yyyy-MM-dd"
));
var
endTime
=
DateTime
.
Parse
(
EndTime
.
ToString
(
"yyyy-MM-dd"
));
if
(
endTime
<
beginTime
)
throw
new
Exception
(
"查询结束日期不可小于开始日期!"
);
if
(
endTime
==
beginTime
)
endTime
=
endTime
.
AddDays
(
1
);
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Payment
>();
var
queryAccount
=
conn
.
From
<
Account
>();
queryAccount
.
Where
(
o
=>
o
.
OrganizationKvid
==
KiviiContext
.
CurrentMember
.
OrganizationKvid
&&
Sql
.
In
(
o
.
Type
,
AccountType
.
Balance
,
AccountType
.
Cash
,
AccountType
.
Pos
));
queryAccount
.
Select
(
o
=>
o
.
Kvid
);
var
sqlExpress
=
conn
.
From
<
Payment
>();
sqlExpress
.
Where
(
o
=>
o
.
RootKvid
==
o
.
Kvid
&&
o
.
OffsetKvid
==
Guid
.
Empty
&&
Sql
.
In
(
o
.
Type
,
PaymentType
.
AliPay
,
PaymentType
.
WeChat
,
PaymentType
.
Bank
,
PaymentType
.
Cash
,
PaymentType
.
Pos
));
sqlExpress
.
And
(
o
=>
o
.
CreateTime
>=
beginTime
&&
o
.
CreateTime
<
endTime
);
//sqlExpress.And(o => o.AmountSplited == 0 || o.AmountSplited < o.Amount);
sqlExpress
.
And
(
o
=>
(
Sql
.
In
(
o
.
PayerAccountKvid
,
queryAccount
)));
sqlExpress
.
Select
(
o
=>
new
{
o
.
AmountSplited
,
o
.
AmountInvoice
,
o
.
AmountUsed
,
o
.
Amount
});
var
results
=
conn
.
Select
(
sqlExpress
);
var
rtns
=
new
StatisticResponse
<
Payment
>();
//rtns.Description = "待认领流水";
rtns
.
BeginTime
=
BeginTime
;
rtns
.
EndTime
=
EndTime
;
if
(
results
.
IsNullOrEmpty
())
return
rtns
;
rtns
.
Total
=
results
.
Count
();
rtns
.
TotalAmount
=
results
.
Sum
(
o
=>
o
.
Amount
);
rtns
.
TotalAmountSplited
=
results
.
Sum
(
o
=>
o
.
Amount
-
o
.
AmountSplited
);
rtns
.
TotalQuantitySplited
=
results
.
Where
(
o
=>
o
.
AmountSplited
==
0
||
o
.
AmountSplited
<
o
.
Amount
).
Count
();
rtns
.
TotalAmountInvoice
=
results
.
Sum
(
o
=>
o
.
Amount
-
o
.
AmountInvoice
);
rtns
.
TotalQuantityInvoice
=
results
.
Where
(
o
=>
o
.
AmountInvoice
==
0
||
o
.
AmountInvoice
<
o
.
Amount
).
Count
();
rtns
.
TotalAmountUsed
=
results
.
Sum
(
o
=>
o
.
Amount
-
o
.
AmountUsed
);
rtns
.
TotalQuantityUsed
=
results
.
Where
(
o
=>
o
.
AmountUsed
==
0
||
o
.
AmountUsed
<
o
.
Amount
).
Count
();
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