로그레벨 수정, 웹기능 제거, 불필요 코드 정리

This commit is contained in:
jangdongsin 2024-10-22 08:55:43 +09:00
parent 011366d31b
commit b369522f6b
6 changed files with 17 additions and 136 deletions

View File

@ -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'

View File

@ -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);
// }
}

View File

@ -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());

View File

@ -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<FileBaseDto> uploadMultiFile(final String path, final List<MultipartFile> listMultipartFile) throws IOException {
return uploadMultiFileEnableExtension(path, listMultipartFile, null);
}
/**
* 파일관련 : 다중 파일 업로드 : 허용 확장자
* @param path
* @param listMultipartFile
* @param listEnableExtension
* @return
* @throws IOException
*/
public static List<FileBaseDto> uploadMultiFileEnableExtension(final String path, final List<MultipartFile> listMultipartFile, final String[] listEnableExtension) throws IOException {
if (listMultipartFile == null || listMultipartFile.size() == 0) {
return null;
}
List<FileBaseDto> 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"));
}
}

View File

@ -7,6 +7,8 @@ spring:
logging:
level:
root: info
# org.springframework: DEBUG
# org.springframework.web: DEBUG
mybatis:
configuration:

View File

@ -20,7 +20,7 @@
<appender name="FILE-INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>./log/info/info-${BY_DATE}.log</file>
<filter class = "ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<level>DEBUG</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>