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
c4f1eb96
Commit
c4f1eb96
authored
Mar 11, 2019
by
zry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
excel developing
parent
1c51f19b
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
122 additions
and
35 deletions
+122
-35
performance/Performance.Api/Controllers/AllotController.cs
+29
-4
performance/Performance.ConsoleApp/Program.cs
+1
-1
performance/Performance.DtoModels/PerExcel/PerSheetPoint.cs
+1
-1
performance/Performance.Services/PerExcelService/PerExcelService.cs
+26
-11
performance/Performance.Services/PerExcelService/PerSheetService.cs
+6
-4
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataFactory.cs
+8
-8
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadEmployee.cs
+2
-2
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadExpend.cs
+2
-2
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadIncome.cs
+27
-0
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadOvertime.cs
+18
-0
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadWorkload.cs
+2
-2
No files found.
performance/Performance.Api/Controllers/AllotController.cs
View file @
c4f1eb96
...
...
@@ -12,6 +12,7 @@
using
System.Collections.Generic
;
using
System.IO
;
using
System.Linq
;
using
System.Linq.Expressions
;
using
System.Threading.Tasks
;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
...
...
@@ -23,19 +24,19 @@ public class AllotController : Controller
{
private
AllotService
_allotService
;
private
HospitalService
_hospitalService
;
//
private PerExcelService _perExcelService;
private
PerExcelService
_perExcelService
;
private
IHostingEnvironment
_evn
;
private
ILogger
<
AllotController
>
_logger
;
public
AllotController
(
AllotService
allotService
,
HospitalService
hospitalService
,
//
PerExcelService perExcelService,
PerExcelService
perExcelService
,
ILogger
<
AllotController
>
logger
,
IHostingEnvironment
evn
)
{
_allotService
=
allotService
;
_hospitalService
=
hospitalService
;
//
_perExcelService = perExcelService;
_perExcelService
=
perExcelService
;
_logger
=
logger
;
_evn
=
evn
;
}
...
...
@@ -141,7 +142,31 @@ public ApiResponse Import([FromForm] IFormCollection form)
public
ApiResponse
Generate
([
CustomizeValidator
(
RuleSet
=
"Delete"
),
FromBody
]
AllotRequest
request
)
{
var
allot
=
_allotService
.
GetAllot
(
request
.
ID
);
BackgroundJob
.
Enqueue
<
PerExcelService
>(
p
=>
p
.
Analyze
(
allot
.
Path
));
if
(
null
==
allot
||
string
.
IsNullOrEmpty
(
allot
.
Path
))
throw
new
PerformanceException
(
"当前绩效记录不存在或没有上传数据文件"
);
Action
<
PerExcelService
>
action
=
(
service
)
=>
{
// 拷贝配置信息
service
.
Copy
(
allot
.
ID
);
// 导出数据
var
excel
=
service
.
Import
(
allot
.
Path
);
// 保存数据
service
.
ImportSave
(
excel
);
// 计算合并数据
service
.
ProcessCompute
(
excel
);
// 保存过程数据
service
.
ProcessSave
(
excel
);
// 计算最总数据
service
.
Compute
(
excel
);
};
BackgroundJob
.
Enqueue
<
PerExcelService
>(
p
=>
action
.
Invoke
(
p
));
return
new
ApiResponse
(
ResponseType
.
OK
);
}
}
...
...
performance/Performance.ConsoleApp/Program.cs
View file @
c4f1eb96
...
...
@@ -10,7 +10,7 @@ static void Main(string[] args)
Console
.
WriteLine
(
"Hello World!"
);
PerSheetService
perSheetService
=
new
PerSheetService
();
PerExcelService
perExcelService
=
new
PerExcelService
(
perSheetService
);
var
excel
=
perExcelService
.
Analyze
(
@"C:\Users\ry\Desktop\文件\测试.xlsx"
);
var
excel
=
perExcelService
.
Import
(
@"C:\Users\ry\Desktop\文件\测试.xlsx"
);
Console
.
ReadKey
();
}
...
...
performance/Performance.DtoModels/PerExcel/PerSheetPoint.cs
View file @
c4f1eb96
...
...
@@ -32,7 +32,7 @@ public class PerSheetPoint
/// <summary>
/// 核算单元列
/// </summary>
public
int
?
Standard
CellNum
{
get
;
set
;
}
public
int
?
AccountingUnit
CellNum
{
get
;
set
;
}
/// <summary>
/// 科室名称
/// </summary>
...
...
performance/Performance.Services/PerExcelService/PerExcelService.cs
View file @
c4f1eb96
...
...
@@ -18,7 +18,7 @@ public PerExcelService(PerSheetService perSheetService)
{
_perSheetService
=
perSheetService
;
}
public
PerExcel
Analyze
(
string
path
)
public
PerExcel
Import
(
string
path
)
{
PerExcel
excel
=
new
PerExcel
{
...
...
@@ -41,20 +41,10 @@ public PerExcel Analyze(string path)
excel
.
PerSheet
.
Add
(
st
);
}
}
Save
(
excel
);
return
excel
;
}
}
private
bool
Save
(
PerExcel
excel
)
{
foreach
(
var
item
in
excel
.
PerSheet
.
Where
(
t
=>
t
.
SheetType
==
SheetType
.
Employee
))
{
var
result
=
C
(
item
.
PerData
);
}
return
true
;
}
private
List
<
im_employee
>
C
(
List
<
PerData
>
dataList
)
{
List
<
im_employee
>
result
=
new
List
<
im_employee
>();
...
...
@@ -85,5 +75,30 @@ private List<im_employee> C(List<PerData> dataList)
return
result
;
}
public
void
Copy
(
int
iD
)
{
throw
new
NotImplementedException
();
}
public
void
ImportSave
(
PerExcel
excel
)
{
throw
new
NotImplementedException
();
}
public
void
ProcessCompute
(
PerExcel
excel
)
{
throw
new
NotImplementedException
();
}
public
void
ProcessSave
(
PerExcel
excel
)
{
throw
new
NotImplementedException
();
}
public
void
Compute
(
PerExcel
excel
)
{
throw
new
NotImplementedException
();
}
}
}
performance/Performance.Services/PerExcelService/PerSheetService.cs
View file @
c4f1eb96
...
...
@@ -20,7 +20,7 @@ public PerSheet Sheet(ISheet sheet)
if
(
perSheet
.
SheetType
==
SheetType
.
Unidentifiable
)
return
null
;
IPerSheetDataRead
sheetRead
=
PerSheetDataFactory
.
GetAnalyze
(
perSheet
.
SheetType
);
var
sheetRead
=
PerSheetDataFactory
.
GetDataRead
(
perSheet
.
SheetType
);
perSheet
.
PerData
=
AnalyzeData
(
sheet
,
sheetRead
);
return
perSheet
;
...
...
@@ -30,9 +30,11 @@ public SheetType GetSheetType(string sheetName)
{
if
(
sheetName
.
StartsWith
(
"医院人员名单"
))
return
SheetType
.
Employee
;
else
if
(
sheetName
.
StartsWith
(
"工作量"
))
else
if
(
sheetName
.
StartsWith
(
"1."
))
return
SheetType
.
Income
;
else
if
(
sheetName
.
StartsWith
(
"2."
))
return
SheetType
.
Expend
;
else
if
(
sheetName
.
StartsWith
(
"
生成成本
"
))
else
if
(
sheetName
.
StartsWith
(
"
3.
"
))
return
SheetType
.
Workload
;
return
SheetType
.
Unidentifiable
;
}
...
...
@@ -42,7 +44,7 @@ public List<PerData> AnalyzeData(ISheet sheet, IPerSheetDataRead sheetRead)
List
<
PerData
>
dataList
=
new
List
<
PerData
>();
PerHeaderService
perHeader
=
new
PerHeaderService
();
var
headList
=
perHeader
.
GetPerHeaderReverse
(
sheet
,
sheetRead
.
Point
);
var
vhead
=
headList
.
Where
(
t
=>
t
.
PointCell
!=
sheetRead
.
Point
.
Standard
CellNum
&&
t
.
PointCell
!=
sheetRead
.
Point
.
DeptCellNum
)
var
vhead
=
headList
.
Where
(
t
=>
t
.
PointCell
!=
sheetRead
.
Point
.
AccountingUnit
CellNum
&&
t
.
PointCell
!=
sheetRead
.
Point
.
DeptCellNum
)
.
OrderBy
(
t
=>
t
.
PointCell
);
for
(
int
r
=
sheetRead
.
Point
.
DataFirstRowNum
.
Value
;
r
<
sheet
.
LastRowNum
+
1
;
r
++)
...
...
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataFactory.cs
View file @
c4f1eb96
...
...
@@ -7,28 +7,28 @@ namespace Performance.Services
{
public
class
PerSheetDataFactory
{
public
static
IPerSheetDataRead
Get
Analyze
(
SheetType
sheetType
)
public
static
IPerSheetDataRead
Get
DataRead
(
SheetType
sheetType
)
{
IPerSheetDataRead
analyze
=
null
;
IPerSheetDataRead
dataread
=
null
;
switch
(
sheetType
)
{
case
SheetType
.
Employee
:
analyze
=
new
PerSheetDataReadEmployee
();
dataread
=
new
PerSheetDataReadEmployee
();
break
;
case
SheetType
.
Income
:
dataread
=
new
PerSheetDataReadIncome
();
break
;
case
SheetType
.
Expend
:
analyze
=
new
PerSheetDataReadExpend
();
dataread
=
new
PerSheetDataReadExpend
();
break
;
case
SheetType
.
Overtime
:
dataread
=
new
PerSheetDataReadOvertime
();
break
;
case
SheetType
.
Workload
:
analyze
=
new
PerSheetDataReadWorkload
();
break
;
default
:
dataread
=
new
PerSheetDataReadWorkload
();
break
;
}
return
analyze
;
return
dataread
;
}
}
}
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadEmployee.cs
View file @
c4f1eb96
...
...
@@ -14,7 +14,7 @@ public class PerSheetDataReadEmployee : IPerSheetDataRead
HeaderLastRowNum
=
0
,
HeaderFirstCellNum
=
0
,
DataFirstRowNum
=
1
,
Standard
CellNum
=
0
,
AccountingUnit
CellNum
=
0
,
DeptCellNum
=
1
};
...
...
@@ -22,7 +22,7 @@ public PerData GetPerData(IRow row, PerHeader perHeader)
{
return
new
PerDataEmployee
{
AccountingUnit
=
row
.
GetCell
(
Point
.
Standard
CellNum
.
Value
)?.
ToString
(),
AccountingUnit
=
row
.
GetCell
(
Point
.
AccountingUnit
CellNum
.
Value
)?.
ToString
(),
Department
=
row
.
GetCell
(
Point
.
DeptCellNum
.
Value
)?.
ToString
(),
TypeName
=
perHeader
?.
CellName
,
CellValue
=
row
.
GetCell
(
perHeader
.
PointCell
)?.
ToString
(),
...
...
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadExpend.cs
View file @
c4f1eb96
...
...
@@ -16,7 +16,7 @@ public class PerSheetDataReadExpend : IPerSheetDataRead
HeaderFirstCellNum
=
3
,
DataFirstRowNum
=
6
,
FactorRow
=
5
,
Standard
CellNum
=
3
,
AccountingUnit
CellNum
=
3
,
DeptCellNum
=
4
};
...
...
@@ -24,7 +24,7 @@ public PerData GetPerData(IRow row, PerHeader perHeader)
{
return
new
PerDataExpend
{
AccountingUnit
=
row
.
GetCell
(
Point
.
Standard
CellNum
.
Value
).
ToString
(),
AccountingUnit
=
row
.
GetCell
(
Point
.
AccountingUnit
CellNum
.
Value
).
ToString
(),
Department
=
row
.
GetCell
(
Point
.
DeptCellNum
.
Value
).
ToString
(),
ParentType
=
perHeader
.
Parent
?.
CellName
,
TypeName
=
perHeader
.
CellName
,
...
...
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadIncome.cs
0 → 100644
View file @
c4f1eb96
using
NPOI.SS.UserModel
;
using
Performance.DtoModels
;
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
namespace
Performance.Services
{
public
class
PerSheetDataReadIncome
:
IPerSheetDataRead
{
public
PerSheetPoint
Point
=>
new
PerSheetPoint
{
HeaderFirstRowNum
=
1
,
HeaderLastRowNum
=
1
,
HeaderFirstCellNum
=
0
,
DataFirstRowNum
=
4
,
AccountingUnitCellNum
=
0
,
DeptCellNum
=
1
,
FactorRow
=
1
,
};
public
PerData
GetPerData
(
IRow
row
,
PerHeader
perHeader
)
{
throw
new
NotImplementedException
();
}
}
}
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadOvertime.cs
0 → 100644
View file @
c4f1eb96
using
System
;
using
System.Collections.Generic
;
using
System.Text
;
using
NPOI.SS.UserModel
;
using
Performance.DtoModels
;
namespace
Performance.Services
{
public
class
PerSheetDataReadOvertime
:
IPerSheetDataRead
{
public
PerSheetPoint
Point
=>
throw
new
NotImplementedException
();
public
PerData
GetPerData
(
IRow
row
,
PerHeader
perHeader
)
{
throw
new
NotImplementedException
();
}
}
}
performance/Performance.Services/PerExcelService/SheetDataRead/PerSheetDataReadWorkload.cs
View file @
c4f1eb96
...
...
@@ -15,7 +15,7 @@ public class PerSheetDataReadWorkload : IPerSheetDataRead
HeaderLastRowNum
=
2
,
HeaderFirstCellNum
=
1
,
DataFirstRowNum
=
3
,
Standard
CellNum
=
1
,
AccountingUnit
CellNum
=
1
,
DeptCellNum
=
2
};
...
...
@@ -23,7 +23,7 @@ public PerData GetPerData(IRow row, PerHeader perHeader)
{
return
new
PerDataWorkload
{
AccountingUnit
=
row
.
GetCell
(
Point
.
Standard
CellNum
.
Value
).
ToString
(),
AccountingUnit
=
row
.
GetCell
(
Point
.
AccountingUnit
CellNum
.
Value
).
ToString
(),
Department
=
row
.
GetCell
(
Point
.
DeptCellNum
.
Value
).
ToString
(),
ParentType
=
perHeader
.
Parent
?.
CellName
,
TypeName
=
perHeader
.
CellName
,
...
...
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