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

导出设置格式

parent 8d1d919b
...@@ -49,6 +49,8 @@ public interface WorkTimeOrderMapper extends BaseMapper<WorkTimeOrder> { ...@@ -49,6 +49,8 @@ public interface WorkTimeOrderMapper extends BaseMapper<WorkTimeOrder> {
List<MonthlyWorkingHoursStatistics> statisticsByProjectType(@Param("userId") Integer userId, @Param("currentMonthFirstDay") Date currentMonthFirstDay); List<MonthlyWorkingHoursStatistics> statisticsByProjectType(@Param("userId") Integer userId, @Param("currentMonthFirstDay") Date currentMonthFirstDay);
/** /**
* 获取用户在某月的工时、工时类型、工单日期
*
* @param year * @param year
* @param month * @param month
* @param userIds * @param userIds
......
...@@ -28,6 +28,11 @@ public interface WorkUserMapper extends BaseMapper<WorkUser> { ...@@ -28,6 +28,11 @@ public interface WorkUserMapper extends BaseMapper<WorkUser> {
Integer updateUserInfo(WorkUser user); Integer updateUserInfo(WorkUser user);
/**
* 获取用户主键、姓名、部门名称
* @param userIds
* @return
*/
List<StatisticsTableDto> getStatisticsTableDtos(List<Integer> userIds); List<StatisticsTableDto> getStatisticsTableDtos(List<Integer> userIds);
} }
...@@ -26,6 +26,7 @@ import com.github.pagehelper.PageHelper; ...@@ -26,6 +26,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.hssf.usermodel.*; import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment; import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -124,7 +125,6 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -124,7 +125,6 @@ public class StatisticsServiceImpl implements StatisticsService {
} }
} }
statisticsTableDto.setDayWorkTimeAndTypeList(dayWorkTimeAndTypes1); statisticsTableDto.setDayWorkTimeAndTypeList(dayWorkTimeAndTypes1);
} }
pageInfo.setList(statisticsTableDtos); pageInfo.setList(statisticsTableDtos);
return pageInfo; return pageInfo;
...@@ -251,6 +251,7 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -251,6 +251,7 @@ public class StatisticsServiceImpl implements StatisticsService {
// 垂直、水平中心对齐 // 垂直、水平中心对齐
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER); cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
cellStyle.setAlignment(HorizontalAlignment.CENTER); cellStyle.setAlignment(HorizontalAlignment.CENTER);
cellStyle.setWrapText(true);
// 第一列列宽 // 第一列列宽
sheet.setColumnWidth(1, EXCEL_WIDTH); sheet.setColumnWidth(1, EXCEL_WIDTH);
// 创建一行 // 创建一行
...@@ -288,9 +289,12 @@ public class StatisticsServiceImpl implements StatisticsService { ...@@ -288,9 +289,12 @@ public class StatisticsServiceImpl implements StatisticsService {
} else { } else {
HSSFCell emptyCell = row_i.createCell(timeAndType.getDay() + 2); HSSFCell emptyCell = row_i.createCell(timeAndType.getDay() + 2);
emptyCell.setCellValue(timeAndType.getType() + timeAndType.getWorkTime().toString()); emptyCell.setCellValue(timeAndType.getType() + timeAndType.getWorkTime().toString());
emptyCell.setCellStyle(cellStyle);
} }
} }
// 给该行每个单元格设置单元格样式
for (Cell cell : row_i) {
cell.setCellStyle(cellStyle);
}
// 换行 // 换行
i++; i++;
} }
......
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