认证-上报库-导出英文处理
This commit is contained in:
+45
-12
@@ -499,9 +499,9 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
|||||||
OutputStream os = null;
|
OutputStream os = null;
|
||||||
OutputStream excelOS = null;
|
OutputStream excelOS = null;
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||||
String fileOriName = "上报库参数项常规导出信息";
|
String fileOriName = "常规导出";
|
||||||
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
||||||
fileOriName = "Params report normal data";
|
fileOriName = "normal";
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(paramsReportDetailVO.getExportName())) {
|
if (StringUtils.isNotEmpty(paramsReportDetailVO.getExportName())) {
|
||||||
fileOriName = paramsReportDetailVO.getExportName();
|
fileOriName = paramsReportDetailVO.getExportName();
|
||||||
@@ -516,7 +516,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
|||||||
try{
|
try{
|
||||||
String fileName = fileOriName + ".xlsx";
|
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[] titles = getWorkbookTitleForExport(paramsReportDetailVO); // 获取表头
|
||||||
|
|
||||||
String[] headers = titles[1].split(",");
|
String[] headers = titles[1].split(",");
|
||||||
@@ -550,7 +554,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
|||||||
cell.setCellValue(text);
|
cell.setCellValue(text);
|
||||||
cell.setCellStyle(cellStyle1);
|
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);
|
sheetItems.setColumnWidth(i, 80 * 256);
|
||||||
} else {
|
} else {
|
||||||
sheetItems.setColumnWidth(i, 20 * 256);
|
sheetItems.setColumnWidth(i, 20 * 256);
|
||||||
@@ -582,7 +590,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
|||||||
//下载关联文件内容
|
//下载关联文件内容
|
||||||
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
||||||
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
|
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("/","_");
|
String repFileName = fileName.replaceAll("/","_");
|
||||||
@@ -620,7 +632,12 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
|||||||
fis.close(); // 先开后关
|
fis.close(); // 先开后关
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), 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 {
|
} finally {
|
||||||
IOUtils.closeQuietly(os);
|
IOUtils.closeQuietly(os);
|
||||||
IOUtils.closeQuietly(excelOS);
|
IOUtils.closeQuietly(excelOS);
|
||||||
@@ -677,9 +694,9 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
|||||||
public void exportCustomWord(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request) {
|
public void exportCustomWord(ParamsReportDetailVO paramsReportDetailVO, HttpServletResponse response, HttpServletRequest request) {
|
||||||
OutputStream os = null;
|
OutputStream os = null;
|
||||||
OutputStream wordOS = null;
|
OutputStream wordOS = null;
|
||||||
String fileOriName = "上报库参数项自定义导出信息";
|
String fileOriName = "自定义导出";
|
||||||
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
if (CutEnum.EN.getValue().equals(paramsReportDetailVO.getCut())) {
|
||||||
fileOriName = "Params report custom data";
|
fileOriName = "custom";
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(paramsReportDetailVO.getExportName())) {
|
if (StringUtils.isNotEmpty(paramsReportDetailVO.getExportName())) {
|
||||||
fileOriName = 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");
|
List<OSSFile> allRelevFileList = (List<OSSFile>) allParamsInfoList.get(2).get("fileListAll");
|
||||||
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
||||||
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
|
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) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), 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 {
|
} finally {
|
||||||
IOUtils.closeQuietly(os);
|
IOUtils.closeQuietly(os);
|
||||||
@@ -814,7 +839,11 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
|
|||||||
List<OSSFile> allRelevFileList = (List<OSSFile>) allParamsInfoList.get(2).get("fileListAll");
|
List<OSSFile> allRelevFileList = (List<OSSFile>) allParamsInfoList.get(2).get("fileListAll");
|
||||||
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
if (allRelevFileList != null && !allRelevFileList.isEmpty()) {
|
||||||
allRelevFileList = allRelevFileList.stream().distinct().collect(Collectors.toList());
|
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) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), 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 {
|
} finally {
|
||||||
IOUtils.closeQuietly(os);
|
IOUtils.closeQuietly(os);
|
||||||
|
|||||||
Reference in New Issue
Block a user