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
b53eca2a
Commit
b53eca2a
authored
May 15, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug -- 部分列头无法获取
parent
f118e442
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
132 additions
and
31 deletions
+132
-31
performance/Performance.Api/Controllers/TemplateController.cs
+17
-2
performance/Performance.Services/ExtractService.cs
+112
-24
performance/Performance.Services/TemplateService.cs
+3
-5
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
b53eca2a
...
...
@@ -3,11 +3,14 @@
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Http.Internal
;
using
Microsoft.AspNetCore.Mvc
;
using
Microsoft.Extensions.Options
;
using
Performance.DtoModels
;
using
Performance.DtoModels.AppSettings
;
using
Performance.EntityModels
;
using
Performance.Infrastructure
;
using
Performance.Services
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
...
...
@@ -21,17 +24,20 @@ public class TemplateController : Controller
private
HospitalService
hospitalService
;
private
IHostingEnvironment
evn
;
private
ClaimService
claim
;
private
Application
application
;
public
TemplateController
(
TemplateService
templateService
,
HospitalService
hospitalService
,
ExtractService
extractService
,
IHostingEnvironment
evn
,
ClaimService
claim
)
ClaimService
claim
,
IOptions
<
Application
>
options
)
{
this
.
templateService
=
templateService
;
this
.
extractService
=
extractService
;
this
.
hospitalService
=
hospitalService
;
this
.
evn
=
evn
;
this
.
claim
=
claim
;
this
.
application
=
options
.
Value
;
}
/// <summary>
...
...
@@ -80,7 +86,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
};
if
(
templateService
.
InsertFirst
(
template
))
{
templateService
.
SendEmail
(
path
,
$"
{
hospital
.
HosName
}
首次上传模板"
,
"上传成功"
);
templateService
.
SendEmail
(
application
.
Receiver
.
ToList
(),
path
,
$"
{
hospital
.
HosName
}
首次上传模板"
,
"上传成功"
);
}
}
return
new
ApiResponse
(
ResponseType
.
OK
);
...
...
@@ -95,7 +101,16 @@ public ApiResponse Import([FromForm] IFormCollection form)
[
HttpPost
]
public
ApiResponse
ExtractData
([
CustomizeValidator
(
RuleSet
=
"Delete"
),
FromBody
]
HospitalRequest
request
)
{
var
hospital
=
hospitalService
.
GetHopital
(
request
.
ID
);
if
(
hospital
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"hospitalid不存在"
);
var
filePath
=
extractService
.
ExtractData
(
request
.
ID
);
if
(!
string
.
IsNullOrEmpty
(
filePath
)
&&
FileHelper
.
IsExistFile
(
filePath
))
{
var
user
=
claim
.
At
(
request
.
Token
);
templateService
.
SendEmail
(
new
List
<
string
>
{
user
.
Mail
},
filePath
,
$"
{
hospital
.
HosName
}
提取数据"
,
$"
{
hospital
.
HosName
}
在
{
DateTime
.
Now
.
ToString
(
"yyyy-MM-dd HH:mm:ss"
)}
成功提取。"
);
}
return
new
ApiResponse
(
ResponseType
.
OK
,
"OK"
,
filePath
);
}
}
...
...
performance/Performance.Services/ExtractService.cs
View file @
b53eca2a
This diff is collapsed.
Click to expand it.
performance/Performance.Services/TemplateService.cs
View file @
b53eca2a
...
...
@@ -12,13 +12,11 @@ namespace Performance.Services
{
public
class
TemplateService
:
IAutoInjection
{
private
Application
application
;
private
IEmailService
emailService
;
private
PerforPerfirstRepository
PerforPerfirstRepository
;
public
TemplateService
(
I
Options
<
Application
>
options
,
I
EmailService
emailService
,
public
TemplateService
(
IEmailService
emailService
,
PerforPerfirstRepository
PerforPerfirstRepository
)
{
this
.
application
=
options
.
Value
;
this
.
emailService
=
emailService
;
this
.
PerforPerfirstRepository
=
PerforPerfirstRepository
;
}
...
...
@@ -40,11 +38,11 @@ public bool InsertFirst(per_first first)
/// <param name="path"></param>
/// <param name="subject"></param>
/// <param name="body"></param>
public
void
SendEmail
(
string
path
,
string
subject
,
string
body
)
public
void
SendEmail
(
List
<
string
>
receiver
,
string
path
,
string
subject
,
string
body
)
{
var
message
=
new
EmailMessage
{
To
=
application
.
Receiver
.
ToList
()
,
To
=
receiver
,
Attachments
=
new
List
<
string
>
{
path
},
DisplayName
=
"溯直健康"
,
Subject
=
subject
,
...
...
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