Commit c222aa80 authored by nie'hong's avatar nie'hong

完善工时统计

parent d92463ef
......@@ -247,7 +247,7 @@ public class StatisticsServiceImpl implements StatisticsService {
workingHoursStatistics.setProjectType(workType.getId());
workingHoursStatistics.setCount(0);
workingHoursStatistics.setWorkTime(0);
monthlyWorkingHoursStatistics.add(i,workingHoursStatistics);
monthlyWorkingHoursStatistics.add(i, workingHoursStatistics);
}
}
......@@ -346,7 +346,7 @@ public class StatisticsServiceImpl implements StatisticsService {
WorkTimeAndCostCollect workTimeAndCostCollect1 = new WorkTimeAndCostCollect();
workTimeAndCostCollect1.setType(workType.getId());
workTimeAndCostCollect1.setTypeName(workType.getName());
workTimeAndCostCollects.add(i,workTimeAndCostCollect1);
workTimeAndCostCollects.add(i, workTimeAndCostCollect1);
}
}
}
......@@ -756,6 +756,7 @@ public class StatisticsServiceImpl implements StatisticsService {
HSSFWorkbook sheets = new HSSFWorkbook();
HSSFSheet sheet1 = sheets.createSheet("sheet1");
sheet1.setColumnWidth(1,EXCEL_WIDTH);
// 第0行,存部门名称和时间
HSSFRow row0 = sheet1.createRow(0);
......@@ -770,8 +771,15 @@ public class StatisticsServiceImpl implements StatisticsService {
HSSFRow row_1 = sheet1.createRow(1);
HSSFCell row_1Cell1 = row_1.createCell(0);
row_1Cell1.setCellValue("序号");
// 单位\姓名
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);
......@@ -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 {
setBorderStyle(BorderStyle.THIN, cellRangeAddress3, sheet1);
// 项目行和总计行,正常工时和加班工时表头列数
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);
sheet1.addMergedRegion(cellRangeAddress4);
......@@ -909,6 +918,11 @@ public class StatisticsServiceImpl implements StatisticsService {
}
sheet1.getRow(0).getCell(0).setCellStyle(ordinaryCellStyle1);
// 设置姓名\单位(小时)单元格德样式,左对齐
HSSFCellStyle ordinaryCellStyle3 = this.createOrdinaryCellStyle(sheets);
ordinaryCellStyle3.setAlignment(HorizontalAlignment.LEFT);
row_1Cell2.setCellStyle(ordinaryCellStyle3);
this.closeSheets(sheets);
return sheets;
}
......@@ -1279,7 +1293,7 @@ public class StatisticsServiceImpl implements StatisticsService {
}
// 返回一个空的Excel
public HSSFWorkbook creatEmptyHSSFWorkbook(){
public HSSFWorkbook creatEmptyHSSFWorkbook() {
HSSFWorkbook sheets = new HSSFWorkbook();
HSSFSheet sheet = sheets.createSheet();
sheet.createRow(0).createCell(0).setCellValue("暂无数据");
......
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