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
f708e889
Commit
f708e889
authored
Oct 09, 2019
by
ruyun.zhang@suvalue.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
临时
parent
b2ccb395
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
294 additions
and
14 deletions
+294
-14
performance/Performance.Api/Controllers/SecondAllotController.cs
+26
-14
performance/Performance.DtoModels/Request/UseTempRequest.cs
+19
-0
performance/Performance.DtoModels/Request/WorkloadRequest.cs
+68
-0
performance/Performance.DtoModels/Response/SecondTempResponse.cs
+10
-0
performance/Performance.Services/SecondAllotService.cs
+171
-0
No files found.
performance/Performance.Api/Controllers/SecondAllotController.cs
View file @
f708e889
using
Microsoft.AspNetCore.Http
;
using
FluentValidation.AspNetCore
;
using
Microsoft.AspNetCore.Http
;
using
Microsoft.AspNetCore.Mvc
;
using
Performance.DtoModels
;
using
Performance.Services
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
...
...
@@ -12,10 +14,13 @@ namespace Performance.Api.Controllers
public
class
SecondAllotController
:
ControllerBase
{
private
readonly
ClaimService
claimService
;
private
readonly
SecondAllotService
secondAllotService
;
public
SecondAllotController
(
ClaimService
claimService
)
public
SecondAllotController
(
ClaimService
claimService
,
SecondAllotService
secondAllotService
)
{
this
.
claimService
=
claimService
;
this
.
secondAllotService
=
secondAllotService
;
}
/// <summary>
...
...
@@ -27,8 +32,8 @@ public SecondAllotController(ClaimService claimService)
public
ApiResponse
List
()
{
var
userId
=
claimService
.
GetUserId
();
return
new
ApiResponse
(
ResponseType
.
OK
);
var
result
=
secondAllotService
.
GetSecondList
(
userId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
/// <summary>
...
...
@@ -59,9 +64,10 @@ public ApiResponse SaveCompute()
/// <returns></returns>
[
Route
(
"api/second/workload/list"
)]
[
HttpPost
]
public
ApiResponse
WorkloadList
()
public
ApiResponse
WorkloadList
(
[
CustomizeValidator
(
RuleSet
=
"Query"
),
FromBody
]
WorkloadRequest
request
)
{
return
new
ApiResponse
(
ResponseType
.
OK
);
var
result
=
secondAllotService
.
GetWorkloadList
(
request
.
SecondId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
/// <summary>
...
...
@@ -70,9 +76,10 @@ public ApiResponse WorkloadList()
/// <returns></returns>
[
Route
(
"api/second/workload/add"
)]
[
HttpPost
]
public
ApiResponse
WorkloadAdd
()
public
ApiResponse
WorkloadAdd
(
[
CustomizeValidator
(
RuleSet
=
"Add"
),
FromBody
]
WorkloadRequest
request
)
{
return
new
ApiResponse
(
ResponseType
.
OK
);
var
result
=
secondAllotService
.
WorkloadAdd
(
request
);
return
new
ApiResponse
(
result
?
ResponseType
.
OK
:
ResponseType
.
Fail
);
}
/// <summary>
...
...
@@ -81,9 +88,10 @@ public ApiResponse WorkloadAdd()
/// <returns></returns>
[
Route
(
"api/second/workload/update"
)]
[
HttpPost
]
public
ApiResponse
WorkloadUpdate
()
public
ApiResponse
WorkloadUpdate
(
[
CustomizeValidator
(
RuleSet
=
"Update"
),
FromBody
]
WorkloadRequest
request
)
{
return
new
ApiResponse
(
ResponseType
.
OK
);
var
result
=
secondAllotService
.
WorkloadUpdate
(
request
);
return
new
ApiResponse
(
result
?
ResponseType
.
OK
:
ResponseType
.
Fail
);
}
/// <summary>
...
...
@@ -92,9 +100,10 @@ public ApiResponse WorkloadUpdate()
/// <returns></returns>
[
Route
(
"api/second/workload/delete"
)]
[
HttpPost
]
public
ApiResponse
WorkloadDelete
()
public
ApiResponse
WorkloadDelete
(
[
CustomizeValidator
(
RuleSet
=
"Delete"
),
FromBody
]
WorkloadRequest
request
)
{
return
new
ApiResponse
(
ResponseType
.
OK
);
var
result
=
secondAllotService
.
WorkloadDelete
(
request
.
SecondId
);
return
new
ApiResponse
(
result
?
ResponseType
.
OK
:
ResponseType
.
Fail
);
}
/// <summary>
...
...
@@ -105,7 +114,9 @@ public ApiResponse WorkloadDelete()
[
HttpPost
]
public
ApiResponse
Temp
()
{
return
new
ApiResponse
(
ResponseType
.
OK
);
var
userId
=
claimService
.
GetUserId
();
var
result
=
secondAllotService
.
GetTemp
(
userId
);
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
}
/// <summary>
...
...
@@ -114,8 +125,9 @@ public ApiResponse Temp()
/// <returns></returns>
[
Route
(
"api/temp/usetemp"
)]
[
HttpPost
]
public
ApiResponse
UseTemp
()
public
ApiResponse
UseTemp
(
UseTempRequest
request
)
{
var
result
=
secondAllotService
.
UseTemp
(
request
.
TempId
);
return
new
ApiResponse
(
ResponseType
.
OK
);
}
...
...
performance/Performance.DtoModels/Request/UseTempRequest.cs
0 → 100644
View file @
f708e889
using
FluentValidation
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
UseTempRequest
{
public
int
TempId
{
get
;
set
;
}
}
public
class
UseTempRequestValidator
:
AbstractValidator
<
UseTempRequest
>
{
public
UseTempRequestValidator
()
{
RuleFor
(
x
=>
x
.
TempId
).
NotNull
().
GreaterThan
(
0
);
}
}
}
performance/Performance.DtoModels/Request/WorkloadRequest.cs
0 → 100644
View file @
f708e889
using
FluentValidation
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels
{
public
class
WorkloadRequest
{
/// <summary>
/// 绩效ID
/// </summary>
public
int
Id
{
get
;
set
;
}
/// <summary>
/// 绩效ID
/// </summary>
public
int
AllotId
{
get
;
set
;
}
/// <summary>
/// 二次绩效ID
/// </summary>
public
int
SecondId
{
get
;
set
;
}
/// <summary>
/// 工作量名称
/// </summary>
public
string
ItemName
{
get
;
set
;
}
/// <summary>
/// 工作量系数
/// </summary>
public
Nullable
<
decimal
>
FactorValue
{
get
;
set
;
}
/// <summary>
///
/// </summary>
public
Nullable
<
decimal
>
Sort
{
get
;
set
;
}
}
public
class
WorkloadRequestValidator
:
AbstractValidator
<
WorkloadRequest
>
{
public
WorkloadRequestValidator
()
{
RuleSet
(
"Add"
,
()
=>
{
RuleFor
(
x
=>
x
.
AllotId
).
NotNull
().
GreaterThan
(
0
);
RuleFor
(
x
=>
x
.
SecondId
).
NotNull
().
GreaterThan
(
0
);
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
.
ItemName
).
NotNull
().
NotEmpty
();
});
RuleSet
(
"Delete"
,
()
=>
{
RuleFor
(
x
=>
x
.
Id
).
NotNull
().
GreaterThan
(
0
);
});
RuleSet
(
"Query"
,
()
=>
{
RuleFor
(
x
=>
x
.
SecondId
).
NotNull
().
GreaterThan
(
0
);
});
}
}
}
performance/Performance.DtoModels/Response/SecondTempResponse.cs
0 → 100644
View file @
f708e889
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.DtoModels.Response
{
public
class
SecondTempResponse
{
}
}
performance/Performance.Services/SecondAllotService.cs
0 → 100644
View file @
f708e889
using
Microsoft.Extensions.Options
;
using
Performance.DtoModels
;
using
Performance.DtoModels.AppSettings
;
using
Performance.EntityModels
;
using
Performance.Repository
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
namespace
Performance.Services
{
public
class
SecondAllotService
:
IAutoInjection
{
private
readonly
Application
application
;
private
readonly
PerforUserRepository
perforUserRepository
;
private
readonly
PerforUserhospitalRepository
perforUserhospitalRepository
;
private
readonly
PerforPerallotRepository
perforPerallotRepository
;
private
readonly
PerforAgsecondallotRepository
perforAgsecondallotRepository
;
private
readonly
PerforResaccountRepository
perforResaccountRepository
;
private
readonly
PerforUserroleRepository
userroleRepository
;
private
readonly
PerforAgworkloadRepository
perforAgworkloadRepository
;
private
readonly
PerforAgtempRepository
perforAgtempRepository
;
private
readonly
PerforAgtempitemRepository
perforAgtempitemRepository
;
public
SecondAllotService
(
IOptions
<
Application
>
application
,
PerforUserRepository
perforUserRepository
,
PerforUserhospitalRepository
perforUserhospitalRepository
,
PerforPerallotRepository
perforPerallotRepository
,
PerforAgsecondallotRepository
perforAgsecondallotRepository
,
PerforResaccountRepository
perforResaccountRepository
,
PerforUserroleRepository
userroleRepository
,
PerforAgworkloadRepository
perforAgworkloadRepository
,
PerforAgtempRepository
perforAgtempRepository
,
PerforAgtempitemRepository
perforAgtempitemRepository
)
{
this
.
application
=
application
.
Value
;
this
.
perforUserRepository
=
perforUserRepository
;
this
.
perforUserhospitalRepository
=
perforUserhospitalRepository
;
this
.
perforPerallotRepository
=
perforPerallotRepository
;
this
.
perforAgsecondallotRepository
=
perforAgsecondallotRepository
;
this
.
perforResaccountRepository
=
perforResaccountRepository
;
this
.
userroleRepository
=
userroleRepository
;
this
.
perforAgworkloadRepository
=
perforAgworkloadRepository
;
this
.
perforAgtempRepository
=
perforAgtempRepository
;
this
.
perforAgtempitemRepository
=
perforAgtempitemRepository
;
}
public
List
<
ag_secondallot
>
GetSecondList
(
int
userId
)
{
var
user
=
perforUserRepository
.
GetEntity
(
t
=>
t
.
ID
==
userId
);
if
(
user
==
null
)
throw
new
NotImplementedException
(
"人员ID无效"
);
var
role
=
userroleRepository
.
GetEntity
(
t
=>
t
.
UserID
==
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
);
if
(
allotList
==
null
||
allotList
.
Count
==
0
)
throw
new
NotImplementedException
(
"该医院未生成绩效"
);
var
allotListId
=
allotList
.
Select
(
t
=>
t
.
ID
).
ToList
();
var
secondList
=
perforAgsecondallotRepository
.
GetEntities
(
t
=>
allotListId
.
Contains
(
t
.
AllotId
.
Value
)
&&
t
.
Department
==
user
.
Department
);
//各科室绩效分配结果
var
accountList
=
perforResaccountRepository
.
GetEntities
(
t
=>
allotListId
.
Contains
(
t
.
AllotID
.
Value
)
&&
t
.
Department
==
user
.
Department
);
//取得未生成二次绩效的绩效id
var
exceptListId
=
secondList
==
null
?
allotListId
:
allotListId
.
Except
(
secondList
.
Select
(
t
=>
t
.
AllotId
.
Value
));
List
<
ag_secondallot
>
newSecond
=
new
List
<
ag_secondallot
>();
foreach
(
var
item
in
exceptListId
)
{
var
allot
=
allotList
.
FirstOrDefault
(
t
=>
t
.
ID
==
item
);
if
(
allot
==
null
)
continue
;
res_account
account
=
null
;
if
(
role
.
RoleID
==
application
.
DirectorRole
)
account
=
accountList
.
FirstOrDefault
(
t
=>
t
.
AllotID
==
item
&&
(
t
.
UnitType
==
(
int
)
UnitType
.
医生组
||
t
.
UnitType
==
(
int
)
UnitType
.
医技组
));
else
if
(
role
.
RoleID
==
application
.
NurseRole
)
account
=
accountList
.
FirstOrDefault
(
t
=>
t
.
AllotID
==
item
&&
t
.
UnitType
==
(
int
)
UnitType
.
护理组
);
if
(
account
==
null
)
continue
;
var
second
=
new
ag_secondallot
{
AllotId
=
item
,
Year
=
allot
.
Year
,
Month
=
allot
.
Month
,
Department
=
user
.
Department
,
UnitType
=
((
UnitType
)
account
.
UnitType
).
ToString
(),
RealGiveFee
=
account
.
RealGiveFee
};
newSecond
.
Add
(
second
);
}
if
(
newSecond
.
Count
>
0
)
{
perforAgsecondallotRepository
.
AddRange
(
newSecond
.
ToArray
());
if
(
secondList
==
null
)
secondList
=
newSecond
;
else
secondList
.
AddRange
(
newSecond
);
}
return
secondList
;
}
public
List
<
ag_temp
>
GetTemp
(
int
userId
)
{
return
perforAgtempRepository
.
GetEntities
();
}
public
bool
UseTemp
(
int
tempId
)
{
var
temp
=
perforAgtempRepository
.
GetEntity
(
t
=>
t
.
Id
==
tempId
);
var
tempItems
=
perforAgtempitemRepository
.
GetEntities
(
t
=>
t
.
TempId
==
tempId
);
return
;
}
public
List
<
ag_workload
>
GetWorkloadList
(
int
secondId
)
{
return
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
secondId
);
}
public
bool
WorkloadAdd
(
WorkloadRequest
request
)
{
var
workloadList
=
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
request
.
SecondId
);
if
(
workloadList
.
Any
(
t
=>
t
.
ItemName
==
request
.
ItemName
))
throw
new
PerformanceException
(
"项目名称重复"
);
ag_workload
workload
=
new
ag_workload
{
AllotId
=
request
.
AllotId
,
FactorValue
=
request
.
FactorValue
??
1
,
ItemName
=
request
.
ItemName
,
SecondId
=
request
.
SecondId
,
Sort
=
request
.
Sort
??
1
,
};
var
result
=
perforAgworkloadRepository
.
Add
(
workload
);
if
(
result
)
{
workload
.
ItemId
=
$"Feild
{
workload
.
Id
}
"
;
perforAgworkloadRepository
.
Update
(
workload
);
}
return
result
;
}
public
bool
WorkloadUpdate
(
WorkloadRequest
request
)
{
var
workloadList
=
perforAgworkloadRepository
.
GetEntities
(
t
=>
t
.
SecondId
==
request
.
SecondId
);
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
.
FactorValue
=
request
.
FactorValue
;
workload
.
ItemName
=
request
.
ItemName
;
workload
.
SecondId
=
request
.
SecondId
;
workload
.
Sort
=
request
.
Sort
;
workload
.
ItemId
=
$"Feild
{
workload
.
Id
}
"
;
return
perforAgworkloadRepository
.
Update
(
workload
);
}
public
bool
WorkloadDelete
(
int
id
)
{
var
workload
=
perforAgworkloadRepository
.
GetEntity
(
t
=>
t
.
Id
==
id
);
return
perforAgworkloadRepository
.
Remove
(
workload
);
}
}
}
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