--- build.gradle
+++ build.gradle
... | ... | @@ -24,7 +24,7 @@ |
| 24 | 24 |
|
| 25 | 25 |
dependencies {
|
| 26 | 26 |
implementation 'org.springframework.boot:spring-boot-starter-batch' |
| 27 |
- implementation 'org.springframework.boot:spring-boot-starter-web' |
|
| 27 |
+// implementation 'org.springframework.boot:spring-boot-starter-web' |
|
| 28 | 28 |
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:3.0.3' |
| 29 | 29 |
compileOnly 'org.projectlombok:lombok' |
| 30 | 30 |
developmentOnly 'org.springframework.boot:spring-boot-devtools' |
--- src/main/java/com/munjaon/server/MunjaonServerApplication.java
+++ src/main/java/com/munjaon/server/MunjaonServerApplication.java
... | ... | @@ -10,14 +10,15 @@ |
| 10 | 10 |
@EnableCaching |
| 11 | 11 |
@EnableScheduling |
| 12 | 12 |
@SpringBootApplication |
| 13 |
-public class MunjaonServerApplication extends SpringBootServletInitializer {
|
|
| 13 |
+public class MunjaonServerApplication {
|
|
| 14 |
+//public class MunjaonServerApplication extends SpringBootServletInitializer {
|
|
| 14 | 15 |
|
| 15 | 16 |
public static void main(String[] args) {
|
| 16 | 17 |
SpringApplication.run(MunjaonServerApplication.class, args); |
| 17 | 18 |
} |
| 18 | 19 |
|
| 19 |
- @Override |
|
| 20 |
- protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
|
| 21 |
- return super.configure(builder); |
|
| 22 |
- } |
|
| 20 |
+// @Override |
|
| 21 |
+// protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
|
|
| 22 |
+// return super.configure(builder); |
|
| 23 |
+// } |
|
| 23 | 24 |
} |
--- src/main/java/com/munjaon/server/server/task/ReportTask.java
+++ src/main/java/com/munjaon/server/server/task/ReportTask.java
... | ... | @@ -53,9 +53,9 @@ |
| 53 | 53 |
@Override |
| 54 | 54 |
public void run() {
|
| 55 | 55 |
if (this.reportUserDto.isLogin()) {
|
| 56 |
- saveSystemLog("[" + this.taskName + "][ID : " + this.reportUserDto.getUserId() + "][### Start ### ### ### ### ### ### ###]");
|
|
| 56 |
+ saveLog("[" + this.taskName + "][ID : " + this.reportUserDto.getUserId() + "][### Start ### ### ### ### ### ### ###]");
|
|
| 57 | 57 |
} else {
|
| 58 |
- saveSystemLog("[" + this.taskName + "][### Start ### ### ### ### ### ### ###]");
|
|
| 58 |
+ saveLog("[" + this.taskName + "][### Start ### ### ### ### ### ### ###]");
|
|
| 59 | 59 |
} |
| 60 | 60 |
|
| 61 | 61 |
/* 최초 RUN Flag 체크 */ |
... | ... | @@ -73,7 +73,7 @@ |
| 73 | 73 |
} |
| 74 | 74 |
} catch (Exception e) {
|
| 75 | 75 |
this.IS_ERROR = true; |
| 76 |
- saveSystemLog(e); |
|
| 76 |
+ saveLog(e); |
|
| 77 | 77 |
} |
| 78 | 78 |
/* 중요 : 사용자 Thread 실행모드 Off */ |
| 79 | 79 |
reportUserDto.setRunningMode(false); |
... | ... | @@ -83,9 +83,9 @@ |
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 | 85 |
if (this.reportUserDto.isLogin()) {
|
| 86 |
- saveSystemLog("[" + this.taskName + "][ID : " + this.reportUserDto.getUserId() + "][### End ### ### ### ### ### ### ###]");
|
|
| 86 |
+ saveLog("[" + this.taskName + "][ID : " + this.reportUserDto.getUserId() + "][### End ### ### ### ### ### ### ###]");
|
|
| 87 | 87 |
} else {
|
| 88 |
- saveSystemLog("[" + this.taskName + "][### End ### ### ### ### ### ### ###]");
|
|
| 88 |
+ saveLog("[" + this.taskName + "][### End ### ### ### ### ### ### ###]");
|
|
| 89 | 89 |
} |
| 90 | 90 |
} |
| 91 | 91 |
|
... | ... | @@ -116,7 +116,7 @@ |
| 116 | 116 |
return; |
| 117 | 117 |
} |
| 118 | 118 |
try {
|
| 119 |
- saveSystemLog("[" + this.taskName + "][Expire connect user: " + reportUserDto + "]");
|
|
| 119 |
+ saveLog("[" + this.taskName + "][Expire connect user: " + reportUserDto + "]");
|
|
| 120 | 120 |
if (reportUserDto != null) {
|
| 121 | 121 |
if (reportUserDto.getUserId() != null) {
|
| 122 | 122 |
reportUserQueue.removeUser(reportUserDto.getUserId()); |
--- src/main/java/com/munjaon/server/util/JobFileFactory.java
+++ src/main/java/com/munjaon/server/util/JobFileFactory.java
... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 |
|
| 3 | 3 |
import com.munjaon.server.util.dto.FileBaseDto; |
| 4 | 4 |
import lombok.extern.slf4j.Slf4j; |
| 5 |
-import org.springframework.web.multipart.MultipartFile; |
|
| 5 |
+//import org.springframework.web.multipart.MultipartFile; |
|
| 6 | 6 |
|
| 7 | 7 |
import java.io.File; |
| 8 | 8 |
import java.io.FileInputStream; |
... | ... | @@ -362,127 +362,5 @@ |
| 362 | 362 |
|
| 363 | 363 |
public static String getJobDirectory(final String rootDirectory, final String orderNo, final String companyNo, final String date) {
|
| 364 | 364 |
return rootDirectory + File.separator + orderNo + File.separator + orderNo + "_" + companyNo + File.separator + date; |
| 365 |
- } |
|
| 366 |
- |
|
| 367 |
- /** |
|
| 368 |
- * 파일관련 : 다중 파일 업로드 |
|
| 369 |
- * @param path |
|
| 370 |
- * @param listMultipartFile |
|
| 371 |
- * @return |
|
| 372 |
- * @throws IOException |
|
| 373 |
- */ |
|
| 374 |
- public static List<FileBaseDto> uploadMultiFile(final String path, final List<MultipartFile> listMultipartFile) throws IOException {
|
|
| 375 |
- return uploadMultiFileEnableExtension(path, listMultipartFile, null); |
|
| 376 |
- } |
|
| 377 |
- |
|
| 378 |
- /** |
|
| 379 |
- * 파일관련 : 다중 파일 업로드 : 허용 확장자 |
|
| 380 |
- * @param path |
|
| 381 |
- * @param listMultipartFile |
|
| 382 |
- * @param listEnableExtension |
|
| 383 |
- * @return |
|
| 384 |
- * @throws IOException |
|
| 385 |
- */ |
|
| 386 |
- public static List<FileBaseDto> uploadMultiFileEnableExtension(final String path, final List<MultipartFile> listMultipartFile, final String[] listEnableExtension) throws IOException {
|
|
| 387 |
- if (listMultipartFile == null || listMultipartFile.size() == 0) {
|
|
| 388 |
- return null; |
|
| 389 |
- } |
|
| 390 |
- |
|
| 391 |
- List<FileBaseDto> listFile = null; |
|
| 392 |
- for (MultipartFile multipartFile : listMultipartFile) {
|
|
| 393 |
- if (multipartFile.isEmpty()) {
|
|
| 394 |
- continue; |
|
| 395 |
- } |
|
| 396 |
- |
|
| 397 |
- FileBaseDto fileBaseDto = uploadFileEnableExtension(path, multipartFile, listEnableExtension); |
|
| 398 |
- if (fileBaseDto != null) {
|
|
| 399 |
- if (listFile == null) {
|
|
| 400 |
- listFile = new ArrayList<>(); |
|
| 401 |
- } |
|
| 402 |
- listFile.add(fileBaseDto); |
|
| 403 |
- } |
|
| 404 |
- } |
|
| 405 |
- return listFile; |
|
| 406 |
- } |
|
| 407 |
- |
|
| 408 |
- /** |
|
| 409 |
- * 파일관련 : 파일 업로드 |
|
| 410 |
- * @param path |
|
| 411 |
- * @param multipartFile |
|
| 412 |
- * @return |
|
| 413 |
- * @throws IOException |
|
| 414 |
- */ |
|
| 415 |
- public static FileBaseDto uploadFile(final String path, final MultipartFile multipartFile) throws IOException {
|
|
| 416 |
- return uploadFileEnableExtension(path, multipartFile, null); |
|
| 417 |
- } |
|
| 418 |
- |
|
| 419 |
- /** |
|
| 420 |
- * 파일관련 : 파일 업로드 : 허용 확장자 |
|
| 421 |
- * @param path |
|
| 422 |
- * @param multipartFile |
|
| 423 |
- * @param listEnableExtension |
|
| 424 |
- * @return |
|
| 425 |
- * @throws IOException |
|
| 426 |
- */ |
|
| 427 |
- public static FileBaseDto uploadFileEnableExtension(final String path, final MultipartFile multipartFile, final String[] listEnableExtension) throws IOException {
|
|
| 428 |
- if (multipartFile == null || multipartFile.isEmpty()) {
|
|
| 429 |
- return null; |
|
| 430 |
- } |
|
| 431 |
- if (exist(path) == false) {
|
|
| 432 |
- makeMultiDirectory(path); |
|
| 433 |
- } |
|
| 434 |
- |
|
| 435 |
- boolean enableUpload = true; |
|
| 436 |
- if (listEnableExtension != null && listEnableExtension.length > 0) {
|
|
| 437 |
- enableUpload = false; // 가능한 확장자를 만나면 다시 true |
|
| 438 |
- String extension = getExtension(multipartFile.getOriginalFilename()); |
|
| 439 |
- if (extension != null) {
|
|
| 440 |
- for (String enableExtension : listEnableExtension) {
|
|
| 441 |
- if (extension.equals(enableExtension)) {
|
|
| 442 |
- enableUpload = true; |
|
| 443 |
- break; |
|
| 444 |
- } |
|
| 445 |
- } |
|
| 446 |
- } |
|
| 447 |
- } |
|
| 448 |
- |
|
| 449 |
- FileBaseDto fileBaseDto = null; |
|
| 450 |
- if (enableUpload) {
|
|
| 451 |
- fileBaseDto = new FileBaseDto(); |
|
| 452 |
- fileBaseDto.setOriginFileName(multipartFile.getOriginalFilename()); |
|
| 453 |
- fileBaseDto.setSaveFileName(getSaveFileName(multipartFile.getOriginalFilename())); |
|
| 454 |
- fileBaseDto.setFileSize(multipartFile.getSize()); |
|
| 455 |
- |
|
| 456 |
- String uploadPath = path + File.separator + fileBaseDto.getSaveFileName(); |
|
| 457 |
- File uploadFile = new File(uploadPath); |
|
| 458 |
- multipartFile.transferTo(uploadFile); |
|
| 459 |
- } |
|
| 460 |
- |
|
| 461 |
- return fileBaseDto; |
|
| 462 |
- } |
|
| 463 |
- |
|
| 464 |
- public static Long uploadFileSize(final MultipartFile multipartFile) {
|
|
| 465 |
- if (multipartFile == null || multipartFile.isEmpty()) {
|
|
| 466 |
- return -1L; |
|
| 467 |
- } |
|
| 468 |
- |
|
| 469 |
- return multipartFile.getSize(); |
|
| 470 |
- } |
|
| 471 |
- /* */ |
|
| 472 |
- public static void main(String[] args) throws IOException {
|
|
| 473 |
- System.out.println(); |
|
| 474 |
-// File file = new File("d:\\example\\image.jpg");
|
|
| 475 |
-// long bytes = file.length(); |
|
| 476 |
-// long kilobyte = bytes / 1024; |
|
| 477 |
-// long megabyte = kilobyte / 1024; |
|
| 478 |
-// System.out.println(bytes + " byte"); // 3980059 byte System.out.println(kilobyte + " kb"); // 3886 kb System.out.println(megabyte + " mb"); // 3 mb |
|
| 479 |
-// File file = new File("c:\\example\\new_directory\\test.txt");
|
|
| 480 |
-// boolean directoryCreated = file.mkdirs(); |
|
| 481 |
- System.out.println("ext : " + JobFileFactory.getExtension("test"));
|
|
| 482 |
- System.out.println("name : " + JobFileFactory.getFileName("test"));
|
|
| 483 |
- System.out.println("name : " + JobFileFactory.getSaveFileName("test.txt"));
|
|
| 484 |
- System.out.println("exist : " + JobFileFactory.exist("C:\\uploads\\20231129\\30e718ce1445499a9ef1c4929310c87f.xlsx"));
|
|
| 485 |
- System.out.println("Now : " + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
|
| 486 |
-// System.out.println("transfer : " + JobFileFactory.transferFile("C:\\Docs", "test.txt", "C:\\Docs", "test2.txt"));
|
|
| 487 | 365 |
} |
| 488 | 366 |
} |
--- src/main/resources/application.yml
+++ src/main/resources/application.yml
... | ... | @@ -7,6 +7,8 @@ |
| 7 | 7 |
logging: |
| 8 | 8 |
level: |
| 9 | 9 |
root: info |
| 10 |
+# org.springframework: DEBUG |
|
| 11 |
+# org.springframework.web: DEBUG |
|
| 10 | 12 |
|
| 11 | 13 |
mybatis: |
| 12 | 14 |
configuration: |
--- src/main/resources/logback-spring.xml
+++ src/main/resources/logback-spring.xml
... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 |
<appender name="FILE-INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
| 21 | 21 |
<file>./log/info/info-${BY_DATE}.log</file>
|
| 22 | 22 |
<filter class = "ch.qos.logback.classic.filter.LevelFilter"> |
| 23 |
- <level>INFO</level> |
|
| 23 |
+ <level>DEBUG</level> |
|
| 24 | 24 |
<onMatch>ACCEPT</onMatch> |
| 25 | 25 |
<onMismatch>DENY</onMismatch> |
| 26 | 26 |
</filter> |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?