149 Commits

Author SHA1 Message Date
2da75305fd Merge remote-tracking branch 'origin/k-kobayashi' into k-oshita
# Conflicts:
#	src/main/java/com/example/demo/app/domain/service/impl/CourseServiceImpl.java
2026-09-18 10:56:22 +09:00
f55ece4dc7 「STYLE] 目標名を追記しました。 2026-09-18 10:55:37 +09:00
kkazuya
b9e6b5662b [EDIT] スペース追加 2026-09-18 10:53:53 +09:00
0a63c81712 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-18 10:39:13 +09:00
571fcc6d90 [add]余分なファイルをコミットしました 2026-09-18 10:16:49 +09:00
15185672c4 s-choiブランチとのマージ完了 2026-09-18 10:08:41 +09:00
3833689759 [ADD]目標を管理するため機能の追加 2026-09-18 10:05:15 +09:00
kkazuya
c091b0491a Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 17:00:25 +09:00
s-choi
902167b663 [FIX] 数式エラーを修正しました。 2026-09-17 17:00:02 +09:00
s-choi
4590c9e5fe [FIX] 遷移先の住所を修正しました。 2026-09-17 16:59:40 +09:00
s-choi
aa5bf0c64e [FIX] 不要なフィールドを削除しました。 2026-09-17 16:58:40 +09:00
0bec7b3b3b [EDIT]目標モデルの改行 2026-09-17 16:52:56 +09:00
d59cf78062 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-17 16:50:04 +09:00
f68a2569bd [FIX]ユーザー取得の例外処理を記述しました 2026-09-17 16:36:43 +09:00
kkazuya
fbec462f65 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 16:35:42 +09:00
a7d61be450 [FIX]分析値の「ー」部分の修正をしました。 2026-09-17 16:33:26 +09:00
s-choi
830d8a672f Merge remote-tracking branch 'origin/s-morimto' into s-choi 2026-09-17 16:31:50 +09:00
kkazuya
8b9765852b Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 16:31:50 +09:00
kkazuya
ae53f3e733 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 16:31:41 +09:00
d87bdfbe91 [EDIT]controllerの修正 2026-09-17 16:28:23 +09:00
s-choi
22191e63ef Merge remote-tracking branch 'origin/s-morimto' into s-choi 2026-09-17 16:27:57 +09:00
kkazuya
e261065a62 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 16:26:31 +09:00
49ad550839 [EDIT]メールアドレスの追加 2026-09-17 16:25:46 +09:00
s-choi
bd2cad7c34 Merge remote-tracking branch 'origin/n-kawahito' into s-choi
# Conflicts:
#	src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java
2026-09-17 16:18:45 +09:00
s-choi
db7fc1d16d Merge remote-tracking branch 'origin/s-morimto' into s-choi
# Conflicts:
#	src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java
2026-09-17 16:17:50 +09:00
662e3433d2 [EDIT]目標のModelの変換部分の修正 2026-09-17 16:12:15 +09:00
23232954f1 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-17 16:08:12 +09:00
4e3477af77 [EDIT]分析値の+-表記と色分けについて記述しました 2026-09-17 16:07:35 +09:00
kkazuya
296bcf8d70 Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 16:03:38 +09:00
kkazuya
544cbd0ac8 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 16:02:58 +09:00
kkazuya
0eddd7889f Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi
# Conflicts:
#	src/main/java/com/example/demo/app/infra/repository/AllocationRepository.java
2026-09-17 16:02:22 +09:00
192191d352 [ADD]パスワード再設定の作成 2026-09-17 15:59:33 +09:00
kkazuya
bda791567c [ADD] コース選択画面を作成しました。 2026-09-17 15:50:43 +09:00
kkazuya
1e09463984 [ADD] コース選択画面に遷移するCourseControllerを作成しました。 2026-09-17 15:50:11 +09:00
kkazuya
a89c54f8c0 [ADD] Course, CoureseInfoのサービスとそれを実装したクラスを作成しました。 2026-09-17 15:49:11 +09:00
cbaee01d13 [EDIT]支出分析画面を追記し、作成しました。 2026-09-17 15:48:17 +09:00
2dad64ab10 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-17 15:34:38 +09:00
9b51b26b0e [EDIT]AnalysisControllerのform変換コードの追記をしました 2026-09-17 15:33:55 +09:00
646c37ea57 [ADD]認証機能の作成 2026-09-17 15:33:17 +09:00
a5799843d3 [ADD]支出分析画面のためのformクラスを作成しました。 2026-09-17 15:33:02 +09:00
kkazuya
7a13d9cdda Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 15:31:40 +09:00
kkazuya
0c5f4a8c9b Merge branch 'k-oshita' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi
# Conflicts:
#	src/main/java/com/example/demo/app/infra/repository/GoalRepository.java
2026-09-17 15:31:20 +09:00
kkazuya
c5d1814be4 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 15:25:03 +09:00
60d4ebd74f Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 15:13:57 +09:00
s-choi
1b6193082d 「FIX] 収支処理のURLを指定しました。 2026-09-17 14:52:46 +09:00
s-choi
86e41765f5 [FIX] JPQLの変数を修正しました。 2026-09-17 14:52:24 +09:00
s-choi
804e4a6fdd [FIX] JQPLの変数名とテーブル名を修正しました。 2026-09-17 14:51:11 +09:00
ca7e93908d [FIX]HOTFIXに合わせて、変数名を変更しました。 2026-09-17 14:43:44 +09:00
a735162974 [EDIT]支出分析のためのサービス実装部分を記述しました。 2026-09-17 14:43:11 +09:00
49af15f939 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 14:36:29 +09:00
s-choi
2e64d623b5 [FIX] 主キーの型を修正しました。 2026-09-17 14:32:48 +09:00
kkazuya
170e319dca [ADD] CourseInfoModelを作成しました 2026-09-17 14:31:35 +09:00
kkazuya
6b91c91c19 [ADD] Course, CourseInfoFormを作成しました 2026-09-17 14:29:59 +09:00
s-choi
1c5cb6bf7a [HOTFIX] Entityのキーを再定義しました。 2026-09-17 14:28:44 +09:00
s-choi
e2286762d6 [ADD] Allocationの複合キークラスを作成しました。 2026-09-17 14:27:59 +09:00
ce0a158988 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 14:23:41 +09:00
3d3177bbfa [ADD]新規会員登録機能の作成 2026-09-17 14:23:30 +09:00
54b909d00d [ADD] 目標のためのModelを作成しました。 2026-09-17 14:22:06 +09:00
kkazuya
0c19adb63f Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 14:20:43 +09:00
kkazuya
f86d47c17a [EDIT] AllocationRepositoryにコース一覧に表示するデータを取得する@Queryを追加しました 2026-09-17 14:20:34 +09:00
a98554ac69 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-17 14:17:43 +09:00
0b336dcf5a [EDIT] 改行・コード位置を調整しました。 2026-09-17 14:16:29 +09:00
s-choi
cf31d03415 [FIX] IDの型を修正しました。 2026-09-17 14:16:19 +09:00
s-choi
80d83b96f4 [FIX] import及び型の修正を行いました。 2026-09-17 14:15:59 +09:00
kkazuya
7f828657ad [ADD] Allocation, CourseのModelを追加しました。 2026-09-17 14:09:06 +09:00
kkazuya
064b74c49b Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 14:04:29 +09:00
kkazuya
4fc69cddb3 [EDIT] Course, AllocationEntityのテーブル名を修正 2026-09-17 14:04:20 +09:00
68fbe40385 [EDIT] 改行・コードを調整しました。 2026-09-17 14:03:44 +09:00
s-choi
c7e68f6a4f [EDIT] Table名を変更しました。 2026-09-17 14:03:13 +09:00
s-choi
083ad8644d [EDIT] Viewの遷移先アドレスを変更しました。 2026-09-17 14:02:54 +09:00
9ae0669739 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 14:01:56 +09:00
f03638b347 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 14:01:32 +09:00
s-choi
7e648b9466 Merge remote-tracking branch 'origin/s-morimto' into s-choi 2026-09-17 14:00:47 +09:00
54512e411a [ADD]QuestionRepositoryの作成 2026-09-17 13:59:17 +09:00
867926391f [ADD] 目標のためのRepositoryを作成しました。 2026-09-17 13:56:58 +09:00
b0e675d32e Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 13:52:56 +09:00
s-choi
19989111ec [EDIT] 改行・コード位置を調整しました。 2026-09-17 13:48:08 +09:00
s-choi
4f49c24c99 [EDIT] ModelからEntityへ変換するメソッドを作成しました。 2026-09-17 13:47:39 +09:00
s-choi
8763f88de4 [EDIT] 収支の登録・修正機能を追加しました。日付のDefault値を設定し、Session
Attribute・オブジェクトの型を修正しました。
2026-09-17 13:47:01 +09:00
s-choi
5ab8109504 [EDIT] 名前で検索できる機能を追加しました。 2026-09-17 13:44:57 +09:00
be286201f5 [ADD]新規会員登録とその確認画面の作成 2026-09-17 13:44:47 +09:00
s-choi
d31d6aaf2d [EDIT] 名前で検索できる機能を追加しました。 2026-09-17 13:44:33 +09:00
86c6910c4a Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 13:29:15 +09:00
s-choi
42bb3c608f Merge remote-tracking branch 'origin/s-morimto' into s-choi 2026-09-17 13:06:35 +09:00
c279045228 [ADD]LoginModelの作成 2026-09-17 13:04:34 +09:00
72477d014b Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-17 13:02:47 +09:00
s-choi
67ad98b0ae Merge remote-tracking branch 'origin/s-morimto' into s-choi 2026-09-17 13:02:40 +09:00
d65a84ea79 [EDIT]transactionRepositoryにカテゴリ別集計を追記しました。 2026-09-17 13:00:25 +09:00
79cbbc1f2b [EDIT]serviceとcontrollerの修正 2026-09-17 12:59:17 +09:00
cef08f1663 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-17 12:51:54 +09:00
kkazuya
792172664c Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 12:44:49 +09:00
1170c710e3 [EDIT]repositoryの修正 2026-09-17 12:41:41 +09:00
fbd1746776 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-17 12:37:53 +09:00
s-choi
073ed5e864 [STYLE] 改行を追加しました。 2026-09-17 12:36:35 +09:00
9bc5bd20ac [DELETE&ADD]AnalysisServiceImpl.javaのファイル位置を修正しました 2026-09-17 11:29:54 +09:00
kkazuya
882212aed5 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 11:24:54 +09:00
5506f5884b [EDIT]AllocationRepositoryにcategoryId取得の作成 2026-09-17 11:24:37 +09:00
s-choi
844c023ef2 Merge remote-tracking branch 'origin/s-morimto' into s-choi
# Conflicts:
#	src/main/java/com/example/demo/app/infra/entity/UserEntity.java
2026-09-17 11:18:26 +09:00
a6a9cb0b63 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-17 11:16:43 +09:00
kkazuya
1369d839af Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 11:16:21 +09:00
kkazuya
7f454b852a [ADD] AllocationRepositoryを作成しました。 2026-09-17 11:16:12 +09:00
s-choi
544ce423d0 [EDIT] userIdによる検索機能に日付も入力するように変更しました。 2026-09-17 11:12:26 +09:00
6c24eba7bf [ADD]UserModelの作成 2026-09-17 11:08:44 +09:00
s-choi
6847f225c4 [EDIT] userIdによる収支検索、期間設定機能がある検索、収入・支出の検索機能のサービス段を作成しました。 2026-09-17 11:01:39 +09:00
s-choi
036a495bc7 [EDIT] userIdによる収支検索、期間設定機能がある検索、収入・支出の検索機能を追加しました。 2026-09-17 11:00:40 +09:00
3d857952c9 [ADD]ログイン機能の作成 2026-09-17 10:59:59 +09:00
s-choi
534fc2683d [EDIT] Formクラスへフィールドを追加しました。 2026-09-17 10:57:53 +09:00
s-choi
555d8ceb87 [EDIT] EntityからModelへの変換メソッドを作成しました。 2026-09-17 10:57:22 +09:00
83e97b7ec1 [ADD]支出分析画面(骨組み)の作成 2026-09-17 10:56:57 +09:00
s-choi
60159ea3fe [FIX] Userの主キーの型を修正しました。 2026-09-17 10:56:45 +09:00
kkazuya
f1b5e3eaf8 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 10:49:58 +09:00
s-choi
3e0c6092aa [EDIT] interfaceにメソッドの宣言を追加しました。 2026-09-17 10:48:42 +09:00
kkazuya
59cec2fed7 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 10:47:23 +09:00
s-choi
8aba950a5f [EDIT] 特定のカテゴリレコードを取得するサービスメソッドを作成しました。 2026-09-17 10:47:01 +09:00
c21e90185b [DELETE]testの削除 2026-09-17 10:41:19 +09:00
s-choi
4774badffe Merge remote-tracking branch 'origin/k-kobayashi' into s-choi 2026-09-17 10:36:28 +09:00
kkazuya
743fe20e9a Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-17 10:36:08 +09:00
s-choi
f3d599e696 [EDIT] EntityからModelへの変換メソッドを作成しました。 2026-09-17 10:35:49 +09:00
91823240da [ADD]test 2026-09-17 10:35:32 +09:00
kkazuya
7a38ba8e63 [ADD] CategoryFormを作成しました。 2026-09-17 10:35:28 +09:00
s-choi
493dd26367 [ADD] Categoryのビジネスロジック作成のためのサービスクラスを作成しました。 2026-09-17 10:35:22 +09:00
kkazuya
cf732c7a48 [ADD] CategoryModelを作成しました 2026-09-17 10:30:49 +09:00
5b9db556e0 [EDIT]AnalysisServiceのアノテーションを追加しました 2026-09-17 10:06:34 +09:00
e38153238d [ADD]支出分析のためのControllerを作成しました。 2026-09-17 10:05:17 +09:00
841a19688d [ADD]AnalysisServiceのIFクラス及びAnalysisServiceImplの実装クラスを作成しました 2026-09-17 09:44:39 +09:00
8c4539dd49 [DELETE]AnalysisRepositoryを削除しました 2026-09-17 09:21:02 +09:00
kkazuya
e361e02aa8 [ADD] Category, Course, AllocationのRepositoryを作成しました。 2026-09-16 16:34:31 +09:00
kkazuya
837a82ef9a Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-16 16:30:49 +09:00
38b2c1b2cb Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-16 15:44:09 +09:00
16477f4ba1 [ADD]支出分析の総支出の比較を行う際にレイヤー間でのデータ転送を行うため、AnalysisModelを作成しました。 2026-09-16 15:43:41 +09:00
ad717036b4 [DELETE]AnalysisModelの削除 2026-09-16 15:41:18 +09:00
c7098f2ec3 Revert "Revert "[ADD]支出分析のカテゴリーごとの比較を行う際にレイヤー間でのデータ転送を行うため、CategoryAnalysisModelを作成しました。""
This reverts commit 67cd3e27ca.
2026-09-16 15:38:39 +09:00
67cd3e27ca Revert "[ADD]支出分析のカテゴリーごとの比較を行う際にレイヤー間でのデータ転送を行うため、CategoryAnalysisModelを作成しました。"
This reverts commit b2662693c2.
2026-09-16 15:38:17 +09:00
b2662693c2 [ADD]支出分析のカテゴリーごとの比較を行う際にレイヤー間でのデータ転送を行うため、CategoryAnalysisModelを作成しました。 2026-09-16 15:37:57 +09:00
s-choi
e8eef1aa73 Merge remote-tracking branch 'origin/k-kobayashi' into s-choi 2026-09-16 15:27:09 +09:00
kkazuya
40ada62856 Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-16 15:26:29 +09:00
acd31c9f2a Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-16 15:17:55 +09:00
842f2b55f8 [ADD]支出分析のためのAnalysisRepositoryを作成しました。 2026-09-16 15:16:48 +09:00
s-choi
c093fcad24 [RENAME] 収支Controllerの名前をSelectTransactionControllerからTransactionControllerに変更しました。 2026-09-16 15:08:26 +09:00
s-choi
bae92ded58 [ADD] 収支のためのService及び実装クラスを作成しました。 2026-09-16 15:07:45 +09:00
s-choi
210579de68 [ADD] 収支のためのRepositoryを作成しました。 2026-09-16 15:07:28 +09:00
s-choi
05797d47d4 [EDIT] 収支Entityの主キーの型を修正しました。 2026-09-16 15:03:28 +09:00
kkazuya
9710b52d8d [EDIT] Category, CourseEntityのIDの型をlong⇒Longに変更 2026-09-16 15:03:18 +09:00
s-choi
0561541bec [ADD] 収支のためのFormを作成しました。 2026-09-16 15:03:04 +09:00
s-choi
a800606bb2 [ADD] 収支のためのModelを作成しました。 2026-09-16 15:02:35 +09:00
kkazuya
c41bcd1791 [EDIT] Categoruy, CourseEntityのIDの型をlongに変更しました。 2026-09-16 14:56:27 +09:00
s-choi
3e2af36bfb [FIX] Entity間の関係を修正しました。 2026-09-16 14:50:58 +09:00
s-choi
c9d0985c7f [ADD] システムに必要なEntityクラスを作成しました。 2026-09-16 14:36:44 +09:00
s-choi
d9a556717c [ADD] 共通定数定義のためのクラスを作成しました。 2026-09-16 13:53:04 +09:00
55 changed files with 2280 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
package com.example.demo.app.domain.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class AllocationModel {
private Long categoryId;
private Long courseId;
private Integer allocationRatio;
}

