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
01b058a9
Commit
01b058a9
authored
Oct 11, 2019
by
李承祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二次绩效workload修改
parent
9161b581
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
180 additions
and
23 deletions
+180
-23
performance/Performance.DtoModels/AutoMapper/AutoMapperConfigs.cs
+4
-0
performance/Performance.DtoModels/Request/FixatItemRequest.cs
+48
-0
performance/Performance.DtoModels/Request/UseTempRequest.cs
+6
-0
performance/Performance.DtoModels/Request/WorkloadRequest.cs
+17
-9
performance/Performance.EntityModels/Entity/ag_fixatitem.cs
+5
-0
performance/Performance.Services/SecondAllotService.cs
+100
-14
No files found.
performance/Performance.DtoModels/AutoMapper/AutoMapperConfigs.cs
View file @
01b058a9
...
...
@@ -178,6 +178,10 @@ public AutoMapperConfigs()
CreateMap
<
res_compute
,
ComputeResponse
>();
CreateMap
<
EmployeeRequest
,
im_employee
>();
CreateMap
<
res_compute
,
ResComputeResponse
>();
CreateMap
<
UseTempRequest
,
ag_usetemp
>()
.
ForMember
(
dest
=>
dest
.
UseTempId
,
opt
=>
opt
.
MapFrom
(
src
=>
src
.
TempId
))
.
ReverseMap
();
}
}
}
performance/Performance.DtoModels/Request/FixatItemRequest.cs
0 → 100644
View file @
01b058a9
using
FluentValidation
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
FixatItemRequest
{
public
int
AllotId
{
get
;
set
;
}
public
int
SecondId
{
get
;
set
;
}
public
string
UnitType
{
get
;
set
;
}
public
List
<
FixatItem
>
FixatItems
{
get
;
set
;
}
public
int
RowNumber
{
get
;
set
;
}
}
public
class
FixatItemRequestValidator
:
AbstractValidator
<
FixatItemRequest
>
{
public
FixatItemRequestValidator
()
{
RuleFor
(
x
=>
x
.
AllotId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
SecondId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
UnitType
).
NotNull
().
NotEmpty
();
}
}
public
class
FixatItem
{
public
int
FixatId
{
get
;
set
;
}
public
string
ItemName
{
get
;
set
;
}
public
decimal
ItemValue
{
get
;
set
;
}
public
decimal
FactorValue
{
get
;
set
;
}
public
decimal
Sort
{
get
;
set
;
}
public
int
Type
{
get
;
set
;
}
public
int
SourceType
{
get
;
set
;
}
}
}
performance/Performance.DtoModels/Request/UseTempRequest.cs
View file @
01b058a9
...
...
@@ -8,6 +8,12 @@ namespace Performance.DtoModels
public
class
UseTempRequest
{
public
int
TempId
{
get
;
set
;
}
public
int
HospitalId
{
get
;
set
;
}
public
string
Department
{
get
;
set
;
}
public
string
UnitType
{
get
;
set
;
}
}
public
class
UseTempRequestValidator
:
AbstractValidator
<
UseTempRequest
>
{
...
...
performance/Performance.DtoModels/Request/WorkloadRequest.cs
View file @
01b058a9
...
...
@@ -11,15 +11,21 @@ public class WorkloadRequest
/// 绩效ID
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 绩效ID
/// 医院ID
/// </summary>
public
Nullable
<
int
>
HospitalId
{
get
;
set
;
}
/// <summary>
/// 科室
/// </summary>
public
int
AllotId
{
get
;
set
;
}
public
string
Department
{
get
;
set
;
}
/// <summary>
///
二次绩效ID
///
/// </summary>
public
int
SecondId
{
get
;
set
;
}
public
string
UnitType
{
get
;
set
;
}
/// <summary>
/// 工作量名称
...
...
@@ -42,16 +48,16 @@ public WorkloadRequestValidator()
{
RuleSet
(
"Add"
,
()
=>
{
RuleFor
(
x
=>
x
.
AllotId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
SecondId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
HospitalId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
Department
).
NotNull
().
NotEmpty
();
RuleFor
(
x
=>
x
.
UnitType
).
NotNull
().
NotEmpty
();
RuleFor
(
x
=>
x
.
ItemName
).
NotNull
().
NotEmpty
();
});
RuleSet
(
"Update"
,
()
=>
{
RuleFor
(
x
=>
x
.
Id
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
AllotId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
SecondId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
HospitalId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
ItemName
).
NotNull
().
NotEmpty
();
});
...
...
@@ -61,7 +67,9 @@ public WorkloadRequestValidator()
});
RuleSet
(
"Query"
,
()
=>
{
RuleFor
(
x
=>
x
.
SecondId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
HospitalId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
Department
).
NotNull
().
NotEmpty
();
RuleFor
(
x
=>
x
.
UnitType
).
NotNull
().
NotEmpty
();
});
}
}
...
...
performance/Performance.EntityModels/Entity/ag_fixatitem.cs
View file @
01b058a9
...
...
@@ -37,6 +37,11 @@ public class ag_fixatitem
public
string
UnitType
{
get
;
set
;
}
/// <summary>
/// 行号
/// </summary>
public
Nullable
<
int
>
RowNumber
{
get
;
set
;
}
/// <summary>
/// 项目名
/// </summary>
public
string
ItemName
{
get
;
set
;
}
...
...
performance/Performance.Services/SecondAllotService.cs
View file @
01b058a9
using
Microsoft.Extensions.Options
;
using
AutoMapper
;
using
Microsoft.Extensions.Options
;
using
Performance.DtoModels
;
using
Performance.DtoModels.AppSettings
;
using
Performance.EntityModels
;
...
...
@@ -22,6 +23,8 @@ public class SecondAllotService : IAutoInjection
private
readonly
PerforAgworkloadRepository
perforAgworkloadRepository
;
private
readonly
PerforAgtempRepository
perforAgtempRepository
;
private
readonly
PerforAgtempitemRepository
perforAgtempitemRepository
;
private
readonly
PerforAgfixatitemRepository
perforAgfixatitemRepository
;
private
readonly
PerforAgusetempRepository
perforAgusetempRepository
;
public
SecondAllotService
(
IOptions
<
Application
>
application
,
PerforUserRepository
perforUserRepository
,
...
...
@@ -32,7 +35,9 @@ public class SecondAllotService : IAutoInjection
PerforUserroleRepository
userroleRepository
,
PerforAgworkloadRepository
perforAgworkloadRepository
,
PerforAgtempRepository
perforAgtempRepository
,
PerforAgtempitemRepository
perforAgtempitemRepository
)
PerforAgtempitemRepository
perforAgtempitemRepository
,
PerforAgfixatitemRepository
perforAgfixatitemRepository
,
PerforAgusetempRepository
perforAgusetempRepository
)
{
this
.
application
=
application
.
Value
;
this
.
perforUserRepository
=
perforUserRepository
;
...
...
@@ -44,6 +49,8 @@ public class SecondAllotService : IAutoInjection
this
.
perforAgworkloadRepository
=
perforAgworkloadRepository
;
this
.
perforAgtempRepository
=
perforAgtempRepository
;
this
.
perforAgtempitemRepository
=
perforAgtempitemRepository
;
this
.
perforAgfixatitemRepository
=
perforAgfixatitemRepository
;
this
.
perforAgusetempRepository
=
perforAgusetempRepository
;
}
/// <summary>
...
...
@@ -121,12 +128,32 @@ public List<ag_temp> GetTemp(int userId)
return
perforAgtempRepository
.
GetEntities
();
}
public
bool
UseTemp
(
int
tempId
)
/// <summary>
/// 使用模板
/// </summary>
/// <param name="tempId"></param>
/// <returns></returns>
public
bool
UseTemp
(
UseTempRequest
request
)
{
var
temp
=
perforAgtempRepository
.
GetEntity
(
t
=>
t
.
Id
==
tempId
);
var
tempItems
=
perforAgtempitemRepository
.
GetEntities
(
t
=>
t
.
TempId
==
tempId
);
var
temp
=
perforAgtempRepository
.
GetEntity
(
t
=>
t
.
Id
==
request
.
TempId
);
if
(
temp
==
null
)
throw
new
PerformanceException
(
"参数tempId 无效"
);
var
entity
=
Mapper
.
Map
<
ag_usetemp
>(
request
);
return
perforAgusetempRepository
.
Add
(
entity
);
}
/// <summary>
/// 应用模板
/// </summary>
/// <returns></returns>
public
void
RefreshTemp
(
int
secondId
)
{
var
fixatList
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
if
(
fixatList
==
null
||
fixatList
.
Count
==
0
)
throw
new
PerformanceException
(
"参数secondId 无效"
);
return
;
}
/// <summary>
...
...
@@ -134,9 +161,9 @@ public bool UseTemp(int tempId)
/// </summary>
/// <param name="secondId"></param>
/// <returns></returns>
public
List
<
ag_workload
>
GetWorkloadList
(
int
secondId
)
public
List
<
ag_workload
>
GetWorkloadList
(
WorkloadRequest
request
)
{
return
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
return
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
Department
==
request
.
Department
&&
t
.
UnitType
==
request
.
Department
);
}
/// <summary>
...
...
@@ -146,15 +173,16 @@ public List<ag_workload> GetWorkloadList(int secondId)
/// <returns></returns>
public
bool
WorkloadAdd
(
WorkloadRequest
request
)
{
var
workloadList
=
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
request
.
SecondId
);
var
workloadList
=
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
Department
==
request
.
Department
&&
t
.
UnitType
==
request
.
Department
);
if
(
workloadList
.
Any
(
t
=>
t
.
ItemName
==
request
.
ItemName
))
throw
new
PerformanceException
(
"项目名称重复"
);
ag_workload
workload
=
new
ag_workload
{
AllotId
=
request
.
AllotId
,
HospitalId
=
request
.
HospitalId
,
Department
=
request
.
Department
,
UnitType
=
request
.
UnitType
,
FactorValue
=
request
.
FactorValue
??
1
,
ItemName
=
request
.
ItemName
,
SecondId
=
request
.
SecondId
,
Sort
=
request
.
Sort
??
1
,
};
var
result
=
perforAgworkloadRepository
.
Add
(
workload
);
...
...
@@ -174,15 +202,16 @@ public bool WorkloadAdd(WorkloadRequest request)
/// <returns></returns>
public
bool
WorkloadUpdate
(
WorkloadRequest
request
)
{
var
workloadList
=
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
request
.
SecondId
);
var
workloadList
=
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
request
.
HospitalId
&&
t
.
Department
==
request
.
Department
&&
t
.
UnitType
==
request
.
Department
);
if
(
workloadList
.
Any
(
t
=>
t
.
Id
!=
request
.
Id
&&
t
.
ItemName
==
request
.
ItemName
))
throw
new
PerformanceException
(
"项目名称重复"
);
var
workload
=
workloadList
.
FirstOrDefault
(
t
=>
t
.
Id
==
request
.
Id
);
workload
.
AllotId
=
request
.
AllotId
;
workload
.
HospitalId
=
request
.
HospitalId
;
workload
.
Department
=
request
.
Department
;
workload
.
UnitType
=
request
.
UnitType
;
workload
.
FactorValue
=
request
.
FactorValue
;
workload
.
ItemName
=
request
.
ItemName
;
workload
.
SecondId
=
request
.
SecondId
;
workload
.
Sort
=
request
.
Sort
;
workload
.
ItemId
=
$"Feild
{
workload
.
Id
}
"
;
...
...
@@ -200,5 +229,62 @@ public bool WorkloadDelete(int id)
return
perforAgworkloadRepository
.
Remove
(
workload
);
}
public
void
GetHeader
()
{
}
public
void
SaveValue
(
FixatItemRequest
request
)
{
if
(
request
.
FixatItems
==
null
||
request
.
FixatItems
.
Count
==
0
)
throw
new
PerformanceException
(
"保存的内容为空"
);
#
region
添加新的值
var
addItem
=
request
.
FixatItems
.
Where
(
t
=>
t
.
FixatId
==
0
).
ToList
();
if
(
addItem
!=
null
&&
addItem
.
Count
()
>
0
)
{
var
newFixat
=
addItem
.
Select
(
t
=>
new
ag_fixatitem
{
AllotId
=
request
.
AllotId
,
SecondId
=
request
.
SecondId
,
UnitType
=
request
.
UnitType
,
RowNumber
=
request
.
RowNumber
,
ItemName
=
t
.
ItemName
,
ItemValue
=
t
.
ItemValue
,
FactorValue
=
t
.
FactorValue
,
Sort
=
t
.
Sort
,
Type
=
t
.
Type
,
SourceType
=
t
.
SourceType
});
if
(
newFixat
!=
null
&&
newFixat
.
Count
()
>
0
)
perforAgfixatitemRepository
.
AddRange
(
newFixat
.
ToArray
());
}
#
endregion
#
region
更新原始值
var
updateItme
=
request
.
FixatItems
.
Where
(
t
=>
t
.
FixatId
>=
0
).
ToList
();
if
(
updateItme
!=
null
&&
updateItme
.
Count
()
>
0
)
{
var
fixatIds
=
updateItme
.
Select
(
t
=>
t
.
FixatId
);
var
oldFixat
=
perforAgfixatitemRepository
.
GetEntities
(
t
=>
fixatIds
.
Contains
(
t
.
Id
));
if
(
oldFixat
!=
null
&&
oldFixat
.
Count
>
0
)
{
oldFixat
.
ForEach
(
t
=>
{
var
fixat
=
updateItme
.
Where
(
s
=>
s
.
FixatId
==
t
.
Id
).
FirstOrDefault
();
t
.
ItemName
=
fixat
.
ItemName
;
t
.
ItemValue
=
fixat
.
ItemValue
;
t
.
FactorValue
=
fixat
.
FactorValue
;
t
.
Sort
=
fixat
.
Sort
;
t
.
Type
=
fixat
.
Type
;
t
.
SourceType
=
fixat
.
SourceType
;
});
perforAgfixatitemRepository
.
AddRange
(
oldFixat
.
ToArray
());
}
}
#
endregion
}
}
}
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