From 5af10edadd2d5d7eaa2bdef15ea674828eec02df Mon Sep 17 00:00:00 2001 From: wangzhijiang <12345678> Date: Fri, 19 Aug 2022 16:12:15 +0800 Subject: [PATCH 1/3] update --- .../project/service/impl/LawsComplianceBoardServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java index a25779130..4bebaed12 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java @@ -257,7 +257,7 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi title = "编号,标题,状态,技术领域,责任领域,相关项目,设计符合性,Pre-Homo确认,验证符合性"; fileName = "符合性结果" + ".xlsx"; }else if(StringUtils.equals(cut,CutEnum.EN.getValue())){ - title = "Number,Title,Status,Tech field,Responsible Field,Relevant Project,Design Compliance Confirmation,Pre-Homo Confirmation,Validation Compliance Confirmation"; + title = "Number,Title,Status,Tech Field,Responsible Field,Relevant Project,Design Compliance Confirmation,Pre-Homo Confirmation,Validation Compliance Confirmation"; fileName = "Compliance results" + ".xlsx"; } OutputStream os = null; From d6eee4079895d55761a18084875ce5a6759e1736 Mon Sep 17 00:00:00 2001 From: liyawei Date: Fri, 19 Aug 2022 16:14:23 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E4=B8=AD=E5=BF=83-?= =?UTF-8?q?=E6=B3=95=E8=A7=84=E6=9C=88=E6=8A=A5-=E6=9A=82=E6=97=B6?= =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/LawsMonthlyReportManageEOServiceImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/service/impl/LawsMonthlyReportManageEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/service/impl/LawsMonthlyReportManageEOServiceImpl.java index e6c1db550..1947159ab 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/service/impl/LawsMonthlyReportManageEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/report/service/impl/LawsMonthlyReportManageEOServiceImpl.java @@ -141,12 +141,17 @@ public class LawsMonthlyReportManageEOServiceImpl extends ServiceImpl Date: Fri, 19 Aug 2022 16:31:43 +0800 Subject: [PATCH 3/3] =?UTF-8?q?58420=E4=BF=AE=E6=94=B9=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/LawsComplianceBoardServiceImpl.java | 110 +++++++++--------- 1 file changed, 54 insertions(+), 56 deletions(-) diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java index 4bebaed12..d060a5ebe 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/project/service/impl/LawsComplianceBoardServiceImpl.java @@ -360,66 +360,64 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi String cut = (String) params.get("cut"); List> exportData = this.lawsComplianceBoardMapper.queryComplianceResultList(params); this.disposeComplianceResult(exportData,cut); - if(CollectionUtils.isNotEmpty(exportData)){ - String title = ""; - String fileName = ""; - if(StringUtils.equals(cut, CutEnum.CN.getValue())){ - title = "责任领域,相关项目,设计符合性,Pre-Homo确认,验证符合性"; - fileName = "符合性结果" + ".xlsx"; - }else if(StringUtils.equals(cut,CutEnum.EN.getValue())){ - title = "Responsible Field,Relevant Project,Design Compliance Confirmation,Pre-Homo Confirmation,Validation Compliance Confirmation"; - fileName = "Compliance results" + ".xlsx"; + String title = ""; + String fileName = ""; + if(StringUtils.equals(cut, CutEnum.CN.getValue())){ + title = "责任领域,相关项目,设计符合性,Pre-Homo确认,验证符合性"; + fileName = "符合性结果" + ".xlsx"; + }else if(StringUtils.equals(cut,CutEnum.EN.getValue())){ + title = "Responsible Field,Relevant Project,Design Compliance Confirmation,Pre-Homo Confirmation,Validation Compliance Confirmation"; + fileName = "Compliance results" + ".xlsx"; + } + OutputStream os = null; + HSSFWorkbook workbook = new HSSFWorkbook(); + + try { + response.setHeader("Content-Disposition", + "attachment; filename=" + fileName); + response.setContentType("application/force-download"); + + HSSFSheet sheet = workbook.createSheet("sheet1"); + + CellStyle titleCellStyle = workbook.createCellStyle(); + titleCellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中 + titleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中 + titleCellStyle.setWrapText(true);//自动换行 + + //创建表头 + String[] firstLineTitleArr = title.split(","); + Row firstRow = sheet.createRow(0); + + //设置居中、表头值。 + for (int i = 0; i < firstLineTitleArr.length; i++){ + sheet.setColumnWidth(i,8000); + Cell cell = firstRow.createCell(i); + cell.setCellStyle(titleCellStyle); + cell.setCellValue(firstLineTitleArr[i]); } - OutputStream os = null; - HSSFWorkbook workbook = new HSSFWorkbook(); - try { - response.setHeader("Content-Disposition", - "attachment; filename=" + fileName); - response.setContentType("application/force-download"); - - HSSFSheet sheet = workbook.createSheet("sheet1"); - - CellStyle titleCellStyle = workbook.createCellStyle(); - titleCellStyle.setAlignment(HorizontalAlignment.CENTER);//垂直居中 - titleCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//水平居中 - titleCellStyle.setWrapText(true);//自动换行 - - //创建表头 - String[] firstLineTitleArr = title.split(","); - Row firstRow = sheet.createRow(0); - - //设置居中、表头值。 - for (int i = 0; i < firstLineTitleArr.length; i++){ - sheet.setColumnWidth(i,8000); - Cell cell = firstRow.createCell(i); - cell.setCellStyle(titleCellStyle); - cell.setCellValue(firstLineTitleArr[i]); - } - - //设置导出数据 - if(CollectionUtils.isNotEmpty(exportData)) { - int rowIndex = 1; - for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) { - Row dataRow = sheet.createRow(rowIndex); - dataRow.createCell(0).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("dutyTerritory_dicText"))); - dataRow.createCell(1).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("projectName"))); - dataRow.createCell(2).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("designFlowTaskStatus_dicText"))); - dataRow.createCell(3).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("prehomoFlowTaskStatus_dicText"))); - dataRow.createCell(4).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("verifyFlowTaskStatus_dicText"))); - rowIndex ++; - } - } - os = response.getOutputStream(); - workbook.write(os); - os.flush(); - }catch (IOException ex){ - if(CutEnum.CN.getValue().equals(cut)){ - throw new JeroBootException("下载文件失败"); - }else{ - throw new JeroBootException("Failed to download file"); + //设置导出数据 + if(CollectionUtils.isNotEmpty(exportData)) { + int rowIndex = 1; + for (int dataIndex = 0; dataIndex < exportData.size(); dataIndex++) { + Row dataRow = sheet.createRow(rowIndex); + dataRow.createCell(0).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("dutyTerritory_dicText"))); + dataRow.createCell(1).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("projectName"))); + dataRow.createCell(2).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("designFlowTaskStatus_dicText"))); + dataRow.createCell(3).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("prehomoFlowTaskStatus_dicText"))); + dataRow.createCell(4).setCellValue(checkValueIsNotNull(exportData.get(dataIndex).get("verifyFlowTaskStatus_dicText"))); + rowIndex ++; } } + os = response.getOutputStream(); + workbook.write(os); + os.flush(); + }catch (IOException ex){ + if(CutEnum.CN.getValue().equals(cut)){ + throw new JeroBootException("下载文件失败"); + }else{ + throw new JeroBootException("Failed to download file"); + } } }