[BATCH] 월초이월금 계산하여 등록
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,4 +7,5 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface AutoSchedulesMapper {
|
||||
void createMonthlyInputStatus();
|
||||
void createSmsAutoSend(CreateSmsAutoSendCmd cmd);
|
||||
String createMonthlyCarryOver();
|
||||
}
|
||||
|
||||
@@ -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 스케쥴 있다면.. 추가.
|
||||
|
||||
@@ -6,4 +6,5 @@ public interface AutoSchedulesPortIn {
|
||||
|
||||
Optional<Boolean> operate();
|
||||
Optional<Boolean> sendAutoSms();
|
||||
Optional<Boolean> monthlyCarryOver();
|
||||
}
|
||||
@@ -7,4 +7,5 @@ public interface AutoSchedulesPortOut {
|
||||
|
||||
Optional<Boolean> operate();
|
||||
Optional<Boolean> sendAutoSms(CreateSmsAutoSendCmd cmd);
|
||||
Optional<Boolean> monthlyCarryOver();
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -32,4 +32,9 @@
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="createMonthlyCarryOver">
|
||||
select fn_monthly_carry_over(null)
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user