三表一册导出

This commit is contained in:
lSun 2026-01-09 13:32:08 +08:00
parent ab5840c3ec
commit e5253276ee
3 changed files with 96 additions and 39 deletions

View File

@ -460,10 +460,10 @@ public class PmProjectController extends BaseController {
List<ProMonthTableRosterVo> res = pmProjectService.getProMonthTableRosterList(proMonthTableRosterVo);
ExcelUtil<ProMonthTableRosterVo> util = new ExcelUtil<ProMonthTableRosterVo>(ProMonthTableRosterVo.class);
List<String> titles = new ArrayList<>();
titles.add("农民工花名册");
titles.add("施工人员花名册");
titles.add("工程名称:"+proMonthTableRosterVo.getProName());
List<String> tails = new ArrayList<>();
util.exportExcel(response, res, "导出农民工花名册",titles,tails);
util.exportExcel(response, res, "花名册",titles,tails);
} catch (Exception e) {
logger.error(e.toString(), e);
}
@ -484,7 +484,8 @@ public class PmProjectController extends BaseController {
List<String> tails = new ArrayList<>();
tails.add("分包单位(章) 施工项目部(章) 监理项目部(章)");
tails.add("法定代表人/授权委托人: 项目经理: 总/专业监理工程师:");
util.exportExcel(response, res, "农民工实名制工资信息报审", titles, tails);
tails.add("1.本表由分包单位进场前编制附农民工与分包单位的用工合同复印件、身份证复印件、银行卡复印件。2.本信息备案表一式三份,分包单位、监理项目部、施工项目部各留存一份。");
util.exportExcel(response, res, "信息报审表", titles, tails);
} catch (Exception e) {
logger.error(e.toString(), e);
}
@ -532,7 +533,7 @@ public class PmProjectController extends BaseController {
Row myTitleRow = sheet.createRow(0);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 8+WorkerAttDayVoList.size()));
Cell cell00 = myTitleRow.createCell(0);
cell00.setCellValue("分包人员考勤明细");
cell00.setCellValue( userAttendanceVo.getMonth() +"施工人员考勤记录");
cell00.setCellStyle(styles.get("title")); // 应用标准表头样式
Row myTitleRow2 = sheet.createRow(1);
@ -543,9 +544,9 @@ public class PmProjectController extends BaseController {
Cell cell11 = myTitleRow2.createCell(0);
cell11.setCellValue("工程:"+userAttendanceVo.getProName());
cell11.setCellStyle(styles.get("noBorderData"));
Cell cell13 = myTitleRow2.createCell(3);
cell13.setCellValue(userAttendanceVo.getMonth());
cell13.setCellStyle(styles.get("noBorderData"));
// Cell cell13 = myTitleRow2.createCell(3);
// cell13.setCellValue(userAttendanceVo.getMonth());
// cell13.setCellStyle(styles.get("noBorderData"));
Cell cell1x = myTitleRow2.createCell(5+WorkerAttDayVoList.size());
cell1x.setCellValue("出勤1 缺勤0 无对应日期:空白");
cell1x.setCellStyle(styles.get("noBorderData"));
@ -644,36 +645,49 @@ public class PmProjectController extends BaseController {
//构建单独的头部
//第一行
Row myTitleRow = sheet.createRow(0);
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 16));
sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 17));
Cell cell00 = myTitleRow.createCell(0);
cell00.setCellValue("农 民 工 工 资 支 付 表");
cell00.setCellValue("施工人员工资支付表(" + userWagePayVo.getMonth() + "");
cell00.setCellStyle(styles.get("title"));
//第二行
Row myTitleRow2 = sheet.createRow(1);
sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 16));
Cell cell10 = myTitleRow2.createCell(0);
cell10.setCellValue("日期:"+userWagePayVo.getMonth());
cell10.setCellStyle(styles.get("noBorderData"));
// Row myTitleRow2 = sheet.createRow(1);
// sheet.addMergedRegion(new CellRangeAddress(1, 1, 0, 16));
// Cell cell10 = myTitleRow2.createCell(0);
// cell10.setCellValue("日期:"+userWagePayVo.getMonth());
// cell10.setCellStyle(styles.get("noBorderData"));
//第三行
Row myTitleRow3 = sheet.createRow(2);
Row myTitleRow3 = sheet.createRow(1);
Cell cell20 = myTitleRow3.createCell(0);
cell20.setCellValue("工程名称:"+userWagePayVo.getProName());
cell20.setCellStyle(styles.get("noBorderData"));
Cell cell116 = myTitleRow3.createCell(16);
Cell cell116 = myTitleRow3.createCell(17);
cell116.setCellValue("金额单位:元");
cell116.setCellStyle(styles.get("noBorderData"));
//第四行
Row myTitleRow4 = sheet.createRow(3);
sheet.addMergedRegion(new CellRangeAddress(3, 3, 0, 13));
sheet.addMergedRegion(new CellRangeAddress(3, 3, 14, 16));
Row myTitleRow4 = sheet.createRow(2);
sheet.addMergedRegion(new CellRangeAddress(2, 2, 0, 13));
// sheet.addMergedRegion(new CellRangeAddress(2, 2, 14, 14));
// sheet.addMergedRegion(new CellRangeAddress(2, 2, 15, 15));
sheet.addMergedRegion(new CellRangeAddress(2, 2, 16, 17));
Cell cell30 = myTitleRow4.createCell(0);
cell30.setCellValue("分包单位填写");
cell30.setCellStyle(styles.get("noBorderData"));
Cell cell314 = myTitleRow4.createCell(14);
cell314.setCellValue("施工总承包单位填写");
cell314.setCellValue("监理单位填写");
cell314.setCellStyle(styles.get("noBorderData"));
Cell cell315 = myTitleRow4.createCell(15);
cell315.setCellValue("建管单位填写");
cell315.setCellStyle(styles.get("noBorderData"));
Cell cell316 = myTitleRow4.createCell(16);
cell316.setCellValue("施工总承包单位填写");
cell316.setCellStyle(styles.get("noBorderData"));
//第五行
Row headerRow = sheet.createRow(4);
Row headerRow = sheet.createRow(3);
ArrayList<Object> headers = new ArrayList<>();
headers.add("序号");
headers.add("姓名");
@ -689,9 +703,32 @@ public class PmProjectController extends BaseController {
headers.add("银行卡号");
headers.add("是否与劳动合同约定一致");
headers.add("本人签字");
headers.add("备注");
headers.add("是否为“e基建”内人员");
headers.add("是否通过“e基建”外人员审批");
headers.add("转账日期");
headers.add("银行凭证号");
// 设置列宽单位字符宽度 * 256
// 注意列索引从0开始
sheet.setColumnWidth(0, 8 * 256); // 序号 - 8个字符宽
sheet.setColumnWidth(1, 10 * 256); // 姓名 - 10个字符宽
sheet.setColumnWidth(2, 25 * 256); // 身份证号 - 25个字符宽18位身份证需要
sheet.setColumnWidth(3, 15 * 256); // 所在班组 - 15个字符宽
sheet.setColumnWidth(4, 15 * 256); // 岗位 - 15个字符宽
sheet.setColumnWidth(5, 12 * 256); // 出勤天数 - 12个字符宽
sheet.setColumnWidth(6, 12 * 256); // 应发工资 - 12个字符宽
sheet.setColumnWidth(7, 18 * 256); // 其中代扣/代缴 - 18个字符宽
sheet.setColumnWidth(8, 12 * 256); // 实发工资 - 12个字符宽
sheet.setColumnWidth(9, 20 * 256); // 开户银行 - 20个字符宽
sheet.setColumnWidth(10, 20 * 256); // 收款银行联行号 - 20个字符宽
sheet.setColumnWidth(11, 25 * 256); // 银行卡号 - 25个字符宽
sheet.setColumnWidth(12, 25 * 256); // 是否与劳动合同约定一致 - 25个字符宽
sheet.setColumnWidth(13, 12 * 256); // 本人签字 - 12个字符宽
sheet.setColumnWidth(14, 25 * 256); // 是否为"e基建"内人员 - 25个字符宽
sheet.setColumnWidth(15, 30 * 256); // 是否通过"e基建"外人员审批 - 30个字符宽
sheet.setColumnWidth(16, 15 * 256); // 转账日期 - 15个字符宽
sheet.setColumnWidth(17, 20 * 256); // 银行凭证号 - 20个字符宽
for (int i = 0; i < headers.size(); i++) {
Cell cell = headerRow.createCell(i);
cell.setCellValue(headers.get(i).toString());
@ -701,27 +738,34 @@ public class PmProjectController extends BaseController {
// 填充数据行
for (int i = 0; i < res.size(); i++) {
UserWagePayVo userAttendanceVoNew = res.get(i);
Row dataRow = sheet.createRow(i + 5);
Row dataRow = sheet.createRow(i + 4);
dataRow.createCell(0).setCellValue(i+1);
dataRow.createCell(1).setCellValue(userAttendanceVoNew.getUserName());
dataRow.createCell(2).setCellValue(userAttendanceVoNew.getIdCard());
dataRow.createCell(3).setCellValue(userAttendanceVoNew.getTeamName());
dataRow.createCell(4).setCellValue(userAttendanceVoNew.getIdCard());
dataRow.createCell(5).setCellValue(userAttendanceVoNew.getWorkName());
dataRow.createCell(6).setCellValue(userAttendanceVoNew.getAttendanceNum());
dataRow.createCell(7).setCellValue(String.valueOf(userAttendanceVoNew.getPayMoney()));
dataRow.createCell(8).setCellValue(String.valueOf(userAttendanceVoNew.getDeductMoney()));
dataRow.createCell(9).setCellValue(String.valueOf(userAttendanceVoNew.getActualMoney()));
dataRow.createCell(10).setCellValue(userAttendanceVoNew.getBankName());
dataRow.createCell(11).setCellValue(userAttendanceVoNew.getBankNum());
dataRow.createCell(12).setCellValue(userAttendanceVoNew.getBankCode());
dataRow.createCell(13).setCellValue(userAttendanceVoNew.getIsAccord());
dataRow.createCell(14).setCellValue(userAttendanceVoNew.getSignature());
dataRow.createCell(15).setCellValue(userAttendanceVoNew.getRemark());
// dataRow.createCell(4).setCellValue(userAttendanceVoNew.getIdCard());
dataRow.createCell(4).setCellValue(userAttendanceVoNew.getWorkName());
dataRow.createCell(5).setCellValue(userAttendanceVoNew.getAttendanceNum());
dataRow.createCell(6).setCellValue(String.valueOf(userAttendanceVoNew.getPayMoney()));
dataRow.createCell(7).setCellValue(String.valueOf(userAttendanceVoNew.getDeductMoney()));
dataRow.createCell(8).setCellValue(String.valueOf(userAttendanceVoNew.getActualMoney()));
dataRow.createCell(9).setCellValue(userAttendanceVoNew.getBankName());
dataRow.createCell(10).setCellValue(userAttendanceVoNew.getBankNum());
dataRow.createCell(11).setCellValue(userAttendanceVoNew.getBankCode());
String k = userAttendanceVoNew.getIsAccord();
if(k.equals("1")){
k = "";
}else{
k = "";
}
dataRow.createCell(12).setCellValue(k);
dataRow.createCell(13).setCellValue(userAttendanceVoNew.getSignature());
dataRow.createCell(14).setCellValue("");
dataRow.createCell(15).setCellValue("");
dataRow.createCell(16).setCellValue(userAttendanceVoNew.getPayDay());
dataRow.createCell(17).setCellValue(userAttendanceVoNew.getBankNumber());
}
applyBorderPreservingOriginalStyle(workbook,sheet, 0, res.size()+5, 0, 16);
applyBorderPreservingOriginalStyle(workbook,sheet, 0, res.size()+4, 0, 17);
}
/**
@ -760,10 +804,10 @@ public class PmProjectController extends BaseController {
// 4.1 Sheet1农民工花名册
ExcelUtil<ProMonthTableRosterVo> rosterExcel = new ExcelUtil<>(ProMonthTableRosterVo.class);
List<String> titles = new ArrayList<>();
titles.add("农民工花名册");
titles.add("施工人员花名册");
titles.add("工程名称:"+userWagePayVo.getProName());
List<String> tails = new ArrayList<>();
rosterExcel.addSheetMy(wb, proMonthTableRosterList, "农民工花名册", titles, tails);
rosterExcel.addSheetMy(wb, proMonthTableRosterList, "花名册", titles, tails);
// 4.2 Sheet2农民工实名制工资信息报审
ExcelUtil<UserSalaryApprovalVo> salaryApprovalExcel = new ExcelUtil<>(UserSalaryApprovalVo.class);
@ -773,7 +817,8 @@ public class PmProjectController extends BaseController {
List<String> tails2 = new ArrayList<>();
tails2.add("分包单位(章) 施工项目部(章) 监理项目部(章)");
tails2.add("法定代表人/授权委托人: 项目经理: 总/专业监理工程师:");
salaryApprovalExcel.addSheetMy(wb, userSalaryApprovalList, "农民工实名制工资信息报审", titles2, tails2);
tails2.add("1.本表由分包单位进场前编制附农民工与分包单位的用工合同复印件、身份证复印件、银行卡复印件。2.本信息备案表一式三份,分包单位、监理项目部、施工项目部各留存一份。");
salaryApprovalExcel.addSheetMy(wb, userSalaryApprovalList, "信息报审表", titles2, tails2);
// 4.3 Sheet3分包人员考勤明细
dealExcelByThree(wb, userAttendanceList, "分包人员考勤明细表", userAttendanceVo);

View File

@ -40,6 +40,12 @@ public class ProMonthTableRosterVo {
*/
private Long subId;
/**
* 序号字段仅用于导出展示
*/
@Excel(name = "序号", sort = 0, isSequence = true)
private Integer sequence;
/**
*分包单位名称
*/

View File

@ -47,6 +47,12 @@ public class UserSalaryApprovalVo {
*/
private Long teamId;
/**
* 序号字段仅用于导出展示
*/
@Excel(name = "序号", sort = 0, isSequence = true)
private Integer sequence;
/**
* 班组名称
*/