View File

@@ -0,0 +1,20 @@
package com.example.demo.app.domain.model;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class AnalysisModel {
private Integer currentMonthTotalAmount;
private Integer previousMonthTotalAmount;
private Integer totalDifferenceAmount;
private List<CategoryAnalysisModel>
categoryAnalysisModelList;
}

View File

@@ -0,0 +1,21 @@
package com.example.demo.app.domain.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class CategoryAnalysisModel {
private String categoryName;
private Integer currentMonthAmount;
private Integer previousMonthAmount;
private Integer monthDifferenceAmount;
private Integer courseLimitAmount;
private Integer courseDifferenceAmount;
}

View File

@@ -0,0 +1,30 @@
package com.example.demo.app.domain.model;
import java.util.List;
import com.example.demo.app.infra.entity.CategoryEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class CategoryModel {
private Long categoryId;
private String categoryName;
private Integer transactionType;
public static CategoryModel convertFrom(CategoryEntity categoryEntity) {
return new CategoryModel(
categoryEntity.getCategoryId(),
categoryEntity.getCategoryName(),
categoryEntity.getTransactionType());
}
public static List<CategoryModel> convertFrom(List<CategoryEntity> categoryEntityList) {
return categoryEntityList.stream().map(CategoryModel::convertFrom).toList();
}
}

