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
716adc59
Commit
716adc59
authored
Aug 08, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
绩效抽取日志
parent
4de40ffa
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
60 additions
and
30 deletions
+60
-30
performance/Performance.Api/Controllers/TemplateController.cs
+11
-7
performance/Performance.Api/Performance.Api.csproj
+6
-0
performance/Performance.Api/Template/医院人员绩效模板.xls
+0
-0
performance/Performance.Api/Template/医院绩效模板.xls
+0
-0
performance/Performance.Api/wwwroot/Performance.Api.xml
+2
-2
performance/Performance.Extract.Api/Controllers/ExtractController.cs
+3
-3
performance/Performance.Repository/PerforCofdirectorRepository.cs
+1
-1
performance/Performance.Repository/PerforPerAllotRepository.cs
+3
-0
performance/Performance.Services/DFExtractService.cs
+0
-0
performance/Performance.Services/EmployeeService.cs
+10
-1
performance/Performance.Services/Hubs/AllotLogHub.cs
+1
-0
performance/Performance.Services/LogManageService.cs
+23
-16
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
716adc59
...
...
@@ -70,7 +70,7 @@ public IActionResult DownFile(int type = 1)
switch
(
type
)
{
case
1
:
path
=
Path
.
Combine
(
env
.
ContentRootPath
,
"Template"
,
"医院绩效模板.xls
x
"
);
path
=
Path
.
Combine
(
env
.
ContentRootPath
,
"Template"
,
"医院绩效模板.xls"
);
break
;
case
2
:
path
=
Path
.
Combine
(
env
.
ContentRootPath
,
"Template"
,
"医院二次分配绩效模板.xlsx"
);
...
...
@@ -78,6 +78,9 @@ public IActionResult DownFile(int type = 1)
case
3
:
path
=
Path
.
Combine
(
env
.
ContentRootPath
,
"Template"
,
"医院绩效模板(无执行科室).xlsx"
);
break
;
case
4
:
path
=
Path
.
Combine
(
env
.
ContentRootPath
,
"Template"
,
"医院人员绩效模板.xls"
);
break
;
}
var
memoryStream
=
new
MemoryStream
();
...
...
@@ -238,9 +241,9 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
//HttpHelper.HttpPostNoRequest(url.HttpPost + "/extract/extract", JsonHelper.Serialize(request), true);
if
(
string
.
IsNullOrEmpty
(
filePath
))
HttpHelper
.
HttpPostNoRequest
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
&
groupName =
{
request
.
GroupName
}
"
,
""
);
HttpHelper
.
HttpPostNoRequest
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
&
userId=
{
claim
.
GetUserId
()
}
"
,
""
);
else
HttpHelper
.
HttpClient
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
&
groupName =
{
request
.
GroupName
}
"
,
filePath
,
true
);
HttpHelper
.
HttpClient
(
url
.
HttpPost
+
$"/extract/extract?allotId=
{
request
.
AllotId
}
&hospitalId=
{
request
.
HospitalId
}
&email=
{
claim
.
GetUserClaim
(
JwtClaimTypes
.
Mail
)}
&
userId=
{
claim
.
GetUserId
()
}
"
,
filePath
,
true
);
return
new
ApiResponse
(
ResponseType
.
OK
,
"HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!"
,
new
{
IsExtracting
=
false
});
}
...
...
@@ -357,24 +360,25 @@ public ApiResponse SaveFile([FromForm] IFormCollection form, int allotId, int ho
/// <summary>
/// 返回日志
/// </summary>
/// <param name="allotId">绩效Id</param>
/// <param name="type">1 进度条 2 信息</param>
/// <param name="tag"></param>
/// <param name="message"></param>
/// <param name="level"></param>
/// <param name="success"></param>
/// <param name="groupName"></param>
[
Route
(
"returnlog"
)]
[
HttpPost
]
[
AllowAnonymous
]
public
void
ReturnLog
(
int
allotId
,
int
type
,
string
tag
,
string
message
,
int
level
=
1
,
bool
success
=
fals
e
)
public
void
ReturnLog
(
int
type
,
string
tag
,
string
message
,
int
level
,
string
groupNam
e
)
{
logger
.
LogInformation
(
"返回日志:"
+
JsonHelper
.
Serialize
(
new
{
type
,
tag
,
message
,
level
,
groupName
}));
if
(
type
==
3
)
{
logService
.
Schedule
(
allotId
,
ConvertHelper
.
To
<
decimal
>(
message
),
level
,
success
);
logService
.
Schedule
(
groupName
,
ConvertHelper
.
To
<
decimal
>(
message
),
level
);
}
else
{
logService
.
ExtractLog
(
allotId
,
tag
,
message
,
level
);
logService
.
ExtractLog
(
groupName
,
tag
,
message
,
level
);
}
}
...
...
performance/Performance.Api/Performance.Api.csproj
View file @
716adc59
...
...
@@ -83,9 +83,15 @@
<None Update="Template\医院二次分配绩效模板.xlsx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Template\医院人员绩效模板.xls">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Template\医院绩效模板%28无执行科室%29.xlsx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Template\医院绩效模板.xls">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Template\医院绩效模板.xlsx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
...
...
performance/Performance.Api/Template/医院人员绩效模板.xls
0 → 100644
View file @
716adc59
File added
performance/Performance.Api/Template/医院绩效模板.xls
View file @
716adc59
No preview for this file type
performance/Performance.Api/wwwroot/Performance.Api.xml
View file @
716adc59
...
...
@@ -1190,16 +1190,16 @@
<param
name=
"hospitalId"
></param>
<returns></returns>
</member>
<member
name=
"M:Performance.Api.Controllers.TemplateController.ReturnLog(System.Int32,System.
Int32,System.String,System.String,System.Int32,System.Boolean
)"
>
<member
name=
"M:Performance.Api.Controllers.TemplateController.ReturnLog(System.Int32,System.
String,System.String,System.Int32,System.Boolean,System.String
)"
>
<summary>
返回日志
</summary>
<param
name=
"allotId"
>
绩效Id
</param>
<param
name=
"type"
>
1 进度条 2 信息
</param>
<param
name=
"tag"
></param>
<param
name=
"message"
></param>
<param
name=
"level"
></param>
<param
name=
"success"
></param>
<param
name=
"groupName"
></param>
</member>
<member
name=
"M:Performance.Api.Controllers.TemplateController.ReturnLog(Performance.EntityModels.log_dbug)"
>
<summary>
...
...
performance/Performance.Extract.Api/Controllers/ExtractController.cs
View file @
716adc59
...
...
@@ -112,9 +112,9 @@ public ApiResponse Import([FromForm] IFormCollection form, int type, int hospita
/// <returns></returns>
[
Route
(
"extract"
)]
[
HttpPost
]
public
void
ExtractData
([
FromForm
]
IFormCollection
form
,
int
allotId
,
int
hospitalId
,
string
email
)
public
void
ExtractData
([
FromForm
]
IFormCollection
form
,
int
allotId
,
int
hospitalId
,
string
email
,
string
userId
)
{
logger
.
LogInformation
(
"提取绩效数据请求参数:"
+
JsonHelper
.
Serialize
(
new
{
allotId
,
hospitalId
,
email
}));
logger
.
LogInformation
(
"提取绩效数据请求参数:"
+
JsonHelper
.
Serialize
(
new
{
allotId
,
hospitalId
,
email
,
userId
}));
if
(
allotId
==
0
||
hospitalId
==
0
)
return
;
...
...
@@ -149,7 +149,7 @@ public void ExtractData([FromForm] IFormCollection form, int allotId, int hospit
#
endregion
//string filePath = newExtractService.ExtractData(allotId, request.Email, hospitalId);
string
filePath
=
extractService
.
ExtractData
(
allotId
,
email
,
hospitalId
,
path
);
//抽取
string
filePath
=
extractService
.
ExtractData
(
allotId
,
email
,
hospitalId
,
"User"
+
userId
,
path
);
//抽取
#
region
保存文件到网站下
...
...
performance/Performance.Repository/PerforCofdirectorRepository.cs
View file @
716adc59
...
...
@@ -38,7 +38,7 @@ public int DeleteData(int allotId)
};
string
sql
=
""
;
tableArray
.
ForEach
(
t
=>
sql
+=
$"delete from
{
t
}
where allotid=@allotId;"
);
sql
+=
"delete from log_dbug where allotid=@allotId and
sourc
e=1;"
;
sql
+=
"delete from log_dbug where allotid=@allotId and
typ
e=1;"
;
return
Execute
(
sql
,
new
{
allotId
});
}
...
...
performance/Performance.Repository/PerforPerAllotRepository.cs
View file @
716adc59
...
...
@@ -109,6 +109,9 @@ public void ClearResultData(int allotid)
if
(
connection
.
State
!=
ConnectionState
.
Open
)
connection
.
Open
();
try
{
string
update
=
"update ex_result set isdelete = 1 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
);
}
...
...
performance/Performance.Services/DFExtractService.cs
View file @
716adc59
This diff is collapsed.
Click to expand it.
performance/Performance.Services/EmployeeService.cs
View file @
716adc59
using
AutoMapper
;
using
Microsoft.AspNetCore.Hosting
;
using
Microsoft.Extensions.Logging
;
using
NPOI.HSSF.UserModel
;
using
NPOI.SS.UserModel
;
using
NPOI.SS.Util
;
using
NPOI.XSSF.UserModel
;
...
...
@@ -330,7 +331,15 @@ public void ImpoerAprEmployees(int allotid, string path, int userid)
try
{
IWorkbook
workbook
=
new
XSSFWorkbook
(
path
);
IWorkbook
workbook
=
null
;
var
version
=
FileHelper
.
GetExtension
(
path
)
==
".xlsx"
?
ExcelVersion
.
xlsx
:
ExcelVersion
.
xls
;
using
(
FileStream
fs
=
new
FileStream
(
path
,
FileMode
.
OpenOrCreate
))
{
workbook
=
(
version
==
ExcelVersion
.
xlsx
)
?
(
IWorkbook
)(
new
XSSFWorkbook
(
fs
))
:
(
IWorkbook
)(
new
HSSFWorkbook
(
fs
));
}
if
(
workbook
==
null
)
return
;
var
sheet
=
workbook
.
GetSheetAt
(
0
);
...
...
performance/Performance.Services/Hubs/AllotLogHub.cs
View file @
716adc59
...
...
@@ -64,6 +64,7 @@ public override Task OnDisconnectedAsync(Exception exception)
cache
.
Set
(
key
,
groupName
,
new
TimeSpan
(
1
,
0
,
0
));
logger
.
LogDebug
(
$"日志推送 添加用户组
{
connectionId
}
-
{
groupName
}
"
);
//2 将用户插入分组
await
Groups
.
AddToGroupAsync
(
connectionId
,
groupName
);
}
...
...
performance/Performance.Services/LogManageService.cs
View file @
716adc59
using
Microsoft.AspNetCore.Mvc.ViewFeatures
;
using
Microsoft.AspNetCore.SignalR
;
using
Microsoft.AspNetCore.SignalR
;
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Options
;
using
Performance.DtoModels.AppSettings
;
using
Performance.Infrastructure
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
System.Threading.Tasks
;
namespace
Performance.Services
{
...
...
@@ -52,36 +48,47 @@ public void WriteMsg(string tag, string message, int level, int allotId, string
/// <summary>
/// 抽取进度
/// </summary>
/// <param name="
allotId
"></param>
/// <param name="
groupName
"></param>
/// <param name="ratio"></param>
/// <param name="level">等级1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)</param>
/// <param name="success"></param>
public
void
Schedule
(
int
allotId
,
decimal
ratio
,
int
level
=
1
,
bool
success
=
false
)
public
void
Schedule
(
string
groupName
,
decimal
ratio
,
int
level
)
{
if
(!
success
&&
ratio
>
100
)
ratio
=
99
;
ratio
=
Math
.
Round
(
ratio
)
;
if
(
success
&&
ratio
!=
100
)
ratio
=
100
;
if
(
level
!=
5
&&
ratio
>
100
)
ratio
=
99
;
hubContext
.
Clients
.
Group
(
$"Extract
{
allotId
}
"
).
SendAsync
(
"Schedule"
,
ratio
,
level
);
if
(
level
==
5
&&
ratio
!=
100
)
ratio
=
100
;
hubContext
.
Clients
.
Group
(
groupName
).
SendAsync
(
"Schedule"
,
ratio
,
level
);
}
/// <summary>
/// 抽取日志
/// </summary>
/// <param name="
allotId
"></param>
/// <param name="
groupName
"></param>
/// <param name="tag"></param>
/// <param name="message"></param>
/// <param name="level">等级1、信息(info)2、警告(warn)3、错误(error)4、异常(exception)5、成功(success)</param>
public
void
ExtractLog
(
int
allotId
,
string
tag
,
string
message
,
int
level
=
1
)
public
void
ExtractLog
(
string
groupName
,
string
tag
,
string
message
,
int
level
)
{
hubContext
.
Clients
.
Group
(
$"Extract
{
allotId
}
"
).
SendAsync
(
"ExtractLog"
,
tag
,
message
,
level
);
hubContext
.
Clients
.
Group
(
groupName
).
SendAsync
(
"ExtractLog"
,
tag
,
message
,
level
);
}
public
void
ReturnTheLog
(
int
allotId
,
int
type
,
string
tag
,
object
message
,
int
level
=
1
,
bool
success
=
false
)
public
void
ReturnTheLog
(
int
allotId
,
string
groupName
,
int
type
,
string
tag
,
object
message
,
int
level
=
1
)
{
logdbug
.
Add
(
allotId
,
tag
,
message
.
ToString
(),
level
,
type
);
HttpHelper
.
HttpPostNoRequest
(
url
.
ImportFile
+
$"/template/returnlog?allotId=
{
allotId
}
&type=
{
type
}
&tag=
{
tag
}
&message=
{
message
}
&level=
{
level
}
&success=
{
success
}
"
,
""
);
try
{
var
http
=
url
.
ImportFile
+
$"/template/returnlog?type=
{
type
}
&tag=
{
tag
}
&message=
{
message
}
&level=
{
level
}
&groupName=
{
groupName
}
"
;
logger
.
LogInformation
(
"发送日志:"
+
http
);
logdbug
.
Add
(
allotId
,
tag
,
message
.
ToString
(),
level
,
type
);
HttpHelper
.
HttpPostNoRequest
(
http
,
""
);
}
catch
(
Exception
ex
)
{
logger
.
LogInformation
(
"发送日志失败:"
+
ex
.
ToString
());
}
}
public
bool
ClearExtractLog
(
int
allotId
)
...
...
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