Merge remote-tracking branch 'origin/dev_third_stage' into dev_third_stage

This commit is contained in:
qq787203167
2022-08-19 16:41:44 +08:00
2 changed files with 62 additions and 61 deletions
@@ -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;
@@ -360,66 +360,64 @@ public class LawsComplianceBoardServiceImpl implements ILawsComplianceBoardServi
String cut = (String) params.get("cut");
List<Map<String,Object>> 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");
}
}
}
@@ -141,12 +141,17 @@ public class LawsMonthlyReportManageEOServiceImpl extends ServiceImpl<LawsMonthl
String id = lawsMonthlyReportManageEO.getId();
String issueStatus = lawsMonthlyReportManageEO.getIssueStatus();
LawsMonthlyReportManageEO monthlyReportManageEO = getById(id);
Date issueTime = new Date();
lawsMonthlyReportManageEO.setUpdateTime(issueTime);
this.updateById(lawsMonthlyReportManageEO);
// 同步es
// syncElasticsearch(id, issueStatus, issueTime);
}
private void syncElasticsearch(String id, String issueStatus, Date issueTime) {
LawsMonthlyReportManageEO monthlyReportManageEO = getById(id);
if ("1".equals(issueStatus)) { // 已发布---发布操作
// 添加月报到es
OSSFile ossFile = iOSSFileService.getById(monthlyReportManageEO.getFileId());
@@ -240,9 +245,7 @@ public class LawsMonthlyReportManageEOServiceImpl extends ServiceImpl<LawsMonthl
log.error("文档库删除es失败");
}
}
}
private void putMap(String id, String moduleType,
String content, String title , String fileText,
String fileName, String fileId, Date issueTime, String cut,