Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
김현주
2025-06-23 17:45:11 +09:00
22 changed files with 336 additions and 80 deletions

View File

@@ -1,5 +1,6 @@
package app.module.admin.config.adapters.web.interceptor;
import app.module.admin.config.application.util.AdminUtil;
import app.module.core.config.adapters.web.interceptor.model.URITopTierVO;
import app.module.core.config.application.enums.AppType;
import app.module.core.config.application.exception.NoMatchingURIException;
@@ -76,16 +77,16 @@ public class AdminURIInterceptor implements HandlerInterceptor {
// 활성 프로파일 가져오기 TODO 2차 오픈시 삭제 예정
modelAndView.addObject("activeProfile", activeProfiles);
String roleId = AdminUtil.getLoginUserRole();
if (!CommonUtil.isAjaxRequest(request)) {
URITopTier topTierOutput = topTierPortIn.connect(AppType.ADMIN);
URITopTier topTierOutput = topTierPortIn.connectRoleId(AppType.ADMIN,roleId);
modelAndView.addObject("topNode", recursiveMapping(topTierOutput));
if (modelAndView.getModelMap().getAttribute("currentURI") == null) {
modelAndView.addObject("currentURI", request.getAttribute("currentURI"));
}
modelAndView.addObject(
"menuHierarchy", uriAncestryPortIn.connect(AppType.ADMIN, request.getRequestURI()));
modelAndView.addObject("menuHierarchy", uriAncestryPortIn.connect(AppType.ADMIN, request.getRequestURI()));
if (cloudFrontDomain != null && bucketFolder != null) {
modelAndView.addObject("S3URL", "https://" + cloudFrontDomain + bucketFolder);

View File

@@ -65,17 +65,18 @@ public class AdminAuthSuccessEvent {
"security.password.change.notify", adminUser.getRemainPasswordDays()));
}
// 로그인 활성화 기록 생성
// loggedInUserSavePortIn.connect(
// LoggedInUserSaveCmd.builder()
// .loggedInUserId(
// LoggedInUserIdSaveCmd.builder()
// .appType(AppType.ADMIN)
// .id(authentication.getName())
// .build())
// .clientIP(CommonUtil.getClientIP(request))
// .lastLoggedInAt(LocalDateTime.now())
// .build());
// 로그인 이력 쌓기
loggedInUserSavePortIn.connect(
LoggedInUserSaveCmd.builder()
.loggedInUserId(
LoggedInUserIdSaveCmd.builder()
.appType(AppType.ADMIN)
.id(authentication.getName())
.build())
.clientIP(CommonUtil.getClientIP(request))
.lastLoggedInAt(LocalDateTime.now())
.build());
}
@EventListener

View File

