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
0221b62a
Commit
0221b62a
authored
Nov 13, 2020
by
lcx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽取bug-新增科室起始行读取错误
parent
c914323c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
11 deletions
+33
-11
performance/Performance.Api/Controllers/TemplateController.cs
+1
-1
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
+3
-1
performance/Performance.Services/ExtractExcelService/ExtractService.cs
+20
-1
performance/Performance.Services/ExtractExcelService/QueryService.cs
+3
-2
performance/Performance.Services/LogManageService.cs
+6
-6
No files found.
performance/Performance.Api/Controllers/TemplateController.cs
View file @
0221b62a
...
@@ -250,7 +250,7 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
...
@@ -250,7 +250,7 @@ public ApiResponse NewExtractData([CustomizeValidator, FromBody] ExtractRequest
if
(
isSingle
)
if
(
isSingle
)
{
{
extractEService
.
Main
(
allot
.
ID
,
allot
.
HospitalId
,
email
,
"User"
+
claim
.
GetUserId
(),
filePath
,
true
);
string
extractFilePath
=
extractEService
.
Main
(
allot
.
ID
,
allot
.
HospitalId
,
email
,
"User"
+
claim
.
GetUserId
(),
filePath
,
true
);
}
}
else
else
{
{
...
...
performance/Performance.Services/ExtractExcelService/ExtractHelper/WriteDataHelper.cs
View file @
0221b62a
...
@@ -125,7 +125,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
...
@@ -125,7 +125,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var
cell
=
row
.
GetOrCreate
(
cellIndex
);
var
cell
=
row
.
GetOrCreate
(
cellIndex
);
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
==
column
)?.
Value
;
var
value
=
deptData
.
FirstOrDefault
(
t
=>
t
.
Category
==
column
)?.
Value
;
var
notWrite
=
!
value
.
HasValue
&&
!
string
.
IsNullOrEmpty
(
cell
.
GetDecodeEscapes
());
var
notWrite
=
!
value
.
HasValue
&&
!
string
.
IsNullOrEmpty
(
cell
.
ToString
());
if
(
sheetType
==
SheetType
.
Income
)
if
(
sheetType
==
SheetType
.
Income
)
{
{
...
@@ -161,6 +161,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
...
@@ -161,6 +161,7 @@ public static void WriteSheetData(ISheet sheet, PerSheetPoint point, SheetType s
var
deptStyle
=
style
.
GetCellStyle
();
var
deptStyle
=
style
.
GetCellStyle
();
var
cellStyle
=
style
.
SetBgkColorAndFormat
(
style
.
GetCellStyle
(),
StyleType
.
数据
);
var
cellStyle
=
style
.
SetBgkColorAndFormat
(
style
.
GetCellStyle
(),
StyleType
.
数据
);
dataFirstRowNum
+=
1
;
foreach
(
string
department
in
departments
)
foreach
(
string
department
in
departments
)
{
{
var
deptData
=
data
.
Where
(
t
=>
t
.
Department
==
department
);
var
deptData
=
data
.
Where
(
t
=>
t
.
Department
==
department
);
...
@@ -306,6 +307,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
...
@@ -306,6 +307,7 @@ public static void WriteCollectData(ISheet sheet, PerSheetPoint point, SheetType
var
deptStyle
=
style
.
GetCellStyle
();
var
deptStyle
=
style
.
GetCellStyle
();
var
cellStyle
=
style
.
SetBgkColorAndFormat
(
style
.
GetCellStyle
(),
StyleType
.
数据
);
var
cellStyle
=
style
.
SetBgkColorAndFormat
(
style
.
GetCellStyle
(),
StyleType
.
数据
);
dataFirstRowNum
+=
1
;
foreach
(
string
department
in
departments
)
foreach
(
string
department
in
departments
)
{
{
var
deptData
=
data
.
Where
(
t
=>
t
.
Department
==
department
);
var
deptData
=
data
.
Where
(
t
=>
t
.
Department
==
department
);
...
...
performance/Performance.Services/ExtractExcelService/ExtractService.cs
View file @
0221b62a
...
@@ -59,6 +59,7 @@ PerforPeremployeeRepository peremployeeRepository
...
@@ -59,6 +59,7 @@ PerforPeremployeeRepository peremployeeRepository
public
string
Main
(
int
allotId
,
int
hospitalId
,
string
email
,
string
groupName
,
string
filePath
=
null
,
bool
isSingle
=
false
)
public
string
Main
(
int
allotId
,
int
hospitalId
,
string
email
,
string
groupName
,
string
filePath
=
null
,
bool
isSingle
=
false
)
{
{
string
extractFilePath
=
""
;
string
extractFilePath
=
""
;
per_allot
allot
=
null
;
IWorkbook
workbook
=
null
;
IWorkbook
workbook
=
null
;
try
try
{
{
...
@@ -69,7 +70,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
...
@@ -69,7 +70,7 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
var
allots
=
perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
var
allots
=
perallotRepository
.
GetEntities
(
t
=>
t
.
HospitalId
==
hospitalId
);
if
(
allots
==
null
||
!
allots
.
Any
(
t
=>
t
.
ID
==
allotId
))
throw
new
Exception
(
"绩效不存在"
);
if
(
allots
==
null
||
!
allots
.
Any
(
t
=>
t
.
ID
==
allotId
))
throw
new
Exception
(
"绩效不存在"
);
var
allot
=
allots
.
First
(
t
=>
t
.
ID
==
allotId
);
allot
=
allots
.
First
(
t
=>
t
.
ID
==
allotId
);
var
dict
=
new
Dictionary
<
ExDataDict
,
object
>();
var
dict
=
new
Dictionary
<
ExDataDict
,
object
>();
logService
.
ReturnTheLog
(
allotId
,
groupName
,
3
,
""
,
5
,
1
,
isSingle
);
logService
.
ReturnTheLog
(
allotId
,
groupName
,
3
,
""
,
5
,
1
,
isSingle
);
...
@@ -88,9 +89,13 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
...
@@ -88,9 +89,13 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
WriteDataToFile
(
workbook
,
allotId
,
dict
,
standData
,
groupName
,
isSingle
);
WriteDataToFile
(
workbook
,
allotId
,
dict
,
standData
,
groupName
,
isSingle
);
logService
.
ReturnTheLog
(
allotId
,
groupName
,
2
,
"提取完成"
,
$"绩效数据提取成功"
,
5
,
isSingle
);
logService
.
ReturnTheLog
(
allotId
,
groupName
,
2
,
"提取完成"
,
$"绩效数据提取成功"
,
5
,
isSingle
);
allot
.
IsExtracting
=
isSingle
?
2
:
0
;
allot
.
ExtractPath
=
extractFilePath
;
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
allot
.
IsExtracting
=
3
;
logService
.
ReturnTheLog
(
allotId
,
groupName
,
2
,
"提取完成"
,
$"绩效数据提取失败"
,
4
,
isSingle
);
logService
.
ReturnTheLog
(
allotId
,
groupName
,
2
,
"提取完成"
,
$"绩效数据提取失败"
,
4
,
isSingle
);
logger
.
LogError
(
"提取数据中发生异常: "
+
ex
.
ToString
());
logger
.
LogError
(
"提取数据中发生异常: "
+
ex
.
ToString
());
}
}
...
@@ -102,10 +107,20 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
...
@@ -102,10 +107,20 @@ public string Main(int allotId, int hospitalId, string email, string groupName,
workbook
.
Write
(
file
);
workbook
.
Write
(
file
);
}
}
workbook
.
Close
();
workbook
.
Close
();
perallotRepository
.
Update
(
allot
);
}
}
return
extractFilePath
;
return
extractFilePath
;
}
}
/// <summary>
/// 数据写入
/// </summary>
/// <param name="workbook"></param>
/// <param name="allotId"></param>
/// <param name="exdict"></param>
/// <param name="extractDto"></param>
/// <param name="groupName"></param>
/// <param name="isSingle"></param>
private
void
WriteDataToFile
(
IWorkbook
workbook
,
int
allotId
,
Dictionary
<
ExDataDict
,
object
>
exdict
,
List
<
ExtractTransDto
>
extractDto
,
string
groupName
,
bool
isSingle
)
private
void
WriteDataToFile
(
IWorkbook
workbook
,
int
allotId
,
Dictionary
<
ExDataDict
,
object
>
exdict
,
List
<
ExtractTransDto
>
extractDto
,
string
groupName
,
bool
isSingle
)
{
{
ExcelStyle
style
=
new
ExcelStyle
(
workbook
);
ExcelStyle
style
=
new
ExcelStyle
(
workbook
);
...
@@ -145,6 +160,10 @@ private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataD
...
@@ -145,6 +160,10 @@ private void WriteDataToFile(IWorkbook workbook, int allotId, Dictionary<ExDataD
customer
.
WriteCollectData
(
sheet
,
point
,
sheetType
,
style
,
collects
);
customer
.
WriteCollectData
(
sheet
,
point
,
sheetType
,
style
,
collects
);
var
exdata
=
extractDto
.
Where
(
t
=>
t
.
SheetName
.
NoBlank
()
==
sheetName
)?.
ToList
();
var
exdata
=
extractDto
.
Where
(
t
=>
t
.
SheetName
.
NoBlank
()
==
sheetName
)?.
ToList
();
if
(
exdata
!=
null
)
{
logger
.
LogInformation
(
$"
{
sheetName
}
: 总金额 -
{
exdata
.
Sum
(
s
=>
s
.
Value
??
0
)}
; 科室 -
{
string
.
Join
(
","
,
exdata
.
Select
(
s
=>
s
.
Department
).
Distinct
())}
"
);
}
var
data
=
GetDataBySheetType
(
sheetType
,
exdata
,
employeeDict
);
var
data
=
GetDataBySheetType
(
sheetType
,
exdata
,
employeeDict
);
customer
.
WriteSheetData
(
sheet
,
point
,
sheetType
,
style
,
data
,
exdict
);
customer
.
WriteSheetData
(
sheet
,
point
,
sheetType
,
style
,
data
,
exdict
);
}
}
...
...
performance/Performance.Services/ExtractExcelService/QueryService.cs
View file @
0221b62a
...
@@ -238,9 +238,10 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
...
@@ -238,9 +238,10 @@ private List<ex_result> ExtractItemData(per_allot allot, string groupName, bool
{
{
var
data
=
new
List
<
ex_result
>();
var
data
=
new
List
<
ex_result
>();
if
(
dictValue
is
List
<
ex_item
>
items
&&
items
!=
null
&&
items
.
Any
(
t
=>
t
.
TypeId
.
HasValue
&&
t
.
TypeId
>
0
))
var
incomeModuleIds
=
modules
.
Where
(
w
=>
w
.
SheetType
==
(
int
)
SheetType
.
Income
)?.
Select
(
s
=>
s
.
Id
).
ToList
()
??
new
List
<
int
>();
if
(
dictValue
is
List
<
ex_item
>
items
&&
items
!=
null
&&
items
.
Any
(
t
=>
t
.
TypeId
.
HasValue
&&
t
.
TypeId
>
0
&&
!
incomeModuleIds
.
Contains
(
t
.
ModuleId
??
0
)))
{
{
var
typeIds
=
items
.
Where
(
t
=>
t
.
TypeId
.
HasValue
&&
t
.
TypeId
>
0
)?.
Select
(
t
=>
t
.
TypeId
.
Value
).
Distinct
().
ToList
();
var
typeIds
=
items
.
Where
(
t
=>
t
.
TypeId
.
HasValue
&&
t
.
TypeId
>
0
&&
!
incomeModuleIds
.
Contains
(
t
.
ModuleId
??
0
)
)?.
Select
(
t
=>
t
.
TypeId
.
Value
).
Distinct
().
ToList
();
if
(
typeIds
==
null
||
typeIds
.
Count
==
0
)
return
data
;
if
(
typeIds
==
null
||
typeIds
.
Count
==
0
)
return
data
;
decimal
ratio
=
20
m
;
decimal
ratio
=
20
m
;
...
...
performance/Performance.Services/LogManageService.cs
View file @
0221b62a
...
@@ -86,18 +86,18 @@ public void ReturnTheLog(int allotId, string groupName, int type, string tag, ob
...
@@ -86,18 +86,18 @@ public void ReturnTheLog(int allotId, string groupName, int type, string tag, ob
string
content
=
""
;
decimal
ratio
=
0
;
string
content
=
""
;
decimal
ratio
=
0
;
if
(
type
==
2
)
if
(
type
==
2
)
{
{
content
=
message
.
ToString
();
logger
.
LogInformation
(
content
);
if
(
isSingle
)
hubContext
.
Clients
.
Group
(
groupName
).
SendAsync
(
"ExtractLog"
,
tag
,
content
,
level
);
}
else
if
(
type
==
3
)
{
ratio
=
Math
.
Round
(
Convert
.
ToDecimal
(
message
),
2
,
MidpointRounding
.
AwayFromZero
);
ratio
=
Math
.
Round
(
Convert
.
ToDecimal
(
message
),
2
,
MidpointRounding
.
AwayFromZero
);
if
(
level
!=
5
&&
ratio
>
100
)
ratio
=
99
;
if
(
level
!=
5
&&
ratio
>
100
)
ratio
=
99
;
if
(
level
==
5
&&
ratio
!=
100
)
ratio
=
100
;
if
(
level
==
5
&&
ratio
!=
100
)
ratio
=
100
;
content
=
ratio
.
ToString
();
content
=
ratio
.
ToString
();
if
(
isSingle
)
hubContext
.
Clients
.
Group
(
groupName
).
SendAsync
(
"Schedule"
,
ratio
,
level
);
if
(
isSingle
)
hubContext
.
Clients
.
Group
(
groupName
).
SendAsync
(
"Schedule"
,
ratio
,
level
);
}
}
else
if
(
type
==
3
)
{
content
=
message
.
ToString
();
logger
.
LogInformation
(
content
);
if
(
isSingle
)
hubContext
.
Clients
.
Group
(
groupName
).
SendAsync
(
"ExtractLog"
,
tag
,
content
,
level
);
}
logdbug
.
Add
(
allotId
,
tag
,
content
,
level
,
type
);
logdbug
.
Add
(
allotId
,
tag
,
content
,
level
,
type
);
if
(!
isSingle
)
if
(!
isSingle
)
...
...
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