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
24fe2597
Commit
24fe2597
authored
Mar 28, 2019
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微调
parent
e8433753
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
8 deletions
+29
-8
performance/Performance.Api/Controllers/AllotController.cs
+3
-2
performance/Performance.Services/AllotService.cs
+26
-6
No files found.
performance/Performance.Api/Controllers/AllotController.cs
View file @
24fe2597
...
@@ -155,8 +155,9 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody]Al
...
@@ -155,8 +155,9 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody]Al
var
allot
=
_allotService
.
GetAllot
(
request
.
ID
);
var
allot
=
_allotService
.
GetAllot
(
request
.
ID
);
if
(
null
==
allot
||
string
.
IsNullOrEmpty
(
allot
.
Path
))
if
(
null
==
allot
||
string
.
IsNullOrEmpty
(
allot
.
Path
))
throw
new
PerformanceException
(
"当前绩效记录不存在或没有上传数据文件"
);
throw
new
PerformanceException
(
"当前绩效记录不存在或没有上传数据文件"
);
//_perExcelService.Execute(allot);
var
user
=
_claim
.
At
(
request
);
BackgroundJob
.
Enqueue
(()
=>
_allotService
.
Generate
(
allot
));
_allotService
.
Generate
(
allot
,
user
);
//BackgroundJob.Enqueue(() => _allotService.Generate(allot, user));
return
new
ApiResponse
(
ResponseType
.
OK
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
}
}
}
...
...
performance/Performance.Services/AllotService.cs
View file @
24fe2597
...
@@ -22,9 +22,11 @@ public class AllotService : IAutoInjection
...
@@ -22,9 +22,11 @@ public class AllotService : IAutoInjection
private
ProcessComputService
processComputService
;
private
ProcessComputService
processComputService
;
private
ResultComputeService
resultComputeService
;
private
ResultComputeService
resultComputeService
;
private
ConfigService
configService
;
private
IHostingEnvironment
_evn
;
private
IHostingEnvironment
_evn
;
private
ILogger
<
AllotService
>
_logger
;
private
ILogger
<
AllotService
>
_logger
;
private
PerforPerAllotRepository
_allotRepository
;
private
PerforPerAllotRepository
_allotRepository
;
private
IEmailService
emailService
;
public
AllotService
(
PerforPerAllotRepository
allotRepository
,
public
AllotService
(
PerforPerAllotRepository
allotRepository
,
BaiscNormService
baiscNormService
,
BaiscNormService
baiscNormService
,
...
@@ -32,7 +34,9 @@ public class AllotService : IAutoInjection
...
@@ -32,7 +34,9 @@ public class AllotService : IAutoInjection
ImportDataService
importDataService
,
ImportDataService
importDataService
,
ProcessComputService
processComputService
,
ProcessComputService
processComputService
,
ResultComputeService
resultComputeService
,
ResultComputeService
resultComputeService
,
IHostingEnvironment
evn
,
ILogger
<
AllotService
>
logger
)
ConfigService
configService
,
IHostingEnvironment
evn
,
ILogger
<
AllotService
>
logger
,
IEmailService
emailService
)
{
{
_allotRepository
=
allotRepository
;
_allotRepository
=
allotRepository
;
_logger
=
logger
;
_logger
=
logger
;
...
@@ -42,6 +46,8 @@ public class AllotService : IAutoInjection
...
@@ -42,6 +46,8 @@ public class AllotService : IAutoInjection
this
.
importDataService
=
importDataService
;
this
.
importDataService
=
importDataService
;
this
.
processComputService
=
processComputService
;
this
.
processComputService
=
processComputService
;
this
.
resultComputeService
=
resultComputeService
;
this
.
resultComputeService
=
resultComputeService
;
this
.
emailService
=
emailService
;
this
.
configService
=
configService
;
}
}
#
region
基础功能
#
region
基础功能
...
@@ -163,14 +169,21 @@ public bool Update(per_allot allot)
...
@@ -163,14 +169,21 @@ public bool Update(per_allot allot)
}
}
#
endregion
#
endregion
public
void
Generate
(
per_allot
allot
)
/// <summary>
/// 生成绩效
/// </summary>
/// <param name="allot"></param>
/// <param name="user"></param>
public
void
Generate
(
per_allot
allot
,
UserIdentity
user
)
{
{
configService
.
Clear
(
allot
.
ID
);
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
InCheckData
,
EnumHelper
.
GetDescription
(
AllotStates
.
InCheckData
));
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
InCheckData
,
EnumHelper
.
GetDescription
(
AllotStates
.
InCheckData
));
// 导出数据
// 导出数据
var
excel
=
importDataService
.
ReadDataAndSave
(
allot
);
var
excel
=
importDataService
.
ReadDataAndSave
(
allot
);
if
(
checkDataService
.
Check
(
excel
,
allot
))
if
(
!
checkDataService
.
Check
(
excel
,
allot
))
{
{
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
CheckFail
,
EnumHelper
.
GetDescription
(
AllotStates
.
CheckFail
));
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
CheckFail
,
EnumHelper
.
GetDescription
(
AllotStates
.
CheckFail
));
SendEmail
(
allot
,
user
);
return
;
return
;
}
}
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
InGenerate
,
EnumHelper
.
GetDescription
(
AllotStates
.
InGenerate
));
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
InGenerate
,
EnumHelper
.
GetDescription
(
AllotStates
.
InGenerate
));
...
@@ -185,12 +198,19 @@ public void Generate(per_allot allot)
...
@@ -185,12 +198,19 @@ public void Generate(per_allot allot)
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
GenerateSucceed
,
EnumHelper
.
GetDescription
(
AllotStates
.
GenerateSucceed
));
_allotRepository
.
UpdateAllotStates
(
allot
.
ID
,
(
int
)
AllotStates
.
GenerateSucceed
,
EnumHelper
.
GetDescription
(
AllotStates
.
GenerateSucceed
));
//发送邮件
//发送邮件
SendEmail
(
allot
);
SendEmail
(
allot
,
user
);
}
}
private
void
SendEmail
(
per_allot
allot
)
private
void
SendEmail
(
per_allot
allot
,
UserIdentity
user
)
{
{
var
message
=
new
EmailMessage
{
To
=
new
List
<
string
>
{
user
.
Mail
},
DisplayName
=
"溯直健康"
,
Subject
=
"绩效生成结束"
,
Body
=
"绩效生成结束"
};
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