From 65d80e6306fe57b188878791768987ab15ec6fdc Mon Sep 17 00:00:00 2001 From: s-choi Date: Thu, 24 Sep 2026 10:39:03 +0900 Subject: [PATCH 1/8] =?UTF-8?q?[FIX]=20=E7=9B=AE=E6=A8=99=E3=82=AB?= =?UTF-8?q?=E3=83=A9=E3=83=A0=E3=81=AE=E6=9D=A1=E4=BB=B6=E3=81=A8=E8=AA=AD?= =?UTF-8?q?=E3=81=BF=E5=8F=96=E3=82=8C=E3=81=AA=E3=81=84=E5=95=8F=E9=A1=8C?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/service/impl/UserServiceImpl.java | 64 +++++++++---------- .../demo/app/infra/entity/GoalEntity.java | 10 +-- 2 files changed, 35 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java b/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java index b4872f7..6aa541c 100644 --- a/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java +++ b/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java @@ -16,7 +16,6 @@ import com.example.demo.app.presentation.form.UserForm; import lombok.RequiredArgsConstructor; - @Service @RequiredArgsConstructor public class UserServiceImpl implements UserService { @@ -24,58 +23,55 @@ public class UserServiceImpl implements UserService { private final QuestionRepository questionRepository; private final GoalRepository goalRepository; private final CourseRepository courseRepository; - + @Override public void register(UserForm userForm, Long courseId) { - UserEntity userEntity = new UserEntity(); + UserEntity userEntity = new UserEntity(); - userEntity.setUserName(userForm.getUserName()); - userEntity.setMailAddress(userForm.getMailAddress()); - userEntity.setPassword(userForm.getPassword()); - userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer()); - userEntity.setBirthDate(userForm.getBirthDate()); - userEntity.setSaving(userForm.getSaving()); - userEntity.setBirthDate(userForm. getBirthDate()); - userEntity.setSaving(userForm.getSaving()); - userEntity.setAnnualIncome(userForm.getAnnualIncome()); - userEntity.setMonthlyBudget(userForm.getMonthlyBudget()); + userEntity.setUserName(userForm.getUserName()); + userEntity.setMailAddress(userForm.getMailAddress()); + userEntity.setPassword(userForm.getPassword()); + userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer()); + userEntity.setBirthDate(userForm.getBirthDate()); + userEntity.setSaving(userForm.getSaving()); + userEntity.setBirthDate(userForm.getBirthDate()); + userEntity.setSaving(userForm.getSaving()); + userEntity.setAnnualIncome(userForm.getAnnualIncome()); + userEntity.setMonthlyBudget(userForm.getMonthlyBudget()); - QuestionEntity questionEntity = - questionRepository.findById(userForm.getSecretQuestionId()).orElse(null); + QuestionEntity questionEntity = questionRepository.findById(userForm.getSecretQuestionId()).orElse(null); - GoalEntity goalEntity = - goalRepository.findById(userForm.getGoalId()).orElse(null); + GoalEntity goalEntity = new GoalEntity(); + goalEntity.setTargetAmount(Integer.parseInt(String.valueOf(userForm.getGoalId()))); - CourseEntity courseEntity = - courseRepository.findById(courseId).orElse(null); + goalRepository.save( + goalEntity); - userEntity.setQuestionEntity(questionEntity); - userEntity.setGoalEntity(goalEntity); - userEntity.setCourseEntity(courseEntity); + CourseEntity courseEntity = courseRepository.findById(courseId).orElse(null); - userEntity.setDeleteFlag(0); + userEntity.setQuestionEntity(questionEntity); + userEntity.setGoalEntity(goalEntity); + userEntity.setCourseEntity(courseEntity); - userRepository.save(userEntity); + userEntity.setDeleteFlag(0); + + userRepository.save(userEntity); } - + @Override public void updateCourse(Long userId, Long courseId) { UserEntity userEntity = userRepository.findById(userId).orElseThrow(); - + CourseEntity courseEntity = courseRepository.findById(courseId).orElseThrow(); - + userEntity.setCourseEntity(courseEntity); - + userRepository.save(userEntity); } - - + public UserModel findByUserId(Long userId) { - + return UserModel.convertFrom(userRepository.findById(userId).get()); } } - - - diff --git a/src/main/java/com/example/demo/app/infra/entity/GoalEntity.java b/src/main/java/com/example/demo/app/infra/entity/GoalEntity.java index 2996fe6..e37c562 100644 --- a/src/main/java/com/example/demo/app/infra/entity/GoalEntity.java +++ b/src/main/java/com/example/demo/app/infra/entity/GoalEntity.java @@ -32,14 +32,14 @@ public class GoalEntity { @Column(name = "goal_subtitle", nullable = true) private String goalSubtitle; - @Column(name = "target_amount", nullable = false) + @Column(name = "target_amount", nullable = true) private Integer targetAmount; - @Column(name = "deadline", nullable = false) - private LocalDate deadline; + @Column(name = "deadline", nullable = true) + private LocalDate deadline = LocalDate.now().plusYears(1L); - @Column(name = "goal_complete", nullable = true) - private Integer goalComplete; + @Column(name = "goal_complete", nullable = false) + private Integer goalComplete = 0; @OneToOne(mappedBy = "goalEntity") private UserEntity userEntity; From 5ca3226dfac468fe61847a47e61e2640a44344ca Mon Sep 17 00:00:00 2001 From: s-choi Date: Thu, 24 Sep 2026 10:41:38 +0900 Subject: [PATCH 2/8] =?UTF-8?q?[FIX]=20user=E3=81=AB=E7=9B=AE=E6=A8=99?= =?UTF-8?q?=E3=81=8C=E7=B4=90=E3=81=A5=E3=81=91=E3=82=89=E3=82=8C=E3=81=AA?= =?UTF-8?q?=E3=81=84=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../demo/app/domain/service/impl/UserServiceImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java b/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java index 6aa541c..bba298a 100644 --- a/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java +++ b/src/main/java/com/example/demo/app/domain/service/impl/UserServiceImpl.java @@ -45,13 +45,11 @@ public class UserServiceImpl implements UserService { GoalEntity goalEntity = new GoalEntity(); goalEntity.setTargetAmount(Integer.parseInt(String.valueOf(userForm.getGoalId()))); - goalRepository.save( - goalEntity); - CourseEntity courseEntity = courseRepository.findById(courseId).orElse(null); userEntity.setQuestionEntity(questionEntity); - userEntity.setGoalEntity(goalEntity); + userEntity.setGoalEntity(goalRepository.save( + goalEntity)); userEntity.setCourseEntity(courseEntity); userEntity.setDeleteFlag(0); From 41aa5a5b7be402da95f3216118b3cf2446185f1d Mon Sep 17 00:00:00 2001 From: s-morimoto Date: Thu, 24 Sep 2026 10:45:00 +0900 Subject: [PATCH 3/8] =?UTF-8?q?[EDIT]Bootstrap=E3=81=AE=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/authentication.html | 2 ++ src/main/resources/templates/login.html | 2 ++ src/main/resources/templates/password_reset.html | 2 ++ src/main/resources/templates/profile.html | 2 ++ src/main/resources/templates/profile_edit.html | 2 ++ src/main/resources/templates/user_register.html | 2 ++ src/main/resources/templates/user_register_confirm.html | 2 ++ src/main/resources/templates/user_register_return.html | 2 ++ 8 files changed, 16 insertions(+) diff --git a/src/main/resources/templates/authentication.html b/src/main/resources/templates/authentication.html index d99335e..d9b2341 100644 --- a/src/main/resources/templates/authentication.html +++ b/src/main/resources/templates/authentication.html @@ -4,6 +4,8 @@ 認証 + + diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index b49f376..472e628 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -3,6 +3,8 @@ ログイン + +
diff --git a/src/main/resources/templates/password_reset.html b/src/main/resources/templates/password_reset.html index b2abc42..07d4ffb 100644 --- a/src/main/resources/templates/password_reset.html +++ b/src/main/resources/templates/password_reset.html @@ -3,6 +3,8 @@ パスワード再設定 + + diff --git a/src/main/resources/templates/profile.html b/src/main/resources/templates/profile.html index 0fe082b..8a9c72b 100644 --- a/src/main/resources/templates/profile.html +++ b/src/main/resources/templates/profile.html @@ -3,6 +3,8 @@ プロフィール + + diff --git a/src/main/resources/templates/profile_edit.html b/src/main/resources/templates/profile_edit.html index d82c709..ec7d81e 100644 --- a/src/main/resources/templates/profile_edit.html +++ b/src/main/resources/templates/profile_edit.html @@ -3,6 +3,8 @@ プロフィール編集 + + diff --git a/src/main/resources/templates/user_register.html b/src/main/resources/templates/user_register.html index c6ec36b..dee9c92 100644 --- a/src/main/resources/templates/user_register.html +++ b/src/main/resources/templates/user_register.html @@ -3,6 +3,8 @@ 新規会員登録 + +
diff --git a/src/main/resources/templates/user_register_confirm.html b/src/main/resources/templates/user_register_confirm.html index 5356eb7..581457e 100644 --- a/src/main/resources/templates/user_register_confirm.html +++ b/src/main/resources/templates/user_register_confirm.html @@ -4,6 +4,8 @@ 新規会員登録確認 + + diff --git a/src/main/resources/templates/user_register_return.html b/src/main/resources/templates/user_register_return.html index 4ecd680..04fb234 100644 --- a/src/main/resources/templates/user_register_return.html +++ b/src/main/resources/templates/user_register_return.html @@ -3,6 +3,8 @@ 新規会員登録 + +
From 428cb0fd640bac4b1571967255498a773fb80db1 Mon Sep 17 00:00:00 2001 From: kkazuya Date: Thu, 24 Sep 2026 10:50:39 +0900 Subject: [PATCH 4/8] =?UTF-8?q?[EDIT]=20=E3=82=B3=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E9=81=B8=E6=8A=9E=E3=81=AE=E3=83=87=E3=83=95=E3=82=A9=E3=83=AB?= =?UTF-8?q?=E3=83=88=E3=82=92=E3=83=90=E3=83=A9=E3=83=B3=E3=82=B9=E3=82=B3?= =?UTF-8?q?=E3=83=BC=E3=82=B9=E3=81=AB=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E7=B7=A8=E9=9B=86=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= =?UTF-8?q?=E3=83=AD=E3=82=B0=E3=82=A4=E3=83=B3=E6=B8=88=E3=81=BF=E3=81=AE?= =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=81=8C=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=E3=81=BE=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/CourseController.java | 74 +++++++------------ 1 file changed, 25 insertions(+), 49 deletions(-) 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 5a5e2cd..b4e34f8 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 @@ -1,8 +1,5 @@ package com.example.demo.app.presentation.controller; -import java.util.logging.Level; -import java.util.logging.Logger; - import jakarta.servlet.http.HttpSession; import org.springframework.stereotype.Controller; @@ -25,74 +22,53 @@ import lombok.RequiredArgsConstructor; @Controller -//@RequestMapping("/course") @RequiredArgsConstructor public class CourseController { - - private final static Logger LOGGER = Logger.getLogger(CourseController.class.getName()); - // エラーメッセージ用の定数フィールド - private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!"; - private final HttpSession httpSession; private final CourseService courseService; private final CourseInfoService courseInfoService; private final UserService userService; - @PostMapping("/course/select/register") + @PostMapping("/user/register/course") public String showSelectCourse(@ModelAttribute UserForm userForm, Model model, HttpSession session) { - try { + - session.setAttribute("userForm", userForm); - model.addAttribute("mode", "regist"); - model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll())); - model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll())); + session.setAttribute("userForm", userForm); + model.addAttribute("mode", "regist"); + model.addAttribute("currentCourseId", 4); + model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll())); + model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll())); + return "select_course"; - return "select_course"; - - } catch (Exception e) { - // ログイン情報の破棄 - httpSession.invalidate(); - - e.printStackTrace(); - - // エラーログ出力 - LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e); - // エラー画面遷移 - return null; - } + } @SessionCheck - @GetMapping("/select/change") - public String showChangeCourse(Model model) { + @GetMapping("/course") + public String showChangeCourse(Model model, HttpSession session) { - try { - - model.addAttribute("mode", "change"); - model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll())); - model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll())); - - return "select_course"; - - } catch (Exception e) { - // ログイン情報の破棄 - httpSession.invalidate(); + + LoginModel loginUser = (LoginModel) session.getAttribute("loginUser"); + Long userId = loginUser.getUserId(); + + Long currentCourseId = userService.findByUserId(userId).getCourseId(); + model.addAttribute("mode", "change"); + model.addAttribute("currentCourseId", currentCourseId); + model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll())); + model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll())); + - e.printStackTrace(); - - // エラーログ出力 - LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e); - // エラー画面遷移 - return null; - } + return "select_course"; + + } @SessionCheck @PostMapping("/change") - public String changeCourse(@RequestParam Long courseId) { + public String changeCourse(@RequestParam Long courseId, HttpSession httpSession) { LoginModel loginUser = (LoginModel) httpSession.getAttribute("loginUser"); From 6fb4ac0161fd1cd9f37c02dad83d67f284c0ce88 Mon Sep 17 00:00:00 2001 From: kkazuya Date: Thu, 24 Sep 2026 10:51:49 +0900 Subject: [PATCH 5/8] =?UTF-8?q?[EDIT]=20=E3=82=B3=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E9=81=B8=E6=8A=9E=E7=94=BB=E9=9D=A2=E3=81=B8=E3=81=AE=E3=83=98?= =?UTF-8?q?=E3=83=83=E3=83=80=E3=83=BC=E3=81=AE=E8=BF=BD=E5=8A=A0=E3=81=A8?= =?UTF-8?q?=E3=80=81=E3=83=A9=E3=82=B8=E3=82=AA=E3=83=9C=E3=82=BF=E3=83=B3?= =?UTF-8?q?=E3=81=AEchecked=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=97=E3=81=BE?= =?UTF-8?q?=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/select_course.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/resources/templates/select_course.html b/src/main/resources/templates/select_course.html index 7fbda20..505f1dc 100644 --- a/src/main/resources/templates/select_course.html +++ b/src/main/resources/templates/select_course.html @@ -7,6 +7,7 @@ コース選択 +

コース選択

@@ -17,7 +18,7 @@

- + From f10f9f83de06b241887b2939041af403c4a7d54a Mon Sep 17 00:00:00 2001 From: kkazuya Date: Thu, 24 Sep 2026 10:52:52 +0900 Subject: [PATCH 6/8] =?UTF-8?q?[EDIT]=20URL=E3=83=91=E3=82=BF=E3=83=BC?= =?UTF-8?q?=E3=83=B3=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=97=E3=81=BE=E3=81=97?= =?UTF-8?q?=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/user_register.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/templates/user_register.html b/src/main/resources/templates/user_register.html index dee9c92..1bdb65c 100644 --- a/src/main/resources/templates/user_register.html +++ b/src/main/resources/templates/user_register.html @@ -13,7 +13,7 @@

新規会員登録

-
+
Date: Thu, 24 Sep 2026 10:55:03 +0900 Subject: [PATCH 7/8] =?UTF-8?q?[EDIT]=E8=AA=8D=E8=A8=BC=E7=94=BB=E9=9D=A2?= =?UTF-8?q?=E3=81=AE=E3=83=95=E3=83=83=E3=82=BF=E3=83=BC=E3=81=AE=E5=89=8A?= =?UTF-8?q?=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/authentication.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/resources/templates/authentication.html b/src/main/resources/templates/authentication.html index d9b2341..4ea2f8e 100644 --- a/src/main/resources/templates/authentication.html +++ b/src/main/resources/templates/authentication.html @@ -54,8 +54,6 @@ alert(/*[[${errorMessage}]]*/); -
-
From 2139cad2b7c55d285c704c35f17b8dd74b6e4bc0 Mon Sep 17 00:00:00 2001 From: kkazuya Date: Thu, 24 Sep 2026 11:05:26 +0900 Subject: [PATCH 8/8] =?UTF-8?q?[EDIT]=20=E3=82=B3=E3=83=BC=E3=82=B9?= =?UTF-8?q?=E5=A4=89=E6=9B=B4=E7=94=BB=E9=9D=A2=E3=81=AE=E3=81=BF=E3=83=95?= =?UTF-8?q?=E3=83=83=E3=82=BF=E3=83=BC=E3=81=8C=E8=A1=A8=E7=A4=BA=E3=81=95?= =?UTF-8?q?=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E4=BF=AE=E6=AD=A3=E3=81=97?= =?UTF-8?q?=E3=81=BE=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/templates/select_course.html | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/resources/templates/select_course.html b/src/main/resources/templates/select_course.html index 505f1dc..6f3aa5c 100644 --- a/src/main/resources/templates/select_course.html +++ b/src/main/resources/templates/select_course.html @@ -41,6 +41,10 @@
+ +
+
+ \ No newline at end of file