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
5f1dcc4a
Commit
5f1dcc4a
authored
May 08, 2019
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
邮件通知文案
parent
5debbd47
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
13 deletions
+34
-13
performance/Performance.Services/AllotService.cs
+34
-13
No files found.
performance/Performance.Services/AllotService.cs
View file @
5f1dcc4a
...
...
@@ -30,6 +30,7 @@ public class AllotService : IAutoInjection
private
IEmailService
emailService
;
private
PerforPeragainallotRepository
_againallotRepository
;
private
PerforLogcheckRepository
perforLogcheckRepository
;
private
readonly
PerforHospitalRepository
perforHospitalRepository
;
public
AllotService
(
PerforPerallotRepository
allotRepository
,
BaiscNormService
baiscNormService
,
...
...
@@ -42,7 +43,8 @@ public class AllotService : IAutoInjection
IHostingEnvironment
evn
,
ILogger
<
AllotService
>
logger
,
IEmailService
emailService
,
PerforPeragainallotRepository
againallotRepository
,
PerforLogcheckRepository
perforLogcheckRepository
)
PerforLogcheckRepository
perforLogcheckRepository
,
PerforHospitalRepository
perforHospitalRepository
)
{
_allotRepository
=
allotRepository
;
_againallotRepository
=
againallotRepository
;
...
...
@@ -57,6 +59,7 @@ public class AllotService : IAutoInjection
this
.
configService
=
configService
;
this
.
logdbug
=
logdbug
;
this
.
perforLogcheckRepository
=
perforLogcheckRepository
;
this
.
perforHospitalRepository
=
perforHospitalRepository
;
}
#
region
基础功能
...
...
@@ -185,6 +188,7 @@ public bool Update(per_allot allot)
/// <param name="user"></param>
public
void
Generate
(
per_allot
allot
,
UserIdentity
user
)
{
DateTime
time
=
DateTime
.
Now
;
try
{
logdbug
.
Add
(
allot
.
ID
,
"绩效开始执行"
,
JsonHelper
.
Serialize
(
allot
));
...
...
@@ -195,7 +199,7 @@ public void Generate(per_allot allot, UserIdentity user)
if
(!
checkDataService
.
Check
(
excel
,
allot
))
{
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
CheckFail
,
EnumHelper
.
GetDescription
(
AllotStates
.
CheckFail
));
SendEmail
(
allot
,
user
.
Mail
,
"数值健康,绩效数据校验失败"
,
"绩效数据校验失败"
);
SendEmail
(
allot
,
user
.
Mail
,
3
,
time
);
logdbug
.
Add
(
allot
.
ID
,
"绩效数据校验失败"
,
JsonHelper
.
Serialize
(
allot
));
return
;
}
...
...
@@ -213,13 +217,13 @@ public void Generate(per_allot allot, UserIdentity user)
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
GenerateSucceed
,
EnumHelper
.
GetDescription
(
AllotStates
.
GenerateSucceed
));
//发送邮件
SendEmail
(
allot
,
user
.
Mail
,
"绩效生成成功"
,
"绩效生成成功"
);
SendEmail
(
allot
,
user
.
Mail
,
1
,
time
);
logdbug
.
Add
(
allot
.
ID
,
"绩效开始执行"
,
"绩效生成成功"
);
}
catch
(
Exception
ex
)
{
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
GenerateFail
,
EnumHelper
.
GetDescription
(
AllotStates
.
GenerateFail
));
SendEmail
(
allot
,
user
.
Mail
,
"绩效生成失败"
,
ex
.
ToString
()
);
SendEmail
(
allot
,
user
.
Mail
,
2
,
time
);
logdbug
.
Add
(
allot
.
ID
,
"绩效开始执行"
,
ex
.
ToString
());
//throw ex;
}
...
...
@@ -230,17 +234,34 @@ public void Generate(per_allot allot, UserIdentity user)
/// </summary>
/// <param name="allot"></param>
/// <param name="mail"></param>
/// <param name="subject"></param>
/// <param name="body"></param>
private
void
SendEmail
(
per_allot
allot
,
string
mail
,
string
subject
,
string
body
)
/// <param name="type"> 1 成功 2 异常 3 验证失败</param>
private
void
SendEmail
(
per_allot
allot
,
string
mail
,
int
type
,
DateTime
time
)
{
var
message
=
new
EmailMessage
var
hospital
=
perforHospitalRepository
.
GetEntity
(
t
=>
t
.
ID
==
allot
.
HospitalId
);
var
message
=
new
EmailMessage
();
message
.
To
=
new
List
<
string
>
{
mail
};
message
.
DisplayName
=
"溯直健康"
;
message
.
Subject
=
$"绩效生成任务结束提醒!"
;
if
(
type
==
1
)
{
message
.
Body
=
$"<p>尊敬的用户!</p><p> 数值健康提醒您,您在
{
time
.
ToString
(
"yyyy-MM-dd hh:mm:ss"
)}
发布"
+
$"
{
hospital
.
HosName
}{
allot
.
Year
}
年
{
allot
.
Month
}
月的绩效生成任务<strong><span style=\"color:#E53333;\">“执行成功”</span></strong>,"
+
$"您可以登录<a href=\"http://jixiao.suvalue.com\" target=\"_blank\">http://jixiao.suvalue.com</a>查看绩效结果。</p>"
;
}
else
if
(
type
==
2
)
{
To
=
new
List
<
string
>
{
mail
},
DisplayName
=
"溯直健康"
,
Subject
=
subject
,
Body
=
body
};
message
.
Body
=
$"<p>尊敬的用户!</p><p> 数值健康提醒您,您在
{
time
.
ToString
(
"yyyy-MM-dd hh:mm:ss"
)}
发布"
+
$"
{
hospital
.
HosName
}{
allot
.
Year
}
年
{
allot
.
Month
}
月的绩效生成任务<strong><span style=\"color:#E53333;\">“执行失败”</span></strong>,"
+
$"执行过程中出现异常情况,我们将尽快解决问题。给您带来的不便我们深感歉意!</p>"
;
}
else
if
(
type
==
1
)
{
message
.
Body
=
$"<p>尊敬的用户!</p><p> 数值健康提醒您,您在
{
time
.
ToString
(
"yyyy-MM-dd hh:mm:ss"
)}
发布"
+
$"
{
hospital
.
HosName
}{
allot
.
Year
}
年
{
allot
.
Month
}
月的绩效生成任务<strong><span style=\"color:#E53333;\">“校验失败”</span></strong>,"
+
$"您可以登录<a href=\"http://jixiao.suvalue.com\" target=\"_blank\">http://jixiao.suvalue.com</a>查看详细清空。</p>"
;
}
emailService
.
SendAsync
(
message
);
}
...
...
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