[FO] 일계부 월별 임산물, 은행 자동이체 조건 추가
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
package app.module.front.usecase.daily.calendar.adapters.persistence;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordCalendarDto;
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.MonthlyStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.ports.RecordCalendarPortOut;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.CalendarChildren;
|
||||
@@ -10,6 +12,8 @@ import app.module.front.usecase.daily.record.adapters.web.model.DailyTargetStatu
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -24,6 +28,7 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
public List<RecordCalendar> operate(RecordCalendarCmd command) {
|
||||
List<DailyRecordCalendarDto> calendarList = this.getCalendarList(command);
|
||||
List<DailyRecordStatusDto> statusList = this.getDailyRecordStatus(command);
|
||||
MonthlyStatusDto monthlyStatus = this.getBankExist(command);
|
||||
|
||||
String pathFormat = "/record/%s/%s/%s";
|
||||
|
||||
@@ -38,10 +43,10 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
.filter(f -> Objects.equals(calendar.getDailyId(), f.getDailyId()))
|
||||
.findFirst().orElse(null);
|
||||
|
||||
List<CalendarChildren> childList = new ArrayList<>();
|
||||
if (findStatus == null) {
|
||||
refine.setChildren(new ArrayList<>());
|
||||
} else {
|
||||
List<CalendarChildren> childList = new ArrayList<>();
|
||||
if (DailyTargetStatus.TARGET.equals(findStatus.getIncomeStatus())
|
||||
|| DailyTargetStatus.TODAY_NONE.equals(findStatus.getIncomeStatus())) {
|
||||
childList.add(new CalendarChildren(
|
||||
@@ -90,23 +95,22 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
findStatus.getFarmingCount(),
|
||||
String.format(pathFormat, "farming", command.getSearchMonth(), findStatus.getDayGroupNo())));
|
||||
}
|
||||
|
||||
// TODO /info/monthly
|
||||
childList.add(new CalendarChildren(
|
||||
"MONTHLY",
|
||||
"임산물 현황 등록",
|
||||
0,
|
||||
String.format("/info/monthly/month/%s", command.getSearchMonth())));
|
||||
|
||||
childList.add(new CalendarChildren(
|
||||
"BANK",
|
||||
"은행 자동이체 내역 등록",
|
||||
0,
|
||||
"/info/bank"));
|
||||
|
||||
refine.setChildren(childList);
|
||||
}
|
||||
|
||||
childList.add(new CalendarChildren(
|
||||
"MONTHLY",
|
||||
"임산물 현황 등록",
|
||||
monthlyStatus.isForestNone() ? 0 : 1,
|
||||
String.format("/info/monthly/month/%s", command.getSearchMonth())));
|
||||
|
||||
childList.add(new CalendarChildren(
|
||||
"BANK",
|
||||
"은행 자동이체 내역 등록",
|
||||
monthlyStatus.isBankNone() ? 0 : 1,
|
||||
(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMM")).equals(command.getSearchMonth())) ? "/info/bank" : null));
|
||||
|
||||
refine.setChildren(childList);
|
||||
|
||||
refineList.add(refine);
|
||||
}
|
||||
|
||||
@@ -151,4 +155,16 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
|
||||
return statusList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 특정월의 월별 작성 상태 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return true=등록완료, false=미등록
|
||||
*/
|
||||
private MonthlyStatusDto getBankExist(RecordCalendarCmd command) {
|
||||
MonthlyStatusDto detail = recordCalendarMapper.getMonthlyStatus(command);
|
||||
|
||||
return detail == null ? new MonthlyStatusDto(MonthStatus.NONE, MonthStatus.NONE, MonthStatus.NONE) : detail;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package app.module.front.usecase.daily.calendar.adapters.persistence;
|
||||
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordCalendarDto;
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.DailyRecordStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.adapters.persistence.model.MonthlyStatusDto;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@@ -12,16 +13,24 @@ public interface RecordCalendarMapper {
|
||||
/**
|
||||
* 특정월의 일 그룹 조회
|
||||
*
|
||||
* @param cmd 검색 조건
|
||||
* @param command 검색 조건
|
||||
* @return 일(DAY) 그룹 목록
|
||||
*/
|
||||
List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarCmd cmd);
|
||||
List<DailyRecordCalendarDto> getCalendarByDailyRecord(RecordCalendarCmd command);
|
||||
|
||||
/**
|
||||
* 특정일의 일계부 등록 상태 조회
|
||||
*
|
||||
* @param cmd 검색 조건
|
||||
* @param command 검색 조건
|
||||
* @return 일계부 등록 현황 목록
|
||||
*/
|
||||
List<DailyRecordStatusDto> getDailyRecordStatus(RecordCalendarCmd cmd);
|
||||
List<DailyRecordStatusDto> getDailyRecordStatus(RecordCalendarCmd command);
|
||||
|
||||
/**
|
||||
* 특정월의 월별 작성 상태 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @return 월별 작성 상태
|
||||
*/
|
||||
MonthlyStatusDto getMonthlyStatus(RecordCalendarCmd command);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
package app.module.front.usecase.daily.calendar.adapters.persistence.model;
|
||||
|
||||
import app.module.core.config.application.enums.MonthStatus;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public class MonthlyStatusDto {
|
||||
private MonthStatus forestProduct;
|
||||
private MonthStatus bankInput;
|
||||
private MonthStatus bankOutput;
|
||||
|
||||
/**
|
||||
* 임산물 현황 등록 여부
|
||||
* @return true=미등록, false=등록완료
|
||||
*/
|
||||
public boolean isForestNone() {
|
||||
return MonthStatus.NONE.equals(forestProduct) || forestProduct == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 은행 자동이체 내역 등록 여부
|
||||
* @return true=미등록, false=등록완료
|
||||
*/
|
||||
public boolean isBankNone() {
|
||||
return (MonthStatus.NONE.equals(bankInput) || bankInput == null)
|
||||
&& (MonthStatus.NONE.equals(bankOutput) || bankOutput == null);
|
||||
}
|
||||
}
|
||||
@@ -39,4 +39,15 @@
|
||||
and dr.record_month = #{searchMonth}
|
||||
</select>
|
||||
|
||||
<select id="getMonthlyStatus">
|
||||
select mis.forest_product_status as forest_product, mis.bank_auto_transfer_input_status as bank_input, mis.bank_auto_transfer_output_status as bank_output
|
||||
from monthly_input_status mis
|
||||
where mis.is_deleted = false
|
||||
and mis.household_seq = #{householdSeq}
|
||||
and mis.month = #{searchMonth}
|
||||
order by
|
||||
mis.id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -780,7 +780,7 @@
|
||||
<script id="etcRowTmpl" type="text/x-jsrender">
|
||||
<div class="regist-btn-area">
|
||||
{{for etcList}}
|
||||
<a href="{{:path}}" class="btn{{if total != null && total != 0}} complete{{/if}}">
|
||||
<a href="{{:path ? path : 'javascript:void(0);'}}" class="btn{{if total != null && total != 0}} complete{{/if}}">
|
||||
<p>{{:codeLabel}}</p>
|
||||
{{if total != null && total != 0}}
|
||||
<span>등록완료</span>
|
||||
|
||||
Reference in New Issue
Block a user