diff --git a/src/main/java/com/example/demo/aop/aspect/SessionCheckAspect.java b/src/main/java/com/example/demo/aop/aspect/SessionCheckAspect.java index 3043c98..37faa6d 100644 --- a/src/main/java/com/example/demo/aop/aspect/SessionCheckAspect.java +++ b/src/main/java/com/example/demo/aop/aspect/SessionCheckAspect.java @@ -10,6 +10,7 @@ import org.aspectj.lang.annotation.Pointcut; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword; import com.example.demo.exception.NoSessionException; @@ -32,7 +33,7 @@ public class SessionCheckAspect { public void checkSession() { HttpSession session = request.getSession(false); - if (session == null || session.getAttribute("loginUser") == null) { + if (session == null || session.getAttribute(SessionKeyword.LOGIN_USER) == null) { throw new NoSessionException("不正なログインです"); } diff --git a/src/main/java/com/example/demo/aop/handler/GlobalExceptionHandler.java b/src/main/java/com/example/demo/aop/handler/GlobalExceptionHandler.java index f61f570..cd2be68 100644 --- a/src/main/java/com/example/demo/aop/handler/GlobalExceptionHandler.java +++ b/src/main/java/com/example/demo/aop/handler/GlobalExceptionHandler.java @@ -12,6 +12,8 @@ import org.springframework.web.HttpRequestMethodNotSupportedException; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; +import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword; +import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; import com.example.demo.exception.NoSessionException; @ControllerAdvice @@ -30,18 +32,18 @@ public class GlobalExceptionHandler { LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e); model.addAttribute( - "errorMessage", + PageReturnAttributeKeyword.ERROR_MESSAGE, "システムエラーが発生しました。" + "初めからやり直してください。"); - return "redirect:/login"; + return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN; } @ExceptionHandler(HttpRequestMethodNotSupportedException.class) public String handleBadRequestException(Model model, Exception e, HttpSession session) { - model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST); - model.addAttribute("status", HttpStatus.BAD_REQUEST.value()); + model.addAttribute(PageReturnAttributeKeyword.ERROR, SEVERE_ERROR_MESSAGE_BAD_REQUEST); + model.addAttribute(PageReturnAttributeKeyword.STATUS, HttpStatus.BAD_REQUEST.value()); e.printStackTrace(); @@ -50,7 +52,7 @@ public class GlobalExceptionHandler { System.out.println("session invalidated method not supported exception"); session.invalidate(); - return "error"; + return TransitionTargetPageNameKeyword.ERROR_HTML; } @ExceptionHandler(Exception.class) @@ -60,6 +62,6 @@ public class GlobalExceptionHandler { System.out.println("session invalidated exception"); session.invalidate(); - return "error"; + return TransitionTargetPageNameKeyword.ERROR_HTML; } } diff --git a/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java b/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java index 26ef947..d11347e 100644 --- a/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java +++ b/src/main/java/com/example/demo/app/domain/service/impl/LoginServiceImpl.java @@ -25,6 +25,8 @@ public class LoginServiceImpl implements LoginService { if (userEntity == null) { return null; + } else if (userEntity.getDeleteFlag() == 1) { + return null; } boolean isValidPassword = false; diff --git a/src/main/java/com/example/demo/app/presentation/controller/CourseController.java b/src/main/java/com/example/demo/app/presentation/controller/CourseController.java index 6166a96..a9b92e4 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/CourseController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/CourseController.java @@ -125,15 +125,6 @@ public class CourseController { List allocationModelList = new ArrayList<>(); - allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId1(), - (Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID), - allocationFormList.getAllocationRatio1())); - allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId2(), - (Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID), - allocationFormList.getAllocationRatio2())); - allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId3(), - (Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID), - allocationFormList.getAllocationRatio3())); allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(), (Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID), allocationFormList.getAllocationRatio4())); diff --git a/src/main/java/com/example/demo/app/presentation/controller/GoalController.java b/src/main/java/com/example/demo/app/presentation/controller/GoalController.java index cb7ee49..2ced072 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/GoalController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/GoalController.java @@ -275,7 +275,7 @@ public class GoalController { int currentAmount = goalService.getCurrentAmount(userId); - model.addAttribute("currentAmount", currentAmount); + model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount); return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML; } diff --git a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java index ab20efd..6593154 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java @@ -238,8 +238,8 @@ public class TransactionController { model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm); - session.setAttribute("tType", String.valueOf(transactionForm.getTransactionType())); - + session.setAttribute(SessionKeyword.T_TYPE, String.valueOf(transactionForm.getTransactionType())); + model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList); model.addAttribute(PageReturnAttributeKeyword.TODAY, today.format(DateTimeFormatter.ISO_LOCAL_DATE)); diff --git a/src/main/java/com/example/demo/app/presentation/controller/UserController.java b/src/main/java/com/example/demo/app/presentation/controller/UserController.java index 2c3eb8e..d09f9ae 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/UserController.java +++ b/src/main/java/com/example/demo/app/presentation/controller/UserController.java @@ -16,6 +16,7 @@ import com.example.demo.app.domain.service.QuestionService; import com.example.demo.app.domain.service.UserService; import com.example.demo.app.infra.entity.QuestionEntity; import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword; +import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword; import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword; import com.example.demo.app.presentation.form.UserForm; @@ -58,7 +59,7 @@ public class UserController { model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName()); } - session.setAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName()); + session.setAttribute(SessionKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName()); model.addAttribute(PageReturnAttributeKeyword.COURSE_ID, courseId); model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm); @@ -70,11 +71,9 @@ public class UserController { String selectedCourseName, Model model, HttpSession session) { - model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute("selectedCourseName")); + model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME)); - session.setAttribute("questionId", userForm.getSecretQuestionId()); - - System.out.println("return questionId: ****************************:" + userForm.getSecretQuestionId()); + session.setAttribute(SessionKeyword.QUESTION_ID, userForm.getSecretQuestionId()); return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML; @@ -86,11 +85,9 @@ public class UserController { Model model, HttpSession session) { - Long courseId = courseService.findByName((String) session.getAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME)); + Long courseId = courseService.findByName((String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME)); - Long questionId = (Long) session.getAttribute("questionId"); - - System.out.println("confirm questionId: ****************************:" + questionId); + Long questionId = (Long) session.getAttribute(SessionKeyword.QUESTION_ID); userForm.setSecretQuestionId(questionId); diff --git a/src/main/java/com/example/demo/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java b/src/main/java/com/example/demo/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java index 3b0a32a..1b89364 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java +++ b/src/main/java/com/example/demo/app/presentation/controller/pageproperty/PageReturnAttributeKeyword.java @@ -4,7 +4,8 @@ public class PageReturnAttributeKeyword { public static final String ERROR_MESSAGE = "errorMessage"; public static final String MESSAGE = "message"; - + public static final String ERROR = "error"; + public static final String STATUS = "status"; public static final String QUESTION_LIST = "questionList"; public static final String USER_FORM = "userForm"; diff --git a/src/main/java/com/example/demo/app/presentation/controller/pageproperty/SessionKeyword.java b/src/main/java/com/example/demo/app/presentation/controller/pageproperty/SessionKeyword.java index b9ee3cc..ca9f1dd 100644 --- a/src/main/java/com/example/demo/app/presentation/controller/pageproperty/SessionKeyword.java +++ b/src/main/java/com/example/demo/app/presentation/controller/pageproperty/SessionKeyword.java @@ -3,4 +3,10 @@ package com.example.demo.app.presentation.controller.pageproperty; public class SessionKeyword { // SESSION情報として格納したいログイン者の情報 public static final String LOGIN_USER = "loginUser"; + + public static final String SELECTED_COURSE_NAME = "selectedCourseName"; + + public static final String QUESTION_ID = "questionId"; + + public static final String T_TYPE = "tType"; } diff --git a/src/main/resources/templates/analysis.html b/src/main/resources/templates/analysis.html index c85e4e0..dfbe44f 100644 --- a/src/main/resources/templates/analysis.html +++ b/src/main/resources/templates/analysis.html @@ -35,7 +35,7 @@ - + @@ -47,7 +47,7 @@ 0
カテゴリ別 支出 前月比
- 食費 - 0 = 0} - ? '+' + ${category.courseDifferenceAmount} + ? '+' + ${category.courseDifferenceAmount} : ${category.courseDifferenceAmount}" th:class="${category.courseDifferenceAmount >= 0} ? 'text-danger' diff --git a/src/main/resources/templates/category_create.html b/src/main/resources/templates/category_create.html index 3a42e92..e91ecd6 100644 --- a/src/main/resources/templates/category_create.html +++ b/src/main/resources/templates/category_create.html @@ -25,7 +25,7 @@
- +

@@ -33,7 +33,7 @@
- diff --git a/src/main/resources/templates/category_list.html b/src/main/resources/templates/category_list.html index b67c0ee..c4184b6 100644 --- a/src/main/resources/templates/category_list.html +++ b/src/main/resources/templates/category_list.html @@ -9,13 +9,13 @@ - +
-
    +
    • @@ -49,19 +49,29 @@
      -
      -
+ +
+
+ - - - -
+ + + + +
+ +
diff --git a/src/main/resources/templates/category_update.html b/src/main/resources/templates/category_update.html index f69ad72..25998de 100644 --- a/src/main/resources/templates/category_update.html +++ b/src/main/resources/templates/category_update.html @@ -25,7 +25,7 @@
- +

@@ -33,7 +33,7 @@
- @@ -47,7 +47,7 @@
- +
diff --git a/src/main/resources/templates/course_create.html b/src/main/resources/templates/course_create.html index dd2f12a..6a1257d 100644 --- a/src/main/resources/templates/course_create.html +++ b/src/main/resources/templates/course_create.html @@ -23,7 +23,7 @@
- +

diff --git a/src/main/resources/templates/course_create_ratio.html b/src/main/resources/templates/course_create_ratio.html index 0ec7ccb..ad7df48 100644 --- a/src/main/resources/templates/course_create_ratio.html +++ b/src/main/resources/templates/course_create_ratio.html @@ -22,86 +22,70 @@
-
- - -
- -
- -
- - -
- -
- -
- - -
- -
-
- +

- +

- +

- +

- +

- +

- +

- + +
+ +
+ +

- +
@@ -110,7 +94,27 @@
- + + diff --git a/src/main/resources/templates/fixed_cost.html b/src/main/resources/templates/fixed_cost.html index 8f7f9f1..9d34e26 100644 --- a/src/main/resources/templates/fixed_cost.html +++ b/src/main/resources/templates/fixed_cost.html @@ -10,7 +10,7 @@ - +
@@ -19,7 +19,7 @@

-
    +
    • @@ -52,21 +52,29 @@
      -
      -
+
- +
+ +
+ + + + + +
+ +
+ - - -
- - -
-
diff --git a/src/main/resources/templates/fixed_cost_create.html b/src/main/resources/templates/fixed_cost_create.html index c6397e9..0c478d1 100644 --- a/src/main/resources/templates/fixed_cost_create.html +++ b/src/main/resources/templates/fixed_cost_create.html @@ -40,8 +40,8 @@ @@ -70,7 +70,7 @@
-
@@ -94,7 +94,7 @@ transactionType.addEventListener("change", function () { - if (this.value === "1") { + if (this.value === "0") { for (let i = 0; i < expenseList.length; i++) { expenseList[i].style.display = ""; @@ -104,7 +104,7 @@ incomeList[i].style.display = "none"; } - } else if (this.value === "2") { + } else if (this.value === "1") { for (let i = 0; i < expenseList.length; i++) { expenseList[i].style.display = "none"; diff --git a/src/main/resources/templates/goal_create.html b/src/main/resources/templates/goal_create.html index 2057470..7acbe37 100644 --- a/src/main/resources/templates/goal_create.html +++ b/src/main/resources/templates/goal_create.html @@ -26,12 +26,12 @@
- +
- +
@@ -51,9 +51,12 @@ - -
- + +
+ + + +
diff --git a/src/main/resources/templates/goal_record.html b/src/main/resources/templates/goal_record.html index e2b5900..c5a7e0b 100644 --- a/src/main/resources/templates/goal_record.html +++ b/src/main/resources/templates/goal_record.html @@ -8,7 +8,7 @@ - +
@@ -74,16 +74,16 @@ -
-
- - - -
-
+ +
+
+ +
+
+
diff --git a/src/main/resources/templates/goal_view.html b/src/main/resources/templates/goal_view.html index 5249f82..45b6b63 100644 --- a/src/main/resources/templates/goal_view.html +++ b/src/main/resources/templates/goal_view.html @@ -189,6 +189,8 @@ +
+
+ +
diff --git a/src/main/resources/templates/menu.html b/src/main/resources/templates/menu.html index 4b4b6b3..8573b98 100644 --- a/src/main/resources/templates/menu.html +++ b/src/main/resources/templates/menu.html @@ -8,10 +8,9 @@ Calendar - - + diff --git a/src/main/resources/templates/profile_edit.html b/src/main/resources/templates/profile_edit.html index c0598f7..3feec50 100644 --- a/src/main/resources/templates/profile_edit.html +++ b/src/main/resources/templates/profile_edit.html @@ -101,15 +101,15 @@ max="10000000" required> + +
+ +
- -
- -
diff --git a/src/main/resources/templates/select_course.html b/src/main/resources/templates/select_course.html index 635e154..7eea6ee 100644 --- a/src/main/resources/templates/select_course.html +++ b/src/main/resources/templates/select_course.html @@ -5,20 +5,23 @@ + コース選択 - +

コース選択

- -
- -
- - -
+
+ +
+ +
+
+
@@ -53,6 +56,7 @@
+
diff --git a/src/main/resources/templates/transaction_create.html b/src/main/resources/templates/transaction_create.html index 760047b..53e3bd3 100644 --- a/src/main/resources/templates/transaction_create.html +++ b/src/main/resources/templates/transaction_create.html @@ -3,10 +3,9 @@ - 取引登録 - - + + 取引登録 @@ -45,11 +44,11 @@ 選択してください - - @@ -124,15 +123,15 @@ const tType = '[[${session.tType}]]'; if (tType == "0") { + transactionType.value = 0; + } else if (tType == "1") { transactionType.value = 1; - } else { - transactionType.value = 2; } transactionType.addEventListener("change", function () { - if (this.value === "1") { + if (this.value === "0") { for (let i = 0; i < expenseList.length; i++) { expenseList[i].style.display = ""; @@ -142,7 +141,7 @@ incomeList[i].style.display = "none"; } - } else if (this.value === "2") { + } else if (this.value === "1") { for (let i = 0; i < expenseList.length; i++) { expenseList[i].style.display = "none";