23 Commits

Author SHA1 Message Date
23232954f1 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-17 16:08:12 +09:00
kkazuya
296bcf8d70 Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 16:03:38 +09:00
kkazuya
544cbd0ac8 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 16:02:58 +09:00
kkazuya
0eddd7889f Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi
# Conflicts:
#	src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java
2026-09-17 16:02:22 +09:00
192191d352 [ADD]パスワード再設定の作成 2026-09-17 15:59:33 +09:00
kkazuya
bda791567c [ADD] コース選択画面を作成しました。 2026-09-17 15:50:43 +09:00
kkazuya
1e09463984 [ADD] コース選択画面に遷移するCourseControllerを作成しました。 2026-09-17 15:50:11 +09:00
kkazuya
a89c54f8c0 [ADD] Course, CoureseInfoのサービスとそれを実装したクラスを作成しました。 2026-09-17 15:49:11 +09:00
646c37ea57 [ADD]認証機能の作成 2026-09-17 15:33:17 +09:00
kkazuya
7a13d9cdda Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 15:31:40 +09:00
kkazuya
0c5f4a8c9b Merge branch 'k-oshita' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi
# Conflicts:
#	src/main/java/com/example/demo/app/infra/repository/GoalRepository.java
2026-09-17 15:31:20 +09:00
kkazuya
c5d1814be4 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 15:25:03 +09:00
ce0a158988 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 14:23:41 +09:00
3d3177bbfa [ADD]新規会員登録機能の作成 2026-09-17 14:23:30 +09:00
54b909d00d [ADD] 目標のためのModelを作成しました。 2026-09-17 14:22:06 +09:00
0b336dcf5a [EDIT] 改行・コード位置を調整しました。 2026-09-17 14:16:29 +09:00
68fbe40385 [EDIT] 改行・コードを調整しました。 2026-09-17 14:03:44 +09:00
9ae0669739 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 14:01:56 +09:00
f03638b347 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 14:01:32 +09:00
867926391f [ADD] 目標のためのRepositoryを作成しました。 2026-09-17 13:56:58 +09:00
b0e675d32e Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 13:52:56 +09:00
86c6910c4a Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 13:29:15 +09:00
cef08f1663 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 12:51:54 +09:00
17 changed files with 457 additions and 1 deletions

View File

@@ -0,0 +1,10 @@
package com.example.demo.app.domain.service;
import java.util.List;
import com.example.demo.app.domain.model.CourseInfoModel;
public interface CourseInfoService {
public List<CourseInfoModel> findAll();
}

View File

@@ -0,0 +1,11 @@
package com.example.demo.app.domain.service;
import java.util.List;
import com.example.demo.app.domain.model.CourseModel;
public interface CourseService {
public List<CourseModel> findAll();
}

View File

@@ -0,0 +1,8 @@
package com.example.demo.app.domain.service;
import com.example.demo.app.presentation.form.PasswordResetForm;
public interface PasswordResetService {
boolean resetPassword(Long userId, PasswordResetForm passwordResetForm);
}

View File

@@ -0,0 +1,8 @@
package com.example.demo.app.domain.service;
import com.example.demo.app.presentation.form.UserForm;
public interface UserService {
void register(UserForm userForm);
}

View File

@@ -0,0 +1,23 @@
package com.example.demo.app.domain.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.CourseInfoModel;
import com.example.demo.app.domain.service.CourseInfoService;
import com.example.demo.app.infra.repository.AllocationRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class CourseInfoServiceImpl implements CourseInfoService {
private final AllocationRepository allocationRepository;
@Override
public List<CourseInfoModel> findAll() {
return allocationRepository.findAllJoinedAllocation();
}
}

View File

@@ -0,0 +1,24 @@
package com.example.demo.app.domain.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.CourseModel;
import com.example.demo.app.domain.service.CourseService;
import com.example.demo.app.infra.entity.CourseEntity;
import com.example.demo.app.infra.repository.CourseRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class CourseServiceImpl implements CourseService {
private final CourseRepository courseRepository;
public List<CourseModel> findAll(){
return CourseEntity.createCourseModelList(courseRepository.findAll());
}
}

View File

@@ -0,0 +1,41 @@
package com.example.demo.app.domain.service.impl;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.service.PasswordResetService;
import com.example.demo.app.infra.entity.UserEntity;
import com.example.demo.app.infra.repository.UserRepository;
import com.example.demo.app.presentation.form.PasswordResetForm;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class PasswordResetServiceImpl implements PasswordResetService {
private final UserRepository userRepository;
@Override
public boolean resetPassword(
Long userId,
PasswordResetForm passwordResetForm) {
if (!passwordResetForm.getPassword()
.equals(passwordResetForm.getPasswordConfirm())) {
return false;
}
UserEntity userEntity =
userRepository.findById(userId).orElse(null);
if (userEntity == null) {
return false;
}
userEntity.setPassword(passwordResetForm.getPassword());
userRepository.save(userEntity);
return true;
}
}

View File