@@ -46,6 +46,7 @@ public class AdminDetailsService implements UserDetailsService {
adminUser.getPassword(),
adminUser.getRoles().stream().map(CoreRole::getId).findFirst().orElse(null),
adminUser.getRegionMainCode(),
adminUser.getLastLoginIp(),
!accountDisabled,
true,
isCredentialsNonExpired(adminUser.getPasswordUpdatedAt()),

View File

@@ -10,6 +10,7 @@ public class AdminUser extends User {
private Long seq;
private String roleId;
private String regionMainCode;
private String lastLoginIp;
private long remainPasswordDays;
public AdminUser(
@@ -18,6 +19,7 @@ public class AdminUser extends User {
String password,
String roleId,
String regionMainCode,
String lastLoginIp,
boolean enabled,
boolean accountNonExpired,
boolean credentialsNonExpired,
@@ -35,6 +37,7 @@ public class AdminUser extends User {
this.seq = seq;
this.roleId = roleId;
this.regionMainCode = regionMainCode;
this.lastLoginIp = lastLoginIp;
this.remainPasswordDays = remainPasswordDays;
}
}

View File

@@ -53,4 +53,14 @@ public class AdminUtil {
AdminUser user = (AdminUser) authentication.getPrincipal();
return user.getRegionMainCode().isEmpty() ? null : user.getRegionMainCode();
}
public static String getLoginUserLastIp() {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
if (authentication == null || !(authentication.getPrincipal() instanceof AdminUser)) {
return null;
}
AdminUser user = (AdminUser) authentication.getPrincipal();
return user.getLastLoginIp();
}
}

View File

@@ -7,13 +7,15 @@
<insert id="insert" parameterType="app.module.core.config.adapters.persistence.entity.LoggedInUser">
INSERT INTO logged_in_user
(
app_type,
id,
app_type,
login_id,
clientip,
last_logged_in_at
)
VALUES
(
nextval('logged_in_user_seq'),
#{appType},
#{id},
#{clientIP},
@@ -27,7 +29,7 @@
clientip = #{clientIP},
last_logged_in_at = #{lastLoggedInAt}
WHERE app_type = #{appType}
AND id = #{id}
AND login_id = #{id}
</update>
</mapper>

File diff suppressed because one or more lines are too long

View File

@@ -6677,6 +6677,14 @@ input[type=number] {
-webkit-justify-content: space-between;
justify-content: space-between;
}
.table-group .table-tit-group.large {
margin-bottom: 2.4rem;
}
.table-group .table-tit-group.large h3 {
font-size: 2.4rem;
font-weight: 700;
color: #212529;
}
.table-group .table-tit-group h3 {
display: -webkit-box;
display: -webkit-flex;
@@ -6708,6 +6716,9 @@ table a {
table th {
background-color: #f1f3f5 !important;
}
table tr.total {
background-color: #F1F3F5;
}
table .align-right {
text-align: right;
}
@@ -7193,6 +7204,18 @@ table tbody th {
flex: 1;
background-color: #ffffff;
}
.dounut-chart-area .chart-group.type-green .donut-chart {
background: conic-gradient(#95BA45 -webkit-calc(var(--percent) * 1%), #E9ECEF 0%);
background: conic-gradient(#95BA45 calc(var(--percent) * 1%), #E9ECEF 0%);
}
.dounut-chart-area .chart-group.type-blue .donut-chart {
background: conic-gradient(#00B09B -webkit-calc(var(--percent) * 1%), #E9ECEF 0%);
background: conic-gradient(#00B09B calc(var(--percent) * 1%), #E9ECEF 0%);
}
.dounut-chart-area .chart-group.type-orange .donut-chart {
background: conic-gradient(#FD9E01 -webkit-calc(var(--percent) * 1%), #E9ECEF 0%);
background: conic-gradient(#FD9E01 calc(var(--percent) * 1%), #E9ECEF 0%);
}
.dounut-chart-area .chart-group dl {
color: #212529;
}
@@ -7231,16 +7254,22 @@ table tbody th {
.donut-chart {
--percent: 75;
width: 160px;
height: 160px;
min-width: 16rem;
min-height: 16rem;
width: 16rem;
height: 16rem;
border-radius: 50%;
background: conic-gradient(#95BA45 -webkit-calc(75 * 1%), #E9ECEF 0%);
background: conic-gradient(#95BA45 calc(75 * 1%), #E9ECEF 0%);
background: conic-gradient(#95BA45 -webkit-calc(var(--percent) * 1%), #E9ECEF 0%);
background: conic-gradient(#95BA45 calc(var(--percent) * 1%), #E9ECEF 0%);
background: conic-gradient(#95ba45 0 -webkit-calc(75 * 1%), #e9ecef 0);
background: conic-gradient(#95ba45 0 calc(75 * 1%), #e9ecef 0);
position: relative;
}
@supports (background: conic-gradient(red 0deg, red 0deg 1deg, red 2deg)){
.donut-chart {
background: conic-gradient(#95ba45 0 -webkit-calc(var(--percent) * 1%), #e9ecef 0);
background: conic-gradient(#95ba45 0 calc(var(--percent) * 1%), #e9ecef 0);
}
}
.donut-chart::before {
content: "";
position: absolute;
@@ -7253,6 +7282,100 @@ table tbody th {
background: #fff;
border-radius: 50%;
}
.donut-chart::after {
content: "";
position: absolute;
top: 0;
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
width: 4px;
height: 50px;
background: #ffffff;
}
.donut-chart .end-line {
content: "";
position: absolute;
top: 0;
left: 50%;
-webkit-transform: translateX(-50%) rotate(-webkit-calc(var(--percent) * 3.6deg));
transform: translateX(-50%) rotate(calc(var(--percent) * 3.6deg));
-webkit-transform-origin: center 80px;
transform-origin: center 80px;
width: 4px;
height: 50px;
background: #ffffff;
}
.progress-group {
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center;
-webkit-box-pack: center;
-webkit-justify-content: center;
justify-content: center;
gap: 2.4rem;
}
.progress-group.type-green .progress::-webkit-progress-value {
background: #95BA45;
border-radius: 0px;
}
.progress-group.type-blue .progress::-webkit-progress-value {
background: #00B09B;
border-radius: 0px;
}
.progress-group.type-orange .progress::-webkit-progress-value {
background: #FD9E01;
border-radius: 0px;
}
.progress-group .progress {
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
width: 100%;
max-width: 20rem;
height: 0.8rem;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.progress-group .progress::-webkit-progress-bar {
background: #E9ECEF;
border-radius: 12px;
height: 0.8rem;
overflow: hidden;
}
.progress-group .progress::-webkit-progress-value {
background: #95BA45;
border-radius: 0px;
}
.progress-group .detail {
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
align-items: center;
}
.progress-group .detail .percent {
position: relative;
padding-right: 1.3rem;
margin-right: 0.4rem;
}
.progress-group .detail .percent::after {
position: absolute;
content: "%";
display: block;
right: 0;
top: 0;
}
.progress-group .detail .d-flex {
gap: 0.2rem;
}
/* https://cdn.datatables.net/1.12.1/css/jquery.dataTables.min.css */
table.dataTable td.dt-control {

File diff suppressed because one or more lines are too long

View File

@@ -105,7 +105,7 @@
<!-- 자식 children 가 있는 경우 -->
<th:block th:if="${#lists.size(menu.children) > 0}">
<a th:href="${menu.uri}" th:text="${#messages.msg(menu.id)}">메뉴명</a>
<a href="#" th:text="${#messages.msg(menu.id)}" >메뉴명</a>
<th:block th:insert="~{this :: subMenuFrag}"
th:with="subMenus = ${menu.children}, addSubMenuClass = false">
</th:block>
@@ -133,7 +133,7 @@
</ul>
<div class="header-right">
<p class="user"><strong sec:authentication="name">로그인 사용자명</strong>님 안녕하세요</p>
<span class="user-ip">111.11.111.111</span>
<span class="user-ip" th:text="${@adminUtil.getLoginUserLastIp}">111.11.111.111</span>
<button class="btn-logout" onclick="location.href='/logout'">로그아웃</button>
</div>
</div>

View File

@@ -32,7 +32,7 @@
</tr>
</tbody>
</table>
<div class="component-btns bottom-btn-group">
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
<div class="btns-row align-right">
<button type="button" class="btn">
<span class="btn-txt">정보수정</span>

View File

@@ -20,7 +20,18 @@
<tr>
<th>방문일</th>
<td>
<input id="visitDate" class="flatpickr" name="visitDate" type="text" placeholder="방문일을 선택하세요"/>
<div class="component-datepicker">
<div class="component-input">
<div class="input-field">
<input type="text" class="datepicker-btn-trigger" name="visitDate" id="visitDate" aria-label="방문일"
placeholder="방문일을 입력해주세요" />
<span class="input-field-btn datepicker-state">
<span class="hide-txt">달력</span>
<i class="ico-calendar ico-normal" aria-hidden="true"></i>
</span>
</div>
</div>
</div>
</td>
<th>관리분야</th>
<td>
@@ -87,7 +98,7 @@
const showHouseholdModal2 = (seq) => {
document.querySelector(".modal02").ui.open();
initFlatpickr();
//initFlatpickr();
ajaxUtil._ajaxMethod(
'/api/researcher/visitHousehold/'+seq,

View File

@@ -24,6 +24,7 @@ public class AdminView implements Serializable {
private Boolean accountDisabled;
private Integer loginFailCnt;
private Boolean accountLocked;
private String lastLoginIp;
private LocalDateTime createdAt;
private String createdBy;
private LocalDateTime updatedAt;

View File

@@ -9,5 +9,7 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface URIMapper {
URITopTier findTopTierByAppType(@Param("appType") AppType appType);
URITopTier findTopTierByAppTypeByRoleId(@Param("appType") AppType appType,@Param("roleId") String roleId);
List<URITopTier> findChildrenByParentId(@Param("parentId") String parentId);
List<URITopTier> findChildrenByParentIdByRoleId(@Param("parentId") String parentId,@Param("roleId") String roleId);
}

View File

@@ -25,12 +25,33 @@ public class URITopTierDao implements URITopTierPortOut {
return recursiveMapping(top);
}
@Override
@Transactional
public URITopTier connectRoleId(AppType appType, String roleId) {
URITopTier top = uriMapper.findTopTierByAppTypeByRoleId(appType,roleId);
if (top == null) {
throw new RuntimeException("There is no top tier item of " + appType);
}
return recursiveMapping(top,roleId);
}
private URITopTier recursiveMapping(URITopTier current) {
List<URITopTier> children = uriMapper.findChildrenByParentId(current.getId());
current.setChildren(children.stream()
.map(this::recursiveMapping)
.map(this::recursiveMapping)
.collect(Collectors.toList()));
return current;
}
private URITopTier recursiveMapping(URITopTier current,String roleId) {
List<URITopTier> children = uriMapper.findChildrenByParentIdByRoleId(current.getId(),roleId);
current.setChildren(children.stream()
.map(uri -> recursiveMapping(uri,roleId))
.collect(Collectors.toList()));
return current;
}
}

View File

@@ -5,4 +5,5 @@ import app.module.core.usecase.uri.toptier.ports.application.domain.URITopTier;
public interface URITopTierPortIn {
URITopTier connect(AppType appType);
URITopTier connectRoleId(AppType appType, String roleId);
}

View File

@@ -6,4 +6,5 @@ import app.module.core.usecase.uri.toptier.ports.application.domain.URITopTier;
public interface URITopTierPortOut {
URITopTier connect(AppType appType);
URITopTier connectRoleId(AppType appType,String roleId);
}

View File

@@ -19,4 +19,10 @@ public class URITopTierService implements URITopTierPortIn {
public URITopTier connect(AppType appType) {
return topTierPortOut.connect(appType);
}
@Override
public URITopTier connectRoleId(AppType appType, String roleId) {
return topTierPortOut.connectRoleId(appType,roleId);
}
}

View File

@@ -18,12 +18,17 @@
a.account_disabled,
a.login_fail_cnt,
a.account_locked,
liu.clientip as last_login_ip,
a.created_at,
a.created_by,
a.updated_at,
a.updated_by
FROM admin a
WHERE id = #{id}
LEFT JOIN ( SELECT clientip,login_id
FROM logged_in_user liu
ORDER BY last_logged_in_at desc
LIMIT 1 ) liu on liu.login_id = a.id
WHERE a.id = #{id}
AND a.is_deleted = false
</select>

View File

@@ -2,32 +2,65 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="app.module.core.usecase.uri.toptier.adapters.persistence.URIMapper">
<select id="findTopTierByAppType" resultType="app.module.core.usecase.uri.toptier.ports.application.domain.URITopTier">
SELECT
u.id,
u.app_type,
u.text,
u.uri,
u.show_on_navi,
u.order_no
FROM uri u
WHERE u.app_type = #{appType}
AND u.parent_id IS NULL
AND u.is_deleted = false
</select>
<select id="findTopTierByAppType" resultType="app.module.core.usecase.uri.toptier.ports.application.domain.URITopTier">
<select id="findChildrenByParentId" resultType="app.module.core.usecase.uri.toptier.ports.application.domain.URITopTier">
SELECT
u.id,
u.app_type,
u.text,
u.uri,
u.show_on_navi,
u.order_no
FROM uri u
WHERE u.parent_id = #{parentId}
AND u.is_deleted = false
ORDER BY u.order_no ASC
</select>
<select id="findTopTierByAppTypeByRoleId" resultType="app.module.core.usecase.uri.toptier.ports.application.domain.URITopTier">
SELECT
id,
app_type,
text,
uri,
show_on_navi,
order_no
FROM uri
WHERE app_type = #{appType}
AND parent_id IS NULL
AND is_deleted = false
u.id,
u.app_type,
u.text,
u.uri,
u.show_on_navi,
u.order_no
FROM uri u
JOIN uri_has_role uhr ON u.id = uhr.uri_id and uhr.is_deleted = false
WHERE u.app_type = #{appType}
AND u.parent_id IS NULL
AND u.is_deleted = false
AND uhr.role_id = #{roleId}
AND u.show_on_navi = true
</select>
<select id="findChildrenByParentId" resultType="app.module.core.usecase.uri.toptier.ports.application.domain.URITopTier">
<select id="findChildrenByParentIdByRoleId" resultType="app.module.core.usecase.uri.toptier.ports.application.domain.URITopTier">
SELECT
id,
app_type,
text,
uri,
show_on_navi,
order_no
FROM uri
WHERE parent_id = #{parentId}
AND is_deleted = false
ORDER BY order_no ASC
u.id,
u.app_type,
u.text,
u.uri,
u.show_on_navi,
u.order_no
FROM uri u
JOIN uri_has_role uhr ON u.id = uhr.uri_id and uhr.is_deleted = false
WHERE u.parent_id = #{parentId}
AND u.is_deleted = false
AND uhr.role_id = #{roleId}
AND u.show_on_navi = true
ORDER BY u.order_no ASC
</select>
</mapper>

View File

@@ -831,23 +831,26 @@ COMMENT ON COLUMN operation_log.is_deleted IS '삭제여부';
-- ============================================
-- TABLE : logged_in_user
-- DESC : 로그인 사용자 정보 테이블
-- DESC : 로그인 사용자 이력 테이블
-- ============================================
CREATE SEQUENCE logged_in_user_seq START WITH 1 INCREMENT BY 1 CACHE 1 NO CYCLE;
CREATE TABLE logged_in_user (
id bigint DEFAULT nextval('logged_in_user_seq') NOT NULL, -- 로그 ID (PK)
app_type varchar(255) NOT NULL, -- 앱 타입 (FRONT / ADMIN)
id varchar(255) NOT NULL, -- 로그인 아이디
login_id varchar(255) NOT NULL, -- 로그인 아이디
last_logged_in_at timestamp(6), -- 마지막 로그인 날짜
clientip varchar(255), -- 접속 아이피
CONSTRAINT logged_in_user_pkey PRIMARY KEY (app_type, id),
CONSTRAINT logged_in_user_pkey PRIMARY KEY (id),
CONSTRAINT logged_in_user_app_type_check
CHECK (app_type::text = ANY (ARRAY['FRONT', 'ADMIN']))
);
COMMENT ON TABLE logged_in_user IS '로그인사용자정보테이블';
COMMENT ON TABLE logged_in_user IS '로그인사용자이력테이블';
COMMENT ON COLUMN logged_in_user.id IS '로그 ID';
COMMENT ON COLUMN logged_in_user.app_type IS '앱 타입';
COMMENT ON COLUMN logged_in_user.id IS '로그인 아이디';
COMMENT ON COLUMN logged_in_user.login_id IS '로그인 아이디';
COMMENT ON COLUMN logged_in_user.last_logged_in_at IS '마지막 로그인 날짜';
COMMENT ON COLUMN logged_in_user.clientip IS '접속 아이피';

View File

@@ -85,13 +85,13 @@
</div>
<div class="component-input">
<div class="input-field">
<input type="text" placeholder=0000 th:field="*{tel2}" maxlength="4"
<input type="text" th:field="*{tel2}" maxlength="4"
oninput="this.value=this.value.replace(/[^0-9]/g,'')"/>
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="text" placeholder=0000 th:field="*{tel3}" maxlength="4"
<input type="text" th:field="*{tel3}" maxlength="4"
oninput="this.value=this.value.replace(/[^0-9]/g,'')"/>
</div>
</div>
@@ -123,8 +123,7 @@
</div>
<div class="select-scroll">
<ul class="">
<li class="option" data-value="010">010</li>
<li class="option" data-value="011">011</li>
<li class="option" data-value="010" th:field="*{phone2}">010</li>
</ul>
</div>
</div>
@@ -132,13 +131,13 @@
</div>
<div class="component-input">
<div class="input-field">
<input type="text" id="temp_input_0006" placeholder=0000 th:field="*{phone2}"
<input type="text" id="temp_input_0006" th:field="*{phone2}"
maxlength="4" oninput="this.value=this.value.replace(/[^0-9]/g,'')">
</div>
</div>
<div class="component-input">
<div class="input-field">
<input type="text" id="temp_input_0007" placeholder=0000 th:field="*{phone3}"
<input type="text" id="temp_input_0007" th:field="*{phone3}"
maxlength="4" oninput="this.value=this.value.replace(/[^0-9]/g,'')">
</div>
</div>
@@ -155,24 +154,26 @@
</div>
<div id="regionMainCodeId" class="component-select bottom-sheet" data-props-default="시/도 선택"
<div id="regionMainCodeId" class="component-select bottom-sheet" data-props-default="지역 선택"
data-props-type="bottomSheet">
<input type="hidden" th:field="*{regionMainCode}" data-type="select">
<input type="hidden1" name="regionMainCode" data-type="select" th:value="${userInfo.regionMainCode}">
<button type="button" class="select-box">
<span class="select-txt">선택</span>
</button>
<div class="select-options">
<div class="select-header">
<p>시/도 선택</p>
<p>지역 선택</p>
<button type="button" class="select-close">
<span class="hide-txt">닫기</span>
</button>
</div>
<div class="select-scroll">
<ul class="">
<th:block th:each="item : ${regionMainList}">
<li class="option" th:data-value="${item.id}"
th:text="${item.codeText}">option1
th:text="${item.codeText}"
th:selected="${item.id eq userInfo.regionMainCode ? 'current' : ''}">option1
</li>
</th:block>
</ul>
@@ -185,14 +186,14 @@
<div class="select-group">
<div id="regionSubCodeId" class="component-select bottom-sheet"
data-props-default="시/군/구 선택" data-props-type="bottomSheet">
data-props-default="세부지역 선택" data-props-type="bottomSheet">
<input type="hidden" th:field="*{regionSubCode}" data-type="select">
<button type="button" class="select-box">
<span class="select-txt">선택</span>
</button>
<div class="select-options">
<div class="select-header">
<p>시/군/구 선택</p>
<p>세부지역 선택</p>
<button type="button" class="select-close">
<span class="hide-txt">닫기</span>
</button>
@@ -277,6 +278,10 @@
<section layout:fragment="script">
<script th:inline="javascript">
$(function() {
//formControl.init();
});
let ENV = {
httpUrl: {
root: /*[[#{uri.front.info.user.path}]]*/'rootUrl',
@@ -297,6 +302,18 @@
},
_bindUI() {
ENV.module.confirmPopup = document.querySelector(".confirmPopup").ui;
const $select1 = document.querySelector('#regionMainCodeId');
const selectboxInstance1 = new etUI.components.SelectBox();
selectboxInstance1.core.init($select1, {
selectItemCallback({selectValue, dataValue}){
console.log('selectItemCallback', selectValue, dataValue)
$('input[name="regionMainCode"]').val(dataValue);
}
});
// selectboxInstance1.update();
selectboxInstance1.setValue($('input[name=regionMainCode]').val());
},
confirmPopup() {
ENV.module.confirmPopup.open();