
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
package com.takensoft.cms.cntnStats.web;
import com.takensoft.cms.cntnStats.dto.CntnStatsDTO;
import com.takensoft.cms.cntnStats.dto.CntnStatsExcelDTO;
import com.takensoft.cms.cntnStats.service.CntnStatsService;
import com.takensoft.common.excel.service.ExcelService;
import com.takensoft.common.message.MessageCode;
import com.takensoft.common.util.ResponseData;
import com.takensoft.common.util.ResponseUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import jakarta.servlet.http.HttpServletResponse;
import java.nio.charset.Charset;
import java.util.*;
/**
* @author takensoft
* @since 2024.05.23
* @modification
* since | author | description
* 2024.05.23 | takensoft | 최초 등록
* 2024.05.29 | 박정하 | selectUserCntnStatsProc 추가
* 2024.05.30 | 박정하 | selectMenuCntnStatsProc, selectBbsCntnStatsProc, excelDownload 추가
* 2025.03.17 | 방선주 | 코드 리펙토링
*
* 접속 통계 관련 컨트롤러
*/
@RestController
@RequiredArgsConstructor
@Slf4j
@RequestMapping(value = "/sys/cntnStats")
public class CntnStatsController {
private final CntnStatsService cntnStatsService;
private final ExcelService excelService;
private final ResponseUtil resUtil;
/**
* @param cntnStatsDTO - 접속 통계 DTO
* @return ResponseEntity - 접속 통계 등록 응답 결과
*
* 접속 통게 등록
*/
@PostMapping("/saveProc.json")
public ResponseEntity<?> saveProc(@RequestBody CntnStatsDTO cntnStatsDTO){
int result = cntnStatsService.cntnStatsSave(cntnStatsDTO);
// 응답 처리
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS);
}
/**
* @param params - 접속 통계 조회 파라미터
* @return ResponseEntity - 사용자 접속 통계 응답 결과
*
* 사용자 접속 통계
*/
@PostMapping("/selectUserCntnStatsProc.json")
public ResponseEntity<?> selectUserCntnStatsProc(@RequestBody HashMap<String, Object> params){
// 사용자 접속 통계 조회
HashMap<String, Object> result = cntnStatsService.userCntnStatsSelect(params);
// 응답 처리
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS);
}
/**
* @param params - 접속 통계 조회 파라미터
* @return ResponseEntity - 메뉴별 접속 통계 응답 결과
*
* 메뉴별 접속 통계
*/
@PostMapping("/selectMenuCntnStatsProc.json")
public ResponseEntity<?> selectMenuCntnStatsProc(@RequestBody HashMap<String, Object> params){
// 메뉴별 접속 통계 조회
HashMap<String, Object> result = cntnStatsService.menuCntnStatsSelect(params);
// 응답 처리
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS);
}
/**
* @param params - 접속 통계 조회 파라미터
* @return ResponseEntity - 게시판 접속 통계 응답 결과
*
* 게시판 접속 통계
*/
@PostMapping("/selectBbsCntnStatsProc.json")
public ResponseEntity<?> selectBbsCntnStatsProc(@RequestBody HashMap<String, Object> params){
// 게시판 접속 통계 조회
HashMap<String, Object> result = cntnStatsService.bbsCntnStatsSelect(params);
// 응답 처리
return resUtil.successRes(result, MessageCode.COMMON_SUCCESS);
}
/**
* @param response - HTTP 응답 객체
* @param cntnStats - 엑셀 다운로드 데이터
* @param chart - 차트 명
* @return ResponseEntity - 게시판 접속 통계 응답 결과
*
* 접속 통계 엑셀 다운로드
*/
@PostMapping("/excelDownload.file")
public void excelDownload(HttpServletResponse response, @RequestPart List<CntnStatsExcelDTO> cntnStats, @RequestPart String chart){
excelService.cntnStatsExcelDownload(response, cntnStats, chart);
}
}