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

This commit is contained in:
김현주
2025-07-11 11:54:15 +09:00
16 changed files with 275 additions and 16 deletions

View File

@@ -5,6 +5,7 @@ import app.module.admin.usecase.communication.notice.getNotice.ports.GetNoticePo
import app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNotice;
import app.module.admin.usecase.communication.notice.getNotice.ports.application.domain.GetNoticeCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import java.util.Optional;
@@ -13,10 +14,10 @@ import java.util.Optional;
@RequiredArgsConstructor
class GetNoticeService implements GetNoticePortIn {
private final GetNoticePortOut portOut;
private final GetNoticePortOut getNoticePortOut;
@Override
public Optional<GetNotice> operate(GetNoticeCmd command) {
return portOut.operate(command);
return getNoticePortOut.operate(command);
}
}

View File

@@ -10,10 +10,10 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor
class UpdateNoticeService implements UpdateNoticePortIn {
private final UpdateNoticePortOut portOut;
private final UpdateNoticePortOut updateNoticePortOut;
@Override
public void operate(UpdateNoticeCmd command) {
portOut.operate(command);
updateNoticePortOut.operate(command);
}
}

View File

@@ -4,8 +4,10 @@ import app.module.core.config.application.enums.DailyStatus;
import app.module.core.config.application.enums.DailyTargetStatus;
import app.module.core.config.application.util.AuditUtil;
import app.module.core.config.application.util.DailyUtil;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordAlertDto;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordStatusDto;
import app.module.core.usecase.daily.record.adapters.persistence.model.RecordAlertDto;
import app.module.core.usecase.daily.record.ports.DailyRecordPortOut;
import app.module.core.usecase.daily.record.ports.application.domain.CreateDailyRecordCmd;
import app.module.core.usecase.daily.record.ports.application.domain.GetDailyRecordCmd;
@@ -99,6 +101,14 @@ public class DailyRecordDao implements DailyRecordPortOut {
}
}
@Override
public RecordAlertDto selectNoRegister(String recordMonth, Long householdSeq) {
List<DailyRecordAlertDto> dailyRecordAlertDtoList = dailyRecordMapper.selectDailyNoRegister(recordMonth,householdSeq);
List<String> monthRecoredAlertDtoList = dailyRecordMapper.selectMonthNoRegister(recordMonth,householdSeq);
return new RecordAlertDto(dailyRecordAlertDtoList,monthRecoredAlertDtoList);
}
/**
* 일계부 전체 입력상태 변경
*

View File

@@ -1,11 +1,13 @@
package app.module.core.usecase.daily.record.adapters.persistence;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordAlertDto;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordStatusDto;
import app.module.core.usecase.daily.record.ports.application.domain.CreateDailyRecordCmd;
import app.module.core.usecase.daily.record.ports.application.domain.GetDailyRecordCmd;
import app.module.core.usecase.daily.record.ports.application.domain.UpdateDailyRecordStatusCmd;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -55,4 +57,10 @@ public interface DailyRecordMapper {
* @param command 수정 데이터
*/
void updateDailyRecordStatus(UpdateDailyRecordStatusCmd command);
List<DailyRecordAlertDto> selectDailyNoRegister(@Param("searchMonth") String searchMonth, @Param("householdSeq")Long householdSeq);
List<String> selectMonthNoRegister(@Param("searchMonth")String searchMonth, @Param("householdSeq")Long householdSeq);
}

View File

@@ -0,0 +1,10 @@
package app.module.core.usecase.daily.record.adapters.persistence.model;
import lombok.Data;
@Data
public class DailyRecordAlertDto {
private String recordMonth;
private Integer startDay;
private Integer endDay;
}

View File

@@ -0,0 +1,13 @@
package app.module.core.usecase.daily.record.adapters.persistence.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
@Data
@AllArgsConstructor
public class RecordAlertDto {
private List<DailyRecordAlertDto> dailyRecordAlertDtoList;
private List<String> monthRecordAlertDtoList;
}

View File

@@ -1,6 +1,7 @@
package app.module.core.usecase.daily.record.ports;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.adapters.persistence.model.RecordAlertDto;
import app.module.core.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
import app.module.core.usecase.daily.record.adapters.web.model.DailyUIReqVO;
@@ -32,4 +33,6 @@ public interface DailyRecordPortIn {
void updateByStatus(String recordMonth, Integer dayGroupNo, Long householdSeq, String targetType, String targetStatus);
void updateByAllStatus(String recordMonth, Integer dayGroupNo, Long householdSeq);
RecordAlertDto selectNoRegister(String recordMonth, Long householdSeq);
}

