-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
STT S3 저장 기능 구현
- Loading branch information
Showing
17 changed files
with
356 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/com/smart/watchboard/common/support/PdfConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.smart.watchboard.common.support; | ||
|
||
import com.itextpdf.text.Document; | ||
import com.itextpdf.text.DocumentException; | ||
import com.itextpdf.text.Paragraph; | ||
import com.itextpdf.text.pdf.PdfWriter; | ||
|
||
import java.io.ByteArrayOutputStream; | ||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
|
||
public class PdfConverter { | ||
public static File convertStringToPdf(String content, String fileName) throws DocumentException, IOException { | ||
Document document = new Document(); | ||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); | ||
|
||
try { | ||
PdfWriter.getInstance(document, byteArrayOutputStream); | ||
document.open(); | ||
document.add(new Paragraph(content)); | ||
} finally { | ||
document.close(); | ||
} | ||
|
||
byte[] pdfBytes = byteArrayOutputStream.toByteArray(); | ||
return saveByteArrayToFile(pdfBytes, fileName); | ||
} | ||
|
||
public static File saveByteArrayToFile(byte[] bytes, String fileName) throws IOException { | ||
File outputFile = new File(fileName); | ||
System.out.println(outputFile.getName()); | ||
try (FileOutputStream fos = new FileOutputStream(outputFile)) { | ||
fos.write(bytes); | ||
} | ||
System.out.println(outputFile); | ||
return outputFile; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.smart.watchboard.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
@Getter | ||
@Setter | ||
public class AnswerDto { | ||
private String text; | ||
|
||
@JsonCreator | ||
public AnswerDto(@JsonProperty("text") String text) { | ||
this.text = text; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/smart/watchboard/dto/MindmapRequestDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.smart.watchboard.dto; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@Setter | ||
public class MindmapRequestDto { | ||
private String key; | ||
private String dataType; | ||
private List<String> keywords; | ||
private Long documentId; | ||
|
||
public MindmapRequestDto(String key, String dataType, List<String> keywords, Long documentId) { | ||
this.key = key; | ||
this.dataType = dataType; | ||
this.keywords = keywords; | ||
this.documentId = documentId; | ||
} | ||
} |
Oops, something went wrong.