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
55a85fed
Commit
55a85fed
authored
Jul 27, 2021
by
钟博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改重新加载人员字典问题
parent
b4255d09
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
30 deletions
+55
-30
performance/Performance.Api/Controllers/PersonController.cs
+6
-3
performance/Performance.Services/PersonService.cs
+49
-27
No files found.
performance/Performance.Api/Controllers/PersonController.cs
View file @
55a85fed
...
...
@@ -278,10 +278,13 @@ public ApiResponse SaveDeptHands(int hospitalId, SaveCollectData request)
/// <returns></returns>
[
HttpPost
]
[
Route
(
"peson/{hospitalId}/reloadPersonnel/{allotId}"
)]
public
ApiResponse
ReloadPersonnel
(
int
hospitalId
,
int
allotId
)
public
ApiResponse
ReloadPersonnel
(
int
hospitalId
,
int
allotId
)
{
personService
.
ReloadPersonnel
(
hospitalId
,
allotId
);
return
new
ApiResponse
(
ResponseType
.
OK
);
var
result
=
personService
.
ReloadPersonnel
(
hospitalId
,
allotId
);
if
(
result
)
return
new
ApiResponse
(
ResponseType
.
OK
,
result
);
else
return
new
ApiResponse
(
ResponseType
.
Error
,
result
);
}
}
}
performance/Performance.Services/PersonService.cs
View file @
55a85fed
...
...
@@ -1001,52 +1001,74 @@ public string GetPersonDictFile(int allotId, int userId)
return
filepath
;
}
public
void
ReloadPersonnel
(
int
hospitalId
,
int
allotId
)
public
bool
ReloadPersonnel
(
int
hospitalId
,
int
allotId
)
{
var
allotList
=
perallotRepository
.
GetEntities
(
w
=>
w
.
HospitalId
==
hospitalId
)?.
OrderBy
(
s
=>
s
.
Year
).
ThenBy
(
s
=>
s
.
Month
).
ToList
();
if
(
allotList
==
null
||
!
allotList
.
Any
())
return
;
if
(
allotList
==
null
||
!
allotList
.
Any
())
throw
new
PerformanceException
(
"加载失败,绩效记录不存在!"
);
var
allot
=
allotList
.
FirstOrDefault
(
w
=>
w
.
ID
==
allotId
);
if
(
allot
==
null
)
return
;
if
(
allot
==
null
)
throw
new
PerformanceException
(
"加载失败,绩效记录不存在!"
);
var
index
=
allotList
.
IndexOf
(
allot
);
if
(
index
==
0
)
return
;
if
(
index
==
0
)
throw
new
PerformanceException
(
"加载失败,绩效记录不存在!"
);
var
prevAllot
=
allotList
[
index
-
1
];
if
(
prevAllot
==
null
)
prevAllot
.
ID
=
-
1
;
var
persons
=
peremployeeRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
&&
t
.
AllotId
==
prevAllot
.
ID
);
if
(
persons
==
null
||
!
persons
.
Any
())
return
;
if
(
persons
==
null
||
!
persons
.
Any
())
throw
new
PerformanceException
(
"加载失败,未查询到上月人员信息!"
);
var
i
=
peremployeeRepository
.
Execute
(
$@"DELETE FROM per_employee WHERE HospitalId=@HospitalId and AllotId=@AllotId;"
,
new
{
hospitalId
,
allotId
});
if
(
i
<=
0
)
return
;
if
(
i
<=
0
)
throw
new
PerformanceException
(
"加载失败,人员信息重置失败!"
);
int
day
=
DateTime
.
DaysInMonth
(
allot
.
Year
,
allot
.
Month
);
var
data
=
persons
.
Select
(
t
=>
new
per_employee
var
data
=
persons
.
Select
(
t
=>
{
HospitalId
=
t
.
HospitalId
,
AllotId
=
allotId
,
AccountingUnit
=
t
.
AccountingUnit
,
Department
=
t
.
Department
,
DoctorName
=
t
.
DoctorName
,
JobCategory
=
t
.
JobCategory
,
Duty
=
t
.
Duty
,
JobTitle
=
t
.
JobTitle
,
UnitType
=
t
.
UnitType
,
AttendanceDay
=
day
,
Attendance
=
1
,
PermanentStaff
=
t
.
PermanentStaff
,
EfficiencyNumber
=
t
.
EfficiencyNumber
,
WorkTime
=
t
.
WorkTime
,
BirthDate
=
t
.
BirthDate
,
Age
=
t
.
Age
,
ReservedRatio
=
t
.
ReservedRatio
,
BankCard
=
t
.
BankCard
,
Remark
=
t
.
Remark
,
CreateTime
=
DateTime
.
Now
,
var
entity
=
new
per_employee
{
HospitalId
=
t
.
HospitalId
,
AllotId
=
allotId
,
AccountingUnit
=
t
.
AccountingUnit
,
Department
=
t
.
Department
,
DoctorName
=
t
.
DoctorName
,
JobCategory
=
t
.
JobCategory
,
Duty
=
t
.
Duty
,
JobTitle
=
t
.
JobTitle
,
UnitType
=
t
.
UnitType
,
AttendanceDay
=
day
,
Attendance
=
1
,
PermanentStaff
=
t
.
PermanentStaff
,
EfficiencyNumber
=
t
.
EfficiencyNumber
,
WorkTime
=
t
.
WorkTime
,
BirthDate
=
t
.
BirthDate
,
Age
=
t
.
Age
,
ReservedRatio
=
t
.
ReservedRatio
,
BankCard
=
t
.
BankCard
,
Remark
=
t
.
Remark
,
CreateTime
=
DateTime
.
Now
,
};
if
(!
string
.
IsNullOrEmpty
(
t
.
PersonnelNumber
)
&&
!
string
.
IsNullOrEmpty
(
t
.
JobNumber
))
{
entity
.
PersonnelNumber
=
t
.
PersonnelNumber
;
entity
.
JobNumber
=
t
.
JobNumber
;
}
else
{
string
number
=
!
string
.
IsNullOrEmpty
(
t
.
PersonnelNumber
)
?
t
.
PersonnelNumber
:
t
.
JobNumber
;
entity
.
PersonnelNumber
=
number
;
entity
.
JobNumber
=
number
;
}
return
entity
;
}).
ToList
();
SaveAllotPersons
(
data
);
return
true
;
}
}
}
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