/info/monthly/month/2025-05 추가

This commit is contained in:
주우성
2025-06-16 15:03:30 +09:00
parent c9085a6e91
commit 809f4d9f82

View File

@@ -19,6 +19,7 @@ import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
import app.module.front.config.application.util.AuthUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.PageableDefault;
@@ -29,6 +30,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.util.NoSuchElementException;
import java.util.Optional;
@Controller
@RequiredArgsConstructor
@@ -39,8 +42,34 @@ class CreateMonthlyUIController {
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
private final GetMonthlyForestProductsPortIn getMonthlyForestProductsPortIn;
private final GetMonthlyInputStatussPortIn getMonthlyInputStatussPortIn;
private final UICodeListPortIn uiCodeListPortIn;
@GetMapping(path = "/info/monthly/month/{month}")
String operateMonth(@PathVariable String month) {
Pageable pageable = PageRequest.of(
0,
13,
Sort.by(Sort.Direction.DESC, "month")
);
Page<GetMonthlyInputStatuss> list =
getMonthlyInputStatussPortIn.operate(
pageable,
new GetMonthlyInputStatussCmd(
null, null, AuthUtil.getUserSeq()));
GetMonthlyInputStatuss matched = list.getContent().stream()
.filter(item -> month.equals(item.getMonth()))
.findFirst()
.orElseThrow(() -> new NoSuchElementException("해당 월의 데이터가 없습니다."));
return "redirect:/info/monthly/create/" + matched.getId();
}
@GetMapping(path = "/info/monthly/create/{id}")
String operate(Model model,
@PathVariable Long id,