[BATCH] 월초이월금 계산하여 등록

This commit is contained in:
김현주
2025-07-10 13:43:53 +09:00
parent 940211f408
commit 5c6bc9d6c1
8 changed files with 171 additions and 7 deletions

View File

@@ -44,4 +44,19 @@ class AutoSchedulesDao implements AutoSchedulesPortOut {
return Optional.of(false);
}
}
@Override
@Transactional
public Optional<Boolean> monthlyCarryOver() {
try {
mapper.createMonthlyCarryOver();
return Optional.of(true);
} catch (Exception e) {
log.error("[AutoSchedule][monthlyCarryOver] message: {}", e.getMessage(), e);
// 예외 발생 시 false 반환
return Optional.of(false);
}
}
}

View File

@@ -7,4 +7,5 @@ import org.apache.ibatis.annotations.Mapper;
public interface AutoSchedulesMapper {
void createMonthlyInputStatus();
void createSmsAutoSend(CreateSmsAutoSendCmd cmd);
String createMonthlyCarryOver();
}

View File

@@ -1,9 +1,6 @@
package app.module.admin.usecase.schedule.autoSchedules.adapters.web;
import app.module.admin.config.application.util.DateUiUtil;
import app.module.admin.config.application.util.model.DayRange;
import app.module.admin.usecase.schedule.autoSchedules.ports.AutoSchedulesPortIn;
import java.time.LocalDate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@@ -28,6 +25,15 @@ public class AutoSchedulesController {
public void fetchSmsAutoSend() {
portIn.sendAutoSms();
}
/**
* 월초이월금 계산하여 등록
* 매월 16일 0시 1초에 실행되는 스케줄러
*/
@Scheduled(cron = "1 0 0 16 * *")
public void fetchMonthlyCarryOver() {
portIn.monthlyCarryOver();
}
/**
* TODO 스케쥴 있다면.. 추가.

View File

@@ -6,4 +6,5 @@ public interface AutoSchedulesPortIn {
Optional<Boolean> operate();
Optional<Boolean> sendAutoSms();
Optional<Boolean> monthlyCarryOver();
}

View File

@@ -7,4 +7,5 @@ public interface AutoSchedulesPortOut {
Optional<Boolean> operate();
Optional<Boolean> sendAutoSms(CreateSmsAutoSendCmd cmd);
Optional<Boolean> monthlyCarryOver();
}

View File

@@ -11,10 +11,8 @@ import app.module.admin.usecase.schedule.getIncompleteHouseholds.ports.GetIncomp
import app.module.admin.usecase.schedule.getIncompleteHouseholds.ports.application.domain.GetIncompleteHouseholds;
import app.module.admin.usecase.schedule.getIncompleteHouseholds.ports.application.domain.GetIncompleteHouseholdsCmd;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.UUID;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@@ -76,4 +74,9 @@ class AutoSchedulesService implements AutoSchedulesPortIn {
return Optional.of(true);
}
@Override
public Optional<Boolean> monthlyCarryOver() {
return portOut.monthlyCarryOver();
}
}