74 Commits

Author SHA1 Message Date
kkazuya
640240db92 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-29 15:25:22 +09:00
s-choi
bbee55f58f [FIX] 未達成の履歴がメニューに表示される問題を修正しました。 2026-09-29 15:24:56 +09:00
kkazuya
f319fcb9f8 [EDIT] 固定費登録の収支区分とカテゴリーを入力必須にしました 2026-09-29 15:22:15 +09:00
78d3042299 [EDIT]マージ跡を消しました 2026-09-29 15:13:56 +09:00
ead133ba65 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito
# Conflicts:
#	src/main/resources/templates/select_course.html
2026-09-29 15:13:04 +09:00
00c3041d95 [FIX]収支の選択に合わせてカテゴリが出るようにしました。 2026-09-29 15:11:35 +09:00
s-choi
65b4a9e54a [EDIT] コース削除機能を追加しました。 2026-09-29 15:09:08 +09:00
s-choi
515c789399 [EDIT] コースの情報を配分入力画面でも渡されるようにしました。 2026-09-29 15:08:49 +09:00
s-choi
7299ee0d06 [EDIT] 余計な機能を削除しました。 2026-09-29 15:08:16 +09:00
s-choi
fa0bfa7c90 [FIX] 配分まで入力してもらったあと、保存されるように修正しました。コース削除機能を追加しました。 2026-09-29 15:07:58 +09:00
s-choi
a911eaabc5 [EDIT] courseIdによる削除クエリを追加しました。 2026-09-29 15:07:10 +09:00
d27d8afbb3 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 14:48:01 +09:00
kkazuya
d291306599 [FIX] 取引更新画面のカテゴリ表示不備を修正しました。 2026-09-29 14:47:37 +09:00
04b15c4397 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 14:38:33 +09:00
kkazuya
5c87473e55 [FIX] 固定費一覧画面の新規登録ボタンの遷移先を修正しました。 2026-09-29 14:35:31 +09:00
e6b1e676a6 [FIX]達成期限が過ぎた場合、未達成として履歴に表示するように設計 2026-09-29 14:18:59 +09:00
b666b32214 [FIX]URLの河川を削除しました。 2026-09-29 13:38:52 +09:00
fd469405bc Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 13:18:23 +09:00
a995a41656 [FIX]デザインの修正 2026-09-29 13:17:44 +09:00
kkazuya
fd1b098e3c [FIX] 取引登録の収支区分の初期値を修正しました。 2026-09-29 13:15:40 +09:00
kkazuya
0b9eff82c5 [EDIT] 二次実装に伴う定数の追加と、AOPのクラスも定数クラスを参照するよう編集しました。 2026-09-29 13:06:31 +09:00
s-choi
52cf2b0a84 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-29 12:53:49 +09:00
150b6287c4 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 12:53:21 +09:00
kkazuya
000c1fa464 Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-29 12:45:53 +09:00
kkazuya
81b426b579 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-29 12:45:37 +09:00
kkazuya
104fa5e319 [EDIT] SessionKeyWordを追加しました。コントローラ側でそれを参照するよう修正しました。 2026-09-29 12:44:56 +09:00
kkazuya
fb031e5255 [EDIT] 目標名と目標説明入力欄のrequiredを外しました。 2026-09-29 12:42:23 +09:00
kkazuya
cb5d228db4 [EDIT] 収支区分の値について、支出が0、収入が1になっていなかった箇所を修正しました。 2026-09-29 12:40:17 +09:00
438ff59bc2 [FIX]画面デザインの不具合を調整しました。 2026-09-29 11:32:22 +09:00
s-choi
f5c410b352 [FIX] 脱退したらログインできないように修正しました。 2026-09-29 11:31:25 +09:00
kkazuya
18c51d3a65 [FIX] カテゴリー登録の際、カテゴリー名と収支区分の入力を必須にしました。 2026-09-29 11:22:41 +09:00
kkazuya
0162f2f679 [EDIT] コース作成で、配分の合計が100%でないと登録できないように修正しました。 2026-09-29 11:19:37 +09:00
94b526a045 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 11:15:50 +09:00
s-choi
31d80388af [HOTFIX] 開発者ツールエラーのため、ファイルを追加しました。 2026-09-29 11:15:31 +09:00
4a9a1d0898 [FIX]コース選択画面のデザイン修正 2026-09-29 11:13:13 +09:00
759df536a5 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 11:00:07 +09:00
s-choi
bce2d01e48 [HOTFIX] エラー処理を行いました。 2026-09-29 10:59:49 +09:00
s-choi
6ee8a3aa59 [EDIT] エラー処理にセッション破棄を改めて追加しました。 2026-09-29 10:57:28 +09:00
98ebb86673 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 10:55:37 +09:00
s-choi
84e55d7606 [HOTFIX] エラー処理を行いました。 2026-09-29 10:54:33 +09:00
3a825196e1 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 10:22:16 +09:00
s-choi
aad285f9ba [HOTFIX] AOPの例外処理を修正しました。 2026-09-29 10:21:59 +09:00
s-choi
f1e48b02f9 [STYLE] padding-top を調整しました。 2026-09-29 10:03:24 +09:00
718b90cee6 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-29 10:02:56 +09:00
s-choi
60e0694731 [FIX] 会員登録の段階で目標が登録されるように修正しました。 2026-09-29 09:44:42 +09:00
s-choi
b09fd95c31 [FIX] Default値設定及び必要ないカラムを削除しました。 2026-09-29 09:44:18 +09:00
s-choi
65282cdcb2 [FIX] カラムの文字数を制限しました。 2026-09-29 09:43:45 +09:00
74b7032ffc [FIX]デザインを修正しました 2026-09-28 17:06:13 +09:00
s-choi
0687a1837e [STYLE] 重複コードを削除しました。 2026-09-28 16:40:38 +09:00
s-choi
2a4150c883 [STYLE] 重複コードを削除しました。 2026-09-28 16:37:04 +09:00
s-choi
add6a85c64 Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-28 16:35:05 +09:00
s-choi
fd74dee965 [FIX] 固定費で登録する際、収支区分が自動で入るように修正しました。 2026-09-28 16:32:02 +09:00
s-choi
7aa8e31bfd [EDIT] プロフィール編集画面の項目を修正しました。(パスワード→生年月日)、ボタンのテキストを変更しました。(確認→確定) 2026-09-28 16:04:31 +09:00
s-choi
e3af89a694 [STYLE] コース一覧の下部の間隔を調整しました。 2026-09-28 16:03:19 +09:00
s-choi
efdaacbb27 [FIX] エラー画面でセッション廃棄されない問題を修正しました。 2026-09-28 15:51:16 +09:00
154e6787d4 [FIX]取引新規登録ボタンを一つにし、デザインを統一しました 2026-09-28 15:37:41 +09:00
75f2f7c8d0 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-28 15:35:54 +09:00
ac101172d2 [EDIT]生年月日の情報取得用コードの追記 2026-09-28 15:35:30 +09:00
s-choi
d7a0aac355 [FIX] 下部の文字が隠れる問題を修正しました。 2026-09-28 15:26:36 +09:00
s-choi
a45045d008 [EDIT] 他人が作成したコースは見えないように修正しました。 2026-09-28 15:23:27 +09:00
s-choi
17074c3132 [ADD] コースの作成者を管理するためのテーブルを追加しました。 2026-09-28 15:22:44 +09:00
s-choi
34172aecc9 [FIX] 目標金額が現在所持金より低かった場合、エラーを表示するように修正しました。 2026-09-28 11:45:23 +09:00
s-choi
e5af64b53b [FIX] 目標登録の画面でボタンのテキストを修正しました。 2026-09-28 11:15:22 +09:00
s-choi
b76be8f38a [FIX] 収支登録の際、収支項目を分けました。金額の最少額は1円に設定しました。 2026-09-28 11:11:28 +09:00
s-choi
47185d8f26 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-28 10:54:05 +09:00
kkazuya
0f800da9a3 [FIX] 誤字を修正しました。 2026-09-28 10:53:41 +09:00
s-choi
546206317d [FIX] エラーメッセージが表示されるように修正しました。 2026-09-28 10:53:07 +09:00
kkazuya
d764da2ebf Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-28 10:52:52 +09:00
kkazuya
b83f360781 [EDIT] 二次機能の定数部分を、定数クラスを参照するよう修正しました。 2026-09-28 10:52:42 +09:00
kkazuya
42c4d7c273 [EDIT] 二次機能まで含めた定数クラスを作成しました。 2026-09-28 10:51:34 +09:00
kkazuya
cfbf56cf4e [EDIT] HTMLファイル名のハイフンをアンダースコアに変更しました。 2026-09-28 10:51:02 +09:00
s-choi
503ac3f3db [FIX] 新規会員登録画面での生年月日のmax値を今日の日付へ変更しました。新規会員登録画面で一回コースを選択したら、変更できないように修正しました。 2026-09-28 10:45:13 +09:00
s-choi
d5b18ae3ad [FIX] 会員登録の生年月日、今日以降の日付は選べないようにしました。 2026-09-28 10:03:06 +09:00
s-choi
efe93e010d [STYLE] 余計な文章を削除しました。 2026-09-28 10:02:23 +09:00
62 changed files with 1284 additions and 750 deletions

View File

