Merge branch 'susu' into dev

This commit is contained in:
주수현
2025-06-16 17:34:08 +09:00
13 changed files with 407 additions and 82 deletions

View File

@@ -7,21 +7,22 @@
<select id="getHouseholdsStatus"
resultType="app.module.admin.usecase.household.getHouseholdsStatus.ports.application.domain.GetHouseholdsStatus">
/* getHouseholdsStatus : 임가현황 리스트 조회 */
WITH record_progress AS (
SELECT ROUND(
100.0 *
(SELECT COUNT(*)
FROM daily_record
WHERE record_month = #{cmd.recordMonth} AND all_status = 'DONE')
/ NULLIF(
<if test="!(cmd.viewType eq 'popup')">
WITH record_progress AS (
SELECT ROUND(
100.0 *
(SELECT COUNT(*)
FROM daily_day_group
WHERE end_day &lt;= EXTRACT(DAY FROM CURRENT_DATE)), 0
),
2
) AS progress_percent
) /* 일계부 입력 진행 완료 퍼센테이지 (이번달 작성 완료일 수 / 현재날짜 기준 전체 입력 가능 날짜 수) */
FROM daily_record
WHERE record_month = #{cmd.recordMonth} AND all_status = 'DONE')
/ NULLIF(
(SELECT COUNT(*)
FROM daily_day_group
WHERE end_day &lt;= EXTRACT(DAY FROM CURRENT_DATE)), 0
),
2
) AS progress_percent
) /* 일계부 입력 진행 완료 퍼센테이지 (이번달 작성 완료일 수 / 현재날짜 기준 전체 입력 가능 날짜 수) */
</if>
SELECT
hvr.*,
COUNT(*) OVER () AS total
@@ -42,7 +43,12 @@
h.industry_middle_code as industryMiddleCode,
h.industry_middle_name AS industryMiddleName,
h.is_panel AS isPanel,
<if test="!(cmd.viewType eq 'popup')">
ps.progress_percent AS progressPercent,
</if>
<if test="cmd.viewType eq 'popup'">
0 AS progressPercent,
</if>
v.first_visit_date AS firstVisitDate,
v.second_visit_date AS secondVisitDate,
COALESCE(v.is_gift_sent, false) AS isGiftSent,
@@ -51,7 +57,9 @@
FROM v_household_with_code h
LEFT JOIN v_household_visit v ON h.seq = v.household_seq
LEFT JOIN v_household_researcher r ON h.seq = r.household_seq
<if test="!(cmd.viewType eq 'popup')">
CROSS JOIN record_progress ps
</if>
) AS hvr
<where>
@@ -178,6 +186,18 @@
</when>
</choose>
</if>
<if test="cmd.isMapping != null">
/* 패널 유지 여부 */
<choose>
<when test="cmd.isMapping">
AND r.researcher_name is not null
</when>
<when test="!cmd.isMapping">
AND r.researcher_name is null
</when>
</choose>
</if>
</where>
ORDER BY hvr.householdNum ASC

View File

@@ -58,6 +58,7 @@
a.id,
a.name,
a.phone,
a.region_main_code,
u.code_text AS region_main_code_name,
case a.account_disabled when false then '사용' when true then '미사용' end account_disabled_flag
from admin a

View File

