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
b89c5212
Commit
b89c5212
authored
Jun 10, 2020
by
lcx
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '单元格修改' into 读取excel抽取
parents
52dcc918
92f7f024
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
28 deletions
+61
-28
performance/Performance.Api/Controllers/SecondAllotController.cs
+2
-2
performance/Performance.Services/SecondAllotService.cs
+59
-26
No files found.
performance/Performance.Api/Controllers/SecondAllotController.cs
View file @
b89c5212
...
@@ -49,8 +49,8 @@ public ApiResponse List()
...
@@ -49,8 +49,8 @@ public ApiResponse List()
[
HttpPost
]
[
HttpPost
]
public
ApiResponse
SaveValue
(
int
secondid
,
[
FromBody
]
List
<
ag_fixatitem
>
request
)
public
ApiResponse
SaveValue
(
int
secondid
,
[
FromBody
]
List
<
ag_fixatitem
>
request
)
{
{
if
(
secondid
!=
0
&&
(
request
==
null
||
request
.
Count
==
0
))
//
if (secondid != 0 && (request == null || request.Count == 0))
secondAllotService
.
DelValue
(
secondid
,
request
);
//
secondAllotService.DelValue(secondid, request);
var
allotCount
=
request
.
Where
(
t
=>
t
.
AllotId
>
0
).
Select
(
t
=>
t
.
AllotId
).
Distinct
().
Count
();
var
allotCount
=
request
.
Where
(
t
=>
t
.
AllotId
>
0
).
Select
(
t
=>
t
.
AllotId
).
Distinct
().
Count
();
if
(
allotCount
!=
1
||
request
.
Any
(
t
=>
t
.
AllotId
==
0
))
if
(
allotCount
!=
1
||
request
.
Any
(
t
=>
t
.
AllotId
==
0
))
...
...
performance/Performance.Services/SecondAllotService.cs
View file @
b89c5212
...
@@ -308,7 +308,7 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
...
@@ -308,7 +308,7 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
//检验 二次绩效配置 数据是否 有值,无则补充带出
//检验 二次绩效配置 数据是否 有值,无则补充带出
FillData
(
second
,
result
.
BodyItems
);
FillData
(
second
,
result
.
BodyItems
);
SupplyHeaderByWorkItem
(
request
,
result
,
second
);
SupplyHeaderByWorkItem
(
request
,
result
,
second
,
fixatList
?.
Where
(
t
=>
t
.
RowNumber
==
-
1
)
);
return
new
SecondResponse
return
new
SecondResponse
{
{
...
@@ -436,18 +436,13 @@ private void FillData(ag_secondallot second, List<BodyItem> bodyItems)
...
@@ -436,18 +436,13 @@ private void FillData(ag_secondallot second, List<BodyItem> bodyItems)
/// </summary>
/// </summary>
/// <param name="request"></param>
/// <param name="request"></param>
/// <param name="result"></param>
/// <param name="result"></param>
private
void
SupplyHeaderByWorkItem
(
UseTempRequest
request
,
SecondResponse
result
,
ag_secondallot
second
)
private
void
SupplyHeaderByWorkItem
(
UseTempRequest
request
,
SecondResponse
result
,
ag_secondallot
second
,
IEnumerable
<
ag_fixatitem
>
fixatitems
)
{
{
var
workitem
=
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
Department
==
request
.
Department
//
var workitem = perforAgworkloadRepository.GetEntities(t => t.HospitalId == request.HospitalId && t.Department == request.Department
&&
t
.
UnitType
==
request
.
UnitType
&&
!
EnumHelper
.
GetItems
<
AgWorkloadType
>().
Select
(
type
=>
type
.
Value
).
Contains
(
t
.
WorkTypeId
)
);
//&& t.UnitType == request.UnitType && t.WorkTypeId != (int)AgWorkloadType.SingleAwards
);
if
(
workitem
==
null
||
!
workitem
.
Any
(
t
=>
t
.
Id
>
0
))
//if (workitem == null || !workitem.Any(t => t.Id > 0))
return
;
// return;
var
unit
=
second
.
UnitType
==
UnitType
.
医技组
.
ToString
()
?
UnitType
.
医生组
.
ToString
()
:
second
.
UnitType
;
var
deptHeader
=
perforAgworkloadtypeRepository
.
GetEntities
(
t
=>
request
.
HospitalId
==
t
.
HospitalId
&&
t
.
Department
==
second
.
Department
&&
t
.
UnitType
==
unit
);
if
(
deptHeader
==
null
||
!
deptHeader
.
Any
())
return
;
//不包含工作量绩效
//不包含工作量绩效
if
(!
result
.
HeadItems
.
Select
(
t
=>
t
.
FiledId
).
Contains
(
"PerformanceShareTheWorkload"
))
if
(!
result
.
HeadItems
.
Select
(
t
=>
t
.
FiledId
).
Contains
(
"PerformanceShareTheWorkload"
))
...
@@ -476,6 +471,10 @@ private void SupplyHeaderByWorkItem(UseTempRequest request, SecondResponse resul
...
@@ -476,6 +471,10 @@ private void SupplyHeaderByWorkItem(UseTempRequest request, SecondResponse resul
var
headerItems
=
new
List
<
HeadItem
>();
var
headerItems
=
new
List
<
HeadItem
>();
var
unit
=
second
.
UnitType
==
UnitType
.
医技组
.
ToString
()
?
UnitType
.
医生组
.
ToString
()
:
second
.
UnitType
;
var
deptHeader
=
perforAgworkloadtypeRepository
.
GetEntities
(
t
=>
request
.
HospitalId
==
t
.
HospitalId
&&
t
.
Department
==
second
.
Department
&&
t
.
UnitType
==
unit
);
if
(
deptHeader
!=
null
&&
deptHeader
.
Any
())
{
int
sortindex
=
1
;
int
sortindex
=
1
;
foreach
(
var
item
in
deptHeader
)
foreach
(
var
item
in
deptHeader
)
{
{
...
@@ -494,6 +493,7 @@ private void SupplyHeaderByWorkItem(UseTempRequest request, SecondResponse resul
...
@@ -494,6 +493,7 @@ private void SupplyHeaderByWorkItem(UseTempRequest request, SecondResponse resul
sortindex
++;
sortindex
++;
}
}
}
}
}
var
defauleHeader
=
new
List
<
ag_workload_type
>
var
defauleHeader
=
new
List
<
ag_workload_type
>
{
{
new
ag_workload_type
{
Id
=
2
,
TypeName
=
"工作量绩效占比"
,
},
new
ag_workload_type
{
Id
=
2
,
TypeName
=
"工作量绩效占比"
,
},
...
@@ -521,6 +521,8 @@ private void SupplyHeaderByWorkItem(UseTempRequest request, SecondResponse resul
...
@@ -521,6 +521,8 @@ private void SupplyHeaderByWorkItem(UseTempRequest request, SecondResponse resul
result
.
HeadItems
.
Add
(
item
);
result
.
HeadItems
.
Add
(
item
);
var
body
=
Mapper
.
Map
<
BodyItem
>(
item
);
var
body
=
Mapper
.
Map
<
BodyItem
>(
item
);
body
.
RowNumber
=
rownumber
;
body
.
RowNumber
=
rownumber
;
if
(
fixatitems
!=
null
&&
fixatitems
.
Any
(
t
=>
t
.
ItemName
==
item
.
FiledName
))
body
.
Value
=
fixatitems
.
FirstOrDefault
(
t
=>
t
.
ItemName
==
item
.
FiledName
).
ItemValue
;
result
.
BodyItems
.
Add
(
body
);
result
.
BodyItems
.
Add
(
body
);
}
}
}
}
...
@@ -538,51 +540,82 @@ public bool SaveValue(List<ag_fixatitem> request)
...
@@ -538,51 +540,82 @@ public bool SaveValue(List<ag_fixatitem> request)
var
second
=
perforAgsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
var
second
=
perforAgsecondallotRepository
.
GetEntity
(
t
=>
t
.
Id
==
secondId
);
if
(
second
==
null
)
if
(
second
==
null
)
throw
new
PerformanceException
(
"二次绩效ID不存在"
);
throw
new
PerformanceException
(
"二次绩效ID不存在"
);
var
fixatitems
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
var
fixatitems
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
var
result
=
DelValue
(
fixatitems
,
request
);
List
<
ag_fixatitem
>
update
=
new
List
<
ag_fixatitem
>(),
insert
=
new
List
<
ag_fixatitem
>();
if
(
fixatitems
!=
null
&&
fixatitems
.
Any
())
{
foreach
(
var
item
in
request
)
foreach
(
var
item
in
request
)
{
{
if
(
fixatitems
!=
null
&&
fixatitems
.
Any
(
t
=>
t
.
SecondId
==
secondId
&&
t
.
RowNumber
==
item
.
RowNumber
&&
t
.
ItemName
==
item
.
ItemName
))
if
(
fixatitems
.
Any
(
t
=>
t
.
RowNumber
==
item
.
RowNumber
&&
t
.
ItemName
==
item
.
ItemName
))
{
{
var
cellItem
=
fixatitems
.
First
(
t
=>
t
.
SecondId
==
secondId
&&
t
.
RowNumber
==
item
.
RowNumber
&&
t
.
ItemName
==
item
.
ItemName
);
var
cellItem
=
fixatitems
.
FirstOrDefault
(
t
=>
t
.
RowNumber
==
item
.
RowNumber
&&
t
.
ItemName
==
item
.
ItemName
);
if
(
cellItem
==
null
)
continue
;
cellItem
.
ItemValue
=
item
.
ItemValue
;
cellItem
.
ItemValue
=
item
.
ItemValue
;
cellItem
.
Sort
=
item
.
Sort
;
cellItem
.
Sort
=
item
.
Sort
;
cellItem
.
SourceType
=
item
.
SourceType
;
cellItem
.
SourceType
=
item
.
SourceType
;
cellItem
.
Type
=
item
.
Type
;
cellItem
.
Type
=
item
.
Type
;
cellItem
.
UnitType
=
item
.
UnitType
;
cellItem
.
UnitType
=
item
.
UnitType
;
cellItem
.
SpecialAttr
=
item
.
SpecialAttr
;
cellItem
.
SpecialAttr
=
item
.
SpecialAttr
;
perforAgfixatitemRepository
.
Update
(
cellItem
);
update
.
Add
(
cellItem
);
}
}
else
else
{
{
perforAgfixatitemRepository
.
Add
(
item
);
insert
.
Add
(
item
);
}
}
}
}
}
return
DelValue
(
second
.
Id
,
request
);
else
insert
=
request
;
result
=
perforAgfixatitemRepository
.
UpdateRange
(
update
.
ToArray
());
result
=
perforAgfixatitemRepository
.
AddRange
(
insert
.
ToArray
());
return
result
;
}
}
/// <summary>
/// <summary>
/// 删除未保存的历史数据
/// 删除未保存的历史数据
/// </summary>
/// </summary>
/// <param name="
secondId">
</param>
/// <param name="
fixatlist">数据库中查询到的值
</param>
/// <param name="fixatitems"></param>
/// <param name="fixatitems">
需要保存的数据
</param>
/// <returns></returns>
/// <returns></returns>
public
bool
DelValue
(
int
secondId
,
List
<
ag_fixatitem
>
fixatitems
)
public
bool
DelValue
(
List
<
ag_fixatitem
>
fixatlist
,
List
<
ag_fixatitem
>
fixatitems
)
{
{
if
(
secondId
==
0
)
var
result
=
true
;
throw
new
PerformanceException
(
"二次绩效Id无效"
);
// 提交数据为空时,删除所有数据
var
fixatlist
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
if
(
fixatitems
==
null
||
fixatitems
.
Count
==
0
)
if
(
fixatitems
==
null
||
fixatitems
.
Count
==
0
)
{
{
return
perforAgfixatitemRepository
.
RemoveRange
(
fixatlist
.
ToArray
());
if
(
fixatlist
!=
null
&&
fixatlist
.
Any
())
result
=
perforAgfixatitemRepository
.
RemoveRange
(
fixatlist
.
ToArray
());
return
result
;
}
if
(
fixatlist
!=
null
&&
fixatlist
.
Any
())
{
var
groupData
=
fixatlist
.
GroupBy
(
t
=>
new
{
t
.
RowNumber
,
t
.
ItemName
}).
Select
(
t
=>
new
{
t
.
Key
.
RowNumber
,
t
.
Key
.
ItemName
,
Count
=
t
.
Count
(),
Id
=
t
.
Max
(
group
=>
group
.
ID
)
});
// 删除重复数据
if
(
groupData
.
Any
(
t
=>
t
.
Count
>
1
))
{
var
delData
=
fixatlist
.
Where
(
t
=>
!
groupData
.
Select
(
w
=>
w
.
Id
).
Contains
(
t
.
ID
));
int
flag
=
fixatlist
.
RemoveAll
(
t
=>
!
groupData
.
Select
(
w
=>
w
.
Id
).
Contains
(
t
.
ID
));
result
=
perforAgfixatitemRepository
.
RemoveRange
(
delData
.
ToArray
());
}
}
// 删除行号不存在的数据
var
saveRows
=
fixatitems
.
Select
(
t
=>
t
.
RowNumber
).
Distinct
();
var
saveRows
=
fixatitems
.
Select
(
t
=>
t
.
RowNumber
).
Distinct
();
var
delRows
=
fixatlist
.
Select
(
t
=>
t
.
RowNumber
).
Distinct
().
Except
(
saveRows
);
var
delRows
=
fixatlist
.
Select
(
t
=>
t
.
RowNumber
).
Distinct
().
Except
(
saveRows
);
if
(
delRows
!=
null
&&
delRows
.
Count
()
>
0
)
if
(
delRows
!=
null
&&
delRows
.
Count
()
>
0
)
return
perforAgfixatitemRepository
.
RemoveRange
(
fixatlist
.
Where
(
t
=>
delRows
.
Contains
(
t
.
RowNumber
)).
ToArray
());
result
=
perforAgfixatitemRepository
.
RemoveRange
(
fixatlist
.
Where
(
t
=>
delRows
.
Contains
(
t
.
RowNumber
)).
ToArray
());
}
return
true
;
return
result
;
}
}
/// <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