@@ -10,6 +10,7 @@ import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
import com.example.demo.exception.NoSessionException;
@@ -32,7 +33,7 @@ public class SessionCheckAspect {
public void checkSession() {
HttpSession session = request.getSession(false);
if (session == null || session.getAttribute("loginUser") == null) {
if (session == null || session.getAttribute(SessionKeyword.LOGIN_USER) == null) {
throw new NoSessionException("不正なログインです");
}

View File

@@ -4,12 +4,16 @@ package com.example.demo.aop.handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import jakarta.servlet.http.HttpSession;
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.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
import com.example.demo.exception.NoSessionException;
@ControllerAdvice
@@ -28,34 +32,36 @@ public class GlobalExceptionHandler {
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
model.addAttribute(
"errorMessage",
PageReturnAttributeKeyword.ERROR_MESSAGE,
"システムエラーが発生しました。"
+ "初めからやり直してください。");
return "redirect:/login";
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
}
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public String handleBadRequestException(Model model, Exception e) {
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
public String handleBadRequestException(Model model, Exception e, HttpSession session) {
model.addAttribute(PageReturnAttributeKeyword.ERROR, SEVERE_ERROR_MESSAGE_BAD_REQUEST);
model.addAttribute(PageReturnAttributeKeyword.STATUS, HttpStatus.BAD_REQUEST.value());
e.printStackTrace();
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
return "error";
System.out.println("session invalidated");
session.invalidate();
return TransitionTargetPageNameKeyword.ERROR_HTML;
}
@ExceptionHandler(Exception.class)
public String AllException(Model model, Exception e) {
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
public String AllException(Model model, Exception e, HttpSession session) {
e.printStackTrace();
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
return "error";
System.out.println("session invalidated exception");
session.invalidate();
return TransitionTargetPageNameKeyword.ERROR_HTML;
}
}

View File

@@ -3,7 +3,6 @@ package com.example.demo.app.domain.model;
import java.util.List;
import com.example.demo.app.infra.entity.CourseEntity;
import com.example.demo.app.infra.entity.UserEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
@@ -27,11 +26,10 @@ public class CourseModel {
return courseEntityList.stream().map(CourseModel::convertFrom).toList();
}
public static CourseEntity convertTo(CourseModel courseModel, List<UserEntity> userEntityList) {
public static CourseEntity convertTo(CourseModel courseModel) {
return new CourseEntity(
courseModel.getCourseId(),
courseModel.getCourseName(),
courseModel.getDescription(),
userEntityList);
courseModel.getDescription());
}
}

View File

@@ -57,7 +57,7 @@ public class GoalModel {
goalModel.getTargetAmount(),
goalModel.getDeadline(),
0,
userEntity, 0);
userEntity);
}
public static GoalModel convertFrom(GoalForm goalForm) {

View File

@@ -8,6 +8,4 @@ public interface AllocationService {
public List<AllocationModel> findAll();
public List<AllocationModel> save(List<AllocationModel> allocationModelList);
}

View File

@@ -3,6 +3,7 @@ package com.example.demo.app.domain.service;
import java.util.List;
import com.example.demo.app.domain.model.CourseModel;
import com.example.demo.app.presentation.form.AllocationFormList;
public interface CourseService {
@@ -12,5 +13,14 @@ public interface CourseService {
public Long findByName(String courName);
public CourseModel save(CourseModel courseModel, Long userId);
public CourseModel save(CourseModel courseModel, Long userId, AllocationFormList allocationFormList);
public List<CourseModel> findAllByUserId(Long userId);
public List<CourseModel> findAllByNull();
public String deleteCourse(Long courseId, Long userId);
}

View File

@@ -18,6 +18,8 @@ public interface GoalService {
public void updateGoalComplete(Long userId);
public int getCurrentAmount(Long userId);
// void deleteGoal(Long goalId);
}

View File

@@ -1,6 +1,5 @@
package com.example.demo.app.domain.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Service;
@@ -26,26 +25,5 @@ public class AllocationServiceImpl implements AllocationService {
return AllocationEntity.createAllocationModelList(allocationRepository.findAll());
}
public List<AllocationModel> save(List<AllocationModel> allocationModelList) {
List<AllocationEntity> allocationEntityList = new ArrayList<>();
allocationModelList.forEach(allocationModel -> {
allocationEntityList.add(
AllocationModel.convertTo(
categoryRepository.findById(allocationModel.getCategoryId()).get(),
courseRepository.findById(allocationModel.getCourseId()).get(),
allocationModel.getAllocationRatio()));
});
List<AllocationModel> result = new ArrayList<>();
for (AllocationEntity allocationEntity : allocationEntityList) {
result.add(AllocationModel.convertFrom(allocationRepository.save(allocationEntity)));
}
return result;
}
}

View File

@@ -3,14 +3,23 @@ package com.example.demo.app.domain.service.impl;
import java.util.ArrayList;
import java.util.List;
import jakarta.transaction.Transactional;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.AllocationModel;
import com.example.demo.app.domain.model.CourseModel;
import com.example.demo.app.domain.service.CourseService;
import com.example.demo.app.infra.entity.AllocationEntity;
import com.example.demo.app.infra.entity.CourseEntity;
import com.example.demo.app.infra.entity.CourseOwnerEntity;
import com.example.demo.app.infra.entity.UserEntity;
import com.example.demo.app.infra.repository.AllocationRepository;
import com.example.demo.app.infra.repository.CategoryRepository;
import com.example.demo.app.infra.repository.CourseOwnerRepository;
import com.example.demo.app.infra.repository.CourseRepository;
import com.example.demo.app.infra.repository.UserRepository;
import com.example.demo.app.presentation.form.AllocationFormList;
import lombok.RequiredArgsConstructor;
@@ -18,14 +27,27 @@ import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class CourseServiceImpl implements CourseService {
private final AllocationRepository allocationRepository;
private final CourseRepository courseRepository;
private final UserRepository userRepository;
private final CourseOwnerRepository courseOwnerRepository;
private final CategoryRepository categoryRepository;
public List<CourseModel> findAll(){
public List<CourseModel> findAll() {
return CourseEntity.createCourseModelList(courseRepository.findAll());
}
public List<CourseModel> findAllByUserId(Long userId) {
return CourseModel.convertFrom(courseRepository.findAllByUserId(userId));
}
public List<CourseModel> findAllByNull() {
return CourseModel.convertFrom(courseRepository.findAllByNull());
}
public CourseModel findById(Long courseId) {
return CourseModel.convertFrom(courseRepository.findByCourseId(courseId));
}
@@ -34,12 +56,92 @@ public class CourseServiceImpl implements CourseService {
return courseRepository.findByCourseName(courseName).getCourseId();
}
public CourseModel save(CourseModel courseModel, Long userId) {
@Transactional
public CourseModel save(CourseModel courseModel, Long userId, AllocationFormList allocationFormList) {
List<UserEntity> userEntityList = new ArrayList<>();
userEntityList.add(userRepository.findById(userId).get());
CourseEntity result = courseRepository.save(CourseModel.convertTo(courseModel));
return CourseModel.convertFrom( courseRepository.save( CourseModel.convertTo(courseModel, userEntityList)));
List<AllocationModel> allocationModelList = new ArrayList<>();
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
result.getCourseId(),
allocationFormList.getAllocationRatio4()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(),
result.getCourseId(),
allocationFormList.getAllocationRatio5()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(),
result.getCourseId(),
allocationFormList.getAllocationRatio6()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(),
result.getCourseId(),
allocationFormList.getAllocationRatio7()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(),
result.getCourseId(),
allocationFormList.getAllocationRatio8()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(),
result.getCourseId(),
allocationFormList.getAllocationRatio9()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(),
result.getCourseId(),
allocationFormList.getAllocationRatio10()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(),
result.getCourseId(),
allocationFormList.getAllocationRatio11()));
allocationModelList.stream().forEach(allocation -> {
System.out.println(allocation.getCourseId());
});
UserEntity user = userRepository.findById(userId).orElse(null);
user.setCourseEntity(result);
UserEntity userResult = userRepository.save(user);
CourseOwnerEntity courseOwnerEntity = new CourseOwnerEntity();
courseOwnerEntity.setUserEntity(userResult);
courseOwnerEntity.setCourseEntity(result);
courseOwnerRepository.save(courseOwnerEntity);
List<AllocationEntity> allocationEntityList = new ArrayList<>();
allocationModelList.forEach(allocationModel -> {
allocationEntityList.add(
AllocationModel.convertTo(
categoryRepository.findById(allocationModel.getCategoryId()).get(),
courseRepository.findById(allocationModel.getCourseId()).get(),
allocationModel.getAllocationRatio()));
});
List<AllocationModel> resultList = new ArrayList<>();
for (AllocationEntity allocationEntity : allocationEntityList) {
resultList.add(AllocationModel.convertFrom(allocationRepository.save(allocationEntity)));
}
return CourseModel.convertFrom(result);
}
@Transactional
public String deleteCourse(Long courseId, Long userId) {
UserEntity userEntity = userRepository.findById(userId).orElse(null);
System.out.println("***********************ここでエラー1");
if (userEntity.getCourseEntity().getCourseId() == courseId) {
return "selected";
}
System.out.println("***********************ここでエラー2");
allocationRepository.deleteByCourseId(courseId);
System.out.println("***********************ここでエラー3");
courseOwnerRepository.deleteByCourseId(courseId);
System.out.println("***********************ここでエラー4");
courseRepository.deleteById(courseId);
System.out.println("***********************ここでエラー5");
return "ok";
}
}

View File

@@ -59,13 +59,28 @@ public class GoalServiceImpl implements GoalService {
: (int) ((currentAmount * 100.0) / goalEntity.getTargetAmount()),
currentAmount)));
return goalModelList;
}
@Override
public GoalModel createGoal(GoalModel goalModel, Long userId) {
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
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;
if (currentAmount >= goalModel.getTargetAmount()) {
return null;
}
GoalEntity goalEntity = GoalModel.convertTo(goalModel, userRepository.findById(userId).get());
GoalEntity savedGoalEntity = goalRepository.save(goalEntity);
@@ -108,4 +123,21 @@ public class GoalServiceImpl implements GoalService {
});
}
public int getCurrentAmount(Long userId) {
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
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;
return currentAmount;
}
}

View File

@@ -25,6 +25,8 @@ public class LoginServiceImpl implements LoginService {
if (userEntity == null) {
return null;
} else if (userEntity.getDeleteFlag() == 1) {
return null;
}
boolean isValidPassword = false;

View File

@@ -58,6 +58,7 @@ public class ProfileServiceImpl implements ProfileService{
userEntity.setSaving(profileEditForm.getSaving());
userEntity.setAnnualIncome(profileEditForm.getAnnualIncome());
userEntity.setMonthlyBudget(profileEditForm.getMonthlyBudget());
userEntity.setBirthDate(profileEditForm.getBirthDate());
userRepository.save(userEntity);
}
}

View File

@@ -52,11 +52,14 @@ public class UserServiceImpl implements UserService {
CourseEntity courseEntity = courseRepository.findById(courseId).orElse(null);
userEntity.setQuestionEntity(questionEntity);
userEntity.setCourseEntity(courseEntity);
userEntity.setDeleteFlag(0);
userRepository.save(userEntity);
goalEntity.setUserEntity(userRepository.save(userEntity));
goalRepository.save(goalEntity);
}
@Override

View File