View File

@@ -0,0 +1,20 @@
package com.example.demo.app.domain.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class CourseInfoModel {
private Long courseId;
private String courseName;
private Long categoryId;
private String categoryName;
private Integer allocationRatio;
}

View File

@@ -0,0 +1,28 @@
package com.example.demo.app.domain.model;
import java.util.List;
import com.example.demo.app.infra.entity.CourseEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class CourseModel {
private Long courseId;
private String courseName;
private String description;
public static CourseModel convertFrom(CourseEntity courseEntity) {
return new CourseModel(
courseEntity.getCourseId(),
courseEntity.getCourseName(),
courseEntity.getDescription());
}
public static List<CourseModel> convertFrom(List<CourseEntity> courseEntityList) {
return courseEntityList.stream().map(CourseModel::convertFrom).toList();
}
}

View File

@@ -0,0 +1,58 @@
package com.example.demo.app.domain.model;
import java.time.LocalDate;
import com.example.demo.app.infra.entity.GoalEntity;
import com.example.demo.app.presentation.form.GoalForm;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class GoalModel {
private Long goalId;
private String goalTitle;
private String goalSubtitle;
private Integer targetAmount;
private LocalDate deadline;
private Integer goalComplete;
public static GoalModel convertFrom(GoalEntity goalEntity) {
return new GoalModel(
goalEntity.getGoalId(),
goalEntity.getGoalTitle(),
goalEntity.getGoalSubtitle(),
goalEntity.getTargetAmount(),
goalEntity.getDeadline(),
goalEntity.getGoalComplete());
}
public static GoalEntity convertTo(GoalModel goalModel) {
return new GoalEntity(
goalModel.getGoalId(),
goalModel.getGoalTitle(),
goalModel.getGoalSubtitle(),
goalModel.getTargetAmount(),
goalModel.getDeadline(),
goalModel.getGoalComplete(),
null);
}
public static GoalModel convertFrom(GoalForm goalForm) {
return new GoalModel(
goalForm.getGoalId(),
goalForm.getGoalTitle(),
goalForm.getGoalSubtitle(),
goalForm.getTargetAmount(),
goalForm.getDeadline(),
goalForm.getGoalComplete());
}
}

View File

@@ -0,0 +1,10 @@
package com.example.demo.app.domain.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class LoginModel {
private Long userId;
}

View File

@@ -0,0 +1,49 @@
package com.example.demo.app.domain.model;
import java.time.LocalDate;
import java.util.List;
import com.example.demo.app.infra.entity.CategoryEntity;
import com.example.demo.app.infra.entity.TransactionEntity;
import com.example.demo.app.infra.entity.UserEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class TransactionModel {
private Long transactionId;
private Long userId;
private Long categoryId;
private Integer amount;
private LocalDate transactionDate;
public static TransactionModel convertFrom(TransactionEntity transactionEntity) {
return new TransactionModel(
transactionEntity.getTransactionId(),
transactionEntity.getUserEntity().getUserId(),
transactionEntity.getCategoryEntity().getCategoryId(),
transactionEntity.getAmount(),
transactionEntity.getTransactionDate());
}
public static List<TransactionModel> convertFrom(List<TransactionEntity> transactionEntityList) {
return transactionEntityList.stream().map(TransactionModel::convertFrom).toList();
}
public static TransactionEntity convertTo(TransactionModel transactionModel, UserEntity userEntity, CategoryEntity categoryEntity) {
return new TransactionEntity(
transactionModel.getTransactionId(),
userEntity,
categoryEntity,
transactionModel.getAmount(),
transactionModel.getTransactionDate());
}
}

View File

@@ -0,0 +1,25 @@
package com.example.demo.app.domain.model;
import java.time.LocalDate;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class UserModel {
private Long userId;
private String userName;
private String emailAddress;
private String password;
private Integer secretQuestionId;
private String secretAnswer;
private LocalDate brithDate;
private Integer saving;
private Integer annualIncome;
private Integer monthlyBudget;
private Integer goalId;
private Integer courseId;
private Integer deleteFlag;
}

View File

@@ -0,0 +1,9 @@
package com.example.demo.app.domain.service;
import com.example.demo.app.domain.model.AnalysisModel;
public interface AnalysisService {
AnalysisModel getAnalysis(Long userId);
}

View File

@@ -0,0 +1,14 @@
package com.example.demo.app.domain.service;
import java.util.List;
import com.example.demo.app.domain.model.CategoryModel;
public interface CategoryService {
public List<CategoryModel> findAll();
public CategoryModel findOne(Long categoryId);
public CategoryModel findOneByCategoryName(String categoryName);
}

