貸出申請承認の作業完了しました

This commit is contained in:
2026-10-23 10:27:10 +09:00
parent a80e99da7f
commit 06d0d4b019
5 changed files with 129 additions and 94 deletions

View File

@@ -1,56 +1,53 @@
package com.example.demo.controller; package com.example.demo.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import com.example.demo.form.ReturnForm;
import com.example.demo.service.ReturnService;
/** /**
* 書籍貸出承認確認用のコントローラ * 書籍貸出承認確認用のコントローラ
*/ */
@Controller @Controller
public class ApprovalConfirmController { public class ApprovalConfirmController {
// ログ出力用インスタンス
// private final static Logger LOGGER = Logger.getLogger(ApprovalConfirmController.class.getName());
// エラーメッセージ用の定数フィールド
// private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
// HttpSession httpSession; // HttpSession httpSession;
// Request request; ReturnService returnService;
//
// @Autowired
// public ApprovalConfirmController(
// HttpSession httpSession,
// Request request) {
// this.httpSession = httpSession;
// this.request = request;
// }
//
// @ModelAttribute
// public ApprovalForm approvalForm() {
// return new ApprovalForm();
// }
@RequestMapping(value = "/approvalConfirm", method = RequestMethod.POST) @Autowired
public String AprrvalForm() { ApprovalConfirmController(ReturnService returnService) {
this.returnService = returnService;
}
System.out.println("a"); @ModelAttribute
return "bookList"; ReturnForm returnForm() {
// try { return new ReturnForm();
// }
//
// return ; @RequestMapping(value = "/approvalConfirm", method = { RequestMethod.POST, RequestMethod.GET })
// } catch (Exception e) { public String ApporvalForm(Model model) {
// // ログイン情報の破棄 //System.out.println("a");
// httpSession.invalidate(); try {
// //仮の値を入れる 貸出テーブルのID
// e.printStackTrace(); Integer id = 1;
// //申請IDを元に取得
// // エラーログ出力 ReturnForm approvalresultForm = returnService.getReturnForm(id);
// LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e); approvalresultForm.setIdRequest(id);
// // エラー画面遷移
// return "error"; //returnFormに値をセット
// } // 画面に返す為の情報をセット
model.addAttribute("returnForm", approvalresultForm);
return "approvalConfirm";
} catch (Exception e) {
e.printStackTrace();
return "error";
} }
} }
}

View File

@@ -1,11 +1,73 @@
package com.example.demo.controller; package com.example.demo.controller;
import jakarta.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.example.demo.form.ReturnForm;
import com.example.demo.service.ReturnService;
/** /**
* 書籍貸出完了・却下処理用のコントローラ * 書籍貸出承認完了・却下処理用のコントローラ
*/ */
@Controller @Controller
public class ApprovalConfirmResultController { public class ApprovalConfirmResultController {
HttpSession httpSession;
ReturnService returnService;
@Autowired
public ApprovalConfirmResultController(HttpSession httpSession, ReturnService returnService) {
this.httpSession = httpSession;
this.returnService = returnService;
}
@ModelAttribute
ReturnForm returnForm() {
return new ReturnForm();
}
//承認完了画面表示処理
@RequestMapping(value = "/approvalComplete", method = RequestMethod.POST)
public String approvalComplete(ReturnForm returnForm) {
try {
//セッションからIDを拾いたい
httpSession.getAttribute("");
//いったん1ということで
int id = 1;
returnService.setReturnComplete(returnForm.getIdRequest(), id);
return "approvalComplete";
} catch (Exception e) {
e.printStackTrace();
return "error";
}
}
//却下完了画面表示処理
@RequestMapping(value = "/approvalRejected", method = RequestMethod.POST)
public String approvalRejected(ReturnForm returnForm) {
try {
//セッションからIDを拾いたい
httpSession.getAttribute("");
//いったん1ということで
int id = 1;
returnService.setReturnRejected(returnForm.getIdRequest(), id);
return "approvalRejected";
} catch (Exception e) {
e.printStackTrace();
return "error";
}
}
} }

View File

@@ -2,14 +2,8 @@
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta charset="UTF-8">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> <title>書籍貸出承認画面</title>
<!-- 外部のスクリプトファイルを読み込む -->
<script th:src="@{/js/common.js}"></script>
<!-- CSSの読み込み -->
<link rel="stylesheet" th:href="@{/css/all.css}">
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
<title>書籍貸出承認完了画面</title>
</head> </head>
<body> <body>

View File