@@ -29,7 +29,7 @@ public class CategoryEntity {
@Column(name = "category_id")
private Long categoryId;
@Column(name = "category_name", nullable = false)
@Column(name = "category_name", nullable = false, length = 50)
private String categoryName;
@Column(name = "transaction_type", nullable = false)

View File

@@ -7,7 +7,6 @@ import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import com.example.demo.app.domain.model.CourseModel;
@@ -28,16 +27,13 @@ public class CourseEntity {
@Column(name = "course_id")
private Long courseId;
@Column(name = "course_name", nullable = false)
@Column(name = "course_name", nullable = false, length = 50)
private String courseName;
@Column(name = "description", nullable = false)
private String description;
@OneToMany(mappedBy = "courseEntity")
private List<UserEntity> userEntity;
public static List<CourseModel> createCourseModelList(List<CourseEntity> courseEntityList) {
return courseEntityList

View File

@@ -0,0 +1,37 @@
package com.example.demo.app.infra.entity;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "course_owner_t")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CourseOwnerEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long courseOwnerId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private UserEntity userEntity;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "course_id")
private CourseEntity courseEntity;
}

View File

@@ -34,7 +34,7 @@ public class FixedCostEntity {
@JoinColumn(name = "category_id")
private CategoryEntity categoryEntity;
@Column(name = "fixed_cost_name", nullable = false)
@Column(name = "fixed_cost_name", nullable = false, length = 50)
private String fixedCostName;
@Column(name = "amount", nullable = false)

View File

@@ -29,10 +29,10 @@ public class GoalEntity {
private Long goalId;
@Column(name = "goal_title", nullable = true)
private String goalTitle;
private String goalTitle = "名前を設定してください";
@Column(name = "goal_subtitle", nullable = true)
private String goalSubtitle;
private String goalSubtitle = "説明を書いてください";
@Column(name = "target_amount", nullable = true)
private Integer targetAmount;
@@ -47,6 +47,4 @@ public class GoalEntity {
@JoinColumn(name = "user_id")
private UserEntity userEntity;
private Integer deleteFlag;
}

View File

@@ -0,0 +1,5 @@
package com.example.demo.app.infra.entity;
public class TestController6 {
}

View File

@@ -30,7 +30,7 @@ public class UserEntity {
@Column(name = "user_id")
private Long userId;
@Column(name = "user_name", nullable = false)
@Column(name = "user_name", nullable = false, length = 100)
private String userName;
@Column(name = "mail_address", nullable = false)
@@ -39,7 +39,7 @@ public class UserEntity {
@Column(name = "password", nullable = false)
private String password;
@Column(name = "secret_answer", nullable = false)
@Column(name = "secret_answer", nullable = false, length = 100)
private String secretQuestionAnswer;
@Column(name = "birth_date", nullable = false)

View File

@@ -3,6 +3,7 @@ package com.example.demo.app.infra.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import com.example.demo.app.domain.model.CourseInfoModel;
@@ -29,4 +30,8 @@ public interface AllocationRepository extends JpaRepository<AllocationEntity, Al
+ " a.categoryEntity.categoryId ASC ")
List<CourseInfoModel> findAllJoinedAllocation();
@Modifying
@Query("delete from AllocationEntity a where a.courseEntity.courseId = :courseId")
void deleteByCourseId(Long courseId);
}

View File

@@ -0,0 +1,15 @@
package com.example.demo.app.infra.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import com.example.demo.app.infra.entity.CourseOwnerEntity;
public interface CourseOwnerRepository extends JpaRepository<CourseOwnerEntity, Long>{
@Modifying
@Query("delete from CourseOwnerEntity c where c.courseEntity.courseId = :courseId")
public void deleteByCourseId(Long courseId);
}

View File

@@ -1,5 +1,7 @@
package com.example.demo.app.infra.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
@@ -13,5 +15,10 @@ public interface CourseRepository extends JpaRepository<CourseEntity, Long> {
@Query("SELECT c FROM CourseEntity c WHERE c.courseName = :courseName ")
public CourseEntity findByCourseName(String courseName);
@Query("select c from CourseEntity c inner join CourseOwnerEntity o on c.courseId = o.courseEntity.courseId inner join UserEntity u on o.userEntity.userId = u.userId where u.userId = :userId")
public List<CourseEntity> findAllByUserId(Long userId);
@Query("select c from CourseEntity c where c.courseId between 1 and 6")
public List<CourseEntity> findAllByNull();
}

View File

@@ -12,6 +12,9 @@ import org.springframework.web.bind.annotation.PostMapping;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.CategoryService;
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
import com.example.demo.app.presentation.form.CategoryForm;
import lombok.RequiredArgsConstructor;
@@ -23,64 +26,64 @@ public class CategoryController {
private final CategoryService categoryService;
@GetMapping("/category/list")
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_LIST)
public String categoryListGet(Model model, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
List<CategoryForm> categoryFormList = CategoryForm.convertFrom(categoryService.findAllByuserId(loginUser.getUserId()));
model.addAttribute("categoryFormList", categoryFormList);
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
return "category-list";
return TransitionTargetPageNameKeyword.CATEGORY_LIST_HTML;
}
@GetMapping("/category/create")
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_CREATE)
public String categoryCreateGet(@ModelAttribute CategoryForm categoryForm) {
return "category-create";
return TransitionTargetPageNameKeyword.CATEGORY_CREATE_HTML;
}
@PostMapping("/category/create")
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_CREATE)
public String categoryCreatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
return "redirect:/category/list";
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
}
@GetMapping("/category/update")
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_UPDATE)
public String categoryUpdateGet(Model model, Long categoryId) {
CategoryForm categoryForm = CategoryForm.convertFrom(categoryService.findOne(categoryId));
model.addAttribute("categoryId", categoryId);
model.addAttribute("categoryForm", categoryForm);
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_ID, categoryId);
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM, categoryForm);
return "category-update";
return TransitionTargetPageNameKeyword.CATEGORY_UPDATE_HTML;
}
@PostMapping("/category/update")
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_UPDATE)
public String categoryUpdatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session, Long categoryId) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
categoryForm.setCategoryId(categoryId);
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
return "redirect:/category/list";
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
}
@PostMapping("/category/delete")
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_DELETE)
public String categoryDeletePost(Long categoryId) {
categoryService.delete(categoryId);
return "redirect:/category/list";
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
}

View File

@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.example.demo.aop.aspect.SessionCheck;
import com.example.demo.app.domain.model.AllocationModel;
import com.example.demo.app.domain.model.CourseModel;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.AllocationService;
import com.example.demo.app.domain.service.CourseInfoService;
@@ -47,7 +47,9 @@ public class CourseController {
session.setAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
model.addAttribute(PageReturnAttributeKeyword.MODE, MODE);
model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, courseService.findByName(DEFAULT));
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST, CourseForm.convertFrom(courseService.findAll()));
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST,
CourseForm.convertFrom(courseService.findAllByNull()));
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
CourseInfoForm.convertFrom(courseInfoService.findAll()));
@@ -66,9 +68,15 @@ public class CourseController {
Long currentCourseId = userService.findByUserId(userId).getCourseId();
List<CourseModel> courseModelList = new ArrayList<>(courseService.findAllByNull());
List<CourseModel> tempList = courseService.findAllByUserId(userId);
tempList.forEach(courseModelList::add);
model.addAttribute(PageReturnAttributeKeyword.MODE, MODE);
model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, currentCourseId);
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST, CourseForm.convertFrom(courseService.findAll()));
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST, CourseForm.convertFrom(courseModelList));
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
CourseInfoForm.convertFrom(courseInfoService.findAll()));
@@ -88,60 +96,58 @@ public class CourseController {
}
@SessionCheck
@GetMapping("/course/create")
@GetMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
public String createCourseGet(@ModelAttribute CourseForm courseForm, HttpSession session) {
return "course_create";
return TransitionTargetPageNameKeyword.COURSE_CREATE_HTML;
}
@SessionCheck
@PostMapping("/course/create/ratio")
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO)
public String createCourse(@ModelAttribute CourseForm courseForm,
@ModelAttribute AllocationFormList allocationFormList,
HttpSession session, Model model) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
CourseForm form = CourseForm
.convertFrom(courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId()));
model.addAttribute("courseForm", courseForm);
session.setAttribute("courseId", form.getCourseId());
return "course_create_ratio";
return TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO_HTML;
}
@SessionCheck
@PostMapping("/course/create")
public String createCoursePost(@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
public String createCoursePost(@ModelAttribute CourseForm courseForm,
@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
List<AllocationModel> allocationModelList = new ArrayList<>();
courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId(), allocationFormList);
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId1(),
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio1()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId2(),
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio2()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId3(),
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio3()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio4()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(),
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio5()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(),
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio6()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(),
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio7()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(),
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio8()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(),
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio9()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(),
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio10()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(),
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio11()));
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
}
allocationService.save(allocationModelList);
@SessionCheck
@PostMapping("/course/delete")
public String createCoursePost(@RequestParam Long courseId, HttpSession session, Model model) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
System.out.println("**********************cousrId: " + courseId);
String condition = courseService.deleteCourse(courseId, loginUser.getUserId());
if (condition.equals("selected")) {
model.addAttribute("message", "適用中のコースは選べません");
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
} else if (condition.equals("ok")) {
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
}
model.addAttribute("message", "エラーが発生しました");
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
return "redirect:/course";
}
}

View File

@@ -11,4 +11,5 @@ public class ErrorController {
public String showError() {
return TransitionTargetPageNameKeyword.ERROR_HTML;
}
}

View File

