Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
W
work_service
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
licc
work_service
Commits
c222aa80
Commit
c222aa80
authored
Mar 15, 2021
by
nie'hong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完善工时统计
parent
d92463ef
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
6 deletions
+20
-6
StatisticsServiceImpl.java
...java/cn/wisenergy/service/impl/StatisticsServiceImpl.java
+20
-6
No files found.
wisenergy-service/src/main/java/cn/wisenergy/service/impl/StatisticsServiceImpl.java
View file @
c222aa80
...
@@ -247,7 +247,7 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -247,7 +247,7 @@ public class StatisticsServiceImpl implements StatisticsService {
workingHoursStatistics
.
setProjectType
(
workType
.
getId
());
workingHoursStatistics
.
setProjectType
(
workType
.
getId
());
workingHoursStatistics
.
setCount
(
0
);
workingHoursStatistics
.
setCount
(
0
);
workingHoursStatistics
.
setWorkTime
(
0
);
workingHoursStatistics
.
setWorkTime
(
0
);
monthlyWorkingHoursStatistics
.
add
(
i
,
workingHoursStatistics
);
monthlyWorkingHoursStatistics
.
add
(
i
,
workingHoursStatistics
);
}
}
}
}
...
@@ -346,7 +346,7 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -346,7 +346,7 @@ public class StatisticsServiceImpl implements StatisticsService {
WorkTimeAndCostCollect
workTimeAndCostCollect1
=
new
WorkTimeAndCostCollect
();
WorkTimeAndCostCollect
workTimeAndCostCollect1
=
new
WorkTimeAndCostCollect
();
workTimeAndCostCollect1
.
setType
(
workType
.
getId
());
workTimeAndCostCollect1
.
setType
(
workType
.
getId
());
workTimeAndCostCollect1
.
setTypeName
(
workType
.
getName
());
workTimeAndCostCollect1
.
setTypeName
(
workType
.
getName
());
workTimeAndCostCollects
.
add
(
i
,
workTimeAndCostCollect1
);
workTimeAndCostCollects
.
add
(
i
,
workTimeAndCostCollect1
);
}
}
}
}
}
}
...
@@ -756,6 +756,7 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -756,6 +756,7 @@ public class StatisticsServiceImpl implements StatisticsService {
HSSFWorkbook
sheets
=
new
HSSFWorkbook
();
HSSFWorkbook
sheets
=
new
HSSFWorkbook
();
HSSFSheet
sheet1
=
sheets
.
createSheet
(
"sheet1"
);
HSSFSheet
sheet1
=
sheets
.
createSheet
(
"sheet1"
);
sheet1
.
setColumnWidth
(
1
,
EXCEL_WIDTH
);
// 第0行,存部门名称和时间
// 第0行,存部门名称和时间
HSSFRow
row0
=
sheet1
.
createRow
(
0
);
HSSFRow
row0
=
sheet1
.
createRow
(
0
);
...
@@ -770,8 +771,15 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -770,8 +771,15 @@ public class StatisticsServiceImpl implements StatisticsService {
HSSFRow
row_1
=
sheet1
.
createRow
(
1
);
HSSFRow
row_1
=
sheet1
.
createRow
(
1
);
HSSFCell
row_1Cell1
=
row_1
.
createCell
(
0
);
HSSFCell
row_1Cell1
=
row_1
.
createCell
(
0
);
row_1Cell1
.
setCellValue
(
"序号"
);
row_1Cell1
.
setCellValue
(
"序号"
);
// 单位\姓名
HSSFCell
row_1Cell2
=
row_1
.
createCell
(
1
);
HSSFCell
row_1Cell2
=
row_1
.
createCell
(
1
);
row_1Cell2
.
setCellValue
(
"人员"
);
row_1Cell2
.
setCellValue
(
" 单位(小时)\n 姓名"
);
// 画斜线
HSSFPatriarch
drawingPatriarch
=
sheet1
.
createDrawingPatriarch
();
HSSFClientAnchor
hssfClientAnchor
=
new
HSSFClientAnchor
(
0
,
0
,
1023
,
255
,
(
short
)
1
,
1
,
(
short
)
1
,
2
);
HSSFSimpleShape
simpleShape
=
drawingPatriarch
.
createSimpleShape
(
hssfClientAnchor
);
simpleShape
.
setShapeType
(
HSSFSimpleShape
.
OBJECT_TYPE_LINE
);
simpleShape
.
setLineStyle
(
HSSFSimpleShape
.
LINESTYLE_SOLID
);
// 合计行
// 合计行
HSSFRow
totalRow1
=
sheet1
.
createRow
(
userWorkTimeStatisticsReport
.
size
()
+
1
);
HSSFRow
totalRow1
=
sheet1
.
createRow
(
userWorkTimeStatisticsReport
.
size
()
+
1
);
...
@@ -864,7 +872,8 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -864,7 +872,8 @@ public class StatisticsServiceImpl implements StatisticsService {
}
}
}
}
// 个人合计
// 个人合计
row_i
.
createCell
(
row1_lastCellNum
).
setCellValue
(
userWorkTimeStatisticsByProject1
.
getTotalTime
());
short
lastCellNum
=
totalRow1
.
getLastCellNum
();
row_i
.
createCell
(
lastCellNum
-
1
).
setCellValue
(
userWorkTimeStatisticsByProject1
.
getTotalTime
());
}
}
// 合并单元格,第一行
// 合并单元格,第一行
...
@@ -885,7 +894,7 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -885,7 +894,7 @@ public class StatisticsServiceImpl implements StatisticsService {
setBorderStyle
(
BorderStyle
.
THIN
,
cellRangeAddress3
,
sheet1
);
setBorderStyle
(
BorderStyle
.
THIN
,
cellRangeAddress3
,
sheet1
);
// 项目行和总计行,正常工时和加班工时表头列数
// 项目行和总计行,正常工时和加班工时表头列数
short
lastCellNum
=
row_2
.
getLastCellNum
();
short
lastCellNum
=
row_2
.
getLastCellNum
();
for
(
int
i
=
0
;
i
<
lastCellNum
/
2
;
i
++)
{
for
(
int
i
=
0
;
i
<
lastCellNum
/
2
;
i
++)
{
// 总计行
// 总计行
CellRangeAddress
cellRangeAddress4
=
new
CellRangeAddress
(
userWorkTimeStatisticsReport
.
size
()
+
2
,
userWorkTimeStatisticsReport
.
size
()
+
2
,
i
*
2
,
i
*
2
+
1
);
CellRangeAddress
cellRangeAddress4
=
new
CellRangeAddress
(
userWorkTimeStatisticsReport
.
size
()
+
2
,
userWorkTimeStatisticsReport
.
size
()
+
2
,
i
*
2
,
i
*
2
+
1
);
sheet1
.
addMergedRegion
(
cellRangeAddress4
);
sheet1
.
addMergedRegion
(
cellRangeAddress4
);
...
@@ -909,6 +918,11 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -909,6 +918,11 @@ public class StatisticsServiceImpl implements StatisticsService {
}
}
sheet1
.
getRow
(
0
).
getCell
(
0
).
setCellStyle
(
ordinaryCellStyle1
);
sheet1
.
getRow
(
0
).
getCell
(
0
).
setCellStyle
(
ordinaryCellStyle1
);
// 设置姓名\单位(小时)单元格德样式,左对齐
HSSFCellStyle
ordinaryCellStyle3
=
this
.
createOrdinaryCellStyle
(
sheets
);
ordinaryCellStyle3
.
setAlignment
(
HorizontalAlignment
.
LEFT
);
row_1Cell2
.
setCellStyle
(
ordinaryCellStyle3
);
this
.
closeSheets
(
sheets
);
this
.
closeSheets
(
sheets
);
return
sheets
;
return
sheets
;
}
}
...
@@ -1279,7 +1293,7 @@ public class StatisticsServiceImpl implements StatisticsService {
...
@@ -1279,7 +1293,7 @@ public class StatisticsServiceImpl implements StatisticsService {
}
}
// 返回一个空的Excel
// 返回一个空的Excel
public
HSSFWorkbook
creatEmptyHSSFWorkbook
(){
public
HSSFWorkbook
creatEmptyHSSFWorkbook
()
{
HSSFWorkbook
sheets
=
new
HSSFWorkbook
();
HSSFWorkbook
sheets
=
new
HSSFWorkbook
();
HSSFSheet
sheet
=
sheets
.
createSheet
();
HSSFSheet
sheet
=
sheets
.
createSheet
();
sheet
.
createRow
(
0
).
createCell
(
0
).
setCellValue
(
"暂无数据"
);
sheet
.
createRow
(
0
).
createCell
(
0
).
setCellValue
(
"暂无数据"
);
...
...
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