/info/monthly/month/2025-05 추가
This commit is contained in:
@@ -19,6 +19,7 @@ import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
|||||||
import app.module.front.config.application.util.AuthUtil;
|
import app.module.front.config.application.util.AuthUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.domain.Sort;
|
import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.data.web.PageableDefault;
|
import org.springframework.data.web.PageableDefault;
|
||||||
@@ -29,6 +30,8 @@ import org.springframework.web.bind.annotation.PathVariable;
|
|||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.YearMonth;
|
import java.time.YearMonth;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@@ -39,8 +42,34 @@ class CreateMonthlyUIController {
|
|||||||
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
private final GetMonthlyInputStatusPortIn getMonthlyInputStatusPortIn;
|
||||||
private final GetMonthlyForestProductsPortIn getMonthlyForestProductsPortIn;
|
private final GetMonthlyForestProductsPortIn getMonthlyForestProductsPortIn;
|
||||||
|
|
||||||
|
|
||||||
|
private final GetMonthlyInputStatussPortIn getMonthlyInputStatussPortIn;
|
||||||
|
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
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}")
|
@GetMapping(path = "/info/monthly/create/{id}")
|
||||||
String operate(Model model,
|
String operate(Model model,
|
||||||
@PathVariable Long id,
|
@PathVariable Long id,
|
||||||
|
|||||||
Reference in New Issue
Block a user