标准合规评估查询条件 以及征求意见流程内导出 新增字段

This commit is contained in:
yuezhihang
2022-01-24 22:22:33 +08:00
parent e24dd1ad6b
commit d2dfa6b2b0
3 changed files with 37 additions and 16 deletions
@@ -14,7 +14,7 @@ public class TableToExcel {
public static <T extends Object> Workbook createExcel(Map<String,String> columnMap, List<T> dataList, String sheelName, String fileName) { public static <T extends Object> Workbook createExcel(Map<String,String> columnMap, List<T> dataList, String sheelName, String fileName) {
if(sheelName==null)sheelName="sheet1"; if(sheelName==null)sheelName="sheet1";
columnMap.put("a","序号");
int sheetRow=500; int sheetRow=500;
sheetRow=sheetRow<0?200:sheetRow; sheetRow=sheetRow<0?200:sheetRow;
//第一步,创建一个webbook,对应一个excel文件,内存中sheetRow条记录后提交。 //第一步,创建一个webbook,对应一个excel文件,内存中sheetRow条记录后提交。
@@ -36,9 +36,10 @@ public class TableToExcel {
Row neckRow = sheet.createRow(1); Row neckRow = sheet.createRow(1);
sheet.addMergedRegion(new CellRangeAddress(0,1,0,0)); sheet.addMergedRegion(new CellRangeAddress(0,1,0,0));
sheet.addMergedRegion(new CellRangeAddress(0,1,1,1)); sheet.addMergedRegion(new CellRangeAddress(0,1,1,1));
sheet.addMergedRegion(new CellRangeAddress(0,0,2,4)); sheet.addMergedRegion(new CellRangeAddress(0,1,2,2));
sheet.addMergedRegion(new CellRangeAddress(0,1,5,5)); sheet.addMergedRegion(new CellRangeAddress(0,0,3,5));
sheet.addMergedRegion(new CellRangeAddress(0,1,6,6)); sheet.addMergedRegion(new CellRangeAddress(0,1,6,6));
sheet.addMergedRegion(new CellRangeAddress(0,1,9,9));
sheet.addMergedRegion(new CellRangeAddress(0,1,7,7)); sheet.addMergedRegion(new CellRangeAddress(0,1,7,7));
sheet.addMergedRegion(new CellRangeAddress(0,1,8,8)); sheet.addMergedRegion(new CellRangeAddress(0,1,8,8));
//生成表头行 //生成表头行
@@ -46,39 +47,51 @@ public class TableToExcel {
for(String key:keys) { for(String key:keys) {
Cell hCell=headRow.createCell(j++); Cell hCell=headRow.createCell(j++);
if (j<3) if (j<4)
hCell.setCellValue(columnMap.get(key)); hCell.setCellValue(columnMap.get(key));
} }
if (null!=columnMap.get("commentText")) { if (null!=columnMap.get("commentText")) {
Cell hCellh = headRow.createCell(2); Cell hCellh = headRow.createCell(3);
hCellh.setCellValue("修改意见内容"); hCellh.setCellValue("修改意见内容");
} }
if (null!=columnMap.get("a")) {
Cell hCellh = headRow.createCell(0);
hCellh.setCellValue("序号");
}
if (null!=columnMap.get("chapterNumber")) {
Cell hCellh = headRow.createCell(1);
hCellh.setCellValue("章条编号");
}
if (null!=columnMap.get("chapterName")) {
Cell hCellh = headRow.createCell(2);
hCellh.setCellValue("章节名称");
}
if (null!=columnMap.get("department")) { if (null!=columnMap.get("department")) {
Cell hCell = headRow.createCell(5); Cell hCell = headRow.createCell(6);
hCell.setCellValue("提出部门"); hCell.setCellValue("提出部门");
} }
if (null!=columnMap.get("responUserName")) { if (null!=columnMap.get("responUserName")) {
Cell hCell1 = headRow.createCell(6); Cell hCell1 = headRow.createCell(7);
hCell1.setCellValue("提出人"); hCell1.setCellValue("提出人");
} }
if (null!=columnMap.get("stateText")) { if (null!=columnMap.get("stateText")) {
Cell hCell2 = headRow.createCell(7); Cell hCell2 = headRow.createCell(8);
hCell2.setCellValue("处理意见"); hCell2.setCellValue("处理意见");
} }
if (null!=columnMap.get("oldText")) { if (null!=columnMap.get("oldText")) {
Cell nCell = neckRow.createCell(2); Cell nCell = neckRow.createCell(3);
nCell.setCellValue("修改前"); nCell.setCellValue("修改前");
} }
if (null!=columnMap.get("newText")) { if (null!=columnMap.get("newText")) {
Cell nCell1 = neckRow.createCell(3); Cell nCell1 = neckRow.createCell(4);
nCell1.setCellValue("修改后"); nCell1.setCellValue("修改后");
} }
if (null!=columnMap.get("reason")) { if (null!=columnMap.get("reason")) {
Cell nCell1 = neckRow.createCell(4); Cell nCell1 = neckRow.createCell(5);
nCell1.setCellValue("修改理由"); nCell1.setCellValue("修改理由");
} }
if (null!=columnMap.get("cause")) { if (null!=columnMap.get("cause")) {
Cell nCell1 = headRow.createCell(8); Cell nCell1 = headRow.createCell(9);
nCell1.setCellValue("原因"); nCell1.setCellValue("原因");
} }
@@ -89,7 +102,8 @@ public class TableToExcel {
T t=dataList.get(k); T t=dataList.get(k);
Row dataRow=sheet.createRow(c++); Row dataRow=sheet.createRow(c++);
//循环取值进行数据填充 //循环取值进行数据填充
int v=0; int v=1;
dataRow.createCell(0).setCellValue(k+1);
for(String key:keys) { for(String key:keys) {
if (!"commentText".equals(key)) { if (!"commentText".equals(key)) {
try { try {
@@ -325,21 +325,26 @@ public class SarStandProjectLibraryController extends BaseController<SarStandPro
List<String> managementHostList = new ArrayList<>(); List<String> managementHostList = new ArrayList<>();
List<String> developmentHostList = new ArrayList<>(); List<String> developmentHostList = new ArrayList<>();
List<String> categoryList = new ArrayList<>(); List<String> categoryList = new ArrayList<>();
List<String> statusList=new ArrayList<>();
for(SarStandProjectLibrary sarStandProjectLibrary1 : list){ for(SarStandProjectLibrary sarStandProjectLibrary1 : list){
if(!managementHostList.contains(sarStandProjectLibrary1.getManagementHostName())){ if(null!= sarStandProjectLibrary1.getManagementHostName()&& !"".equals(sarStandProjectLibrary1.getManagementHostName()) && !managementHostList.contains(sarStandProjectLibrary1.getManagementHostName())){
managementHostList.add(sarStandProjectLibrary1.getManagementHostName()); managementHostList.add(sarStandProjectLibrary1.getManagementHostName());
} }
if(!developmentHostList.contains(sarStandProjectLibrary1.getDevelopmentHostName())){ if(null!= sarStandProjectLibrary1.getDevelopmentHostName()&& !"".equals(sarStandProjectLibrary1.getDevelopmentHostName()) && !developmentHostList.contains(sarStandProjectLibrary1.getDevelopmentHostName())){
developmentHostList.add(sarStandProjectLibrary1.getDevelopmentHostName()); developmentHostList.add(sarStandProjectLibrary1.getDevelopmentHostName());
} }
if(!categoryList.contains(sarStandProjectLibrary1.getCategoryName())){ if(null!= sarStandProjectLibrary1.getCategoryName()&& !"".equals(sarStandProjectLibrary1.getCategoryName()) && !categoryList.contains(sarStandProjectLibrary1.getCategoryName())){
categoryList.add(sarStandProjectLibrary1.getCategoryName()); categoryList.add(sarStandProjectLibrary1.getCategoryName());
} }
if (null!= sarStandProjectLibrary1.getProjectStatus()&& !"".equals(sarStandProjectLibrary1.getProjectStatus()) && !statusList.contains(sarStandProjectLibrary1.getProjectStatus())){
statusList.add(sarStandProjectLibrary1.getProjectStatus());
}
} }
QuerySelectRspDTO querySelectRspDTO = QuerySelectRspDTO.builder() QuerySelectRspDTO querySelectRspDTO = QuerySelectRspDTO.builder()
.managementHostList(managementHostList) .managementHostList(managementHostList)
.developmentHostList(developmentHostList) .developmentHostList(developmentHostList)
.categoryList(categoryList) .categoryList(categoryList)
.statusList(statusList)
.build(); .build();
return Result.success(querySelectRspDTO); return Result.success(querySelectRspDTO);
} }
@@ -14,4 +14,6 @@ public class QuerySelectRspDTO {
private List<String> developmentHostList; private List<String> developmentHostList;
private List<String> categoryList; private List<String> categoryList;
private List<String> statusList;
} }