@@ -16,6 +16,9 @@ import com.example.demo.aop.aspect.SessionCheck;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.CategoryService;
import com.example.demo.app.domain.service.FixedCostService;
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
import com.example.demo.app.presentation.form.CategoryForm;
import com.example.demo.app.presentation.form.FixedCostForm;
@@ -29,30 +32,30 @@ public class FixedCostController {
private final CategoryService categoryService;
@SessionCheck
@GetMapping("/fixed-cost/list")
@GetMapping(TransitionTargetPageNameKeyword.FIXED_COST_LIST)
public String getFixedCostList(
HttpSession session, Model model, LocalDate today) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
if (today == null) {
today = (LocalDate) session.getAttribute("today");
today = (LocalDate) session.getAttribute(PageReturnAttributeKeyword.TODAY);
}
List<FixedCostForm> fixedCostFormList = FixedCostForm.convertFrom(fixedCostService.findAllByUserId(loginUser.getUserId()));
fixedCostFormList.forEach(fixedCostForm -> fixedCostForm.setCategoryName(categoryService.findOne(fixedCostForm.getCategoryId()).getCategoryName()));
model.addAttribute("fixedCostFormList", fixedCostFormList);
model.addAttribute(PageReturnAttributeKeyword.FIXED_COST_FORM_LIST, fixedCostFormList);
model.addAttribute("today", today);
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
return "fixed_cost";
return TransitionTargetPageNameKeyword.FIXED_COST_HTML;
}
@SessionCheck
@GetMapping("/fixed-cost/create")
@GetMapping(TransitionTargetPageNameKeyword.FIXED_COST_CREATE)
public String getFixedCostCreate(
HttpSession session, @ModelAttribute FixedCostForm fixedCostForm, Model model, LocalDate today) {
@@ -72,42 +75,42 @@ public class FixedCostController {
}
model.addAttribute("expenseList", expenseList);
model.addAttribute("incomeList", incomeList);
model.addAttribute("today", today);
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
return "fixed_cost_create";
return TransitionTargetPageNameKeyword.FIXED_COST_CREATE_HTML;
}
@SessionCheck
@PostMapping("/fixed-cost/create")
@PostMapping(TransitionTargetPageNameKeyword.FIXED_COST_CREATE)
public String postFixedCostCreate(
HttpSession session, @ModelAttribute FixedCostForm fixedCostForm, Model model, LocalDate today) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
fixedCostForm.setUserId(loginUser.getUserId());
fixedCostService.save(FixedCostForm.convertTo(fixedCostForm));
session.setAttribute("today", today);
session.setAttribute(PageReturnAttributeKeyword.TODAY, today);
return "redirect:/fixed-cost/list";
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.FIXED_COST_LIST;
}
@SessionCheck
@PostMapping("/fixed-cost/delete")
@PostMapping(TransitionTargetPageNameKeyword.FIXED_COST_DELETE)
public String postFixedCostDelete(Long fixedCostId, LocalDate today, HttpSession session) {
fixedCostService.delete(fixedCostId);
session.setAttribute("today", today);
session.setAttribute(PageReturnAttributeKeyword.TODAY, today);
return "redirect:/fixed-cost/list";
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.FIXED_COST_LIST;
}

View File

@@ -53,10 +53,12 @@ public class GoalController {
HttpSession session,
Long goalId) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
Long userId = loginUser.getUserId();
LocalDate today = LocalDate.now();
goalService.updateGoalComplete(userId);
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
@@ -64,19 +66,20 @@ public class GoalController {
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
List<GoalForm> goalFormList = goalFormList1.stream()
.filter(goalForm -> goalForm.getGoalComplete() == 0)
.filter(goalForm -> goalForm.getGoalComplete() == 0
&& !goalForm.getDeadline().isBefore(today))
.collect(Collectors.toList());
model.addAttribute(
"goalFormList",
PageReturnAttributeKeyword.GOAL_FORM_LIST,
goalFormList);
model.addAttribute(
"achievementList",
PageReturnAttributeKeyword.ACHIEVEMENT_LIST,
new ArrayList<MonthlyAchievementForm>());
if (goalFormList.isEmpty()) {
return "goal_view";
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
}
GoalForm graphGoal;
@@ -95,7 +98,7 @@ public class GoalController {
}
model.addAttribute(
"graphGoal",
PageReturnAttributeKeyword.GRAPH_GOAL,
graphGoal);
int currentAmount = graphGoal.getCurrentAmount();
@@ -107,8 +110,6 @@ public class GoalController {
1,
1);
LocalDate today = LocalDate.now();
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
transactionService
@@ -223,7 +224,7 @@ public class GoalController {
}
model.addAttribute(
"achievementList",
PageReturnAttributeKeyword.ACHIEVEMENT_LIST,
achievementList);
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
@@ -238,7 +239,6 @@ public class GoalController {
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm);
return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML;
@@ -266,44 +266,58 @@ public class GoalController {
}
@SessionCheck
@GetMapping("/create")
public String createGoalGet(@ModelAttribute GoalForm goalForm, HttpSession session) {
@GetMapping(TransitionTargetPageNameKeyword.CREATE)
public String createGoalGet(@ModelAttribute GoalForm goalForm, HttpSession session, Model model) {
return "goal_create";
}
@SessionCheck
@PostMapping("/create")
public String createGoalPost(@ModelAttribute GoalForm goalForm, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
Long userId = loginUser.getUserId();
goalService.createGoal(GoalModel.convertFrom(goalForm), userId);
int currentAmount = goalService.getCurrentAmount(userId);
return "redirect:/goal";
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount);
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
}
@SessionCheck
@PostMapping("/delete") // フラグ考慮してないため、今度修正必要
@PostMapping(TransitionTargetPageNameKeyword.CREATE)
public String createGoalPost(@ModelAttribute GoalForm goalForm, HttpSession session, Model model) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
Long userId = loginUser.getUserId();
if (goalService.createGoal(GoalModel.convertFrom(goalForm), userId) == null) {
model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "現在所持金より高い金額を設定してください。");
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
}
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
}
@SessionCheck
@PostMapping(TransitionTargetPageNameKeyword.DELETE) // フラグ考慮してないため、今度修正必要
public String deleteGoal(Long goalId, Long record) {
goalService.delete(goalId);
if (record == null) {
return "redirect:/goal";
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
} else {
return "redirect:/goal/record";
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL
+ TransitionTargetPageNameKeyword.RECORD;
}
}
@SessionCheck
@GetMapping("/record")
@GetMapping(TransitionTargetPageNameKeyword.RECORD)
public String getRecord(HttpSession session, Model model) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LocalDate today = LocalDate.now();
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
Long userId = loginUser.getUserId();
goalService.updateGoalComplete(userId);
@@ -314,16 +328,22 @@ public class GoalController {
List<GoalForm> goalCompleteFormList = new ArrayList<>();
goalFormList.stream().forEach(goalForm -> {
if (goalForm.getGoalComplete() == 1) {
if (goalForm.getGoalComplete() == 1 || goalForm.getDeadline().isBefore(today)) {
goalForm.setStatus(
goalForm.getGoalComplete() == 1
? "達成"
: "未達成");
goalCompleteFormList.add(goalForm);
}
});
model.addAttribute(
"goalCompleteFormList",
PageReturnAttributeKeyword.GOAL_COMPLETE_FORM_LIST,
goalCompleteFormList);
return "goal_record";
return TransitionTargetPageNameKeyword.GOAL_RECORD_HTML;
}
}

View File

@@ -26,8 +26,8 @@ public class LoginController {
@GetMapping(TransitionTargetPageNameKeyword.LOGIN)
public String showLogin(@ModelAttribute LoginForm loginForm, HttpSession session) {
if (session.getAttribute("loginUser") != null) {
return "redirect:/menu";
if (session.getAttribute(SessionKeyword.LOGIN_USER) != null) {
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
}
return TransitionTargetPageNameKeyword.LOGIN_HTML;

View File

@@ -54,6 +54,7 @@ public class ProfileController {
new ProfileEditForm(
profileModel.getUserName(),
profileModel.getMailAddress(),
profileModel.getBirthDate(),
profileModel.getSaving(),
profileModel.getAnnualIncome(),
profileModel.getMonthlyBudget());

View File

@@ -192,7 +192,7 @@ public class TransactionController {
Long fixedCostId,
Model model, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
if (today == null) {
today = LocalDate.now();
}
@@ -218,8 +218,28 @@ public class TransactionController {
}
}
List<CategoryForm> expenseList = new ArrayList<CategoryForm>();
List<CategoryForm> incomeList = new ArrayList<CategoryForm>();
for (CategoryForm categoryForm : categoryFormList) {
if (categoryForm.getTransactionType() == 0) {
expenseList.add(categoryForm);
} else {
incomeList.add(categoryForm);
}
}
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
session.setAttribute(SessionKeyword.T_TYPE, String.valueOf(transactionForm.getTransactionType()));
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
model.addAttribute(PageReturnAttributeKeyword.TODAY, today.format(DateTimeFormatter.ISO_LOCAL_DATE));
@@ -253,7 +273,7 @@ public class TransactionController {
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
Model model, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
if (today == null) {
today = LocalDate.now();
}
@@ -277,6 +297,23 @@ public class TransactionController {
transactionService.findMoneyRecord(transactionId),
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType());
List<CategoryForm> expenseList = new ArrayList<CategoryForm>();
List<CategoryForm> incomeList = new ArrayList<CategoryForm>();
for (CategoryForm categoryForm : categoryFormList) {
if (categoryForm.getTransactionType() == 0) {
expenseList.add(categoryForm);
} else {
incomeList.add(categoryForm);
}
}
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_ID, transactionId);
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
@@ -285,6 +322,8 @@ public class TransactionController {
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
session.setAttribute(SessionKeyword.T_TYPE, transactionForm.getTransactionType());
return TransitionTargetPageNameKeyword.TRANSACTION_UPDATE_HTML;
}
@@ -295,7 +334,7 @@ public class TransactionController {
@RequestParam LocalDate today, Model model,
HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
transactionForm.setUserId(loginUser.getUserId());
transactionForm.setTransactionId(transactionId);
@@ -390,7 +429,7 @@ public class TransactionController {
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0)
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0 && goal.getDeadline().isAfter(today) )
.collect(Collectors.toList());
if (!resultList.isEmpty()) {
@@ -407,15 +446,17 @@ public class TransactionController {
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, result.getDeadline());
} else {
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, "目標を設定してください");
final String MESSAGE = "目標を設定してください";
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, "目標を設定してください");
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, MESSAGE);
model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, "目標を設定してください");
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, MESSAGE);
model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, MESSAGE);
model.addAttribute(PageReturnAttributeKeyword.SAVING, userForm.getSaving());
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, "目標を設定してください");
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, MESSAGE);
}
return TransitionTargetPageNameKeyword.MENU_HTML;

View File

