diff --git a/build.gradle b/build.gradle index b0ca3a2..4b9e098 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ repositories { dependencies { implementation 'org.springframework.boot:spring-boot-starter-batch' - implementation 'org.springframework.boot:spring-boot-starter-web' +// implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3' compileOnly 'org.projectlombok:lombok' developmentOnly 'org.springframework.boot:spring-boot-devtools' diff --git a/src/main/java/com/munjaon/server/MunjaonServerApplication.java b/src/main/java/com/munjaon/server/MunjaonServerApplication.java index 51068da..9b6a2e9 100644 --- a/src/main/java/com/munjaon/server/MunjaonServerApplication.java +++ b/src/main/java/com/munjaon/server/MunjaonServerApplication.java @@ -10,14 +10,15 @@ import org.springframework.scheduling.annotation.EnableScheduling; @EnableCaching @EnableScheduling @SpringBootApplication -public class MunjaonServerApplication extends SpringBootServletInitializer { +public class MunjaonServerApplication { +//public class MunjaonServerApplication extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(MunjaonServerApplication.class, args); } - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { - return super.configure(builder); - } +// @Override +// protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { +// return super.configure(builder); +// } } diff --git a/src/main/java/com/munjaon/server/server/task/ReportTask.java b/src/main/java/com/munjaon/server/server/task/ReportTask.java index 55da7f1..97705b5 100644 --- a/src/main/java/com/munjaon/server/server/task/ReportTask.java +++ b/src/main/java/com/munjaon/server/server/task/ReportTask.java @@ -53,9 +53,9 @@ public abstract class ReportTask extends Thread { @Override public void run() { if (this.reportUserDto.isLogin()) { - saveSystemLog("[" + this.taskName + "][ID : " + this.reportUserDto.getUserId() + "][### Start ### ### ### ### ### ### ###]"); + saveLog("[" + this.taskName + "][ID : " + this.reportUserDto.getUserId() + "][### Start ### ### ### ### ### ### ###]"); } else { - saveSystemLog("[" + this.taskName + "][### Start ### ### ### ### ### ### ###]"); + saveLog("[" + this.taskName + "][### Start ### ### ### ### ### ### ###]"); } /* 최초 RUN Flag 체크 */ @@ -73,7 +73,7 @@ public abstract class ReportTask extends Thread { } } catch (Exception e) { this.IS_ERROR = true; - saveSystemLog(e); + saveLog(e); } /* 중요 : 사용자 Thread 실행모드 Off */ reportUserDto.setRunningMode(false); @@ -83,9 +83,9 @@ public abstract class ReportTask extends Thread { } if (this.reportUserDto.isLogin()) { - saveSystemLog("[" + this.taskName + "][ID : " + this.reportUserDto.getUserId() + "][### End ### ### ### ### ### ### ###]"); + saveLog("[" + this.taskName + "][ID : " + this.reportUserDto.getUserId() + "][### End ### ### ### ### ### ### ###]"); } else { - saveSystemLog("[" + this.taskName + "][### End ### ### ### ### ### ### ###]"); + saveLog("[" + this.taskName + "][### End ### ### ### ### ### ### ###]"); } } @@ -116,7 +116,7 @@ public abstract class ReportTask extends Thread { return; } try { - saveSystemLog("[" + this.taskName + "][Expire connect user: " + reportUserDto + "]"); + saveLog("[" + this.taskName + "][Expire connect user: " + reportUserDto + "]"); if (reportUserDto != null) { if (reportUserDto.getUserId() != null) { reportUserQueue.removeUser(reportUserDto.getUserId()); diff --git a/src/main/java/com/munjaon/server/util/JobFileFactory.java b/src/main/java/com/munjaon/server/util/JobFileFactory.java index 34ad994..4b132fd 100644 --- a/src/main/java/com/munjaon/server/util/JobFileFactory.java +++ b/src/main/java/com/munjaon/server/util/JobFileFactory.java @@ -2,7 +2,7 @@ package com.munjaon.server.util; import com.munjaon.server.util.dto.FileBaseDto; import lombok.extern.slf4j.Slf4j; -import org.springframework.web.multipart.MultipartFile; +//import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.FileInputStream; @@ -363,126 +363,4 @@ public final class JobFileFactory { public static String getJobDirectory(final String rootDirectory, final String orderNo, final String companyNo, final String date) { return rootDirectory + File.separator + orderNo + File.separator + orderNo + "_" + companyNo + File.separator + date; } - - /** - * 파일관련 : 다중 파일 업로드 - * @param path - * @param listMultipartFile - * @return - * @throws IOException - */ - public static List uploadMultiFile(final String path, final List listMultipartFile) throws IOException { - return uploadMultiFileEnableExtension(path, listMultipartFile, null); - } - - /** - * 파일관련 : 다중 파일 업로드 : 허용 확장자 - * @param path - * @param listMultipartFile - * @param listEnableExtension - * @return - * @throws IOException - */ - public static List uploadMultiFileEnableExtension(final String path, final List listMultipartFile, final String[] listEnableExtension) throws IOException { - if (listMultipartFile == null || listMultipartFile.size() == 0) { - return null; - } - - List listFile = null; - for (MultipartFile multipartFile : listMultipartFile) { - if (multipartFile.isEmpty()) { - continue; - } - - FileBaseDto fileBaseDto = uploadFileEnableExtension(path, multipartFile, listEnableExtension); - if (fileBaseDto != null) { - if (listFile == null) { - listFile = new ArrayList<>(); - } - listFile.add(fileBaseDto); - } - } - return listFile; - } - - /** - * 파일관련 : 파일 업로드 - * @param path - * @param multipartFile - * @return - * @throws IOException - */ - public static FileBaseDto uploadFile(final String path, final MultipartFile multipartFile) throws IOException { - return uploadFileEnableExtension(path, multipartFile, null); - } - - /** - * 파일관련 : 파일 업로드 : 허용 확장자 - * @param path - * @param multipartFile - * @param listEnableExtension - * @return - * @throws IOException - */ - public static FileBaseDto uploadFileEnableExtension(final String path, final MultipartFile multipartFile, final String[] listEnableExtension) throws IOException { - if (multipartFile == null || multipartFile.isEmpty()) { - return null; - } - if (exist(path) == false) { - makeMultiDirectory(path); - } - - boolean enableUpload = true; - if (listEnableExtension != null && listEnableExtension.length > 0) { - enableUpload = false; // 가능한 확장자를 만나면 다시 true - String extension = getExtension(multipartFile.getOriginalFilename()); - if (extension != null) { - for (String enableExtension : listEnableExtension) { - if (extension.equals(enableExtension)) { - enableUpload = true; - break; - } - } - } - } - - FileBaseDto fileBaseDto = null; - if (enableUpload) { - fileBaseDto = new FileBaseDto(); - fileBaseDto.setOriginFileName(multipartFile.getOriginalFilename()); - fileBaseDto.setSaveFileName(getSaveFileName(multipartFile.getOriginalFilename())); - fileBaseDto.setFileSize(multipartFile.getSize()); - - String uploadPath = path + File.separator + fileBaseDto.getSaveFileName(); - File uploadFile = new File(uploadPath); - multipartFile.transferTo(uploadFile); - } - - return fileBaseDto; - } - - public static Long uploadFileSize(final MultipartFile multipartFile) { - if (multipartFile == null || multipartFile.isEmpty()) { - return -1L; - } - - return multipartFile.getSize(); - } - /* */ - public static void main(String[] args) throws IOException { - System.out.println(); -// File file = new File("d:\\example\\image.jpg"); -// long bytes = file.length(); -// long kilobyte = bytes / 1024; -// long megabyte = kilobyte / 1024; -// System.out.println(bytes + " byte"); // 3980059 byte System.out.println(kilobyte + " kb"); // 3886 kb System.out.println(megabyte + " mb"); // 3 mb -// File file = new File("c:\\example\\new_directory\\test.txt"); -// boolean directoryCreated = file.mkdirs(); - System.out.println("ext : " + JobFileFactory.getExtension("test")); - System.out.println("name : " + JobFileFactory.getFileName("test")); - System.out.println("name : " + JobFileFactory.getSaveFileName("test.txt")); - System.out.println("exist : " + JobFileFactory.exist("C:\\uploads\\20231129\\30e718ce1445499a9ef1c4929310c87f.xlsx")); - System.out.println("Now : " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd"))); -// System.out.println("transfer : " + JobFileFactory.transferFile("C:\\Docs", "test.txt", "C:\\Docs", "test2.txt")); - } } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 94bd1c7..7464547 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -7,6 +7,8 @@ spring: logging: level: root: info +# org.springframework: DEBUG +# org.springframework.web: DEBUG mybatis: configuration: diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml index 7e1f61a..7c1e9c3 100644 --- a/src/main/resources/logback-spring.xml +++ b/src/main/resources/logback-spring.xml @@ -20,7 +20,7 @@ ./log/info/info-${BY_DATE}.log - INFO + DEBUG ACCEPT DENY