Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
performance
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zry
performance
Commits
413c1eae
Commit
413c1eae
authored
Dec 23, 2021
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop' into develop
parents
6e965464
80a5d6f1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
43 additions
and
26 deletions
+43
-26
performance/Performance.Api/Controllers/AllotController.cs
+9
-1
performance/Performance.Api/Controllers/ModExtractController.cs
+22
-19
performance/Performance.Repository/PerforCofdirectorRepository.cs
+1
-0
performance/Performance.Repository/PerforPerAllotRepository.cs
+1
-4
performance/Performance.Services/AllotService.cs
+8
-1
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
+2
-1
No files found.
performance/Performance.Api/Controllers/AllotController.cs
View file @
413c1eae
...
@@ -297,7 +297,15 @@ public ApiResponse GenerateReport([CustomizeValidator(RuleSet = "Delete"), FromB
...
@@ -297,7 +297,15 @@ public ApiResponse GenerateReport([CustomizeValidator(RuleSet = "Delete"), FromB
if
(
null
==
allot
||
!
states
.
Contains
(
allot
.
States
))
if
(
null
==
allot
||
!
states
.
Contains
(
allot
.
States
))
throw
new
PerformanceException
(
"当前绩效暂未生成,无法统计报表数据。"
);
throw
new
PerformanceException
(
"当前绩效暂未生成,无法统计报表数据。"
);
//_publishEndpoint.Publish(allot).Wait();
_backgroundTaskQueue
.
QueueBackgroundWorkItem
(
async
token
=>
{
using
(
var
scope
=
_serviceScopeFactory
.
CreateScope
())
{
var
scopedServices
=
scope
.
ServiceProvider
.
GetRequiredService
<
AllotService
>();
scopedServices
.
GenerateReport
(
allot
);
await
Task
.
Delay
(
TimeSpan
.
FromSeconds
(
5
),
token
);
}
});
return
new
ApiResponse
(
ResponseType
.
OK
,
"统计报表数据任务开始"
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"统计报表数据任务开始"
);
}
}
...
...
performance/Performance.Api/Controllers/ModExtractController.cs
View file @
413c1eae
...
@@ -20,6 +20,7 @@ public class ModExtractController : Controller
...
@@ -20,6 +20,7 @@ public class ModExtractController : Controller
private
readonly
AllotService
_allotService
;
private
readonly
AllotService
_allotService
;
private
readonly
CustomExtractService
_extractService
;
private
readonly
CustomExtractService
_extractService
;
private
readonly
IServiceScopeFactory
_serviceScopeFactory
;
private
readonly
IServiceScopeFactory
_serviceScopeFactory
;
private
readonly
IBackgroundTaskQueue
_backgroundTaskQueue
;
private
readonly
IHubNotificationQueue
_notificationQueue
;
private
readonly
IHubNotificationQueue
_notificationQueue
;
public
ModExtractController
(
public
ModExtractController
(
...
@@ -27,12 +28,14 @@ public class ModExtractController : Controller
...
@@ -27,12 +28,14 @@ public class ModExtractController : Controller
AllotService
allotService
,
AllotService
allotService
,
CustomExtractService
extractService
,
CustomExtractService
extractService
,
IServiceScopeFactory
serviceScopeFactory
,
IServiceScopeFactory
serviceScopeFactory
,
IBackgroundTaskQueue
backgroundTaskQueue
,
IHubNotificationQueue
notificationQueue
)
IHubNotificationQueue
notificationQueue
)
{
{
_claim
=
claim
;
_claim
=
claim
;
_allotService
=
allotService
;
_allotService
=
allotService
;
_extractService
=
extractService
;
_extractService
=
extractService
;
_serviceScopeFactory
=
serviceScopeFactory
;
_serviceScopeFactory
=
serviceScopeFactory
;
_backgroundTaskQueue
=
backgroundTaskQueue
;
_notificationQueue
=
notificationQueue
;
_notificationQueue
=
notificationQueue
;
}
}
...
@@ -43,27 +46,27 @@ public ApiResponse CustomExtract(int allotId)
...
@@ -43,27 +46,27 @@ public ApiResponse CustomExtract(int allotId)
if
(!
_extractService
.
CheckConfigScript
(
userId
,
allotId
))
if
(!
_extractService
.
CheckConfigScript
(
userId
,
allotId
))
return
new
ApiResponse
(
ResponseType
.
Fail
,
"未配置自定义抽取,请联系绩效管理人员。"
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
"未配置自定义抽取,请联系绩效管理人员。"
);
//
_backgroundTaskQueue.QueueBackgroundWorkItem(async token =>
_backgroundTaskQueue
.
QueueBackgroundWorkItem
(
async
token
=>
//
{
{
//
using (var scope = _serviceScopeFactory.CreateScope())
using
(
var
scope
=
_serviceScopeFactory
.
CreateScope
())
//
{
{
//
var scopedServices = scope.ServiceProvider.GetRequiredService<CustomExtractService>();
var
scopedServices
=
scope
.
ServiceProvider
.
GetRequiredService
<
CustomExtractService
>();
//
var scopedAllotService = scope.ServiceProvider.GetRequiredService<AllotService>();
var
scopedAllotService
=
scope
.
ServiceProvider
.
GetRequiredService
<
AllotService
>();
//
var scopedQueue = scope.ServiceProvider.GetRequiredService<IHubNotificationQueue>();
var
scopedQueue
=
scope
.
ServiceProvider
.
GetRequiredService
<
IHubNotificationQueue
>();
//
if (scopedServices.ExtractData(userId, allotId, out string resultFilePath))
if
(
scopedServices
.
ExtractData
(
userId
,
allotId
,
out
string
resultFilePath
))
//
{
{
//
scopedAllotService.UpdateAllotCustomExtractPath(allotId, resultFilePath);
scopedAllotService
.
UpdateAllotCustomExtractPath
(
allotId
,
resultFilePath
);
//
scopedQueue.Send(new Notification(allotId, "CustomDowoload", new CustomDownloadContent("自定义数据提取数据成功,是否立即下载", allotId)));
scopedQueue
.
Send
(
new
Notification
(
allotId
,
"CustomDowoload"
,
new
CustomDownloadContent
(
"自定义数据提取数据成功,是否立即下载"
,
allotId
)));
//
}
}
//
else
else
//
{
{
//
scopedQueue.Send(new Notification(allotId, "Notification", new TextContent("自定义数据提取数据失败", NotificationLevel.ERR)));
scopedQueue
.
Send
(
new
Notification
(
allotId
,
"Notification"
,
new
TextContent
(
"自定义数据提取数据失败"
,
NotificationLevel
.
ERR
)));
//
}
}
//
await Task.Delay(TimeSpan.FromSeconds(5), token);
await
Task
.
Delay
(
TimeSpan
.
FromSeconds
(
5
),
token
);
//
}
}
//
});
});
_notificationQueue
.
Send
(
new
Notification
(
allotId
,
"Notification"
,
new
TextContent
(
"自定义数据提取任务开始执行"
)));
_notificationQueue
.
Send
(
new
Notification
(
allotId
,
"Notification"
,
new
TextContent
(
"自定义数据提取任务开始执行"
)));
...
...
performance/Performance.Repository/PerforCofdirectorRepository.cs
View file @
413c1eae
...
@@ -76,6 +76,7 @@ public int DeleteAllotData(int allotId)
...
@@ -76,6 +76,7 @@ public int DeleteAllotData(int allotId)
"im_employee_logistics"
,
"im_employee_logistics"
,
"im_header"
,
"im_header"
,
"im_specialunit"
,
"im_specialunit"
,
"his_data"
,
"log_check"
,
"log_check"
,
"per_employee"
,
"per_employee"
,
"per_sheet"
,
"per_sheet"
,
...
...
performance/Performance.Repository/PerforPerAllotRepository.cs
View file @
413c1eae
...
@@ -123,10 +123,7 @@ public void ClearResultData(int allotid)
...
@@ -123,10 +123,7 @@ public void ClearResultData(int allotid)
if
(
connection
.
State
!=
ConnectionState
.
Open
)
connection
.
Open
();
if
(
connection
.
State
!=
ConnectionState
.
Open
)
connection
.
Open
();
try
try
{
{
string
update
=
"update ex_result set isdelete = 1 where allotid = @allotid "
;
string
clear
=
"delete from ex_result where allotid = @allotid;"
;
connection
.
Execute
(
update
,
new
{
allotid
},
commandTimeout
:
60
*
60
);
string
clear
=
"delete from ex_result where allotid = @allotid and isdelete = 1 and createtime < (select min(createtime) from (select distinct createtime from ex_result where allotid = @allotid and isdelete = 1 order by createtime desc limit 4) t);"
;
connection
.
Execute
(
clear
,
new
{
allotid
},
commandTimeout
:
60
*
60
);
connection
.
Execute
(
clear
,
new
{
allotid
},
commandTimeout
:
60
*
60
);
}
}
catch
(
Exception
)
catch
(
Exception
)
...
...
performance/Performance.Services/AllotService.cs
View file @
413c1eae
...
@@ -487,7 +487,14 @@ public void Generate(per_allot allot)
...
@@ -487,7 +487,14 @@ public void Generate(per_allot allot)
/// <param name="allot"></param>
/// <param name="allot"></param>
public
void
GenerateReport
(
per_allot
allot
)
public
void
GenerateReport
(
per_allot
allot
)
{
{
reportService
.
ExecProc
(
"call proc_report_performance(@hospitalid, @year, @month);"
,
new
{
allot
.
HospitalId
,
allot
.
Year
,
allot
.
Month
});
try
{
reportService
.
ExecProc
(
"call proc_report_performance(@hospitalid, @year, @month);"
,
new
{
allot
.
HospitalId
,
allot
.
Year
,
allot
.
Month
});
}
catch
(
Exception
ex
)
{
_logger
.
LogError
(
$"
{
allot
.
Year
}
年
{
allot
.
Month
}
月绩效报表生成失败。 allotid:
{
allot
.
ID
}
。"
+
ex
.
Message
);
}
}
}
/// <summary>
/// <summary>
...
...
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
View file @
413c1eae
...
@@ -232,7 +232,8 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri
...
@@ -232,7 +232,8 @@ private void HisData(per_allot allot, sys_hospitalconfig config, his_script scri
var
data
=
queryService
.
QueryData
<
HisData
>(
config
,
script
.
ExecScript
,
allot
,
isSingle
);
var
data
=
queryService
.
QueryData
<
HisData
>(
config
,
script
.
ExecScript
,
allot
,
isSingle
);
if
(
data
==
null
||
!
data
.
Any
())
return
;
if
(
data
==
null
||
!
data
.
Any
())
return
;
var
hisdata
=
hisdataRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
&&
t
.
SourceType
==
script
.
SourceType
&&
t
.
Category
==
script
.
Category
);
var
hisdata
=
hisdataRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
&&
t
.
Year
==
allot
.
Year
&&
t
.
Month
==
allot
.
Month
&&
t
.
SourceType
==
script
.
SourceType
&&
t
.
Category
==
script
.
Category
);
if
(
hisdata
!=
null
&&
hisdata
.
Any
())
if
(
hisdata
!=
null
&&
hisdata
.
Any
())
{
{
hisdataRepository
.
RemoveRange
(
hisdata
.
ToArray
());
hisdataRepository
.
RemoveRange
(
hisdata
.
ToArray
());
...
...
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