认证-上报库-导出英文处理

This commit is contained in:
liyawei
2022-08-02 13:44:38 +08:00
parent 8c09abfe63
commit fc92c5d2a5
@@ -499,9 +499,9 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
OutputStream os = null;
OutputStream excelOS = null;
XSSFWorkbook workbook = new XSSFWorkbook();
String fileOriName = "上报库参数项常规导出信息";
String fileOriName = "常规导出";
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
fileOriName = "Params report normal data";
fileOriName = "normal";
}
if (StringUtils.isNotEmpty(paramsReportDetailVO.getExportName())) {
fileOriName = paramsReportDetailVO.getExportName();
@@ -516,7 +516,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
try{
String fileName = fileOriName + ".xlsx";
// 设置表格相关属性
XSSFSheet sheetItems = workbook.createSheet("上报库参数项信息");
String sheetName = "参数项信息";
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
sheetName = "Params data";
}
XSSFSheet sheetItems = workbook.createSheet(sheetName);
String[] titles = getWorkbookTitleForExport(paramsReportDetailVO); // 获取表头
String[] headers = titles[1].split(",");
@@ -550,7 +554,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
cell.setCellValue(text);
cell.setCellStyle(cellStyle1);
// 设置单元格宽度
if("参数值".equals(headers[i])) {
String ParamsValues = "参数值";
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
ParamsValues = "Params Values";
}
if(ParamsValues.equals(headers[i])) {
sheetItems.setColumnWidth(i, 80 * 256);
} else {
sheetItems.setColumnWidth(i, 20 * 256);
@@ -582,7 +590,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
//下载关联文件内容
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
downLoadFileList(allRelevFileList,fileNowPath + File.separator + "导出文件");
String exportFile = "导出文件";
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
exportFile = "Export file";
}
downLoadFileList(allRelevFileList,fileNowPath + File.separator + exportFile);
}
String repFileName = fileName.replaceAll("/","_");
@@ -620,7 +632,12 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
fis.close(); // 先开后关
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new JeroBootException("下载文件失败,请重试");
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
throw new JeroBootException("Failed to download file, please try again");
} else {
throw new JeroBootException("下载文件失败,请重试");
}
} finally {
IOUtils.closeQuietly(os);
IOUtils.closeQuietly(excelOS);
@@ -677,9 +694,9 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
public void exportCustomWord(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request) {
OutputStream os = null;
OutputStream wordOS = null;
String fileOriName = "上报库参数项自定义导出信息";
String fileOriName = "自定义导出";
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
fileOriName = "Params report custom data";
fileOriName = "custom";
}
if (StringUtils.isNotEmpty(paramsReportDetailVO.getExportName())) {
fileOriName = paramsReportDetailVO.getExportName();
@@ -711,7 +728,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
List<OSSFile> allRelevFileList = (List<OSSFile>) allParamsInfoList.get(2).get("fileListAll");
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
downLoadFileList(allRelevFileList,fileNowPath + File.separator + "导出文件");
String exportFile = "导出文件";
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
exportFile = "Export file";
}
downLoadFileList(allRelevFileList,fileNowPath + File.separator + exportFile);
}
// 拿取模板
@@ -764,7 +785,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new JeroBootException("下载文件失败,请重试");
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
throw new JeroBootException("Failed to download file, please try again");
} else {
throw new JeroBootException("下载文件失败,请重试");
}
} finally {
IOUtils.closeQuietly(os);
@@ -814,7 +839,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
List<OSSFile> allRelevFileList = (List<OSSFile>) allParamsInfoList.get(2).get("fileListAll");
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
downLoadFileList(allRelevFileList,fileNowPath + File.separator + "导出文件");
String exportFile = "导出文件";
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
exportFile = "Export file";
}
downLoadFileList(allRelevFileList,fileNowPath + File.separator + exportFile);
}
// 拿取模板
@@ -881,7 +910,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new JeroBootException("下载文件失败,请重试");
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
throw new JeroBootException("Failed to download file, please try again");
} else {
throw new JeroBootException("下载文件失败,请重试");
}
} finally {
IOUtils.closeQuietly(os);