@@ -1,39 +1,28 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"> <meta charset="UTF-8">
<!-- 外部のスクリプトファイルを読み込む -->
<script th:src="@{/js/common.js}"></script>
<!-- CSSの読み込み -->
<link rel="stylesheet" th:href="@{/css/all.css}">
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
<title>書籍貸出承認確認</title> <title>書籍貸出承認確認</title>
</head> </head>
<body> <body>
<h1>登録内容確認    <div style="text-align: right;">
<div class="rightSection">
<span class="loginInfo">ログイン者名:<span th:text="${session.loginUser.nmEmployee}"></span></span>
<button class="logoutButton" onclick="logoutSubmit()">ログアウト</button> <button class="logoutButton" onclick="logoutSubmit()">ログアウト</button>
</div> </div>
</h1>
<!-- 変数名は変更したが、中身は変更していない -->
<!-- ボタンや遷移も手を付けていない -->
<form action="approvalConfirm"
method="post">
<div class="msgBox error" th:if="${messageError != null}"> <form action ="approvalComplete"
<span class="error" th:each="message : ${messageError.message}" th:text="${message}"></span> method="post"
</div> th:object="${returnForm}">
<table> <table>
<tr> <tr>
<th class="header">申請ID</th> <th class="header">申請ID</th>
<td> <td>
<label> <label>
<input class="readOnly" <input class="readOnly"
name="idRquest" name="idRequest"
readonly="readonly" readonly="readonly"
type="text" th:field="*{idRequest}"
value="自動で設定されます"/> type="text"/>
</label> </label>
</td> </td>
</tr> </tr>
@@ -44,7 +33,7 @@
<input class="readOnly" <input class="readOnly"
name="nmEmployee" name="nmEmployee"
readonly="readonly" readonly="readonly"
th:value="*{nmEmployee}" th:field="*{nmEmployee}"
type="text"/> type="text"/>
</label> </label>
</td> </td>
@@ -54,9 +43,9 @@
<td> <td>
<label> <label>
<input class="readOnly" <input class="readOnly"
name="dataRequest" name="dateRequest"
readonly="readonly" readonly="readonly"
th:value="*{dataRequest}" th:field="*{dateRequest}"
type="text"/> type="text"/>
</label> </label>
</td> </td>
@@ -68,7 +57,7 @@
<input class="readOnly" <input class="readOnly"
name="isBn" name="isBn"
readonly="readonly" readonly="readonly"
th:value="*{isBn}" th:field="*{isBn}"
type="text"/> type="text"/>
</label> </label>
</td> </td>
@@ -80,7 +69,7 @@
<input class="readOnly" <input class="readOnly"
name="nmBook" name="nmBook"
readonly="readonly" readonly="readonly"
th:value="*{nmBook}" th:field="*{nmBook}"
type="text"/> type="text"/>
</label> </label>
</td> </td>
@@ -90,9 +79,9 @@
<td> <td>
<label> <label>
<input class="readOnly" <input class="readOnly"
name="publisher" name="pubLisher"
readonly="readonly" readonly="readonly"
th:value="*{publisher}" th:field="*{pubLisher}"
type="text"/> type="text"/>
</label> </label>
</td> </td>
@@ -102,9 +91,9 @@
<td> <td>
<label> <label>
<input class="readOnly" <input class="readOnly"
name="note" name="noteText"
readonly="readonly" readonly="readonly"
th:value="*{note}" th:field="*{noteText}"
type="text"/> type="text"/>
</label> </label>
</td> </td>
@@ -116,7 +105,7 @@
<input class="readOnly" <input class="readOnly"
name="dateBorrow" name="dateBorrow"
readonly="readonly" readonly="readonly"
th:value="*{dateBorrow}" th:field="*{dateBorrow}"
type="text"/> type="text"/>
</label> </label>
</td> </td>
@@ -128,7 +117,7 @@
<input class="readOnly" <input class="readOnly"
name="dateScheduledReturn" name="dateScheduledReturn"
readonly="readonly" readonly="readonly"
th:value="*{date_scheduled_return}" th:field="*{dateScheduledReturn}"
type="text"/> type="text"/>
</label> </label>
</td> </td>
@@ -147,6 +136,5 @@
<br/> <br/>
<a href="javascript:insertSubmit()">承認待ち一覧に戻る</a> <a href="javascript:insertSubmit()">承認待ち一覧に戻る</a>
</form> </form>
</body> </body>
</html> </html>

View File

@@ -2,13 +2,7 @@
<html xmlns:th="http://www.thymeleaf.org"> <html xmlns:th="http://www.thymeleaf.org">
<head> <head>
<meta charset="UTF-8">
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<!-- 外部のスクリプトファイルを読み込む -->
<script th:src="@{/js/common.js}"></script>
<!-- CSSの読み込み -->
<link rel="stylesheet" th:href="@{/css/all.css}">
<link rel=stylesheet th:href="@{/css/style.css}" type="text/css">
<title>書籍貸出却下画面</title> <title>書籍貸出却下画面</title>
</head> </head>