Commit 6cd98b2a authored by nie'hong's avatar nie'hong

完善工时统计

parent fdbb1ca4
......@@ -207,7 +207,7 @@
</select>
<select id="listByDateAndUserId" resultMap="dayWorkTimeAndType">
select user_id,day(work_day),CASE when `type` = 3 then "请假" when `type` = 4 then "调休" else "正常" end AS `type`,
select user_id,day(work_day),CASE when `type` = 3 then "请假" when `type` = 4 then "调休" else if(is_overtime = 0,"正常","加班") end AS `type`,
sum(work_time)
from
<include refid="table"/>
......@@ -215,7 +215,7 @@
<foreach collection="userIds" separator="," close=")" item="userId" open="(">
#{userId}
</foreach>
group by user_id,day(work_day), CASE when `type` = 3 then "请假" when `type` = 4 then "调休" else "正常" end
group by user_id,day(work_day), CASE when `type` = 3 then "请假" when `type` = 4 then "调休" else if(is_overtime = 0,"正常","加班") end
order by day(work_day)
</select>
......
......@@ -770,7 +770,7 @@ public class StatisticsServiceImpl implements StatisticsService {
HSSFWorkbook sheets = new HSSFWorkbook();
HSSFSheet sheet1 = sheets.createSheet("sheet1");
sheet1.setColumnWidth(1,EXCEL_WIDTH);
sheet1.setColumnWidth(1, EXCEL_WIDTH);
// 第0行,存部门名称和时间
HSSFRow row0 = sheet1.createRow(0);
......@@ -788,12 +788,7 @@ public class StatisticsServiceImpl implements StatisticsService {
// 单位\姓名
HSSFCell row_1Cell2 = row_1.createCell(1);
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);
setDrawingPatriarch(sheet1, 0, 0, 1023, 255, (short) 1, 1, (short) 1, 2);
// 合计行
HSSFRow totalRow1 = sheet1.createRow(userWorkTimeStatisticsReport.size() + 1);
......@@ -945,7 +940,7 @@ public class StatisticsServiceImpl implements StatisticsService {
HSSFCellStyle ordinaryCellStyle3 = this.createOrdinaryCellStyle(sheets);
ordinaryCellStyle3.setAlignment(HorizontalAlignment.LEFT);
row_1Cell2.setCellStyle(ordinaryCellStyle3);
sheet1.setZoom(8,5);
sheet1.setZoom(6, 5);
this.closeSheets(sheets);
return sheets;
}
......@@ -1015,7 +1010,6 @@ public class StatisticsServiceImpl implements StatisticsService {
this.conversionDateFormat(projectStatisticsByMonths2, yearMonthList, null, false);
HSSFWorkbook sheets = new HSSFWorkbook();
for (ProjectStatisticsByMonth projectStatisticsByMonth : projectStatisticsByMonths) {
// 项目名作为sheet名
......@@ -1023,7 +1017,7 @@ public class StatisticsServiceImpl implements StatisticsService {
// sheet名不能存在“/”
String s = projectName.replaceAll("/", "_");
HSSFSheet sheet = sheets.createSheet(s);
sheet.setColumnWidth(2, EXCEL_WIDTH);
// 普通样式
HSSFCellStyle ordinaryCellStyle = this.createOrdinaryCellStyle(sheets);
// 将人员所在部门列宽加宽
......@@ -1056,11 +1050,16 @@ public class StatisticsServiceImpl implements StatisticsService {
// 部门的表头
row_last.createCell(0).setCellValue("人员所在部门");
row_last.createCell(1).setCellValue("序号");
row_last.createCell(2).setCellValue("人员");
row_last.createCell(2).setCellValue(" 单位(人*天)\n 姓名");
// 画斜线
setDrawingPatriarch(sheet, 0, 0, 1023, 255, (short) 2, lastRowNum + 1, (short) 2, lastRowNum + 1);
for (int i = 0; i < 12; i++) {
row_last.createCell(i + 3).setCellValue(i + 1 + "月");
}
row_last.createCell(15).setCellValue("合计");
// 设置行高
row_last.setHeight((short) 500);
// 部门下的人员的统计
for (int i = 0, k = 0; i < projectStatisticsByMonths2.size(); i++) {
......@@ -1361,5 +1360,12 @@ public class StatisticsServiceImpl implements StatisticsService {
return sheets;
}
// 画斜线
private void setDrawingPatriarch(HSSFSheet sheet1, int dx1, int dy1, int dx2, int dy2, short col1, int row1, short col2, int row2) {
HSSFPatriarch drawingPatriarch = sheet1.createDrawingPatriarch();
HSSFClientAnchor hssfClientAnchor = new HSSFClientAnchor(dx1, dy1, dx2, dy2, col1, row1, col2, row2);
HSSFSimpleShape simpleShape = drawingPatriarch.createSimpleShape(hssfClientAnchor);
simpleShape.setShapeType(HSSFSimpleShape.OBJECT_TYPE_LINE);
simpleShape.setLineStyle(HSSFSimpleShape.LINESTYLE_SOLID);
}
}
......@@ -35,8 +35,6 @@ public abstract class BaseController {
protected Logger log = LoggerFactory.getLogger(this.getClass());
/**
* 应用接口异常处理
*
......
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