From ceaea6dcfc56752d91f0bfb355f2d9e9d98f1387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E7=B2=BE=E5=8D=8E?= <842761733@qq.com> Date: Mon, 19 Jun 2023 09:14:53 +0800 Subject: [PATCH] update some codestyle --- server/pom.xml | 6 +++--- .../main/java/cn/keking/config/ConfigConstants.java | 10 +++++----- .../java/cn/keking/config/ConfigRefreshComponent.java | 4 ++-- .../cn/keking/service/impl/OfficeFilePreviewImpl.java | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/server/pom.xml b/server/pom.xml index 23dc67d5..5952259d 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -258,9 +258,9 @@ windows-x86_64 - com.itextpdf - itextpdf - ${itextpdf.version} + com.itextpdf + itextpdf + ${itextpdf.version} diff --git a/server/src/main/java/cn/keking/config/ConfigConstants.java b/server/src/main/java/cn/keking/config/ConfigConstants.java index 32b09e17..32a94e63 100644 --- a/server/src/main/java/cn/keking/config/ConfigConstants.java +++ b/server/src/main/java/cn/keking/config/ConfigConstants.java @@ -74,7 +74,7 @@ public class ConfigConstants { public static final String DEFAULT_PROHIBIT = "exe,dll"; public static final String DEFAULT_PASSWORD = "123456"; public static final String DEFAULT_PDF2_JPG_DPI = "105"; - public static final String DEFAULT_OFFICE_TyPEWEB_DISABLE = "web"; + public static final String DEFAULT_OFFICE_TYPE_WEB = "web"; public static final String DEFAULT_DELETE_SOURCE_FILE = "true"; public static Boolean isCacheEnabled() { @@ -424,14 +424,14 @@ public class ConfigConstants { ConfigConstants.pdf2JpgDpi = pdf2JpgDpi; } - public static String getofficeTypeWeb() { + public static String getOfficeTypeWeb() { return officeTypeWeb; } @Value("${office.type.web:web}") - public void setofficeTypeWeb(String officeTypeWeb) { - setofficeTypeWebValue(officeTypeWeb); + public void setOfficeTypeWeb(String officeTypeWeb) { + setOfficeTypeWebValue(officeTypeWeb); } - public static void setofficeTypeWebValue(String officeTypeWeb) { + public static void setOfficeTypeWebValue(String officeTypeWeb) { ConfigConstants.officeTypeWeb = officeTypeWeb; } diff --git a/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java b/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java index 7f860e38..82bbcd5a 100644 --- a/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java +++ b/server/src/main/java/cn/keking/config/ConfigRefreshComponent.java @@ -90,7 +90,7 @@ public class ConfigRefreshComponent { prohibit = properties.getProperty("prohibit", ConfigConstants.DEFAULT_PROHIBIT); password = properties.getProperty("delete.password", ConfigConstants.DEFAULT_PASSWORD); pdf2JpgDpi = Integer.parseInt(properties.getProperty("pdf2jpg.dpi", ConfigConstants.DEFAULT_PDF2_JPG_DPI)); - officeTypeWeb = properties.getProperty("office.type.web", ConfigConstants.DEFAULT_OFFICE_TyPEWEB_DISABLE); + officeTypeWeb = properties.getProperty("office.type.web", ConfigConstants.DEFAULT_OFFICE_TYPE_WEB); deleteSourceFile = Boolean.parseBoolean(properties.getProperty("delete.source.file", ConfigConstants.DEFAULT_DELETE_SOURCE_FILE)); prohibitArray = prohibit.split(","); @@ -116,7 +116,7 @@ public class ConfigRefreshComponent { ConfigConstants.setProhibitValue(prohibitArray); ConfigConstants.setPasswordValue(password); ConfigConstants.setPdf2JpgDpiValue(pdf2JpgDpi); - ConfigConstants.setofficeTypeWebValue(officeTypeWeb); + ConfigConstants.setOfficeTypeWebValue(officeTypeWeb); ConfigConstants.setDeleteSourceFileValue(deleteSourceFile); setWatermarkConfig(properties); bufferedReader.close(); diff --git a/server/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java b/server/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java index 10ef4e18..601155ff 100644 --- a/server/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java +++ b/server/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java @@ -57,9 +57,9 @@ public class OfficeFilePreviewImpl implements FilePreview { String pdfName = fileName.substring(0, fileName.lastIndexOf(".") ) + suffix +"." +(isHtml ? "html" : "pdf"); //生成文件添加类型后缀 防止同名文件 String cacheFileName = userToken == null ? pdfName : userToken + "_" + pdfName; String outFilePath = FILE_DIR + cacheFileName; - if(!officePreviewType.equalsIgnoreCase("html")){ - if(officePreviewType.equalsIgnoreCase("web")|| ConfigConstants.getofficeTypeWeb() .equalsIgnoreCase("web") ){ - if(suffix.equalsIgnoreCase("xlsx")){ + if (!officePreviewType.equalsIgnoreCase("html")) { + if (ConfigConstants.getOfficeTypeWeb() .equalsIgnoreCase("web")) { + if (suffix.equalsIgnoreCase("xlsx")) { model.addAttribute("pdfUrl", url); return XLSX_FILE_PREVIEW_PAGE; }