View File

@@ -0,0 +1,15 @@
package com.example.demo.app.domain.service;
import com.example.demo.app.domain.model.GoalModel;
public interface GoalService {
GoalModel getGoalById(Long goalId);
GoalModel createGoal(GoalModel goalModel);
GoalModel updateGoal(GoalModel goalModel);
// void deleteGoal(Long goalId);
}

View File

@@ -0,0 +1,9 @@
package com.example.demo.app.domain.service;
import com.example.demo.app.domain.model.LoginModel;
public interface LoginService {
LoginModel login(String mailAddress, String password);
}

View File

@@ -0,0 +1,23 @@
package com.example.demo.app.domain.service;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import com.example.demo.app.domain.model.TransactionModel;
public interface TransactionService {
public Map<LocalDate, List<TransactionModel>> findAllByDate(LocalDate startDate, LocalDate endDate, Long userId);
public List<TransactionModel> findByUserIdAndDate(LocalDate todayDate, Long userId);
public int findTotalIncome(LocalDate startDate, LocalDate endDate, Long userId);
public int findTotalexpense(LocalDate startDate, LocalDate endDate, Long userId);
public int createTransaction(TransactionModel transactionModel);
public int updateTransaction(TransactionModel transactionModel);
}

View File

@@ -0,0 +1,144 @@
package com.example.demo.app.domain.service.impl;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.AnalysisModel;
import com.example.demo.app.domain.model.CategoryAnalysisModel;
import com.example.demo.app.domain.service.AnalysisService;
import com.example.demo.app.infra.entity.AllocationEntity;
import com.example.demo.app.infra.entity.CategoryEntity;
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.TransactionRepository;
import com.example.demo.app.infra.repository.UserRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class AnalysisServiceImpl implements AnalysisService {
//Repositoryの呼び出し
private final TransactionRepository transactionRepository;
private final AllocationRepository allocationRepository;
private final UserRepository userRepository;
private final CategoryRepository categoryRepository;
@Override
public AnalysisModel getAnalysis(Long userId) {
// ユーザー情報取得、月別使用可能資金取得
UserEntity userEntity = userRepository.findById(userId).orElseThrow(() ->
new RuntimeException(
"User not found."));
// コースID取得
Long courseId = userEntity.getCourseEntity().getCourseId();
// 月別使用可能資金取得
Integer monthlyBudget =userEntity.getMonthlyBudget();
// 今月の期間取得
LocalDate currentMonthStartDate = LocalDate.now().withDayOfMonth(1);
LocalDate currentMonthEndDate = LocalDate.now().withDayOfMonth(LocalDate.now().lengthOfMonth());
// 前月の期間取得
LocalDate previousMonthStartDate = LocalDate.now().minusMonths(1).withDayOfMonth(1);
LocalDate previousMonthEndDate = LocalDate.now().minusMonths(1).withDayOfMonth(LocalDate.now().minusMonths(1).lengthOfMonth());
// 今月の支出取得
Integer currentMonthTotalAmount = transactionRepository.findTotalExpense(currentMonthStartDate, currentMonthEndDate, userId);
if (currentMonthTotalAmount == null) {
currentMonthTotalAmount = 0;
}
// 前月の支出取得
Integer previousMonthTotalAmount = transactionRepository.findTotalExpense(previousMonthStartDate, previousMonthEndDate, userId);
if (previousMonthTotalAmount == null) {
previousMonthTotalAmount = 0;
}
//総支出差額算出
Integer totalDifferenceAmount = currentMonthTotalAmount - previousMonthTotalAmount;
//カテゴリ一覧取得
List<CategoryAnalysisModel> categoryAnalysisModelList = new ArrayList<>();
List<CategoryEntity> categoryEntityList = categoryRepository.findAll();
List<AllocationEntity> allocationEntityList = allocationRepository.findByCourseEntity_CourseId(courseId);
//取得ループ
for (CategoryEntity categoryEntity : categoryEntityList) {
if (categoryEntity.getTransactionType() != 0) {
continue;
}
// カテゴリ別今月金額取得
Integer currentMonthAmount =
transactionRepository.findCategoryExpense(currentMonthStartDate,
currentMonthEndDate,
userId,
categoryEntity.getCategoryId());
// カテゴリ別前月金額取得
Integer previousMonthAmount =
transactionRepository.findCategoryExpense(previousMonthStartDate,
previousMonthEndDate,
userId,
categoryEntity.getCategoryId());
if (currentMonthAmount == null) {
currentMonthAmount = 0;
}
if (previousMonthAmount == null) {
previousMonthAmount = 0;
}
// カテゴリ別前月差額算出
Integer monthDifferenceAmount = currentMonthAmount - previousMonthAmount;
// コース配分取得
AllocationEntity allocationEntity = allocationEntityList.stream().filter(allocation ->
allocation.getCategoryEntity()
.getCategoryId()
.equals(categoryEntity.getCategoryId()))
.findFirst()
.orElse(null);
Integer allocationRatio = 0;
if (allocationEntity != null) {
allocationRatio =
allocationEntity.getAllocationRatio();
}
// コース限度額算出
Integer courseLimitAmount = monthlyBudget * allocationRatio / 100;
// コース差額算出
Integer courseDifferenceAmount = currentMonthAmount - courseLimitAmount;
// CategoryAnalysisModel生成
CategoryAnalysisModel categoryAnalysisModel = new CategoryAnalysisModel(
categoryEntity.getCategoryName(),
currentMonthAmount,
previousMonthAmount,
monthDifferenceAmount,
courseLimitAmount,
courseDifferenceAmount);
categoryAnalysisModelList.add(categoryAnalysisModel);
}
// AnalysisModelの生成
return new AnalysisModel(currentMonthTotalAmount, previousMonthTotalAmount, totalDifferenceAmount, categoryAnalysisModelList);
}
}

View File

@@ -0,0 +1,51 @@
package com.example.demo.app.domain.service.impl;
import java.util.List;
import java.util.Optional;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.CategoryModel;
import com.example.demo.app.domain.service.CategoryService;
import com.example.demo.app.infra.entity.CategoryEntity;
import com.example.demo.app.infra.repository.CategoryRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class CategoryServiceImpl implements CategoryService {
private final CategoryRepository categoryRepository;
public List<CategoryModel> findAll() {
return CategoryModel.convertFrom(categoryRepository.findAll());
}
public CategoryModel findOne(Long categoryId) {
Optional<CategoryEntity> optionalCategoryModel = categoryRepository.findById(categoryId);
if (optionalCategoryModel.isEmpty()) {
return null;
}
return CategoryModel.convertFrom(optionalCategoryModel.get());
}
public CategoryModel findOneByCategoryName(String categoryName) {
CategoryEntity categoryModel = categoryRepository.findByCategoryName(categoryName);
if (categoryModel == null) {
return null;
}
return CategoryModel.convertFrom(categoryModel);
}
}

View File

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

View File

@@ -0,0 +1,49 @@
package com.example.demo.app.domain.service.impl;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.GoalModel;
import com.example.demo.app.domain.service.GoalService;
import com.example.demo.app.infra.entity.GoalEntity;
import com.example.demo.app.infra.repository.GoalRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class GoalServiceImpl implements GoalService {
private final GoalRepository goalRepository;
@Override
public GoalModel getGoalById(Long goalId) {
GoalEntity goalEntity = goalRepository.findById(goalId).orElse(null);
return GoalModel.convertFrom(goalEntity);
}
@Override
public GoalModel createGoal(GoalModel goalModel) {
GoalEntity goalEntity = GoalModel.convertTo(goalModel);
GoalEntity savedGoalEntity = goalRepository.save(goalEntity);
return GoalModel.convertFrom(savedGoalEntity);
}
@Override
public GoalModel updateGoal(GoalModel goalModel) {
GoalEntity goalEntity = GoalModel.convertTo(goalModel);
GoalEntity updatedGoalEntity = goalRepository.save(goalEntity);
return GoalModel.convertFrom(updatedGoalEntity);
}
}

