Commit 9b707d69 authored by nie'hong's avatar nie'hong

完善工时统计

parent 74477e43
...@@ -776,8 +776,9 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -776,8 +776,9 @@ public class StatisticsServiceImpl implements StatisticsService {
// 项目行 // 项目行
HSSFRow row_2 = sheet1.createRow(2); HSSFRow row_2 = sheet1.createRow(2);
for (int i = 0; i < projectWorkTimeAndType.size(); i++) { for (int i = 0; i < projectWorkTimeAndType.size(); i++) {
// 项目名称 // 项目名称单元格
HSSFCell row_1Cell; HSSFCell row_1Cell;
// 总计行单元格
HSSFCell totalRow2Cell; HSSFCell totalRow2Cell;
if (!"请假".equals(projectWorkTimeAndType.get(i).getProjectName()) && !"调休".equals(projectWorkTimeAndType.get(i).getProjectName())) { if (!"请假".equals(projectWorkTimeAndType.get(i).getProjectName()) && !"调休".equals(projectWorkTimeAndType.get(i).getProjectName())) {
// 项目名称或类型名称 // 项目名称或类型名称
...@@ -786,42 +787,27 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -786,42 +787,27 @@ public class StatisticsServiceImpl implements StatisticsService {
// 正常工时 // 正常工时
HSSFCell row2Cell = row_2.createCell((i + 1) * 2); HSSFCell row2Cell = row_2.createCell((i + 1) * 2);
row2Cell.setCellValue("正常工时"); row2Cell.setCellValue("正常工时");
// 该项目正常工时合计
HSSFCell cell1 = totalRow1.createCell((i + 1) * 2); HSSFCell cell1 = totalRow1.createCell((i + 1) * 2);
cell1.setCellValue(projectWorkTimeAndType.get(i).getNormalTime()); cell1.setCellValue(projectWorkTimeAndType.get(i).getNormalTime());
// 加班工时 // 加班工时
HSSFCell row2Cell1 = row_2.createCell((i + 1) * 2 + 1); HSSFCell row2Cell1 = row_2.createCell((i + 1) * 2 + 1);
row2Cell1.setCellValue("加班工时"); row2Cell1.setCellValue("加班工时");
// 该项目加班工时合计
HSSFCell cell2 = totalRow1.createCell((i + 1) * 2 + 1); HSSFCell cell2 = totalRow1.createCell((i + 1) * 2 + 1);
cell2.setCellValue(projectWorkTimeAndType.get(i).getOverTime()); cell2.setCellValue(projectWorkTimeAndType.get(i).getOverTime());
} else { } else {
// 调休和请假没有加班工时和正常工时之分 // 加班工时和正常工时行最后的
row_1Cell = row_1.createCell((i + 1) * 2); short lastCellNum = row_2.getLastCellNum();
// 调休和请假的类型名单元格
row_1Cell = row_1.createCell(lastCellNum);
// 请假或调休的总计单元格
totalRow2Cell = totalRow2.createCell(lastCellNum);
// 类型名称
row_1Cell.setCellValue(projectWorkTimeAndType.get(i).getProjectName()); row_1Cell.setCellValue(projectWorkTimeAndType.get(i).getProjectName());
// 请假合计 // 请假或调休合计
HSSFCell cell1 = totalRow1.createCell((i + 1) * 2); HSSFCell cell1 = totalRow1.createCell(lastCellNum);
cell1.setCellValue(projectWorkTimeAndType.get(i).getNormalTime()); cell1.setCellValue(projectWorkTimeAndType.get(i).getNormalTime());
// 请假总计
HSSFCell cell3 = totalRow2.createCell((i + 1) * 2);
cell3.setCellValue(projectWorkTimeAndType.get(i).getNormalTime());
i++;
row_1Cell = row_1.createCell((i + 1) * 2 - 1);
row_1Cell.setCellValue(projectWorkTimeAndType.get(i).getProjectName());
// 调休合计
HSSFCell cell2 = totalRow1.createCell((i + 1) * 2 - 1);
cell2.setCellValue(projectWorkTimeAndType.get(i).getNormalTime());
// 调休总计
HSSFCell cell4 = totalRow2.createCell((i + 1) * 2 - 1);
cell4.setCellValue(projectWorkTimeAndType.get(i).getNormalTime());
// 合计行的合计
HSSFCell cell5 = totalRow1.createCell((i + 1) * 2);
cell5.setCellValue(userWorkTimeStatisticsByProject.getTotalTime());
// 总计行的合计
HSSFCell cell6 = totalRow2.createCell((i + 1) * 2);
cell6.setCellValue(userWorkTimeStatisticsByProject.getTotalTime());
break;
} }
row_1Cell.setCellValue(projectWorkTimeAndType.get(i).getProjectName()); row_1Cell.setCellValue(projectWorkTimeAndType.get(i).getProjectName());
totalRow2Cell.setCellValue(projectWorkTimeAndType.get(i).getTotalTime()); totalRow2Cell.setCellValue(projectWorkTimeAndType.get(i).getTotalTime());
...@@ -831,8 +817,12 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -831,8 +817,12 @@ public class StatisticsServiceImpl implements StatisticsService {
short row1_lastCellNum = row_1.getLastCellNum(); short row1_lastCellNum = row_1.getLastCellNum();
if (lastProjectName.equals("请假") || lastProjectName.equals("调休")) { if (lastProjectName.equals("请假") || lastProjectName.equals("调休")) {
row_1.createCell(row1_lastCellNum).setCellValue("合计"); row_1.createCell(row1_lastCellNum).setCellValue("合计");
totalRow1.createCell(row1_lastCellNum).setCellValue(userWorkTimeStatisticsByProject.getTotalTime());
totalRow2.createCell(row1_lastCellNum).setCellValue(userWorkTimeStatisticsByProject.getTotalTime());
} else { } else {
row_1.createCell(row1_lastCellNum + 1).setCellValue("合计"); row_1.createCell(row1_lastCellNum + 1).setCellValue("合计");
totalRow1.createCell(row1_lastCellNum + 1).setCellValue(userWorkTimeStatisticsByProject.getTotalTime());
totalRow2.createCell(row1_lastCellNum + 1).setCellValue(userWorkTimeStatisticsByProject.getTotalTime());
} }
for (int i = 0; i < userWorkTimeStatisticsReport.size() - 2; i++) { for (int i = 0; i < userWorkTimeStatisticsReport.size() - 2; i++) {
...@@ -1136,7 +1126,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -1136,7 +1126,7 @@ public class StatisticsServiceImpl implements StatisticsService {
String date = new String(); String date = new String();
if (i < statisticsDateAndWorkTimes.size()) { if (i < statisticsDateAndWorkTimes.size()) {
date = statisticsDateAndWorkTimes.get(i).getDate(); date = statisticsDateAndWorkTimes.get(i).getDate();
}else { } else {
break; break;
} }
// 时间不连续,创建对象 // 时间不连续,创建对象
...@@ -1268,7 +1258,8 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -1268,7 +1258,8 @@ public class StatisticsServiceImpl implements StatisticsService {
} }
} }
} }
public void closeSheets(HSSFWorkbook sheets ){
public void closeSheets(HSSFWorkbook sheets) {
try { try {
sheets.close(); sheets.close();
} catch (IOException e) { } catch (IOException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment