[2차][FO] 입력현황 WIP

This commit is contained in:
김현주
2025-07-07 17:27:16 +09:00
parent f85c96ea62
commit 48cbe00b2e
26 changed files with 854 additions and 23 deletions

View File

@@ -17,6 +17,19 @@
ds.id desc
</select>
<select id="getDailyIncomeListByMonth"
resultType="app.module.front.usecase.daily.income.adapters.persistence.model.DailyIncomeDto">
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit as credit
, ds.crop_code, ds.income_kind, ds.source_purpose
, ds.quantity, ds.unit_code, ds.unit_self, ds.price, ds.estimated_value
, dr.start_date, dr.end_date
from daily_income ds
<include refid="app.module.core.usecase.daily.record.adapters.persistence.DailyRecordMapper.InnerJoinByDailyRecordMonth"/>
where ds.is_deleted = false
order by
dr.id, ds.id
</select>
<select id="getRecordExistCount" resultType="int">
select count(1)
from daily_income ds

View File

@@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="app.module.front.usecase.daily.status.adapters.persistence.DailyStatusMapper">
<select id="getDailyStatusByMonth"
resultType="app.module.front.usecase.daily.status.adapters.persistence.model.DailyMonthStatusDto">
<![CDATA[
with day_gorup as (
select only_day.day, ddg.group_no
from (SELECT generate_series(1, 31) as day) as only_day
left join
daily_day_group ddg on ddg.start_day <= only_day."day" and ddg.end_day >= only_day."day" and ddg.is_deleted = false
where only_day.day <= DATE_PART('day', (date_trunc('MONTH', TO_DATE(#{recordMonth}, 'YYYYMM')) + INTERVAL '1 MONTH - 1 day'))
)
select count(dg.day) as day_count
, (count(dg.day) filter (where dr.all_status = 'DONE')) as done_count
from day_gorup dg
left join
daily_record dr on dr.day_group_no = dg.group_no and dr.record_month = to_char(TO_DATE(#{recordMonth}, 'YYYYMM'), 'YYYYMM') and dr.household_seq = #{householdSeq}
]]>
</select>
<select id="getDailyStatusByItemCount"
resultType="app.module.front.usecase.daily.status.adapters.persistence.model.DailyItemStatusDto">
<![CDATA[
with day_gorup as (
select only_day.day, ddg.group_no, dr.id as daily_record_seq
, dr.all_status, dr.income_status, dr.work_status, dr.expense_status, dr.power_status, dr.forestry_status, dr.farming_status
from (SELECT generate_series(1, 31) as day) as only_day
left join
daily_day_group ddg on ddg.start_day <= only_day."day" and ddg.end_day >= only_day."day" and ddg.is_deleted = false
left join
daily_record dr on dr.record_month = #{recordMonth} and dr.household_seq = #{householdSeq} and dr.day_group_no = ddg.group_no and dr.is_deleted = false
where only_day.day <= DATE_PART('day', (date_trunc('MONTH', TO_DATE(#{recordMonth}, 'YYYYMM')) + INTERVAL '1 MONTH - 1 day'))
)
select 'INCOME' as step
, count(distinct dg.day) as day_count
, count(distinct dg.day) filter (where (dg.income_status = 'TARGET' and di.id is not null) or dg.income_status = 'TODAY_NONE') as done_count
, count(distinct di.id) as input_count
from day_gorup dg
left join
daily_income di on di.daily_record_seq = dg.daily_record_seq and di.is_deleted = false
union all
select 'EXPENSE' as step
, count(distinct dg.day) as day_count
, count(distinct dg.day) filter (where (dg.expense_status = 'TARGET' and de.id is not null) or dg.expense_status = 'TODAY_NONE') as done_count
, count(distinct de.id) as input_count
from day_gorup dg
left join
daily_expense de on de.daily_record_seq = dg.daily_record_seq and de.is_deleted = false
union all
select 'WORK' as step
, count(distinct dg.day) as day_count
, count(distinct dg.day) filter (where (dg.work_status = 'TARGET' and dw.id is not null) or dg.work_status = 'TODAY_NONE') as done_count
, count(distinct dw.id) as input_count
from day_gorup dg
left join
daily_work dw on dw.daily_record_seq = dg.daily_record_seq and dw.is_deleted = false
union all
select 'POWER' as step
, count(distinct dg.day) as day_count
, count(distinct dg.day) filter (where (dg.power_status = 'TARGET' and dp.id is not null) or dg.power_status = 'TODAY_NONE') as done_count
, count(distinct dp.id) as input_count
from day_gorup dg
left join
daily_power dp on dp.daily_record_seq = dg.daily_record_seq and dp.is_deleted = false
union all
select 'FORESTRY' as step
, count(distinct dg.day) as day_count
, count(distinct dg.day) filter (where (dg.forestry_status = 'TARGET' and df1.id is not null) or dg.forestry_status = 'TODAY_NONE') as done_count
, count(distinct df1.id) as input_count
from day_gorup dg
left join
daily_forestry df1 on df1.daily_record_seq = dg.daily_record_seq and df1.is_deleted = false
union all
select 'FARMING' as step
, count(distinct dg.day) as day_count
, count(distinct dg.day) filter (where (dg.farming_status = 'TARGET' and df2.id is not null) or dg.farming_status = 'TODAY_NONE') as done_count
, count(distinct df2.id) as input_count
from day_gorup dg
left join
daily_farming df2 on df2.daily_record_seq = dg.daily_record_seq and df2.is_deleted = false
]]>
</select>
<select id="getDailyStatusByItemValue"
resultType="app.module.front.usecase.daily.status.adapters.persistence.model.DailyItemStatusDto">
<![CDATA[
with r_daily_record as (
select dr.id from daily_record dr where dr.record_month = #{recordMonth} and dr.household_seq = #{householdSeq} and dr.is_deleted = false
)
select 'INCOME' as step
, COALESCE(sum( COALESCE(di.price, 0) + COALESCE(di.estimated_value, 0) ), 0) as total_value
from daily_income di
inner join
r_daily_record dr on dr.id = di.daily_record_seq
where di.is_deleted = false
union all
select 'EXPENSE' as step
, COALESCE(sum( COALESCE(de.price, 0) + COALESCE(de.estimated_value, 0) ), 0) as total_value
from daily_expense de
inner join
r_daily_record dr on dr.id = de.daily_record_seq
where de.is_deleted = false
union all
select 'WORK' as step
, COALESCE(sum(
COALESCE(cast(dw.owner_time as numeric), 0) + COALESCE(cast(dw.spouse_time as numeric), 0)
+ COALESCE(cast(dw.family_f_hours as numeric), 0) + COALESCE(cast(dw.family_m_hours as numeric), 0)
+ COALESCE(cast(dw.hired_m_hours as numeric), 0) + COALESCE(cast(dw.hired_f_hours as numeric), 0)
+ COALESCE(cast(dw.shared_m_hours as numeric), 0) + COALESCE(cast(dw.shared_f_hours as numeric), 0)
+ COALESCE(cast(dw.volunteer_m_hours as numeric), 0) + COALESCE(cast(dw.volunteer_f_hours as numeric), 0)
), 0) as total_value
from daily_work dw
inner join
r_daily_record dr on dr.id = dw.daily_record_seq
where dw.is_deleted = false
union all
select 'POWER' as step
, COALESCE(sum( COALESCE(cast(dp.owned_hours as numeric), 0) + COALESCE(cast(dp.leased_hours as numeric), 0) ), 0) as total_value
from daily_power dp
inner join
r_daily_record dr on dr.id = dp.daily_record_seq
where dp.is_deleted = false
union all
select 'FORESTRY' as step
, COALESCE(sum( COALESCE(df1.estimated_value, 0) ), 0) as total_value
from daily_forestry df1
inner join
r_daily_record dr on dr.id = df1.daily_record_seq
where df1.is_deleted = false
union all
select 'FARMING' as step
, COALESCE(sum( COALESCE(df2.estimated_value, 0) ), 0) as total_value
from daily_farming df2
inner join
r_daily_record dr on dr.id = df2.daily_record_seq
where df2.is_deleted = false
]]>
</select>
</mapper>

View File

@@ -5,10 +5,11 @@ uri.front.login=\uB85C\uADF8\uC778
# \uC785\uB825\uD604\uD669
uri.front.status=\uC785\uB825\uD604\uD669
uri.front.status.path=/status/daily
# \uD1B5\uACC4
uri.front.statistics=\uD1B5\uACC4
# \uC774\uC6A9\uC548\uB0B4
uri.front.guide=\uC774\uC6A9\uC548\uB0B4
uri.front.guide.path=/guide
# \uB0B4\uC815\uBCF4
uri.front.info=\uB0B4 \uC815\uBCF4

View File

@@ -171,10 +171,16 @@
or #strings.containsIgnoreCase(currentURI?.uri, '/record/')} ? 'active'">
<a th:href="#{uri.front.record.calendar.path}">일계부</a>
</li>
<!--/* TODO : 2차 오픈 s */-->
<li class="menu-regi disabled"><a href="javascript:void(0)">입력현황</a></li>
<li class="menu-use disabled"><a href="javascript:void(0)">이용안내</a></li>
<!--/* TODO : 2차 오픈 e */-->
<li class="menu-regi"
th:classappend="${#strings.containsIgnoreCase(currentURI?.uri, '/status/')} ? 'active'">
<a th:href="#{uri.front.status.path}">입력현황</a>
</li>
<!--/* TODO */-->
<li class="menu-use disabled"><a href="javascript:void(0);">이용안내</a></li>
<!--/*<li class="menu-use"
th:classappend="${#strings.containsIgnoreCase(currentURI?.uri, '/guide')} ? 'active'">
<a th:href="#{uri.front.guide.path}">이용안내</a>
</li>*/-->
<li class="menu-info"
th:classappend="${#strings.equals(currentURI?.uri, '/info')
or #strings.containsIgnoreCase(currentURI?.uri, '/info/')} ? 'active'">

View File

@@ -15,8 +15,10 @@
<ul class="allmenu-list" th:if="${topNode != null}">
<li th:each="menu : ${topNode.children}" th:if="${menu.showOnNavi}"
th:with="accoClass=${#strings.containsIgnoreCase(menu.uri, '/record') ? 'acco': ''}
, infoClass=${#strings.containsIgnoreCase(menu.uri, '/info') ? 'info': ''}"
th:class="|${accoClass}${infoClass}|"
, infoClass=${#strings.containsIgnoreCase(menu.uri, '/info') ? 'info': ''}
, statusClass=${#strings.containsIgnoreCase(menu.uri, '/status') ? 'regi': ''}
, guideClass=${#strings.containsIgnoreCase(menu.uri, '/guide') ? 'use': ''}"
th:class="|${accoClass}${infoClass}${statusClass}${guideClass}|"
th:classappend="${@coreUtil.containsCurrentURI(menuHierarchy, menu.id)}? 'active'">
<!--/* 자식 nodes 가 없는 경우 */-->
<a th:classappend="${currentURI.id == menu.id}? 'active'"

View File

@@ -0,0 +1,168 @@
<!DOCTYPE html>
<html layout:decorate="~{layout/layout}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org" lang="ko">
<div layout:fragment="content" th:classappend="regi-wrap">
<main id="content" role="main">
<section class="month-filter">
<div class="inner">
<div id="searchMonth" class="component-select bottom-sheet" data-props-type="bottomSheet">
<button type="button" class="select-box">
<span class="select-txt"></span>
</button>
<div class="select-options">
<div class="select-header">
<p>월 선택</p>
<button type="button" class="select-close">
<span class="hide-txt">닫기</span>
</button>
</div>
<div class="select-scroll">
<ul class="">
<li class="option"
th:each="item, itemStatus : ${reqVO.monthList}"
th:classappend="${#strings.equals(reqVO.searchMonth, #temporals.format(item, 'yyyyMM'))} ? 'current'"
th:data-value="${#temporals.format(item, 'yyyyMM')}"
th:text="${#temporals.format(item, 'yyyy년 M월')}"></li>
</ul>
</div>
</div>
</div>
<ul class="summary">
<li>
<span>작성일</span>
<p><strong>[[${detail.doneCount}]]</strong>일</p>
</li>
<li>
<span>미작성일</span>
<p><strong>[[${detail.dayCount - detail.doneCount}]]</strong>일</p>
</li>
<li>
<span>총 등록</span>
<p><strong>[[${#numbers.formatInteger(detail.totalInput, 1, 'COMMA')}]]</strong>건</p>
</li>
</ul>
</div>
</section>
<section class="month-detail bg-gray bg-lround"
th:unless="${#lists.isEmpty(detail.itemList)}">
<div class="inner">
<p class="tit">항목별 월간 현황</p>
<ul class="btn-column-list">
<th:block th:each="item, itemStatus : ${detail.itemList}">
<li th:classappend="${item.inputCount != 0} ? 'view'">
<th:block th:if="${item.inputCount != 0}">
<a href="javascript:void(0);" th:onclick="formControl.detailModal([[${#strings.toLowerCase(item.step.name)}]], [[${#strings.toLowerCase(item.step.desc2)}]])">
</th:block>
<p class="label">[[${item.step.desc2}]]</p>
<ul class="value">
<li>
<span>작성일</span>
<span>[[${item.doneCount}]]일</span>
</li>
<li>
<span>등록 건수</span>
<span>[[${item.inputCount}]]건</span>
</li>
<li class="total"
th:if="${#strings.equals(item.step, T(app.module.core.config.application.enums.DailySort).WORK)}">
<span>총 투입 시간</span>
<span><strong>[[${@dailyUtil.getStringComma(item.totalValue)}]]</strong>시간</span>
</li>
<li class="total"
th:if="${#strings.equals(item.step, T(app.module.core.config.application.enums.DailySort).POWER)}">
<span>총 사용 시간</span>
<span><strong>[[${@dailyUtil.getStringComma(item.totalValue)}]]</strong>시간</span>
</li>
<li class="total"
th:unless="${#strings.equals(item.step, T(app.module.core.config.application.enums.DailySort).WORK)
or #strings.equals(item.step, T(app.module.core.config.application.enums.DailySort).POWER)}">
<span>총 금액</span>
<span><strong>[[${#numbers.formatInteger(item.totalValue, 1, 'COMMA')}]]</strong>원</span>
</li>
</ul>
<th:block th:if="${item.inputCount != 0}">
</a >
</th:block>
</li>
</th:block>
</ul>
</div>
</section>
</main>
<!-- 모달 팝업 -->
<div class="layer-wrap">
<div class="component-modal regi-wrap detailModal" data-props-dimm-click="true">
<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">
<!--/* detail */-->
</div>
<button type="button" class="modal-close"></button>
</div>
</div>
</div>
</div>
<!-- //모달 팝업 -->
</div>
<section layout:fragment="script">
<script th:inline="javascript">
let ENV = {
httpUrl: {
root: /*[[${currentURI?.uri}]]*/'',
detail: /*[[|${currentURI?.uri}/{step}/{month}|]]*/'',
},
modal: {
// 등록 영역
selector: '.detailModal',
},
month: /*[[${reqVO.searchMonth}]]*/'month',
submitted: false,
};
let formControl = {
init() {
this._bindUI();
},
_bindUI() {
console.log('_bindUI()')
const $select1 = document.querySelector('#searchMonth');
const selectboxInstance1 = $select1.ui;
selectboxInstance1.core.init($select1, {
selectItemCallback({selectValue, dataValue}){
location.href = ENV.httpUrl.root + '?searchMonth=' + dataValue;
}
});
},
detailModal(step, desc) {
ajaxUtil._ajaxAsyncMethod(
ENV.httpUrl.detail.replace('{step}', step).replace('{month}', ENV.month),
{},
function(rstHtml, status) {
$(ENV.modal.selector).find('.modal-tit').html(desc + ' 내역');
$(ENV.modal.selector).find('.modal-content').html(rstHtml);
const modal01 = document.querySelector(ENV.modal.selector).ui;
modal01.open();
},
function(code, rstData) {
kri.logger.error('Do nothing. code: '+ code, rstData);
},
'get',
'html'
);
},
};
</script>
</section>
</html>

View File

@@ -0,0 +1,66 @@
<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org" lang="ko">
<div layout:fragment="content" th:classappend="regi-wrap">
<div class="modal-content-inner">
<hgroup class="tit-group">
<h3>
[[${#temporals.format(#temporals.createDate(searchMonth+'01', 'yyyyMMdd'), 'yyyy년 M월')}]]의 [[${step.desc2}]] 내역이 <br>
<strong>[[${#lists.size(list)}]]건 등록</strong> 되었습니다.
</h3>
</hgroup>
<section class="regist-item-area"
th:unless="${#lists.isEmpty(list)}">
<th:block th:each="recordItem, recordItemStatus : ${list}">
<p class="month-tit">
<th:block th:if="${recordItem.startDate eq recordItem.endDate}">
[[${#temporals.format(recordItem.startDate, 'M월 d일')}]]
</th:block>
<th:block th:if="not ${recordItem.startDate eq recordItem.endDate}">
[[${#temporals.format(recordItem.startDate, 'M월 d일')}]]~[[${#temporals.format(recordItem.endDate, 'd일')}]]
</th:block>
</p>
<!--/* [INFO] templates/record/xxxx/index.html 의 item-list 와 동일한 HTML */-->
<div class="item-list">
<div class="list-item"
th:each="item, itemStatus : ${recordItem.children}">
<div class="item-tit-group">
<p class="item-name">[[${item.incomeKind}]]</p>
</div>
<ul class="detail-list">
<li th:if="${item.credit != null}">
<p>외상판매</p>
<span th:text="${item.credit ? '예' : '아니오'}">아니오</span>
</li>
<li th:if="${not #strings.isEmpty(item.cropLabel)}">
<p>재배형태</p>
<span th:text="${item.cropLabel}">재배형태</span>
</li>
<li th:if="${not #strings.isEmpty(item.sourcePurpose)}">
<p>수입원</p>
<span th:text="${item.sourcePurpose}">소비자</span>
</li>
<li th:if="${not #strings.isEmpty(item.quantity)}">
<p>수량</p>
<span th:text="|${@dailyUtil.getStringComma(item.quantity)}${#strings.defaultString(item.unitLabel,'')}|">500g</span>
</li>
<li th:if="${not #strings.isEmpty(item.price)}">
<p>현금 </p>
<span th:text="|${#numbers.formatInteger(item.price, 1, 'COMMA')}원|">302,000원</span>
</li>
<li th:if="${not #strings.isEmpty(item.estimatedValue)}">
<p>현물평가액</p>
<span th:text="|${#numbers.formatInteger(item.estimatedValue, 1, 'COMMA')}원|">302,000원</span>
</li>
</ul>
</div>
</div>
</th:block>
</section>
</div>
</div>
</html>