fix 导出表格调整

master
Todking 3 years ago
parent 80ead71db4
commit 7577ba00b5

@ -124,7 +124,7 @@ public class ApsNoticeClientsServiceImpl implements ApsNoticeClientsService {
}
private void setSheetContent(XSSFWorkbook xWorkbook, XSSFSheet xSheet, List<ApsNoticeClient> apsNoticeClients) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//创建内容样式(头部以下的样式)
CellStyle cs = xWorkbook.createCellStyle();
cs.setWrapText(true);
@ -161,31 +161,43 @@ public class ApsNoticeClientsServiceImpl implements ApsNoticeClientsService {
userName = user.getString("username");
}
}
switch (apsNoticeClients.get(i).getStatus()) {
case 0:
xCell2.setCellValue("未读");
case 1:
xCell2.setCellValue("已读(" + userName + ":" + df.format(apsNoticeClients.get(i).getReadTime()) + ")");
case 2:
xCell2.setCellValue("同意(" + userName + ":" + df.format(apsNoticeClients.get(i).getStatusTime()) + ")");
case 3:
xCell2.setCellValue("拒绝(" + userName + ":" + df.format(apsNoticeClients.get(i).getStatusTime()) + ")");
}
switch (apsNoticeClients.get(i).getStatus()) {
case 0: {
xCell2.setCellValue("未读");
break;
}
case 1: {
xCell2.setCellValue("已读(" + userName + ":" + df.format(apsNoticeClients.get(i).getReadTime()) + ")");
break;
}
case 2: {
xCell2.setCellValue("同意(" + userName + ":" + df.format(apsNoticeClients.get(i).getStatusTime()) + ")");
break;
}
//设置第四列
XSSFCell xCell3 = xRow.createCell(3);
xCell3.setCellStyle(cs);
switch (apsNoticeClients.get(i).getHandle()) {
case 0:
xCell3.setCellValue("未处理");
case 1:
if (StringUtils.isNotBlank(apsNoticeClients.get(i).getModifier())) {
JSONObject modifier = managerMapper.findDetail(apsNoticeClients.get(i).getModifier());
if (modifier != null) {
xCell3.setCellValue("已处理(" + modifier.getString("username") + ":" + df.format(apsNoticeClients.get(i).getModifyTime()) + ")");
} else {
xCell3.setCellValue("已处理(未知用户:" + df.format(apsNoticeClients.get(i).getModifyTime()) + ")");
}
case 3: {
xCell2.setCellValue("拒绝(" + userName + ":" + df.format(apsNoticeClients.get(i).getStatusTime()) + ")");
break;
}
}
//设置第四列
XSSFCell xCell3 = xRow.createCell(3);
xCell3.setCellStyle(cs);
switch (apsNoticeClients.get(i).getHandle()) {
case 0: {
xCell3.setCellValue("未处理");
break;
}
case 1: {
if (StringUtils.isNotBlank(apsNoticeClients.get(i).getModifier())) {
JSONObject modifier = managerMapper.findDetail(apsNoticeClients.get(i).getModifier());
if (modifier != null) {
xCell3.setCellValue("已处理(" + modifier.getString("username") + ":" + df.format(apsNoticeClients.get(i).getModifyTime()) + ")");
} else {
xCell3.setCellValue("已处理(未知用户:" + df.format(apsNoticeClients.get(i).getModifyTime()) + ")");
}
}
break;
}
}
}
@ -195,7 +207,7 @@ public class ApsNoticeClientsServiceImpl implements ApsNoticeClientsService {
private void setSheetHeader(XSSFWorkbook xWorkbook, XSSFSheet xSheet) {
//设置表格的宽度 xSheet.setColumnWidth(0, 20 * 256); 中的数字 20 自行设置为自己适用的
xSheet.setColumnWidth(0, 10 * 256);
xSheet.setColumnWidth(1, 30 * 256);
xSheet.setColumnWidth(1, 25 * 256);
xSheet.setColumnWidth(2, 40 * 256);
xSheet.setColumnWidth(3, 40 * 256);
//创建表格的样式

Loading…
Cancel
Save