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
dfd758f7
Commit
dfd758f7
authored
Jun 06, 2019
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
邮件资源释放
parent
8aa2b332
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
7 deletions
+17
-7
performance/Performance.Api/Controllers/AgainAllotController.cs
+1
-1
performance/Performance.Api/Controllers/AllotController.cs
+1
-1
performance/Performance.Api/Controllers/TemplateController.cs
+1
-1
performance/Performance.Infrastructure/Util/EmailService.cs
+12
-2
performance/Performance.Services/ExtractService.cs
+2
-2
No files found.
performance/Performance.Api/Controllers/AgainAllotController.cs
View file @
dfd758f7
...
@@ -91,7 +91,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
...
@@ -91,7 +91,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
var
name
=
FileHelper
.
GetFileNameNoExtension
(
file
.
FileName
)
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
name
=
FileHelper
.
GetFileNameNoExtension
(
file
.
FileName
)
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
ext
=
FileHelper
.
GetExtension
(
file
.
FileName
);
var
ext
=
FileHelper
.
GetExtension
(
file
.
FileName
);
var
dpath
=
Path
.
Combine
(
env
.
ContentRootPath
.
Substring
(
0
,
env
.
ContentRootPath
.
LastIndexOf
(
"\\"
))
,
"Files"
,
$"
{
allot
.
HospitalId
}
"
,
$"
{
allot
.
Year
}{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
"
);
var
dpath
=
Path
.
Combine
(
env
.
ContentRootPath
,
"Files"
,
$"
{
allot
.
HospitalId
}
"
,
$"
{
allot
.
Year
}{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
"
);
FileHelper
.
CreateDirectory
(
dpath
);
FileHelper
.
CreateDirectory
(
dpath
);
var
path
=
Path
.
Combine
(
dpath
,
$"
{
name
}{
ext
}
"
);
var
path
=
Path
.
Combine
(
dpath
,
$"
{
name
}{
ext
}
"
);
...
...
performance/Performance.Api/Controllers/AllotController.cs
View file @
dfd758f7
...
@@ -120,7 +120,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
...
@@ -120,7 +120,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
var
name
=
FileHelper
.
GetFileNameNoExtension
(
file
.
FileName
)
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
name
=
FileHelper
.
GetFileNameNoExtension
(
file
.
FileName
)
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
ext
=
FileHelper
.
GetExtension
(
file
.
FileName
);
var
ext
=
FileHelper
.
GetExtension
(
file
.
FileName
);
var
dpath
=
Path
.
Combine
(
_evn
.
ContentRootPath
.
Substring
(
0
,
_evn
.
ContentRootPath
.
LastIndexOf
(
"\\"
))
,
"Files"
,
$"
{
allot
.
HospitalId
}
"
,
$"
{
allot
.
Year
}{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
"
);
var
dpath
=
Path
.
Combine
(
_evn
.
ContentRootPath
,
"Files"
,
$"
{
allot
.
HospitalId
}
"
,
$"
{
allot
.
Year
}{
allot
.
Month
.
ToString
().
PadLeft
(
2
,
'0'
)}
"
);
FileHelper
.
CreateDirectory
(
dpath
);
FileHelper
.
CreateDirectory
(
dpath
);
var
path
=
Path
.
Combine
(
dpath
,
$"
{
name
}{
ext
}
"
);
var
path
=
Path
.
Combine
(
dpath
,
$"
{
name
}{
ext
}
"
);
...
...
performance/Performance.Api/Controllers/TemplateController.cs
View file @
dfd758f7
...
@@ -69,7 +69,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
...
@@ -69,7 +69,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
var
name
=
FileHelper
.
GetFileNameNoExtension
(
file
.
FileName
)
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
name
=
FileHelper
.
GetFileNameNoExtension
(
file
.
FileName
)
+
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
);
var
ext
=
FileHelper
.
GetExtension
(
file
.
FileName
);
var
ext
=
FileHelper
.
GetExtension
(
file
.
FileName
);
var
dpath
=
Path
.
Combine
(
evn
.
ContentRootPath
.
Substring
(
0
,
evn
.
ContentRootPath
.
LastIndexOf
(
"\\"
))
,
"Files"
,
$"
{
hospitalid
}
"
,
"first"
);
var
dpath
=
Path
.
Combine
(
evn
.
ContentRootPath
,
"Files"
,
$"
{
hospitalid
}
"
,
"first"
);
FileHelper
.
CreateDirectory
(
dpath
);
FileHelper
.
CreateDirectory
(
dpath
);
var
path
=
Path
.
Combine
(
dpath
,
$"
{
name
}{
ext
}
"
);
var
path
=
Path
.
Combine
(
dpath
,
$"
{
name
}{
ext
}
"
);
...
...
performance/Performance.Infrastructure/Util/EmailService.cs
View file @
dfd758f7
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
using
Microsoft.Extensions.Logging
;
using
Microsoft.Extensions.Logging
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Net
;
using
System.Net
;
using
System.Net.Mail
;
using
System.Net.Mail
;
using
System.Text
;
using
System.Text
;
...
@@ -79,9 +80,9 @@ public Task<bool> SendAsync(EmailMessage message)
...
@@ -79,9 +80,9 @@ public Task<bool> SendAsync(EmailMessage message)
public
bool
Send
(
EmailMessage
message
)
public
bool
Send
(
EmailMessage
message
)
{
{
MailMessage
mail
=
new
MailMessage
();
try
try
{
{
MailMessage
mail
=
new
MailMessage
();
mail
.
From
=
new
MailAddress
(
options
.
Account
,
message
.
DisplayName
);
mail
.
From
=
new
MailAddress
(
options
.
Account
,
message
.
DisplayName
);
//多邮箱地址处理
//多邮箱地址处理
message
.
To
.
ForEach
(
t
=>
mail
.
To
.
Add
(
t
));
message
.
To
.
ForEach
(
t
=>
mail
.
To
.
Add
(
t
));
...
@@ -92,7 +93,11 @@ public bool Send(EmailMessage message)
...
@@ -92,7 +93,11 @@ public bool Send(EmailMessage message)
mail
.
IsBodyHtml
=
true
;
//设置为HTML格式
mail
.
IsBodyHtml
=
true
;
//设置为HTML格式
mail
.
Priority
=
MailPriority
.
Low
;
//优先级
mail
.
Priority
=
MailPriority
.
Low
;
//优先级
//发送附件 指明附件的绝对地址
//发送附件 指明附件的绝对地址
message
.
Attachments
.
ForEach
(
t
=>
mail
.
Attachments
.
Add
(
new
Attachment
(
t
)));
message
.
Attachments
.
ForEach
(
t
=>
{
if
(
FileHelper
.
IsExistFile
(
t
))
mail
.
Attachments
.
Add
(
new
Attachment
(
t
));
});
SmtpClient
client
=
new
SmtpClient
(
options
.
SmtpServer
,
80
);
SmtpClient
client
=
new
SmtpClient
(
options
.
SmtpServer
,
80
);
client
.
Timeout
=
10000
;
client
.
Timeout
=
10000
;
client
.
UseDefaultCredentials
=
true
;
client
.
UseDefaultCredentials
=
true
;
...
@@ -106,6 +111,11 @@ public bool Send(EmailMessage message)
...
@@ -106,6 +111,11 @@ public bool Send(EmailMessage message)
logger
.
LogError
(
ex
.
ToString
());
logger
.
LogError
(
ex
.
ToString
());
throw
ex
;
throw
ex
;
}
}
finally
{
if
(
message
.
Attachments
.
Any
())
mail
.
Attachments
.
Dispose
();
}
}
}
}
}
...
...
performance/Performance.Services/ExtractService.cs
View file @
dfd758f7
...
@@ -120,7 +120,7 @@ public void ExtractData(int allotId, string mail, sys_hospital hospital)
...
@@ -120,7 +120,7 @@ public void ExtractData(int allotId, string mail, sys_hospital hospital)
}
}
}
}
LogHelper
.
Information
(
$"基础数据提取完成,"
,
"提取绩效数据"
);
LogHelper
.
Information
(
$"基础数据提取完成,"
,
"提取绩效数据"
);
var
dpath
=
Path
.
Combine
(
environment
.
ContentRootPath
.
Substring
(
0
,
environment
.
ContentRootPath
.
LastIndexOf
(
"\\"
))
,
"Files"
,
$"
{
hospital
.
ID
}
"
,
"autoextract"
);
var
dpath
=
Path
.
Combine
(
environment
.
ContentRootPath
,
"Files"
,
$"
{
hospital
.
ID
}
"
,
"autoextract"
);
FileHelper
.
CreateDirectory
(
dpath
);
FileHelper
.
CreateDirectory
(
dpath
);
string
path
=
Path
.
Combine
(
dpath
,
$"绩效数据
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
)}
.xlsx"
);
string
path
=
Path
.
Combine
(
dpath
,
$"绩效数据
{
DateTime
.
Now
.
ToString
(
"yyyyMMddHHmmssfff"
)}
.xlsx"
);
//根据SHEET页信息,列头信息,创建EXCEL文件
//根据SHEET页信息,列头信息,创建EXCEL文件
...
@@ -416,7 +416,7 @@ private List<PerSheet> GetRepositoryData(int allotId)
...
@@ -416,7 +416,7 @@ private List<PerSheet> GetRepositoryData(int allotId)
}
}
return
sheetList
;
return
sheetList
;
}
}
/// <summary>
/// <summary>
/// 获取sheet及列头
/// 获取sheet及列头
/// </summary>
/// </summary>
...
...
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