View File

@@ -0,0 +1,31 @@
package com.example.demo.app.domain.service.impl;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.LoginService;
import com.example.demo.app.infra.entity.UserEntity;
import com.example.demo.app.infra.repository.UserRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class LoginServiceImpl implements LoginService {
private final UserRepository userRepository;
@Override
public LoginModel login(String mailAddress, String password) {
UserEntity userEntity = userRepository.findByMailAddressAndPassword(
mailAddress,
password).orElse(null);
if (userEntity == null) {
return null;
}
return new LoginModel(userEntity.getUserId());
}
}

View File

@@ -0,0 +1,118 @@
package com.example.demo.app.domain.service.impl;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.TransactionModel;
import com.example.demo.app.domain.service.TransactionService;
import com.example.demo.app.infra.entity.CategoryEntity;
import com.example.demo.app.infra.entity.TransactionEntity;
import com.example.demo.app.infra.entity.UserEntity;
import com.example.demo.app.infra.repository.CategoryRepository;
import com.example.demo.app.infra.repository.TransactionRepository;
import com.example.demo.app.infra.repository.UserRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class TransactionServiceImpl implements TransactionService {
private final TransactionRepository transactionRepository;
private final UserRepository userRepository;
private final CategoryRepository categoryRepository;
public Map<LocalDate, List<TransactionModel>> findAllByDate(LocalDate startDate, LocalDate endDate, Long userId) {
List<TransactionEntity> transactionEntityList = transactionRepository.findAllByDateAndUserId(startDate, endDate,
userId);
List<TransactionModel> transactionModelList = TransactionModel
.convertFrom(transactionEntityList);
Map<LocalDate, List<TransactionModel>> transactionModelMap = transactionModelList.stream()
.collect(Collectors.groupingBy(TransactionModel::getTransactionDate));
return transactionModelMap;
}
public int findTotalIncome(LocalDate startDate, LocalDate endDate, Long userId) {
return transactionRepository.findTotalIncome(startDate, endDate, userId);
}
public int findTotalexpense(LocalDate startDate, LocalDate endDate, Long userId) {
return transactionRepository.findTotalIncome(startDate, endDate, userId);
}
public List<TransactionModel> findByUserIdAndDate(LocalDate todayDate, Long userId) {
return TransactionModel.convertFrom(transactionRepository.findByUserIdAndDate(todayDate, userId));
}
public int createTransaction(TransactionModel transactionModel) {
Optional<UserEntity> userEntityOptional = userRepository.findById(transactionModel.getUserId());
if (userEntityOptional.isEmpty()) {
return -1;
}
Optional<CategoryEntity> categoryEntityOptional = categoryRepository.findById(transactionModel.getCategoryId());
if (categoryEntityOptional.isEmpty()) {
return -1;
}
TransactionEntity transactionEntity = TransactionModel.convertTo(
transactionModel,
userEntityOptional.get(),
categoryEntityOptional.get());
if (transactionRepository.save(transactionEntity) != null) {
return 0;
} else {
return -1;
}
}
public int updateTransaction(TransactionModel transactionModel) {
if (!transactionRepository.existsById(transactionModel.getTransactionId())) {
return -1;
}
Optional<UserEntity> userEntityOptional = userRepository.findById(transactionModel.getUserId());
if (userEntityOptional.isEmpty()) {
return -1;
}
Optional<CategoryEntity> categoryEntityOptional = categoryRepository.findById(transactionModel.getCategoryId());
if (categoryEntityOptional.isEmpty()) {
return -1;
}
TransactionEntity transactionEntity = TransactionModel.convertTo(
transactionModel,
userEntityOptional.get(),
categoryEntityOptional.get());
if (transactionRepository.save(transactionEntity) != null) {
return 0;
} else {
return -1;
}
}
}

View File

@@ -0,0 +1,53 @@
package com.example.demo.app.infra.entity;
import java.util.List;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.IdClass;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import com.example.demo.app.domain.model.AllocationModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@IdClass(AllocationId.class)
@Table(name = "allocation_m")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AllocationEntity {
@Id
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "category_id")
private CategoryEntity categoryEntity;
@Id
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "course_id")
private CourseEntity courseEntity;
@Column(name = "allocation_ratio", nullable = false)
private Integer allocationRatio;
public static List<AllocationModel> createAllocationModelList(List<AllocationEntity> allocationEntityList) {
return allocationEntityList
.stream()
.map(allocationEntity -> new AllocationModel(
allocationEntity.getCategoryEntity().getCategoryId(),
allocationEntity.getCourseEntity().getCourseId(),
allocationEntity.getAllocationRatio()
)).toList();
}
}

View File

@@ -0,0 +1,16 @@
package com.example.demo.app.infra.entity;
import java.io.Serializable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AllocationId implements Serializable {
private Long categoryEntity;
private Long courseEntity;
}

View File

@@ -0,0 +1,40 @@
package com.example.demo.app.infra.entity;
import java.util.List;
import jakarta.persistence.Column;
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 lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "category_t")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CategoryEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "category_id")
private Long categoryId;
@Column(name = "category_name", nullable = false)
private String categoryName;
@Column(name = "transaction_type", nullable = false)
private Integer transactionType;
@OneToMany(mappedBy = "categoryEntity")
private List<TransactionEntity> transactionEntity;
@OneToMany(mappedBy = "categoryEntity")
private List<AllocationEntity> allocationEntity;
}

View File

@@ -0,0 +1,52 @@
package com.example.demo.app.infra.entity;
import java.util.List;
import jakarta.persistence.Column;
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;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "course_m")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CourseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "course_id")
private Long courseId;
@Column(name = "course_name", nullable = false)
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
.stream()
.map(courseEntity -> new CourseModel(
courseEntity.getCourseId(),
courseEntity.getCourseName(),
courseEntity.getDescription()
)).toList();
}
}

View File

@@ -0,0 +1,47 @@
package com.example.demo.app.infra.entity;
import java.time.LocalDate;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "goal_t")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GoalEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "goal_id")
private Long goalId;
@Column(name = "goal_title", nullable = true)
private String goalTitle;
@Column(name = "goal_subtitle", nullable = true)
private String goalSubtitle;
@Column(name = "target_amount", nullable = false)
private Integer targetAmount;
@Column(name = "deadline", nullable = false)
private LocalDate deadline;
@Column(name = "goal_complete", nullable = false)
private Integer goalComplete;
@OneToOne(mappedBy = "goalEntity")
private UserEntity userEntity;
}

View File

@@ -0,0 +1,35 @@
package com.example.demo.app.infra.entity;
import java.util.List;
import jakarta.persistence.Column;
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 lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "question_m")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class QuestionEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "secret_question_id")
private Long secretQuestionId;
@Column(name = "question_text", nullable = false)
private String questionText;
@OneToMany(mappedBy = "questionEntity")
private List<UserEntity> userEntity;
}

View File

@@ -0,0 +1,45 @@
package com.example.demo.app.infra.entity;
import java.time.LocalDate;
import jakarta.persistence.Column;
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.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "transaction_t")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TransactionEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "transaction_id")
private Long transactionId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private UserEntity userEntity;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "category_id")
private CategoryEntity categoryEntity;
@Column(name = "amount", nullable = false)
private Integer amount;
@Column(name = "transaction_date", nullable = false)
private LocalDate transactionDate;
}

View File

