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
aba86203
Commit
aba86203
authored
Jun 04, 2019
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
下载文件
parent
72f262ee
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
8 deletions
+38
-8
performance/Performance.Api/Controllers/TemplateController.cs
+21
-0
performance/Performance.Api/Filters/ActionsFilter.cs
+7
-4
performance/Performance.DtoModels/Response/AllotResponse.cs
+4
-0
performance/Performance.Services/AllotService.cs
+6
-4
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
aba86203
...
...
@@ -4,6 +4,7 @@
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http.Internal
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.AspNetCore.StaticFiles
;
using
Microsoft.Extensions.Options
;
using
Performance.DtoModels
;
using
Performance.DtoModels.AppSettings
;
...
...
@@ -119,5 +120,24 @@ public ApiResponse ExtractData([CustomizeValidator(RuleSet = "Template"), FromBo
BackgroundJob
.
Enqueue
(()
=>
extractService
.
ExtractData
(
request
.
ID
,
user
.
Mail
,
hospital
));
return
new
ApiResponse
(
ResponseType
.
OK
,
"HIS绩效数据提取任务正在执行,稍后我们将以邮件的通知您!"
);
}
/// <summary>
/// 从WebAPI下载文件
/// </summary>
/// <returns></returns>
[
Route
(
"down"
)]
public
IActionResult
DownFile
([
FromQuery
]
AllotRequest
request
)
{
var
allot
=
allotService
.
GetAllot
(
request
.
ID
);
if
(
allot
==
null
||
string
.
IsNullOrWhiteSpace
(
allot
.
ExtractPath
)
||
!
FileHelper
.
IsExistFile
(
allot
.
ExtractPath
))
{
return
new
ObjectResult
(
new
ApiResponse
(
ResponseType
.
Fail
,
"文件不存在"
));
}
var
stream
=
new
FileStream
(
allot
.
ExtractPath
,
FileMode
.
Open
);
string
fileExt
=
Path
.
GetExtension
(
allot
.
ExtractPath
);
var
provider
=
new
FileExtensionContentTypeProvider
();
var
memi
=
provider
.
Mappings
[
fileExt
];
return
File
(
stream
,
memi
,
Path
.
GetFileName
(
allot
.
ExtractPath
));
}
}
}
\ No newline at end of file
performance/Performance.Api/Filters/ActionsFilter.cs
View file @
aba86203
...
...
@@ -83,10 +83,13 @@ public ActionsFilter(ILoggerFactory factory, IMemoryCache cache, IHostingEnviron
if
(
executedContext
.
Exception
!=
null
)
throw
executedContext
.
Exception
;
var
objectResult
=
(
ObjectResult
)
executedContext
.
Result
;
var
jsonData
=
JsonHelper
.
Serialize
(
objectResult
.
Value
);
_logger
.
LogInformation
(
$"响应结果:
{
jsonData
}
"
);
LogHelper
.
Information
(
$"请求地址:
{
context
.
HttpContext
.
Request
.
Path
}
;响应结果:
{
jsonData
}
"
,
"响应结果"
);
if
(
executedContext
.
Result
is
ObjectResult
)
{
var
objectResult
=
(
ObjectResult
)
executedContext
.
Result
;
var
jsonData
=
JsonHelper
.
Serialize
(
objectResult
.
Value
);
_logger
.
LogInformation
(
$"响应结果:
{
jsonData
}
"
);
LogHelper
.
Information
(
$"请求地址:
{
context
.
HttpContext
.
Request
.
Path
}
;响应结果:
{
jsonData
}
"
,
"响应结果"
);
}
}
}
...
...
performance/Performance.DtoModels/Response/AllotResponse.cs
View file @
aba86203
...
...
@@ -53,5 +53,9 @@ public class AllotResponse
/// 提取绩效数据文件生成路径
/// </summary>
public
string
ExtractPath
{
get
;
set
;
}
/// <summary>
/// 是否可以下载
/// </summary>
public
bool
IsDown
{
get
;
set
;
}
}
}
performance/Performance.Services/AllotService.cs
View file @
aba86203
...
...
@@ -74,7 +74,9 @@ public List<AllotResponse> GetAllotList(int? hospitalId)
throw
new
PerformanceException
(
"hospitalId无效"
);
var
allotList
=
_allotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
allotList
=
allotList
==
null
?
allotList
:
allotList
.
OrderByDescending
(
t
=>
t
.
ID
).
ToList
();
return
Mapper
.
Map
<
List
<
AllotResponse
>>(
allotList
);
var
reuslt
=
Mapper
.
Map
<
List
<
AllotResponse
>>(
allotList
);
reuslt
.
ForEach
(
t
=>
t
.
IsDown
=
!
string
.
IsNullOrEmpty
(
t
.
ExtractPath
));
return
reuslt
;
}
/// <summary>
...
...
@@ -199,7 +201,7 @@ public void Generate(per_allot allot, string mail)
if
(!
checkDataService
.
Check
(
excel
,
allot
))
{
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
CheckFail
,
EnumHelper
.
GetDescription
(
AllotStates
.
CheckFail
));
SendEmail
(
allot
,
mail
,
3
,
time
);
SendEmail
(
allot
,
mail
,
3
,
time
);
logdbug
.
Add
(
allot
.
ID
,
"绩效数据校验失败"
,
JsonHelper
.
Serialize
(
allot
));
return
;
}
...
...
@@ -217,13 +219,13 @@ public void Generate(per_allot allot, string mail)
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
GenerateSucceed
,
EnumHelper
.
GetDescription
(
AllotStates
.
GenerateSucceed
));
//发送邮件
SendEmail
(
allot
,
mail
,
1
,
time
);
SendEmail
(
allot
,
mail
,
1
,
time
);
logdbug
.
Add
(
allot
.
ID
,
"绩效开始执行"
,
"绩效生成成功"
);
}
catch
(
Exception
ex
)
{
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
GenerateFail
,
EnumHelper
.
GetDescription
(
AllotStates
.
GenerateFail
));
SendEmail
(
allot
,
mail
,
2
,
time
);
SendEmail
(
allot
,
mail
,
2
,
time
);
logdbug
.
Add
(
allot
.
ID
,
"绩效开始执行"
,
ex
.
ToString
());
//throw ex;
}
...
...
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