ads367 / yj_portal star
박정하 박정하 08-30
240830 박정하 배포 후 오류 수정
@7456052ff7d44adfd4a40872119537b6668081ff
pom.xml
--- pom.xml
+++ pom.xml
@@ -54,12 +54,6 @@
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
 			<artifactId>spring-boot-starter-web</artifactId>
-			<exclusions>
-				<exclusion>
-					<groupId>org.springframework.boot</groupId>
-					<artifactId>spring-boot-starter-logging</artifactId>
-				</exclusion>
-			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.springframework.boot</groupId>
src/main/java/com/takensoft/cms/bbs/service/Impl/BbsCnServiceImpl.java
--- src/main/java/com/takensoft/cms/bbs/service/Impl/BbsCnServiceImpl.java
+++ src/main/java/com/takensoft/cms/bbs/service/Impl/BbsCnServiceImpl.java
@@ -214,6 +214,8 @@
             if (path.startsWith("file:///")) {
                 // "file:///" 부분을 제거하고 경로를 반환
                 previewPath = path.replace("file:///", "") + fileUploadPath;
+            } else {
+                previewPath = locationPath + fileUploadPath;
             }
         }
         if (filePath == null) return null;
src/main/java/com/takensoft/cms/bbs/web/BbsTypeMngController.java
--- src/main/java/com/takensoft/cms/bbs/web/BbsTypeMngController.java
+++ src/main/java/com/takensoft/cms/bbs/web/BbsTypeMngController.java
@@ -70,7 +70,6 @@
      */
     @PostMapping("/findAll.json")
     public ResponseEntity<?> findAll(@RequestBody BbsTypeMngVO bbsTypeMngVO) throws Exception{
-        System.out.println("bbsTypeMng findAll = " + bbsTypeMngVO);
         // 게시판 유형 관리 목록 조회
         Map<String, Object> result = bbsTypeMngService.findAllBbsTypeMng(bbsTypeMngVO);
 
src/main/java/com/takensoft/cms/mber/web/RefreshTokenController.java
--- src/main/java/com/takensoft/cms/mber/web/RefreshTokenController.java
+++ src/main/java/com/takensoft/cms/mber/web/RefreshTokenController.java
@@ -51,7 +51,6 @@
             cookie.setPath("/"); // 쿠키 적용 범위
             cookie.setHttpOnly(true);
             res.addCookie(cookie);
-
             responseData.setStatus(HttpStatus.OK);
             responseData.setMessage("정상적으로 로그아웃 처리되었습니다.");
             return new ResponseEntity<>(responseData, headers, HttpStatus.OK);
src/main/java/com/takensoft/common/file/service/Impl/FileServiceImpl.java
--- src/main/java/com/takensoft/common/file/service/Impl/FileServiceImpl.java
+++ src/main/java/com/takensoft/common/file/service/Impl/FileServiceImpl.java
@@ -4,24 +4,16 @@
 import com.takensoft.common.file.service.FileService;
 import com.takensoft.common.file.vo.FileVO;
 import com.takensoft.common.util.JWTUtil;
-import com.takensoft.common.util.ResponseData;
 import lombok.RequiredArgsConstructor;
 import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
-import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 import org.springframework.web.multipart.MultipartFile;
-import org.springframework.web.multipart.MultipartHttpServletRequest;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.charset.Charset;
-import java.nio.file.Paths;
 import java.util.*;
 import java.util.UUID;
 
@@ -54,7 +46,7 @@
      * 파일 등록
      */
     @Override
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     public int fileInsert(String fileMngId, List<MultipartFile> multipartFileList) throws Exception {
         int result = 0;
 
@@ -71,13 +63,14 @@
             // 절대 경로 생성
             // "file:///" 제거하여 실제 파일 시스템 경로만을 저장
             String uploadPath = null;
-            String[] pathArray = locationPath.split("/, ");
-            for (String path : pathArray) {
-                if (path.startsWith("file:///")) {
-                    // "file:///" 부분을 제거하고 경로를 반환
-                    uploadPath = path.replace("file:///", "") + fileUploadPath;
-                }
-            }
+//            String[] pathArray = locationPath.split("/, ");
+//            for (String path : pathArray) {
+//                if (path.startsWith("file:///")) {
+//                    // "file:///" 부분을 제거하고 경로를 반환
+//                    uploadPath = path.replace("file:///", "") + fileUploadPath;
+//                }
+//            }
+            uploadPath = locationPath + fileUploadPath;
 
             // 파일 정보 가공
             String fileName = file.getOriginalFilename(); // 파일명 (원본)
@@ -163,15 +156,15 @@
 
                 // http 부분
                 String url = frontUrl + ":" + serverPort;
-
                 String uploadPath = null;
-                String[] pathArray = locationPath.split("/, ");
-                for (String path : pathArray) {
-                    if (path.startsWith("file:///")) {
-                        // "file:///" 부분을 제거하고 경로를 반환
-                        uploadPath = path.replace("file:///", "") + fileUploadPath;
-                    }
-                }
+//                String[] pathArray = locationPath.split("/, ");
+//                for (String path : pathArray) {
+//                    if (path.startsWith("file:///")) {
+//                        // "file:///" 부분을 제거하고 경로를 반환
+//                        uploadPath = path.replace("file:///", "") + fileUploadPath;
+//                    }
+//                }
+                uploadPath = locationPath + fileUploadPath;
 
                 String path = file.get("absltPath").toString();
                 path = path.replace(url, uploadPath);
@@ -206,44 +199,37 @@
     @Override
     public String editorUploadImg(MultipartFile file) throws Exception {
         MultipartFile uploadFile = file;
-
         // 파일 명 생성
         String originalFileName = uploadFile.getOriginalFilename();
         String ext = originalFileName.substring(originalFileName.lastIndexOf("."));
         String maskNm = UUID.randomUUID() + ext; // 랜덤으로 파일명 생성
-
         // 파일 저장 경로
         String uploadPath = null;
-        String[] pathArray = locationPath.split(", ");
-        for (String path : pathArray) {
-            if (path.startsWith("file:///")) {
-                // "file:///" 부분을 제거하고 경로를 반환
-                uploadPath = path.replace("file:///", "") + editPath;
-                break; // 루프를 종료하여 첫 번째 일치하는 경로만 사용
-            }
-        }
-        if (uploadPath == null) {
-            throw new Exception("Upload path is not properly configured.");
-        }
+//        String[] pathArray = locationPath.split(", ");
+//        for (String path : pathArray) {
+//            if (path.startsWith("file:///")) {
+//                // "file:///" 부분을 제거하고 경로를 반환
+//                uploadPath = path.replace("file:///", "") + editPath;
+//                break; // 루프를 종료하여 첫 번째 일치하는 경로만 사용
+//            }
+//        }
+//        if (uploadPath == null) {
+//            throw new Exception("Upload path is not properly configured.");
+//        }
+        uploadPath = "/home/cloud-user/front-end/invest/uploadFiles" + editPath;
         String savePath = uploadPath + maskNm;
-
         // 파일 저장
         try {
             File saveFile = new File(savePath);
-
             if (!saveFile.exists()) {
                 saveFile.mkdirs();
             }
             uploadFile.transferTo(saveFile);
-
         } catch (Exception e) {
             e.printStackTrace();
             throw new Exception("File upload failed.");
         }
-
-        String imgPath = frontUrl + ":" + serverPort + editPath + maskNm;
-
+        String imgPath = frontUrl + "/invest/uploadFiles" + editPath + maskNm;
         return imgPath;
     }
-
 }
(파일 끝에 줄바꿈 문자 없음)
src/main/java/com/takensoft/common/file/web/FileController.java
--- src/main/java/com/takensoft/common/file/web/FileController.java
+++ src/main/java/com/takensoft/common/file/web/FileController.java
@@ -35,20 +35,8 @@
 @Slf4j
 @RequestMapping(value="/sys/file")
 public class FileController {
-
     private final FileService fileService;
 
-    @Value("${front.url}")
-    private String frontUrl;
-
-    @Value("${server.port}")
-    private String serverPort;
-
-    @Value("${spring.web.resources.static-locations}")
-    private String locationPath;
-
-    @Value("${file.edit-file-upload-path}")
-    private String editPath;
     /**
      * @author 방선주
      * @since  2024.05.21
@@ -83,96 +71,6 @@
         }
     }
 
-    /**
-     * @author 방선주
-     * @since  2024.05.23
-     * @param
-     * @return
-     * @throws Exception
-     *
-     * 에디터 파일 업로드
-     */
-//    @PostMapping("/postImageUpload.file")
-//    public void postImageUpload(HttpServletRequest request, HttpServletResponse response){
-//        try {
-//            String sFileInfo = "";
-//            String sFilename = request.getHeader("file-name");
-//            String sFilenameExt = sFilename.substring(sFilename.lastIndexOf(".") + 1).toLowerCase();
-//
-//            // 허용되는 파일 확장자 목록
-//            String[] allowFileArr = {"jpg", "png", "bmp", "gif"};
-//            boolean isAllowed = Arrays.asList(allowFileArr).contains(sFilenameExt);
-//
-//            if (!isAllowed) {
-//                // 이미지가 아닐 경우
-//                PrintWriter print = response.getWriter();
-//                print.print("NOTALLOW_" + sFilename);
-//                print.flush();
-//                print.close();
-//            } else {
-//                // 파일 경로 설정
-//                System.out.println("locationPath : " + locationPath);
-//                System.out.println("editPath : " + editPath);
-//
-//                // "file:///" 제거하여 실제 파일 시스템 경로만을 저장
-//                String uploadFilePath = null;
-//                String[] pathArray = locationPath.split("/, ");
-//                for (String path : pathArray) {
-//                    if (path.startsWith("file:///")) {
-//                        // "file:///" 부분을 제거하고 경로를 반환
-//                        uploadFilePath = path.replace("file:///", "") + editPath;
-//                    }
-//                }
-//
-//                System.out.println("uploadFilePath : " + uploadFilePath);
-//
-//                String filePath = uploadFilePath; // 서버 이동시 경로 변경
-////                String filePath = "C:\\uploadFiles\\editFileUpload\\";
-//                File file = new File(filePath);
-//
-//                if (!file.exists()) {
-//                    file.mkdirs();
-//                }
-//
-//                // 고유 파일명 생성
-//                LocalDateTime localDateTime = LocalDateTime.now();
-//                String now = localDateTime.format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
-//                String sRealFileNm = now + UUID.randomUUID().toString() + sFilename.substring(sFilename.lastIndexOf("."));
-//                String rlFileNm = filePath + sRealFileNm;
-//
-//                // 서버에 파일 쓰기
-//                InputStream inputStream = request.getInputStream();
-//                OutputStream outputStream = new FileOutputStream(rlFileNm);
-//                int numRead;
-//                byte[] bytes = new byte[1024]; // 버퍼 크기를 더 작은 값으로 설정
-//                while ((numRead = inputStream.read(bytes, 0, bytes.length)) != -1) {
-//                    outputStream.write(bytes, 0, numRead);
-//                }
-//                inputStream.close();
-//                outputStream.flush();
-//                outputStream.close();
-//
-//                // 이미지 표시
-//                sFileInfo += "&bNewLine=true";
-//                sFileInfo += "&sFileName="+ sFilename;
-//                //TODO: 파일 경로를 절대경로로 설정함
-//                if(System.getProperty("os.name").indexOf("Windows") > -1){
-//                    sFileInfo += "&sFileURL=" + frontUrl + ":" + serverPort + editPath + sRealFileNm; // 서버 이동시 경로 변경
-//                } else {
-//                    sFileInfo += "&sFileURL=" + frontUrl + ":" + serverPort + editPath + sRealFileNm;
-//                }
-//
-//                // 출력
-//                PrintWriter printWriter = response.getWriter();
-//                printWriter.print(sFileInfo);
-//                printWriter.flush();
-//                printWriter.close();
-//            }
-//        } catch (Exception e) {
-//            e.printStackTrace();
-//            response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); // 예외 발생 시 서버 에러 상태 반환
-//        }
-//    }
     @PostMapping("/postImageUpload.file")
     public Map<String, Object> handleFileUpload(@RequestPart("upload") MultipartFile file) throws Exception {
         Map<String, Object> response = new HashMap<>();
src/main/java/com/takensoft/common/util/CustomAccessDenieHandler.java
--- src/main/java/com/takensoft/common/util/CustomAccessDenieHandler.java
+++ src/main/java/com/takensoft/common/util/CustomAccessDenieHandler.java
@@ -1,8 +1,5 @@
 package com.takensoft.common.util;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import com.takensoft.common.config.CommonConfig;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
src/main/java/com/takensoft/common/util/CustomAuthenticationEntryPoint.java
--- src/main/java/com/takensoft/common/util/CustomAuthenticationEntryPoint.java
+++ src/main/java/com/takensoft/common/util/CustomAuthenticationEntryPoint.java
@@ -1,8 +1,5 @@
 package com.takensoft.common.util;
 
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
 import com.takensoft.common.config.CommonConfig;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
src/main/java/com/takensoft/portal/entDscsnAply/web/EntDscsnAplyController.java
--- src/main/java/com/takensoft/portal/entDscsnAply/web/EntDscsnAplyController.java
+++ src/main/java/com/takensoft/portal/entDscsnAply/web/EntDscsnAplyController.java
@@ -1,6 +1,5 @@
 package com.takensoft.portal.entDscsnAply.web;
 
-import com.takensoft.common.Pagination;
 import com.takensoft.common.file.service.FileService;
 import com.takensoft.common.util.ResponseData;
 import com.takensoft.portal.entDscsnAply.service.EntDscsnAplyService;
@@ -11,7 +10,6 @@
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
 import java.nio.charset.Charset;
src/main/resources/application.yml
--- src/main/resources/application.yml
+++ src/main/resources/application.yml
@@ -54,8 +54,8 @@
 
   servlet:
     multipart:
-      max-file-size: 200MB
-      max-request-size: 200MB
+      max-file-size: 500MB
+      max-request-size: 500MB
 
   # 캐시 설정
   cache:
@@ -64,7 +64,8 @@
       spec: maximumSize=100, expireAfterAccess=1h
   web:
     resources:
-      static-locations: file:///C:/uploadFiles/, classpath:/static/
+      # static-locations: file:///C:/uploadFiles/, classpath:/static/
+      static-locations: /home/cloud-user/uploadFiles
 
 # Mybatis settings
 #mybatis:
@@ -106,3 +107,7 @@
 file:
   file-upload-path: /fileUpload/
   edit-file-upload-path: /editFileUpload/
+
+logging:
+  level:
+    root: error
(파일 끝에 줄바꿈 문자 없음)
 
src/main/resources/logback-srping.xml (deleted)
--- src/main/resources/logback-srping.xml
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- 15초마다 설정 파일의 변경을 확인 하여 변경시 갱신 -->
-<configuration scan="true" scanPeriod="15 seconds">
-    <!-- Server Log Config -->
-    <springProfile name="dev">
-        <property resource="application.properties"/>
-        <!-- log file path -->
-        <property name="LOG_PATH" value="/home/cloud-user/back-end/logs/logs"/>
-        <!-- log file name -->
-        <property name="LOG_FILE_NAME" value="log_file"/>
-        <!-- err log file name -->
-        <property name="ERR_LOG_FILE_NAME" value="err_file"/>
-        <!-- log pattern -->
-        <property name="LOG_PATTERN" value="%-5level %d{yy-MM-dd HH:mm:ss} [%thread] [%logger{0}-%M:%line] - %msg%n "/>
-        <appender name="DEV_CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
-            <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
-                <pattern>${LOG_PATTERN}</pattern>
-            </encoder>
-        </appender>
-        <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
-            <!-- 파일경로 설정 -->
-            <file>${LOG_PATH}/${LOG_FILE_NAME}.log</file>
-            <!-- 출력패턴 설정-->
-            <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
-                <pattern>${LOG_PATTERN}</pattern>
-            </encoder>
-            <!-- Rolling 정책 (파일 관리설정) -->
-            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-                <!-- .gz,.zip 등을 넣으면 자동 일자별 로그파일 압축 -->
-                <fileNamePattern>${LOG_PATH}/${LOG_FILE_NAME}.%d{yyyy-MM-dd}_%i.log</fileNamePattern>
-                <!--    파일 크기 지정할떄 사용 -->
-                <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                    <!-- 파일당 최고 용량 kb, mb, gb -->
-                    <maxFileSize>10MB</maxFileSize>
-                </timeBasedFileNamingAndTriggeringPolicy>
-                <!-- 일자별 로그파일 최대 보관주기(~일), 해당 설정일 이상된 파일은 자동으로 제거-->
-                <maxHistory>30</maxHistory>
-                <!--<MinIndex>1</MinIndex> <MaxIndex>10</MaxIndex>-->
-            </rollingPolicy>
-        </appender>
-        <appender name="Error" class="ch.qos.logback.core.rolling.RollingFileAppender">
-            <filter class="ch.qos.logback.classic.filter.LevelFilter">
-                <!-- 에러로그를 설정하고 로그의 레벨이 맞으면 onMatch, 아니라면 onMismatch  -->
-                <level>error</level>
-                <onMatch>ACCEPT</onMatch>
-                <onMismatch>DENY</onMismatch>
-            </filter>
-            <file>${LOG_PATH}/${ERR_LOG_FILE_NAME}.log</file>
-            <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
-                <pattern>${LOG_PATTERN}</pattern>
-            </encoder>
-            <!-- Rolling 정책 -->
-            <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
-                <fileNamePattern>${LOG_PATH}/${ERR_LOG_FILE_NAME}.%d{yyyy-MM-dd}_%i.log</fileNamePattern>
-                <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
-                    <maxFileSize>10MB</maxFileSize>
-                </timeBasedFileNamingAndTriggeringPolicy>
-                <maxHistory>30</maxHistory>
-            </rollingPolicy>
-        </appender>
-        <root>
-            <appender-ref ref="DEV_CONSOLE"/>
-            <appender-ref ref="FILE"/>
-            <appender-ref ref="Error"/>
-        </root>
-    </springProfile>
-</configuration>(파일 끝에 줄바꿈 문자 없음)
src/main/resources/mybatis/mapper/cntnStats/cntnStats-SQL.xml
--- src/main/resources/mybatis/mapper/cntnStats/cntnStats-SQL.xml
+++ src/main/resources/mybatis/mapper/cntnStats/cntnStats-SQL.xml
@@ -235,8 +235,8 @@
     -->
     <select id="selectUserCntnStats" parameterType="HashMap" resultType="HashMap">
         SELECT ai.dates
-            , array_agg(authrt_nm) AS authrt_nm
-            , array_agg(COALESCE(ucs.cntn_nope, 0)) AS cntn_nope
+             , array_agg(authrt_nm) AS authrt_nm
+             , array_agg(COALESCE(ucs.cntn_nope, 0)) AS cntn_nope
         FROM (SELECT generate_series(to_date(#{startDt}, 'YYYY-MM-DD'), to_date(#{endDt}, 'YYYY-MM-DD'), '1 day'::interval)::date AS dates , authrt_cd , authrt_nm FROM authrt_info WHERE use_yn = 'Y') AS ai
         LEFT JOIN (SELECT authrt_cd, to_date(concat(cntn_yr, cntn_mm, cntn_day), 'YYYYMMDD') AS cntn_date, cntn_nope FROM user_cntn_stats) AS ucs
         ON dates = ucs.cntn_date
@@ -251,7 +251,7 @@
         내   용 : 사용자 접속 통계 목록 개수 조회
     -->
     <select id="selectUserCntnStatsCnt" parameterType="HashMap">
-        SELECT SUM(COALESCE(cntn_nope, 0))
+        SELECT COALESCE(SUM(cntn_nope), 0)
           FROM user_cntn_stats
          WHERE to_date(concat(cntn_yr, cntn_mm, cntn_day), 'YYYYMMDD') >= to_date(#{startDt}, 'YYYY-MM-DD')
            AND to_date(#{endDt}, 'YYYY-MM-DD') >= to_date(concat(cntn_yr, cntn_mm, cntn_day), 'YYYYMMDD')
src/main/resources/mybatis/mapper/main/governmentMain-SQL.xml
--- src/main/resources/mybatis/mapper/main/governmentMain-SQL.xml
+++ src/main/resources/mybatis/mapper/main/governmentMain-SQL.xml
@@ -24,7 +24,7 @@
     </sql>
     <sql id="groupItem">
         <if test="searchKeyword != null and searchText != ''">
-            GROUP BY true
+            GROUP BY true::boolean
             <if test="searchKeyword == 'day'">
                 , stats_date::DATE
             </if>
src/main/resources/mybatis/mapper/mber/refresh-SQL.xml
--- src/main/resources/mybatis/mapper/mber/refresh-SQL.xml
+++ src/main/resources/mybatis/mapper/mber/refresh-SQL.xml
@@ -35,7 +35,7 @@
         DELETE
           FROM mbr_refresh
          WHERE mbr_id = #{mbrId}
-           AND use_ip = #{useIp}
+           AND use_ip like #{useIp} || '%'
     </delete>
 
     <!--
Add a comment
List