로그현황 - 개인정보 로그

thkim
Lim\jun 2024-01-04 18:33:36 +09:00
parent 5fa0e3f25f
commit ff14346de4
7 changed files with 379 additions and 7 deletions

View File

@ -32,9 +32,11 @@
/* Board */ /* Board */
.board_list {border-top: 2px solid #222;} .board_list {border-top: 2px solid #222;}
.board_list .head {display: table; table-layout: fixed; width: 100%;} .board_list .head {display: table; table-layout: fixed; width: 100%;}
.board_list .head > span {display: table-cell; padding: 25px 0 27px 0; border-bottom: 1px solid #888; font-size: 16px; font-weight: 500px; text-align: center;} /* changed by lim padding: 25px 0 27px 0; */
.board_list .head > span {display: table-cell; padding: 10px 0 10px 0; border-bottom: 1px solid #888; font-size: 16px; font-weight: 500px; text-align: center;}
.board_list .result .list_item {display: table; width: 100%; table-layout: fixed;} .board_list .result .list_item {display: table; width: 100%; table-layout: fixed;}
.board_list .result .list_item > div {display: table-cell; padding: 18px 0 20px 0; border-bottom: 1px solid #dde2e5; color: #666; font-size: 16px; text-align: center; vertical-align: middle;} /* changed by lim padding: 18px 0 20px 0; */
.board_list .result .list_item > div {display: table-cell; padding: 7px 0 7px 0; border-bottom: 1px solid #dde2e5; color: #666; font-size: 16px; text-align: center; vertical-align: middle;}
.board_list .result .list_item > div.al {padding: 18px 30px 20px 30px; text-align: left;} .board_list .result .list_item > div.al {padding: 18px 30px 20px 30px; text-align: left;}
.board_list .result .list_item > div.reply {position: relative; padding: 18px 30px 20px 52px;} .board_list .result .list_item > div.reply {position: relative; padding: 18px 30px 20px 52px;}
.board_list .result .list_item > div.reply::before {content: ""; display: block; position: absolute; left: 27px; top: 24px; width: 22px; height: 14px; background: url(css/images/ico_reply.png) no-repeat;} .board_list .result .list_item > div.reply::before {content: ""; display: block; position: absolute; left: 27px; top: 24px; width: 22px; height: 14px; background: url(css/images/ico_reply.png) no-repeat;}
@ -245,7 +247,7 @@ select::-ms-expand {display:none;}
/* Title */ /* Title */
.tit_1 {position: relative; padding-bottom: 50px; color: #222; font-size: 48px; font-weight: 500; letter-spacing: -2px; line-height: 48px;} .tit_1 {position: relative; padding-bottom: 20px; color: #222; font-size: 38px; font-weight: 500; letter-spacing: -2px; line-height: 48px;} /* changed by lim padding-bottom: 50px; font-size: 48px;*/
.tit_1::after {content: ""; display: block; position: absolute; left: 0; bottom: 0; width: 30px; height: 2px; background: #0465be;} .tit_1::after {content: ""; display: block; position: absolute; left: 0; bottom: 0; width: 30px; height: 2px; background: #0465be;}
.tit_2 {font-size: 30px; font-weight: 700;} .tit_2 {font-size: 30px; font-weight: 700;}

View File

@ -1,13 +1,147 @@
import React from 'react'; import React, { useState, useEffect, useCallback, useRef } from 'react';
import { Link, useLocation } from 'react-router-dom';
import * as EgovNet from 'api/egovFetch';
import URL from 'constants/url';
function UserConnections(props) { import { default as EgovLeftNav } from 'components/leftmenu/EgovLeftNavAdmin';
import EgovPaging from 'components/EgovPaging';
import { itemIdxByPage } from 'utils/calc';
function PrivacyConnections(props) {
// console.group("EgovAdminPrivacyList");
// console.log("[Start] EgovAdminPrivacyList ------------------------------");
// console.log("EgovAdminPrivacyList [props] : ", props);
const location = useLocation();
// console.log("EgovAdminPrivacyList [location] : ", location);
// const cndRef = useRef();
// const wrdRef = useRef();
// eslint-disable-next-line no-unused-vars
const [searchCondition, setSearchCondition] = useState(location.state?.searchCondition || { pageIndex: 1, searchCnd: '0', searchWrd: '' });// ||
const [paginationInfo, setPaginationInfo] = useState({});
const [listTag, setListTag] = useState([]);
const retrieveList = useCallback((srchCnd) => {
// console.groupCollapsed("EgovAdminUsageList.retrieveList()");
const retrieveListURL = '/admin/logs/privacy';
const requestOptions = {
method: "POST",
headers: {
'Content-type': 'application/json',
},
body: JSON.stringify(srchCnd)
}
EgovNet.requestFetch(retrieveListURL,
requestOptions,
(resp) => {
setPaginationInfo(resp.result.paginationInfo);
let mutListTag = [];
listTag.push(<p className="no_data" key="0">데이터가 없습니다.</p>); //
const resultCnt = parseInt(resp.result.resultCnt);
const currentPageNo = resp.result.paginationInfo.currentPageNo;
const pageSize = resp.result.paginationInfo.pageSize;
const startIndex = (currentPageNo - 1) * pageSize;
const endIndex = Math.min(startIndex + pageSize, resultCnt);
//
for (let index = startIndex; index < endIndex; index++) {
const listIdx = itemIdxByPage(resultCnt, currentPageNo, 0, index); // pageSize listIdx 2 0
const item = resp.result.resultList[index];
mutListTag.push(
<div key={listIdx} className="list_item">
<div>{listIdx}</div>
<div>{item.userId}</div>
<div>{item.targetUserId}</div>
<div>{item.accessType === "PRV_LIST" ? "사용자현황 조회" : item.accessType === "PRV_VIEW" ? "User 상세조회" : "User 수정"}</div>
<div>{item.ipAddress}</div>
<div>{item.accessDt}</div>
</div>
);
}
setListTag(mutListTag);
},
function (resp) {
console.log("err response : ", resp);
}
);
// console.groupEnd("EgovAdminPrivacyList.retrieveList()");
},[listTag]);
useEffect(() => {
retrieveList(searchCondition);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// console.log("------------------------------EgovAdminPrivacyList [End]");
// console.groupEnd("EgovAdminPrivacyList");
return ( return (
<div className="container"> <div className="container">
UserConnections <div className="c_wrap">
{/* <!-- Location --> */}
<div className="location">
<ul>
<li><Link to={URL.MAIN} className="home">Home</Link></li>
<li><Link to={URL.ADMIN} >사이트관리</Link></li>
<li>로그현황</li>
</ul>
</div>
{/* <!--// Location --> */}
<div className="layout">
{/* <!-- Navigation --> */}
<EgovLeftNav></EgovLeftNav>
{/* <!--// Navigation --> */}
<div className="contents NOTICE_LIST" id="contents">
{/* <!-- 본문 --> */}
<div className="top_tit">
<h1 className="tit_1">개인정보 로그현황</h1>
</div>
{/* <!-- 게시판목록 --> */}
<div className="board_list BRD009">
<div className="head">
<span>번호</span>
<span>관리자 ID</span>
<span>수정 ID</span>
<span>타입</span>
<span>접속IP</span>
<span>변경일자</span>
</div>
<div className="result">
{listTag}
</div>
</div>
{/* <!--// 게시판목록 --> */}
<div className="board_bot">
{/* <!-- Paging --> */}
<EgovPaging pagination={paginationInfo} moveToPage={passedPage => {
retrieveList({ ...searchCondition, pageIndex: passedPage }) //, searchCnd: cndRef.current.value, searchWrd: wrdRef.current.value
}} />
{/* <!--/ Paging --> */}
</div>
{/* <!--// 본문 --> */}
</div>
</div>
</div>
</div> </div>
); );
} }
export default UserConnections; export default PrivacyConnections;

View File

@ -0,0 +1,79 @@
package com.dbnt.kcscbackend.admin.logs;
import com.dbnt.kcscbackend.admin.logs.entity.ThPrivacyLog;
import com.dbnt.kcscbackend.admin.logs.service.AdminLogsService;
import com.dbnt.kcscbackend.auth.entity.LoginVO;
import com.dbnt.kcscbackend.config.common.BaseController;
import com.dbnt.kcscbackend.config.common.ResponseCode;
import com.dbnt.kcscbackend.config.common.ResultVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.egovframe.rte.fdl.property.EgovPropertyService;
import org.egovframe.rte.ptl.mvc.tags.ui.pagination.PaginationInfo;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequiredArgsConstructor
@RequestMapping("/admin/logs")
@Tag(name="AdminLogsController", description = "사이트관리 로그현황 메뉴 컨트롤러")
public class AdminLogsController extends BaseController {
@Resource(name = "propertiesService")
protected EgovPropertyService propertyService;
private final AdminLogsService adminLogsService;
@Operation(
summary = "로그현황 - 개인정보 로그",
description = "개인정보 로그현황",
tags = {"AdminLogsController"}
)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "조회 성공"),
@ApiResponse(responseCode = "403", description = "인가된 사용자가 아님")
})
@RequestMapping(method = RequestMethod.POST, value = "/privacy", consumes = MediaType.APPLICATION_JSON_VALUE)
public ResultVO selectPrivacyLogsList(@RequestBody ThPrivacyLog thPrivacyLog, @AuthenticationPrincipal LoginVO user)
throws Exception {
ResultVO resultVO = new ResultVO();
Map<String, Object> resultMap = adminLogsService.selectPrivacyList();
PaginationInfo paginationInfo = new PaginationInfo();
paginationInfo.setCurrentPageNo(thPrivacyLog.getPageIndex());
paginationInfo.setRecordCountPerPage(propertyService.getInt("Globals.pageUnit"));
paginationInfo.setPageSize(propertyService.getInt("Globals.pageSize"));
thPrivacyLog.setFirstIndex(paginationInfo.getFirstRecordIndex());
thPrivacyLog.setLastIndex(paginationInfo.getLastRecordIndex());
thPrivacyLog.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
int totCnt = Integer.parseInt((String)resultMap.get("resultCnt"));
paginationInfo.setTotalRecordCount(totCnt);
// resultMap.put("resultList", adminLogsService.selectPrivacyList());
// resultMap.put("resultList", resultMap.get("resultList"));
// resultMap.put("resultCnt", totCnt);
resultMap.put("paginationInfo", paginationInfo);
resultVO.setResultCode(ResponseCode.SUCCESS.getCode());
resultVO.setResultMessage(ResponseCode.SUCCESS.getMessage());
resultVO.setResult(resultMap);
return resultVO;
}
}

View File

@ -0,0 +1,99 @@
package com.dbnt.kcscbackend.admin.logs.entity;
import java.io.Serializable;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Getter
@Setter
@Accessors(chain = true)
@Entity
@NoArgsConstructor
@DynamicInsert
@DynamicUpdate
@Table(name = "th_user_privacy_log")
public class ThPrivacyLog implements Serializable {
private static final long serialVersionUID = -3779821913760046011L;
@Transient
@Schema(description = "검색시작일")
private String searchBgnDe = "";
@Transient
@Schema(description = "검색조건")
private String searchCnd = "";
@Transient
@Schema(description = "검색종료일")
private String searchEndDe = "";
@Transient
@Schema(description = "검색단어")
private String searchWrd = "";
@Transient
@Schema(description = "정렬순서(DESC,ASC)")
private long sortOrdr = 0L;
@Transient
@Schema(description = "검색사용여부")
private String searchUseYn = "";
@Transient
@Schema(description = "현재페이지")
private int pageIndex = 1;
@Transient
@Schema(description = "페이지갯수")
private int pageUnit = 10;
@Transient
@Schema(description = "페이지사이즈")
private int pageSize = 10;
@Transient
@Schema(description = "첫페이지 인덱스")
private int firstIndex = 1;
@Transient
@Schema(description = "마지막페이지 인덱스")
private int lastIndex = 1;
@Transient
@Schema(description = "페이지당 레코드 개수")
private int recordCountPerPage = 10;
@Transient
@Schema(description = "레코드 번호")
private int rowNo = 0;
@Id
@Column(name = "upl_seq")
private Long uplSeq;
@Column(name = "user_id")
private String userId;
@Column(name = "target_user_id")
private String targetUserId;
@Column(name = "access_type")
private String accessType;
@Column(name = "ip_address")
private String ipAddress;
@Column(name = "access_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate accessDt;
}

View File

@ -0,0 +1,7 @@
package com.dbnt.kcscbackend.admin.logs.mapper;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface AdminLogsMapper {
}

View File

@ -0,0 +1,12 @@
package com.dbnt.kcscbackend.admin.logs.repository;
import com.dbnt.kcscbackend.admin.logs.entity.ThPrivacyLog;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface PrivacyLogsRepository extends JpaRepository<ThPrivacyLog, String> {
long count(); // 전체 레코드 수를 반환하는 메서드
List<ThPrivacyLog> findAllByOrderByUplSeqDesc();
}

View File

@ -0,0 +1,39 @@
package com.dbnt.kcscbackend.admin.logs.service;
import com.dbnt.kcscbackend.admin.logs.entity.ThPrivacyLog;
import com.dbnt.kcscbackend.admin.logs.repository.PrivacyLogsRepository;
import lombok.RequiredArgsConstructor;
import org.egovframe.rte.fdl.cmmn.EgovAbstractServiceImpl;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@RequiredArgsConstructor
public class AdminLogsService extends EgovAbstractServiceImpl {
private final PrivacyLogsRepository privacyLogsRepository;
// public List<ThPrivacyLog> selectPrivacyList(){
// return privacyLogsRepository.findAll();
// }
public Map<String, Object> selectPrivacyList() {
Map<String, Object> resultMap = new HashMap<>();
// 전체 레코드 수 가져오기
long totalRecordCount = privacyLogsRepository.count();
// 개수를 resultMap에 추가
resultMap.put("resultCnt", String.valueOf(totalRecordCount));
// 개인 정보 로그 리스트 가져오기
List<ThPrivacyLog> privacyLogList = privacyLogsRepository.findAllByOrderByUplSeqDesc();
// 결과를 resultMap에 추가
resultMap.put("resultList", privacyLogList);
return resultMap;
}
}