@@ -16,6 +16,7 @@ import com.example.demo.app.domain.service.QuestionService;
import com.example.demo.app.domain.service.UserService;
import com.example.demo.app.infra.entity.QuestionEntity;
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
import com.example.demo.app.presentation.form.UserForm;
@@ -58,8 +59,8 @@ public class UserController {
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
}
session.setAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
model.addAttribute(PageReturnAttributeKeyword.COURESE_ID, courseId);
session.setAttribute(SessionKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
model.addAttribute(PageReturnAttributeKeyword.COURSE_ID, courseId);
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
return TransitionTargetPageNameKeyword.USER_RESISTER_RETURN_HTML;
@@ -70,7 +71,10 @@ public class UserController {
String selectedCourseName, Model model,
HttpSession session) {
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute("selectedCourseName"));
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME));
session.setAttribute(SessionKeyword.QUESTION_ID, userForm.getSecretQuestionId());
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
}
@@ -81,7 +85,11 @@ public class UserController {
Model model,
HttpSession session) {
Long courseId = courseService.findByName((String) session.getAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME));
Long courseId = courseService.findByName((String) session.getAttribute(SessionKeyword.SELECTED_COURSE_NAME));
Long questionId = (Long) session.getAttribute(SessionKeyword.QUESTION_ID);
userForm.setSecretQuestionId(questionId);
userService.register(userForm, courseId);

View File

