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
f49b1c57
Commit
f49b1c57
authored
Mar 25, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
清除历史记录以及copy配置
parent
1e3f69cb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
120 additions
and
10 deletions
+120
-10
performance/Performance.Api/Controllers/AllotController.cs
+5
-3
performance/Performance.Services/PerExcelService/PerExcelService.cs
+115
-7
No files found.
performance/Performance.Api/Controllers/AllotController.cs
View file @
f49b1c57
...
...
@@ -112,7 +112,7 @@ public ApiResponse Import([FromForm] IFormCollection form)
var
file
=
((
FormFileCollection
)
form
.
Files
).
FirstOrDefault
();
if
(
file
==
null
)
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"
allotid
无效"
);
return
new
ApiResponse
(
ResponseType
.
Fail
,
"参数错误"
,
"
文件
无效"
);
var
allot
=
_allotService
.
GetAllot
(
allotid
);
if
(
allot
==
null
)
...
...
@@ -136,6 +136,8 @@ public ApiResponse Import([FromForm] IFormCollection form)
allot
.
UploadDate
=
DateTime
.
Now
;
if
(!
_allotService
.
Update
(
allot
))
return
new
ApiResponse
(
ResponseType
.
Fail
,
$"
{
file
.
FileName
}
上传成功,修改状态失败"
);
_perExcelService
.
Clear
(
allot
.
ID
);
_perExcelService
.
Copy
(
allot
);
}
return
new
ApiResponse
(
ResponseType
.
OK
);
...
...
@@ -148,8 +150,8 @@ public ApiResponse Generate([CustomizeValidator(RuleSet = "Delete"), FromBody]Al
var
allot
=
_allotService
.
GetAllot
(
request
.
ID
);
if
(
null
==
allot
||
string
.
IsNullOrEmpty
(
allot
.
Path
))
throw
new
PerformanceException
(
"当前绩效记录不存在或没有上传数据文件"
);
//
_perExcelService.Execute(allot);
BackgroundJob
.
Enqueue
(()
=>
_perExcelService
.
Execute
(
allot
));
_perExcelService
.
Execute
(
allot
);
//
BackgroundJob.Enqueue(() => _perExcelService.Execute(allot));
return
new
ApiResponse
(
ResponseType
.
OK
);
}
}
...
...
performance/Performance.Services/PerExcelService/PerExcelService.cs
View file @
f49b1c57
...
...
@@ -27,8 +27,15 @@ public class PerExcelService : IAutoInjection
private
PerforResAccountnurseRepository
_perforImaccountnurseRepository
;
private
PerforCofpositionRepository
_perforCofpositionRepository
;
private
PerforCofdirectorRepository
_perforCofdirectorRepository
;
private
PerforCofdrugpropRepository
_perforCofdrugpropRepository
;
private
PerforCofincomeRepository
_perforCofincomeRepository
;
private
PerforCofworkyearRepository
_perforCofworkyearRepository
;
private
PerforResAccountdoctorRepository
_perforResAccountdoctorRepository
;
private
PerforResAccountnurseRepository
_perforResAccountnurseRepository
;
private
PerforResbaiscnormRepository
_perforResbaiscnormRepository
;
private
PerforRescomputeRepository
_perforRescomputeRepository
;
private
PerforPerAllotRepository
_perforPerAllotRepository
;
public
PerExcelService
(
PerSheetService
perSheetService
,
PerHeaderService
perHeaderService
,
PerforPerSheetRepository
perforImSheetRepository
,
...
...
@@ -40,8 +47,14 @@ public class PerExcelService : IAutoInjection
PerforResAccountnurseRepository
perforImaccountnurseRepository
,
PerforCofpositionRepository
perforCofpositionRepository
,
PerforCofdirectorRepository
perforCofdirectorRepository
,
PerforCofdrugpropRepository
perforCofdrugpropRepository
,
PerforCofincomeRepository
perforCofincomeRepository
,
PerforCofworkyearRepository
perforCofworkyearRepository
,
PerforResAccountdoctorRepository
perforResAccountdoctorRepository
,
PerforResAccountnurseRepository
perforResAccountnurseRepository
)
PerforResAccountnurseRepository
perforResAccountnurseRepository
,
PerforResbaiscnormRepository
perforResbaiscnormRepository
,
PerforRescomputeRepository
perforRescomputeRepository
,
PerforPerAllotRepository
perforPerAllotRepository
)
{
_perSheetService
=
perSheetService
;
_perHeaderService
=
perHeaderService
;
...
...
@@ -56,15 +69,21 @@ public class PerExcelService : IAutoInjection
_perforResAccountdoctorRepository
=
perforResAccountdoctorRepository
;
_perforResAccountnurseRepository
=
perforResAccountnurseRepository
;
_perforCofdirectorRepository
=
perforCofdirectorRepository
;
_perforCofdrugpropRepository
=
perforCofdrugpropRepository
;
_perforCofincomeRepository
=
perforCofincomeRepository
;
_perforCofworkyearRepository
=
perforCofworkyearRepository
;
_perforResbaiscnormRepository
=
perforResbaiscnormRepository
;
_perforRescomputeRepository
=
perforRescomputeRepository
;
_perforPerAllotRepository
=
perforPerAllotRepository
;
}
public
void
Execute
(
per_allot
allot
)
{
//清空当前绩效下数据
Clear
(
allot
.
ID
);
//
Clear(allot.ID);
// 拷贝配置信息
Copy
(
allot
.
ID
);
//
Copy(allot.ID);
// 导出数据
var
excel
=
Import
(
allot
.
Path
);
...
...
@@ -90,9 +109,38 @@ private void SendEmail(per_allot allot)
}
p
rivate
void
Clear
(
int
iD
)
p
ublic
void
Clear
(
int
allotId
)
{
var
director
=
_perforCofdirectorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
);
if
(
director
!=
null
)
{
foreach
(
var
item
in
director
)
_perforCofdirectorRepository
.
Remove
(
item
);
}
var
durgprop
=
_perforCofdrugpropRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
);
if
(
durgprop
!=
null
)
{
foreach
(
var
item
in
durgprop
)
_perforCofdrugpropRepository
.
Remove
(
item
);
}
var
income
=
_perforCofincomeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
);
if
(
income
!=
null
)
{
foreach
(
var
item
in
income
)
_perforCofincomeRepository
.
Remove
(
item
);
}
var
position
=
_perforCofpositionRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
);
if
(
position
!=
null
)
{
foreach
(
var
item
in
position
)
_perforCofpositionRepository
.
Remove
(
item
);
}
var
workyear
=
_perforCofworkyearRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
);
if
(
workyear
!=
null
)
{
foreach
(
var
item
in
workyear
)
_perforCofworkyearRepository
.
Remove
(
item
);
}
}
/// <summary>
...
...
@@ -132,9 +180,69 @@ public PerExcel Import(string path)
/// 复制报表基础配置
/// </summary>
/// <param name="iD"></param>
public
void
Copy
(
int
iD
)
public
void
Copy
(
per_allot
allot
)
{
//throw new NotImplementedException();
var
list
=
_perforPerAllotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
allot
.
HospitalId
)
.
OrderByDescending
(
t
=>
t
.
Year
).
ThenBy
(
t
=>
t
.
Month
).
ToList
();
int
allotId
=
0
;
for
(
int
i
=
0
;
i
<
list
.
Count
;
i
++)
{
if
(
list
[
i
].
ID
==
allot
.
ID
&&
(
i
-
1
)
>=
0
)
allotId
=
list
[
i
-
1
].
ID
;
}
if
(
allotId
>
0
)
{
var
director
=
_perforCofdirectorRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
);
if
(
director
!=
null
)
{
foreach
(
var
item
in
director
)
{
item
.
ID
=
0
;
item
.
AllotID
=
allot
.
ID
;
_perforCofdirectorRepository
.
Add
(
item
);
}
}
var
durgprop
=
_perforCofdrugpropRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
);
if
(
durgprop
!=
null
)
{
foreach
(
var
item
in
durgprop
)
{
item
.
ID
=
0
;
item
.
AllotID
=
allot
.
ID
;
_perforCofdrugpropRepository
.
Add
(
item
);
}
}
var
income
=
_perforCofincomeRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
);
if
(
income
!=
null
)
{
foreach
(
var
item
in
income
)
{
item
.
ID
=
0
;
item
.
AllotID
=
allot
.
ID
;
_perforCofincomeRepository
.
Add
(
item
);
}
}
var
position
=
_perforCofpositionRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
);
if
(
position
!=
null
)
{
foreach
(
var
item
in
position
)
{
item
.
ID
=
0
;
item
.
AllotID
=
allot
.
ID
;
_perforCofpositionRepository
.
Add
(
item
);
}
}
var
workyear
=
_perforCofworkyearRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allotId
);
if
(
workyear
!=
null
)
{
foreach
(
var
item
in
workyear
)
{
item
.
ID
=
0
;
item
.
AllotID
=
allot
.
ID
;
_perforCofworkyearRepository
.
Add
(
item
);
}
}
}
}
/// <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