diff --git a/WebRoot/Excel/06856ad1-50e0-4078-af05-b9ac27f27f4f.pdf b/WebRoot/Excel/06856ad1-50e0-4078-af05-b9ac27f27f4f.pdf index c56a17a0..cfa7ee91 100644 Binary files a/WebRoot/Excel/06856ad1-50e0-4078-af05-b9ac27f27f4f.pdf and b/WebRoot/Excel/06856ad1-50e0-4078-af05-b9ac27f27f4f.pdf differ diff --git a/WebRoot/Excel/b712e11b-8449-4d2c-a4c2-c624b5a4810e.pdf b/WebRoot/Excel/b712e11b-8449-4d2c-a4c2-c624b5a4810e.pdf index d2e18c05..dfa099de 100644 Binary files a/WebRoot/Excel/b712e11b-8449-4d2c-a4c2-c624b5a4810e.pdf and b/WebRoot/Excel/b712e11b-8449-4d2c-a4c2-c624b5a4810e.pdf differ diff --git a/src/main/java/com/dsideal/QingLong/Collect/Controller/CollectController.java b/src/main/java/com/dsideal/QingLong/Collect/Controller/CollectController.java index 7b80217b..1aa6a0eb 100644 --- a/src/main/java/com/dsideal/QingLong/Collect/Controller/CollectController.java +++ b/src/main/java/com/dsideal/QingLong/Collect/Controller/CollectController.java @@ -29,10 +29,7 @@ import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import javax.servlet.http.HttpServletResponse; import java.io.*; -import java.net.URISyntaxException; -import java.net.URL; import java.text.ParseException; import java.util.*; @@ -832,7 +829,7 @@ public class CollectController extends Controller { String pdfPath = excelPath.replace(".xlsx", ".pdf"); AsposeUtil.xls2pdf(excelPath, pdfPath); OutputStream outputStream = getResponse().getOutputStream(); - outputStream.write(CommonUtil.convertFileToByteArray(new File(pdfPath))); + outputStream.write(FileUtil.readBytes(pdfPath)); outputStream.flush(); renderNull(); } diff --git a/src/main/java/com/dsideal/QingLong/Util/CommonUtil.java b/src/main/java/com/dsideal/QingLong/Util/CommonUtil.java index d48c7256..686f20ef 100644 --- a/src/main/java/com/dsideal/QingLong/Util/CommonUtil.java +++ b/src/main/java/com/dsideal/QingLong/Util/CommonUtil.java @@ -22,7 +22,6 @@ import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.time.LocalDateTime; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -33,17 +32,6 @@ public class CommonUtil { public static String WebRoot; - public static byte[] convertFileToByteArray(File file) { - byte[] fileBytes = null; - try (FileInputStream fis = new FileInputStream(file)) { - fileBytes = new byte[(int) file.length()]; - fis.read(fileBytes); - } catch (IOException e) { - e.printStackTrace(); - } - return fileBytes; - } - //获取当前年份 public static String getCurrentYear() { SimpleDateFormat sdf = new SimpleDateFormat("yyyy");