2023-09-21 12:14 사용자 로그인 로그 수정

This commit is contained in:
myname 2023-09-21 12:14:14 +09:00
parent 7533c3e7e1
commit 59a09ea2f2
8 changed files with 207 additions and 15 deletions

View File

@ -29,6 +29,8 @@ public interface EgovLoginLogService {
* @param LoginLog * @param LoginLog
*/ */
public void logInsertLoginLog(LoginLog loinLog) throws Exception; public void logInsertLoginLog(LoginLog loinLog) throws Exception;
public int logInsertLoginLogNewStep1(LoginLog loinLog) throws Exception;
/** /**
* 접속로그를 조회한다. * 접속로그를 조회한다.

View File

@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl; import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl;
import egovframework.rte.fdl.idgnr.EgovIdGnrService; import egovframework.rte.fdl.idgnr.EgovIdGnrService;
import kcc.com.cmm.util.StringUtil2;
import kcc.let.sym.log.clg.service.EgovLoginLogService; import kcc.let.sym.log.clg.service.EgovLoginLogService;
import kcc.let.sym.log.clg.service.LoginLog; import kcc.let.sym.log.clg.service.LoginLog;
@ -66,6 +67,59 @@ public class EgovLoginLogServiceImpl extends EgovAbstractServiceImpl implements
loginLogDAO.logInsertWebLoginLog(loinLog); //사용자 페이지의 로그만 남김(메뉴에 등록된 페이지만 남김) loginLogDAO.logInsertWebLoginLog(loinLog); //사용자 페이지의 로그만 남김(메뉴에 등록된 페이지만 남김)
} }
public int logInsertLoginLogNewStep1(LoginLog loinLog) throws Exception {
// TODO Auto-generated method stub
String logId = egovLoginLogIdGnrService.getNextStringId();
loinLog.setLogId(logId);
//method name 설정
//LETTNLOGINLOG_BAK 테이블을 위해서 추가됨
//String[] s_arr = loinLog.getUrl().split("/");
//loinLog.setMethodNm(s_arr[s_arr.length-3]+"/"+s_arr[s_arr.length-2]+"/"+s_arr[s_arr.length-1]);
loinLog.setMethodNm(StringUtil2.extractLogMethodNm(loinLog.getUrl()));
System.out.println("loinLog.getMethodNm()");
System.out.println(loinLog.getMethodNm());
//loginLogDAO.logInsertLoginLog(loinLog);
int i=loginLogDAO.logInsertWebLoginLogNewStep1(loinLog); //사용자 페이지의 로그만 남김(메뉴에 등록된 페이지만 남김)
System.out.println("=====i=====");
System.out.println(i);
System.out.println(i);
try {
if (loinLog.getUrl().length()>400) {
loinLog.setUrl(loinLog.getUrl().substring(0,399));
}
if (i<=0) {
//LETTNADMINMETHOD 테이블에 추가하기
loginLogDAO.logInsertWebLoginLogNewStep3(loinLog);
//다시 남기기
i=loginLogDAO.logInsertWebLoginLogNewStep1(loinLog); //사용자 페이지의 로그만 남김(메뉴에 등록된 페이지만 남김)
//lettnloginlog 남기기
i=loginLogDAO.logInsertWebLoginLogNewStep2(loinLog); //사용자 페이지의 로그만 남김(메뉴에 등록된 페이지만 남김)
}
}catch(Exception ex) {
ex.printStackTrace();
}
System.out.println("=====i=====");
System.out.println(i);
System.out.println(i);
return i;
}
/** /**
* 접속로그를 조회한다. * 접속로그를 조회한다.
* *

View File

@ -143,6 +143,19 @@ public class LoginLogDAO extends EgovAbstractDAO {
insert("LoginLogDAO.logInsertWebLoginLog", loinLog); insert("LoginLogDAO.logInsertWebLoginLog", loinLog);
} }
public int logInsertWebLoginLogNewStep1(LoginLog loinLog) throws Exception{
return update("LoginLogDAO.logInsertWebLoginLogNewStep1", loinLog);
//return update("LoginLogDAO.logInsertWebLoginLogNewStep1_bak", loinLog);
}
public int logInsertWebLoginLogNewStep2(LoginLog loinLog) throws Exception{
return update("LoginLogDAO.logInsertWebLoginLogNewStep2", loinLog);
}
public int logInsertWebLoginLogNewStep3(LoginLog loinLog) throws Exception{
return update("LoginLogDAO.logInsertWebLoginLogNewStep3_bak", loinLog);
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public List<LoginLog> selectWebLogList(LoginLog loginLog) throws Exception{ public List<LoginLog> selectWebLogList(LoginLog loginLog) throws Exception{
return (List<LoginLog>)list("LoginLogDAO.selectWebLogList", loginLog); return (List<LoginLog>)list("LoginLogDAO.selectWebLogList", loginLog);

View File

@ -184,7 +184,7 @@ public class EgovLoginLogController {
loginLog.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); loginLog.setRecordCountPerPage(paginationInfo.getRecordCountPerPage());
if("".equals(loginLog.getSearchSortCnd())){ //최초조회시 최신것 조회List if("".equals(loginLog.getSearchSortCnd())){ //최초조회시 최신것 조회List
loginLog.setSearchSortCnd("b.ADMINLOG_ID"); loginLog.setSearchSortCnd("b.CREAT_DT");
loginLog.setSearchSortOrd("desc"); loginLog.setSearchSortOrd("desc");
} }
List<LoginLog> adminLogList = loginLogService.selectNWebLog(loginLog); List<LoginLog> adminLogList = loginLogService.selectNWebLog(loginLog);

View File

@ -735,7 +735,9 @@ public class MainController {
}else { }else {
loginLog.setUrl(request.getRequestURI()); loginLog.setUrl(request.getRequestURI());
} }
loginLogService.logInsertLoginLog(loginLog); //loginLogService.logInsertLoginLog(loginLog);
loginLogService.logInsertLoginLogNewStep1(loginLog);
} }
//오늘 접속 / 최종접속 //오늘 접속 / 최종접속

View File

@ -298,13 +298,16 @@
, c.USER_ID AS loginId , c.USER_ID AS loginId
, c.USER_NM AS userNm , c.USER_NM AS userNm
FROM LETTNADMINMETHOD a FROM LETTNADMINMETHOD a
, LETTNADMINLOG b , lettnloginlog b
, COMVNUSERMASTER c LEFT OUTER JOIN COMVNUSERMASTER c
ON(
1=1
AND b.CONECT_ID =c.ESNTL_ID
)
WHERE 1=1 WHERE 1=1
AND a.use_yn='Y' AND a.use_yn='Y'
AND a.method_cd='U' AND a.method_cd='U'
AND a.METHOD_NM =b.PROGRM_FILE_NM AND a.METHOD_NM =b.PROGRM_FILE_NM
AND b.CONECT_ID =c.ESNTL_ID
<isNotEmpty property="searchKeyword"> <isNotEmpty property="searchKeyword">
<isEqual prepend="AND" property="searchCondition" compareValue=""> <isEqual prepend="AND" property="searchCondition" compareValue="">
@ -546,6 +549,124 @@
AND B.URL = #url# AND B.URL = #url#
</insert> </insert>
<!-- 사용자 접속 로그 등록(매뉴에 등록된 페이지만 )-->
<update id="LoginLogDAO.logInsertWebLoginLogNewStep1" parameterClass="loginLog">
/* 임시.*NOT_SQL_LOG.* */
/* 2023-06-20일 저장확인을 위해 update 추가함*/
/* LoginLogDAO.logInsertWebLoginLogNewStep1 */
INSERT INTO LETTNLOGINLOG
( LOG_ID
, CONECT_ID
, CONECT_IP
, USER_AT
, DEVICE_TYPE /**인테넛,모바일 */
, PROGRM_FILE_NM
, MENU_NM
, URL
, CREAT_DT )
SELECT
#logId#
, #loginId#
, #loginIp#
, #userAt# /**A:관리자, U:홈페이지 */
, #deviceType#
, method_nm
, menu_nm
, #url#
, NOW()
FROM LETTNADMINMETHOD
WHERE METHOD_NM = #methodNm#
LIMIT 1
</update>
<!-- 사용자 접속 로그 등록(매뉴에 없는 페이지 등록용 )-->
<update id="LoginLogDAO.logInsertWebLoginLogNewStep2" parameterClass="loginLog">
/* 임시.*NOT_SQL_LOG.* */
/* 2023-06-20일 저장확인을 위해 update 추가함*/
/* LoginLogDAO.logInsertWebLoginLogNewStep2 */
INSERT INTO LETTNLOGINLOG
( LOG_ID
, CONECT_ID
, CONECT_IP
, USER_AT
, DEVICE_TYPE /**인테넛,모바일 */
, PROGRM_FILE_NM
, MENU_NO
, MENU_NM
, URL
, CREAT_DT )
SELECT
#logId#
, #loginId#
, #loginIp#
, #userAt# /**A:관리자, U:홈페이지 */
, #deviceType#
, 'PROGRM_FILE_NM'
, '999999999'
, 'MENU_NM'
, #url#
, NOW()
FROM DUAL
</update>
<!-- 사용자 접속 로그 등록(매뉴에 없는 페이지 등록용 )-->
<update id="LoginLogDAO.logInsertWebLoginLogNewStep2_bak" parameterClass="loginLog">
/* 임시.*NOT_SQL_LOG.* */
/* 2023-06-20일 저장확인을 위해 update 추가함*/
/* LoginLogDAO.logInsertWebLoginLogNewStep2 */
INSERT INTO LETTNLOGINLOG_BAK
( LOG_ID
, CONECT_ID
, CONECT_IP
, USER_AT
, DEVICE_TYPE /**인테넛,모바일 */
, PROGRM_FILE_NM
, MENU_NO
, MENU_NM
, URL
, CREAT_DT )
SELECT
#logId#
, #loginId#
, #loginIp#
, #userAt# /**A:관리자, U:홈페이지 */
, #deviceType#
, 'PROGRM_FILE_NM'
, '999999999'
, 'MENU_NM'
, #url#
, NOW()
</update>
<!-- 시스템 관리자 로그 등록(LETTNADMINMETHOD 테이블에 등록하기) -->
<update id="LoginLogDAO.logInsertWebLoginLogNewStep3_bak" parameterClass="loginLog">
/* LoginLogDAO.logInsertWebLoginLogNewStep3_bak */
INSERT INTO lettnadminmethod (
admot_id,
method_nm,
param,
creat_dt,
menu_nm,
appro_nm,
privacy,
method_cd /* A or U */
)
SELECT
NVL(MAX(TO_NUMBER(REPLACE(admot_id, 'ADMOTID_', ''))) + 1, 1)
, #methodNm#
, 'N'
, NOW()
, #methodNm#
, #url#
, 'N'
, 'U'
FROM LETTNADMINMETHOD
</update>
<!-- 사용자 메뉴별 접속 리스트 --> <!-- 사용자 메뉴별 접속 리스트 -->
<select id="LoginLogDAO.selectWebLogList" parameterClass="loginLog" resultClass="loginLog"> <select id="LoginLogDAO.selectWebLogList" parameterClass="loginLog" resultClass="loginLog">
/* 임시.*NOT_SQL_LOG.* */ /* 임시.*NOT_SQL_LOG.* */

View File

@ -143,7 +143,7 @@ function logListExcelDownload(){
<col style="width: 8%"> <col style="width: 8%">
<col style="width: 12%"> <col style="width: 12%">
<col style="width: 9%"> <col style="width: 9%">
<col style="width: 20%"> <%-- <col style="width: 20%"> --%>
<col style="width: 10%"> <col style="width: 10%">
<col style="width: 10%"> <col style="width: 10%">
<col style="width: 24%"> <col style="width: 24%">
@ -154,7 +154,7 @@ function logListExcelDownload(){
<th>번호 <button type="button" class="sortBtn sort" id="sort_logId"></button></th> <th>번호 <button type="button" class="sortBtn sort" id="sort_logId"></button></th>
<th>메뉴명 <button type="button" class="sortBtn sort" id="sort_menuNm"></button></th> <th>메뉴명 <button type="button" class="sortBtn sort" id="sort_menuNm"></button></th>
<th>접근구분 <button type="button" class="sortBtn sort" id="sort_approNm"></button></th> <th>접근구분 <button type="button" class="sortBtn sort" id="sort_approNm"></button></th>
<th>메소드 <button type="button" class="sortBtn sort" id="sort_progrmFileNm"></button></th> <!-- <th>메소드 <button type="button" class="sortBtn sort" id="sort_progrmFileNm"></button></th> -->
<th>접속ID <button type="button" class="sortBtn sort" id="sort_loginId"></button></th> <th>접속ID <button type="button" class="sortBtn sort" id="sort_loginId"></button></th>
<th>접속IP <button type="button" class="sortBtn sort" id="sort_loginIp"></button></th> <th>접속IP <button type="button" class="sortBtn sort" id="sort_loginIp"></button></th>
<th>접속URL <button type="button" class="sortBtn sort" id="sort_url"></button></th> <th>접속URL <button type="button" class="sortBtn sort" id="sort_url"></button></th>
@ -175,7 +175,7 @@ function logListExcelDownload(){
</td> </td>
<td><c:out value="${result.menuNm}"/></td> <td><c:out value="${result.menuNm}"/></td>
<td><c:out value="${result.approNm}"/></td> <td><c:out value="${result.approNm}"/></td>
<td><c:out value="${result.progrmFileNm}"/></td> <%-- <td><c:out value="${result.progrmFileNm}"/></td> --%>
<td><span class="privateInfo"><c:out value="${result.loginId}"/></span></td> <td><span class="privateInfo"><c:out value="${result.loginId}"/></span></td>
<td><c:out value="${result.loginIp}"/></td> <td><c:out value="${result.loginIp}"/></td>
<td><c:out value="${result.url}"/></td> <td><c:out value="${result.url}"/></td>

View File

@ -139,11 +139,11 @@ function logListExcelDownload(){
<div class="list tbType01"> <div class="list tbType01">
<table> <table>
<colgroup> <colgroup>
<col style="width: 8%"> <col style="width: 5%">
<col style="width: 12%"> <col style="width: 12%">
<col style="width: 9%"> <%-- <col style="width: 9%"> --%>
<col style="width: 20%"> <col style="width: 6%">
<col style="width: 10%"> <col style="width: 15%">
<col style="width: 10%"> <col style="width: 10%">
<col style="width: 24%"> <col style="width: 24%">
<col style="width: 15%"> <col style="width: 15%">
@ -152,7 +152,7 @@ function logListExcelDownload(){
<tr> <tr>
<th>번호 <button type="button" class="sortBtn sort" id="sort_logId"></button></th> <th>번호 <button type="button" class="sortBtn sort" id="sort_logId"></button></th>
<th>메뉴명 <button type="button" class="sortBtn sort" id="sort_menuNm"></button></th> <th>메뉴명 <button type="button" class="sortBtn sort" id="sort_menuNm"></button></th>
<th>접근구분 <button type="button" class="sortBtn sort" id="sort_approNm"></button></th> <!-- <th>접근구분 <button type="button" class="sortBtn sort" id="sort_approNm"></button></th> -->
<th>메소드 <button type="button" class="sortBtn sort" id="sort_progrmFileNm"></button></th> <th>메소드 <button type="button" class="sortBtn sort" id="sort_progrmFileNm"></button></th>
<th>접속ID <button type="button" class="sortBtn sort" id="sort_loginId"></button></th> <th>접속ID <button type="button" class="sortBtn sort" id="sort_loginId"></button></th>
<th>접속IP <button type="button" class="sortBtn sort" id="sort_loginIp"></button></th> <th>접속IP <button type="button" class="sortBtn sort" id="sort_loginIp"></button></th>
@ -173,8 +173,8 @@ function logListExcelDownload(){
</c:if> </c:if>
</td> </td>
<td><c:out value="${result.menuNm}"/></td> <td><c:out value="${result.menuNm}"/></td>
<%-- <td><c:out value="${result.methodNm}"/></td> --%>
<td><c:out value="${result.approNm}"/></td> <td><c:out value="${result.approNm}"/></td>
<td><c:out value="${result.progrmFileNm}"/></td>
<td><span class="privateInfo"><c:out value="${result.loginId}"/></span></td> <td><span class="privateInfo"><c:out value="${result.loginId}"/></span></td>
<td><c:out value="${result.loginIp}"/></td> <td><c:out value="${result.loginIp}"/></td>
<td><c:out value="${result.url}"/></td> <td><c:out value="${result.url}"/></td>