@@ -0,0 +1,76 @@
package com.example.demo.app.infra.entity;
import java.time.LocalDate;
import java.util.List;
import jakarta.persistence.Column;
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.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Entity
@Table(name = "user_t")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "user_id")
private Long userId;
@Column(name = "user_name", nullable = false)
private String userName;
@Column(name = "mail_address", nullable = false)
private String mailAddress;
@Column(name = "password", nullable = false)
private String password;
@Column(name = "secret_answer", nullable = false)
private String secretQuestionAnswer;
@Column(name = "birth_date", nullable = false)
private LocalDate birthDate;
@Column(name = "saving", nullable = false)
private Integer saving;
@Column(name = "annual_income", nullable = false)
private Integer annualIncome;
@Column(name = "monthly_budget", nullable = false)
private Integer monthlyBudget;
@Column(name = "delete_flag", nullable = false)
private Integer deleteFlag;
@OneToMany(mappedBy = "userEntity")
private List<TransactionEntity> transactionEntityList;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "secret_question_id")
private QuestionEntity questionEntity;
@OneToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "goal_id")
private GoalEntity goalEntity;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "course_id")
private CourseEntity courseEntity;
}

View File

@@ -0,0 +1,32 @@
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;
import com.example.demo.app.domain.model.CourseInfoModel;
import com.example.demo.app.infra.entity.AllocationEntity;
import com.example.demo.app.infra.entity.AllocationId;
public interface AllocationRepository extends JpaRepository<AllocationEntity, AllocationId>{
List<AllocationEntity> findByCourseEntity_CourseId(Long courseId);
@Query(" SELECT new com.example.demo.app.domain.model.CourseInfoModel("
+ "co.courseId, "
+ " co.courseName, "
+ " ca.categoryId, "
+ " ca.categoryName, "
+ " a.allocationRatio )"
+ " FROM AllocationEntity a"
+ " INNER JOIN CourseEntity co "
+ " ON a.courseEntity.courseId = co.courseId "
+ " INNER JOIN CategoryEntity ca "
+ " on a.categoryEntity.categoryId = ca.categoryId "
+ " WHERE ca.transactionType = 0 "
+ " ORDER BY a.courseEntity.courseId ASC, "
+ " a.categoryEntity.categoryId ASC ")
List<CourseInfoModel> findAllJoinedAllocation();
}

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.Query;
import org.springframework.data.repository.query.Param;
import com.example.demo.app.infra.entity.CategoryEntity;
public interface CategoryRepository extends JpaRepository<CategoryEntity, Long> {
@Query("select c from CategoryEntity c where c.categoryName = :categoryName")
public CategoryEntity findByCategoryName(@Param("categoryName") String categoryName);
}

View File

@@ -0,0 +1,9 @@
package com.example.demo.app.infra.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.app.infra.entity.CourseEntity;
public interface CourseRepository extends JpaRepository<CourseEntity, Long> {
}

View File

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

View File

@@ -0,0 +1,9 @@
package com.example.demo.app.infra.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import com.example.demo.app.infra.entity.QuestionEntity;
public interface QuestionRepository extends JpaRepository<QuestionEntity, Long> {
}

View File

@@ -0,0 +1,27 @@
package com.example.demo.app.infra.repository;
import java.time.LocalDate;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import com.example.demo.app.infra.entity.TransactionEntity;
public interface TransactionRepository extends JpaRepository<TransactionEntity, Long> {
@Query("select t from TransactionEntity t where t.userEntity.userId = :userId and t.transactionDate = :transactionDate")
public List<TransactionEntity> findByUserIdAndDate(LocalDate todayDate, Long userId);
@Query("select t from TransactionEntity t where (t.transactionDate between :startDate and :endDate) and (t.userEntity.userId = :userId) order by t.transactionDate asc")
public List<TransactionEntity> findAllByDateAndUserId(LocalDate startDate, LocalDate endDate, Long userId);
@Query("select sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryEntity.categoryId = c.categoryId where (t.userEntity.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 0")
public Integer findTotalExpense(LocalDate startDate, LocalDate endDate, Long userId);
@Query("select sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryEntity.categoryId = c.categoryId where (t.userEntity.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 1")
public Integer findTotalIncome(LocalDate startDate, LocalDate endDate, Long userId);
@Query("select sum(t.amount) from TransactionEntity t where t.userEntity.userId = :userId and t.categoryEntity.categoryId = :categoryId and t.transactionDate between :startDate and :endDate")
public Integer findCategoryExpense(LocalDate startDate, LocalDate endDate, Long userId, Long categoryId);
}

View File

@@ -0,0 +1,21 @@
package com.example.demo.app.infra.repository;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.example.demo.app.infra.entity.UserEntity;
@Repository
public interface UserRepository extends JpaRepository<UserEntity, Long> {
@Query("select u from UserEntity u where u.mailAddress = :mailAddress and u.password = :password and u.deleteFlag = 0")
Optional<UserEntity> findByMailAddressAndPassword(
String mailAddress,
String password);
Optional<UserEntity> findByMailAddress(String mailAddress);
}

View File

@@ -0,0 +1,40 @@
package com.example.demo.app.presentation.controller;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import com.example.demo.app.domain.model.AnalysisModel;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.AnalysisService;
import com.example.demo.app.presentation.form.AnalysisForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class AnalysisController {
private final AnalysisService analysisService;
@GetMapping("/analysis")
public String showAnalysis(Model model, HttpSession session) {
//ログインユーザーの取得(セッション)
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
//分析結果の取得(Service)
AnalysisModel analysisModel = analysisService.getAnalysis(loginUser.getUserId());
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
//model格納
model.addAttribute("analysisForm", analysisForm);
return "analysis";
}
}

View File

@@ -0,0 +1,52 @@
package com.example.demo.app.presentation.controller;
import java.util.logging.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import com.example.demo.app.domain.service.CourseInfoService;
import com.example.demo.app.domain.service.CourseService;
import com.example.demo.app.presentation.form.CourseForm;
import com.example.demo.app.presentation.form.CourseInfoForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class CourseController {
private final static Logger LOGGER = Logger.getLogger(CourseController.class.getName());
// エラーメッセージ用の定数フィールド
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
// private final HttpSession httpSession;
private final CourseService courseService;
private final CourseInfoService courseInfoService;
@GetMapping("/select-course")
public String select(Model model) {
//try {
model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll()));
model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll()));
return "select_course";
//} catch (Exception e) {
// // ログイン情報の破棄
// httpSession.invalidate();
//
// e.printStackTrace();
//
// // エラーログ出力
// LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
// // エラー画面遷移
// return null;
// }
}
}

View File

@@ -0,0 +1,61 @@
package com.example.demo.app.presentation.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.example.demo.app.domain.model.GoalModel;
import com.example.demo.app.domain.service.GoalService;
import com.example.demo.app.presentation.form.GoalForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
@RequestMapping("/goal")
public class GoalController {
private final GoalService goalService;
@GetMapping("/{goalId}")
public String getGoal(@PathVariable Long goalId, Model model) {
GoalModel goalModel = goalService.getGoalById(goalId);
GoalForm goalForm = GoalForm.convertFrom(goalModel);
model.addAttribute("goalForm", goalForm);
return "goal_view";
}
@GetMapping("/{goalId}/edit")
public String editGoal(@PathVariable Long goalId, Model model) {
GoalModel goalModel = goalService.getGoalById(goalId);
GoalForm goalForm = GoalForm.convertFrom(goalModel);
model.addAttribute("goalForm", goalForm);
return "goal_edit";
}
@PostMapping("/update")
public String updateGoal(@ModelAttribute GoalForm goalForm) {
GoalModel goalModel = GoalModel.convertFrom(goalForm);
goalService.updateGoal(goalModel);
return "redirect:/goal/" + goalForm.getGoalId();
}
}

View File

@@ -0,0 +1,55 @@
package com.example.demo.app.presentation.controller;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.LoginService;
import com.example.demo.app.presentation.form.LoginForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class LoginController {
private final LoginService loginService;
@GetMapping("/login")
public String showLogin(Model model) {
model.addAttribute(
"loginForm",
new LoginForm());
return "login";
}
@PostMapping("/login")
public String login(
@ModelAttribute LoginForm loginForm,
Model model,
HttpSession session) {
LoginModel loginModel = loginService.login(
loginForm.getMailAddress(),
loginForm.getPassword());
if (loginModel == null) {
model.addAttribute(
"errorMessage",
"Email address or password is incorrect.");
return "login";
}
session.setAttribute("loginUser", loginModel);
return "menu";
}
}

