职工福利-选择福利统计-新增: 导出选择福利统计表;
This commit is contained in:
+47
@@ -853,6 +853,53 @@ public class WelfareSingleController {
|
||||
|
||||
}
|
||||
|
||||
@At
|
||||
@ViReturn
|
||||
@Ok("void")
|
||||
@RequiresPermissions("welfare.project.statistics.single")
|
||||
public void statisticsExport(String projectId, HttpServletResponse response) {
|
||||
WelfareProject welfareProject = dao.fetch(WelfareProject.class, Cnd.where("id", "=", projectId));
|
||||
String projectName = welfareProject.getName();
|
||||
|
||||
NutMap nutMap = welfareSingleService.pageData(projectId, "", "", "", "");
|
||||
List<NutMap> tableList = nutMap.getAsList("tableList", NutMap.class);
|
||||
// Json.fromJsonAsList()
|
||||
for (NutMap map : tableList) {
|
||||
boolean isAudit = (boolean) map.get("isAudit");
|
||||
map.setv("isAudit", isAudit ? "已核对" : "未核对");
|
||||
}
|
||||
|
||||
List<ExcelExportEntity> exportEntities = new ArrayList<>();
|
||||
exportEntities.add(new ExcelExportEntity("所属工会", "welfareUnitName", 50));
|
||||
exportEntities.add(new ExcelExportEntity("本次福利会员人数", "teacherSum", 20));
|
||||
//传入动态列 tableColumn
|
||||
List<NutMap> labelList = nutMap.getAsList("tableColumn", NutMap.class);
|
||||
for (NutMap labeMap : labelList) {
|
||||
exportEntities.add(new ExcelExportEntity(labeMap.getString("label"), labeMap.get("prop"), 20));
|
||||
}
|
||||
exportEntities.add(new ExcelExportEntity("参加人数", "totalCount", 20));
|
||||
exportEntities.add(new ExcelExportEntity("未选人数", "unselectedTeacherSum", 20));
|
||||
exportEntities.add(new ExcelExportEntity("是否核对", "isAudit", 20));
|
||||
|
||||
|
||||
|
||||
Workbook workbook = new XSSFWorkbook();
|
||||
ExcelExportService service = new ExcelExportService();
|
||||
ExportParams exportParams = new ExportParams();
|
||||
exportParams.setType(ExcelType.XSSF);
|
||||
exportParams.setTitle(projectName + "选择统计");
|
||||
exportParams.setSheetName(projectName);
|
||||
service.createSheetForMap(workbook, exportParams, exportEntities, tableList);
|
||||
|
||||
try (ServletOutputStream outputStream = response.getOutputStream()) {
|
||||
ViTool.excelResponse(response, projectName + "选择统计.xlsx");
|
||||
workbook.write(outputStream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
public static class qlbExportEntityUser {
|
||||
|
||||
Reference in New Issue
Block a user