@@ -0,0 +1,250 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
layout:decorate="~{layout/layout}">
<div class="layer-wrap" th:fragment="modalFragment">
<div class="component-modal modal01" id="mappingHouseholdModal" data-props-dimm-click="true" data-state="close">
<div class="modal-dimm"></div>
<div class="modal-frame">
<div class="modal-container">
<div class="modal-header">
<h3 class="modal-tit" >임가 매핑</h3>
</div>
<div class="modal-content">
<div class="modal-content-inner">
<section class="filter-wrap">
<div class="form-area">
<form autocomplete="off" method="get" name="reqHouseholdForm" id="reqHouseholdForm">
<input name="page" th:field="*{reqVO.page}" type="hidden"/>
<input type="hidden" name="regionMainCode" th:value="${regionMainCode}">
<!-- 경영주 -->
<div class="input-group">
<div class="input-label">
<p class="label-txt">경영주</p>
</div>
<div class="d-flex">
<div class="component-select">
<select class="select-list" id="ownerField" name="ownerField">
<option value="all" selected>전체</option>
<option value="ownerName">이름</option>
<option value="phone">전화번호</option>
</select>
</div>
<div class="component-input">
<div class="input-field">
<input type="text" id="ownerValue" name="ownerValue" placeholder="입력" th:value="${ownerValue}">
</div>
</div>
</div>
</div>
<!-- 지역 -->
<div class="input-group">
<div class="d-flex">
<div class="component-select">
<div class="input-label">
<p class="label-txt">지역</p>
</div>
<select class="select-list" id="regionSubCode" name="regionSubCode">
<option value="" selected>전체</option>
<option th:each="region : ${regionSubList}" th:value="${region.id}" th:text="${region.codeText}"></option>
</select>
</div>
<div class="component-select">
<div class="input-label">
<p class="label-txt">세부지역</p>
</div>
<select class="select-list" id="regionDetailCode" name="regionDetailCode">
<option value="" selected>전체</option>
<option th:each="subRegion : ${regionDetailList}" th:value="${subRegion.id}" th:text="${subRegion.codeText}"></option>
</select>
</div>
</div>
</div>
<!-- 패널 유지 여부 및 맵핑 여부 -->
<div class="input-group">
<div class="d-flex">
<div class="component-select">
<div class="input-label">
<p class="label-txt">패널유지여부</p>
</div>
<select class="select-list" id="isPanel" name="isPanel">
<option value="" selected>전체</option>
<option value="true">유지</option>
<option value="false">탈락</option>
</select>
</div>
<div class="component-select">
<div class="input-label">
<p class="label-txt">맵핑여부</p>
</div>
<select class="select-list" id="isMapping" name="isMapping">
<option value="" selected>전체</option>
<option value="true">맵핑 완료</option>
<option value="false">맵핑 없음</option>
</select>
</div>
</div>
</div>
</form>
</div>
<div class="component-btns">
<div class="btns-row">
<button type="button" class="btn" onclick="resetSearchForm()">
<span class="btn-txt">초기화</span>
</button>
<button type="button" class="btn btn-primary" onclick="searchHouseholdList()">
<span class="btn-txt">검색</span>
</button>
</div>
</div>
</section>
<section>
<p class="input-label" style="font-size: 16px;">
총 <span id="mappingHouseholdTotalElements"></span>건
</p>
<table id="householdTable">
<thead>
<tr>
<th>선택</th>
<th>임가번호</th>
<th>경영주명</th>
<th>휴대폰번호</th>
<th>실사</th>
<th>지역</th>
<th>세부지역</th>
<th>조사원</th>
</tr>
</thead>
<tbody id="mappingHousehold-list"></tbody>
</table>
<!-- 페이지네이션 -->
<div class="row paging"></div>
<!-- 등록 버튼 -->
<div class="component-btns bottom-btn-group" th:fragment="modalButtons">
<div class="btns-row align-right">
<button type="button" class="btn btn-primary" onclick="registerHouseholds()">
<span class="btn-txt">등록</span>
</button>
</div>
</div>
</section>
</div>
<button class="modal-close" onclick="closeModal()"></button>
</div>
</div>
</div>
</div>
<script th:inline="javascript">
const showHouseholdModal = (button) => {
// 버튼의 data-region-main-code 속성에서 regionMainCode 가져오기
const regionMainCode = button.getAttribute('data-region-main-code') || '';
const existingModal = document.querySelector("#mappingHouseholdModal");
if (existingModal) {
existingModal.remove();
}
document.querySelector(".modal01").ui.open();
// 초기 데이터 조회
searchHouseholdList(0,regionMainCode);
};
const resetSearchForm = () => {
const form = document.getElementById('reqHouseholdForm');
form.reset();
$('#ownerField').val('all');
$('#regionSubCode').val('all');
$('#regionDetailCode').val('all');
$('#isPanel').val('all');
$('#searchMapping').val('all');
$('#ownerValue').val('');
};
const searchHouseholdList = (pageNo,regionMainCode) => {
const f = document.reqHouseholdForm;
f.page.value = pageNo;
f.regionMainCode.value = regionMainCode;
let dataOj = $(f).serializeObject();
ajaxUtil._ajaxMethod(
'/researcher/mappingHousehold/search',
dataOj,
function (response) {
$('#mappingHouseholdTotalElements').text(response.totalElements);
// List 구성하기
const tbody = $('#mappingHousehold-list');
tbody.empty();
$(response.content).each((idx, ct) => {
tbody.append(
`
<tr data-id="${ct.id}">
<td>
<label>
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.seq}"/>
</label>
</td>
<td>${ct.householdNum}</td>
<td>${ct.householdName}</td>
<td>${ct.householdPhone}</td>
<td>${ct.regionMainName}</td>
<td>${ct.regionSubName}</td>
<td>${ct.regionDetailName}</td>
<td>${ct.researcherName}</td>
</tr>
`);
});
// Pagination 구성하기
const paging = $('.paging');
paging.empty();
paging.append(
uiUtil.getPagingUI(pageNo, response.size, response.totalPages,
(movePageNo) => {
f.page.value = movePageNo;
searchHouseholdList(movePageNo,regionMainCode);
}));
},
function (code, rstData) {
alert('임가 조회에 실패했습니다.');
},
'get',
'json',
null
);
};
const registerHouseholds = () => {
const selectedIds = [];
$('input[name="householdSelect"]:checked').each(function () {
selectedIds.push($(this).val());
});
if (selectedIds.length === 0) {
alert('선택된 임가가 없습니다.');
return;
}
ajaxUtil._ajaxMethod(
'/researcher/mappingHousehold/search',
{ regionMainCode: regionMainCode },
function (response) {
$("#mappingHouseholdModal").append(response);
// 모달 표시
},
function (code, rstData) {
alert('임가 등록에 실패했습니다.');
},
'get',
'json',
null
);
};
</script>
</div>
</html>

View File

