Browse Source

코드 정리

pull/3/head
lkd9125 1 year ago
parent
commit
f298886491
  1. 2
      pav-server/src/main/java/com/palnet/biz/api/bas/flight/controller/BasFlightController.java
  2. 9
      pav-server/src/main/java/com/palnet/comn/utils/PdfUtils.java

2
pav-server/src/main/java/com/palnet/biz/api/bas/flight/controller/BasFlightController.java

@ -394,7 +394,7 @@ public class BasFlightController {
public void createLancePDF(@RequestBody LanncPdfVO vo) {
String airUser = vo.getUserName();
String etc = String.valueOf(System.currentTimeMillis());
String etc = String.valueOf(System.currentTimeMillis()); // 동명이인 방지
String fileName = pdfUtils.getSaveName(airUser, etc);
// PDF 생성 및 저장

9
pav-server/src/main/java/com/palnet/comn/utils/PdfUtils.java

@ -7,10 +7,8 @@ import java.io.InputStream;
import java.io.StringReader;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@ -66,6 +64,7 @@ public class PdfUtils {
/**
* 파일명 만들기, 앞에 기본으로 금일 날짜있음
* [예시] 20230102_[추가파라미터]
* @param etcName
* @return
*/
@ -81,6 +80,8 @@ public class PdfUtils {
.append(name);
}
result.append(this.FILE_EXTENSION);
return result.toString();
}
@ -131,7 +132,7 @@ public class PdfUtils {
new File(pdfPath).mkdirs();
// File 저장 기본경로는 main 아래로 기본으로 잡힘
PdfWriter writer = PdfWriter.getInstance(pdfDocument, new FileOutputStream(pdfPath + fileName + this.FILE_EXTENSION));
PdfWriter writer = PdfWriter.getInstance(pdfDocument, new FileOutputStream(pdfPath + fileName));
writer.setInitialLeading(12.5f);
pdfDocument.open();
@ -189,7 +190,7 @@ public class PdfUtils {
result.setFileOriNm(fileName);
try {
String filePath = result.getFileOriNm() + this.FILE_EXTENSION;
String filePath = result.getFileOriNm();
long fileSize = Files.size(Paths.get(pdfPath + filePath)) / 1024;
if(fileSize > 0) result.setFileSize(String.valueOf(fileSize));

Loading…
Cancel
Save