Compare commits
15 Commits
b128e92598
...
3d5653418a
| Author | SHA1 | Date | |
|---|---|---|---|
| 3d5653418a | |||
| b6d24a3d05 | |||
| 6faaedaa95 | |||
| b6ada277a2 | |||
| b58a996e84 | |||
| 0b89e45386 | |||
| 694cb0f621 | |||
| ff1c43d80b | |||
| 528eadec5a | |||
| 13f2fdedea | |||
| 4e6ca0eea9 | |||
| d67b790c44 | |||
| eddc638c93 | |||
| 8392c6d2da | |||
| 75af719656 |
@@ -1,5 +1,4 @@
|
|||||||
package com.example.demo.controller;
|
package com.example.demo.controller;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -37,7 +36,7 @@ public class AdminLoanController {
|
|||||||
public String approvalConfirm(@PathVariable Integer id, Model model, RedirectAttributes ra) {
|
public String approvalConfirm(@PathVariable Integer id, Model model, RedirectAttributes ra) {
|
||||||
try {
|
try {
|
||||||
model.addAttribute("r", loanService.getView(id, Const.STATUS_WAITING));
|
model.addAttribute("r", loanService.getView(id, Const.STATUS_WAITING));
|
||||||
return "approvalConfirm";
|
return "approvalConfilm";
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
ra.addFlashAttribute("errorMessage", e.getMessage());
|
ra.addFlashAttribute("errorMessage", e.getMessage());
|
||||||
return "redirect:/admin/applications";
|
return "redirect:/admin/applications";
|
||||||
@@ -50,7 +49,7 @@ public class AdminLoanController {
|
|||||||
try {
|
try {
|
||||||
loanService.approve(id, admin);
|
loanService.approve(id, admin);
|
||||||
ra.addFlashAttribute("message", "書籍貸出申請を承認しました。");
|
ra.addFlashAttribute("message", "書籍貸出申請を承認しました。");
|
||||||
return "redirect:/admin/approval/complete";
|
return "approvalComplete";
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
ra.addFlashAttribute("errorMessage", e.getMessage());
|
ra.addFlashAttribute("errorMessage", e.getMessage());
|
||||||
return "redirect:/admin/applications";
|
return "redirect:/admin/applications";
|
||||||
@@ -63,7 +62,7 @@ public class AdminLoanController {
|
|||||||
try {
|
try {
|
||||||
loanService.reject(id, admin);
|
loanService.reject(id, admin);
|
||||||
ra.addFlashAttribute("message", "書籍貸出申請を却下しました。");
|
ra.addFlashAttribute("message", "書籍貸出申請を却下しました。");
|
||||||
return "redirect:/admin/approval/complete";
|
return "approvalRejected";
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
ra.addFlashAttribute("errorMessage", e.getMessage());
|
ra.addFlashAttribute("errorMessage", e.getMessage());
|
||||||
return "redirect:/admin/applications";
|
return "redirect:/admin/applications";
|
||||||
@@ -116,3 +115,4 @@ public class AdminLoanController {
|
|||||||
return "complete";
|
return "complete";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package com.example.demo.service;
|
package com.example.demo.service;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -18,6 +15,7 @@ import com.example.demo.form.BookForm;
|
|||||||
import com.example.demo.repository.BookCollectionRepository;
|
import com.example.demo.repository.BookCollectionRepository;
|
||||||
|
|
||||||
/** BOOK-02:書籍登録、BOOK-03:書籍編集 */
|
/** BOOK-02:書籍登録、BOOK-03:書籍編集 */
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class BookAdminService {
|
public class BookAdminService {
|
||||||
private final BookCollectionRepository bookRepository;
|
private final BookCollectionRepository bookRepository;
|
||||||
@@ -83,6 +81,7 @@ public class BookAdminService {
|
|||||||
if (!errors.isEmpty()) throw new BusinessException(String.join(" ", errors));
|
if (!errors.isEmpty()) throw new BusinessException(String.join(" ", errors));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void apply(BookCollection b, BookForm f) {
|
private static void apply(BookCollection b, BookForm f) {
|
||||||
b.setIsbn(f.getIsbn());
|
b.setIsbn(f.getIsbn());
|
||||||
b.setNmBook(f.getNmBook());
|
b.setNmBook(f.getNmBook());
|
||||||
@@ -90,4 +89,5 @@ public class BookAdminService {
|
|||||||
b.setPublisher(f.getPublisher().isEmpty() ? null : f.getPublisher());
|
b.setPublisher(f.getPublisher().isEmpty() ? null : f.getPublisher());
|
||||||
b.setNote(f.getNote().isEmpty() ? null : f.getNote());
|
b.setNote(f.getNote().isEmpty() ? null : f.getNote());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user