[FO] 일계부 항목 등록, 수입내역 등록 wip

This commit is contained in:
김현주
2025-06-10 19:44:37 +09:00
parent d73167148c
commit 71b18550c8
36 changed files with 780 additions and 433 deletions

View File

@@ -2,36 +2,29 @@
<!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.income.persistence.DailyIncomeMapper">
<select id="getDailyIncomeExistCount" resultType="int">
select count(ds.*)
from daily_income ds
<select id="getDailyIncomeList"
resultType="app.module.front.usecase.daily.income.persistence.model.DailyIncomeDto">
select ds.id, ds.daily_record_seq, ds.input_type, ds.is_credit
, ds.crop_code, ds.category_code, ds.category_self, ds.source_purpose
, ds.quantity, ds.unit_code, ds.price, ds.estimated_value
from daily_income ds
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
where ds.is_deleted = false
where ds.is_deleted = false
<if test="incomeId != null and incomeId != ''">
and ds.id = ${incomeId}
</if>
</select>
<select id="getDailyIncomeList">
select id, daily_record_seq, is_credit, crop_code, category_code, category_name, source_purpose
, quantity, unit_code, price, estimated_value
, created_at, created_by
from daily_income
where is_deleted = false
and daily_record_seq = 1
and id = 1
</select>
<select id="getDailyIncome">
select id, daily_record_seq, is_credit, crop_code, category_code, category_name, source_purpose
, quantity, unit_code, price, estimated_value
, created_at, created_by
from daily_income
where is_deleted = false
and daily_record_seq = 1
and id = 1
<select id="getDailyIncomeExistCount" resultType="int">
select count(1)
from daily_income ds
<include refid="app.module.front.usecase.daily.record.persistence.DailyRecordMapper.InnerJoinByDailyRecord"/>
where ds.is_deleted = false
</select>
<insert id="createDailyIncome" useGeneratedKeys="true" keyProperty="id">
insert into daily_income (
daily_record_seq, is_credit, crop_code, category_code, category_name, source_purpose
daily_record_seq, is_credit, crop_code, category_code, category_self, source_purpose
, quantity, unit_code, price, estimated_value
, created_at, created_by, is_deleted
) values (
@@ -49,7 +42,7 @@
, is_credit = #{isCredit}
, crop_code = #{cropCode}
, category_code = #{categoryCode}
, category_name = #{categoryName}
, category_self = #{categorySelf}
, source_purpose = #{sourcePurpose}
, quantity = #{quantity}
, unit_code = #{unitCode}

View File

@@ -16,27 +16,25 @@
and ddg.group_no = #{groupNo}
</select>
<select id="getDailyRecordExistCount"
resultType="int">
/* 일계부 데이터 존재 여부 getDailyRecordExistCount */
select count(*) as exist
from daily_record dr
where dr.household_seq = 2
and dr.is_deleted = false
and dr.record_month = '2025-06'
and dr.day_group_no = 3
<select id="getDailyRecordExistCount" resultType="int">
select count(1) as exist
from daily_record dr
where dr.is_deleted = false
and dr.household_seq = #{householdSeq}
and dr.record_month = #{searchMonth}
and dr.day_group_no = #{groupNo}
</select>
<insert id="createDailyRecord" useGeneratedKeys="true" keyProperty="id">
insert into daily_record (
household_seq, record_month, day_group_no, start_date, end_date
, all_status, income_status, work_status, expense_status, power_status, forestry_status
, all_status, income_status, work_status, expense_status, power_status, forestry_status, farming_status
, is_deleted
, <include refid="common.fields.CreateUpdateBaseColumns"/>
) values (
#{householdSeq}
, #{recordMonth}, #{dayGroupNo}, #{startDate}, #{endDate}
, #{allStatus}, #{incomeStatus}, #{workStatus}, #{expenseStatus}, #{powerStatus}, #{forestryStatus}
, #{allStatus}, #{incomeStatus}, #{workStatus}, #{expenseStatus}, #{powerStatus}, #{forestryStatus}, #{farmingStatus}
, false
, <include refid="common.fields.CreateUpdateBaseValues"/>
)
@@ -62,11 +60,10 @@
</update>
<sql id="InnerJoinByDailyRecord">
/* TODO */
inner join daily_record dr on
dr.id = ds.daily_record_seq
and dr.is_deleted = false
and dr.recordMonth = #{recordMonth} and dr.day_group_no = #{dayGroupNo}
and dr.record_month = #{searchMonth} and dr.day_group_no = #{groupNo}
and dr.household_seq = #{householdSeq}
</sql>

View File

@@ -32,11 +32,13 @@ var ajaxUtil = {
ajaxUtil._alert(message, '오류 안내');
},
_alert : function (alertMessage, alertTitle, afterEvent) {
ajaxUtil._alertMethod({
id: null,
title: alertTitle !== undefined ? alertTitle : null,
etUI.dialog.alert({
title: alertTitle,
message: alertMessage,
after: afterEvent !== undefined ? (afterEvent ? 'Y' : 'N') : 'N',
type: "alert",
callback: function() {
console.log("alert callback");
},
});
},
_alertId : function (alertId, afterEvent) {
@@ -133,14 +135,17 @@ var ajaxUtil = {
if (typeof errorCallback !== 'undefined') {
errorCallback(ajaxUtil.$404, rstData);
} else {
kri.menu.main();
// kri.menu.main();
kri.logger.error('statusCode: 404');
}
},
401:function(){
kri.menu.main();
// kri.menu.main();
kri.logger.error('statusCode: 401');
},
403:function(rstData){
kri.menu.main();
// kri.menu.main();
kri.logger.error('statusCode: 403');
},
422:function(rstData, status) {
console.log(rstData)
@@ -151,6 +156,14 @@ var ajaxUtil = {
target.parent().find('.invalid-feedback').text(oj.defaultMessage);
});
if ($('.invalid-feedback').length === 0) {
let fieldErrors = rstData.responseJSON != null ? rstData.responseJSON : null;
if (fieldErrors != null && fieldErrors.length > 0) {
ajaxUtil._alert(fieldErrors[0].defaultMessage, '유효성 체크');
}
}
},
500:function(rstData){
ajaxUtil._hideWaiting();

View File

@@ -2,9 +2,9 @@ let krip= {};
krip.daily = new Object();
krip.daily.httpUrl = {
base: '/record/calendar',
root: '/record/calendar',
daily: '/record/daily/{month}/{groupNo}',
target: '/record/daily/{month}/{groupNo}/{target}',
target: '/record/{target}/{month}/{groupNo}',
// income: '/record/daily/{month}/{groupNo}/income',
// work: '/record/daily/{month}/{groupNo}/work',
// expense: '/record/daily/{month}/{groupNo}/expense',

View File

@@ -7,7 +7,7 @@
<div id="wrap">
<section th:replace="~{common/components :: header}"></section>
<div class="acco-wrap" id="container" layout:fragment="content">
<div id="container" layout:fragment="content">
page content
</div>

View File

@@ -7,7 +7,7 @@
<div id="wrap">
<section th:replace="~{common/components :: header}"></section>
<div class="acco-wrap btm-footer" id="container" layout:fragment="content">
<div class="btm-footer" id="container" layout:fragment="content">
page content
</div>

View File

@@ -2,7 +2,7 @@
<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">
<div layout:fragment="content" th:classappend="acco-wrap">
<main id="content" role="main">
<h2>calendar</h2>
<div>

View File

@@ -2,85 +2,100 @@
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org" lang="ko">
<div layout:fragment="content">
<main id="content" role="main">
<h2>daily Form</h2>
<div>
reqVO: [[${reqVO}]]
</div>
<div>
[[${#temporals.format(detail.startDate, 'yyyy년 MM월 dd일')}]] ~ [[${#temporals.format(detail.endDate, 'yyyy년 MM월 dd일')}]]<br/>
<form name="reqForm">
<input type="hidden1" name="todayNone" value="" />
<br/>
<div>
<input type="checkbox" name="incomeStatus" value="WAITING" data-target="income" /> 수입 내역
<div class="invalid-feedback">
에러 메세지
<div layout:fragment="content" th:classappend="acco-wrap">
<th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
<div>
reqVO: [[${reqVO}]]
</div>
<div>
detail: [[${dailyRecord}]]
</div>
</th:block>
<main id="content" role="main">
<div class="inner">
<hgroup class="tit-group">
<h3 th:data-start="${#temporals.format(dailyRecord.startDate, 'M월 d일')}"
th:data-end="${#temporals.format(dailyRecord.endDate, 'd일')}">
<th:block th:if="${dailyRecord.startDay eq dailyRecord.endDay}">
[[${#temporals.format(dailyRecord.startDate, 'M월 d일')}]], <br>
</th:block>
<th:block th:if="not ${dailyRecord.startDay eq dailyRecord.endDay}">
[[${#temporals.format(dailyRecord.startDate, 'M월 d')}]]~[[${#temporals.format(dailyRecord.endDate, 'd일')}]], <br>
</th:block>
<strong>등록하실 내용</strong>이 있나요?
</h3>
<p>등록하실 항목을 선택해 주세요.</p>
</hgroup>
<form name="reqForm">
<input type="hidden" name="todayNone" value="">
<section class="switch-group">
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">수입</span>
<input type="checkbox" name="incomeStatus" value="WAITING" data-target="income">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
</label>
</div>
</div>
<br/>
<div>
<input type="checkbox" name="workStatus" value="WAITING" data-target="work" /> 노동 내역
<div class="invalid-feedback">
에러 메세지
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">임업노동 투입 내역</span>
<input type="checkbox" name="workStatus" value="WAITING" data-target="work">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
</label>
</div>
</div>
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">지출</span>
<input type="checkbox" name="expenseStatus" value="WAITING" data-target="expense">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
</label>
</div>
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">동력 사용시간</span>
<input type="checkbox" name="powerStatus" value="WAITING" data-target="power">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
</label>
</div>
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">자가임업 생산물 중 자가소비량</span>
<input type="checkbox" name="forestryStatus" value="WAITING" data-target="forestry">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
</label>
</div>
<!-- TODO : 자가농업 생산물 중 자가소비량은 7일차 등록일에만 노출 및 선택 -->
<div class="component-input">
<label class="switch-inner type-txt">
<span class="switch-label">자가농업 생산물 중 자가소비량</span>
<input type="checkbox" name="farmingStatus" value="WAITING" data-target="farming">
<span class="switch-item">
<span class="switch-handle"></span>
</span>
</label>
</div>
</section>
</form>
</div>
</main>
</form>
<th:block th:if="${detail.updated}">
수정
</th:block>
<th:block th:if="${!detail.updated}">
<input type="button" value="등록" th:onclick="formControl.create([[${reqVO.searchMonth}]], [[${reqVO.groupNo}]])" />
</th:block>
<br/><br/>
detail: [[${detail}]]
<div class="component-btns fixed">
<div class="btns-row" th:if="${!dailyRecord.updated}">
<button type="button" class="btn btn-l btn-primary" th:onclick="formControl.createValid([[${reqVO.searchMonth}]], [[${reqVO.groupNo}]])">
<span class="btn-txt">다음 단계로 이동</span>
</button>
</div>
</div>
</main>
<style>
.content {
margin-bottom: 20px;
}
.content label {
font-weight: bold;
display: block;
margin-bottom: 5px;
}
.content div {
padding: 8px 0;
}
.tox-tinymce {
border: none;
}
.invalid-feedback {
display: none;
font-size: 12px;
font-weight: bold;
}
.is-invalid + .invalid-feedback {
display: block;
}
textarea.is-invalid ~ .invalid-feedback {
display: block;
}
</style>
</div>
@@ -89,35 +104,66 @@
<script th:inline="javascript">
let ENV = {
httpUrl: {
root: '',
create: '',
root: /*[[|/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
},
month: [[${reqVO.searchMonth}]],
groupNo: [[${reqVO.groupNo}]],
submitted: false,
};
let formControl = {
create(searchMonth, groupNo) {
createValid() {
const f = document.reqForm;
if ($(f).find('input:checked').length == 0) {
if (confirm('등록할 내용이 없음?')) {
f.todayNone.value = 'Y';
}
if ($(f).find('input:checked').length === 0) {
this.createConfirm();
} else {
this.create();
}
},
createConfirm() {
etUI.locales.ko = {
dialog: {
positive: '예',
negative: '아니오',
},
};
let message = ', 등록하실 항목이 없나요?';
let $messageWrap = $('#content .tit-group h3');
if ($messageWrap.data('start').indexOf($messageWrap.data('end')) !== -1) {
message = $messageWrap.data('start') + '~' + $messageWrap.data('end') + message;
} else {
message = $messageWrap.data('start') + message;
}
etUI.dialog.alert({
title: "등록 항목 확인",
message: message,
type: "confirm",
dialogType: "confirm",
callback: function () {
formControl.create();
},
});
},
create() {
const f = document.reqForm;
if ($(f).find('input:checked').length === 0) {
f.todayNone.value = 'Y';
}
const obj = $(f).serializeObject();
ajaxUtil._ajaxAsync(
ENV.httpUrl.create.replace('{searchMonth}', searchMonth).replace('{groupNo}', groupNo),
ENV.httpUrl.root,
obj,
function(rstData, status) {
console.log(rstData);
if (f.todayNone.value == 'Y') {
function (rstData, status) {
if (f.todayNone.value === 'Y') {
krip.daily.goToMain();
} else {
krip.daily.goToNext($('input:checked').eq(0).data('target'), searchMonth, groupNo);
krip.daily.goToNext($('input:checked').eq(0).data('target'), ENV.month, ENV.groupNo);
}
},
);
},

View File

@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html layout:decorate="~{layout/layout-none}" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
xmlns:th="http://www.thymeleaf.org" lang="ko">
<div layout:fragment="content" th:classappend="acco-wrap">
<th:block th:if="${@systemProperties['spring.profiles.active'] eq 'local'}">
<div>
reqVO: [[${reqVO}]]
</div>
<div>
detail: [[${detail}]]
</div>
</th:block>
</div>
<section layout:fragment="script">
<script th:src="@{/static/ui/page/daily-record.js}"></script>
<script th:inline="javascript">
let ENV = {
httpUrl: {
root: /*[[|/record/daily/${reqVO.searchMonth}/${reqVO.groupNo}|]]*/'rootUrl',
},
month: [[${reqVO.searchMonth}]],
groupNo: [[${reqVO.groupNo}]],
submitted: false,
};
let formControl = {
};
</script>
</section>
</html>