[FO] 일계부 월별 소스 정리
This commit is contained in:
@@ -159,30 +159,15 @@ public class RecordCalendarDao implements RecordCalendarPortOut {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getDataNoneCountBySomeDayAfter(RecordCalendarCmd command) {
|
||||
int dataNoneCount = recordCalendarMapper.getDataNoneCountBySomeDayAfter(command);
|
||||
public int getDataNoneCountBySomeDayAfter(Long householdSeq) {
|
||||
|
||||
return dataNoneCount != 0;
|
||||
return recordCalendarMapper.getDataNoneCountBySomeDayAfter(householdSeq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLatestDate(RecordCalendarCmd command) {
|
||||
String returnValue = null;
|
||||
DailyRecordStatusDto detail = recordCalendarMapper.getLatestDate(command);
|
||||
if (detail != null && detail.getStartDate() != null && detail.getEndDate() != null) {
|
||||
if (detail.getStartDate().getMonth() != detail.getEndDate().getMonth()) {
|
||||
// 종료일의 달이 변경되면 시작일=종료일 처리
|
||||
detail.setEndDate(detail.getStartDate());
|
||||
}
|
||||
public DailyRecordStatusDto getLatestDate(Long householdSeq) {
|
||||
|
||||
if (detail.getStartDate().equals(detail.getEndDate())) {
|
||||
returnValue = detail.getStartDate().format(DateTimeFormatter.ofPattern("yyyy년 M월 d일"));
|
||||
} else {
|
||||
returnValue = detail.getStartDate().format(DateTimeFormatter.ofPattern("yyyy년 M월 d")) + "~" + detail.getEndDate().format(DateTimeFormatter.ofPattern("d일"));
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
return recordCalendarMapper.getLatestDate(householdSeq);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,16 +29,16 @@ public interface RecordCalendarMapper {
|
||||
/**
|
||||
* 3일전 ~ 15일전 미등록된 데이터 개수 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @param householdSeq 임가회원 일련번호
|
||||
* @return 미등록 건 수
|
||||
*/
|
||||
Integer getDataNoneCountBySomeDayAfter(RecordCalendarCmd command);
|
||||
Integer getDataNoneCountBySomeDayAfter(Long householdSeq);
|
||||
|
||||
/**
|
||||
* 최신 등록일 데이터 조회
|
||||
*
|
||||
* @param command 검색 조건
|
||||
* @param householdSeq 임가회원 일련번호
|
||||
* @return 최신 등록 데이터
|
||||
*/
|
||||
DailyRecordStatusDto getLatestDate(RecordCalendarCmd command);
|
||||
DailyRecordStatusDto getLatestDate(Long householdSeq);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,11 @@ import java.util.List;
|
||||
public class RecordCalendarController {
|
||||
private final RecordCalendarPortIn recordCalendarPortIn;
|
||||
|
||||
/**
|
||||
* 일계부 월별 목록
|
||||
*
|
||||
* @param searchMonth 검색 월(yyyyMM)
|
||||
*/
|
||||
@GetMapping(path = "/{searchMonth}")
|
||||
public ResponseEntity<?> list(@PathVariable("searchMonth") String searchMonth) {
|
||||
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO(searchMonth);
|
||||
|
||||
@@ -16,6 +16,11 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
public class RecordCalendarUIController {
|
||||
private final RecordCalendarPortIn recordCalendarPortIn;
|
||||
|
||||
/**
|
||||
* 일계부 월별 현황 화면
|
||||
*
|
||||
* @param model Model
|
||||
*/
|
||||
@GetMapping(path = "")
|
||||
public String index(Model model) {
|
||||
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO();
|
||||
|
||||
@@ -22,7 +22,7 @@ public interface RecordCalendarPortIn {
|
||||
boolean getDataNoneCountBySomeDayAfter();
|
||||
|
||||
/**
|
||||
* 일계부 최신 데이터 조회
|
||||
* 일계부 최신 데이터 등록일 조회
|
||||
*
|
||||
* @return 최신 등록 기간
|
||||
*/
|
||||
|
||||
@@ -2,13 +2,14 @@ package app.module.front.usecase.daily.calendar.ports;
|
||||
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
|
||||
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordStatusDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface RecordCalendarPortOut {
|
||||
List<RecordCalendar> operate(RecordCalendarCmd command);
|
||||
|
||||
boolean getDataNoneCountBySomeDayAfter(RecordCalendarCmd command);
|
||||
int getDataNoneCountBySomeDayAfter(Long householdSeq);
|
||||
|
||||
String getLatestDate(RecordCalendarCmd command);
|
||||
DailyRecordStatusDto getLatestDate(Long householdSeq);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package app.module.front.usecase.daily.calendar.ports.application;
|
||||
|
||||
import app.module.front.config.application.util.AuthUtil;
|
||||
import app.module.front.usecase.daily.calendar.adapters.web.model.RecordCalendarUIReqVO;
|
||||
import app.module.front.usecase.daily.calendar.ports.RecordCalendarPortIn;
|
||||
import app.module.front.usecase.daily.calendar.ports.RecordCalendarPortOut;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.CalendarChildren;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendar;
|
||||
import app.module.front.usecase.daily.calendar.ports.application.domain.RecordCalendarCmd;
|
||||
import app.module.front.usecase.daily.record.adapters.persistence.model.DailyRecordStatusDto;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@@ -25,15 +28,28 @@ public class RecordCalendarService implements RecordCalendarPortIn {
|
||||
|
||||
@Override
|
||||
public boolean getDataNoneCountBySomeDayAfter() {
|
||||
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO();
|
||||
int dataNoneCount = portOut.getDataNoneCountBySomeDayAfter(AuthUtil.getUserSeq());
|
||||
|
||||
return portOut.getDataNoneCountBySomeDayAfter(new RecordCalendarCmd(reqVO.getSearchMonth(), reqVO.getHouseholdSeq()));
|
||||
return dataNoneCount != 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLatestDate() {
|
||||
RecordCalendarUIReqVO reqVO = new RecordCalendarUIReqVO();
|
||||
String returnValue = null;
|
||||
DailyRecordStatusDto detail = portOut.getLatestDate(AuthUtil.getUserSeq());
|
||||
if (detail != null && detail.getStartDate() != null && detail.getEndDate() != null) {
|
||||
if (detail.getStartDate().getMonth() != detail.getEndDate().getMonth()) {
|
||||
// 종료일의 달이 변경되면 시작일=종료일 처리
|
||||
detail.setEndDate(detail.getStartDate());
|
||||
}
|
||||
|
||||
return portOut.getLatestDate(new RecordCalendarCmd(reqVO.getSearchMonth(), reqVO.getHouseholdSeq()));
|
||||
if (detail.getStartDate().equals(detail.getEndDate())) {
|
||||
returnValue = detail.getStartDate().format(DateTimeFormatter.ofPattern("yyyy년 M월 d일"));
|
||||
} else {
|
||||
returnValue = detail.getStartDate().format(DateTimeFormatter.ofPattern("yyyy년 M월 d")) + "~" + detail.getEndDate().format(DateTimeFormatter.ofPattern("d일"));
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,16 +74,9 @@
|
||||
-- 이전월 마지막 DAY 로 시작, 종료일이 같은지 여부
|
||||
or start_day = DATE_PART('day', date_trunc('month', CURRENT_DATE) - INTERVAL '1 days')
|
||||
or end_day = DATE_PART('day', date_trunc('month', CURRENT_DATE) - INTERVAL '1 days')
|
||||
|
||||
/*
|
||||
-- 현재 DAY 로 시작, 종료일이 같은지 여부
|
||||
or start_day = DATE_PART('day', CURRENT_DATE - INTERVAL '3 days')
|
||||
*/
|
||||
)
|
||||
)
|
||||
--select count(tdg.group_no), count(dr.id)
|
||||
select case when count(tdg.group_no) = count(dr.id) then 0 else count(tdg.group_no) - count(dr.id) end
|
||||
--select *
|
||||
from temp_day_group tdg
|
||||
left join
|
||||
daily_record dr on dr.record_month = tdg.current_month and dr.day_group_no = tdg.group_no
|
||||
|
||||
Reference in New Issue
Block a user