View File

@@ -2,6 +2,7 @@ package app.module.core.usecase.daily.record.ports;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.adapters.persistence.model.RecordAlertDto;
import app.module.core.usecase.daily.record.ports.application.domain.CreateDailyRecordCmd;
import app.module.core.usecase.daily.record.ports.application.domain.GetDailyRecordCmd;
@@ -22,4 +23,6 @@ public interface DailyRecordPortOut {
void create(GetDailyRecordCmd findCmd, CreateDailyRecordCmd command);
void updateByStatus(String recordMonth, Integer dayGroupNo, Long householdSeq, String targetType, String targetStatus);
RecordAlertDto selectNoRegister(String recordMonth, Long householdSeq);
}

View File

@@ -4,6 +4,7 @@ import app.module.core.config.application.enums.DailySort;
import app.module.core.config.application.enums.DailyTargetStatus;
import app.module.core.config.application.util.AuditUtil;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.usecase.daily.record.adapters.persistence.model.RecordAlertDto;
import app.module.core.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
import app.module.core.usecase.daily.record.adapters.web.model.DailyUIReqVO;
import app.module.core.usecase.daily.record.ports.DailyRecordPortIn;
@@ -130,4 +131,9 @@ public class DailyRecordService implements DailyRecordPortIn {
public void updateByAllStatus(String recordMonth, Integer dayGroupNo, Long householdSeq) {
portOut.updateByStatus(recordMonth, dayGroupNo, householdSeq, "ALL", null);
}
@Override
public RecordAlertDto selectNoRegister(String recordMonth, Long householdSeq) {
return portOut.selectNoRegister(recordMonth, householdSeq);
}
}

View File

@@ -122,6 +122,50 @@
and day_group_no = #{dayGroupNo}
</update>
<select id="selectDailyNoRegister">
WITH target AS (
SELECT total_day_groups,record_month
FROM v_household_monthly_target_days
WHERE household_seq = 1 AND record_month = #{searchMonth}
)
SELECT
g.day_group_no,
ddg.start_day,
CASE
WHEN g.day_group_no = t.total_day_groups
THEN EXTRACT(day FROM date_trunc('month'::text, to_date(t.record_month::text, 'YYYYMM'::text)::timestamp with time zone) + '1 mon -1 days'::interval)::integer
ELSE ddg.end_day
END AS end_day,
dr.all_status
FROM target t
CROSS JOIN generate_series(1, t.total_day_groups) AS g(day_group_no)
LEFT JOIN daily_record dr
ON dr.household_seq = #{householdSeq}
AND dr.record_month = #{searchMonth}
AND dr.day_group_no = g.day_group_no
LEFT JOIN daily_day_group ddg
ON ddg.group_no = g.day_group_no
WHERE dr.all_status != 'DONE' OR dr.id is null
ORDER BY g.day_group_no
</select>
<select id="selectMonthNoRegister">
SELECT
v.category
FROM monthly_input_status mis
CROSS JOIN LATERAL (
VALUES
('임산물 현황 미등록', mis.forest_product_status,1),
('은행 자동이체 내역(수입) 미등록', mis.bank_auto_transfer_input_status,2),
('은행 자동이체 내역(지출) 미등록', mis.bank_auto_transfer_output_status,3)
) AS v(category, status, order_by)
WHERE mis.household_seq = #{householdSeq}
AND mis.month = #{searchMonth}
AND (v.status != 'REGISTERED' )
ORDER BY v.order_by
</select>
<sql id="InnerJoinByDailyRecord">
inner join daily_record dr
on dr.id = ds.daily_record_seq

View File

@@ -1,5 +1,6 @@
package app.module.front.usecase.daily.record.adapters.web;
import app.module.core.config.application.util.CommonUtil;
import app.module.core.usecase.daily.record.adapters.persistence.model.DailyRecordDto;
import app.module.core.config.application.enums.DailyTargetStatus;
import app.module.core.usecase.daily.record.adapters.web.model.CreateDailyRecordReqVO;
@@ -81,4 +82,14 @@ public class DailyRecordController {
return ResponseEntity.status(HttpStatus.OK).body(reqVO);
}
/**
* 일계부 해당 달 말일일경우 DONE이 아닌 일계부 Alert 창 처리
*
* @param searchMonth 검색 월(yyyyMM)
*/
@GetMapping(path = "/alert/{searchMonth}")
ResponseEntity<?> selectNoRegister(@PathVariable("searchMonth") String searchMonth) {
return ResponseEntity.status(HttpStatus.OK).body(dailyRecordPortIn.selectNoRegister(searchMonth, AuthUtil.getUserSeq()));
}
}

