Compare commits
47 Commits
31a6ce44a4
...
f10f9f83de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f10f9f83de | ||
|
|
6fb4ac0161 | ||
|
|
428cb0fd64 | ||
|
|
df28fa8ccd | ||
| 41aa5a5b7b | |||
|
|
5ca3226dfa | ||
| ff896c77cb | |||
|
|
65d80e6306 | ||
| 1197955f70 | |||
| 336adf0dec | |||
|
|
642cd7ee69 | ||
| 52fe77a5b4 | |||
| ac85c2dc23 | |||
|
|
21ca1a72e2 | ||
|
|
56bb709921 | ||
|
|
e2ddffcc60 | ||
|
|
51310bae25 | ||
|
|
08c2c06f4a | ||
|
|
06c2d35512 | ||
|
|
4192faecc2 | ||
|
|
19218d868c | ||
| 8282331339 | |||
| 1759c45fea | |||
| 44ac862bdb | |||
|
|
5939e75f86 | ||
| ed7a3a67b7 | |||
|
|
41c5f6e99e | ||
|
|
af3e171006 | ||
| 79b1abeac6 | |||
| 1d010dc02b | |||
|
|
d308f14df4 | ||
|
|
a36705d83f | ||
|
|
ab802cdb25 | ||
|
|
1160af5711 | ||
|
|
d2cf2e6e98 | ||
| 69213bcf9c | |||
| e0a7a3496f | |||
| f35a3e03d7 | |||
| 9a1d7144a8 | |||
|
|
d83559e937 | ||
|
|
db65afe184 | ||
|
|
34e9a17273 | ||
|
|
3378f81a2d | ||
| f588e29b46 | |||
| 11fbec6d8c | |||
| 2372c81ddd | |||
| d8ea1acf2f |
11
src/main/java/com/example/demo/aop/aspect/SessionCheck.java
Normal file
11
src/main/java/com/example/demo/aop/aspect/SessionCheck.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.example.demo.aop.aspect;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
public @interface SessionCheck {
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.example.demo.aop.aspect;
|
||||||
|
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
|
import org.aspectj.lang.annotation.Before;
|
||||||
|
import org.aspectj.lang.annotation.Pointcut;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.example.demo.exception.NoSessionException;
|
||||||
|
|
||||||
|
|
||||||
|
@Aspect
|
||||||
|
@Component
|
||||||
|
public class SessionCheckAspect {
|
||||||
|
|
||||||
|
HttpServletRequest request;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public SessionCheckAspect(HttpServletRequest request) {
|
||||||
|
this.request = request;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Pointcut("@annotation(com.example.demo.aop.aspect.SessionCheck)")
|
||||||
|
public void sessionCheckMethod() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before("sessionCheckMethod()")
|
||||||
|
public void checkSession() {
|
||||||
|
HttpSession session = request.getSession(false);
|
||||||
|
|
||||||
|
if (session == null || session.getAttribute("loginUser") == null) {
|
||||||
|
throw new NoSessionException("不正なログインです");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.example.demo.aop.handler;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||||
|
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||||
|
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||||
|
|
||||||
|
import com.example.demo.exception.NoSessionException;
|
||||||
|
|
||||||
|
@ControllerAdvice
|
||||||
|
public class GlobalExceptionHandler {
|
||||||
|
|
||||||
|
private final static Logger LOGGER = Logger.getLogger(GlobalExceptionHandler.class.getName());
|
||||||
|
|
||||||
|
private final String SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION = "不正な遷移です。";
|
||||||
|
private final String SEVERE_ERROR_MESSAGE_BAD_REQUEST = "不正なリクエストです。";
|
||||||
|
|
||||||
|
@ExceptionHandler(NoSessionException.class)
|
||||||
|
public String handleNoSessionException(Model model, Exception e) {
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
|
model.addAttribute(
|
||||||
|
"errorMessage",
|
||||||
|
"システムエラーが発生しました。"
|
||||||
|
+ "初めからやり直してください。");
|
||||||
|
|
||||||
|
return "error";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||||
|
public String handleBadRequestException(Model model, Exception e) {
|
||||||
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
|
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
|
||||||
|
@ExceptionHandler(Exception.class)
|
||||||
|
public String AllException(Model model, Exception e) {
|
||||||
|
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||||
|
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,10 @@ public class GoalModel {
|
|||||||
private LocalDate deadline;
|
private LocalDate deadline;
|
||||||
|
|
||||||
private Integer goalComplete;
|
private Integer goalComplete;
|
||||||
|
|
||||||
|
private Integer achievementRate; // 達成率
|
||||||
|
|
||||||
|
private Integer currentAmount; // 現在の資産
|
||||||
|
|
||||||
public static GoalModel convertFrom(GoalEntity goalEntity) {
|
public static GoalModel convertFrom(GoalEntity goalEntity) {
|
||||||
return new GoalModel(
|
return new GoalModel(
|
||||||
@@ -31,7 +35,8 @@ public class GoalModel {
|
|||||||
goalEntity.getGoalSubtitle(),
|
goalEntity.getGoalSubtitle(),
|
||||||
goalEntity.getTargetAmount(),
|
goalEntity.getTargetAmount(),
|
||||||
goalEntity.getDeadline(),
|
goalEntity.getDeadline(),
|
||||||
goalEntity.getGoalComplete());
|
goalEntity.getGoalComplete(),
|
||||||
|
null,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GoalEntity convertTo(GoalModel goalModel) {
|
public static GoalEntity convertTo(GoalModel goalModel) {
|
||||||
@@ -52,7 +57,8 @@ public class GoalModel {
|
|||||||
goalForm.getGoalSubtitle(),
|
goalForm.getGoalSubtitle(),
|
||||||
goalForm.getTargetAmount(),
|
goalForm.getTargetAmount(),
|
||||||
goalForm.getDeadline(),
|
goalForm.getDeadline(),
|
||||||
goalForm.getGoalComplete());
|
goalForm.getGoalComplete()
|
||||||
|
,null,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@ package com.example.demo.app.domain.model;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import com.example.demo.app.infra.entity.UserEntity;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -12,7 +14,7 @@ public class UserModel {
|
|||||||
private String userName;
|
private String userName;
|
||||||
private String mailAddress;
|
private String mailAddress;
|
||||||
private String password;
|
private String password;
|
||||||
private Integer secretQuestionId;
|
private Long secretQuestionId;
|
||||||
private String secretAnswer;
|
private String secretAnswer;
|
||||||
private LocalDate brithDate;
|
private LocalDate brithDate;
|
||||||
private Integer saving;
|
private Integer saving;
|
||||||
@@ -21,4 +23,22 @@ public class UserModel {
|
|||||||
private Long goalId;
|
private Long goalId;
|
||||||
private Long courseId;
|
private Long courseId;
|
||||||
private Integer deleteFlag;
|
private Integer deleteFlag;
|
||||||
|
|
||||||
|
public static UserModel convertFrom(UserEntity userEntity) {
|
||||||
|
return new UserModel(
|
||||||
|
userEntity.getUserId(),
|
||||||
|
userEntity.getUserName(),
|
||||||
|
userEntity.getMailAddress(),
|
||||||
|
userEntity.getPassword(),
|
||||||
|
userEntity.getQuestionEntity().getSecretQuestionId(),
|
||||||
|
userEntity.getSecretQuestionAnswer(),
|
||||||
|
userEntity.getBirthDate(),
|
||||||
|
userEntity.getSaving(),
|
||||||
|
userEntity.getAnnualIncome(),
|
||||||
|
userEntity.getMonthlyBudget(),
|
||||||
|
userEntity.getGoalEntity().getGoalId(),
|
||||||
|
userEntity.getCourseEntity().getCourseId(),
|
||||||
|
userEntity.getDeleteFlag()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ import com.example.demo.app.domain.model.AnalysisModel;
|
|||||||
|
|
||||||
public interface AnalysisService {
|
public interface AnalysisService {
|
||||||
|
|
||||||
AnalysisModel getAnalysis(Long userId);
|
AnalysisModel getAnalysis(
|
||||||
|
Long userId,
|
||||||
|
Integer year,
|
||||||
|
Integer month);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ public interface CourseService {
|
|||||||
|
|
||||||
public CourseModel findById(Long courseId);
|
public CourseModel findById(Long courseId);
|
||||||
|
|
||||||
|
public Long findByName(String courName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.example.demo.app.domain.service;
|
package com.example.demo.app.domain.service;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.ProfileModel;
|
import com.example.demo.app.domain.model.ProfileModel;
|
||||||
|
import com.example.demo.app.presentation.form.ProfileEditForm;
|
||||||
|
|
||||||
public interface ProfileService {
|
public interface ProfileService {
|
||||||
ProfileModel findOne(Long userId);
|
ProfileModel findOne(Long userId);
|
||||||
|
void withdraw(Long userId);
|
||||||
|
void update(Long userId, ProfileEditForm profileEditForm);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.example.demo.app.domain.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.example.demo.app.infra.entity.QuestionEntity;
|
||||||
|
|
||||||
|
public interface QuestionService {
|
||||||
|
public List<QuestionEntity> findAll();
|
||||||
|
}
|
||||||
@@ -1,10 +1,13 @@
|
|||||||
package com.example.demo.app.domain.service;
|
package com.example.demo.app.domain.service;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.model.UserModel;
|
||||||
import com.example.demo.app.presentation.form.UserForm;
|
import com.example.demo.app.presentation.form.UserForm;
|
||||||
|
|
||||||
public interface UserService {
|
public interface UserService {
|
||||||
|
|
||||||
void register(UserForm userForm);
|
void register(UserForm userForm, Long courseId);
|
||||||
|
|
||||||
public void updateCourse(Long userId, Long courseId);
|
public void updateCourse(Long userId, Long courseId);
|
||||||
|
|
||||||
|
public UserModel findByUserId(Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class AnalysisServiceImpl implements AnalysisService {
|
|||||||
private final CategoryRepository categoryRepository;
|
private final CategoryRepository categoryRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AnalysisModel getAnalysis(Long userId) {
|
public AnalysisModel getAnalysis(Long userId, Integer year, Integer month) {
|
||||||
|
|
||||||
// ユーザー情報取得、月別使用可能資金取得
|
// ユーザー情報取得、月別使用可能資金取得
|
||||||
UserEntity userEntity = userRepository.findById(userId).orElseThrow(() ->
|
UserEntity userEntity = userRepository.findById(userId).orElseThrow(() ->
|
||||||
@@ -44,12 +44,15 @@ public class AnalysisServiceImpl implements AnalysisService {
|
|||||||
Integer monthlyBudget =userEntity.getMonthlyBudget();
|
Integer monthlyBudget =userEntity.getMonthlyBudget();
|
||||||
|
|
||||||
// 今月の期間取得
|
// 今月の期間取得
|
||||||
LocalDate currentMonthStartDate = LocalDate.now().withDayOfMonth(1);
|
LocalDate targetDate = LocalDate.of(year, month, 1);
|
||||||
LocalDate currentMonthEndDate = LocalDate.now().withDayOfMonth(LocalDate.now().lengthOfMonth());
|
LocalDate currentMonthStartDate = targetDate.withDayOfMonth(1);
|
||||||
|
LocalDate currentMonthEndDate = targetDate.withDayOfMonth(targetDate.lengthOfMonth());
|
||||||
|
|
||||||
// 前月の期間取得
|
// 前月の期間取得
|
||||||
LocalDate previousMonthStartDate = LocalDate.now().minusMonths(1).withDayOfMonth(1);
|
LocalDate previousDate = targetDate.minusMonths(1);
|
||||||
LocalDate previousMonthEndDate = LocalDate.now().minusMonths(1).withDayOfMonth(LocalDate.now().minusMonths(1).lengthOfMonth());
|
|
||||||
|
LocalDate previousMonthStartDate = previousDate.withDayOfMonth(1);
|
||||||
|
LocalDate previousMonthEndDate = previousDate.withDayOfMonth(previousDate.lengthOfMonth());
|
||||||
|
|
||||||
// 今月の支出取得
|
// 今月の支出取得
|
||||||
Integer currentMonthTotalAmount = transactionRepository.findTotalExpense(currentMonthStartDate, currentMonthEndDate, userId);
|
Integer currentMonthTotalAmount = transactionRepository.findTotalExpense(currentMonthStartDate, currentMonthEndDate, userId);
|
||||||
|
|||||||
@@ -25,4 +25,8 @@ public class CourseServiceImpl implements CourseService {
|
|||||||
public CourseModel findById(Long courseId) {
|
public CourseModel findById(Long courseId) {
|
||||||
return CourseModel.convertFrom(courseRepository.findByCourseId(courseId));
|
return CourseModel.convertFrom(courseRepository.findByCourseId(courseId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long findByName(String courseName) {
|
||||||
|
return courseRepository.findByCourseName(courseName).getCourseId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,37 @@ public class GoalServiceImpl implements GoalService {
|
|||||||
|
|
||||||
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
|
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
|
||||||
GoalEntity goalEntity = userEntity.getGoalEntity();
|
GoalEntity goalEntity = userEntity.getGoalEntity();
|
||||||
return GoalModel.convertFrom(goalEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// 収支の合計を計算(収入はプラス、支出はマイナス)
|
||||||
|
int transactionTotal = userEntity.getTransactionEntityList().stream()
|
||||||
|
.mapToInt(t -> {
|
||||||
|
int sign = t.getCategoryEntity().getTransactionType() == 1 ? 1 : -1;
|
||||||
|
return sign * t.getAmount();
|
||||||
|
})
|
||||||
|
.sum();
|
||||||
|
|
||||||
|
// 現在の資産 = 貯蓄金 + 収支合計
|
||||||
|
int currentAmount = userEntity.getSaving() + transactionTotal;
|
||||||
|
|
||||||
|
// 達成率(%) = 現在の資産 ÷ 目標金額 × 100
|
||||||
|
int achievementRate =
|
||||||
|
(goalEntity.getTargetAmount() == null)
|
||||||
|
? 0 :
|
||||||
|
(int) ((currentAmount * 100.0) / goalEntity.getTargetAmount());
|
||||||
|
|
||||||
|
GoalModel goalModel = GoalModel.convertFrom(goalEntity);
|
||||||
|
|
||||||
|
return new GoalModel(
|
||||||
|
goalModel.getGoalId(),
|
||||||
|
goalModel.getGoalTitle(),
|
||||||
|
goalModel.getGoalSubtitle(),
|
||||||
|
goalModel.getTargetAmount(),
|
||||||
|
goalModel.getDeadline(),
|
||||||
|
goalModel.getGoalComplete(),
|
||||||
|
achievementRate,
|
||||||
|
currentAmount);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GoalModel createGoal(GoalModel goalModel) {
|
public GoalModel createGoal(GoalModel goalModel) {
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import com.example.demo.app.domain.model.ProfileModel;
|
|||||||
import com.example.demo.app.domain.service.ProfileService;
|
import com.example.demo.app.domain.service.ProfileService;
|
||||||
import com.example.demo.app.infra.entity.UserEntity;
|
import com.example.demo.app.infra.entity.UserEntity;
|
||||||
import com.example.demo.app.infra.repository.UserRepository;
|
import com.example.demo.app.infra.repository.UserRepository;
|
||||||
|
import com.example.demo.app.presentation.form.ProfileEditForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@@ -31,4 +32,32 @@ public class ProfileServiceImpl implements ProfileService{
|
|||||||
userEntity.getAnnualIncome(),
|
userEntity.getAnnualIncome(),
|
||||||
userEntity.getMonthlyBudget());
|
userEntity.getMonthlyBudget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void withdraw(Long userId) {
|
||||||
|
UserEntity userEntity = userRepository.findById(userId).orElse(null);
|
||||||
|
|
||||||
|
if (userEntity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
userEntity.setDeleteFlag(1);
|
||||||
|
userRepository.save(userEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(Long userId, ProfileEditForm profileEditForm) {
|
||||||
|
UserEntity userEntity = userRepository.findById(userId).orElse(null);
|
||||||
|
|
||||||
|
if (userEntity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
userEntity.setUserName(profileEditForm.getUserName());
|
||||||
|
userEntity.setMailAddress(profileEditForm.getMailAddress());
|
||||||
|
userEntity.setSaving(profileEditForm.getSaving());
|
||||||
|
userEntity.setAnnualIncome(profileEditForm.getAnnualIncome());
|
||||||
|
userEntity.setMonthlyBudget(profileEditForm.getMonthlyBudget());
|
||||||
|
userRepository.save(userEntity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.service.QuestionService;
|
||||||
|
import com.example.demo.app.infra.entity.QuestionEntity;
|
||||||
|
import com.example.demo.app.infra.repository.QuestionRepository;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class QuestionServiceImpl implements QuestionService{
|
||||||
|
|
||||||
|
private final QuestionRepository questionRepository;
|
||||||
|
|
||||||
|
public List<QuestionEntity> findAll() {
|
||||||
|
return questionRepository.findAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.example.demo.app.domain.service.impl;
|
|||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.model.UserModel;
|
||||||
import com.example.demo.app.domain.service.UserService;
|
import com.example.demo.app.domain.service.UserService;
|
||||||
import com.example.demo.app.infra.entity.CourseEntity;
|
import com.example.demo.app.infra.entity.CourseEntity;
|
||||||
import com.example.demo.app.infra.entity.GoalEntity;
|
import com.example.demo.app.infra.entity.GoalEntity;
|
||||||
@@ -15,7 +16,6 @@ import com.example.demo.app.presentation.form.UserForm;
|
|||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class UserServiceImpl implements UserService {
|
public class UserServiceImpl implements UserService {
|
||||||
@@ -23,53 +23,53 @@ public class UserServiceImpl implements UserService {
|
|||||||
private final QuestionRepository questionRepository;
|
private final QuestionRepository questionRepository;
|
||||||
private final GoalRepository goalRepository;
|
private final GoalRepository goalRepository;
|
||||||
private final CourseRepository courseRepository;
|
private final CourseRepository courseRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(UserForm userForm) {
|
public void register(UserForm userForm, Long courseId) {
|
||||||
|
|
||||||
UserEntity userEntity = new UserEntity();
|
UserEntity userEntity = new UserEntity();
|
||||||
|
|
||||||
userEntity.setUserName(userForm.getUserName());
|
userEntity.setUserName(userForm.getUserName());
|
||||||
userEntity.setMailAddress(userForm.getMailAddress());
|
userEntity.setMailAddress(userForm.getMailAddress());
|
||||||
userEntity.setPassword(userForm.getPassword());
|
userEntity.setPassword(userForm.getPassword());
|
||||||
userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer());
|
userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer());
|
||||||
userEntity.setBirthDate(userForm.getBirthDate());
|
userEntity.setBirthDate(userForm.getBirthDate());
|
||||||
userEntity.setSaving(userForm.getSaving());
|
userEntity.setSaving(userForm.getSaving());
|
||||||
userEntity.setBirthDate(userForm. getBirthDate());
|
userEntity.setBirthDate(userForm.getBirthDate());
|
||||||
userEntity.setSaving(userForm.getSaving());
|
userEntity.setSaving(userForm.getSaving());
|
||||||
userEntity.setAnnualIncome(userForm.getAnnualIncome());
|
userEntity.setAnnualIncome(userForm.getAnnualIncome());
|
||||||
userEntity.setMonthlyBudget(userForm.getMonthlyBudget());
|
userEntity.setMonthlyBudget(userForm.getMonthlyBudget());
|
||||||
|
|
||||||
QuestionEntity questionEntity =
|
QuestionEntity questionEntity = questionRepository.findById(userForm.getSecretQuestionId()).orElse(null);
|
||||||
questionRepository.findById(userForm.getSecretQuestionId()).orElse(null);
|
|
||||||
|
|
||||||
GoalEntity goalEntity =
|
GoalEntity goalEntity = new GoalEntity();
|
||||||
goalRepository.findById(userForm.getGoalId()).orElse(null);
|
goalEntity.setTargetAmount(Integer.parseInt(String.valueOf(userForm.getGoalId())));
|
||||||
|
|
||||||
CourseEntity courseEntity =
|
CourseEntity courseEntity = courseRepository.findById(courseId).orElse(null);
|
||||||
courseRepository.findById(userForm.getCourseId()).orElse(null);
|
|
||||||
|
|
||||||
userEntity.setQuestionEntity(questionEntity);
|
userEntity.setQuestionEntity(questionEntity);
|
||||||
userEntity.setGoalEntity(goalEntity);
|
userEntity.setGoalEntity(goalRepository.save(
|
||||||
userEntity.setCourseEntity(courseEntity);
|
goalEntity));
|
||||||
|
userEntity.setCourseEntity(courseEntity);
|
||||||
|
|
||||||
userEntity.setDeleteFlag(0);
|
userEntity.setDeleteFlag(0);
|
||||||
|
|
||||||
userRepository.save(userEntity);
|
userRepository.save(userEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateCourse(Long userId, Long courseId) {
|
public void updateCourse(Long userId, Long courseId) {
|
||||||
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
|
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
|
||||||
|
|
||||||
CourseEntity courseEntity = courseRepository.findById(courseId).orElseThrow();
|
CourseEntity courseEntity = courseRepository.findById(courseId).orElseThrow();
|
||||||
|
|
||||||
userEntity.setCourseEntity(courseEntity);
|
userEntity.setCourseEntity(courseEntity);
|
||||||
|
|
||||||
userRepository.save(userEntity);
|
userRepository.save(userEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UserModel findByUserId(Long userId) {
|
||||||
|
|
||||||
|
return UserModel.convertFrom(userRepository.findById(userId).get());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -32,14 +32,14 @@ public class GoalEntity {
|
|||||||
@Column(name = "goal_subtitle", nullable = true)
|
@Column(name = "goal_subtitle", nullable = true)
|
||||||
private String goalSubtitle;
|
private String goalSubtitle;
|
||||||
|
|
||||||
@Column(name = "target_amount", nullable = false)
|
@Column(name = "target_amount", nullable = true)
|
||||||
private Integer targetAmount;
|
private Integer targetAmount;
|
||||||
|
|
||||||
@Column(name = "deadline", nullable = false)
|
@Column(name = "deadline", nullable = true)
|
||||||
private LocalDate deadline;
|
private LocalDate deadline = LocalDate.now().plusYears(1L);
|
||||||
|
|
||||||
@Column(name = "goal_complete", nullable = true)
|
@Column(name = "goal_complete", nullable = false)
|
||||||
private Integer goalComplete;
|
private Integer goalComplete = 0;
|
||||||
|
|
||||||
@OneToOne(mappedBy = "goalEntity")
|
@OneToOne(mappedBy = "goalEntity")
|
||||||
private UserEntity userEntity;
|
private UserEntity userEntity;
|
||||||
|
|||||||
@@ -10,5 +10,8 @@ public interface CourseRepository extends JpaRepository<CourseEntity, Long> {
|
|||||||
@Query("SELECT c FROM CourseEntity c WHERE c.courseId = :courseId ")
|
@Query("SELECT c FROM CourseEntity c WHERE c.courseId = :courseId ")
|
||||||
public CourseEntity findByCourseId(Long courseId);
|
public CourseEntity findByCourseId(Long courseId);
|
||||||
|
|
||||||
|
@Query("SELECT c FROM CourseEntity c WHERE c.courseName = :courseName ")
|
||||||
|
public CourseEntity findByCourseName(String courseName);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
package com.example.demo.app.presentation.controller;
|
package com.example.demo.app.presentation.controller;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.AnalysisModel;
|
import com.example.demo.app.domain.model.AnalysisModel;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.AnalysisService;
|
import com.example.demo.app.domain.service.AnalysisService;
|
||||||
@@ -20,19 +24,47 @@ public class AnalysisController {
|
|||||||
|
|
||||||
private final AnalysisService analysisService;
|
private final AnalysisService analysisService;
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/analysis")
|
@GetMapping("/analysis")
|
||||||
public String showAnalysis(Model model, HttpSession session) {
|
public String showAnalysis(
|
||||||
|
@RequestParam(required = false) Integer year,
|
||||||
|
@RequestParam(required = false) Integer month,
|
||||||
|
Model model,
|
||||||
|
HttpSession session) {
|
||||||
|
|
||||||
//ログインユーザーの取得(セッション)
|
//ログインユーザーの取得(セッション)
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
|
//初期年月表示
|
||||||
|
LocalDate nowDate = LocalDate.now();
|
||||||
|
|
||||||
|
if (year == null) {
|
||||||
|
year = nowDate.getYear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (month == null) {
|
||||||
|
month = nowDate.getMonthValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
//前月・翌月作成
|
||||||
|
LocalDate targetDate = LocalDate.of(year, month, 1);
|
||||||
|
|
||||||
|
LocalDate previousDate = targetDate.minusMonths(1);
|
||||||
|
LocalDate nextDate = targetDate.plusMonths(1);
|
||||||
|
|
||||||
//分析結果の取得(Service)
|
//分析結果の取得(Service)
|
||||||
AnalysisModel analysisModel = analysisService.getAnalysis(loginUser.getUserId());
|
AnalysisModel analysisModel = analysisService.getAnalysis(loginUser.getUserId(), year, month);
|
||||||
|
|
||||||
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
|
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
|
||||||
|
|
||||||
//model格納
|
//model格納
|
||||||
model.addAttribute("analysisForm", analysisForm);
|
model.addAttribute("analysisForm", analysisForm);
|
||||||
|
model.addAttribute("year", year);
|
||||||
|
model.addAttribute("month", month);
|
||||||
|
model.addAttribute("previousYear", previousDate.getYear());
|
||||||
|
model.addAttribute("previousMonth", previousDate.getMonthValue());
|
||||||
|
model.addAttribute("nextYear", nextDate.getYear());
|
||||||
|
model.addAttribute("nextMonth", nextDate.getMonthValue());
|
||||||
|
|
||||||
return "analysis";
|
return "analysis";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.example.demo.app.domain.model.AuthenticationModel;
|
|||||||
import com.example.demo.app.domain.service.AuthenticationService;
|
import com.example.demo.app.domain.service.AuthenticationService;
|
||||||
import com.example.demo.app.infra.repository.QuestionRepository;
|
import com.example.demo.app.infra.repository.QuestionRepository;
|
||||||
import com.example.demo.app.presentation.form.AuthenticationForm;
|
import com.example.demo.app.presentation.form.AuthenticationForm;
|
||||||
|
import com.example.demo.app.presentation.form.PasswordResetForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@@ -29,7 +30,7 @@ public class AuthenticationController {
|
|||||||
|
|
||||||
return "authentication";
|
return "authentication";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/authentication")
|
@PostMapping("/authentication")
|
||||||
public String authenticate(
|
public String authenticate(
|
||||||
AuthenticationForm authenticationForm,
|
AuthenticationForm authenticationForm,
|
||||||
@@ -50,6 +51,10 @@ public class AuthenticationController {
|
|||||||
"passwordResetUserId",
|
"passwordResetUserId",
|
||||||
authenticationModel.getUserId());
|
authenticationModel.getUserId());
|
||||||
|
|
||||||
|
model.addAttribute(
|
||||||
|
"passwordResetForm",
|
||||||
|
new PasswordResetForm());
|
||||||
|
|
||||||
return "password_reset";
|
return "password_reset";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
package com.example.demo.app.presentation.controller;
|
package com.example.demo.app.presentation.controller;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -12,6 +9,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.CourseInfoService;
|
import com.example.demo.app.domain.service.CourseInfoService;
|
||||||
import com.example.demo.app.domain.service.CourseService;
|
import com.example.demo.app.domain.service.CourseService;
|
||||||
@@ -24,74 +22,53 @@ import lombok.RequiredArgsConstructor;
|
|||||||
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
//@RequestMapping("/course")
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CourseController {
|
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 CourseService courseService;
|
||||||
private final CourseInfoService courseInfoService;
|
private final CourseInfoService courseInfoService;
|
||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/user/register/course")
|
||||||
@GetMapping("/course/select/register")
|
|
||||||
public String showSelectCourse(@ModelAttribute UserForm userForm, Model model, HttpSession session) {
|
public String showSelectCourse(@ModelAttribute UserForm userForm, Model model, HttpSession session) {
|
||||||
|
|
||||||
try {
|
|
||||||
System.out.println(userForm.getMailAddress());
|
|
||||||
|
|
||||||
session.setAttribute("userForm", userForm);
|
|
||||||
model.addAttribute("mode", "regist");
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/select/change")
|
|
||||||
public String showChangeCourse(Model model) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
model.addAttribute("mode", "change");
|
session.setAttribute("userForm", userForm);
|
||||||
model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll()));
|
model.addAttribute("mode", "regist");
|
||||||
model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
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("/course")
|
||||||
|
public String showChangeCourse(Model model, HttpSession session) {
|
||||||
|
|
||||||
|
|
||||||
|
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()));
|
||||||
|
|
||||||
|
|
||||||
|
return "select_course";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/change")
|
@PostMapping("/change")
|
||||||
public String changeCourse(@RequestParam Long courseId) {
|
public String changeCourse(@RequestParam Long courseId, HttpSession httpSession) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) httpSession.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) httpSession.getAttribute("loginUser");
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.GoalModel;
|
import com.example.demo.app.domain.model.GoalModel;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.GoalService;
|
import com.example.demo.app.domain.service.GoalService;
|
||||||
@@ -23,15 +24,14 @@ public class GoalController {
|
|||||||
|
|
||||||
private final GoalService goalService;
|
private final GoalService goalService;
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("")
|
@GetMapping("")
|
||||||
public String getGoal(Model model, HttpSession session) {
|
public String getGoal(Model model, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
//テスト用
|
|
||||||
// Long userId = 1L;
|
|
||||||
|
|
||||||
GoalModel goalModel = goalService.getGoalByUserId(userId);
|
GoalModel goalModel = goalService.getGoalByUserId(userId);
|
||||||
GoalForm goalForm = GoalForm.convertFrom(goalModel);
|
GoalForm goalForm = GoalForm.convertFrom(goalModel);
|
||||||
|
|
||||||
@@ -39,14 +39,12 @@ public class GoalController {
|
|||||||
return "goal_view";
|
return "goal_view";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/edit")
|
@GetMapping("/edit")
|
||||||
public String editGoal(Model model, HttpSession session) {
|
public String editGoal(Model model, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
//テスト用
|
|
||||||
// Long userId = 1L;
|
|
||||||
|
|
||||||
GoalModel goalModel = goalService.getGoalByUserId(userId);
|
GoalModel goalModel = goalService.getGoalByUserId(userId);
|
||||||
GoalForm goalForm = GoalForm.convertFrom(goalModel);
|
GoalForm goalForm = GoalForm.convertFrom(goalModel);
|
||||||
@@ -55,15 +53,13 @@ public class GoalController {
|
|||||||
return "goal_edit";
|
return "goal_edit";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
//テスト用
|
|
||||||
// Long userId = 1L;
|
|
||||||
|
|
||||||
|
|
||||||
// 本人の目標かどうかを確認してから更新する
|
// 本人の目標かどうかを確認してから更新する
|
||||||
GoalModel currentGoal = goalService.getGoalByUserId(userId);
|
GoalModel currentGoal = goalService.getGoalByUserId(userId);
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
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.LoginModel;
|
||||||
|
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) {
|
||||||
|
LoginModel loginUser =
|
||||||
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
|
if (loginUser != null) {
|
||||||
|
userId = loginUser.getUserId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userId == null) {
|
||||||
|
return "redirect:/login";
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isReset =
|
||||||
|
passwordResetService.resetPassword(userId, passwordResetForm);
|
||||||
|
|
||||||
|
System.out.println("isReset=" + isReset);
|
||||||
|
|
||||||
|
if(!isReset) {
|
||||||
|
model.addAttribute("Message", "パスワードが一致しません。");
|
||||||
|
return "password_reset";
|
||||||
|
}
|
||||||
|
|
||||||
|
session.removeAttribute("passwordResetUserId");
|
||||||
|
|
||||||
|
LoginModel loginUser =
|
||||||
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
|
if (loginUser != null) {
|
||||||
|
return "redirect:/menu";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "redirect:/login";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,10 +5,14 @@ import jakarta.servlet.http.HttpSession;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
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.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.model.ProfileModel;
|
import com.example.demo.app.domain.model.ProfileModel;
|
||||||
import com.example.demo.app.domain.service.ProfileService;
|
import com.example.demo.app.domain.service.ProfileService;
|
||||||
|
import com.example.demo.app.presentation.form.ProfileEditForm;
|
||||||
import com.example.demo.app.presentation.form.ProfileForm;
|
import com.example.demo.app.presentation.form.ProfileForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -18,6 +22,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
public class ProfileController {
|
public class ProfileController {
|
||||||
private final ProfileService profileService;
|
private final ProfileService profileService;
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/profile")
|
@GetMapping("/profile")
|
||||||
public String profile(Model model, HttpSession session) {
|
public String profile(Model model, HttpSession session) {
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
@@ -29,4 +34,63 @@ public class ProfileController {
|
|||||||
model.addAttribute("profileForm", profileForm);
|
model.addAttribute("profileForm", profileForm);
|
||||||
return "profile";
|
return "profile";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
|
@GetMapping("/profile/edit")
|
||||||
|
public String showEditProfile(
|
||||||
|
Model model,
|
||||||
|
HttpSession session) {
|
||||||
|
|
||||||
|
LoginModel loginUser =
|
||||||
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
|
ProfileModel profileModel =
|
||||||
|
profileService.findOne(loginUser.getUserId());
|
||||||
|
|
||||||
|
ProfileEditForm profileEditForm =
|
||||||
|
new ProfileEditForm(
|
||||||
|
profileModel.getUserName(),
|
||||||
|
profileModel.getMailAddress(),
|
||||||
|
profileModel.getSaving(),
|
||||||
|
profileModel.getAnnualIncome(),
|
||||||
|
profileModel.getMonthlyBudget());
|
||||||
|
|
||||||
|
model.addAttribute("profileEditForm", profileEditForm);
|
||||||
|
return "profile_edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/profile/edit")
|
||||||
|
public String updateProfile(
|
||||||
|
@ModelAttribute ProfileEditForm profileEditForm,
|
||||||
|
HttpSession session) {
|
||||||
|
|
||||||
|
LoginModel loginUser =
|
||||||
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
|
profileService.update(
|
||||||
|
loginUser.getUserId(),
|
||||||
|
profileEditForm);
|
||||||
|
|
||||||
|
return "redirect:/profile";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/withdraw")
|
||||||
|
public String withdraw(HttpSession session) {
|
||||||
|
|
||||||
|
LoginModel loginUser =
|
||||||
|
(LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
|
profileService.withdraw(loginUser.getUserId());
|
||||||
|
|
||||||
|
session.invalidate();
|
||||||
|
|
||||||
|
return "redirect:/login";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/logout")
|
||||||
|
public String logout(HttpSession session) {
|
||||||
|
session.invalidate();
|
||||||
|
return "redirect:/login";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,18 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import com.example.demo.aop.aspect.SessionCheck;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.CategoryService;
|
import com.example.demo.app.domain.service.CategoryService;
|
||||||
|
import com.example.demo.app.domain.service.GoalService;
|
||||||
import com.example.demo.app.domain.service.TransactionService;
|
import com.example.demo.app.domain.service.TransactionService;
|
||||||
|
import com.example.demo.app.domain.service.UserService;
|
||||||
import com.example.demo.app.presentation.form.CategoryForm;
|
import com.example.demo.app.presentation.form.CategoryForm;
|
||||||
import com.example.demo.app.presentation.form.Expense;
|
import com.example.demo.app.presentation.form.Expense;
|
||||||
|
import com.example.demo.app.presentation.form.GoalForm;
|
||||||
import com.example.demo.app.presentation.form.Income;
|
import com.example.demo.app.presentation.form.Income;
|
||||||
import com.example.demo.app.presentation.form.TransactionForm;
|
import com.example.demo.app.presentation.form.TransactionForm;
|
||||||
|
import com.example.demo.app.presentation.form.UserForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
@@ -33,39 +38,87 @@ public class TransactionController {
|
|||||||
|
|
||||||
private final TransactionService transactionService;
|
private final TransactionService transactionService;
|
||||||
private final CategoryService categoryService;
|
private final CategoryService categoryService;
|
||||||
|
private final GoalService goalService;
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
// 一覧画面
|
// 一覧画面
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/transaction/list")
|
@GetMapping("/transaction/list")
|
||||||
public String transactionList(@RequestParam(required = false) LocalDate startDates,
|
public String transactionList(
|
||||||
@RequestParam(required = false) LocalDate endDates, Model model,
|
@RequestParam(required = false, defaultValue = "0") String years,
|
||||||
|
@RequestParam(required = false, defaultValue = "0") String months,
|
||||||
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LocalDate startDate = (startDates == null) ? LocalDate.now().withDayOfMonth(1) : startDates;
|
|
||||||
|
|
||||||
LocalDate endDate = (endDates == null) ? LocalDate.now().withDayOfMonth(LocalDate.now().lengthOfMonth())
|
|
||||||
: endDates;
|
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
|
int year = years.equals("0")
|
||||||
|
? today.getYear()
|
||||||
|
: Integer.parseInt(years);
|
||||||
|
|
||||||
|
int month = months.equals("0")
|
||||||
|
? today.getMonthValue()
|
||||||
|
: Integer.parseInt(months);
|
||||||
|
|
||||||
|
YearMonth yearMonth = YearMonth.of(year, month);
|
||||||
|
|
||||||
|
YearMonth previousYearMonth = yearMonth.minusMonths(1);
|
||||||
|
|
||||||
|
int previousYear = previousYearMonth.getYear();
|
||||||
|
int previousMonth = previousYearMonth.getMonthValue();
|
||||||
|
|
||||||
|
YearMonth nextYearMonth = yearMonth.plusMonths(1);
|
||||||
|
|
||||||
|
int nextYear = nextYearMonth.getYear();
|
||||||
|
int nextMonth = nextYearMonth.getMonthValue();
|
||||||
|
|
||||||
|
LocalDate startDate = yearMonth.atDay(1);
|
||||||
|
LocalDate endDate = yearMonth.atEndOfMonth();
|
||||||
|
|
||||||
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
|
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
|
||||||
|
|
||||||
transactionService.findAllByDate(startDate, endDate, loginUser.getUserId()).forEach((date, list) -> {
|
transactionService
|
||||||
List<TransactionForm> transactionFormList = list.stream().map(transaction -> {
|
.findAllByDate(
|
||||||
System.out.println(transaction.getTransactionDate());
|
startDate,
|
||||||
TransactionForm transactionForm = TransactionForm.convertFrom(
|
endDate,
|
||||||
transaction,
|
loginUser.getUserId())
|
||||||
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
|
.forEach((date, list) -> {
|
||||||
.getCategoryName(),
|
|
||||||
transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId()),
|
List<TransactionForm> transactionFormList = list.stream()
|
||||||
transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId()),
|
.map(transaction -> {
|
||||||
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
|
|
||||||
.getTransactionType());
|
CategoryForm categoryForm = CategoryForm.convertFrom(
|
||||||
System.out.println("startDate = " + startDate);
|
categoryService.findOne(
|
||||||
System.out.println("endDate = " + endDate);
|
transaction.getCategoryId()));
|
||||||
return transactionForm;
|
|
||||||
}).collect(Collectors.toList());
|
return TransactionForm.convertFrom(
|
||||||
transactionFormMap.put(date, transactionFormList);
|
transaction,
|
||||||
});
|
categoryForm.getCategoryName(),
|
||||||
|
transactionService.findTotalExpense(
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
loginUser.getUserId()),
|
||||||
|
transactionService.findTotalIncome(
|
||||||
|
startDate,
|
||||||
|
endDate,
|
||||||
|
loginUser.getUserId()),
|
||||||
|
categoryForm.getTransactionType());
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
transactionFormMap.put(date, transactionFormList);
|
||||||
|
});
|
||||||
|
|
||||||
|
model.addAttribute("year", year);
|
||||||
|
model.addAttribute("month", month);
|
||||||
|
|
||||||
|
model.addAttribute("previousYear", previousYear);
|
||||||
|
model.addAttribute("previousMonth", previousMonth);
|
||||||
|
|
||||||
|
model.addAttribute("nextYear", nextYear);
|
||||||
|
model.addAttribute("nextMonth", nextMonth);
|
||||||
|
|
||||||
model.addAttribute("transactionFormMap", transactionFormMap);
|
model.addAttribute("transactionFormMap", transactionFormMap);
|
||||||
|
|
||||||
@@ -73,6 +126,7 @@ public class TransactionController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 詳細画面
|
// 詳細画面
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/transaction/detail")
|
@GetMapping("/transaction/detail")
|
||||||
public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) {
|
public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) {
|
||||||
|
|
||||||
@@ -125,10 +179,11 @@ public class TransactionController {
|
|||||||
return "transaction_detail";
|
return "transaction_detail";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/transaction/create")
|
@GetMapping("/transaction/create")
|
||||||
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
|
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
|
||||||
Model model) {
|
Model model) {
|
||||||
|
|
||||||
if (today == null) {
|
if (today == null) {
|
||||||
today = LocalDate.now();
|
today = LocalDate.now();
|
||||||
}
|
}
|
||||||
@@ -149,6 +204,7 @@ public class TransactionController {
|
|||||||
return "transaction_create";
|
return "transaction_create";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/transaction/create")
|
@PostMapping("/transaction/create")
|
||||||
public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today,
|
public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today,
|
||||||
Model model,
|
Model model,
|
||||||
@@ -164,6 +220,7 @@ public class TransactionController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/transaction/update")
|
@GetMapping("/transaction/update")
|
||||||
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
|
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
|
||||||
Model model) {
|
Model model) {
|
||||||
@@ -183,28 +240,29 @@ public class TransactionController {
|
|||||||
|
|
||||||
System.out.println("category: " + transactionForm.getCategoryId() + "金額: " + transactionForm.getAmount());
|
System.out.println("category: " + transactionForm.getCategoryId() + "金額: " + transactionForm.getAmount());
|
||||||
|
|
||||||
|
|
||||||
model.addAttribute("transactionId", transactionId);
|
model.addAttribute("transactionId", transactionId);
|
||||||
|
|
||||||
model.addAttribute("transactionForm", transactionForm);
|
model.addAttribute("transactionForm", transactionForm);
|
||||||
|
|
||||||
model.addAttribute("categoryFormList", categoryFormList);
|
model.addAttribute("categoryFormList", categoryFormList);
|
||||||
|
|
||||||
model.addAttribute("today", today);
|
model.addAttribute("today", today);
|
||||||
|
|
||||||
return "transaction_update";
|
return "transaction_update";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/transaction/update")
|
@PostMapping("/transaction/update")
|
||||||
public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today, Model model,
|
public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm,
|
||||||
|
@RequestParam LocalDate today, Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
transactionForm.setUserId(loginUser.getUserId());
|
transactionForm.setUserId(loginUser.getUserId());
|
||||||
transactionForm.setTransactionId(transactionId);
|
transactionForm.setTransactionId(transactionId);
|
||||||
|
|
||||||
if (transactionService.updateTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
if (transactionService.updateTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
||||||
return "error";
|
return "error";
|
||||||
}
|
}
|
||||||
@@ -213,6 +271,7 @@ public class TransactionController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@PostMapping("/transaction/delete")
|
@PostMapping("/transaction/delete")
|
||||||
public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
|
public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
|
||||||
|
|
||||||
@@ -220,6 +279,7 @@ public class TransactionController {
|
|||||||
return "redirect:/transaction/detail?todayDates=" + today;
|
return "redirect:/transaction/detail?todayDates=" + today;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SessionCheck
|
||||||
@GetMapping("/menu")
|
@GetMapping("/menu")
|
||||||
public String menu(HttpSession session, Model model,
|
public String menu(HttpSession session, Model model,
|
||||||
@RequestParam(required = false, defaultValue = "0") String years,
|
@RequestParam(required = false, defaultValue = "0") String years,
|
||||||
@@ -230,9 +290,8 @@ public class TransactionController {
|
|||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
int year = (years.equals("0")) ? today.getYear() : Integer.parseInt(years);
|
int year = (years.equals("0")) ? today.getYear() : Integer.parseInt(years);
|
||||||
int month = (months.equals("0")) ? today.getMonthValue() : Integer.parseInt(months);
|
|
||||||
|
|
||||||
System.out.println("year : " + year + "month : " + month);
|
int month = (months.equals("0")) ? today.getMonthValue() : Integer.parseInt(months);
|
||||||
|
|
||||||
YearMonth yearMonth = YearMonth.of(year, month);
|
YearMonth yearMonth = YearMonth.of(year, month);
|
||||||
|
|
||||||
@@ -240,6 +299,16 @@ public class TransactionController {
|
|||||||
|
|
||||||
int firstDayOfWeek = yearMonth.atDay(1).getDayOfWeek().getValue() % 7;
|
int firstDayOfWeek = yearMonth.atDay(1).getDayOfWeek().getValue() % 7;
|
||||||
|
|
||||||
|
YearMonth previousYearMonth = yearMonth.minusMonths(1);
|
||||||
|
|
||||||
|
int previousYear = previousYearMonth.getYear();
|
||||||
|
int previousMonth = previousYearMonth.getMonthValue();
|
||||||
|
|
||||||
|
YearMonth nextYearMonth = yearMonth.plusMonths(1);
|
||||||
|
|
||||||
|
int nextYear = nextYearMonth.getYear();
|
||||||
|
int nextMonth = nextYearMonth.getMonthValue();
|
||||||
|
|
||||||
model.addAttribute("year", year);
|
model.addAttribute("year", year);
|
||||||
model.addAttribute("month", month);
|
model.addAttribute("month", month);
|
||||||
model.addAttribute("day", today.getDayOfMonth());
|
model.addAttribute("day", today.getDayOfMonth());
|
||||||
@@ -247,15 +316,20 @@ public class TransactionController {
|
|||||||
model.addAttribute("lastDay", lastDay);
|
model.addAttribute("lastDay", lastDay);
|
||||||
model.addAttribute("firstDayOfWeek", firstDayOfWeek);
|
model.addAttribute("firstDayOfWeek", firstDayOfWeek);
|
||||||
|
|
||||||
LocalDate startDate = LocalDate.now().withDayOfMonth(1);
|
model.addAttribute("previousYear", previousYear);
|
||||||
|
model.addAttribute("previousMonth", previousMonth);
|
||||||
|
|
||||||
LocalDate endDate = LocalDate.now().withDayOfMonth(LocalDate.now().lengthOfMonth());
|
model.addAttribute("nextYear", nextYear);
|
||||||
|
model.addAttribute("nextMonth", nextMonth);
|
||||||
|
|
||||||
|
LocalDate startDate = yearMonth.atDay(1);
|
||||||
|
LocalDate endDate = yearMonth.atEndOfMonth();
|
||||||
|
|
||||||
List<Income> incomeList = transactionService.findTotalIncomeList(startDate, endDate, loginUser.getUserId());
|
List<Income> incomeList = transactionService.findTotalIncomeList(startDate, endDate, loginUser.getUserId());
|
||||||
|
|
||||||
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
|
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
|
||||||
|
|
||||||
model.addAttribute("incomeList", incomeList);
|
model.addAttribute("incomeList", incomeList);
|
||||||
|
|
||||||
model.addAttribute("expenseList", expenseList);
|
model.addAttribute("expenseList", expenseList);
|
||||||
|
|
||||||
int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId());
|
int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId());
|
||||||
@@ -265,6 +339,20 @@ public class TransactionController {
|
|||||||
model.addAttribute("totalIncome", totalIncome);
|
model.addAttribute("totalIncome", totalIncome);
|
||||||
model.addAttribute("totalExpense", totalExpense);
|
model.addAttribute("totalExpense", totalExpense);
|
||||||
|
|
||||||
|
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalByUserId(loginUser.getUserId()));
|
||||||
|
|
||||||
|
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
||||||
|
|
||||||
|
model.addAttribute("achievementRate", goalForm.getAchievementRate());
|
||||||
|
|
||||||
|
model.addAttribute("currentAmount", goalForm.getCurrentAmount());
|
||||||
|
|
||||||
|
model.addAttribute("targetAmount", goalForm.getTargetAmount());
|
||||||
|
|
||||||
|
model.addAttribute("saving", userForm.getSaving());
|
||||||
|
|
||||||
|
model.addAttribute("deadline", goalForm.getDeadline());
|
||||||
|
|
||||||
return "menu";
|
return "menu";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.example.demo.app.presentation.controller;
|
package com.example.demo.app.presentation.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import jakarta.servlet.http.HttpSession;
|
import jakarta.servlet.http.HttpSession;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -10,6 +12,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import com.example.demo.app.domain.service.CourseService;
|
import com.example.demo.app.domain.service.CourseService;
|
||||||
|
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.form.UserForm;
|
import com.example.demo.app.presentation.form.UserForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -17,58 +22,72 @@ import lombok.RequiredArgsConstructor;
|
|||||||
@Controller
|
@Controller
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class UserController {
|
public class UserController {
|
||||||
|
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
private final CourseService courseService;
|
private final CourseService courseService;
|
||||||
|
|
||||||
|
private final QuestionService questionService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/user/register")
|
@GetMapping("/user/register")
|
||||||
public String showRegister(Model model, HttpSession session) {
|
public String showRegister(Model model, HttpSession session) {
|
||||||
UserForm userForm = new UserForm();
|
UserForm userForm = new UserForm();
|
||||||
|
|
||||||
|
List<QuestionEntity> questionList = questionService.findAll();
|
||||||
|
|
||||||
|
session.setAttribute("questionList", questionList);
|
||||||
|
|
||||||
model.addAttribute("userForm", userForm);
|
model.addAttribute("userForm", userForm);
|
||||||
return "user_register";
|
return "user_register";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/user/register/return")
|
@PostMapping("/user/register/return")
|
||||||
public String showRegisterReturn(@RequestParam(required = false) Long courseId, Model model, HttpSession session) {
|
public String showRegisterReturn(@RequestParam(required = false) Long courseId, Model model, HttpSession session) {
|
||||||
|
|
||||||
UserForm userForm = (UserForm) session.getAttribute("userForm");
|
UserForm userForm = (UserForm) session.getAttribute("userForm");
|
||||||
|
System.out.println(
|
||||||
if(userForm == null) {
|
"######################################################################3" + userForm.getBirthDate());
|
||||||
userForm = new UserForm();
|
|
||||||
|
if (userForm.getUserName().equals("")) {
|
||||||
|
userForm = new UserForm();
|
||||||
userForm.setCourseId(courseId);
|
userForm.setCourseId(courseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(courseId != null) {
|
if (courseId != null) {
|
||||||
model.addAttribute("selectedCourseName", courseService.findById(courseId).getCourseName());
|
model.addAttribute("selectedCourseName", courseService.findById(courseId).getCourseName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session.setAttribute("selectedCourseName", courseService.findById(courseId).getCourseName());
|
||||||
model.addAttribute("courseId", courseId);
|
model.addAttribute("courseId", courseId);
|
||||||
|
System.out.println(
|
||||||
|
"######################################################################3" + userForm.getBirthDate());
|
||||||
model.addAttribute("userForm", userForm);
|
model.addAttribute("userForm", userForm);
|
||||||
|
|
||||||
|
return "user_register_return";
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/user/register/confirm")
|
||||||
|
public String confirmRegisterGet(@ModelAttribute UserForm userForm,
|
||||||
|
String selectedCourseName, Model model,
|
||||||
|
HttpSession session) {
|
||||||
|
|
||||||
|
model.addAttribute("selectedCourseName", (String) session.getAttribute("selectedCourseName"));
|
||||||
|
return "user_register_confirm";
|
||||||
|
|
||||||
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")
|
@PostMapping("/user/register/complete")
|
||||||
public String completeRegister(HttpSession session) {
|
public String confirmRegister(
|
||||||
|
@ModelAttribute UserForm userForm,
|
||||||
|
Model model,
|
||||||
|
HttpSession session) {
|
||||||
|
|
||||||
UserForm userForm =
|
Long courseId = courseService.findByName((String) session.getAttribute("selectedCourseName"));
|
||||||
(UserForm) session.getAttribute("userForm");
|
|
||||||
|
userService.register(userForm, courseId);
|
||||||
// DBへの登録処理
|
|
||||||
|
return "redirect:/login";
|
||||||
session.removeAttribute("userForm");
|
|
||||||
|
|
||||||
return "redirect:/login";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ import lombok.NoArgsConstructor;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class AuthenticationForm {
|
public class AuthenticationForm {
|
||||||
private String mailAddress;
|
private String mailAddress;
|
||||||
private Integer secretQuestionId;
|
private Long secretQuestionId;
|
||||||
private String secretAnswer;
|
private String secretAnswer;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package com.example.demo.app.presentation.form;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.GoalModel;
|
import com.example.demo.app.domain.model.GoalModel;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -20,10 +22,15 @@ public class GoalForm {
|
|||||||
private String goalSubtitle;
|
private String goalSubtitle;
|
||||||
|
|
||||||
private Integer targetAmount;
|
private Integer targetAmount;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||||
private LocalDate deadline;
|
private LocalDate deadline;
|
||||||
|
|
||||||
private Integer goalComplete;
|
private Integer goalComplete;
|
||||||
|
|
||||||
|
private Integer achievementRate; // 達成率
|
||||||
|
|
||||||
|
private Integer currentAmount; // 現在の資産
|
||||||
|
|
||||||
public static GoalForm convertFrom(GoalModel goalModel) {
|
public static GoalForm convertFrom(GoalModel goalModel) {
|
||||||
return new GoalForm(
|
return new GoalForm(
|
||||||
@@ -32,7 +39,9 @@ public class GoalForm {
|
|||||||
goalModel.getGoalSubtitle(),
|
goalModel.getGoalSubtitle(),
|
||||||
goalModel.getTargetAmount(),
|
goalModel.getTargetAmount(),
|
||||||
goalModel.getDeadline(),
|
goalModel.getDeadline(),
|
||||||
goalModel.getGoalComplete());
|
goalModel.getGoalComplete(),
|
||||||
|
goalModel.getAchievementRate(),
|
||||||
|
goalModel.getCurrentAmount());
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static List<GoalForm> convertFrom(List<GoalModel> goalModelList) {
|
// public static List<GoalForm> convertFrom(List<GoalModel> goalModelList) {
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.example.demo.app.presentation.form;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ProfileEditForm {
|
||||||
|
private String userName;
|
||||||
|
private String mailAddress;
|
||||||
|
private Integer saving;
|
||||||
|
private Integer annualIncome;
|
||||||
|
private Integer monthlyBudget;
|
||||||
|
}
|
||||||
@@ -2,6 +2,8 @@ package com.example.demo.app.presentation.form;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
import com.example.demo.app.domain.model.UserModel;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -12,13 +14,30 @@ import lombok.NoArgsConstructor;
|
|||||||
public class UserForm {
|
public class UserForm {
|
||||||
private String userName;
|
private String userName;
|
||||||
private String mailAddress;
|
private String mailAddress;
|
||||||
|
private LocalDate birthDate;
|
||||||
private String password;
|
private String password;
|
||||||
private Long secretQuestionId;
|
private Long secretQuestionId;
|
||||||
private String SecretAnswer;
|
private String secretAnswer;
|
||||||
private LocalDate birthDate;
|
|
||||||
private Integer saving;
|
private Integer saving;
|
||||||
private Integer annualIncome;
|
private Integer annualIncome;
|
||||||
private Integer monthlyBudget;
|
private Integer monthlyBudget;
|
||||||
private Long goalId;
|
private Long goalId;
|
||||||
private Long courseId;
|
private Long courseId;
|
||||||
|
|
||||||
|
|
||||||
|
public static UserForm convertFrom(UserModel userModel) {
|
||||||
|
return new UserForm(
|
||||||
|
userModel.getUserName(),
|
||||||
|
userModel.getMailAddress(),
|
||||||
|
userModel.getBrithDate(),
|
||||||
|
userModel.getPassword(),
|
||||||
|
userModel.getSecretQuestionId(),
|
||||||
|
userModel.getSecretAnswer(),
|
||||||
|
userModel.getSaving(),
|
||||||
|
userModel.getAnnualIncome(),
|
||||||
|
userModel.getMonthlyBudget(),
|
||||||
|
userModel.getGoalId(),
|
||||||
|
userModel.getCourseId()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.example.demo.exception;
|
|
||||||
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
|
||||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
|
||||||
|
|
||||||
@ControllerAdvice
|
|
||||||
public class GlobalExceptionHandler {
|
|
||||||
|
|
||||||
@ExceptionHandler(Exception.class)
|
|
||||||
public String handleException(
|
|
||||||
Exception e,
|
|
||||||
Model model) {
|
|
||||||
|
|
||||||
model.addAttribute(
|
|
||||||
"errorMessage",
|
|
||||||
"システムエラーが発生しました。"
|
|
||||||
+ "初めからやり直してください。");
|
|
||||||
|
|
||||||
return "error";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.example.demo.exception;
|
||||||
|
|
||||||
|
public class InsufficientPermissionException extends RuntimeException {
|
||||||
|
|
||||||
|
public InsufficientPermissionException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.example.demo.exception;
|
||||||
|
|
||||||
|
public class NoSessionException extends RuntimeException {
|
||||||
|
|
||||||
|
public NoSessionException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ th {
|
|||||||
}
|
}
|
||||||
|
|
||||||
td {
|
td {
|
||||||
width: 14.28%;
|
width: 14%;
|
||||||
height: 70px;
|
height: 70px;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@@ -42,6 +42,22 @@ td:hover {
|
|||||||
background-color: bisque;
|
background-color: bisque;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.calendar-title {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
gap: 30px;
|
||||||
|
|
||||||
|
margin: 15px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.calendar-date {
|
||||||
|
display: flex;
|
||||||
|
align-items: baseline;
|
||||||
|
gap: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.year {
|
.year {
|
||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
}
|
}
|
||||||
@@ -51,8 +67,23 @@ td:hover {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-title {
|
.month-button {
|
||||||
margin: 15px 10px;
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
|
||||||
|
font-size: 28px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #333;
|
||||||
|
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.month-button:hover {
|
||||||
|
background-color: #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
.date {
|
.date {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
<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 class="pb-5 pt-5">
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}">
|
<div th:replace="~{header :: header}">
|
||||||
@@ -13,6 +14,23 @@
|
|||||||
<div class="container mt-4">
|
<div class="container mt-4">
|
||||||
<h2 class="text-center">支出分析</h2>
|
<h2 class="text-center">支出分析</h2>
|
||||||
|
|
||||||
|
<div class="text-center">
|
||||||
|
|
||||||
|
<a class="month-button" th:href="@{/analysis(year=${previousYear}, month=${previousMonth})}">
|
||||||
|
←
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<div class="calendar-date">
|
||||||
|
<span class="year" th:text="|${year}年|"></span>
|
||||||
|
<span class="month" th:text="|${month}月|"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a class="month-button" th:href="@{/analysis(year=${nextYear}, month=${nextMonth})}">
|
||||||
|
→
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<table class="table text-center">
|
<table class="table text-center">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -4,9 +4,15 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>認証</title>
|
<title>認証</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
|
<div th:replace="~{header :: header}">
|
||||||
|
</div>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h1>本人認証確認</h1>
|
<h1>本人認証確認</h1>
|
||||||
|
|
||||||
@@ -48,6 +54,9 @@
|
|||||||
alert(/*[[${errorMessage}]]*/);
|
alert(/*[[${errorMessage}]]*/);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<div th:replace="~{footer :: footer}">
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -5,7 +5,10 @@
|
|||||||
<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 class="pb-5 pt-5">
|
||||||
|
|
||||||
|
<div th:replace="~{header :: header}">
|
||||||
|
</div>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -3,8 +3,13 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>目標編集</title>
|
<title>目標編集</title>
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
<h1>目標編集</h1>
|
<h1>目標編集</h1>
|
||||||
|
|
||||||
@@ -13,26 +18,29 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標名</label>
|
<label>目標名</label>
|
||||||
<input type="text" th:field="*{goalTitle}">
|
<input type="text" th:field="*{goalTitle}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標説明</label>
|
<label>目標説明</label>
|
||||||
<textarea th:field="*{goalSubtitle}"></textarea>
|
<textarea th:field="*{goalSubtitle}" required></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標金額</label>
|
<label>目標金額</label>
|
||||||
<input type="number" th:field="*{targetAmount}">
|
<input type="number" th:field="*{targetAmount}" required min="1">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標達成期限</label>
|
<label>目標達成期限</label>
|
||||||
<input type="date" th:field="*{deadline}">
|
<input type="date" th:field="*{deadline}" th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit">更新する</button>
|
<button type="submit">更新する</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -3,13 +3,17 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>目標詳細</title>
|
<title>目標詳細</title>
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="pb-5 pt-5">
|
||||||
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
|
|
||||||
<h1>目標詳細</h1>
|
<h1>目標詳細</h1>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標名</th>
|
<th>目標名</th>
|
||||||
<td th:text="${goalForm.goalTitle}"></td>
|
<td th:text="${goalForm.goalTitle}"></td>
|
||||||
@@ -27,9 +31,18 @@
|
|||||||
<th>目標達成期限</th>
|
<th>目標達成期限</th>
|
||||||
<td th:text="${goalForm.deadline}"></td>
|
<td th:text="${goalForm.deadline}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th>達成率</th>
|
||||||
|
<td th:text="${goalForm.achievementRate} + '%'"></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<a th:href="@{/goal/edit}">編集する</a>
|
<a th:href="@{/goal/edit}">編集する</a>
|
||||||
|
|
||||||
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -3,9 +3,12 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>ログイン</title>
|
<title>ログイン</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="pb-5 pt-5">
|
||||||
<header></header>
|
<div th:replace="~{header :: header}">
|
||||||
|
</div>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h1>ログイン</h1>
|
<h1>ログイン</h1>
|
||||||
|
|||||||
@@ -14,22 +14,30 @@
|
|||||||
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
|
|
||||||
<div class="calendar-title">
|
<div class="calendar-title">
|
||||||
|
|
||||||
<span class="year" th:text="|${year}年|">
|
<a class="month-button" th:href="@{/menu(years=${previousYear}, months=${previousMonth})}">
|
||||||
</span>
|
←
|
||||||
|
</a>
|
||||||
|
|
||||||
<span class="month" th:text="|${month}月|">
|
<div class="calendar-date">
|
||||||
</span>
|
<span class="year" th:text="|${year}年|"></span>
|
||||||
|
<span class="month" th:text="|${month}月|"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a class="month-button" th:href="@{/menu(years=${nextYear}, months=${nextMonth})}">
|
||||||
|
→
|
||||||
|
</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<table id="calendar">
|
<table id="calendar">
|
||||||
|
|
||||||
<thead>
|
<thead>
|
||||||
@@ -54,21 +62,25 @@
|
|||||||
<td th:each="weekDay : ${#numbers.sequence(0, 6)}">
|
<td th:each="weekDay : ${#numbers.sequence(0, 6)}">
|
||||||
|
|
||||||
<a th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1
|
<a th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1
|
||||||
and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}"
|
and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}" th:href="@{/transaction/detail(
|
||||||
th:href="@{/transaction/detail(
|
|
||||||
todayDates=${T(java.time.LocalDate).of(year, month, week * 7 + weekDay - firstDayOfWeek + 1)}
|
todayDates=${T(java.time.LocalDate).of(year, month, week * 7 + weekDay - firstDayOfWeek + 1)}
|
||||||
)}">
|
)}">
|
||||||
|
|
||||||
|
|
||||||
<div th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1 and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}">
|
<div
|
||||||
|
th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1 and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}">
|
||||||
|
|
||||||
<div class="date" th:text="${week * 7 + weekDay - firstDayOfWeek + 1}">
|
<div class="date" th:text="${week * 7 + weekDay - firstDayOfWeek + 1}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:each="income : ${incomeList}" th:if="${income.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}" class="income" th:text="|収入 +${income.amount}円|">
|
<div th:each="income : ${incomeList}"
|
||||||
|
th:if="${income.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
||||||
|
class="income" th:text="|収入 +${income.amount}円|">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div th:each="expense : ${expenseList}" th:if="${expense.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}" class="expense" th:text="|支出 -${expense.amount}円|">
|
<div th:each="expense : ${expenseList}"
|
||||||
|
th:if="${expense.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
||||||
|
class="expense" th:text="|支出 -${expense.amount}円|">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -101,6 +113,37 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span>目標貯金</span>
|
||||||
|
<span th:text="${targetAmount}"></span>
|
||||||
|
<span>円</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span>現在高</span>
|
||||||
|
<span th:text="${currentAmount}"></span>
|
||||||
|
<span>円</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span>貯金額</span>
|
||||||
|
<span th:text="${saving}"></span>
|
||||||
|
<span>円</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<span>達成率</span>
|
||||||
|
<span th:text="${achievementRate}"></span>
|
||||||
|
<span>%</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span>達成期限</span>
|
||||||
|
<span th:text="${deadline}"></span>
|
||||||
|
<span>円</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -3,14 +3,18 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>パスワード再設定</title>
|
<title>パスワード再設定</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header></header>
|
<!--<body class="pb-5 pt-5">-->
|
||||||
|
<!-- <div th:replace="~{header :: header}">-->
|
||||||
|
<!-- </div>-->
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h1>パスワード再設定</h1>
|
<h1>パスワード再設定</h1>
|
||||||
|
|
||||||
<form th:action="@{/password_reset}" th:object="${passwordResetForm}" method="post">
|
<form th:action="@{/password/reset}" th:object="${passwordResetForm}" method="post">
|
||||||
<div>
|
<div>
|
||||||
<label for="password">新しいパスワード</label>
|
<label for="password">新しいパスワード</label>
|
||||||
<input type="password"
|
<input type="password"
|
||||||
@@ -34,8 +38,8 @@
|
|||||||
<button type="submit">再設定</button>
|
<button type="submit">再設定</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div th:if="${errorMessage}">
|
<div th:if="${Message}">
|
||||||
<p th:text="${errorMessage}"></p>
|
<p th:text="${Message}"></p>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>プロフィール</title>
|
<title>プロフィール</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="pb-5 pt-5">
|
||||||
<header></header>
|
|
||||||
|
<div th:replace="~{header :: header}">
|
||||||
|
</div>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div>
|
<div>
|
||||||
@@ -51,13 +55,18 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form th:action="@{/login}" method="post">
|
<form th:action="@{/logout}" method="post">
|
||||||
<button type="submit">ログアウト</button>
|
<button type="submit">ログアウト</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form th:action="@{/aaa}" method="post">
|
<form th:action="@{/withdraw}" method="post"
|
||||||
<button type="submit">脱退</button>
|
onsubmit="return confirm('本当に脱退しますか?');">
|
||||||
|
<button type="submit">脱退</button>
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
<div th:replace="~{footer :: footer}">
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
74
src/main/resources/templates/profile_edit.html
Normal file
74
src/main/resources/templates/profile_edit.html
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>プロフィール編集</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="pb-5 pt-5">
|
||||||
|
|
||||||
|
<div th:replace="~{header :: header}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<h1>プロフィール編集</h1>
|
||||||
|
|
||||||
|
<form th:action="@{/profile/edit}"th:object="${profileEditForm}"method="post">
|
||||||
|
<div>
|
||||||
|
<label>氏名</label>
|
||||||
|
<input type="text"
|
||||||
|
th:field="*{userName}"
|
||||||
|
maxlength="100"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>メールアドレス</label>
|
||||||
|
<input type="email"
|
||||||
|
th:field="*{mailAddress}"
|
||||||
|
maxlength="255"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>パスワード</label>
|
||||||
|
<input type="password"
|
||||||
|
value="********"
|
||||||
|
disabled>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>貯蓄金</label>
|
||||||
|
<input type="number"
|
||||||
|
th:field="*{saving}"
|
||||||
|
min="0"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>年収</label>
|
||||||
|
<input type="number"
|
||||||
|
th:field="*{annualIncome}"
|
||||||
|
min="0"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>月別使用可能額</label>
|
||||||
|
<input type="number"
|
||||||
|
th:field="*{monthlyBudget}"
|
||||||
|
min="0"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button type="submit">確認</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<div th:replace="~{footer :: footer}">
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -7,16 +7,18 @@
|
|||||||
<title>コース選択</title>
|
<title>コース選択</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
<h1>コース選択</h1>
|
<h1>コース選択</h1>
|
||||||
|
|
||||||
|
|
||||||
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
|
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
|
||||||
<button type="submit">確定</button>
|
<button type="submit">確定</button>
|
||||||
|
|
||||||
<div class="accordion" id="accordionExample">
|
<div class="accordion" id="accordionExample">
|
||||||
<div class="accordion-item" th:each="course:${courseList}">
|
<div class="accordion-item" th:each="course:${courseList}">
|
||||||
<h2 class="accordion-header d-flex align-items-center">
|
<h2 class="accordion-header d-flex align-items-center">
|
||||||
<input type="radio" name="courseId" th:value="${course.courseId}" class="form-check-input ms-3 me-2">
|
<input type="radio" name="courseId" th:value="${course.courseId}" th:checked="${course.courseId==currentCourseId}" class="form-check-input ms-3 me-2">
|
||||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" th:data-bs-target="'#collapse' + ${course.courseId}" aria-expanded="false" aria-controls="'collapse' + ${course.courseId}">
|
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" th:data-bs-target="'#collapse' + ${course.courseId}" aria-expanded="false" aria-controls="'collapse' + ${course.courseId}">
|
||||||
<span th:text="${course.courseName}"></span>
|
<span th:text="${course.courseName}"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<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 class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<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 class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
<h1 th:text="${today}"></h1>
|
<h1 th:text="${today}"></h1>
|
||||||
|
|||||||
@@ -9,10 +9,37 @@
|
|||||||
<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 class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
|
<div class="calendar-title">
|
||||||
|
|
||||||
|
<a class="month-button" th:href="@{/transaction/list(
|
||||||
|
years=${previousYear},
|
||||||
|
months=${previousMonth}
|
||||||
|
)}">
|
||||||
|
←
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="calendar-date">
|
||||||
|
<span class="year" th:text="|${year}年|"></span>
|
||||||
|
<span class="month" th:text="|${month}月|"></span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<a class="month-button" th:href="@{/transaction/list(
|
||||||
|
years=${nextYear},
|
||||||
|
months=${nextMonth}
|
||||||
|
)}">
|
||||||
|
→
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div th:each="transactionForm : ${transactionFormMap}">
|
<div th:each="transactionForm : ${transactionFormMap}">
|
||||||
|
|
||||||
<a th:href="@{/transaction/detail(todayDates=${transactionForm.key})}">
|
<a th:href="@{/transaction/detail(todayDates=${transactionForm.key})}">
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<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 class="pb-5 pt-5">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
|
|||||||
@@ -3,14 +3,17 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>新規会員登録</title>
|
<title>新規会員登録</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body class="pb-5 pt-5">
|
||||||
<header></header>
|
<div th:replace="~{header :: header}">
|
||||||
|
</div>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h1>新規会員登録</h1>
|
<h1>新規会員登録</h1>
|
||||||
|
|
||||||
<form th:action="@{/user/register/confirm}" th:object="${userForm}" method="post">
|
<form th:action="@{/user/register/course}" th:object="${userForm}" method="post">
|
||||||
<div>
|
<div>
|
||||||
<label for="userName">氏名</label>
|
<label for="userName">氏名</label>
|
||||||
<input type="text"
|
<input type="text"
|
||||||
@@ -53,7 +56,7 @@
|
|||||||
th:field="*{secretQuestionId}"
|
th:field="*{secretQuestionId}"
|
||||||
required>
|
required>
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option th:each="question : ${questionList}"
|
<option th:each="question : ${session.questionList}"
|
||||||
th:value="${question.secretQuestionId}"
|
th:value="${question.secretQuestionId}"
|
||||||
th:text="${question.questionText}">
|
th:text="${question.questionText}">
|
||||||
</option>
|
</option>
|
||||||
@@ -108,8 +111,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<label>コース</label>
|
<label>コース</label>
|
||||||
<input type="hidden" th:field="*{courseId}">
|
<input type="hidden" th:field="*{courseId}">
|
||||||
<span th:text="${selectedCourseName}">未選択</span>
|
<button type="submit">コース選択</button>
|
||||||
<button type="submit"onclick="location.href='/course/select/register'">コース選択</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
@@ -1,78 +1,97 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>新規会員登録確認</title>
|
<title>新規会員登録確認</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
|
||||||
<header></header>
|
<body class="pb-5 pt-5">
|
||||||
|
<div th:replace="~{header :: header}">
|
||||||
|
</div>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
<h1>新規会員登録確認</h1>
|
<h1>新規会員登録確認</h1>
|
||||||
|
|
||||||
<div>
|
<form th:action="@{/user/register/complete}" th:object="${userForm}" method="post">
|
||||||
<p>氏名</p>
|
<div>
|
||||||
<p th:text="${user.userName}"></p>
|
<label for="userName">氏名</label>
|
||||||
</div>
|
<input type="text" id="userName" th:field="*{userName}" maxlength="100" readonly>
|
||||||
|
</div>
|
||||||
<div>
|
|
||||||
<p>メールアドレス</p>
|
<div>
|
||||||
<p th:text="${user.mailAddress}"></p>
|
<label for="mailAddress">メールアドレス</label>
|
||||||
</div>
|
<input type="email" id="mailAddress" th:field="*{mailAddress}" maxlength="255" readonly>
|
||||||
|
</div>
|
||||||
<div>
|
|
||||||
<p>生年月日</p>
|
<div>
|
||||||
<p th:text="${user.birthDate}"></p>
|
<label for="birthDate">生年月日</label>
|
||||||
</div>
|
<input type="date" id="birthDate" name="birthDate" th:value="*{birthDate}" required readonly>
|
||||||
|
</div>
|
||||||
<div>
|
|
||||||
<p>パスワード</p>
|
<div>
|
||||||
<p>********</p>
|
<label for="password">パスワード</label>
|
||||||
</div>
|
<input type="password" id="password" name="password" th:value="*{password}" minlength="8"
|
||||||
|
maxlength="255" required readonly>
|
||||||
<div>
|
</div>
|
||||||
<p>秘密の質問</p>
|
|
||||||
<p th:text="${user.secretQuestionId}"></p>
|
<div>
|
||||||
</div>
|
<label for="secretQuestionId">秘密の質問</label>
|
||||||
|
<select id="secretQuestionId" th:field="*{secretQuestionId}" required readonly>
|
||||||
<div>
|
<option value="">選択してください</option>
|
||||||
<p>秘密の質問の回答</p>
|
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
|
||||||
<p th:text="${user.secretAnswer}"></p>
|
th:text="${question.questionText}">
|
||||||
</div>
|
</option>
|
||||||
|
</select>
|
||||||
<div>
|
</div>
|
||||||
<p>貯蓄金</p>
|
|
||||||
<p th:text="${user.saving}"></p>
|
<div>
|
||||||
</div>
|
<label for="secretAnswer">秘密の質問の回答</label>
|
||||||
|
<input type="text" id="secretAnswer" th:field="*{secretAnswer}" maxlength="100" readonly>
|
||||||
<div>
|
</div>
|
||||||
<p>年収</p>
|
|
||||||
<p th:text="${user.annualIncome}"></p>
|
<div>
|
||||||
</div>
|
<label for="saving">貯蓄金</label>
|
||||||
|
<input type="number" id="saving" th:field="*{saving}" min="0" readonly>
|
||||||
<div>
|
</div>
|
||||||
<p>月別使用可能額</p>
|
|
||||||
<p th:text="${user.monthlyBudget}"></p>
|
<div>
|
||||||
</div>
|
<label for="annualIncome">年収</label>
|
||||||
|
<input type="number" id="annualIncome" th:field="*{annualIncome}" min="0" readonly>
|
||||||
<div>
|
</div>
|
||||||
<p>目標</p>
|
|
||||||
<p th:text="${user.goalId}"></p>
|
<div>
|
||||||
</div>
|
<label for="monthlyBudget">月別使用可能金額</label>
|
||||||
|
<input type="number" id="monthlyBudget" th:field="*{monthlyBudget}" min="0" readonly>
|
||||||
<div>
|
</div>
|
||||||
<p>コース</p>
|
|
||||||
<p th:text="${user.courseId}"></p>
|
<div>
|
||||||
</div>
|
<label for="goalId">目標</label>
|
||||||
|
<input type="number" id="goalId" th:field="*{goalId}" min="0" readonly>
|
||||||
<div>
|
</div>
|
||||||
<form th:action="@{/user/register}" method="get">
|
|
||||||
<button type="submit">戻る</button>
|
<div>
|
||||||
</form>
|
<label>コース</label>
|
||||||
</div>
|
<input type="hidden" th:field="*{courseId}">
|
||||||
<form th:action="@{/user/register/complete}" method="post">
|
<span th:text="${selectedCourseName}">未選択</span>
|
||||||
<button type="submit">確定</button>
|
<button type="submit">コース選択</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button type="submit">作成</button>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<form th:action="@{/user/register}" method="get">
|
||||||
|
<button type="submit">戻る</button>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
128
src/main/resources/templates/user_register_return.html
Normal file
128
src/main/resources/templates/user_register_return.html
Normal file
@@ -0,0 +1,128 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="ja"xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>新規会員登録</title>
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body class="pb-5 pt-5">
|
||||||
|
<div th:replace="~{header :: header}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<h1>新規会員登録</h1>
|
||||||
|
|
||||||
|
<form th:action="@{/user/register/confirm}" th:object="${userForm}" method="get">
|
||||||
|
<div>
|
||||||
|
<label for="userName">氏名</label>
|
||||||
|
<input type="text"
|
||||||
|
id="userName"
|
||||||
|
th:field="*{userName}"
|
||||||
|
maxlength="100"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="mailAddress">メールアドレス</label>
|
||||||
|
<input type="email"
|
||||||
|
id="mailAddress"
|
||||||
|
th:field="*{mailAddress}"
|
||||||
|
maxlength="255"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="birthDate">生年月日</label>
|
||||||
|
<input type="date" id="birthDate" name="birthDate" th:value="*{birthDate}"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="password">パスワード</label>
|
||||||
|
<input type="password"
|
||||||
|
id="password"
|
||||||
|
name="password"
|
||||||
|
th:value="*{password}"
|
||||||
|
minlength="8"
|
||||||
|
maxlength="255"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="secretQuestionId">秘密の質問</label>
|
||||||
|
<select id="secretQuestionId"
|
||||||
|
th:field="*{secretQuestionId}"
|
||||||
|
required>
|
||||||
|
<option value="">選択してください</option>
|
||||||
|
<option th:each="question : ${session.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}"
|
||||||
|
maxlength="100"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="saving">貯蓄金</label>
|
||||||
|
<input type="number"
|
||||||
|
id="saving"
|
||||||
|
th:field="*{saving}"
|
||||||
|
min="0"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="annualIncome">年収</label>
|
||||||
|
<input type="number"
|
||||||
|
id="annualIncome"
|
||||||
|
th:field="*{annualIncome}"
|
||||||
|
min="0"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="monthlyBudget">月別使用可能金額</label>
|
||||||
|
<input type="number"
|
||||||
|
id="monthlyBudget"
|
||||||
|
th:field="*{monthlyBudget}"
|
||||||
|
min="0"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label for="goalId">目標</label>
|
||||||
|
<input type="number"
|
||||||
|
id="goalId"
|
||||||
|
th:field="*{goalId}"
|
||||||
|
min="0"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<label>コース</label>
|
||||||
|
<input type="hidden" th:field="*{courseId}">
|
||||||
|
<span th:text="${selectedCourseName}">未選択</span>
|
||||||
|
<button type="submit">コース選択</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<button type="submit">作成</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form th:action="@{/login}" method="get">
|
||||||
|
<button type="submit">戻る</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</main>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user