View File

@@ -0,0 +1,130 @@
package com.example.demo.app.presentation.controller;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.CategoryService;
import com.example.demo.app.domain.service.TransactionService;
import com.example.demo.app.presentation.form.CategoryForm;
import com.example.demo.app.presentation.form.TransactionForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class TransactionController {
private final TransactionService transactionService;
private final CategoryService categoryService;
// 一覧画面
@GetMapping("/transaction/list")
public String transactionList(@RequestParam(required = false) LocalDate startDates,
@RequestParam(required = false) LocalDate endDates, Model model,
HttpSession session) {
LocalDate startDate = (startDates == null) ? LocalDate.now().withDayOfMonth(1) : startDates;
LocalDate endDate = (endDates == null) ? LocalDate.now().withDayOfMonth(LocalDate.now().lengthOfMonth())
: endDates;
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
transactionService.findAllByDate(startDate, endDate, loginUser.getUserId()).forEach((date, list) -> {
List<TransactionForm> transactionFormList = list.stream().map(transaction -> {
TransactionForm transactionForm = TransactionForm.convertFrom(
transaction,
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getCategoryName(),
transactionService.findTotalexpense(startDate, endDate, loginUser.getUserId()),
transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId()),
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getTransactionType());
return transactionForm;
}).collect(Collectors.toList());
transactionFormMap.put(date, transactionFormList);
});
model.addAttribute("transactionFormMap", transactionFormMap);
return "transaction_list";
}
// 詳細画面
@GetMapping("/transaction/detail")
public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) {
LocalDate todayDate = (todayDates == null) ? LocalDate.now() : todayDates;
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
List<TransactionForm> transactionFormList = transactionService
.findByUserIdAndDate(todayDate, loginUser.getUserId()).stream()
.map(transaction -> {
TransactionForm transactionForm = TransactionForm.convertFrom(
transaction,
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getCategoryName(),
transactionService.findTotalexpense(todayDate, todayDate, loginUser.getUserId()),
transactionService.findTotalIncome(todayDate, todayDate, loginUser.getUserId()),
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getTransactionType());
return transactionForm;
}).collect(Collectors.toList());
model.addAttribute("transactionFormList", transactionFormList);
return "";
}
@GetMapping("/transaction/create")
public String createOneGet(@ModelAttribute TransactionForm transactionForm) {
return "";
}
@PostMapping("/transaction/create")
public String createOnePost(@ModelAttribute TransactionForm transactionForm, Model model) {
if (transactionService.createTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
return "error";
}
return "";
}
@GetMapping("/transaction/update")
public String updateOneGet(@ModelAttribute TransactionForm transactionForm) {
return "";
}
@PostMapping("/transaction/update")
public String updateOnePost(@ModelAttribute TransactionForm transactionForm, Model model) {
if (transactionService.updateTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
return "error";
}
return "";
}
}

View File

@@ -0,0 +1,28 @@
package com.example.demo.app.presentation.form;
import java.util.List;
import com.example.demo.app.domain.model.CategoryModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CategoryForm {
private Long categoryId;
private String categoryName;
private Integer transactionType;
public static CategoryForm convertFrom(CategoryModel categoryModel) {
return new CategoryForm(categoryModel.getCategoryId(), categoryModel.getCategoryName(), categoryModel.getTransactionType());
}
public static List<CategoryForm> convertFrom(List<CategoryModel> categoryModelList){
return categoryModelList.stream().map(CategoryForm::convertFrom).toList();
}
}

View File

@@ -0,0 +1,33 @@
package com.example.demo.app.presentation.form;
import java.util.List;
import com.example.demo.app.domain.model.CourseModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseForm {
private Long courseId;
private String courseName;
private String description;
public static CourseForm convertFrom(CourseModel courseModel) {
return new CourseForm(
courseModel.getCourseId(),
courseModel.getCourseName(),
courseModel.getDescription()
);
}
public static List<CourseForm> convertFrom(List<CourseModel> courseModelList){
return courseModelList.stream().map(CourseForm::convertFrom).toList();
}
}

View File

@@ -0,0 +1,44 @@
package com.example.demo.app.presentation.form;
import java.util.List;
import com.example.demo.app.domain.model.CourseInfoModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CourseInfoForm {
private Long courseId;
private String courseName;
private Long categoryId;
private String categoryName;
private Integer allocationRatio;
public static CourseInfoForm convertFrom(CourseInfoModel courseInfoModel ) {
return new CourseInfoForm(courseInfoModel.getCategoryId(), courseInfoModel.getCourseName(), courseInfoModel.getCategoryId(), courseInfoModel.getCategoryName(), courseInfoModel.getAllocationRatio());
}
public static List<CourseInfoForm> convertFrom(List<CourseInfoModel> courseInfoModelList ) {
return courseInfoModelList.stream().map(CourseInfoForm::convertFrom).toList();
}
public static CourseInfoModel convertTo(CourseInfoForm courseInfoForm) {
return new CourseInfoModel(
courseInfoForm.getCourseId(),
courseInfoForm.getCourseName(),
courseInfoForm.getCategoryId(),
courseInfoForm.getCategoryName(),
courseInfoForm.getAllocationRatio());
}
}

View File

@@ -0,0 +1,42 @@
package com.example.demo.app.presentation.form;
import java.time.LocalDate;
import com.example.demo.app.domain.model.GoalModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class GoalForm {
private Long goalId;
private String goalTitle;
private String goalSubtitle;
private Integer targetAmount;
private LocalDate deadline;
private Integer goalComplete;
public static GoalForm convertFrom(GoalModel goalModel) {
return new GoalForm(
goalModel.getGoalId(),
goalModel.getGoalTitle(),
goalModel.getGoalSubtitle(),
goalModel.getTargetAmount(),
goalModel.getDeadline(),
goalModel.getGoalComplete());
}
// public static List<GoalForm> convertFrom(List<GoalModel> goalModelList) {
// return goalModelList.stream().map(GoalForm::convertFrom).toList();
// }
}

View File

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

View File

@@ -0,0 +1,63 @@
package com.example.demo.app.presentation.form;
import java.time.LocalDate;
import java.util.List;
import com.example.demo.app.domain.model.TransactionModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TransactionForm {
private Long transactionId;
private Long userId;
private Long categoryId;
private Integer amount;
private LocalDate transactionDate;
private String categoryName;
private Integer income;
private Integer expense;
private Integer transactionType;
public static TransactionForm convertFrom(TransactionModel transactionModel, String categoryName, int income, int expense, int transactionType) {
return new TransactionForm(
transactionModel.getTransactionId(),
transactionModel.getUserId(),
transactionModel.getCategoryId(),
transactionModel.getAmount(),
transactionModel.getTransactionDate(),
categoryName,
income,
expense,
transactionType);
}
public static List<TransactionForm> convertFrom(List<TransactionModel> transactionModelList, String categoryName, int income, int expense, int transactionType ) {
return transactionModelList.stream().map(transactionModel -> TransactionForm.convertFrom(transactionModel, categoryName, income, expense, transactionType)).toList();
}
public static TransactionModel convertTo(TransactionForm transactionForm) {
return new TransactionModel(
transactionForm.getTransactionId(),
transactionForm.getUserId(),
transactionForm.getCategoryId(),
transactionForm.getAmount(),
transactionForm.getTransactionDate());
}
}

View File

@@ -0,0 +1,5 @@
package com.example.demo.utility;
public class Constant {
}

View File

