Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
Jst.Domain.Lims.Timeliness.V4.5
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
陶然
Jst.Domain.Lims.Timeliness.V4.5
Commits
8c9f3c26
Commit
8c9f3c26
authored
Dec 19, 2023
by
陶然
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
19e4f6a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
173 additions
and
5 deletions
+173
-5
AssemblyInfo.cs
Src/Properties/AssemblyInfo.cs
+2
-2
RestfulTimeliness.cs
Src/RestfulTimeliness.cs
+171
-3
No files found.
Src/Properties/AssemblyInfo.cs
View file @
8c9f3c26
...
...
@@ -32,6 +32,6 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2023.121
5
0")]
[assembly: AssemblyFileVersion("5.4.2023.121
5
0")]
[assembly: AssemblyVersion("5.4.2023.121
8
0")]
[assembly: AssemblyFileVersion("5.4.2023.121
8
0")]
Src/RestfulTimeliness.cs
View file @
8c9f3c26
...
...
@@ -45,9 +45,9 @@ namespace Jst.Lims.Timeliness
}
[
Api
(
Description
=
"报告时效统计"
)]
[
Api
(
Description
=
"报告
数据录入/报告编制
时效统计"
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
TimelineStatistic
Report
:
RestfulExecution
<
TimelineStatistic
>
public
class
TimelineStatistic
DataEntry
:
RestfulExecution
<
TimelineStatistic
>
{
public
Guid
PolicyNodeKvid
{
get
;
set
;
}
...
...
@@ -92,7 +92,8 @@ namespace Jst.Lims.Timeliness
query
.
LeftJoin
<
Report
>((
o
,
r
)
=>
o
.
BizKvid
==
r
.
Kvid
);
if
(
PolicyNodeKvid
==
Guid
.
Empty
)
query
.
Where
<
Timeline
>(
o
=>
o
.
PreKvid
==
Guid
.
Empty
&&
o
.
RootKvid
==
o
.
Kvid
);
//不指定节点,就查根节点
else
query
.
Where
<
Timeline
>(
o
=>
o
.
PolicyNodeKvid
==
PolicyNodeKvid
&&
o
.
PreKvid
!=
Guid
.
Empty
);
//指定节点,不能包含根节点
query
.
Where
<
Report
>(
o
=>
o
.
TypeEx
==
"W"
&&
o
.
DeadDate
>=
BeginDate
&&
o
.
DeadDate
<=
EndDate
);
//只查看不加急并且要求完成日期在所选范围内的时效记录
query
.
Where
<
Report
>(
o
=>
o
.
DeadDate
>=
BeginDate
&&
o
.
DeadDate
<=
EndDate
&&
Sql
.
In
(
o
.
TypeEx
,
"W"
,
"Z"
));
//只查看不加急并且要求完成日期在所选范围内的时效记录
query
.
And
<
Report
>(
o
=>
!
o
.
ReportId
.
ToLower
().
Contains
(
"test"
));
if
(
Urgent
!=
null
)
{
if
(
Urgent
.
Value
)
query
.
And
<
Report
>(
o
=>
o
.
UrgentRate
>
1
);
...
...
@@ -234,6 +235,173 @@ namespace Jst.Lims.Timeliness
}
}
[
Api
(
Description
=
"报告委托受理/开样时效统计"
)]
[
RequiresAnyRole
(
SystemRoles
.
Everyone
)]
public
class
TimelineStatisticCommission
:
RestfulExecution
<
TimelineStatistic
>
{
public
Guid
PolicyNodeKvid
{
get
;
set
;
}
/// <summary>
/// 统计的开始日期
/// </summary>
public
DateTime
BeginDate
{
get
;
set
;
}
/// <summary>
/// 统计的结束日期
/// </summary>
public
DateTime
EndDate
{
get
;
set
;
}
//public TimeFilter TimeFilter { get; set; }
public
bool
Grouped
{
get
;
set
;
}
public
bool
?
Urgent
{
get
;
set
;
}
public
override
object
OnExecution
(
IRequest
req
,
IResponse
res
)
{
int
monthDay
=
DateTime
.
DaysInMonth
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
);
if
(
BeginDate
==
DateTime
.
MinValue
)
BeginDate
=
new
DateTime
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
,
1
);
if
(
EndDate
==
DateTime
.
MinValue
)
EndDate
=
new
DateTime
(
DateTime
.
Now
.
Year
,
DateTime
.
Now
.
Month
,
monthDay
);
BeginDate
=
DateTime
.
Parse
(
BeginDate
.
ToString
(
"yyyy-MM-dd"
));
EndDate
=
DateTime
.
Parse
(
EndDate
.
ToString
(
"yyyy-MM-dd"
));
if
(
EndDate
<
BeginDate
)
throw
new
Exception
(
"查询结束日期不可小于开始日期!"
);
var
rtns
=
new
RestfulQueryResponse
<
TimelineStatistic
>();
rtns
.
Results
=
new
List
<
TimelineStatistic
>();
var
connL
=
KiviiContext
.
GetOpenedDbConnection
<
Report
>();
var
conn
=
KiviiContext
.
GetOpenedDbConnection
<
Timeline
>();
var
results
=
new
List
<
TimelineStatistic
>();
if
(
connL
.
ConnectionString
==
conn
.
ConnectionString
)
//同一个数据库下的情况 用leftjoin联合查询
{
//connL.Close();
connL
=
conn
;
var
query
=
conn
.
From
<
Timeline
>();
query
.
LeftJoin
<
Report
>((
o
,
r
)
=>
o
.
BizKvid
==
r
.
Kvid
);
if
(
PolicyNodeKvid
==
Guid
.
Empty
)
query
.
Where
<
Timeline
>(
o
=>
o
.
PreKvid
==
Guid
.
Empty
&&
o
.
RootKvid
==
o
.
Kvid
);
//不指定节点,就查根节点
else
query
.
Where
<
Timeline
>(
o
=>
o
.
PolicyNodeKvid
==
PolicyNodeKvid
&&
o
.
PreKvid
!=
Guid
.
Empty
);
//指定节点,不能包含根节点
query
.
Where
<
Report
>(
o
=>
o
.
DealDate
>=
BeginDate
&&
o
.
DealDate
<=
EndDate
&&
Sql
.
In
(
o
.
TypeEx
,
"W"
,
"Z"
));
//只查看不加急并且要求完成日期在所选范围内的时效记录
query
.
And
<
Report
>(
o
=>
!
o
.
ReportId
.
ToLower
().
Contains
(
"test"
));
if
(
Urgent
!=
null
)
{
if
(
Urgent
.
Value
)
query
.
And
<
Report
>(
o
=>
o
.
UrgentRate
>
1
);
else
query
.
And
<
Report
>(
o
=>
o
.
UrgentRate
==
1
);
}
query
.
And
<
Report
>(
o
=>
(
o
.
BizType
!=
"G0"
&&
o
.
BizType
!=
"G1"
)
||
o
.
BizType
==
null
);
query
.
OrderBy
<
Report
>(
o
=>
o
.
DealDate
);
query
.
Select
<
Timeline
,
Report
>((
o
,
r
)
=>
new
{
o
.
OwnerKvid
,
o
.
OwnerName
,
r
.
ReportId
,
o
.
Title
,
o
.
PlanStartTime
,
o
.
RealStartTime
,
o
.
PlanFinishTime
,
o
.
RealFinishTime
,
ReportDealDate
=
r
.
DealDate
,
ReportDeadDate
=
r
.
DeadDate
,
ReportPreparationDate
=
r
.
PreparationDate
,
ReportReviewDate
=
r
.
ReviewDate
,
ReportIssueDate
=
r
.
IssueDate
,
ReportUrgentRate
=
r
.
UrgentRate
});
results
=
conn
.
Select
<
TimelineStatistic
>(
query
);
}
if
(
Grouped
)
{
if
(
PolicyNodeKvid
==
Guid
.
Empty
)
//不按照节点Group统计,按照整个报告的时效进行统计
{
var
group
=
results
.
GroupBy
(
o
=>
o
.
ReportDealDate
);
foreach
(
var
kv
in
group
)
{
var
total
=
new
TimelineStatistic
();
total
.
ReportDealDate
=
kv
.
Key
;
total
.
Quantity
=
kv
.
Count
();
total
.
Details
=
new
List
<
TimelineStatistic
>();
var
records
=
kv
.
OrderBy
(
o
=>
o
.
PlanFinishTime
).
ToList
();
var
grop
=
records
.
GroupBy
(
o
=>
o
.
PlanFinishTime
);
foreach
(
var
gp
in
grop
)
{
var
detail
=
new
TimelineStatistic
();
detail
.
PlanFinishTime
=
gp
.
Key
;
detail
.
Quantity
=
gp
.
Count
();
detail
.
Details
=
new
List
<
TimelineStatistic
>();
foreach
(
var
item
in
gp
)
{
var
realFinishTime
=
item
.
RealFinishTime
;
if
(
realFinishTime
==
null
)
realFinishTime
=
DateTime
.
Now
;
if
(
item
.
PlanFinishTime
!=
null
&&
realFinishTime
>
item
.
PlanFinishTime
)
{
detail
.
TimeoutQuantity
++;
item
.
TimeoutQuantity
++;
total
.
TimeoutQuantity
++;
}
else
{
detail
.
NormalQuantity
++;
item
.
NormalQuantity
++;
total
.
NormalQuantity
++;
}
detail
.
Details
.
Add
(
item
);
}
total
.
Details
.
Add
(
detail
);
}
rtns
.
Results
.
Add
(
total
);
}
}
else
//按照节点Group
{
var
group
=
results
.
GroupBy
(
o
=>
new
{
o
.
ReportDealDate
,
o
.
Title
});
foreach
(
var
kv
in
group
)
{
var
total
=
new
TimelineStatistic
();
total
.
ReportDealDate
=
kv
.
Key
.
ReportDealDate
;
total
.
Title
=
kv
.
Key
.
Title
;
total
.
Quantity
=
kv
.
Count
();
total
.
Details
=
new
List
<
TimelineStatistic
>();
var
records
=
kv
.
OrderBy
(
o
=>
o
.
PlanFinishTime
).
ToList
();
var
grop
=
records
.
GroupBy
(
o
=>
o
.
PlanFinishTime
);
foreach
(
var
gp
in
grop
)
{
var
detail
=
new
TimelineStatistic
();
detail
.
PlanFinishTime
=
gp
.
Key
;
detail
.
Quantity
=
gp
.
Count
();
detail
.
Details
=
new
List
<
TimelineStatistic
>();
foreach
(
var
item
in
gp
)
{
var
realFinishTime
=
item
.
RealFinishTime
;
if
(
realFinishTime
==
null
)
realFinishTime
=
DateTime
.
Now
;
if
(
item
.
PlanFinishTime
!=
null
&&
realFinishTime
>
item
.
PlanFinishTime
)
{
detail
.
TimeoutQuantity
++;
item
.
TimeoutQuantity
++;
total
.
TimeoutQuantity
++;
}
else
{
detail
.
NormalQuantity
++;
item
.
NormalQuantity
++;
total
.
NormalQuantity
++;
}
detail
.
Details
.
Add
(
item
);
}
total
.
Details
.
Add
(
detail
);
}
rtns
.
Results
.
Add
(
total
);
}
}
}
else
rtns
.
Results
=
results
;
rtns
.
Total
=
rtns
.
Results
.
Count
;
return
rtns
;
}
}
public
enum
TimeFilter
{
Unsupported
=
0
,
...
...
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