@@ -0,0 +1,58 @@
package com.example.demo.app.domain.service.impl;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.service.UserService;
import com.example.demo.app.infra.entity.CourseEntity;
import com.example.demo.app.infra.entity.GoalEntity;
import com.example.demo.app.infra.entity.QuestionEntity;
import com.example.demo.app.infra.entity.UserEntity;
import com.example.demo.app.infra.repository.CourseRepository;
import com.example.demo.app.infra.repository.GoalRepository;
import com.example.demo.app.infra.repository.QuestionRepository;
import com.example.demo.app.infra.repository.UserRepository;
import com.example.demo.app.presentation.form.UserForm;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {
private final UserRepository userRepository;
private final QuestionRepository questionRepository;
private final GoalRepository goalRepository;
private final CourseRepository courseRepository;
@Override
public void register(UserForm userForm) {
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.setAnnualIncome(userForm.getAnnualIncome());
userEntity.setMonthlyBudget(userForm.getMonthlyBudget());
QuestionEntity questionEntity =
questionRepository.findById(userForm.getSecretQuestionId()).orElse(null);
GoalEntity goalEntity =
goalRepository.findById(userForm.getGoalId()).orElse(null);
CourseEntity courseEntity =
courseRepository.findById(userForm.getCourseId()).orElse(null);
userEntity.setQuestionEntity(questionEntity);
userEntity.setGoalEntity(goalEntity);
userEntity.setCourseEntity(courseEntity);
userEntity.setDeleteFlag(0);
userRepository.save(userEntity);
}
}

View File

@@ -0,0 +1,11 @@
package com.example.demo.app.infra.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.example.demo.app.infra.entity.GoalEntity;
@Repository
public interface GoalRepository extends JpaRepository<GoalEntity, Long> {
}

View File

@@ -0,0 +1,52 @@
package com.example.demo.app.presentation.controller;
import java.util.logging.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import com.example.demo.app.domain.service.CourseInfoService;
import com.example.demo.app.domain.service.CourseService;
import com.example.demo.app.presentation.form.CourseForm;
import com.example.demo.app.presentation.form.CourseInfoForm;
import lombok.RequiredArgsConstructor;
@Controller
@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;
@GetMapping("/select-course")
public String select(Model model) {
//try {
model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll()));
model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll()));
return "select-course";
//} catch (Exception e) {
// // ログイン情報の破棄
// httpSession.invalidate();
//
// e.printStackTrace();
//
// // エラーログ出力
// LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
// // エラー画面遷移
// return null;
// }
}
}

View File

@@ -0,0 +1,61 @@
package com.example.demo.app.presentation.controller;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import com.example.demo.app.domain.service.PasswordResetService;
import com.example.demo.app.presentation.form.PasswordResetForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class PasswordResetController {
private final PasswordResetService passwordResetService;
@GetMapping("/password_reset")
public String showPasswordReset(Model model) {
model.addAttribute(
"passwordResetForm",
new PasswordResetForm());
return "password_reset";
}
@PostMapping("/password_reset")
public String resetPassword(
PasswordResetForm passwordResetForm,
Model model,
HttpSession session) {
Long userId =
(Long) session.getAttribute("passwordResetUserId");
if (userId == null) {
return "redirect:/login";
}
boolean isReset =
passwordResetService.resetPassword(
userId,
passwordResetForm);
if (!isReset) {
model.addAttribute(
"errorMessage",
"パスワードが一致していません。");
return "password_reset";
}
session.removeAttribute("passwordResetUserId");
return "redirect:/login";
}
}

View File

@@ -0,0 +1,35 @@
package com.example.demo.app.presentation.controller;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import com.example.demo.app.presentation.form.UserForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class UserController {
@GetMapping("/user/register")
public String showRegister(Model model) {
model.addAttribute("userForm", new UserForm());
return "user_register";
}
@PostMapping("/user/register/confirm")
public String confirmRegister(
@ModelAttribute UserForm userForm,
HttpSession session) {
session.setAttribute("userForm", userForm);
return "user_register_confirm";
}
}

View File

@@ -0,0 +1,13 @@
package com.example.demo.app.presentation.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PasswordResetForm {
private String password;
private String passwordConfirm;
}

View File

@@ -0,0 +1,24 @@
package com.example.demo.app.presentation.form;
import java.time.LocalDate;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserForm {
private String userName;
private String mailAddress;
private String password;
private Long secretQuestionId;
private String SecretAnswer;
private LocalDate birthDate;
private Integer saving;
private Integer annualIncome;
private Integer monthlyBudget;
private Long goalId;
private Long courseId;
}

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="ja"xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>パスワード再設定</title>
</head>
<body>
<header></header>
<main>
<h1>パスワード再設定</h1>
<form th:action="@{/password_reset}" th:obiect="${passwordResteForm"} method="post">
<div>
<label for="password">新しいパスワード</label>
<input type="password"
id="password"
th:field="*{password}"
minlength="8"
maxlength="255"
required>
</div>
<div>
<label for="passwordConfirm">パスワード確認</label>
<input type="password"
id="passwordConfirm"
th:field="*{passwordConfirm}"
minlength="8"
maxlength="255"
required>
</div>
<button type="submit">再設定</button>
</form>
<div th:if="${errorMessage}">
<p th:text="${errorMessage}"></p>
</div>
</main>
</body>
</html>

View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>コース選択</title>
</head>
<body>
<div class="accordion" id="accordionExample">
<div class="accordion-item" th:each="course:${courseList}">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
<span th:text="${course.courseName}"></span>
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#accordionExample">
<div class="accordion-body">
<span th:text="${course.description}"></span>
<table border="1">
<tr>
<th>カテゴリ名</th><tr>配分(%)</tr>
</tr>
<tr th:each="courseInfo:${courseInfoList}" th:if="course.courseId=courseInfo.courseId">
<td th:text="${courseInfo.categoryName}"></td>
<td th:text="${courseInfo.allocationRatio}"></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html lang="ja"xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>新規会員登録確認</title>