main
黄海 2 years ago
parent 84ac08e259
commit c2463a41ec

@ -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();
}

@ -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");

Loading…
Cancel
Save