@@ -4,12 +4,13 @@ public class PageReturnAttributeKeyword {
public static final String ERROR_MESSAGE = "errorMessage";
public static final String MESSAGE = "message";
public static final String ERROR = "error";
public static final String STATUS = "status";
public static final String QUESTION_LIST = "questionList";
public static final String USER_FORM = "userForm";
public static final String SELECTED_COURSE_NAME = "selectedCourseName";
public static final String COURESE_ID = "courseId";
public static final String COURSE_ID = "courseId";
public static final String PASSWOR_RESET_FORM = "passwordResetForm";
public static final String PASSWOR_RESET_USER_ID = "passwordResetUserId";
@@ -52,5 +53,14 @@ public class PageReturnAttributeKeyword {
public static final String ANALYSIS_FORM = "analysisForm";
public static final String GOAL_FORM = "goalForm";
public static final String GOAL_FORM_LIST = "goalFormList";
public static final String ACHIEVEMENT_LIST = "achievementList";
public static final String GRAPH_GOAL = "graphGoal";
public static final String GOAL_COMPLETE_FORM_LIST = "goalCompleteFormList";
public static final String CATEGORY_ID = "categoryId";
public static final String CATEGORY_FORM = "categoryForm";
public static final String FIXED_COST_FORM_LIST = "fixedCostFormList";
}

View File

@@ -3,4 +3,10 @@ package com.example.demo.app.presentation.controller.pageproperty;
public class SessionKeyword {
// SESSION情報として格納したいログイン者の情報
public static final String LOGIN_USER = "loginUser";
public static final String SELECTED_COURSE_NAME = "selectedCourseName";
public static final String QUESTION_ID = "questionId";
public static final String T_TYPE = "tType";
}

View File

@@ -21,6 +21,8 @@ public class TransitionTargetPageNameKeyword {
public static final String PROFILE_EDIT_HTML = "profile_edit";
public static final String SELECT_COURSE_HTML = "select_course";
public static final String COURSE_CREATE_HTML = "course_create";
public static final String COURSE_CREATE_RATIO_HTML = "course_create_ratio";
public static final String TRANSACTION_LIST_HTML = "transaction_list";
public static final String TRANSACTION_DETAIL_HTML = "transaction_detail";
@@ -31,6 +33,15 @@ public class TransitionTargetPageNameKeyword {
public static final String GOAL_VIEW_HTML = "goal_view";
public static final String GOAL_EDIT_HTML = "goal_edit";
public static final String GOAL_CREATE_HTML = "goal_create";
public static final String GOAL_RECORD_HTML = "goal_record";
public static final String CATEGORY_LIST_HTML = "category_list";
public static final String CATEGORY_CREATE_HTML = "category_create";
public static final String CATEGORY_UPDATE_HTML = "category_update";
public static final String FIXED_COST_HTML = "fixed_cost";
public static final String FIXED_COST_CREATE_HTML = "fixed_cost_create";
// Countroller
public static final String ERROR = "/error";
@@ -58,6 +69,9 @@ public class TransitionTargetPageNameKeyword {
public static final String SHOW_SELECT_COURSE = "/user/register/course";
public static final String COURSE = "/course";
public static final String CHANGE = "/change";
public static final String COURSE_CREATE = "/course/create";
public static final String COURSE_CREATE_RATIO = "/course/create/ratio";
public static final String INTERROGATION = "?";
public static final String EQUAL = "=";
@@ -73,5 +87,18 @@ public class TransitionTargetPageNameKeyword {
public static final String GOAL = "/goal";
public static final String EDIT = "/edit";
public static final String UPDATE = "/update";
public static final String CREATE = "/create";
public static final String DELETE = "/delete";
public static final String RECORD = "/record";
public static final String CATEGORY_LIST = "/category/list";
public static final String CATEGORY_CREATE = "/category/create";
public static final String CATEGORY_UPDATE = "/category/update";
public static final String CATEGORY_DELETE = "/category/delete";
public static final String FIXED_COST_LIST = "/fixed-cost/list";
public static final String FIXED_COST_CREATE = "/fixed-cost/create";
public static final String FIXED_COST_DELETE = "/fixed-cost/delete";
}

View File

@@ -29,6 +29,8 @@ public class GoalForm {
private Integer goalComplete;
private String status;
private Integer achievementRate; // 達成率
private Integer currentAmount; // 現在の資産
@@ -43,6 +45,7 @@ public class GoalForm {
goalModel.getTargetAmount(),
goalModel.getDeadline(),
goalModel.getGoalComplete(),
null,
goalModel.getAchievementRate(),
goalModel.getCurrentAmount(),
goalModel.getUserId());

View File

@@ -1,5 +1,7 @@
package com.example.demo.app.presentation.form;
import java.time.LocalDate;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -10,6 +12,7 @@ import lombok.NoArgsConstructor;
public class ProfileEditForm {
private String userName;
private String mailAddress;
private LocalDate birthDate;
private Integer saving;
private Integer annualIncome;
private Integer monthlyBudget;

View File

@@ -46,6 +46,10 @@ body {
border-top: 1px solid #d0d7de;
}
.a-footer {
text-decoration: none;
}
/* =======================
カード
======================= */
@@ -178,6 +182,10 @@ td:hover {
text-align: right;
}
.a-calender {
text-decoration: none;
}
/* =======================
金額表示
======================= */

View File

@@ -35,7 +35,7 @@
<table class="table text-center">
<thead>
<tr>
<th scope="col">カテゴリ別</th>
<th scope="col"></th>
<th scope="col">支出</th>
<th scope="col">前月比</th>
</tr>
@@ -47,7 +47,7 @@
0
</td>
<td th:text="${analysisForm.totalDifferenceAmount >= 0}
? '+' + ${analysisForm.totalDifferenceAmount}
? '+' + ${analysisForm.totalDifferenceAmount}
: ${analysisForm.totalDifferenceAmount}"
th:class="${analysisForm.totalDifferenceAmount >= 0}
? 'text-danger'
@@ -73,16 +73,14 @@
<th scope="row"
th:text="${category.categoryName}">
食費
</th>
<td th:text="'¥' + ${category.currentMonthAmount}">
0
</td>
<td>
<span th:text="${category.monthDifferenceAmount >= 0}
? '+' + ${category.monthDifferenceAmount}
? '+' + ${category.monthDifferenceAmount}
: ${category.monthDifferenceAmount}"
th:class="${category.monthDifferenceAmount >= 0}
? 'text-danger'
@@ -90,7 +88,7 @@
</span>
<br>
<span th:text="${category.courseDifferenceAmount >= 0}
? '+' + ${category.courseDifferenceAmount}
? '+' + ${category.courseDifferenceAmount}
: ${category.courseDifferenceAmount}"
th:class="${category.courseDifferenceAmount >= 0}
? 'text-danger'

View File

@@ -25,7 +25,7 @@
<div class="mb-3">
<label class="form-label" for="categoryName">カテゴリ名</label>
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}">
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}" required>
</div>
<br>
@@ -33,7 +33,7 @@
<div class="mb-3">
<label class="form-label" for="transactionType">収入・支出</label>
<select class="form-select" id="transactionType" th:field="*{transactionType}">
<select class="form-select" id="transactionType" th:field="*{transactionType}" required>
<option value="">選択してください</option>
<option value="0">支出</option>

View File

@@ -9,13 +9,13 @@
<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">
<body style="padding-top:80px; padding-bottom:80px;">
<div th:replace="~{header :: header}"></div>
<div class="main-container">
<div>
<ul>
<ul class="list-unstyled p-0 m-0">
<li class="card shadow-sm mb-3" th:each="categoryForm : ${categoryFormList}">
<div class="card-body">
<div class="d-flex justify-content-between">
@@ -49,20 +49,30 @@
</div>
<hr>
<hr>
</div>
</li>
</ul>
</div>
<div class="d-grid mt-4">
<form th:action="@{/category/create}" method="get">
<input type="hidden" name="today" id="today" th:value="${today}">
<button type="submit">新規登録</button>
<input type="hidden"
name="today"
id="today"
th:value="${today}">
<button class="btn btn-success w-100" type="submit">
新規登録
</button>
</form>
</div>
</div>
<div th:replace="~{footer :: footer}"></div>
</body>

View File

@@ -25,7 +25,7 @@
<div class="mb-3">
<label class="form-label" for="categoryName">カテゴリ名</label>
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}">
<input class="form-control" type="text" id="categoryName" th:field="*{categoryName}" required>
</div>
<br>
@@ -33,7 +33,7 @@
<div class="mb-3">
<label class="form-label" for="transactionType">収入・支出</label>
<select class="form-select" id="transactionType" th:field="*{transactionType}">
<select class="form-select" id="transactionType" th:field="*{transactionType}" required>
<option value="">選択してください</option>
<option value="0">支出</option>
@@ -47,7 +47,7 @@
<input type="hidden" name="categoryId" th:value="${categoryId}">
<div class="d-grid">
<button type="submit" class="btn btn-primary">登録</button>
<button type="submit" class="btn btn-primary">更新</button>
</div>
</form>
</div>

View File

@@ -23,7 +23,7 @@
<div class="mb-3">
<label class="form-label" for="courseName">コース名</label>
<input class="form-control" type="text" id="courseName" th:field="*{courseName}">
<input class="form-control" type="text" id="courseName" th:field="*{courseName}" required>
</div>
<br>

View File

@@ -9,7 +9,7 @@
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body style="padding-top:80px; padding-bottom:80px;">
<body style="padding-top:80px; padding-bottom:120px;">
<div th:replace="~{header :: header}"></div>
@@ -22,95 +22,113 @@
<form th:action="@{/course/create}" th:object="${allocationFormList}" method="post">
<div class="mb-3">
<label class="form-label" for="allocationRatio1">給与</label>
<input class="form-control" type="number" id="allocationRatio1" th:field="*{allocationRatio1}">
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio2">賞与</label>
<input class="form-control" type="number" id="allocationRatio2" th:field="*{allocationRatio2}">
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio3">その他</label>
<input class="form-control" type="number" id="allocationRatio3" th:field="*{allocationRatio3}">
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio4">固定費</label>
<input class="form-control" type="number" id="allocationRatio4" th:field="*{allocationRatio4}">
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio4" th:field="*{allocationRatio4}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio5">食費</label>
<input class="form-control" type="number" id="allocationRatio5" th:field="*{allocationRatio5}">
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio5" th:field="*{allocationRatio5}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio6">交通費</label>
<input class="form-control" type="number" id="allocationRatio6" th:field="*{allocationRatio6}">
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio6" th:field="*{allocationRatio6}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio7">日用品費</label>
<input class="form-control" type="number" id="allocationRatio7" th:field="*{allocationRatio7}">
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio7" th:field="*{allocationRatio7}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio8">被服/美容費</label>
<input class="form-control" type="number" id="allocationRatio8" th:field="*{allocationRatio8}">
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio8" th:field="*{allocationRatio8}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio9">医療費</label>
<input class="form-control" type="number" id="allocationRatio9" th:field="*{allocationRatio9}">
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio9" th:field="*{allocationRatio9}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio10">趣味/娯楽費</label>
<input class="form-control" type="number" id="allocationRatio10"
th:field="*{allocationRatio10}">
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio10" th:field="*{allocationRatio10}" required>
</div>
<br>
<div class="mb-3">
<label class="form-label" for="allocationRatio11">その他</label>
<input class="form-control" type="number" id="allocationRatio11"
th:field="*{allocationRatio11}">
<input class="form-control" type="number" min="0" max="100" onchange="inputChange()"
id="allocationRatio11" th:field="*{allocationRatio11}" required>
</div>
<div class="mb-3">
<label class="form-label" for="allocationRatioTotal">合計(%)</label>
<input class="form-control" type="number" value="0" id="allocationRatioTotal" readonly>
</div>
<br>
<div class="d-grid">
<button type="submit" class="btn btn-primary">登録</button>
<button type="submit" class="btn btn-primary" id="submit" disabled="true">登録</button>
</div>
</form>
<span th:object="${courseForm}">
<input type="hidden" id="courseName" th:field="*{courseName}" required>
<br>
<input type="hidden" id="description" th:field="*{description}">
</span>
</div>
</div>
</div>
</div>
<div th:replace="~{footer :: footer}"></div>
<script>
function inputChange() {
let total = 0;
for (let i = 4; i <= 11; i++) {
total += Number(document.getElementById(`allocationRatio${i}`).value || 0);
if (total == 100) {
document.getElementById('submit').disabled = false;
} else {
document.getElementById('submit').disabled = true;
}
}
document.getElementById("allocationRatioTotal").value = total;
}
</script>
</body>

View File

@@ -10,12 +10,6 @@
<div th:replace="~{header :: header}">
</div>
</head>
<body>
<div th:replace="~{header :: header}">
</div>
<div class="container text-center mt-5">
<h2 class="text-danger">

View File

@@ -10,7 +10,7 @@
<link rel="stylesheet" th:href="@{/css/style.css}">
</head>
<body class="pb-5 pt-5">
<body style="padding-top:80px; padding-bottom:80px;">
<div th:replace="~{header :: header}"></div>
<div class="main-container">
@@ -19,7 +19,7 @@
<h2 class="page-title" th:text="${today}"></h2>
<div>
<ul>
<ul class="list-unstyled p-0 m-0">
<li th:each="fixedCostForm : ${fixedCostFormList}" class="card shadow-sm mb-3">
<div class="card-body">
@@ -52,21 +52,29 @@
</div>
<hr>
<hr>
</div>
</li>
</div>
</ul>
</div>
<div class="d-grid mt-4">
<form th:action="@{/fixed-cost/create}" method="get">
<input type="hidden" name="today" id="today" th:value="${today}">
<button type="submit">新規登録</button>
<input type="hidden"
name="today"
id="today"
th:value="${today}">
<button class="btn btn-success w-100" type="submit">
新規登録
</button>
</form>
</div>
</div>
<div th:replace="~{footer :: footer}"></div>
</body>

View File

@@ -37,11 +37,11 @@
<div class="mb-3">
<label class="form-label" for="transactionType">収入・支出</label>
<select class="form-select" id="transactionType">
<select class="form-select" id="transactionType" required>
<option value="">選択してください</option>
<option value="1">支出</option>
<option value="2">収入</option>
<option value="0">支出</option>
<option value="1">収入</option>
</select>
</div>
@@ -51,7 +51,7 @@
<div class="mb-3">
<label class="form-label" for="categoryId">カテゴリ</label>
<select class="form-select" id="categoryId" th:field="*{categoryId}">
<select class="form-select" id="categoryId" th:field="*{categoryId}" required>
<option value="">選択してください</option>
<option class="expenseListClass" th:each="category : ${expenseList}"
@@ -70,7 +70,7 @@
<div class="mb-3">
<label class="form-label" for="amount">金額</label>
<input class="form-control" type="number" id="amount" th:field="*{amount}" min="0" placeholder="金額を入力してください"
<input class="form-control" type="number" id="amount" th:field="*{amount}" min="1" placeholder="金額を入力してください"
required>
</div>
@@ -83,6 +83,7 @@
<div th:replace="~{footer :: footer}"></div>
<script>
const transactionType = document.getElementById("transactionType");
const categoryId = document.getElementById("categoryId");
@@ -90,9 +91,10 @@
const expenseList = document.getElementsByClassName("expenseListClass");
const incomeList = document.getElementsByClassName("incomeListClass");
transactionType.addEventListener("change", function () {
if (this.value === "1") {
if (this.value === "0") {
for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "";
@@ -102,7 +104,7 @@
incomeList[i].style.display = "none";
}
} else if (this.value === "2") {
} else if (this.value === "1") {
for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "none";

View File

@@ -15,22 +15,22 @@
<div class="row">
<div class="col border-end">
<button type="button" class="btn btn-link text-black text-decoration-none">
<a th:href="@{/transaction/create}">入力</a>
<a th:href="@{/transaction/create}" class="a-footer">入力</a>
</button>
</div>
<div class="col border-end">
<button type="button" class="btn btn-link text-black text-decoration-none">
<a th:href="@{/transaction/list}">一覧</a>
<a th:href="@{/transaction/list}" class="a-footer">一覧</a>
</button>
</div>
<div class="col border-end">
<button type="button" class="btn btn-link text-black text-decoration-none">
<a th:href="@{/analysis}">分析</a>
<a th:href="@{/analysis}" class="a-footer">分析</a>
</button>
</div>
<div class="col border-end">
<button type="button" class="btn btn-link text-black text-decoration-none">
<a th:href="@{/goal}">目標</a>
<a th:href="@{/goal}" class="a-footer">目標</a>
</button>
</div>
</div>

View File

@@ -26,17 +26,21 @@
<div>
<label>目標名</label>
<input type="text" th:field="*{goalTitle}" required>
<input type="text" th:field="*{goalTitle}">
</div>
<div>
<label>目標説明</label>
<textarea th:field="*{goalSubtitle}" required></textarea>
<textarea th:field="*{goalSubtitle}"></textarea>
</div>
<div>
<label>目標金額</label>
<input type="number" th:field="*{targetAmount}" required min="1">
<span th:text="|所持金:${currentAmount}円|"></span>
<span th:if="${message != null}">
<span th:text="${message}" style="color: red;"></span>
</span>
</div>
<div>
@@ -44,12 +48,15 @@
<input type="date" th:field="*{deadline}"
th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
</div>
<button type="submit" class="btn btn-sm btn-primary w-100">更新する</button>
<button type="submit" class="btn btn-sm btn-primary w-100">登録</button>
</form>
<div th:replace="~{footer :: footer}"></div>
</div>
</div>
</div>
<div th:replace="~{footer :: footer}"></div>
</body>

View File

@@ -8,7 +8,7 @@
<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">
<body style="padding-top:80px; padding-bottom:80px;">
<div th:replace="~{header :: header}"></div>
@@ -47,6 +47,12 @@
<br>
状態:
<span class="fw-bold" th:text="${goalForm.status}">
</span>
<br>
</p>
</form>
@@ -74,16 +80,16 @@
</ul>
</div>
</div>
<div class="d-grid mt-4">
<form th:action="@{/goal}" method="get">
<button class="btn btn-success w-100" type="submit">
戻る
</button>
</form>
</div>
</div>
</div>
<div th:replace="~{footer :: footer}"></div>

View File

@@ -112,7 +112,7 @@
<ul>
<li th:each="goalForm : ${goalFormList}" class="transaction-item">
<li th:each="goalForm : ${goalFormList}">
<div class="d-flex justify-content-between">
@@ -189,6 +189,8 @@
</div>
<div class="d-grid gap-2 mt-4">
<form th:action="@{/goal/create}" method="get">
<button type="submit" class="btn btn-success w-100">
@@ -205,6 +207,8 @@
</form>
</div>
<div th:replace="~{footer :: footer}"></div>
</body>

View File

@@ -8,10 +8,9 @@
<title>Calendar</title>
<link rel="stylesheet" th:href="@{/css/style.css}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" th:href="@{/css/style.css}">
</head>
<body>
@@ -64,7 +63,7 @@
<a th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1
and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}" th:href="@{/transaction/detail(
todayDates=${T(java.time.LocalDate).of(year, month, week * 7 + weekDay - firstDayOfWeek + 1)}
)}">
)}" class="a-footer">
<div
@@ -138,8 +137,6 @@
</div>
</div>
<div class="card shadow-sm">

View File

@@ -60,6 +60,10 @@
</div>
<span th:if="${message != null}">
<h4 th:text="${message}" style="color: red;"></h4>
</span>
<div class="d-grid">
<button type="submit"

View File

@@ -52,13 +52,15 @@
<div class="mb-3">
<label class="form-label">
パスワード
生年月日
</label>
<input type="password"
<input type="date"
class="form-control"
value="********"
disabled>
id="birthDate"
name="birthDate"
th:value="*{birthDate}"
required>
</div>
<div class="mb-3">
@@ -98,17 +100,17 @@
min="0"
max="10000000"
required>
</div>
</div>
<div class="d-grid">
<button type="submit"
class="btn btn-primary">
確認
編集
</button>
</div>
</div>
</form>
</div>

View File

@@ -5,22 +5,31 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" th:href="@{/css/style.css}">
<title>コース選択</title>
</head>
<body>
<body style="padding-bottom: 120px; padding-top: 80px;">
<div th:replace="~{header :: header}"></div>
<h1 class="page-title">コース選択</h1>
<div class="d-grid gap-2 mt-4">
<th:block th:if="${mode == 'change'}">
<form th:action="@{/course/create}" method="get">
<button class="btn btn-success w-100" type="submit">
新規登録
</button>
</form>
</th:block>
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
<th:block th:if="${mode == 'change'}">
<form th:action="@{/course/create}" method="get">
<button type="submit">新規登録</button>
</form>
</th:block>
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" id="totalForm" method="post">
<button type="submit" class="btn btn-primary w-100">確定</button>
<div class="accordion" id="accordionExample">
@@ -33,9 +42,11 @@
aria-controls="'collapse' + ${course.courseId}">
<span th:text="${course.courseName}"></span>
</button>
<p style="width: 120px;"><button type="button" class="btn btn-danger w-100"
th:attr="data-course-id=${course.courseId}" onclick="deleteCourse(this)">削除</button></p>
</h2>
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse"
data-bs-parent="#accordionExample">
data-bs-parent="#accordionExample" style="padding-bottom: 120px;">
<div class="accordion-body">
<span th:text="${course.description}"></span>
<table class="table table-bordered">
@@ -54,11 +65,49 @@
</div>
</div>
</form>
</div>
<th:block th:if="${mode=='change'}">
<div th:replace="~{footer :: footer}"></div>
</th:block>
<script th:inline="javascript">
const message = /*[[${message}]]*/ null;
if (message != null) {
alert(message);
}
function deleteCourse(button) {
const courseId = button.dataset.courseId;
const totalForm = document.getElementById("totalForm");
const input = document.createElement("input");
const radioButtons = totalForm.querySelectorAll('input[name="courseId"]');
radioButtons.forEach(radio => {
radio.disabled = true;
});
input.type = "hidden";
input.name = "courseId";
input.value = courseId;
totalForm.appendChild(input);
totalForm.action = "/course/delete";
totalForm.method = "post";
courseId.value = courseId;
totalForm.submit();
}
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
</body>

View File

@@ -3,10 +3,9 @@
<head>
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
<title>取引登録</title>
<link rel="stylesheet" th:href="@{/css/menu.css}">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" th:href="@{/css/style.css}">
<title>取引登録</title>
</head>
<body style="padding-top:80px; padding-bottom:80px;">
@@ -23,44 +22,33 @@
<div class="card-body">
<form th:action="@{/transaction/create}"
th:object="${transactionForm}"
method="post">
<form th:action="@{/transaction/create}" th:object="${transactionForm}" method="post">
<div class="mb-3">
<label for="transactionDate"
class="form-label">
<label for="transactionDate" class="form-label">
日付
</label>
<input type="date"
id="transactionDate"
class="form-select"
name="transactionDate"
th:value="*{transactionDate}"
required>
<input type="date" id="transactionDate" class="form-select" name="transactionDate"
th:value="*{transactionDate}" required>
</div>
<div class="mb-3">
<label for="transactionType"
class="form-label">
<label for="transactionType" class="form-label">
収入・支出
</label>
<select id="transactionType"
class="form-select"
th:field="*{transactionType}"
required>
<select id="transactionType" class="form-select" name="transactionType" required>
<option value="">
選択してください
</option>
<option value="1">
<option value="0">
支出
</option>
<option value="2">
<option value="1">
収入
</option>
@@ -70,23 +58,22 @@
<div class="mb-3">
<label for="categoryId"
class="form-label">
<label for="categoryId" class="form-label">
カテゴリ
</label>
<select id="categoryId"
class="form-select"
th:field="*{categoryId}"
required>
<select id="categoryId" class="form-select" th:field="*{categoryId}" required>
<option value="">
選択してください
</option>
<option th:each="category : ${categoryFormList}"
th:value="${category.categoryId}"
th:text="${category.categoryName}">
<option class="expenseListClass" th:each="category : ${expenseList}"
th:value="${category.categoryId}" th:text="${category.categoryName}">
</option>
<option class="incomeListClass" th:each="category : ${incomeList}"
th:value="${category.categoryId}" th:text="${category.categoryName}">
</option>
</select>
@@ -95,30 +82,20 @@
<div class="mb-3">
<label for="amount"
class="form-label">
<label for="amount" class="form-label">
金額
</label>
<input type="number"
id="amount"
class="form-control"
th:field="*{amount}"
min="0"
max="100000000"
placeholder="金額を入力してください"
required>
<input type="number" id="amount" class="form-control" th:field="*{amount}" min="1"
max="100000000" placeholder="金額を入力してください" required>
</div>
<input type="hidden"
name="today"
th:value="${today}">
<input type="hidden" name="today" th:value="${today}">
<div class="d-grid">
<button type="submit"
class="btn btn-primary">
<button type="submit" class="btn btn-primary">
登録
@@ -136,6 +113,67 @@
<div th:replace="~{footer :: footer}"></div>
<script th:inline="javascript">
const transactionType = document.getElementById("transactionType");
const categoryId = document.getElementById("categoryId");
const expenseList = document.getElementsByClassName("expenseListClass");
const incomeList = document.getElementsByClassName("incomeListClass");
const tType = '[[${session.tType}]]';
function toggleCategory() {
if (transactionType.value === "0") {
for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "";
}
for (let i = 0; i < incomeList.length; i++) {
incomeList[i].style.display = "none";
}
} else if (transactionType.value === "1") {
for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "none";
}
for (let i = 0; i < incomeList.length; i++) {
incomeList[i].style.display = "";
}
} else {
for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "none";
}
for (let i = 0; i < incomeList.length; i++) {
incomeList[i].style.display = "none";
}
}
}
transactionType.addEventListener("change", function () {
toggleCategory();
categoryId.value = "";
});
if (tType == "0") {
transactionType.value = "0";
} else if (tType == "1") {
transactionType.value = "1";
}
toggleCategory();
</script>
</body>

