Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi
This commit is contained in:
@@ -0,0 +1,10 @@
|
|||||||
|
package com.example.demo.app.domain.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AuthenticationModel {
|
||||||
|
private Long userId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.example.demo.app.domain.model;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class GoalModel {
|
||||||
|
|
||||||
|
private Long goalId;
|
||||||
|
|
||||||
|
private String goalTitle;
|
||||||
|
|
||||||
|
private String goalSubtitle;
|
||||||
|
|
||||||
|
private Integer targetAmount;
|
||||||
|
|
||||||
|
private LocalDate deadline;
|
||||||
|
|
||||||
|
private Integer goalComplete;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,10 +8,9 @@ import lombok.Getter;
|
|||||||
@Getter
|
@Getter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class UserModel {
|
public class UserModel {
|
||||||
|
|
||||||
private Long userId;
|
private Long userId;
|
||||||
private String userName;
|
private String userName;
|
||||||
private String emailAddress;
|
private String mailAddress;
|
||||||
private String password;
|
private String password;
|
||||||
private Integer secretQuestionId;
|
private Integer secretQuestionId;
|
||||||
private String secretAnswer;
|
private String secretAnswer;
|
||||||
@@ -19,7 +18,7 @@ public class UserModel {
|
|||||||
private Integer saving;
|
private Integer saving;
|
||||||
private Integer annualIncome;
|
private Integer annualIncome;
|
||||||
private Integer monthlyBudget;
|
private Integer monthlyBudget;
|
||||||
private Integer goalId;
|
private Long goalId;
|
||||||
private Integer courseId;
|
private Long courseId;
|
||||||
private Integer deleteFlag;
|
private Integer deleteFlag;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.example.demo.app.domain.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.model.AllocationModel;
|
||||||
|
|
||||||
|
public interface AllocationService {
|
||||||
|
|
||||||
|
public List<AllocationModel> findAll();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.example.demo.app.domain.service;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.model.AuthenticationModel;
|
||||||
|
import com.example.demo.app.presentation.form.AuthenticationForm;
|
||||||
|
|
||||||
|
public interface AuthenticationService {
|
||||||
|
|
||||||
|
AuthenticationModel authenticate(AuthenticationForm authenticationForm);
|
||||||
|
}
|
||||||
@@ -5,6 +5,6 @@ import java.util.List;
|
|||||||
import com.example.demo.app.domain.model.CourseInfoModel;
|
import com.example.demo.app.domain.model.CourseInfoModel;
|
||||||
|
|
||||||
public interface CourseInfoService {
|
public interface CourseInfoService {
|
||||||
|
//
|
||||||
public List<CourseInfoModel> findAll();
|
public List<CourseInfoModel> findAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.List;
|
|||||||
import com.example.demo.app.domain.model.CourseModel;
|
import com.example.demo.app.domain.model.CourseModel;
|
||||||
|
|
||||||
public interface CourseService {
|
public interface CourseService {
|
||||||
|
//
|
||||||
public List<CourseModel> findAll();
|
public List<CourseModel> findAll();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
package com.example.demo.app.domain.service;
|
|
||||||
|
|
||||||
import com.example.demo.app.presentation.form.PasswordResetForm;
|
|
||||||
|
|
||||||
public interface PasswordResetService {
|
|
||||||
|
|
||||||
boolean resetPassword(Long userId, PasswordResetForm passwordResetForm);
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package com.example.demo.app.domain.service;
|
|
||||||
|
|
||||||
import com.example.demo.app.presentation.form.UserForm;
|
|
||||||
|
|
||||||
public interface UserService {
|
|
||||||
|
|
||||||
void register(UserForm userForm);
|
|
||||||
}
|
|
||||||
@@ -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.AllocationModel;
|
||||||
|
import com.example.demo.app.domain.service.AllocationService;
|
||||||
|
import com.example.demo.app.infra.entity.AllocationEntity;
|
||||||
|
import com.example.demo.app.infra.repository.AllocationRepository;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AllocationServiceImpl implements AllocationService {
|
||||||
|
|
||||||
|
AllocationRepository allocationRepository;
|
||||||
|
|
||||||
|
public List<AllocationModel> findAll(){
|
||||||
|
return AllocationEntity.createAllocationModelList(allocationRepository.findAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -33,7 +33,9 @@ public class AnalysisServiceImpl implements AnalysisService {
|
|||||||
public AnalysisModel getAnalysis(Long userId) {
|
public AnalysisModel getAnalysis(Long userId) {
|
||||||
|
|
||||||
// ユーザー情報取得、月別使用可能資金取得
|
// ユーザー情報取得、月別使用可能資金取得
|
||||||
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
|
UserEntity userEntity = userRepository.findById(userId).orElseThrow(() ->
|
||||||
|
new RuntimeException(
|
||||||
|
"User not found."));
|
||||||
|
|
||||||
// コースID取得
|
// コースID取得
|
||||||
Long courseId = userEntity.getCourseEntity().getCourseId();
|
Long courseId = userEntity.getCourseEntity().getCourseId();
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.example.demo.app.domain.service.impl;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.model.AuthenticationModel;
|
||||||
|
import com.example.demo.app.domain.service.AuthenticationService;
|
||||||
|
import com.example.demo.app.infra.entity.UserEntity;
|
||||||
|
import com.example.demo.app.infra.repository.UserRepository;
|
||||||
|
import com.example.demo.app.presentation.form.AuthenticationForm;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AuthenticationServiceImpl implements AuthenticationService {
|
||||||
|
|
||||||
|
private final UserRepository userRepository;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AuthenticationModel authenticate(AuthenticationForm authenticationForm) {
|
||||||
|
|
||||||
|
UserEntity userEntity = userRepository.findByMailAddress(
|
||||||
|
authenticationForm.getMailAddress())
|
||||||
|
.orElse(null);
|
||||||
|
|
||||||
|
if (userEntity == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!userEntity.getQuestionEntity().getSecretQuestionId()
|
||||||
|
.equals(authenticationForm.getSecretQuestionId())) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!userEntity.getSecretQuestionAnswer()
|
||||||
|
.equals(authenticationForm.getSecretAnswer())) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new AuthenticationModel(userEntity.getUserId());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,6 +18,7 @@ public class CourseServiceImpl implements CourseService {
|
|||||||
private final CourseRepository courseRepository;
|
private final CourseRepository courseRepository;
|
||||||
|
|
||||||
public List<CourseModel> findAll(){
|
public List<CourseModel> findAll(){
|
||||||
|
|
||||||
return CourseEntity.createCourseModelList(courseRepository.findAll());
|
return CourseEntity.createCourseModelList(courseRepository.findAll());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -24,15 +24,15 @@ public class AnalysisController {
|
|||||||
public String showAnalysis(Model model, HttpSession session) {
|
public String showAnalysis(Model model, HttpSession session) {
|
||||||
|
|
||||||
//ログインユーザーの取得(セッション)
|
//ログインユーザーの取得(セッション)
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
//分析結果の取得(Service)
|
//分析結果の取得(Service)
|
||||||
AnalysisModel analysisModel = analysisService.getAnalysis(loginUser.getUserId());
|
AnalysisModel analysisModel = analysisService.getAnalysis(loginUser.getUserId());
|
||||||
|
|
||||||
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
|
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
|
||||||
|
|
||||||
//model格納
|
//model格納
|
||||||
model.addAttribute("analysisForm", analysisForm);
|
model.addAttribute("analysisForm", analysisForm);
|
||||||
|
|
||||||
return "analysis";
|
return "analysis";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
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.model.AuthenticationModel;
|
||||||
|
import com.example.demo.app.domain.service.AuthenticationService;
|
||||||
|
import com.example.demo.app.infra.repository.QuestionRepository;
|
||||||
|
import com.example.demo.app.presentation.form.AuthenticationForm;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class AuthenticationController {
|
||||||
|
|
||||||
|
private final AuthenticationService authenticationService;
|
||||||
|
private final QuestionRepository questionRepository;
|
||||||
|
|
||||||
|
@GetMapping("/authentication")
|
||||||
|
public String showAuthentication(Model model) {
|
||||||
|
|
||||||
|
model.addAttribute("authenticationForm", new AuthenticationForm());
|
||||||
|
model.addAttribute("questionList", questionRepository.findAll());
|
||||||
|
|
||||||
|
return "authentication";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/authentication")
|
||||||
|
public String authenticate(
|
||||||
|
AuthenticationForm authenticationForm,
|
||||||
|
Model model,
|
||||||
|
HttpSession session) {
|
||||||
|
|
||||||
|
AuthenticationModel authenticationModel =
|
||||||
|
authenticationService.authenticate(authenticationForm);
|
||||||
|
|
||||||
|
if (authenticationModel == null) {
|
||||||
|
model.addAttribute("errorMessage", "認証情報が正しくありません。");
|
||||||
|
model.addAttribute("questionList", questionRepository.findAll());
|
||||||
|
|
||||||
|
return "authentication";
|
||||||
|
}
|
||||||
|
|
||||||
|
session.setAttribute(
|
||||||
|
"passwordResetUserId",
|
||||||
|
authenticationModel.getUserId());
|
||||||
|
|
||||||
|
return "password_reset";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
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";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
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";
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/user/register/complete")
|
|
||||||
public String completeRegister(HttpSession session) {
|
|
||||||
|
|
||||||
UserForm userForm =
|
|
||||||
(UserForm) session.getAttribute("userForm");
|
|
||||||
|
|
||||||
// DBへの登録処理
|
|
||||||
|
|
||||||
session.removeAttribute("userForm");
|
|
||||||
|
|
||||||
return "redirect:/login";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.example.demo.app.presentation.form;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.model.AllocationModel;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class AllocationForm {
|
||||||
|
|
||||||
|
private Long categoryId;
|
||||||
|
private Long courseId;
|
||||||
|
private Integer allocationRatio;
|
||||||
|
|
||||||
|
public static AllocationForm convertFrom(AllocationModel allocationModel) {
|
||||||
|
return new AllocationForm(allocationModel.getCategoryId(), allocationModel.getCourseId(), allocationModel.getAllocationRatio());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<AllocationForm> convertFrom(List<AllocationModel> allocationModelList){
|
||||||
|
return allocationModelList.stream().map(AllocationForm::convertFrom).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,20 +13,23 @@ import lombok.NoArgsConstructor;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class AnalysisForm {
|
public class AnalysisForm {
|
||||||
|
|
||||||
private Integer currentMonthTotalAmount;
|
private Integer currentMonthTotalAmount;
|
||||||
private Integer previousMonthTotalAmount;
|
|
||||||
private Integer totalDifferenceAmount;
|
|
||||||
private List<CategoryAnalysisForm> categoryAnalysisFormList;
|
|
||||||
|
|
||||||
public static AnalysisForm convertFrom(
|
|
||||||
AnalysisModel analysisModel) {
|
|
||||||
|
|
||||||
return new AnalysisForm(
|
private Integer previousMonthTotalAmount;
|
||||||
analysisModel.getCurrentMonthTotalAmount(),
|
|
||||||
analysisModel.getPreviousMonthTotalAmount(),
|
|
||||||
analysisModel.getTotalDifferenceAmount(),
|
|
||||||
CategoryAnalysisForm.convertFrom(
|
|
||||||
analysisModel.getCategoryAnalysisModelList()));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private Integer totalDifferenceAmount;
|
||||||
|
|
||||||
|
private List<CategoryAnalysisForm>
|
||||||
|
categoryAnalysisFormList;
|
||||||
|
|
||||||
|
public static AnalysisForm convertFrom(
|
||||||
|
AnalysisModel analysisModel) {
|
||||||
|
|
||||||
|
return new AnalysisForm(
|
||||||
|
analysisModel.getCurrentMonthTotalAmount(),
|
||||||
|
analysisModel.getPreviousMonthTotalAmount(),
|
||||||
|
analysisModel.getTotalDifferenceAmount(),
|
||||||
|
CategoryAnalysisForm.convertFrom(
|
||||||
|
analysisModel.getCategoryAnalysisModelList()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ import lombok.NoArgsConstructor;
|
|||||||
@Data
|
@Data
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class PasswordResetForm {
|
public class AuthenticationForm {
|
||||||
private String password;
|
private String mailAddress;
|
||||||
private String passwordConfirm;
|
private Integer secretQuestionId;
|
||||||
|
private String secretAnswer;
|
||||||
}
|
}
|
||||||
@@ -12,8 +12,8 @@ import lombok.NoArgsConstructor;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class CategoryAnalysisForm {
|
public class CategoryAnalysisForm {
|
||||||
|
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
|
|
||||||
private Integer currentMonthAmount;
|
private Integer currentMonthAmount;
|
||||||
|
|
||||||
@@ -24,25 +24,24 @@ public class CategoryAnalysisForm {
|
|||||||
private Integer courseLimitAmount;
|
private Integer courseLimitAmount;
|
||||||
|
|
||||||
private Integer courseDifferenceAmount;
|
private Integer courseDifferenceAmount;
|
||||||
|
|
||||||
public static CategoryAnalysisForm convertFrom(
|
|
||||||
|
|
||||||
CategoryAnalysisModel categoryAnalysisModel) {
|
|
||||||
return new CategoryAnalysisForm(
|
|
||||||
categoryAnalysisModel.getCategoryName(),
|
|
||||||
categoryAnalysisModel.getCurrentMonthAmount(),
|
|
||||||
categoryAnalysisModel.getPreviousMonthAmount(),
|
|
||||||
categoryAnalysisModel.getMonthDifferenceAmount(),
|
|
||||||
categoryAnalysisModel.getCourseLimitAmount(),
|
|
||||||
categoryAnalysisModel.getCourseDifferenceAmount());
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<CategoryAnalysisForm> convertFrom(
|
|
||||||
List<CategoryAnalysisModel> categoryAnalysisModelList) {
|
|
||||||
|
|
||||||
return categoryAnalysisModelList.stream()
|
|
||||||
.map(CategoryAnalysisForm::convertFrom)
|
|
||||||
.toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
public static CategoryAnalysisForm convertFrom(
|
||||||
|
CategoryAnalysisModel categoryAnalysisModel) {
|
||||||
|
|
||||||
|
return new CategoryAnalysisForm(
|
||||||
|
categoryAnalysisModel.getCategoryName(),
|
||||||
|
categoryAnalysisModel.getCurrentMonthAmount(),
|
||||||
|
categoryAnalysisModel.getPreviousMonthAmount(),
|
||||||
|
categoryAnalysisModel.getMonthDifferenceAmount(),
|
||||||
|
categoryAnalysisModel.getCourseLimitAmount(),
|
||||||
|
categoryAnalysisModel.getCourseDifferenceAmount());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<CategoryAnalysisForm> convertFrom(
|
||||||
|
List<CategoryAnalysisModel> categoryAnalysisModelList) {
|
||||||
|
|
||||||
|
return categoryAnalysisModelList.stream()
|
||||||
|
.map(CategoryAnalysisForm::convertFrom)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class CourseInfoForm {
|
|||||||
|
|
||||||
|
|
||||||
public static CourseInfoForm convertFrom(CourseInfoModel courseInfoModel ) {
|
public static CourseInfoForm convertFrom(CourseInfoModel courseInfoModel ) {
|
||||||
return new CourseInfoForm(courseInfoModel.getCategoryId(), courseInfoModel.getCourseName(), courseInfoModel.getCategoryId(), courseInfoModel.getCategoryName(), courseInfoModel.getAllocationRatio());
|
return new CourseInfoForm(courseInfoModel.getCourseId(), courseInfoModel.getCourseName(), courseInfoModel.getCategoryId(), courseInfoModel.getCategoryName(), courseInfoModel.getAllocationRatio());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<CourseInfoForm> convertFrom(List<CourseInfoModel> courseInfoModelList ) {
|
public static List<CourseInfoForm> convertFrom(List<CourseInfoModel> courseInfoModelList ) {
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
53
src/main/resources/templates/Authentication.html
Normal file
53
src/main/resources/templates/Authentication.html
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>認証</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<main>
|
||||||
|
<h1>本人認証確認</h1>
|
||||||
|
|
||||||
|
<form th:action="@{/authentication}" th:object="${authenticationForm}" method="post">
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="mailAddress">メールアドレス</label>
|
||||||
|
<input type="email" id="mailAddress" th:field="*{mailAddress}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="secretQuestionId">秘密の質問</label>
|
||||||
|
<select id="secretQuestionId" th:field="*{secretQuestionId}">
|
||||||
|
|
||||||
|
<option value="">選択してください</option>
|
||||||
|
|
||||||
|
<option th:each="question : ${questionList}" th:value="${question.secretQuestionId}"
|
||||||
|
th:text="${question.questionText}">
|
||||||
|
</option>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="secretAnswer">秘密の質問の回答</label>
|
||||||
|
<input type="text" id="secretAnswer" th:field="*{secretAnswer}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit">確認</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form th:action="@{/login}" method="get">
|
||||||
|
<button type="submit">戻る</button>
|
||||||
|
</form>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<script th:if="${errorMessage}" th:inline="javascript">
|
||||||
|
alert(/*[[${errorMessage}]]*/);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -1,18 +1,21 @@
|
|||||||
<!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 name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||||
<title>分析画面</title>
|
<title>分析画面</title>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
<div th:replace="~{header :: header}">
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2 class="text-center">支出分析</h2>
|
<h2 class="text-center">支出分析</h2>
|
||||||
|
|
||||||
<table class="table text-center">
|
<table class="table text-center">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col"></th>
|
<th scope="col">カテゴリ別</th>
|
||||||
<th scope="col">支出</th>
|
<th scope="col">支出</th>
|
||||||
<th scope="col">前月比</th>
|
<th scope="col">前月比</th>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -24,8 +27,8 @@
|
|||||||
0
|
0
|
||||||
</td>
|
</td>
|
||||||
<td th:text="${analysisForm.totalDifferenceAmount >= 0}
|
<td th:text="${analysisForm.totalDifferenceAmount >= 0}
|
||||||
? '+' + ${analysisForm.totalDifferenceAmount}
|
? '+' + ${analysisForm.totalDifferenceAmount}
|
||||||
: '-' + ${analysisForm.totalDifferenceAmount}"
|
: ${analysisForm.totalDifferenceAmount}"
|
||||||
th:class="${analysisForm.totalDifferenceAmount >= 0}
|
th:class="${analysisForm.totalDifferenceAmount >= 0}
|
||||||
? 'color-danger;'
|
? 'color-danger;'
|
||||||
: 'color-primary;'">
|
: 'color-primary;'">
|
||||||
@@ -42,11 +45,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="col">カテゴリ別</th>
|
<th scope="col">カテゴリ別</th>
|
||||||
<th scope="col">支出</th>
|
<th scope="col">支出</th>
|
||||||
<th scope="col">
|
<th scope="col">前月比<br>コース比</th>
|
||||||
前月比
|
|
||||||
<br>
|
|
||||||
コース比
|
|
||||||
</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -63,16 +62,16 @@
|
|||||||
|
|
||||||
<td>
|
<td>
|
||||||
<span th:text="${category.monthDifferenceAmount >= 0}
|
<span th:text="${category.monthDifferenceAmount >= 0}
|
||||||
? '+' + ${category.monthDifferenceAmount}
|
? '+' + ${category.monthDifferenceAmount}
|
||||||
: '-' + ${category.monthDifferenceAmount}"
|
: ${category.monthDifferenceAmount}"
|
||||||
th:class="${category.monthDifferenceAmount >= 0}
|
th:class="${category.monthDifferenceAmount >= 0}
|
||||||
? 'color-danger;'
|
? 'color-danger;'
|
||||||
: 'color-primary;'">
|
: 'color-primary;'">
|
||||||
</span>
|
</span>
|
||||||
<br>
|
<br>
|
||||||
<span th:text="${category.courseDifferenceAmount >= 0}
|
<span th:text="${category.courseDifferenceAmount >= 0}
|
||||||
? '+' + ${category.courseDifferenceAmount}
|
? '+' + ${category.courseDifferenceAmount}
|
||||||
: '-' + ${category.courseDifferenceAmount}"
|
: ${category.courseDifferenceAmount}"
|
||||||
th:class="${category.courseDifferenceAmount >= 0}
|
th:class="${category.courseDifferenceAmount >= 0}
|
||||||
? 'color-danger;'
|
? 'color-danger;'
|
||||||
: 'color-primary;'">
|
: 'color-primary;'">
|
||||||
|
|||||||
29
src/main/resources/templates/header.html
Normal file
29
src/main/resources/templates/header.html
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>ヘッダー</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header th:fragment="header">
|
||||||
|
|
||||||
|
<nav class="navbar" style="background-color: #e3f2fd;" data-bs-theme="light">
|
||||||
|
<div class="container-fluid">
|
||||||
|
<a th:href="@{/menu}" class="navbar-brand fw-bold">Monegement</a>
|
||||||
|
<div class="d-flex gap-2">
|
||||||
|
<a class="btn btn-outline-primary btn-sm" th:href="@{/course}">
|
||||||
|
コース
|
||||||
|
</a>
|
||||||
|
<a class="btn btn-outline-secondary btn-sm" th:href="@{/profile}">
|
||||||
|
プロフィール
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
</header>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<!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>
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="ja"xmlns:th="http://www.thymeleaf.org">
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>新規会員登録確認</title>
|
<title>新規会員登録確認</title>
|
||||||
|
|||||||
Reference in New Issue
Block a user