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
cf5a051b
Commit
cf5a051b
authored
Aug 21, 2023
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增部门收入分析接口
parent
5729c8c9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
RestfulPayment.Statistic.cs
Src/Transforms/Statistics/RestfulPayment.Statistic.cs
+34
-0
No files found.
Src/Transforms/Statistics/RestfulPayment.Statistic.cs
View file @
cf5a051b
...
...
@@ -392,4 +392,38 @@ namespace Kivii.Finances.Transforms
return
rtns
;
}
}
[
Api
(
Description
=
"部门收入分析"
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
PaymentGroupYearAnalysis
:
RestfulExecution
<
Payment
>
{
public
string
Year
{
get
;
set
;
}
public
Guid
OwnerKvid
{
get
;
set
;
}
public
List
<
Guid
>
OwnerKvids
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
Year
.
ThrowIfNullOrEmpty
(
"请传入收入年份"
);
if
(
OwnerKvids
.
IsNullOrEmpty
())
OwnerKvids
=
new
List
<
Guid
>();
if
(
OwnerKvid
!=
Guid
.
Empty
)
OwnerKvids
.
Add
(
OwnerKvid
);
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Payment
>();
var
query
=
conn
.
From
<
Payment
>();
query
.
Where
(
o
=>
o
.
AuditorName
==
Year
&&
o
.
OffsetKvid
==
Guid
.
Empty
&&
o
.
Type
==
PaymentType
.
Split
);
if
(!
OwnerKvids
.
IsNullOrEmpty
())
query
.
And
(
o
=>
Sql
.
In
(
o
.
OwnerKvid
,
OwnerKvids
));
query
.
GroupBy
(
o
=>
new
{
o
.
OwnerName
,
o
.
AuditorName
});
query
.
Select
(
o
=>
new
{
AuditorName
=
o
.
AuditorName
,
OwnerName
=
o
.
OwnerName
,
Amount
=
Sql
.
Sum
(
o
.
Amount
)
});
var
rtns
=
new
RestfulQueryResponse
<
Payment
>();
rtns
.
Results
=
conn
.
Select
(
query
);
rtns
.
Total
=
rtns
.
Results
.
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