View File

@@ -90,6 +90,7 @@
<input type="hidden"
name="today"
id="today"
th:value="${today}">
<button class="btn btn-success w-100"
@@ -103,21 +104,49 @@
</div>
<div class="d-grid mt-4">
<form th:action="@{/fixed-cost/list}" method="get">
<input type="hidden"
name="today"
id="today"
th:value="${today}">
<button class="btn btn-dark w-100"
type="submit">
固定費一覧
</button>
</form>
</div>
<form th:action="@{/transaction/create}" method="get">
<input type="hidden" name="today" id="today" th:value="${today}">
<button type="submit">新規登録</button>
</form>
<form th:action="@{/fixed-cost/list}" method="get">
<input type="hidden" name="today" th:value="${today}">
<button type="submit">固定費一覧</button>
</form>
<form th:action="@{/category/list}" method="get">
<input type="hidden" name="today" th:value="${today}">
<button type="submit">カテゴリ一覧</button>
<div class="d-grid mt-4">
<form th:action="@{/category/list}"
method="get">
<input type="hidden"
name="today"
id="today"
th:value="${today}">
<button class="btn btn-dark w-100"
type="submit">
カテゴリ一覧
</button>
</form>
</div>
</div>
<div th:replace="~{footer :: footer}"></div>
</body>

View File

@@ -83,18 +83,33 @@
カテゴリ
</label>
<select id="categoryId"
class="form-select"
th:field="*{categoryId}"
required>
<!-- <select id="categoryId"-->
<!-- class="form-select"-->
<!-- th:field="*{categoryId}"-->
<!-- required>-->
<!-- <option value="">-->
<!-- 選択してください-->
<!-- </option>-->
<!-- <option th:each="category : ${categoryFormList}"-->
<!-- th:value="${category.categoryId}"-->
<!-- th:text="${category.categoryName}">-->
<!-- </option>-->
<!-- </select>-->
<select id="categoryId" class="form-select" th:field="*{categoryId}" required>
<option value="">
選択してください
</option>
<option th:each="category : ${categoryFormList}"
th:value="${category.categoryId}"
th:text="${category.categoryName}">
<option class="expenseListClass" th:each="category : ${expenseList}"
th:value="${category.categoryId}" th:text="${category.categoryName}">
</option>
<option class="incomeListClass" th:each="category : ${incomeList}"
th:value="${category.categoryId}" th:text="${category.categoryName}">
</option>
</select>
@@ -141,6 +156,68 @@
<div th:replace="~{footer :: footer}">
</div>
<script th:inline="javascript">
const transactionType = document.getElementById("transactionType");
const categoryId = document.getElementById("categoryId");
const expenseList = document.getElementsByClassName("expenseListClass");
const incomeList = document.getElementsByClassName("incomeListClass");
const tType = '[[${session.tType}]]';
function toggleCategory() {
if (transactionType.value === "0") {
for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "";
}
for (let i = 0; i < incomeList.length; i++) {
incomeList[i].style.display = "none";
}
} else if (transactionType.value === "1") {
for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "none";
}
for (let i = 0; i < incomeList.length; i++) {
incomeList[i].style.display = "";
}
} else {
for (let i = 0; i < expenseList.length; i++) {
expenseList[i].style.display = "none";
}
for (let i = 0; i < incomeList.length; i++) {
incomeList[i].style.display = "none";
}
}
}
transactionType.addEventListener("change", function () {
toggleCategory();
categoryId.value = "";
});
if (tType == "0") {
transactionType.value = "0";
} else if (tType == "1") {
transactionType.value = "1";
}
toggleCategory();
</script>
</body>
</html>

View File

