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
8dce0149
Commit
8dce0149
authored
Nov 18, 2021
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HRP
parent
2143eb5b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
40 deletions
+45
-40
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
+45
-40
No files found.
performance/Performance.Services/ExtractExcelService/DictionaryService.cs
View file @
8dce0149
...
@@ -69,9 +69,9 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
...
@@ -69,9 +69,9 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
{
{
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
2
,
"提取数据"
,
$"提取人员信息数据"
,
isSingle
:
isSingle
);
logService
.
ReturnTheLog
(
allot
.
ID
,
groupName
,
2
,
"提取数据"
,
$"提取人员信息数据"
,
isSingle
:
isSingle
);
var
typeIds
=
types
.
Where
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
Employee
).
Select
(
t
=>
t
.
Id
);
var
typeIds
=
types
.
Where
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
Employee
).
Select
(
t
=>
t
.
Id
);
var
script
=
scripts
.
FirstOrDefault
(
t
=>
typeIds
.
Contains
(
t
.
TypeId
));
var
script
=
scripts
.
Where
(
t
=>
typeIds
.
Contains
(
t
.
TypeId
));
if
(
script
!=
null
)
if
(
script
!=
null
)
Employee
(
allot
,
configs
.
FirstOrDefault
(
t
=>
t
.
Id
==
script
.
ConfigId
),
script
.
ExecScript
);
Employee
(
allot
,
configs
,
scripts
);
}
}
if
(
types
.
Any
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
OnlyExtract
))
//不写入Excel的提取数据
if
(
types
.
Any
(
t
=>
t
.
Source
==
(
int
)
SheetType
.
OnlyExtract
))
//不写入Excel的提取数据
{
{
...
@@ -106,56 +106,61 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
...
@@ -106,56 +106,61 @@ public void Handler(int hospitalId, per_allot allot, string groupName, bool isSi
}
}
}
}
private
void
Employee
(
per_allot
allot
,
sys_hospitalconfig
config
,
string
sql
)
private
void
Employee
(
per_allot
allot
,
List
<
sys_hospitalconfig
>
configs
,
IEnumerable
<
ex_script
>
scripts
)
{
{
try
try
{
{
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
sql
))
return
;
foreach
(
var
script
in
scripts
)
{
var
config
=
configs
.
FirstOrDefault
(
w
=>
w
.
Id
==
script
.
ConfigId
);
var
sql
=
script
.
ExecScript
;
if
(
config
==
null
||
string
.
IsNullOrEmpty
(
sql
))
return
;
var
limitData
=
queryService
.
QueryData
<
dynamic
>(
config
,
allot
,
$"select * from (
{
sql
}
) t limit 1;"
);
var
limitData
=
queryService
.
QueryData
<
dynamic
>(
config
,
allot
,
sql
);
if
(
limitData
==
null
||
!
limitData
.
Any
())
return
;
if
(
limitData
==
null
||
!
limitData
.
Any
())
return
;
var
columns
=
((
IDictionary
<
string
,
object
>)
limitData
.
ElementAt
(
0
)).
Select
(
t
=>
t
.
Key
.
ToLower
()).
ToList
();
var
columns
=
((
IDictionary
<
string
,
object
>)
limitData
.
ElementAt
(
0
)).
Select
(
t
=>
t
.
Key
.
ToLower
()).
ToList
();
var
data
=
queryService
.
QueryData
<
per_employee
>(
config
,
allot
,
sql
).
ToList
();
var
data
=
queryService
.
QueryData
<
per_employee
>(
config
,
allot
,
sql
).
ToList
();
data
.
ForEach
(
t
=>
data
.
ForEach
(
t
=>
{
{
t
.
AllotId
=
allot
.
ID
;
t
.
AllotId
=
allot
.
ID
;
t
.
HospitalId
=
allot
.
HospitalId
;
t
.
HospitalId
=
allot
.
HospitalId
;
t
.
IsHrpEmployee
=
1
;
t
.
IsHrpEmployee
=
1
;
});
});
var
hrpDepartments
=
cofhrpdepartmentRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
var
hrpDepartments
=
cofhrpdepartmentRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
if
(
hrpDepartments
!=
null
&&
hrpDepartments
.
Any
())
if
(
hrpDepartments
!=
null
&&
hrpDepartments
.
Any
())
{
data
=
data
.
GroupJoin
(
hrpDepartments
,
outer
=>
new
{
department
=
outer
.
Department
},
inner
=>
new
{
department
=
inner
.
HRPDepartment
},
(
outer
,
inner
)
=>
new
{
outer
,
inner
}).
Select
(
t
=>
{
{
t
.
outer
.
AccountingUnit
=
t
.
inner
?.
FirstOrDefault
()?.
AccountingUnit
;
data
=
data
.
GroupJoin
(
hrpDepartments
,
outer
=>
new
{
department
=
outer
.
Department
},
inner
=>
new
{
department
=
inner
.
HRPDepartment
},
(
outer
,
inner
)
=>
new
{
outer
,
inner
}).
Select
(
t
=>
return
t
.
outer
;
{
}).
ToList
();
t
.
outer
.
AccountingUnit
=
t
.
inner
?.
FirstOrDefault
()?.
AccountingUnit
;
}
return
t
.
outer
;
}).
ToList
();
}
var
employees
=
peremployeeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
var
employees
=
peremployeeRepository
.
GetEntities
(
t
=>
t
.
AllotId
==
allot
.
ID
);
if
(
employees
==
null
||
!
employees
.
Any
())
if
(
employees
==
null
||
!
employees
.
Any
())
{
{
peremployeeRepository
.
AddRange
(
data
.
ToArray
());
peremployeeRepository
.
AddRange
(
data
.
ToArray
());
return
;
return
;
}
}
var
needAddData
=
data
.
Where
(
w
=>
!
employees
.
Select
(
t
=>
t
.
PersonnelNumber
).
Contains
(
w
.
PersonnelNumber
));
var
needAddData
=
data
.
Where
(
w
=>
!
employees
.
Select
(
t
=>
t
.
PersonnelNumber
).
Contains
(
w
.
PersonnelNumber
));
if
(
needAddData
!=
null
&&
needAddData
.
Any
())
peremployeeRepository
.
AddRange
(
needAddData
.
ToArray
());
if
(
needAddData
!=
null
&&
needAddData
.
Any
())
peremployeeRepository
.
AddRange
(
needAddData
.
ToArray
());
var
needRemarkData
=
employees
.
Where
(
w
=>
!
data
.
Select
(
t
=>
t
.
PersonnelNumber
).
Contains
(
w
.
PersonnelNumber
))?.
ToList
();
var
needRemarkData
=
employees
.
Where
(
w
=>
!
data
.
Select
(
t
=>
t
.
PersonnelNumber
).
Contains
(
w
.
PersonnelNumber
))?.
ToList
();
if
(
needRemarkData
!=
null
&&
needRemarkData
.
Any
())
if
(
needRemarkData
!=
null
&&
needRemarkData
.
Any
())
{
{
needRemarkData
.
ForEach
(
t
=>
t
.
Remark
=
"HRP中无此工号数据"
);
needRemarkData
.
ForEach
(
t
=>
t
.
Remark
=
"HRP中无此工号数据"
);
peremployeeRepository
.
UpdateRange
(
needRemarkData
.
ToArray
());
peremployeeRepository
.
UpdateRange
(
needRemarkData
.
ToArray
());
}
}
var
needUpdateData
=
employees
.
Where
(
w
=>
data
.
Select
(
t
=>
t
.
PersonnelNumber
).
Contains
(
w
.
PersonnelNumber
));
var
needUpdateData
=
employees
.
Where
(
w
=>
data
.
Select
(
t
=>
t
.
PersonnelNumber
).
Contains
(
w
.
PersonnelNumber
));
if
(
needUpdateData
!=
null
&&
needUpdateData
.
Any
())
if
(
needUpdateData
!=
null
&&
needUpdateData
.
Any
())
{
{
JudgeDataEqual
(
columns
,
needUpdateData
.
ToList
(),
data
);
JudgeDataEqual
(
columns
,
needUpdateData
.
ToList
(),
data
);
}
}
}
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
...
...
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