|
|
|
|
@ -130,7 +130,7 @@ public class CarFfnlgTrgtController {
|
|
|
|
|
// TODO : ECU-KR -> UTF-8 변환
|
|
|
|
|
byte[] utfFileBytes = content.getBytes(StandardCharsets.UTF_8);
|
|
|
|
|
|
|
|
|
|
String fileName = URLEncoder.encode("유효기간경과_과태료부과대상_리스트.txt", "UTF-8");
|
|
|
|
|
String fileName = URLEncoder.encode("유효기간경과_과태료부과대상_리스트.prn", "UTF-8");
|
|
|
|
|
|
|
|
|
|
// 응답 헤더 설정 (텍스트 파일, UTF-8 인코딩)
|
|
|
|
|
response.setContentType("text/plain; charset=UTF-8");
|
|
|
|
|
@ -156,7 +156,7 @@ public class CarFfnlgTrgtController {
|
|
|
|
|
* @return 팝업 화면
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/uploadPopup.do")
|
|
|
|
|
@Operation(summary = "파일 업로드 팝업", description = "TXT 파일 업로드 팝업 화면을 제공합니다.")
|
|
|
|
|
@Operation(summary = "파일 업로드 팝업", description = "TXT, PRN 파일 업로드 팝업 화면을 제공합니다.")
|
|
|
|
|
public ModelAndView uploadPopup() {
|
|
|
|
|
log.debug("파일 업로드 팝업 화면 요청");
|
|
|
|
|
|
|
|
|
|
@ -174,11 +174,11 @@ public class CarFfnlgTrgtController {
|
|
|
|
|
* @return 처리 결과
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/upload.ajax")
|
|
|
|
|
@Operation(summary = "TXT 파일 업로드", description = "TXT 파일을 업로드하고 파싱하여 DB에 저장합니다. 한 건이라도 실패 시 전체 롤백됩니다.")
|
|
|
|
|
@Operation(summary = "TXT, PRN 파일 업로드", description = "TXT, PRN 파일을 업로드하고 파싱하여 DB에 저장합니다. 한 건이라도 실패 시 전체 롤백됩니다.")
|
|
|
|
|
public ResponseEntity<?> upload(
|
|
|
|
|
@Parameter(description = "TXT 파일") @RequestParam("file") MultipartFile file) {
|
|
|
|
|
@Parameter(description = "TXT, PRN 파일") @RequestParam("file") MultipartFile file) {
|
|
|
|
|
|
|
|
|
|
log.info("TXT 파일 업로드 요청 - 파일명: {}", file != null ? file.getOriginalFilename() : "null");
|
|
|
|
|
log.info("TXT, PRN 파일 업로드 요청 - 파일명: {}", file != null ? file.getOriginalFilename() : "null");
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
// 세션에서 사용자 ID 가져오기
|
|
|
|
|
@ -217,11 +217,11 @@ public class CarFfnlgTrgtController {
|
|
|
|
|
|
|
|
|
|
} catch (RuntimeException e) {
|
|
|
|
|
// 데이터 처리 중 오류 발생 - 전체 롤백됨
|
|
|
|
|
log.error("TXT 파일 업로드 중 오류 발생 - 전체 롤백", e);
|
|
|
|
|
log.error("TXT, PRN 파일 업로드 중 오류 발생 - 전체 롤백", e);
|
|
|
|
|
return ApiResponseUtil.error(e.getMessage());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
// 예상치 못한 오류
|
|
|
|
|
log.error("TXT 파일 업로드 중 예상치 못한 오류 발생", e);
|
|
|
|
|
log.error("TXT, PRN 파일 업로드 중 예상치 못한 오류 발생", e);
|
|
|
|
|
return ApiResponseUtil.error("파일 업로드 중 오류가 발생했습니다: " + e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|