@@ -3,16 +3,13 @@
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>新規会員登録</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css"
rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet"
th:href="@{/css/style.css}">
<link rel="stylesheet" th:href="@{/css/style.css}">
</head>
<body style="padding-top:80px; padding-bottom:80px;">
@@ -30,83 +27,55 @@
<div class="card-body">
<form th:action="@{/user/register/course}"
th:object="${userForm}"
method="post">
<form th:action="@{/user/register/course}" th:object="${userForm}" method="post">
<div class="mb-3">
<label for="userName"
class="form-label">
<label for="userName" class="form-label">
氏名
</label>
<input type="text"
id="userName"
class="form-control"
th:field="*{userName}"
maxlength="100"
<input type="text" id="userName" class="form-control" th:field="*{userName}" maxlength="100"
required>
</div>
<div class="mb-3">
<label for="mailAddress"
class="form-label">
<label for="mailAddress" class="form-label">
メールアドレス
</label>
<input type="email"
id="mailAddress"
class="form-control"
th:field="*{mailAddress}"
maxlength="255"
required>
<input type="email" id="mailAddress" class="form-control" th:field="*{mailAddress}"
maxlength="255" required>
</div>
<div class="mb-3">
<label for="birthDate"
class="form-label">
<label for="birthDate" class="form-label">
生年月日
</label>
<input type="date"
id="birthDate"
class="form-control"
th:field="*{birthDate}"
required>
<input type="date" id="birthDate" class="form-control" th:field="*{birthDate}" required>
</div>
<div class="mb-3">
<label for="password"
class="form-label">
<label for="password" class="form-label">
パスワード
</label>
<input type="password"
id="password"
class="form-control"
th:field="*{password}"
minlength="8"
maxlength="24"
required>
<input type="password" id="password" class="form-control" th:field="*{password}" minlength="8"
maxlength="24" required>
</div>
<div class="mb-3">
<label for="secretQuestionId"
class="form-label">
<label for="secretQuestionId" class="form-label">
秘密の質問
</label>
<select id="secretQuestionId"
class="form-select"
th:field="*{secretQuestionId}"
required>
<select id="secretQuestionId" class="form-select" th:field="*{secretQuestionId}" required>
<option value="">
選択してください
</option>
<option th:each="question : ${session.questionList}"
th:value="${question.secretQuestionId}"
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
th:text="${question.questionText}">
</option>
@@ -114,91 +83,59 @@
</div>
<div class="mb-3">
<label for="secretAnswer"
class="form-label">
<label for="secretAnswer" class="form-label">
秘密の質問の回答
</label>
<input type="text"
id="secretAnswer"
class="form-control"
th:field="*{secretAnswer}"
maxlength="100"
required>
<input type="text" id="secretAnswer" class="form-control" th:field="*{secretAnswer}"
maxlength="100" required>
</div>
<div class="mb-3">
<label for="saving"
class="form-label">
<label for="saving" class="form-label">
貯蓄金
</label>
<input type="number"
id="saving"
class="form-control"
th:field="*{saving}"
min="0"
max="1000000000"
required>
<input type="number" id="saving" class="form-control" th:field="*{saving}" min="0"
max="1000000000" required>
</div>
<div class="mb-3">
<label for="annualIncome"
class="form-label">
<label for="annualIncome" class="form-label">
年収
</label>
<input type="number"
id="annualIncome"
class="form-control"
th:field="*{annualIncome}"
min="0"
max="100000000"
required>
<input type="number" id="annualIncome" class="form-control" th:field="*{annualIncome}" min="0"
max="100000000" required>
</div>
<div class="mb-3">
<label for="monthlyBudget"
class="form-label">
<label for="monthlyBudget" class="form-label">
月別使用可能金額
</label>
<input type="number"
id="monthlyBudget"
class="form-control"
th:field="*{monthlyBudget}"
min="0"
max="10000000"
required>
<input type="number" id="monthlyBudget" class="form-control" th:field="*{monthlyBudget}" min="0"
max="10000000" required>
</div>
<div class="mb-3">
<label for="goalId"
class="form-label">
<label for="goalId" class="form-label">
目標貯金額
</label>
<input type="number"
id="goalId"
class="form-control"
th:field="*{goalId}"
min="0"
max="1000000000"
required>
<input type="number" id="goalId" class="form-control" th:field="*{goalId}" min="0"
max="1000000000" required>
</div>
<input type="hidden"
th:field="*{courseId}">
<input type="hidden" th:field="*{courseId}">
<div class="d-grid gap-2 mt-4">
<button type="submit"
class="btn btn-outline-primary">
<button type="submit" class="btn btn-outline-primary">
コース選択
</button>
<button type="submit"
class="btn btn-primary">
<button type="submit" class="btn btn-primary">
作成
</button>
@@ -212,11 +149,9 @@
<div class="d-grid mt-3">
<form th:action="@{/login}"
method="get">
<form th:action="@{/login}" method="get">
<button type="submit"
class="btn btn-outline-secondary">
<button type="submit" class="btn btn-outline-secondary">
戻る
</button>
@@ -226,6 +161,34 @@
</div>
<script>
const date = new Date();
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const birthDate = document.getElementById("birthDate");
if (month < 10) {
if (day < 10) {
birthDate.setAttribute("max", year + "-0" + month + "-0" + day);
} else {
birthDate.setAttribute("max", year + "-0" + month + "-" + day);
}
} else {
if (day < 10) {
birthDate.setAttribute("max", year + "-" + month + "-0" + day);
} else {
birthDate.setAttribute("max", year + "-" + month + "-" + day);
}
}
</script>
</body>
</html>

View File

@@ -44,10 +44,10 @@
<div class="mb-3">
<label for="secretQuestionId" class="form-label">秘密の質問</label>
<select id="secretQuestionId" th:field="*{secretQuestionId}" required readonly>
<option value="">選択してください</option>
<select id="secretQuestionId" th:field="*{secretQuestionId}" required disabled>
<option value="" readonly>選択してください</option>
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
th:text="${question.questionText}">
th:text="${question.questionText}" readonly>
</option>
</select>
</div>
@@ -82,7 +82,7 @@
<div class="d-flex justify-content-between align-items-center">
<input type="hidden" class="form-control" th:field="*{courseId}">
<span th:text="${selectedCourseName}">未選択</span>
<button type="submit" class="btn btn-outline-primary btn-sm">コース選択</button>
<button type="submit" class="btn btn-outline-primary btn-sm" disabled>コース選択</button>
</div>
</div>

View File

@@ -1,12 +1,14 @@
<!DOCTYPE html>
<html lang="ja"xmlns:th="http://www.thymeleaf.org">
<html lang="ja" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
<title>新規会員登録</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" th:href="@{/css/style.css}">
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
<title>新規会員登録</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" th:href="@{/css/style.css}">
</head>
<body>
<div th:replace="~{header :: header}">
</div>
@@ -22,22 +24,14 @@
<form th:action="@{/user/register/confirm}" th:object="${userForm}" method="get">
<div class="mb-3">
<label for="userName" class="form-label">氏名</label>
<input type="text"
id="userName"
class="form-control"
th:field="*{userName}"
maxlength="100"
<input type="text" id="userName" class="form-control" th:field="*{userName}" maxlength="100"
required>
</div>
<div class="mb-3">
<label for="mailAddress" class="form-label">メールアドレス</label>
<input type="email"
id="mailAddress"
class="form-control"
th:field="*{mailAddress}"
maxlength="255"
required>
<input type="email" id="mailAddress" class="form-control" th:field="*{mailAddress}"
maxlength="255" required>
</div>
<div class="mb-3">
@@ -48,24 +42,15 @@
<div class="mb-3">
<label for="password" class="form-label">パスワード</label>
<input type="password"
id="password"
name="password"
class="form-control"
th:value="*{password}"
minlength="8"
maxlength="24"
required>
<input type="password" id="password" name="password" class="form-control" th:value="*{password}"
minlength="8" maxlength="24" required>
</div>
<div class="mb-3">
<label for="secretQuestionId" class="form-label">秘密の質問</label>
<select id="secretQuestionId"
th:field="*{secretQuestionId}"
required>
<select id="secretQuestionId" th:field="*{secretQuestionId}" required>
<option value="">選択してください</option>
<option th:each="question : ${session.questionList}"
th:value="${question.secretQuestionId}"
<option th:each="question : ${session.questionList}" th:value="${question.secretQuestionId}"
th:text="${question.questionText}">
</option>
</select>
@@ -73,52 +58,30 @@
<div class="mb-3">
<label for="secretAnswer" class="form-label">秘密の質問の回答</label>
<input type="text"
id="secretAnswer"
class="form-control"
th:field="*{secretAnswer}"
maxlength="100"
required>
<input type="text" id="secretAnswer" class="form-control" th:field="*{secretAnswer}"
maxlength="100" required>
</div>
<div class="mb-3">
<label for="saving" class="form-label">貯蓄金</label>
<input type="number"
id="saving"
class="form-control"
th:field="*{saving}"
min="0"
required>
<input type="number" id="saving" class="form-control" th:field="*{saving}" min="0" required>
</div>
<div class="mb-3">
<label for="annualIncome" class="form-label">年収</label>
<input type="number"
id="annualIncome"
class="form-control"
th:field="*{annualIncome}"
min="0"
<input type="number" id="annualIncome" class="form-control" th:field="*{annualIncome}" min="0"
required>
</div>
<div class="mb-3">
<label for="monthlyBudget" class="form-label">月別使用可能金額</label>
<input type="number"
id="monthlyBudget"
class="form-control"
th:field="*{monthlyBudget}"
min="0"
<input type="number" id="monthlyBudget" class="form-control" th:field="*{monthlyBudget}" min="0"
required>
</div>
<div class="mb-3">
<label for="goalId" class="form-label">目標</label>
<input type="number"
id="goalId"
class="form-control"
th:field="*{goalId}"
min="0"
required>
<label for="goalId" class="form-label">目標貯金額</label>
<input type="number" id="goalId" class="form-control" th:field="*{goalId}" min="0" required>
</div>
<div class="mb-4">
@@ -126,7 +89,7 @@
<div class="d-flex justify-content-between align-items-center">
<input type="hidden" th:field="*{courseId}">
<span th:text="${selectedCourseName}">未選択</span>
<button type="submit" class="btn btn-outline-primary btn-sm">
<button class="btn btn-outline-primary btn-sm" disabled>
コース選択
</button>
</div>
@@ -149,5 +112,34 @@
</div>
</div>
<script>
const date = new Date();
const year = date.getFullYear();
const month = date.getMonth() + 1;
const day = date.getDate();
const birthDate = document.getElementById("birthDate");
if (month < 10) {
if (day < 10) {
birthDate.setAttribute("max", year + "-0" + month + "-0" + day);
} else {
birthDate.setAttribute("max", year + "-0" + month + "-" + day);
}
} else {
if (day < 10) {
birthDate.setAttribute("max", year + "-" + month + "-0" + day);
} else {
birthDate.setAttribute("max", year + "-" + month + "-" + day);
}
}
</script>
</body>
</html>