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
8aa99249
Commit
8aa99249
authored
Mar 31, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二次绩效保存数据时,删除历史数据方式修改;获取二次绩效详情时,重复数据分组过滤获取id最大的数据
parent
dd75a307
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
28 deletions
+66
-28
performance/Performance.Services/Details/SecondAllotDetails.cs
+9
-2
performance/Performance.Services/SecondAllotService.cs
+57
-26
No files found.
performance/Performance.Services/Details/SecondAllotDetails.cs
View file @
8aa99249
...
@@ -98,8 +98,11 @@ public SecondResponse GetSecondDetails(int userId, int secondId, int hospitalId,
...
@@ -98,8 +98,11 @@ public SecondResponse GetSecondDetails(int userId, int secondId, int hospitalId,
if
(
isArchive
==
1
||
new
List
<
int
>
{
(
int
)
SecondAllotStatus
.
WaitReview
,
(
int
)
SecondAllotStatus
.
PassAudit
}.
Contains
(
secondAllot
.
Status
??
(
int
)
SecondAllotStatus
.
Uncommitted
))
if
(
isArchive
==
1
||
new
List
<
int
>
{
(
int
)
SecondAllotStatus
.
WaitReview
,
(
int
)
SecondAllotStatus
.
PassAudit
}.
Contains
(
secondAllot
.
Status
??
(
int
)
SecondAllotStatus
.
Uncommitted
))
employeeSource
=
(
int
)
EmployeeSource
.
Initial
;
employeeSource
=
(
int
)
EmployeeSource
.
Initial
;
// 历史保存过的数据
// 历史保存过的数据
,groupby取最后的一条记录,避免重复数据,在同一rownumber中itemname重复会导致数据丢失
var
savedDataList
=
agfixatitemRepository
.
GetEntities
(
w
=>
w
.
SecondId
==
secondAllot
.
Id
);
var
savedDataList
=
agfixatitemRepository
.
GetEntities
(
w
=>
w
.
SecondId
==
secondAllot
.
Id
);
if
(
savedDataList
!=
null
&&
savedDataList
.
Any
())
savedDataList
=
savedDataList
.
GroupBy
(
t
=>
new
{
t
.
RowNumber
,
t
.
ItemName
,
t
.
Sort
})
.
Select
(
t
=>
t
.
OrderByDescending
(
o
=>
o
.
ID
).
FirstOrDefault
()).
ToList
();
var
header
=
GetHeadItems
(
hospitalId
,
tempId
,
secondAllot
);
var
header
=
GetHeadItems
(
hospitalId
,
tempId
,
secondAllot
);
...
@@ -219,7 +222,7 @@ public List<BodyItem> GetBodyItems(int userId, int employeeSource, ag_secondallo
...
@@ -219,7 +222,7 @@ public List<BodyItem> GetBodyItems(int userId, int employeeSource, ag_secondallo
case
(
int
)
EmployeeSource
.
EmployeeDict
:
case
(
int
)
EmployeeSource
.
EmployeeDict
:
return
GetEmployeeFromEmployeeDict
(
userId
,
secondAllot
,
otherShowColumns
);
return
GetEmployeeFromEmployeeDict
(
userId
,
secondAllot
,
otherShowColumns
);
case
(
int
)
EmployeeSource
.
PrevSecondAllot
:
case
int
source
when
source
==
(
int
)
EmployeeSource
.
PrevSecondAllot
&&
prevSecondAllot
!=
null
:
return
GetEmployeeFromPrevData
(
userId
,
secondAllot
,
prevSecondAllot
,
otherShowColumns
);
return
GetEmployeeFromPrevData
(
userId
,
secondAllot
,
prevSecondAllot
,
otherShowColumns
);
default
:
default
:
...
@@ -334,6 +337,10 @@ public List<BodyItem> GetEmployeeFromPrevData(int userId, ag_secondallot secondA
...
@@ -334,6 +337,10 @@ public List<BodyItem> GetEmployeeFromPrevData(int userId, ag_secondallot secondA
var
savedDataList
=
agfixatitemRepository
.
GetEntities
(
w
=>
w
.
SecondId
==
prevSecondAllot
.
Id
&&
w
.
RowNumber
.
HasValue
&&
w
.
RowNumber
>
-
1
);
var
savedDataList
=
agfixatitemRepository
.
GetEntities
(
w
=>
w
.
SecondId
==
prevSecondAllot
.
Id
&&
w
.
RowNumber
.
HasValue
&&
w
.
RowNumber
>
-
1
);
if
(
savedDataList
==
null
||
!
savedDataList
.
Any
())
return
tableFixedDataList
;
if
(
savedDataList
==
null
||
!
savedDataList
.
Any
())
return
tableFixedDataList
;
// groupby取最后的一条记录,避免重复数据
savedDataList
=
savedDataList
.
GroupBy
(
t
=>
new
{
t
.
RowNumber
,
t
.
ItemName
,
t
.
Sort
})
.
Select
(
t
=>
t
.
OrderByDescending
(
o
=>
o
.
ID
).
FirstOrDefault
()).
ToList
();
var
employeeList
=
personService
.
GetPersons
(
secondAllot
.
AllotId
.
Value
,
userId
);
var
employeeList
=
personService
.
GetPersons
(
secondAllot
.
AllotId
.
Value
,
userId
);
var
employeeColumns
=
new
List
<
Tuple
<
string
,
string
>>
var
employeeColumns
=
new
List
<
Tuple
<
string
,
string
>>
{
{
...
...
performance/Performance.Services/SecondAllotService.cs
View file @
8aa99249
...
@@ -689,33 +689,45 @@ public bool SaveValue(List<ag_fixatitem> request, int secondId)
...
@@ -689,33 +689,45 @@ public bool SaveValue(List<ag_fixatitem> request, int secondId)
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
(
secondId
,
fixatitems
,
request
);
List
<
ag_fixatitem
>
update
=
new
List
<
ag_fixatitem
>(),
insert
=
new
List
<
ag_fixatitem
>();
#
region
old
//var result = DelValue(secondId, 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.Where(w => !string.IsNullOrEmpty(w.ItemName)))
// {
// var cellItem = fixatitems.FirstOrDefault(t => t.RowNumber == item.RowNumber && t.ItemName == item.ItemName);
// if (cellItem != null)
// {
// cellItem.ItemValue = item.ItemValue;
// cellItem.Sort = item.Sort;
// cellItem.SourceType = item.SourceType;
// cellItem.Type = item.Type;
// cellItem.UnitType = item.UnitType;
// cellItem.SpecialAttr = item.SpecialAttr;
// update.Add(cellItem);
// }
// else
// {
// insert.Add(item);
// }
// }
//}
//else
// insert = request;
//result = perforAgfixatitemRepository.UpdateRange(update.ToArray());
//result = perforAgfixatitemRepository.AddRange(insert.ToArray());
#
endregion
bool
result
=
false
;
if
(
fixatitems
!=
null
&&
fixatitems
.
Any
())
if
(
fixatitems
!=
null
&&
fixatitems
.
Any
())
{
result
=
perforAgfixatitemRepository
.
RemoveRange
(
fixatitems
.
ToArray
());
foreach
(
var
item
in
request
.
Where
(
w
=>
!
string
.
IsNullOrEmpty
(
w
.
ItemName
)))
{
result
=
perforAgfixatitemRepository
.
AddRange
(
request
.
ToArray
());
var
cellItem
=
fixatitems
.
FirstOrDefault
(
t
=>
t
.
RowNumber
==
item
.
RowNumber
&&
t
.
ItemName
==
item
.
ItemName
);
if
(
cellItem
!=
null
)
{
cellItem
.
ItemValue
=
item
.
ItemValue
;
cellItem
.
Sort
=
item
.
Sort
;
cellItem
.
SourceType
=
item
.
SourceType
;
cellItem
.
Type
=
item
.
Type
;
cellItem
.
UnitType
=
item
.
UnitType
;
cellItem
.
SpecialAttr
=
item
.
SpecialAttr
;
update
.
Add
(
cellItem
);
}
else
{
insert
.
Add
(
item
);
}
}
}
else
insert
=
request
;
result
=
perforAgfixatitemRepository
.
UpdateRange
(
update
.
ToArray
());
result
=
perforAgfixatitemRepository
.
AddRange
(
insert
.
ToArray
());
return
result
;
return
result
;
}
}
...
@@ -1272,17 +1284,36 @@ public bool AuditSubmit(ag_secondallot second, int userId)
...
@@ -1272,17 +1284,36 @@ public bool AuditSubmit(ag_secondallot second, int userId)
var
temp
=
perforAgusetempRepository
.
GetEntity
(
exp
);
var
temp
=
perforAgusetempRepository
.
GetEntity
(
exp
);
if
(
temp
==
null
)
if
(
temp
==
null
)
throw
new
PerformanceException
(
"选择模板不可用,请确定模板及数据是否存在!"
);
throw
new
PerformanceException
(
"选择模板不可用,请确定模板及数据是否存在!"
);
bool
method
(
decimal
?
submitDataAmount
,
decimal
?
realGiveFee
)
{
if
(!
submitDataAmount
.
HasValue
||
!
realGiveFee
.
HasValue
)
return
false
;
decimal
floatValue
=
0.5
m
;
return
submitDataAmount
>=
(
realGiveFee
-
floatValue
)
&&
submitDataAmount
<=
(
realGiveFee
+
floatValue
);
}
if
(
temp
.
UseTempId
==
6
)
if
(
temp
.
UseTempId
==
6
)
{
{
var
data
=
perforAgothersourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
second
.
Id
);
var
data
=
perforAgothersourceRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
second
.
Id
);
if
(
data
==
null
||
!
data
.
Any
())
if
(
data
==
null
||
!
data
.
Any
())
throw
new
PerformanceException
(
"提交时未检测到数据!"
);
throw
new
PerformanceException
(
"提交时未检测到数据!"
);
var
total
=
data
.
Sum
(
t
=>
t
.
RealAmount
);
if
(!
method
(
total
,
second
.
RealGiveFee
))
throw
new
PerformanceException
(
"总金额与考核后金额不一致!"
);
}
}
else
else
{
{
var
data
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
second
.
Id
);
var
data
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
second
.
Id
);
if
(
data
==
null
||
!
data
.
Any
())
if
(
data
==
null
||
!
data
.
Any
())
throw
new
PerformanceException
(
"提交时未检测到数据!"
);
throw
new
PerformanceException
(
"提交时未检测到数据!"
);
var
total
=
data
.
Where
(
t
=>
t
.
ItemName
==
"实发绩效工资金额"
&&
t
.
RowNumber
>
-
1
).
GroupBy
(
t
=>
t
.
RowNumber
)
.
Sum
(
t
=>
ConvertHelper
.
To
<
decimal
>(
t
.
OrderByDescending
(
o
=>
o
.
ID
).
FirstOrDefault
().
ItemValue
));
if
(!
method
(
total
,
second
.
RealGiveFee
))
throw
new
PerformanceException
(
"总金额与考核后金额不一致!"
);
}
}
second
.
UseTempId
=
temp
.
UseTempId
;
second
.
UseTempId
=
temp
.
UseTempId
;
second
.
Status
=
2
;
second
.
Status
=
2
;
...
...
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