View File

@@ -15,6 +15,7 @@ import app.module.front.usecase.info.monthly.getPrevMonthlyInputStatus.ports.app
import app.module.front.usecase.info.monthlyProduct.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProducts;
import app.module.front.usecase.info.monthlyProduct.getMonthlyForestProducts.ports.application.domain.GetMonthlyForestProductsCmd;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
@@ -28,6 +29,7 @@ import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
@Slf4j
@Controller
@RequiredArgsConstructor
class GetBankInputUIController {
@@ -38,7 +40,6 @@ class GetBankInputUIController {
private final GetBanksPortIn getBanksPortIn;
private final UICodeListPortIn uiCodeListPortIn;
@GetMapping(path = "/info/bank/create/input/{id}")
public String operate(Model model,
@PathVariable Long id
@@ -49,7 +50,6 @@ class GetBankInputUIController {
// 전달 입력 상태 취득 , 데이터가 없을 경우 null
// 이전달 입력상태:NONE일 경우도 null
GetPrevMonthlyInputStatus pastMonthlyInfo =
prevMonthlyInputStatusPortIn.operate(
new GetPrevMonthlyInputStatusCmd(
@@ -82,9 +82,10 @@ class GetBankInputUIController {
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth(), formatter);
LocalDate maxMonth = yearMonth.plusMonths(1).atDay(15);
LocalDate minMonth = yearMonth.minusMonths(1).atDay(15);
LocalDate today = LocalDate.now();
boolean editable = !today.isAfter(maxMonth);
boolean preEditable = !today.isBefore(minMonth);
model.addAttribute("pastMonthlyInfo", pastMonthlyInfo);
model.addAttribute("currentMonthlyInfo", currentMonthlyInfo);
@@ -100,6 +101,7 @@ class GetBankInputUIController {
model.addAttribute("MonthStatus", MonthStatus.class);
model.addAttribute("editable", editable);
model.addAttribute("preEditable", preEditable);
return "info/bank/input";

View File

@@ -87,9 +87,10 @@ class GetBankOutputUIController {
YearMonth yearMonth = YearMonth.parse(currentMonthlyInfo.getMonth(), formatter);
LocalDate maxMonth = yearMonth.plusMonths(1).atDay(15);
LocalDate minMonth = yearMonth.minusMonths(1).atDay(15);
LocalDate today = LocalDate.now();
boolean editable = !today.isAfter(maxMonth);
boolean preEditable = !today.isBefore(minMonth);
model.addAttribute("pastMonthlyInfo", pastMonthlyInfo);
model.addAttribute("currentMonthlyInfo", currentMonthlyInfo);
@@ -105,7 +106,7 @@ class GetBankOutputUIController {
model.addAttribute("MonthStatus", MonthStatus.class);
model.addAttribute("editable", editable);
model.addAttribute("preEditable", preEditable);
return "info/bank/output";
}

View File

@@ -7,6 +7,7 @@
<div class="inner">
<hgroup class="tit-group">
<h3>
[[${currentMonthlyInfo.koreanMonth}]]의 <br>
<strong>은행 자동이체(수입) 내역 <span id="totalItems">[[${bankList.totalElements}]]</span>건 등록</strong> 되었습니다.
</h3>
<p>수입 내역을 등록해 주세요.</p>
@@ -105,6 +106,7 @@
let ENV = {
httpUrl: {
root: /*[[#{uri.front.info.bank.path}]]*/ 'rootUrl',
preMonth: /*[[|/info/bank/create/input|]]*/ 'preMonthUrl',
save: /*[[|/api/front#{uri.front.info.bank.path}/create|]]*/ 'saveUrl'
},
module: {
@@ -117,9 +119,12 @@
bankList : /*[[${bankList.content}]]*/ [],
pastBankList : /*[[${pastBankList.content}]]*/ [],
id: /*[[${currentMonthlyInfo.id}]]*/'',
currentMonth: /*[[${currentMonthlyInfo.month}]]*/'',
currentStatus: /*[[${currentMonthlyInfo.bankAutoTransferInputStatus}]]*/'',
pastStatus: /*[[${pastMonthlyInfo?.bankAutoTransferInputStatus}]]*/'',
pastBankId: /*[[${pastMonthlyInfo?.id}]]*/'',
editable: /*[[${editable}]]*/,
preEditable: /*[[${preEditable}]]*/,
},
elementRefs: {
// noDataCheckbox: document.getElementById("forestProductStatus"),
@@ -198,11 +203,42 @@
const clearAllItems = document.getElementById('clearAllItems');
if (ENV.data.pastBankList.length == 0) {
callPastInfoBtn.disabled = true;
}
if (ENV.data.editable) {
if(ENV.data.preEditable && ENV.data.pastBankList.length === 0 && ENV.data.currentMonth >= "202508"){
callPastInfoBtn.disabled = true;
const handlePageShow = function(event) {
if ('sessionStorage' in window && window['sessionStorage'] !== null) {
// history.back으로 돌아온 경우 (navigation.type == 2)
if (event.persisted || (window.performance && window.performance.navigation.type === 2)) {
sessionStorage.removeItem('pastInputAlertShown'); // 플래그 제거
return; // 알림창 표시하지 않음
}
// 페이지가 처음 로드되었거나 새로고침된 경우 (navigation.type == 0 또는 1)
if (event.persisted || (window.performance && window.performance.navigation.type <= 1)) {
kri.isReturn = true;
const hasShownAlert = sessionStorage.getItem('pastInputAlertShown');
if (!hasShownAlert && ENV.data.pastBankList.length === 0) {
callPastInfoBtn.disabled = true;
etUI.dialog.alert({
title: '지난달 정보 등록하기',
message: '지난달 정보를 아직 입력하지 않으셨네요.\n정확한 조사를 위해 지난달 정보를 입력해주세요.\n\n확인 버튼을 누르시면 지난달 은행자동이체 내역등록으로 이동합니다.',
type: 'alert',
callback: function() {
sessionStorage.setItem('pastInputAlertShown', 'true');
location.href = ENV.httpUrl.preMonth + "/" + ENV.data.pastBankId;
},
});
}
}
}
};
// 초기 로드 시 실행
handlePageShow({ persisted: false, performance: window.performance });
}
if (ENV.data.currentStatus == "NONE") {
if (ENV.data.pastStatus && ENV.data.pastStatus == "REGISTERED" && ENV.data.pastBankList.length > 0) {
this.checkUsePastData();

View File

@@ -7,6 +7,7 @@
<div class="inner">
<hgroup class="tit-group">
<h3>
[[${currentMonthlyInfo.koreanMonth}]]의 <br>
<strong>은행 자동이체(지출) 내역 <span id="totalItems">[[${bankList.totalElements}]]</span>건 등록</strong> 되었습니다.
</h3>
<p>지출 내역을 등록해 주세요.</p>
@@ -105,6 +106,7 @@
let ENV = {
httpUrl: {
root: /*[[#{uri.front.info.bank.path}]]*/ 'rootUrl',
preMonth: /*[[|/info/bank/create/output|]]*/ 'preMonthUrl',
save: /*[[|/api/front#{uri.front.info.bank.path}/create|]]*/ 'saveUrl'
},
module: {
@@ -119,7 +121,9 @@
id: /*[[${currentMonthlyInfo.id}]]*/'',
currentStatus: /*[[${currentMonthlyInfo.bankAutoTransferOutputStatus}]]*/'',
pastStatus: /*[[${pastMonthlyInfo?.bankAutoTransferOutputStatus}]]*/'',
pastBankId: /*[[${pastMonthlyInfo?.id}]]*/'',
editable: /*[[${editable}]]*/,
preEditable: /*[[${preEditable}]]*/,
},
elementRefs: {
// noDataCheckbox: document.getElementById("forestProductStatus"),
@@ -197,11 +201,44 @@
const clearAllItems = document.getElementById('clearAllItems');
if (ENV.data.pastBankList.length == 0) {
callPastInfoBtn.disabled = true;
}
if (ENV.data.editable) {
if (ENV.data.preEditable && ENV.data.pastBankList.length === 0 && ENV.data.currentMonth >= "202508") {
callPastInfoBtn.disabled = true;
const handlePageShow = function(event) {
if ('sessionStorage' in window && window['sessionStorage'] !== null) {
// history.back으로 돌아온 경우 (navigation.type == 2)
if (event.persisted || (window.performance && window.performance.navigation.type === 2)) {
sessionStorage.removeItem('pastOutputAlertShown'); // 플래그 제거
return; // 알림창 표시하지 않음
}
// 페이지가 처음 로드되었거나 새로고침된 경우 (navigation.type == 0 또는 1)
if (event.persisted || (window.performance && window.performance.navigation.type <= 1)) {
kri.isReturn = true;
const hasShownAlert = sessionStorage.getItem('pastOutputAlertShown');
if (!hasShownAlert && ENV.data.pastBankList.length === 0) {
callPastInfoBtn.disabled = true;
etUI.dialog.alert({
title: '지난달 정보 등록하기',
message: '지난달 정보를 아직 입력하지 않으셨네요.\n정확한 조사를 위해 지난달 정보를 입력해주세요.\n\n확인 버튼을 누르시면 지난달 은행자동이체 내역등록으로 이동합니다.',
type: 'alert',
callback: function() {
sessionStorage.setItem('pastOutputAlertShown', 'true');
location.href = ENV.httpUrl.preMonth + "/" + ENV.data.pastBankId;
},
});
}
}
}
};
// 초기 로드 시 실행
handlePageShow({ persisted: false, performance: window.performance });
}
if (ENV.data.currentStatus == "NONE") {
if (ENV.data.pastStatus && ENV.data.pastStatus == "REGISTERED" && ENV.data.pastBankList.length > 0) {
this.checkUsePastData();

View File

@@ -766,6 +766,7 @@
root: '',
list: '/record/calendar/{searchMonth}/{groupNo}',
create: '/record/daily/{searchMonth}/{groupNo}',
alert: '/api/record/daily/alert/{searchMonth}',
},
submitted: false,
};
@@ -805,11 +806,84 @@
}
$('#selectedDay').html(html);
// 오늘 날짜가 해당 달의 마지막 날인지 확인
const today = new Date();
const lastDayOfMonth = new Date(viewDate.getFullYear(), viewDate.getMonth() + 1, 0); // 해당 달의 마지막 날
// 쿠키에서 마지막 alert 날짜 확인
const lastAlertDate = getCookie('lastAlertDate');
const todayDateString = today.toISOString().split('T')[0];
if (lastAlertDate !== todayDateString &&
today.getFullYear() === lastDayOfMonth.getFullYear() &&
today.getMonth() === lastDayOfMonth.getMonth() &&
today.getDate() === lastDayOfMonth.getDate()) {
ajaxUtil._ajaxSyncMethod(
ENV.httpUrl.alert.replace('{searchMonth}', searchMonth.replace('-', '')),
{},
function (response) {
let dailyNo = []
let msgTxt = '';
let month = viewDate.getMonth() + 1;
msgTxt += "등록하지 않은 일계부 항목이 있습니다.\n 정확한 조사를 위해 꾸준히 입력해 주세요.\n";
if(response.dailyRecordAlertDtoList.length > 0){
response.dailyRecordAlertDtoList.forEach((dto) =>{
let dateTxt;
if(dto.startDay === dto.endDay){
dateTxt = month+"월 "+dto.startDay+"일";
}else{
dateTxt = month+"월 "+dto.startDay+"~"+dto.endDay+"일";
}
dailyNo.push(dateTxt);
});
msgTxt += "1. 일계부 미등록 \n"+dailyNo.join(',')+"\n";
}
if(response.monthRecordAlertDtoList.length > 0) {
response.monthRecordAlertDtoList.forEach((dto,idx) => {
if(response.dailyRecordAlertDtoList.length > 0){
idx ++;
}
msgTxt += idx+". "+dto+"\n";
});
}
if(response.dailyRecordAlertDtoList.length > 0 || dto.monthRecordAlertDtoList.length > 0) {
etUI.dialog.alert({
title: '',
message: msgTxt,
type:'alert',
callback: function () {
},
});
}
},
function (rstData, status) {
},
'get'
,'json'
);
}
},
recordCreate(searchMonth, groupNo) {
location.href = ENV.httpUrl.create.replace('{searchMonth}', searchMonth.replace('-', '')).replace('{groupNo}', groupNo);
},
};
// 쿠키 설정 함수
function setCookie(name, value, days) {
const expires = new Date();
expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1000);
document.cookie = `${name}=${value};expires=${expires.toUTCString()};path=/`;
}
// 쿠키 가져오기 함수
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
return null;
}
</script>
<script id="dailyNoneTmpl" type="text/x-jsrender">
{{include tmpl="#titleTmpl" /}}