@@ -56,17 +56,14 @@
</select>
</div>
</div>
<div class="row">
<div class="col text-start">
<div class="fw-bolder text-muted">
TOTAL. <span id="household-totalElements"></span>
</div>
</div>
<div id="researcher-tab1" style="display: none;">
<button type="button" class="btn" onclick="location.href='/researcher/researchers'">
<span class="btn-txt">임가매핑</span>
</button>
</div>
<p class="input-label" style="font-size: 16px;">
총 <span id="household-totalElements"></span>건
</p>
<div id="researcher-tab1" >
<button type="button" class="btn" th:data-region-main-code="${researcherDto.regionMainCode}" onclick="showHouseholdModal(this)">
<span class="btn-txt">임가매핑</span>
</button>
</div>
<!-- hidden parameters -->
@@ -147,9 +144,11 @@
</div>
</div>
</form>
<div th:replace="common/modal-household-mapping:: modalFragment"></div>
</section>
<th:block layout:fragment="script">
<script th:inline="javascript">
// 탭 클릭 시 함수 호출
document.addEventListener('DOMContentLoaded', function () {
const tabButtons = document.querySelectorAll('.tab-label');
@@ -157,7 +156,7 @@
button.addEventListener('click', function () {
const tabValue = this.getAttribute('data-tab-value');
const form = document.householdReqForm;
form.page.value = 1; // 페이지 초기화
form.page.value = 0; // 페이지 초기화
document.getElementById('monthTab2').style.display = 'block';
if (tabValue === 'tab1') {
getHouseholdList(0);
@@ -193,7 +192,7 @@
$(response.content).each((idx, ct) => {
tbody.append(
`
<tr data-id="${ct.id}">
<tr data-id="${ct.seq}">
<td class="underline"><a href="">${ct.householdNum}</a></td>
<td>${ct.ownerName}</td>
<td>${ct.phone}</td>
@@ -221,10 +220,10 @@
const paging = $('.paging');
paging.empty();
paging.append(
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
uiUtil.getPagingUI(pageNo, response.size, response.totalPages,
(movePageNo) => {
f.page.value = movePageNo;
goSearch();
getHouseholdList(movePageNo);
}));
},
@@ -237,6 +236,7 @@
);
}
// 임가 방문 정보
const getHouseholdVisitList = (pageNo) => {
const f = document.householdReqForm;
@@ -244,7 +244,7 @@
let dataObj = {
page: f.page.value,
adminSeq: f.seq.value,
seq: f.seq.value,
searchMonth: f.searchMonth.value,
};
@@ -264,7 +264,7 @@
<tr data-id="${ct.id}">
<td>
<label>
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.id}"/>
<input class="form-check-input" name="selectIds" type="checkbox" value="${ct.seq}"/>
</label>
</td>
<td class="underline"><a href="">${ct.householdNum}</a></td>
@@ -291,10 +291,10 @@
const paging = $('.paging');
paging.empty();
paging.append(
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
uiUtil.getPagingUI(pageNo,response.size, response.totalPages,
(movePageNo) => {
f.page.value = movePageNo;
goSearch();
getHouseholdVisitList(movePageNo);
}));
},
@@ -359,6 +359,10 @@
}
}
</script>
</th:block>

View File

@@ -5,7 +5,6 @@
<section layout:fragment="content">
<form autocomplete="off" method="get" name="reqForm" th:action="@{/researcher/researchers}" th:object="${reqVO}">
<section class="filter-wrap">
<div class="form-area">
<!-- hidden parameters -->
<input name="sort" th:field="*{sort}" type="hidden"/>
@@ -73,41 +72,36 @@
</div>
</div>
</section>
</form>
<div class="row">
<div class="col text-start">
<div class="fw-bolder text-muted">
TOTAL. <span id="totalElements"></span>
<section>
<p class="input-label" style="font-size: 16px;">
총 <span id="totalElements"></span>건
</p>
<table>
<thead>
<tr>
<th>이름</th>
<th>전화번호</th>
<th>실사지역</th>
<th>임가수</th>
<th>사용여부</th>
</tr>
</thead>
<tbody id="listTBody">
</tbody>
</table>
</section>
<div class="row paging"></div>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn" onclick="goExcel();">
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
</button>
</div>
</div>
</div>
<section>
<table>
<thead>
<tr>
<th>이름</th>
<th>전화번호</th>
<th>실사지역</th>
<th>임가수</th>
<th>사용여부</th>
</tr>
</thead>
<tbody id="listTBody">
</tbody>
</table>
</section>
<div class="row paging"></div>
<div class="component-btns bottom-btn-group">
<div class="btns-row align-right">
<button type="button" class="btn" onclick="goExcel();">
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
</button>
</div>
</div>
</form>
</section>
<section layout:fragment="script">
@@ -154,10 +148,10 @@
const paging = $('.paging');
paging.empty();
paging.append(
uiUtil.getPagingUI(pageNo, f.size.value, response.totalPages,
uiUtil.getPagingUI(pageNo, response.size, response.totalPages,
(movePageNo) => {
f.page.value = movePageNo;
goSearch();
getResearchers(movePageNo);
}));
},