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
b7bcc7c8
Commit
b7bcc7c8
authored
Oct 30, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二次绩效选择模板时,删除无用数据,绩效归档时,数据显示根据录入数据的列显示
parent
615e4e1b
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
146 additions
and
13 deletions
+146
-13
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
+6
-0
performance/Performance.DtoModels/AutoMapper/AutoMapperConfigs.cs
+2
-0
performance/Performance.DtoModels/Request/UseTempRequest.cs
+3
-0
performance/Performance.DtoModels/Response/SecondListResponse.cs
+13
-0
performance/Performance.Infrastructure/Extensions/Extensions.Linq.cs
+52
-0
performance/Performance.Services/AllotService.cs
+14
-10
performance/Performance.Services/SecondAllotService.cs
+56
-3
No files found.
performance/Performance.Api/wwwroot/Performance.DtoModels.xml
View file @
b7bcc7c8
...
...
@@ -1514,6 +1514,9 @@
用户科室
</summary>
</member>
<member
name=
"P:Performance.DtoModels.UseTempRequest.IsArchive"
>
<summary>
是否归档
</summary>
</member>
<member
name=
"P:Performance.DtoModels.WorkItemRequest.Item"
>
<summary>
工作量绩效项
...
...
@@ -2100,6 +2103,9 @@
菜单状态 1 启用 2禁用
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SecondListResponse.IsArchive"
>
<summary>
是否归档
</summary>
</member>
<member
name=
"P:Performance.DtoModels.SecondTempResponse.TempName"
>
<summary>
模板名称
...
...
performance/Performance.DtoModels/AutoMapper/AutoMapperConfigs.cs
View file @
b7bcc7c8
...
...
@@ -191,6 +191,8 @@ public AutoMapperConfigs()
.
ForMember
(
dest
=>
dest
.
FiledName
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
ItemName
))
.
ForMember
(
dest
=>
dest
.
Value
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
ItemValue
));
CreateMap
<
ag_temp
,
SecondTempResponse
>();
CreateMap
<
ag_secondallot
,
SecondListResponse
>().
ReverseMap
();
}
}
}
performance/Performance.DtoModels/Request/UseTempRequest.cs
View file @
b7bcc7c8
...
...
@@ -16,6 +16,9 @@ public class UseTempRequest
public
string
UnitType
{
get
;
set
;
}
public
int
SecondId
{
get
;
set
;
}
/// <summary> 是否归档 </summary>
public
int
IsArchive
{
get
;
set
;
}
}
public
class
UseTempRequestValidator
:
AbstractValidator
<
UseTempRequest
>
{
...
...
performance/Performance.DtoModels/Response/SecondListResponse.cs
0 → 100644
View file @
b7bcc7c8
using
Performance.EntityModels
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
SecondListResponse
:
ag_secondallot
{
/// <summary> 是否归档 </summary>
public
int
IsArchive
{
get
;
set
;
}
}
}
performance/Performance.Infrastructure/Extensions/Extensions.Linq.cs
0 → 100644
View file @
b7bcc7c8
using
System
;
using
System.Collections.Generic
;
using
System.Linq.Expressions
;
using
System.Text
;
public
static
partial
class
UtilExtensions
{
public
static
Expression
<
Func
<
T
,
bool
>>
And
<
T
>(
this
Expression
<
Func
<
T
,
bool
>>
first
,
Expression
<
Func
<
T
,
bool
>>
second
)
{
return
first
.
AndAlso
<
T
>(
second
,
Expression
.
AndAlso
);
}
public
static
Expression
<
Func
<
T
,
bool
>>
Or
<
T
>(
this
Expression
<
Func
<
T
,
bool
>>
first
,
Expression
<
Func
<
T
,
bool
>>
second
)
{
return
first
.
AndAlso
<
T
>(
second
,
Expression
.
OrElse
);
}
private
static
Expression
<
Func
<
T
,
bool
>>
AndAlso
<
T
>(
this
Expression
<
Func
<
T
,
bool
>>
expr1
,
Expression
<
Func
<
T
,
bool
>>
expr2
,
Func
<
Expression
,
Expression
,
BinaryExpression
>
func
)
{
var
parameter
=
Expression
.
Parameter
(
typeof
(
T
));
var
leftVisitor
=
new
ReplaceExpressionVisitor
(
expr1
.
Parameters
[
0
],
parameter
);
var
left
=
leftVisitor
.
Visit
(
expr1
.
Body
);
var
rightVisitor
=
new
ReplaceExpressionVisitor
(
expr2
.
Parameters
[
0
],
parameter
);
var
right
=
rightVisitor
.
Visit
(
expr2
.
Body
);
return
Expression
.
Lambda
<
Func
<
T
,
bool
>>(
func
(
left
,
right
),
parameter
);
}
private
class
ReplaceExpressionVisitor
:
ExpressionVisitor
{
private
readonly
Expression
_oldValue
;
private
readonly
Expression
_newValue
;
public
ReplaceExpressionVisitor
(
Expression
oldValue
,
Expression
newValue
)
{
_oldValue
=
oldValue
;
_newValue
=
newValue
;
}
public
override
Expression
Visit
(
Expression
node
)
{
if
(
node
==
_oldValue
)
return
_newValue
;
return
base
.
Visit
(
node
);
}
}
}
\ No newline at end of file
performance/Performance.Services/AllotService.cs
View file @
b7bcc7c8
...
...
@@ -353,16 +353,20 @@ public void Pigeonhole(per_allot allot)
{
allot
.
States
=
8
;
allot
.
Remark
=
"归档"
;
if
(
_allotRepository
.
Update
(
allot
))
{
var
again
=
_againallotRepository
.
GetEntities
(
t
=>
t
.
AllotID
==
allot
.
ID
);
foreach
(
var
item
in
again
)
{
item
.
Remark
=
$"原状态:
{
item
.
States
}
,归档更改状态"
;
item
.
States
=
5
;
_againallotRepository
.
Update
(
item
);
}
}
_allotRepository
.
Update
(
allot
);
//if (_allotRepository.Update(allot))
//{
// var again = _againallotRepository.GetEntities(t => t.AllotID == allot.ID);
// if (again != null && again.Count > 0)
// {
// foreach (var item in again)
// {
// item.Remark = $"原状态:{item.States},归档更改状态";
// item.States = 5;
// _againallotRepository.Update(item);
// }
// }
//}
}
/// <summary>
...
...
performance/Performance.Services/SecondAllotService.cs
View file @
b7bcc7c8
...
...
@@ -7,6 +7,7 @@
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Text
;
namespace
Performance.Services
...
...
@@ -64,7 +65,7 @@ public class SecondAllotService : IAutoInjection
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public
List
<
ag_secondallot
>
GetSecondList
(
int
userId
)
public
List
<
SecondListResponse
>
GetSecondList
(
int
userId
)
{
var
user
=
perforUserRepository
.
GetEntity
(
t
=>
t
.
ID
==
userId
);
if
(
user
==
null
)
...
...
@@ -73,7 +74,7 @@ public List<ag_secondallot> GetSecondList(int userId)
var
hospital
=
perforUserhospitalRepository
.
GetEntity
(
t
=>
t
.
UserID
==
userId
);
if
(
hospital
==
null
)
throw
new
NotImplementedException
(
"人员未选择医院"
);
var
allotList
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
.
HospitalID
&&
t
.
States
==
6
);
var
allotList
=
perforPerallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospital
.
HospitalID
&&
new
List
<
int
>
{
6
,
8
}.
Contains
(
t
.
States
)
);
if
(
allotList
==
null
||
allotList
.
Count
==
0
)
throw
new
NotImplementedException
(
"该医院未生成绩效"
);
...
...
@@ -121,7 +122,9 @@ public List<ag_secondallot> GetSecondList(int userId)
secondList
.
AddRange
(
newSecond
);
}
return
secondList
;
var
list
=
Mapper
.
Map
<
List
<
SecondListResponse
>>(
secondList
);
list
?.
ForEach
(
t
=>
t
.
IsArchive
=
allotList
.
FirstOrDefault
(
a
=>
a
.
ID
==
t
.
AllotId
).
States
==
8
?
1
:
0
);
return
list
;
}
/// <summary>
...
...
@@ -164,6 +167,37 @@ public bool UseTemp(UseTempRequest request)
{
entity
.
UseTempId
=
request
.
TempId
;
result
=
perforAgusetempRepository
.
Update
(
entity
);
//删除多余的数据
if
(
result
)
{
//获取固定模板列头
var
tempItem
=
perforAgtempitemRepository
.
GetEntities
(
t
=>
t
.
TempId
==
request
.
TempId
);
var
headItems
=
Mapper
.
Map
<
List
<
HeadItem
>>(
tempItem
)
??
new
List
<
HeadItem
>();
//获取工作量列头
var
workItem
=
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
Department
==
request
.
Department
&&
t
.
UnitType
==
request
.
UnitType
);
if
(
workItem
!=
null
&&
workItem
.
Count
>
0
)
{
var
workDtos
=
Mapper
.
Map
<
List
<
HeadItem
>>(
workItem
);
workDtos
.
ForEach
(
t
=>
{
t
.
Type
=
3
;
});
headItems
.
AddRange
(
workDtos
);
}
List
<
ag_fixatitem
>
list
=
new
List
<
ag_fixatitem
>();
//获取数据
var
fixatList
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
request
.
SecondId
);
foreach
(
var
item
in
headItems
)
{
list
.
AddRange
(
fixatList
.
Where
(
t
=>
t
.
ItemName
==
item
.
FiledName
&&
t
.
Type
==
item
.
Type
));
}
if
(
list
!=
null
&&
list
.
Count
>
0
)
{
var
delList
=
fixatList
.
Except
(
list
);
perforAgfixatitemRepository
.
RemoveRange
(
delList
.
ToArray
());
}
}
}
return
result
;
}
...
...
@@ -382,6 +416,25 @@ public SecondResponse GetSecondDetail(UseTempRequest request)
var
result
=
new
SecondResponse
{
HeadItems
=
headItems
,
BodyItems
=
new
List
<
BodyItem
>()
};
//获取数据
var
fixatList
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
request
.
SecondId
&&
t
.
RowNumber
.
HasValue
);
if
(
request
.
IsArchive
==
1
)
{
if
(
fixatList
==
null
||
fixatList
.
Count
==
0
)
throw
new
PerformanceException
(
"绩效归档时,尚未添加数据。"
);
else
{
var
existHead
=
fixatList
.
Select
(
t
=>
new
{
FiledName
=
t
.
ItemName
,
Sort
=
t
.
Sort
.
Value
,
SourceType
=
t
.
SourceType
.
Value
,
Type
=
t
.
Type
.
Value
,
FactorValue
=
t
.
FactorValue
.
Value
}).
Distinct
().
ToList
();
headItems
=
existHead
.
Select
(
t
=>
new
HeadItem
{
FiledId
=
headItems
.
FirstOrDefault
(
h
=>
h
.
FiledName
==
t
.
FiledName
&&
h
.
Type
==
t
.
Type
)?.
FiledId
??
"无FiledId"
,
FiledName
=
t
.
FiledName
,
Sort
=
t
.
Sort
,
SourceType
=
t
.
SourceType
,
Type
=
t
.
Type
,
FactorValue
=
t
.
FactorValue
}).
Where
(
t
=>
t
.
FiledId
!=
"无FiledId"
).
ToList
();
}
}
if
(
fixatList
!=
null
&&
fixatList
.
Count
>
0
)
{
//补充数据
...
...
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