@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>分析画面</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<h2 class="text-center">支出分析</h2>
<table class="table text-center">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">支出</th>
<th scope="col">前月比</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">総支出</th>
<td th:text="'¥' + ${analysisForm.currentMonthTotalAmount}">
0
</td>
<td th:text="${analysisForm.totalDifferenceAmount >= 0}
? '+' + ${analysisForm.totalDifferenceAmount}
: ${analysisForm.totalDifferenceAmount}"
th:class="${analysisForm.totalDifferenceAmount >= 0}
? 'color-danger;'
: 'color-primary;'">
0
</td>
</tr>
</tbody>
</table>
<hr class="border border-primary border-2 opacity-50">
<table class="table text-center">
<thead>
<tr>
<th scope="col">カテゴリ別</th>
<th scope="col">支出</th>
<th scope="col">
前月比
<br>
コース比
</th>
</tr>
</thead>
<tbody>
<tr th:each="category : ${analysisForm.categoryAnalysisFormList}">
<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}"
th:class="${category.monthDifferenceAmount >= 0}
? 'color-danger;'
: 'color-primary;'">
</span>
<br>
<span th:text="${category.courseDifferenceAmount >= 0}
? '+' + ${category.courseDifferenceAmount}
: ${category.courseDifferenceAmount}"
th:class="${category.courseDifferenceAmount >= 0}
? 'color-danger;'
: 'color-primary;'">
</span>
</td>
</tr>
</tbody>
</table>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>目標編集</title>
</head>
<body>
<h1>目標編集</h1>
<form th:action="@{/goal/update}" th:object="${goalForm}" method="post">
<input type="hidden" th:field="*{goalId}">
<div>
<label>目標名</label>
<input type="text" th:field="*{goalTitle}">
</div>
<div>
<label>目標補足説明</label>
<textarea th:field="*{goalSubtitle}"></textarea>
</div>
<div>
<label>目標金額</label>
<input type="number" th:field="*{targetAmount}">
</div>
<div>
<label>目標達成期限</label>
<input type="date" th:field="*{deadline}">
</div>
<button type="submit">更新する</button>
</form>
</body>
</html>

View File

@@ -0,0 +1,37 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>目標詳細</title>
</head>
<body>
<h1>目標詳細</h1>
<table>
<!--
<tr>
<th>目標名</th>
<td th:text="${goalForm.goalTitle}"></td>
</tr>
-->
<tr>
<th>目標補足説明</th>
<td th:text="${goalForm.goalSubtitle}"></td>
</tr>
<tr>
<th>目標金額</th>
<td th:text="${goalForm.targetAmount}"></td>
</tr>
<tr>
<th>目標達成期限</th>
<td th:text="${goalForm.deadline}"></td>
</tr>
</table>
<a th:href="@{/goal/{goalId}/edit(goalId=${goalForm.goalId})}">編集する</a>
</body>
</html>

View File

@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="ja"xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>ログイン</title>
</head>
<body>
<header></header>
<main>
<h1>ログイン</h1>
<div th:if="${errorMessage}" th:text="${errorMessage}"></div>
<form th:action="@{/login}" th:object="${loginForm}" method="post">
<div>
<label for="emailAddress">メールアドレス</label>
<input type="email"
id="emailAddress"
th:field="{emailAddress}"
required>
</div>
<div>
<label for="password">パスワード</label>
<input type="password"
id="password"
th:field="{password}"
required>
</div>
<div>
<button type="submit">ログイン</button>
</div>
</form>
<div>
<a href="@{user/register}">新規会員登録</a>
</div>
<div>
<a href="@{password/authentication}">パスワードを忘れた方</a>
</div>
</main>
</body>
</html>

View File

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

View File

@@ -0,0 +1,136 @@
<!DOCTYPE html>
<html lang="ja"xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>新規会員登録</title>
</head>
<body>
<header></header>
<main>
<h1>新規会員登録</h1>
<form th:action="@{/user/register/confirm}" th:object="${userForm}" method="post">
<div>
<label for="userName">氏名</label>
<input type="text"
id="userName"
th:field="*{userName}"
maxlength="100"
required>
</div>
<div>
<label for="mailAddress">メールアドレス</label>
<input type="email"
id="mailAddress"
th:field="*{mailAddress}"
maxlength="255"
required>
</div>
<div>
<label for="birthDate">生年月日</label>
<input type="date"
id="birthDate"
th:field="*{birthDate}"
required>
</div>
<div>
<label for="password">パスワード</label>
<input type="password"
id="password"
th:field="*{password}"
minlength="8"
maxlength="255"
required>
</div>
<div>
<label for="secretQuestionId">秘密の質問</label>
<select id="secretQuestionId"
th:field="*{secretQuestionId}"
required>
<option value="">選択してください</option>
<option th:each="question : ${questionList}"
th:value="${question.secretQuestionId}"
th:text="${question.questionText}">
</option>
</select>
</div>
<div>
<label for="secretAnswer">秘密の質問の回答</label>
<input type="text"
id="secretAnswer"
th:field="*{secretAnswer}"
maxlength="100"
required>
</div>
<div>
<label for="saving">貯蓄金</label>
<input type="number"
id="saving"
th:field="*{saving}"
min="0"
required>
</div>
<div>
<label for="annualIncome">年収</label>
<input type="number"
id="annualIncome"
th:field="*{annualIncome}"
min="0"
required>
</div>
<div>
<label for="monthlyBudget">月別使用可能金額</label>
<input type="number"
id="monthlyBudget"
th:field="*{monthlyBudget}"
min="0"
required>
</div>
<div>
<label for="goalId">目標</label>
<select id="goalId"
th:field="*{goalId}"
required>
<option value="">選択してください</option>
<option th:each="goal : ${goalList}"
th:value="${goal.goalId}"
th:text="${goal.goalTitle}">
</option>
</select>
</div>
<div>
<label for="courseId">コース</label>
<select id="courseId"
th:field="*{courseId}"
required>
<option value="">選択してください</option>
<option th:each="course : ${courseList}"
th:value="${course.courseId}"
th:text="${course.courseName}">
</option>
</select>
</div>
<div>
<button type="submit">作成</button>
</div>
</form>
<form th:action="@{/login}" method="get">
<button type="submit">戻る</button>
</form>
</main>
</body>
</html>

View File

@@ -0,0 +1,78 @@
<!DOCTYPE html>
<html lang="ja"xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>新規会員登録確認</title>
</head>
<body>
<header></header>
<main>
<h1>新規会員登録確認</h1>
<div>
<p>氏名</p>
<p th:text="${session.userForm.userName}" readonly></p>
</div>
<div>
<p>メールアドレス</p>
<p th:text="${session.userForm.mailAddress}" readonly></p>
</div>
<div>
<p>生年月日</p>
<p th:text="${session.userForm.barthDate}" readonly></p>
</div>
<div>
<p>パスワード</p>
<p>********</p>
</div>
<div>
<p>秘密の質問</p>
<p th:text="${session.userForm.secretQuestionId}" readonly></p>
</div>
<div>
<p>秘密の質問の回答</p>
<p th:text="${session.userForm.secretAnswer}" readonly></p>
</div>
<div>
<p>貯蓄金</p>
<p th:text="${session.userForm.saving}" readonly></p>
</div>
<div>
<p>年収</p>
<p th:text="${session.userForm.annualIncome}" readonly></p>
</div>
<div>
<p>月別使用可能額</p>
<p th:text="${session.userForm.monthlyBudget}" readonly></p>
</div>
<div>
<p>目標</p>
<p th:text="${session.userForm.goalId}" readonly></p>
</div>
<div>
<p>コース</p>
<p th:text="${session.userForm.courseId}" readonly></p>
</div>
<div>
<form th:action="@{/user/register}" method="get">
<button type="submit">戻る</button>
</form>
</div>
<form th:action="@{/user/register/complete}" method="post">
<button type="submit">確定</button>
</form>
</main>
</body>
</html>