Compare commits

..

5 Commits

5 changed files with 27 additions and 28 deletions

3
.gitignore vendored
View File

@@ -35,3 +35,6 @@ out/
### VS Code ### ### VS Code ###
.vscode/ .vscode/
logs
upload-file

View File

@@ -32,7 +32,7 @@ repositories {
} }
dependencies { dependencies {
implementation "com.kri.common:starter:beta.1.1.03" implementation "com.kri.common:starter:beta.1.1.17"
implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-security'
@@ -50,7 +50,7 @@ dependencies {
compileOnly 'org.projectlombok:lombok' compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok'
implementation 'org.apache.poi:poi-ooxml:5.2.5' implementation 'org.apache.poi:poi-ooxml:5.5.1'
developmentOnly 'org.springframework.boot:spring-boot-devtools' developmentOnly 'org.springframework.boot:spring-boot-devtools'

View File

@@ -9,8 +9,8 @@ import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
@@ -29,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile;
public class UploadController { public class UploadController {
private static final String XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; private static final String XLSX = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
private static final MediaType XLSX_MEDIA_TYPE = MediaType.valueOf(XLSX);
private final StatisticsDbCache statisticsDbCache; private final StatisticsDbCache statisticsDbCache;
private final UploadService uploadService; private final UploadService uploadService;
@@ -39,7 +40,6 @@ public class UploadController {
produces = {MediaType.APPLICATION_JSON_VALUE, XLSX} produces = {MediaType.APPLICATION_JSON_VALUE, XLSX}
) )
@Operation(summary = "파일 업로드", description = "성공이면 JSON, 실패가 있으면 실패 내역 엑셀(xlsx) 반환") @Operation(summary = "파일 업로드", description = "성공이면 JSON, 실패가 있으면 실패 내역 엑셀(xlsx) 반환")
@ApiResponses({
@ApiResponse( @ApiResponse(
responseCode = "200", responseCode = "200",
description = "성공(JSON) 또는 실패 엑셀(xlsx)", description = "성공(JSON) 또는 실패 엑셀(xlsx)",
@@ -54,8 +54,7 @@ public class UploadController {
) )
} }
) )
}) public ResponseEntity<Object> importData(
public ResponseEntity<?> importData(
@Parameter(description = "업로드 파일", required = true) @Parameter(description = "업로드 파일", required = true)
@RequestPart("file") MultipartFile file @RequestPart("file") MultipartFile file
) { ) {
@@ -64,15 +63,14 @@ public class UploadController {
ExcelUploadResultDto result = uploadService.uploadData(file); ExcelUploadResultDto result = uploadService.uploadData(file);
if (result.isHasErrorFile()) { if (result.isHasErrorFile()) {
String contentDisposition = "attachment; filename*=UTF-8''" + String contentDisposition = "attachment; filename*=UTF-8''" +
java.net.URLEncoder.encode(result.getErrorFileName(), StandardCharsets.UTF_8); URLEncoder.encode(result.getErrorFileName(), StandardCharsets.UTF_8);
return ResponseEntity.ok() return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, contentDisposition) .header(HttpHeaders.CONTENT_DISPOSITION, contentDisposition)
.contentType(MediaType.parseMediaType(XLSX)) .contentType(XLSX_MEDIA_TYPE)
.body(result.getErrorFile()); .body(result.getErrorFile());
}
} else {
return ResponseEntity.ok(ExcelUploadSuccessDto.from(result)); return ResponseEntity.ok(ExcelUploadSuccessDto.from(result));
} }
} }
}

View File

@@ -1,7 +1,7 @@
spring: spring:
datasource: datasource:
#private 도메인 #private 도메인
url: jdbc:mysql://db-md87m.vpc-cdb.ntruss.com:3306/lge_cx_dash?characterEncoding=UTF-8&rewriteBatchedStatements=true url: jdbc:mysql://db-40h0ul.vpc-cdb.ntruss.com:3306/prjct_lge_cx_dash?characterEncoding=UTF-8&rewriteBatchedStatements=true
username: prjct_lge_cx username: prjct_lge_cx
password: lge#260324 password: lge#260324
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver

View File

@@ -54,9 +54,7 @@ kri:
web: web:
enabled: true # 공통 Web 구성 사용 여부 (기본 true) enabled: true # 공통 Web 구성 사용 여부 (기본 true)
webmvc:
enabled: true # 공통 Webmvc 구성 사용 여부 (기본 true)
redis: redis:
enabled: false # RedisQueueHelper 사용 시 true enabled: false # RedisQueueHelper 사용 시 true
scheduling: scheduling:
enabled: true # @Scheduled 사용 시 true enabled: false # @Scheduled 사용 시 true