370 Commits

Author SHA1 Message Date
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
kkazuya
18c51d3a65 [FIX] カテゴリー登録の際、カテゴリー名と収支区分の入力を必須にしました。 2026-09-29 11:22:41 +09:00
kkazuya
0162f2f679 [EDIT] コース作成で、配分の合計が100%でないと登録できないように修正しました。 2026-09-29 11:19:37 +09:00
s-choi
31d80388af [HOTFIX] 開発者ツールエラーのため、ファイルを追加しました。 2026-09-29 11:15:31 +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
s-choi
84e55d7606 [HOTFIX] エラー処理を行いました。 2026-09-29 10:54:33 +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
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
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
s-choi
054eeb7f7a Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi
# Conflicts:
#	src/main/java/com/example/demo/app/presentation/controller/CourseController.java
#	src/main/java/com/example/demo/app/presentation/controller/GoalController.java
#	src/main/java/com/example/demo/app/presentation/controller/LoginController.java
#	src/main/java/com/example/demo/app/presentation/controller/PasswordResetController.java
#	src/main/java/com/example/demo/app/presentation/controller/TransactionController.java
#	src/main/resources/templates/select_course.html
2026-09-25 17:09:35 +09:00
s-choi
5be30572cb [FIX] ログインの際、DBに保存されているパスワードが平文だったらハッシュ化して再保存するようにデモ用コードを追加しました。 2026-09-25 16:49:09 +09:00
kkazuya
6d0cad2454 [EDIT] パスワードの文字数上限を24文字に変更しました。 2026-09-25 16:44:57 +09:00
s-choi
04a6b6dedb [EDIT] ログインしてないユーザのヘッダーを修正しました。 2026-09-25 16:12:00 +09:00
s-choi
2c445c1904 [FIX] ログインしてるユーザーはパスワード再設定後プロフィール画面に戻るように修正・パスワード再設定の際ハッシュ化処理 2026-09-25 16:09:36 +09:00
s-choi
cd4321ef8c [EDIT] ログインしてるユーザはログインページにアクセスできないように修正しました。 2026-09-25 15:54:57 +09:00
s-choi
65bab96432 [HOTFIX] 目標がない人は目標画面へ遷移できないバグを修正しました。 2026-09-25 15:41:06 +09:00
kkazuya
d911334107 [FIX] 目標名、目標説明が必須になっていたバグを修正、目標金額の最小値を1に変更しました。 2026-09-25 15:35:12 +09:00
kkazuya
b9bf0da507 [HOTFIX] 目標が更新できないバグを修正しました。 2026-09-25 15:22:19 +09:00
s-choi
2b3cecf55d [FIX] 目標がない人はログインできないバグを修正しました。 2026-09-25 15:14:39 +09:00
s-choi
9872405377 [EDIT] 会員登録・ログインにパスワード暗号化機能を追加しました。 2026-09-25 15:14:21 +09:00
s-choi
b9742d87c0 [EDIT] いらないパラメータを削除しました。 2026-09-25 15:13:38 +09:00
s-choi
cdc5ea21c7 [EDIT] パスワード暗号化のための依存性を追加しました。 2026-09-25 15:12:17 +09:00
kkazuya
ff21efa943 [EDIT] 全コントローラに定数を反映させました。 2026-09-25 14:59:27 +09:00
kkazuya
a0ef7145d2 [FIX] 定数クラスの誤字を修正しました。 2026-09-25 14:58:09 +09:00
s-choi
29749c444a [HOTFIX] 目標がなかった場合、ログインできない問題を修正しました。 2026-09-25 14:39:03 +09:00
s-choi
073ee12f03 [STYLE] グラフなどのCSS結合 2026-09-25 14:38:38 +09:00
s-choi
1438c94406 [STYLE] 目標作成画面のCSS結合 2026-09-25 14:38:21 +09:00
s-choi
65290c0189 [STYLE] bodyの間隔を調整しました。 2026-09-25 14:38:00 +09:00
s-choi
e0759c0f6b [FIX] 目標資金・現在高・達成率・達成期限が表示されないバグを修正しました。 2026-09-25 14:14:44 +09:00
s-choi
d526dc2e60 [STYLE] CSSを結合しました。 2026-09-25 13:56:09 +09:00
kkazuya
d7c9346b88 [ADD] TransitionTargetPageNameKeyword.javaを作成しました。 2026-09-25 13:16:52 +09:00
kkazuya
18eeb82cac [ADD] PageReturnAttributeKeyword.javaを作成しました。 2026-09-25 13:16:19 +09:00
kkazuya
b18ee5ee82 [ADD] SessionKeyword.javaを追加しました。 2026-09-25 13:15:43 +09:00
kkazuya
6fda1af754 [EDIT] コース選択画面のデザインを修正しました。 2026-09-25 12:57:44 +09:00
kkazuya
90c5dbe8b2 [EDIT] コーディングルールに反する表記を修正しました。 2026-09-25 12:56:58 +09:00
s-choi
29d879e3b7 Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-25 12:52:48 +09:00
s-choi
f33d4412a7 Merge branch 'k-oshita' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-25 12:52:17 +09:00
s-choi
573b7969b7 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi
# Conflicts:
#	src/main/resources/templates/goal_view.html
#	src/main/resources/templates/menu.html
#	src/main/resources/templates/select_course.html
#	src/main/resources/templates/transaction_detail.html
2026-09-25 12:51:53 +09:00
s-choi
29d93d5453 [UPDATE] 2次機能を実装しました。 2026-09-25 12:41:52 +09:00
907b7c1f9b [FIX]登録できない問題の修正をしました 2026-09-24 16:43:46 +09:00
3dba5e5322 [FIX]未ログイン時にヘッダー押下でログイン画面へ遷移するよう修正しました。 2026-09-24 16:02:10 +09:00
kkazuya
1e0cc3a953 [EDIT] 金額入力等の入力制限を追加しました。 2026-09-24 15:57:46 +09:00
kkazuya
67906caf90 [FIX] 取引登録の日付の初期値が表示されない不具合を修正しました 2026-09-24 15:40:09 +09:00
s-choi
95bfd4ed0e [ADD] カテゴリの一覧・作成・修正画面を作成しました。 2026-09-24 15:34:43 +09:00
s-choi
3e6a7f5a74 [EDIT] CategoryのCRUD機能を追加しました。 2026-09-24 15:34:18 +09:00
s-choi
4a574294b7 [EDIT] デフォルトカテゴリ・カスタムカテゴリ両方取得できるように変更しました。 2026-09-24 15:33:37 +09:00
s-choi
b8886fe47b [EDIT] Category一覧への遷移ボタンを追加しました。 2026-09-24 15:32:57 +09:00
s-choi
c44a679213 [EDIT] categoryテーブルにUser・削除フラグを追加しました 2026-09-24 15:32:34 +09:00
kkazuya
0f057bcd36 [EDIT] バランスコースのIDを名前から検索するよう修正しました 2026-09-24 15:25:21 +09:00
s-choi
fb9847a834 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-24 15:24:09 +09:00
d0e14ce2dc [ADD]全画面共通cssファイルを作成しました 2026-09-24 15:18:56 +09:00
ab2bb89d24 [EDIT]スマホ画面のデザインに統一しました 2026-09-24 15:18:15 +09:00
s-choi
58da1fcbfc [ADD] 目標作成画面の追加及び遷移ボタン追加 2026-09-24 14:10:12 +09:00
s-choi
ec862f8271 [FIX] デフォルトで目標達成現状を0に明示化 2026-09-24 14:09:52 +09:00
s-choi
918b7f7218 [EDIT] 目標の一覧を受け取るように修正・作成と削除機能の追加 2026-09-24 14:09:22 +09:00
e0b0109a2b Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-24 13:39:17 +09:00
s-choi
76e3fc2345 [FIX] Goalテーブルの変更に合わせてUserメソッドの修正をおこないました。 2026-09-24 13:32:23 +09:00
bcafdbe067 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-24 13:22:18 +09:00
s-choi
e9d3e16157 [EDIT] 変更したテーブルに合わせてメソッドを修正しました。 2026-09-24 13:20:14 +09:00
s-choi
70ad3678a5 [EDIT] Userテーブルを修正しました。 2026-09-24 13:19:53 +09:00
s-choi
b2b290a998 [EDIT] 目標テーブルを修正しました。 2026-09-24 13:19:23 +09:00
s-choi
1debde25f2 [EDIT] menu画面での目標表示を削除しました。 2026-09-24 13:19:04 +09:00
s-choi
714ffba31f [EDIT] ショートカット機能を適用しました。 2026-09-24 12:43:45 +09:00
s-choi
430f456866 [ADD] ショートカット機能のCRDを作成しました。 2026-09-24 12:43:19 +09:00
s-choi
003e03c0c1 [ADD] ショートカットのためのサービスとレポジトリを作成しました。 2026-09-24 12:42:50 +09:00
s-choi
060102d2b1 [ADD] 固定費登録画面を追加しました。 2026-09-24 12:42:22 +09:00
s-choi
f5b88de9e6 [ADD] 固定費一覧画面を追加しました。 2026-09-24 12:42:14 +09:00
s-choi
68bfbc195d [EDIT] 固定費一覧への遷移ボタンを追加しました。 2026-09-24 12:42:02 +09:00
s-choi
11a8fbf665 [ADD] ショートカット機能のためのEntity/Model/Formを追加しました。 2026-09-24 12:41:31 +09:00
3760bf352d Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-24 12:30:04 +09:00
kkazuya
87fbc67a02 Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-24 11:05:52 +09:00
kkazuya
2139cad2b7 [EDIT] コース変更画面のみフッターが表示されるよう修正しました。 2026-09-24 11:05:26 +09:00
2fcc56b24b Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-24 11:01:36 +09:00
3b97d1f432 [EDIT]認証画面のフッターの削除 2026-09-24 10:55:03 +09:00
8fa363ad56 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-24 10:53:24 +09:00
kkazuya
f10f9f83de [EDIT] URLパターンを変更しました。 2026-09-24 10:52:52 +09:00
kkazuya
6fb4ac0161 [EDIT] コース選択画面へのヘッダーの追加と、ラジオボタンのcheckedを追加しました。 2026-09-24 10:51:49 +09:00
kkazuya
428cb0fd64 [EDIT] コース選択のデフォルトをバランスコースにするよう編集しました。ログイン済みのユーザーがコースを変更できるようにしました。 2026-09-24 10:50:39 +09:00
149f9b220c Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-24 10:47:05 +09:00
kkazuya
df28fa8ccd Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-kobayashi 2026-09-24 10:46:45 +09:00
41aa5a5b7b [EDIT]Bootstrapの追加 2026-09-24 10:45:00 +09:00
s-choi
5ca3226dfa [FIX] userに目標が紐づけられない問題を修正しました。 2026-09-24 10:41:38 +09:00
ff896c77cb Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-morimto 2026-09-24 10:39:30 +09:00
s-choi
65d80e6306 [FIX] 目標カラムの条件と読み取れない問題を修正しました。 2026-09-24 10:39:03 +09:00
1197955f70 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-morimto 2026-09-24 10:20:58 +09:00
336adf0dec Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-24 10:20:26 +09:00
76e91f0bf0 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-24 10:19:55 +09:00
s-choi
642cd7ee69 [STYLE] 余計な行をけしました。 2026-09-24 10:19:27 +09:00
52fe77a5b4 [EDIT]パスワード再設定のバグ修正 2026-09-24 10:12:02 +09:00
ac85c2dc23 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-morimto 2026-09-24 10:11:19 +09:00
s-choi
21ca1a72e2 [FIX] 送り先の修正及び変数名、表示法の修正 2026-09-24 10:03:30 +09:00
s-choi
56bb709921 [ADD] 会員登録のためのHTMLファイル追加 2026-09-24 10:02:53 +09:00
s-choi
e2ddffcc60 [HOTFIX] 質問の読み込み、コース名のセッション変数登録、DB登録機能追加など。 2026-09-24 10:02:22 +09:00
s-choi
51310bae25 [FIX] 会員登録の際、コースを直接設定するようにしました。 2026-09-24 10:01:15 +09:00
s-choi
08c2c06f4a [FIX] コーディングルールと異なる変数名を修正しました。 2026-09-24 10:00:36 +09:00
s-choi
06c2d35512 [EDIT] 名前をもとに情報を取得する機能を追加しました。 2026-09-24 09:59:58 +09:00
s-choi
4192faecc2 [ADD] 質問リストを受け取るメソッドを作成しました。 2026-09-24 09:59:21 +09:00
s-choi
19218d868c [FIX] mapping errorを修正しました。 2026-09-24 09:58:38 +09:00
8282331339 [EDIT]パスワード再設定までの遷移のバグ修正 2026-09-24 09:41:04 +09:00
1759c45fea [EDIT]URLの修正 2026-09-18 16:14:08 +09:00
44ac862bdb Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-18 16:11:57 +09:00
s-choi
5939e75f86 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi
# Conflicts:
#	src/main/java/com/example/demo/app/presentation/controller/CourseController.java
2026-09-18 16:11:27 +09:00
ed7a3a67b7 [EDIT]メニュー画面で現在高の表示をできる用にしました。 2026-09-18 16:11:20 +09:00
s-choi
41c5f6e99e Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-18 16:08:28 +09:00
s-choi
af3e171006 [EDIT] セッションチェック機能をつけました。 2026-09-18 16:08:07 +09:00
kkazuya
31a6ce44a4 [EDIT] コース選択機能を修正しました 2026-09-18 16:04:53 +09:00
79b1abeac6 [EDIT]二次実装である支出分析の年月表示を実装しました 2026-09-18 16:03:32 +09:00
1d010dc02b [ADD]プロフィール編集の作成 2026-09-18 16:01:33 +09:00
s-choi
d308f14df4 [ADD] セッションチェックAOPを追加しました。 2026-09-18 15:51:48 +09:00
s-choi
a36705d83f [ADD] カスタム例外を追加しました。 2026-09-18 15:51:21 +09:00
s-choi
ab802cdb25 [DELETE/ADD] 例外Handlerを再作成しました。 2026-09-18 15:50:26 +09:00
s-choi
1160af5711 Merge branch 'k-oshita' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-18 15:36:18 +09:00
s-choi
d2cf2e6e98 [EDIT] 一覧画面でのつき選択機能を追加しました。 2026-09-18 15:35:53 +09:00
69213bcf9c [EDIT] 目標の編集画面で期限の値が渡せてない問題の修正をしました。 2026-09-18 15:26:51 +09:00
e0a7a3496f [FIX]本文の空白を作成しました 2026-09-18 15:10:55 +09:00
f35a3e03d7 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-18 15:10:15 +09:00
9a1d7144a8 [FIX]本文の空白を作成しました 2026-09-18 15:09:56 +09:00
s-choi
d83559e937 [EDIT] headerとの間隔を調整しました。 2026-09-18 15:06:49 +09:00
s-choi
db65afe184 [EDIT] userIdでUserEntity情報を取得するメソッドを追加しました。 2026-09-18 15:06:16 +09:00
s-choi
34e9a17273 [FIX] userの整合性を修正・変換メソッドを追加しました。 2026-09-18 15:05:44 +09:00
s-choi
3378f81a2d [EDIT] 月転換機能を追加しました。現在セッションユーザーの目標に関する情報をメニューで取得するように変更しました。 2026-09-18 15:05:11 +09:00
f588e29b46 [EDIT]プロフィールの編集 2026-09-18 14:57:43 +09:00
11fbec6d8c [EDIT]目標のヘッダーとフッターを表示するように変更。 2026-09-18 14:45:59 +09:00
2372c81ddd Merge branch 's-morimto' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-18 14:44:40 +09:00
254286f14e [EDIT]新規会員登録のコース選択の修正 2026-09-18 14:41:17 +09:00
d8ea1acf2f [EDIT]達成率が画面に表示されるようにしました 2026-09-18 14:35:06 +09:00
dfcc49ad94 [ADD]プロフィールの作成 2026-09-18 14:22:50 +09:00
kkazuya
9259a53bad [EDIT] コースのコントローラとビュー、ユーザーサービスを修正しました。 2026-09-18 14:16:00 +09:00
s-choi
ad1121d694 [FIX] 日付の設定をデフォルト値を設定しました。 2026-09-18 14:06:57 +09:00
s-choi
6ca5a9eeec [STYLE] 家計簿関連ページのスタイルを修正しました。 2026-09-18 14:03:54 +09:00
709f5e14da [EDIT]画面の上下に空白を作りました 2026-09-18 14:00:20 +09:00
6197b12ac4 [EDIT]ヘッダーを固定化しました 2026-09-18 13:59:50 +09:00
18faec044e Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-18 13:59:17 +09:00
s-choi
b49c9156a1 [FIX] 全体的な整合性を確認しました。 2026-09-18 13:58:12 +09:00
6b4ae5bd96 Merge branch 'k-oshita' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-morimto 2026-09-18 13:58:07 +09:00
s-choi
9cdf7b7767 [EDIT] 収支一覧にデザインを追加しました。 2026-09-18 13:57:51 +09:00
s-choi
6dd182ed0b [ADD] 収支編集画面を作成しました。 2026-09-18 13:57:30 +09:00
s-choi
04d62956f7 [EDIT] 日付が自動で記入されるように変更しました。 2026-09-18 13:57:08 +09:00
s-choi
a5c9ab9abe [EDIT] 該当テーブルの収支の情報を取得するメソッドを追加しました。 2026-09-18 13:56:27 +09:00
s-choi
200ebe2a61 [EDIT] 収支IDでカテゴリエンティティを取得するメソッドを作成しました。 2026-09-18 13:55:32 +09:00
s-choi
2300aa3644 [EDIT] 収支詳細画面のデザインを作成しました。 2026-09-18 13:54:32 +09:00
s-choi
d415bf1ad5 [EDIT] 収支詳細に編集ボタンを追加しました。 2026-09-18 13:53:27 +09:00
s-choi
12550c5b1d [STYLE] menuのデザインを変更しました。 2026-09-18 13:51:59 +09:00
a2b1922548 Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-morimto 2026-09-18 13:35:40 +09:00
1386f4b886 [ADD]新規会員登録のserviceの作成 2026-09-18 13:35:06 +09:00
15bf2949bc [EDIT] 目標を表示する機能を追加しました。 2026-09-18 13:32:14 +09:00
be9abffeaa Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita 2026-09-18 13:30:15 +09:00
d696d8f376 [EDIT]フッターの読み込みコードを追加しました 2026-09-18 13:26:49 +09:00
066d76148b [ADD]フッター画面を追加しました。 2026-09-18 13:26:12 +09:00
603d0d083a [ADD]消えたファイルの追加 2026-09-18 13:20:59 +09:00
cbd5aa6a7d Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-morimto 2026-09-18 13:12:35 +09:00
43740691b5 [EDIT]Loginの修正 2026-09-18 13:07:23 +09:00
7719c002ff [ADD]共通例外処理を実装しました 2026-09-18 12:46:43 +09:00
8884a74625 [ADD]エラー画面処理を実装しました 2026-09-18 12:46:14 +09:00
kkazuya
61da5163b0 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/presentation/controller/UserController.java
#	src/main/resources/templates/login.html
#	src/main/resources/templates/password_reset.html
2026-09-18 12:31:44 +09:00
30a2ef3e21 [EDIT]画面遷移の修正 2026-09-18 11:30:50 +09:00
938574654f [EDIT]Loginに関する修正 2026-09-18 11:28:40 +09:00
s-choi
20b4366d91 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi
# Conflicts:
#	src/main/java/com/example/demo/app/domain/service/impl/CourseInfoServiceImpl.java
2026-09-18 11:22:52 +09:00
s-choi
952c6f69d8 Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-choi 2026-09-18 11:19:44 +09:00
2e427c8189 [EDIT]ヘッダーの読み込みコードを追加しました 2026-09-18 11:19:11 +09:00
0558555315 [ADD]ヘッダーの機能画面追加 2026-09-18 11:18:48 +09:00
s-choi
ff65d8c045 [EDIT] menu画面のためのメソッドを作成しました。 2026-09-18 11:14:23 +09:00
e43028c0ee Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-morimto 2026-09-18 11:13:59 +09:00
s-choi
594f09553a [FIX] parameter名を正しく修正しました。 2026-09-18 11:13:50 +09:00
7ddebf7a4a [RENAME]A→aに変更 2026-09-18 11:13:27 +09:00
s-choi
52f2559cf7 [ADD] 収支の作成・削除・一覧検索・単体検索機能を追加しました。menu画面の追加及びカレンダー機能を追加しました。 2026-09-18 11:13:20 +09:00
s-choi
039f416f49 [EDIT] ログイン後の遷移先を修正しました。 2026-09-18 11:11:28 +09:00
cb7a3f542b Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita
# Conflicts:
#	src/main/java/com/example/demo/app/domain/service/impl/CourseInfoServiceImpl.java
2026-09-18 11:11:19 +09:00
s-choi
ed8e971368 [EDIT] 収入・支出の一覧を取得する機能追加しました。 2026-09-18 11:11:02 +09:00
b48b3ae0bd [ADD]profileの作成 2026-09-18 11:10:45 +09:00
kkazuya
8b6e20cb3a [EDIT] service,serviceInfoControllerを修正しました 2026-09-18 11:10:38 +09:00
s-choi
8f3ea4cd26 [ADD] 支出・収入のクラスを作成しました。 2026-09-18 11:09:25 +09:00
57749b6354 Merge remote-tracking branch 'origin/k-kobayashi' into s-morimto 2026-09-18 11:08:36 +09:00
a8c46cc9db Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-morimto 2026-09-18 11:08:05 +09:00
702dd24d2e Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita
# Conflicts:
#	src/main/java/com/example/demo/app/presentation/form/AnalysisForm.java
#	src/main/java/com/example/demo/app/presentation/form/CategoryAnalysisForm.java
2026-09-18 11:04:06 +09:00
d71194659b [FIX]ゴールモデルのバグ修正 2026-09-18 11:02:42 +09:00
f685b10d01 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito
# Conflicts:
#	src/main/java/com/example/demo/app/domain/service/CourseInfoService.java
#	src/main/java/com/example/demo/app/domain/service/CourseService.java
2026-09-18 11:01:44 +09:00
44ceb0ca07 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into k-oshita
# Conflicts:
#	src/main/java/com/example/demo/app/domain/model/GoalModel.java
#	src/main/java/com/example/demo/app/domain/service/CourseInfoService.java
2026-09-18 11:01:21 +09:00
kkazuya
f955667682 [ADD] いろいろ追加 2026-09-18 11:00:02 +09:00
kkazuya
b062f64ea4 [EDIT] /// 2026-09-18 10:59:01 +09:00
614533e2b0 Merge remote-tracking branch 'origin/k-kobayashi' into k-oshita
# Conflicts:
#	src/main/java/com/example/demo/app/domain/service/CourseService.java
2026-09-18 10:57:42 +09:00
kkazuya
00b584372e [EDIT] // 2026-09-18 10:57:07 +09:00
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
7e91071379 Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito
# Conflicts:
#	src/main/java/com/example/demo/app/domain/service/impl/CourseServiceImpl.java
2026-09-18 10:55:53 +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
abe5573c88 [ADD]支出分析画面のためのformクラスを作成しました。 2026-09-18 09:53:53 +09:00
46fd6ee60c Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-18 09:47:18 +09:00
e40c64c2a9 [FIX]プッシュエラーのため、コミットリセット 2026-09-18 09:46:13 +09:00
05dbbb4053 Merge branch 'n-kawahito' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-18 09:41:52 +09:00
aa2a511d2b Merge branch 'k-kobayashi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-18 09:41:38 +09:00
6d494e1ac1 Merge branch 'k-oshita' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-18 09:37:07 +09:00
1c61909a48 Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into n-kawahito 2026-09-18 09:28:17 +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
136 changed files with 8302 additions and 0 deletions

1
.gitignore vendored
View File

@@ -31,3 +31,4 @@ build/
### VS Code ###
.vscode/
/bin/

View File

@@ -83,6 +83,11 @@
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
<version>0.4</version>
</dependency>
</dependencies>
<build>

View File

@@ -0,0 +1,11 @@
package com.example.demo.aop.aspect;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface SessionCheck {
}

View File

@@ -0,0 +1,41 @@
package com.example.demo.aop.aspect;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpSession;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.example.demo.exception.NoSessionException;
@Aspect
@Component
public class SessionCheckAspect {
HttpServletRequest request;
@Autowired
public SessionCheckAspect(HttpServletRequest request) {
this.request = request;
}
@Pointcut("@annotation(com.example.demo.aop.aspect.SessionCheck)")
public void sessionCheckMethod() {
}
@Before("sessionCheckMethod()")
public void checkSession() {
HttpSession session = request.getSession(false);
if (session == null || session.getAttribute("loginUser") == null) {
throw new NoSessionException("不正なログインです");
}
}
}

View File

@@ -0,0 +1,65 @@
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.exception.NoSessionException;
@ControllerAdvice
public class GlobalExceptionHandler {
private final static Logger LOGGER = Logger.getLogger(GlobalExceptionHandler.class.getName());
private final String SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION = "不正な遷移です。";
private final String SEVERE_ERROR_MESSAGE_BAD_REQUEST = "不正なリクエストです。";
@ExceptionHandler(NoSessionException.class)
public String handleNoSessionException(Model model, Exception e) {
e.printStackTrace();
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
model.addAttribute(
"errorMessage",
"システムエラーが発生しました。"
+ "初めからやり直してください。");
return "redirect:/login";
}
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
public String handleBadRequestException(Model model, Exception e, HttpSession session) {
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
model.addAttribute("status", HttpStatus.BAD_REQUEST.value());
e.printStackTrace();
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
System.out.println("session invalidated");
session.invalidate();
return "error";
}
@ExceptionHandler(Exception.class)
public String AllException(Model model, Exception e, HttpSession session) {
e.printStackTrace();
System.out.println("session invalidated exception");
session.invalidate();
return "error";
}
}

View File

@@ -0,0 +1,42 @@
package com.example.demo.app.domain.model;
import java.util.List;
import com.example.demo.app.infra.entity.AllocationEntity;
import com.example.demo.app.infra.entity.CategoryEntity;
import com.example.demo.app.infra.entity.CourseEntity;
import com.example.demo.app.presentation.form.AllocationForm;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class AllocationModel {
private Long categoryId;
private Long courseId;
private Integer allocationRatio;
public static AllocationModel convertFrom(AllocationEntity allocationEntity) {
return new AllocationModel(allocationEntity.getCategoryEntity().getCategoryId(), allocationEntity.getCourseEntity().getCourseId(), allocationEntity.getAllocationRatio());
}
public static List<AllocationModel> convertFrom(List<AllocationEntity> allocationEntityList){
return allocationEntityList.stream().map(AllocationModel::convertFrom).toList();
}
public static AllocationModel convertFrom1(AllocationForm allocationForm) {
return new AllocationModel(allocationForm.getCategoryId(), allocationForm.getCourseId(), allocationForm.getAllocationRatio());
}
public static List<AllocationModel> convertFrom1(List<AllocationForm> allocationFormList){
return allocationFormList.stream().map(AllocationModel::convertFrom1).toList();
}
public static AllocationEntity convertTo(CategoryEntity categoryEntity, CourseEntity courseEntity, Integer allocationRatio) {
return new AllocationEntity(categoryEntity, courseEntity, 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,10 @@
package com.example.demo.app.domain.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class AuthenticationModel {
private Long userId;
}

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,42 @@
package com.example.demo.app.domain.model;
import java.util.List;
import com.example.demo.app.infra.entity.CategoryEntity;
import com.example.demo.app.infra.entity.UserEntity;
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();
}
public static CategoryEntity convertTo(CategoryModel categoryModel, UserEntity userEntity) {
return new CategoryEntity(
categoryModel.getCategoryId(),
categoryModel.getCategoryName(),
categoryModel.getTransactionType(),
userEntity,
0,
null,
null);
}
}

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,35 @@
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();
}
public static CourseEntity convertTo(CourseModel courseModel) {
return new CourseEntity(
courseModel.getCourseId(),
courseModel.getCourseName(),
courseModel.getDescription());
}
}

View File

@@ -0,0 +1,49 @@
package com.example.demo.app.domain.model;
import java.util.List;
import com.example.demo.app.infra.entity.CategoryEntity;
import com.example.demo.app.infra.entity.FixedCostEntity;
import com.example.demo.app.infra.entity.UserEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class FixedCostModel {
private Long fixedCostId;
private Long userId;
private Long categoryId;
private String fixedCostName;
private Integer amount;
public static FixedCostModel convertFrom(FixedCostEntity fixedCostEntity) {
return new FixedCostModel(
fixedCostEntity.getFixedCostId(),
fixedCostEntity.getUserEntity().getUserId(),
fixedCostEntity.getCategoryEntity().getCategoryId(),
fixedCostEntity.getFixedCostName(),
fixedCostEntity.getAmount());
}
public static List<FixedCostModel> convertFrom(List<FixedCostEntity> fixedCostEntityList) {
return fixedCostEntityList.stream().map(FixedCostModel::convertFrom).toList();
}
public static FixedCostEntity convertTo(FixedCostModel fixedCostModel, UserEntity userEntity, CategoryEntity categoryEntity) {
return new FixedCostEntity(
fixedCostModel.getFixedCostId(),
userEntity,
categoryEntity,
fixedCostModel.getFixedCostName(),
fixedCostModel.getAmount());
}
}

View File

@@ -0,0 +1,76 @@
package com.example.demo.app.domain.model;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import com.example.demo.app.infra.entity.GoalEntity;
import com.example.demo.app.infra.entity.UserEntity;
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;
private Integer achievementRate; // 達成率
private Integer currentAmount; // 現在の資産
private Long userId;
private List<Integer> savingList;
public static GoalModel convertFrom(GoalEntity goalEntity, int achievementRate, int currentAmount) {
return new GoalModel(
goalEntity.getGoalId(),
goalEntity.getGoalTitle(),
goalEntity.getGoalSubtitle(),
goalEntity.getTargetAmount(),
goalEntity.getDeadline(),
goalEntity.getGoalComplete(),
achievementRate,
currentAmount,
goalEntity.getUserEntity().getUserId(),
new ArrayList<>());
}
public static GoalEntity convertTo(GoalModel goalModel, UserEntity userEntity) {
return new GoalEntity(
goalModel.getGoalId(),
goalModel.getGoalTitle(),
goalModel.getGoalSubtitle(),
goalModel.getTargetAmount(),
goalModel.getDeadline(),
0,
userEntity);
}
public static GoalModel convertFrom(GoalForm goalForm) {
return new GoalModel(
goalForm.getGoalId(),
goalForm.getGoalTitle(),
goalForm.getGoalSubtitle(),
goalForm.getTargetAmount(),
goalForm.getDeadline(),
goalForm.getGoalComplete()
,null,null,
goalForm.getUserId(),
new ArrayList<>());
}
}

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,18 @@
package com.example.demo.app.domain.model;
import java.time.LocalDate;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class ProfileModel {
private Long userId;
private String userName;
private String mailAddress;
private LocalDate birthDate;
private Integer saving;
private Integer annualIncome;
private Integer monthlyBudget;
}

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,42 @@
package com.example.demo.app.domain.model;
import java.time.LocalDate;
import com.example.demo.app.infra.entity.UserEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class UserModel {
private Long userId;
private String userName;
private String mailAddress;
private String password;
private Long secretQuestionId;
private String secretAnswer;
private LocalDate brithDate;
private Integer saving;
private Integer annualIncome;
private Integer monthlyBudget;
private Long courseId;
private Integer deleteFlag;
public static UserModel convertFrom(UserEntity userEntity) {
return new UserModel(
userEntity.getUserId(),
userEntity.getUserName(),
userEntity.getMailAddress(),
userEntity.getPassword(),
userEntity.getQuestionEntity().getSecretQuestionId(),
userEntity.getSecretQuestionAnswer(),
userEntity.getBirthDate(),
userEntity.getSaving(),
userEntity.getAnnualIncome(),
userEntity.getMonthlyBudget(),
userEntity.getCourseEntity().getCourseId(),
userEntity.getDeleteFlag()
);
}
}

View File

@@ -0,0 +1,13 @@
package com.example.demo.app.domain.service;
import java.util.List;
import com.example.demo.app.domain.model.AllocationModel;
public interface AllocationService {
public List<AllocationModel> findAll();
public List<AllocationModel> save(List<AllocationModel> allocationModelList);
}

View File

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

View File

@@ -0,0 +1,9 @@
package com.example.demo.app.domain.service;
import com.example.demo.app.domain.model.AuthenticationModel;
import com.example.demo.app.presentation.form.AuthenticationForm;
public interface AuthenticationService {
AuthenticationModel authenticate(AuthenticationForm authenticationForm);
}

View File

@@ -0,0 +1,24 @@
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);
public CategoryModel findByTransactionId(Long transactionId);
public List<CategoryModel> findAllByuserId(Long userId);
public void delete(Long categoryId);
public CategoryModel save(CategoryModel categoryModel, Long userId);
public List<CategoryModel> findAllExceptCustom();
}

View File

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

View File

@@ -0,0 +1,23 @@
package com.example.demo.app.domain.service;
import java.util.List;
import com.example.demo.app.domain.model.CourseModel;
public interface CourseService {
public List<CourseModel> findAll();
public CourseModel findById(Long courseId);
public Long findByName(String courName);
public CourseModel save(CourseModel courseModel, Long userId);
public List<CourseModel> findAllByUserId(Long userId);
public List<CourseModel> findAllByNull();
}

View File

@@ -0,0 +1,16 @@
package com.example.demo.app.domain.service;
import java.util.List;
import com.example.demo.app.domain.model.FixedCostModel;
public interface FixedCostService {
public List<FixedCostModel> findAllByUserId(Long userId);
public FixedCostModel save(FixedCostModel fixedCostModel);
public void delete(Long fixedCostId);
public FixedCostModel findById(Long fixedCostId);
}

View File

@@ -0,0 +1,25 @@
package com.example.demo.app.domain.service;
import java.util.List;
import com.example.demo.app.domain.model.GoalModel;
public interface GoalService {
GoalModel getGoalById(Long goalId);
public List<GoalModel> getGoalByUserId(Long userId);
public GoalModel createGoal(GoalModel goalModel, Long userId);
GoalModel updateGoal(GoalModel goalModel, Long userId);
public void delete(Long goalId);
public void updateGoalComplete(Long userId);
public int getCurrentAmount(Long userId);
// 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,7 @@
package com.example.demo.app.domain.service;
import com.example.demo.app.presentation.form.PasswordResetForm;
public interface PasswordResetService {
boolean resetPassword(Long userId, PasswordResetForm passwordResetForm);
}

View File

@@ -0,0 +1,10 @@
package com.example.demo.app.domain.service;
import com.example.demo.app.domain.model.ProfileModel;
import com.example.demo.app.presentation.form.ProfileEditForm;
public interface ProfileService {
ProfileModel findOne(Long userId);
void withdraw(Long userId);
void update(Long userId, ProfileEditForm profileEditForm);
}

View File

@@ -0,0 +1,9 @@
package com.example.demo.app.domain.service;
import java.util.List;
import com.example.demo.app.infra.entity.QuestionEntity;
public interface QuestionService {
public List<QuestionEntity> findAll();
}

View File

@@ -0,0 +1,35 @@
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;
import com.example.demo.app.presentation.form.Expense;
import com.example.demo.app.presentation.form.Income;
public interface TransactionService {
public TransactionModel findByTransactionId(Long transactionId);
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 findMoneyRecord(Long transactionId);
public int createTransaction(TransactionModel transactionModel);
public int updateTransaction(TransactionModel transactionModel);
public void deleteTransaction(Long transactionId);
public List<Income> findTotalIncomeList(LocalDate startDate, LocalDate endDate, Long userId);
public List<Expense> findTotalExpenseList(LocalDate startDate, LocalDate endDate, Long userId);
}

View File

@@ -0,0 +1,13 @@
package com.example.demo.app.domain.service;
import com.example.demo.app.domain.model.UserModel;
import com.example.demo.app.presentation.form.UserForm;
public interface UserService {
public void register(UserForm userForm, Long courseId);
public void updateCourse(Long userId, Long courseId);
public UserModel findByUserId(Long userId);
}

View File

@@ -0,0 +1,51 @@
package com.example.demo.app.domain.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.AllocationModel;
import com.example.demo.app.domain.service.AllocationService;
import com.example.demo.app.infra.entity.AllocationEntity;
import com.example.demo.app.infra.repository.AllocationRepository;
import com.example.demo.app.infra.repository.CategoryRepository;
import com.example.demo.app.infra.repository.CourseRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class AllocationServiceImpl implements AllocationService {
private final AllocationRepository allocationRepository;
private final CategoryRepository categoryRepository;
private final CourseRepository courseRepository;
public List<AllocationModel> findAll() {
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

@@ -0,0 +1,147 @@
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, Integer year, Integer month) {
// ユーザー情報取得、月別使用可能資金取得
UserEntity userEntity = userRepository.findById(userId).orElseThrow(() ->
new RuntimeException(
"User not found."));
// コースID取得
Long courseId = userEntity.getCourseEntity().getCourseId();
// 月別使用可能資金取得
Integer monthlyBudget =userEntity.getMonthlyBudget();
// 今月の期間取得
LocalDate targetDate = LocalDate.of(year, month, 1);
LocalDate currentMonthStartDate = targetDate.withDayOfMonth(1);
LocalDate currentMonthEndDate = targetDate.withDayOfMonth(targetDate.lengthOfMonth());
// 前月の期間取得
LocalDate previousDate = targetDate.minusMonths(1);
LocalDate previousMonthStartDate = previousDate.withDayOfMonth(1);
LocalDate previousMonthEndDate = previousDate.withDayOfMonth(previousDate.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,42 @@
package com.example.demo.app.domain.service.impl;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.AuthenticationModel;
import com.example.demo.app.domain.service.AuthenticationService;
import com.example.demo.app.infra.entity.UserEntity;
import com.example.demo.app.infra.repository.UserRepository;
import com.example.demo.app.presentation.form.AuthenticationForm;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class AuthenticationServiceImpl implements AuthenticationService {
private final UserRepository userRepository;
@Override
public AuthenticationModel authenticate(AuthenticationForm authenticationForm) {
UserEntity userEntity = userRepository.findByMailAddress(
authenticationForm.getMailAddress())
.orElse(null);
if (userEntity == null) {
return null;
}
if (!userEntity.getQuestionEntity().getSecretQuestionId()
.equals(authenticationForm.getSecretQuestionId())) {
return null;
}
if (!userEntity.getSecretQuestionAnswer()
.equals(authenticationForm.getSecretAnswer())) {
return null;
}
return new AuthenticationModel(userEntity.getUserId());
}
}

View File

@@ -0,0 +1,82 @@
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 com.example.demo.app.infra.repository.UserRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class CategoryServiceImpl implements CategoryService {
private final CategoryRepository categoryRepository;
private final UserRepository userRepository;
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);
}
public CategoryModel findByTransactionId(Long transactionId) {
return CategoryModel.convertFrom(categoryRepository.findByTransactionId(transactionId));
}
public List<CategoryModel> findAllByuserId(Long userId) {
return CategoryModel.convertFrom(categoryRepository.findByUserId(userId));
}
public void delete(Long categoryId) {
categoryRepository.deleteById(categoryId);
}
public CategoryModel save(CategoryModel categoryModel, Long userId) {
return CategoryModel.convertFrom(
categoryRepository.save(CategoryModel.convertTo(categoryModel, userRepository.findById(userId).get())));
}
public List<CategoryModel> findAllExceptCustom() {
return CategoryModel.convertFrom(categoryRepository.findAllExceptCustom());
}
}

View File

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

View File

@@ -0,0 +1,74 @@
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.CourseModel;
import com.example.demo.app.domain.service.CourseService;
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.CourseOwnerRepository;
import com.example.demo.app.infra.repository.CourseRepository;
import com.example.demo.app.infra.repository.UserRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class CourseServiceImpl implements CourseService {
private final CourseRepository courseRepository;
private final UserRepository userRepository;
private final CourseOwnerRepository courseOwnerRepository;
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));
}
public Long findByName(String courseName) {
return courseRepository.findByCourseName(courseName).getCourseId();
}
@Transactional
public CourseModel save(CourseModel courseModel, Long userId) {
List<UserEntity> userEntityList = new ArrayList<>();
userEntityList.add(userRepository.findById(userId).get());
CourseEntity result = courseRepository.save( CourseModel.convertTo(courseModel));
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);
return CourseModel.convertFrom(result);
}
}

View File

@@ -0,0 +1,48 @@
package com.example.demo.app.domain.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.FixedCostModel;
import com.example.demo.app.domain.service.FixedCostService;
import com.example.demo.app.infra.repository.CategoryRepository;
import com.example.demo.app.infra.repository.FixedCostRepository;
import com.example.demo.app.infra.repository.UserRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class FixedCostServiceImpl implements FixedCostService{
private final FixedCostRepository fixedCostRepository;
private final UserRepository userRepository;
private final CategoryRepository categoryRepository;
public List<FixedCostModel> findAllByUserId(Long userId) {
return FixedCostModel.convertFrom(fixedCostRepository.findByUserId(userId));
}
public FixedCostModel save(FixedCostModel fixedCostModel) {
return FixedCostModel.convertFrom(fixedCostRepository.save( FixedCostModel.convertTo(fixedCostModel, userRepository.findById(fixedCostModel.getUserId()).get(), categoryRepository.findById(fixedCostModel.getCategoryId()).get())));
}
public void delete(Long fixedCostId) {
fixedCostRepository.deleteById(fixedCostId);
}
public FixedCostModel findById(Long fixedCostId) {
return FixedCostModel.convertFrom(fixedCostRepository.findById(fixedCostId).get());
}
}

View File

@@ -0,0 +1,143 @@
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.GoalModel;
import com.example.demo.app.domain.service.GoalService;
import com.example.demo.app.infra.entity.GoalEntity;
import com.example.demo.app.infra.entity.UserEntity;
import com.example.demo.app.infra.repository.GoalRepository;
import com.example.demo.app.infra.repository.TransactionRepository;
import com.example.demo.app.infra.repository.UserRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class GoalServiceImpl implements GoalService {
private final GoalRepository goalRepository;
private final UserRepository userRepository;
private final TransactionRepository transactionRepository;
@Override
public GoalModel getGoalById(Long goalId) {
GoalEntity goalEntity = goalRepository.findById(goalId).orElse(null);
return GoalModel.convertFrom(goalEntity, 0, 0);
}
@Override
public List<GoalModel> getGoalByUserId(Long userId) {
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
List<GoalEntity> goalEntityList = goalRepository.findAllByUserId(userId);
// 収支の合計を計算(収入はプラス、支出はマイナス)
int transactionTotal = userEntity.getTransactionEntityList().stream()
.mapToInt(t -> {
int sign = t.getCategoryEntity().getTransactionType() == 1 ? 1 : -1;
return sign * t.getAmount();
})
.sum();
// 現在の資産 = 貯蓄金 + 収支合計
int currentAmount = userEntity.getSaving() + transactionTotal;
// 達成率(%) = 現在の資産 ÷ 目標金額 × 100
List<GoalModel> goalModelList = new ArrayList<GoalModel>();
goalEntityList.stream()
.forEach(goalEntity -> goalModelList.add(GoalModel.convertFrom(goalEntity,
(goalEntity.getTargetAmount() == null)
? 0
: (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);
return GoalModel.convertFrom(savedGoalEntity, 0, 0);
}
@Override
public GoalModel updateGoal(GoalModel goalModel, Long userId) {
GoalEntity goalEntity = GoalModel.convertTo(goalModel, userRepository.findById(userId).get());
GoalEntity updatedGoalEntity = goalRepository.save(goalEntity);
return GoalModel.convertFrom(updatedGoalEntity, 0, 0);
}
public void delete(Long goalId) {
goalRepository.deleteById(goalId);
}
@Transactional
public void updateGoalComplete(Long userId) {
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
List<GoalEntity> goalEntityList = goalRepository.findAllByUserId(userId);
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;
goalEntityList.stream().forEach(goalEntity -> {
if (goalEntity.getTargetAmount() <= currentAmount) {
goalRepository.updateCompleteByGoalId(goalEntity.getGoalId());
}
});
}
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

@@ -0,0 +1,54 @@
package com.example.demo.app.domain.service.impl;
import org.mindrot.jbcrypt.BCrypt;
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
.findByMailAddress(mailAddress)
.orElse(null);
if (userEntity == null) {
return null;
}
boolean isValidPassword = false;
if (userEntity.getPassword().length() <= 24) {
if (userEntity.getPassword().equals(password)) {
userEntity.setPassword(BCrypt.hashpw(password, BCrypt.gensalt()));
userRepository.save(userEntity);
isValidPassword = true;
} else {
return null;
}
} else {
isValidPassword = BCrypt.checkpw(password, userEntity.getPassword());
}
if (!isValidPassword) {
return null;
}
return new LoginModel(userEntity.getUserId());
}
}

View File

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

View File

@@ -0,0 +1,64 @@
package com.example.demo.app.domain.service.impl;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.ProfileModel;
import com.example.demo.app.domain.service.ProfileService;
import com.example.demo.app.infra.entity.UserEntity;
import com.example.demo.app.infra.repository.UserRepository;
import com.example.demo.app.presentation.form.ProfileEditForm;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class ProfileServiceImpl implements ProfileService{
private final UserRepository userRepository;
@Override
public ProfileModel findOne(Long userId) {
UserEntity userEntity = userRepository.findById(userId).orElse(null);
if(userEntity == null) {
return null;
}
return new ProfileModel(
userEntity.getUserId(),
userEntity.getUserName(),
userEntity.getMailAddress(),
userEntity.getBirthDate(),
userEntity.getSaving(),
userEntity.getAnnualIncome(),
userEntity.getMonthlyBudget());
}
@Override
public void withdraw(Long userId) {
UserEntity userEntity = userRepository.findById(userId).orElse(null);
if (userEntity == null) {
return;
}
userEntity.setDeleteFlag(1);
userRepository.save(userEntity);
}
@Override
public void update(Long userId, ProfileEditForm profileEditForm) {
UserEntity userEntity = userRepository.findById(userId).orElse(null);
if (userEntity == null) {
return;
}
userEntity.setUserName(profileEditForm.getUserName());
userEntity.setMailAddress(profileEditForm.getMailAddress());
userEntity.setSaving(profileEditForm.getSaving());
userEntity.setAnnualIncome(profileEditForm.getAnnualIncome());
userEntity.setMonthlyBudget(profileEditForm.getMonthlyBudget());
userEntity.setBirthDate(profileEditForm.getBirthDate());
userRepository.save(userEntity);
}
}

View File

@@ -0,0 +1,23 @@
package com.example.demo.app.domain.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.service.QuestionService;
import com.example.demo.app.infra.entity.QuestionEntity;
import com.example.demo.app.infra.repository.QuestionRepository;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class QuestionServiceImpl implements QuestionService{
private final QuestionRepository questionRepository;
public List<QuestionEntity> findAll() {
return questionRepository.findAll();
}
}

View File

@@ -0,0 +1,168 @@
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 com.example.demo.app.presentation.form.Expense;
import com.example.demo.app.presentation.form.Income;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class TransactionServiceImpl implements TransactionService {
private final TransactionRepository transactionRepository;
private final UserRepository userRepository;
private final CategoryRepository categoryRepository;
public TransactionModel findByTransactionId(Long transactionId) {
return TransactionModel.convertFrom(transactionRepository.findById(transactionId).get());
}
public Map<LocalDate, List<TransactionModel>> findAllByDate(
LocalDate startDate,
LocalDate endDate,
Long userId) {
System.out.println("========== findAllByDate ==========");
System.out.println("startDate = " + startDate);
System.out.println("endDate = " + endDate);
System.out.println("userId = " + userId);
List<TransactionEntity> transactionEntityList = transactionRepository.findAllByDateAndUserId(startDate, endDate,
userId);
System.out.println("Entity count = " + transactionEntityList.size());
transactionEntityList.forEach(t -> {
System.out.println(
"date = " + t.getTransactionDate()
+ ", amount = " + t.getAmount());
});
List<TransactionModel> transactionModelList = TransactionModel.convertFrom(transactionEntityList);
System.out.println("Model count = " + transactionModelList.size());
Map<LocalDate, List<TransactionModel>> transactionModelMap = transactionModelList.stream()
.collect(Collectors.groupingBy(
TransactionModel::getTransactionDate));
System.out.println("Map = " + transactionModelMap);
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.findTotalExpense(startDate, endDate, userId);
}
public List<Income> findTotalIncomeList(LocalDate startDate, LocalDate endDate, Long userId) {
return transactionRepository.findTotalIncomeList(startDate, endDate, userId);
}
public List<Expense> findTotalExpenseList(LocalDate startDate, LocalDate endDate, Long userId) {
return transactionRepository.findTotalExpenseList(startDate, endDate, userId);
}
public List<TransactionModel> findByUserIdAndDate(LocalDate todayDate, Long userId) {
return TransactionModel.convertFrom(transactionRepository.findByUserIdAndDate(todayDate, userId));
}
public int findMoneyRecord(Long transactionId) {
return transactionRepository.findMoneyRecord(transactionId);
}
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;
}
}
public void deleteTransaction(Long transactionId) {
transactionRepository.deleteById(transactionId);
}
}

View File

@@ -0,0 +1,80 @@
package com.example.demo.app.domain.service.impl;
import org.mindrot.jbcrypt.BCrypt;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.UserModel;
import com.example.demo.app.domain.service.UserService;
import com.example.demo.app.infra.entity.CourseEntity;
import com.example.demo.app.infra.entity.GoalEntity;
import com.example.demo.app.infra.entity.QuestionEntity;
import com.example.demo.app.infra.entity.UserEntity;
import com.example.demo.app.infra.repository.CourseRepository;
import com.example.demo.app.infra.repository.GoalRepository;
import com.example.demo.app.infra.repository.QuestionRepository;
import com.example.demo.app.infra.repository.UserRepository;
import com.example.demo.app.presentation.form.UserForm;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class UserServiceImpl implements UserService {
private final UserRepository userRepository;
private final QuestionRepository questionRepository;
private final GoalRepository goalRepository;
private final CourseRepository courseRepository;
@Override
public void register(UserForm userForm, Long courseId) {
UserEntity userEntity = new UserEntity();
userEntity.setUserName(userForm.getUserName());
userEntity.setMailAddress(userForm.getMailAddress());
String passwordHashed = BCrypt.hashpw(userForm.getPassword(), BCrypt.gensalt());
userEntity.setPassword(passwordHashed);
userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer());
userEntity.setBirthDate(userForm.getBirthDate());
userEntity.setSaving(userForm.getSaving());
userEntity.setBirthDate(userForm.getBirthDate());
userEntity.setSaving(userForm.getSaving());
userEntity.setAnnualIncome(userForm.getAnnualIncome());
userEntity.setMonthlyBudget(userForm.getMonthlyBudget());
QuestionEntity questionEntity = questionRepository.findById(userForm.getSecretQuestionId()).orElse(null);
GoalEntity goalEntity = new GoalEntity();
goalEntity.setTargetAmount(Integer.parseInt(String.valueOf(userForm.getGoalId())));
CourseEntity courseEntity = courseRepository.findById(courseId).orElse(null);
userEntity.setQuestionEntity(questionEntity);
userEntity.setCourseEntity(courseEntity);
userEntity.setDeleteFlag(0);
goalEntity.setUserEntity(userRepository.save(userEntity));
goalRepository.save(goalEntity);
}
@Override
public void updateCourse(Long userId, Long courseId) {
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
CourseEntity courseEntity = courseRepository.findById(courseId).orElseThrow();
userEntity.setCourseEntity(courseEntity);
userRepository.save(userEntity);
}
public UserModel findByUserId(Long userId) {
return UserModel.convertFrom(userRepository.findById(userId).get());
}
}

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,50 @@
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.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
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, length = 50)
private String categoryName;
@Column(name = "transaction_type", nullable = false)
private Integer transactionType;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private UserEntity userEntity;
@Column(name = "delete_flag")
private Integer deleteFlag;
@OneToMany(mappedBy = "categoryEntity")
private List<TransactionEntity> transactionEntity;
@OneToMany(mappedBy = "categoryEntity")
private List<AllocationEntity> allocationEntity;
}

View File

@@ -0,0 +1,48 @@
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.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, length = 50)
private String courseName;
@Column(name = "description", nullable = false)
private String description;
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,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

@@ -0,0 +1,42 @@
package com.example.demo.app.infra.entity;
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 = "fixed_cost_t")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class FixedCostEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "fixed_cost_id")
private Long fixedCostId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
private UserEntity userEntity;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "category_id")
private CategoryEntity categoryEntity;
@Column(name = "fixed_cost_name", nullable = false, length = 50)
private String fixedCostName;
@Column(name = "amount", nullable = false)
private Integer amount;
}

View File

@@ -0,0 +1,50 @@
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 = "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 = true)
private Integer targetAmount;
@Column(name = "deadline", nullable = true)
private LocalDate deadline = LocalDate.now().plusYears(1L);
@Column(name = "goal_complete", nullable = false)
private Integer goalComplete = 0;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id")
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,74 @@
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.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, length = 100)
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, length = 100)
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;
@OneToMany(mappedBy = "userEntity")
private List<GoalEntity> goalEntityList;
@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,26 @@
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 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);
@Query("select c from CategoryEntity c inner join TransactionEntity t on c.categoryId = t.categoryEntity.categoryId where t.transactionId = :transactionId")
public CategoryEntity findByTransactionId(Long transactionId);
@Query("select c from CategoryEntity c where c.userEntity.userId = :userId")
public List<CategoryEntity> findByUserId(Long userId);
@Query("select c from CategoryEntity c where c.userEntity.userId is null")
public List<CategoryEntity> findAllExceptCustom();
}

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.CourseOwnerEntity;
public interface CourseOwnerRepository extends JpaRepository<CourseOwnerEntity, Long>{
}

View File

@@ -0,0 +1,24 @@
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.infra.entity.CourseEntity;
public interface CourseRepository extends JpaRepository<CourseEntity, Long> {
@Query("SELECT c FROM CourseEntity c WHERE c.courseId = :courseId ")
public CourseEntity findByCourseId(Long courseId);
@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

@@ -0,0 +1,15 @@
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.infra.entity.FixedCostEntity;
public interface FixedCostRepository extends JpaRepository<FixedCostEntity, Long> {
@Query("select f from FixedCostEntity f where f.userEntity.userId = :userId")
public List<FixedCostEntity> findByUserId(Long userId);
}

View File

@@ -0,0 +1,22 @@
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 org.springframework.stereotype.Repository;
import com.example.demo.app.infra.entity.GoalEntity;
@Repository
public interface GoalRepository extends JpaRepository<GoalEntity, Long> {
@Query("select g from GoalEntity g where g.userEntity.userId = :userId")
public List<GoalEntity> findAllByUserId(Long userId);
@Modifying(clearAutomatically = true, flushAutomatically = true)
@Query("update GoalEntity g set g.goalComplete = 1 where g.goalId = :goalId")
public int updateCompleteByGoalId(Long goalId);
}

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,39 @@
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;
import com.example.demo.app.presentation.form.Expense;
import com.example.demo.app.presentation.form.Income;
public interface TransactionRepository extends JpaRepository<TransactionEntity, Long> {
@Query("select t from TransactionEntity t where t.userEntity.userId = :userId and t.transactionDate = :todayDate")
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 coalesce(sum(t.amount), 0) 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 coalesce(sum(t.amount), 0) 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 coalesce(sum(t.amount), 0) 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);
@Query("select new com.example.demo.app.presentation.form.Expense(t.transactionDate, coalesce(sum(t.amount), 0)) 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 group by t.transactionDate order by t.transactionDate asc")
public List<Expense> findTotalExpenseList(LocalDate startDate, LocalDate endDate, Long userId);
@Query("select new com.example.demo.app.presentation.form.Income(t.transactionDate, coalesce(sum(t.amount), 0)) 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 group by t.transactionDate order by t.transactionDate asc")
public List<Income> findTotalIncomeList(LocalDate startDate, LocalDate endDate, Long userId);
@Query("select coalesce(t.amount, 0) from TransactionEntity t where t.transactionId = :transactionId")
public Integer findMoneyRecord(Long transactionId);
}

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,75 @@
package com.example.demo.app.presentation.controller;
import java.time.LocalDate;
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.RequestParam;
import com.example.demo.aop.aspect.SessionCheck;
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.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.AnalysisForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class AnalysisController {
private final AnalysisService analysisService;
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.ANALYSIS)
public String showAnalysis(
@RequestParam(required = false) Integer year,
@RequestParam(required = false) Integer month,
Model model,
HttpSession session) {
//ログインユーザーの取得(セッション)
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
//初期年月表示
LocalDate nowDate = LocalDate.now();
if (year == null) {
year = nowDate.getYear();
}
if (month == null) {
month = nowDate.getMonthValue();
}
//前月・翌月作成
LocalDate targetDate = LocalDate.of(year, month, 1);
LocalDate previousDate = targetDate.minusMonths(1);
LocalDate nextDate = targetDate.plusMonths(1);
//分析結果の取得(Service)
AnalysisModel analysisModel = analysisService.getAnalysis(loginUser.getUserId(), year, month);
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
//model格納
model.addAttribute(PageReturnAttributeKeyword.ANALYSIS_FORM, analysisForm);
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousDate.getYear());
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousDate.getMonthValue());
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextDate.getYear());
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextDate.getMonthValue());
return TransitionTargetPageNameKeyword.ANALYSIS_HTML;
}
}

View File

@@ -0,0 +1,63 @@
package com.example.demo.app.presentation.controller;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import com.example.demo.app.domain.model.AuthenticationModel;
import com.example.demo.app.domain.service.AuthenticationService;
import com.example.demo.app.infra.repository.QuestionRepository;
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
import com.example.demo.app.presentation.form.AuthenticationForm;
import com.example.demo.app.presentation.form.PasswordResetForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class AuthenticationController {
private final AuthenticationService authenticationService;
private final QuestionRepository questionRepository;
@GetMapping(TransitionTargetPageNameKeyword.AUTHENTICATION)
public String showAuthentication(Model model) {
model.addAttribute(PageReturnAttributeKeyword.AUTHENTICATION_FORM, new AuthenticationForm());
model.addAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionRepository.findAll());
return TransitionTargetPageNameKeyword.AUTHENTICATION_HTML;
}
@PostMapping(TransitionTargetPageNameKeyword.AUTHENTICATION)
public String authenticate(
AuthenticationForm authenticationForm,
Model model,
HttpSession session) {
AuthenticationModel authenticationModel =
authenticationService.authenticate(authenticationForm);
if (authenticationModel == null) {
model.addAttribute(PageReturnAttributeKeyword.ERROR_MESSAGE, "認証情報が正しくありません。");
model.addAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionRepository.findAll());
return TransitionTargetPageNameKeyword.AUTHENTICATION_HTML;
}
session.setAttribute(
PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID,
authenticationModel.getUserId());
model.addAttribute(
PageReturnAttributeKeyword.PASSWOR_RESET_FORM,
new PasswordResetForm());
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
}
}

View File

@@ -0,0 +1,90 @@
package com.example.demo.app.presentation.controller;
import java.util.List;
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.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;
@Controller
@RequiredArgsConstructor
public class CategoryController {
private final CategoryService categoryService;
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_LIST)
public String categoryListGet(Model model, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
List<CategoryForm> categoryFormList = CategoryForm.convertFrom(categoryService.findAllByuserId(loginUser.getUserId()));
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
return TransitionTargetPageNameKeyword.CATEGORY_LIST_HTML;
}
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_CREATE)
public String categoryCreateGet(@ModelAttribute CategoryForm categoryForm) {
return TransitionTargetPageNameKeyword.CATEGORY_CREATE_HTML;
}
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_CREATE)
public String categoryCreatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
}
@GetMapping(TransitionTargetPageNameKeyword.CATEGORY_UPDATE)
public String categoryUpdateGet(Model model, Long categoryId) {
CategoryForm categoryForm = CategoryForm.convertFrom(categoryService.findOne(categoryId));
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_ID, categoryId);
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM, categoryForm);
return TransitionTargetPageNameKeyword.CATEGORY_UPDATE_HTML;
}
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_UPDATE)
public String categoryUpdatePost(@ModelAttribute CategoryForm categoryForm, HttpSession session, Long categoryId) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
categoryForm.setCategoryId(categoryId);
categoryService.save(CategoryForm.convertTo(categoryForm), loginUser.getUserId());
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
}
@PostMapping(TransitionTargetPageNameKeyword.CATEGORY_DELETE)
public String categoryDeletePost(Long categoryId) {
categoryService.delete(categoryId);
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.CATEGORY_LIST;
}
}

View File

@@ -0,0 +1,158 @@
package com.example.demo.app.presentation.controller;
import java.util.ArrayList;
import java.util.List;
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.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;
import com.example.demo.app.domain.service.CourseService;
import com.example.demo.app.domain.service.UserService;
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.AllocationFormList;
import com.example.demo.app.presentation.form.CourseForm;
import com.example.demo.app.presentation.form.CourseInfoForm;
import com.example.demo.app.presentation.form.UserForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class CourseController {
private final CourseService courseService;
private final CourseInfoService courseInfoService;
private final UserService userService;
private final AllocationService allocationService;
@PostMapping(TransitionTargetPageNameKeyword.SHOW_SELECT_COURSE)
public String showSelectCourse(@ModelAttribute UserForm userForm, Model model, HttpSession session) {
final String MODE = "regist";
final String DEFAULT = "バランスコース";
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.findAllByNull()));
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
CourseInfoForm.convertFrom(courseInfoService.findAll()));
return TransitionTargetPageNameKeyword.SELECT_COURSE_HTML;
}
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.COURSE)
public String showChangeCourse(Model model, HttpSession session) {
final String MODE = "change";
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
Long userId = loginUser.getUserId();
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(courseModelList));
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
CourseInfoForm.convertFrom(courseInfoService.findAll()));
return TransitionTargetPageNameKeyword.SELECT_COURSE_HTML;
}
@SessionCheck
@PostMapping(TransitionTargetPageNameKeyword.CHANGE)
public String changeCourse(@RequestParam Long courseId, HttpSession httpSession) {
LoginModel loginUser = (LoginModel) httpSession.getAttribute(SessionKeyword.LOGIN_USER);
userService.updateCourse(loginUser.getUserId(), courseId);
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
}
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
public String createCourseGet(@ModelAttribute CourseForm courseForm, HttpSession session) {
return TransitionTargetPageNameKeyword.COURSE_CREATE_HTML;
}
@SessionCheck
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO)
public String createCourse(@ModelAttribute CourseForm courseForm,
@ModelAttribute AllocationFormList allocationFormList,
HttpSession session, Model model) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
CourseForm form = CourseForm
.convertFrom(courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId()));
session.setAttribute(PageReturnAttributeKeyword.COURSE_ID, form.getCourseId());
return TransitionTargetPageNameKeyword.COURSE_CREATE_RATIO_HTML;
}
@SessionCheck
@PostMapping(TransitionTargetPageNameKeyword.COURSE_CREATE)
public String createCoursePost(@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
List<AllocationModel> allocationModelList = new ArrayList<>();
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
allocationFormList.getAllocationRatio4()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(),
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
allocationFormList.getAllocationRatio5()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(),
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
allocationFormList.getAllocationRatio6()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(),
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
allocationFormList.getAllocationRatio7()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(),
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
allocationFormList.getAllocationRatio8()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(),
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
allocationFormList.getAllocationRatio9()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(),
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
allocationFormList.getAllocationRatio10()));
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(),
(Long) session.getAttribute(PageReturnAttributeKeyword.COURSE_ID),
allocationFormList.getAllocationRatio11()));
allocationService.save(allocationModelList);
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
}
}

View File

@@ -0,0 +1,15 @@
package com.example.demo.app.presentation.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
@Controller
public class ErrorController {
@GetMapping(TransitionTargetPageNameKeyword.ERROR)
public String showError() {
return TransitionTargetPageNameKeyword.ERROR_HTML;
}
}

View File

@@ -0,0 +1,123 @@
package com.example.demo.app.presentation.controller;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
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.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;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class FixedCostController {
private final FixedCostService fixedCostService;
private final CategoryService categoryService;
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.FIXED_COST_LIST)
public String getFixedCostList(
HttpSession session, Model model, LocalDate today) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
if (today == null) {
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(PageReturnAttributeKeyword.FIXED_COST_FORM_LIST, fixedCostFormList);
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
return TransitionTargetPageNameKeyword.FIXED_COST_HTML;
}
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.FIXED_COST_CREATE)
public String getFixedCostCreate(
HttpSession session, @ModelAttribute FixedCostForm fixedCostForm, Model model, LocalDate today) {
List<CategoryForm> categoryFormList = CategoryForm.convertFrom(categoryService.findAll());
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.TODAY, today);
return TransitionTargetPageNameKeyword.FIXED_COST_CREATE_HTML;
}
@SessionCheck
@PostMapping(TransitionTargetPageNameKeyword.FIXED_COST_CREATE)
public String postFixedCostCreate(
HttpSession session, @ModelAttribute FixedCostForm fixedCostForm, Model model, LocalDate today) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
fixedCostForm.setUserId(loginUser.getUserId());
fixedCostService.save(FixedCostForm.convertTo(fixedCostForm));
session.setAttribute(PageReturnAttributeKeyword.TODAY, today);
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.FIXED_COST_LIST;
}
@SessionCheck
@PostMapping(TransitionTargetPageNameKeyword.FIXED_COST_DELETE)
public String postFixedCostDelete(Long fixedCostId, LocalDate today, HttpSession session) {
fixedCostService.delete(fixedCostId);
session.setAttribute(PageReturnAttributeKeyword.TODAY, today);
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.FIXED_COST_LIST;
}
}

View File

@@ -0,0 +1,340 @@
package com.example.demo.app.presentation.controller;
import java.time.LocalDate;
import java.time.YearMonth;
import java.util.ArrayList;
import java.util.Collections;
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.RequestMapping;
import com.example.demo.aop.aspect.SessionCheck;
import com.example.demo.app.domain.model.GoalModel;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.CategoryService;
import com.example.demo.app.domain.service.GoalService;
import com.example.demo.app.domain.service.TransactionService;
import com.example.demo.app.domain.service.UserService;
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.GoalForm;
import com.example.demo.app.presentation.form.MonthlyAchievementForm;
import com.example.demo.app.presentation.form.MonthlySavingForm;
import com.example.demo.app.presentation.form.TransactionForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
@RequestMapping(TransitionTargetPageNameKeyword.GOAL)
public class GoalController {
private final GoalService goalService;
private final TransactionService transactionService;
private final UserService userService;
private final CategoryService categoryService;
@SessionCheck
@GetMapping("")
public String getGoal(
Model model,
HttpSession session,
Long goalId) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
Long userId = loginUser.getUserId();
goalService.updateGoalComplete(userId);
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
List<GoalForm> goalFormList = goalFormList1.stream()
.filter(goalForm -> goalForm.getGoalComplete() == 0)
.collect(Collectors.toList());
model.addAttribute(
PageReturnAttributeKeyword.GOAL_FORM_LIST,
goalFormList);
model.addAttribute(
PageReturnAttributeKeyword.ACHIEVEMENT_LIST,
new ArrayList<MonthlyAchievementForm>());
if (goalFormList.isEmpty()) {
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
}
GoalForm graphGoal;
if (goalId == null) {
graphGoal = goalFormList.getFirst();
} else {
graphGoal = goalFormList.stream()
.filter(goal -> goal.getGoalId().equals(goalId))
.findFirst()
.orElse(
goalFormList.getFirst());
}
model.addAttribute(
PageReturnAttributeKeyword.GRAPH_GOAL,
graphGoal);
int currentAmount = graphGoal.getCurrentAmount();
int targetAmount = graphGoal.getTargetAmount();
LocalDate startDate = LocalDate.of(
LocalDate.now().getYear(),
1,
1);
LocalDate today = LocalDate.now();
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
transactionService
.findAllByDate(
startDate,
today,
userId)
.forEach((date, list) -> {
List<TransactionForm> transactionFormList = list.stream()
.map(transaction -> {
CategoryForm categoryForm = CategoryForm.convertFrom(
categoryService.findOne(
transaction.getCategoryId()));
return TransactionForm.convertFrom(
transaction,
categoryForm.getCategoryName(),
transactionService.findTotalExpense(
startDate,
today,
loginUser.getUserId()),
transactionService.findTotalIncome(
startDate,
today,
loginUser.getUserId()),
categoryForm.getTransactionType());
})
.collect(Collectors.toList());
transactionFormMap.put(
date,
transactionFormList);
});
List<MonthlySavingForm> monthlySavingList = new ArrayList<>();
YearMonth startMonth = YearMonth.from(startDate);
YearMonth currentMonth = YearMonth.now();
YearMonth month = currentMonth;
while (!month.isBefore(startMonth)) {
int income = 0;
int expense = 0;
for (Map.Entry<LocalDate, List<TransactionForm>> entry : transactionFormMap.entrySet()) {
YearMonth transactionMonth = YearMonth.from(entry.getKey());
if (!transactionMonth.equals(month)) {
continue;
}
for (TransactionForm transaction : entry.getValue()) {
if (transaction.getAmount() == null) {
continue;
}
if (transaction.getTransactionType() == 1) {
income += transaction.getAmount();
} else if (transaction.getTransactionType() == 0) {
expense += transaction.getAmount();
}
}
}
monthlySavingList.add(
new MonthlySavingForm(
month,
income,
expense,
currentAmount));
currentAmount = currentAmount
- income
+ expense;
month = month.minusMonths(1);
}
Collections.reverse(
monthlySavingList);
List<MonthlyAchievementForm> achievementList = new ArrayList<>();
for (MonthlySavingForm monthlySaving : monthlySavingList) {
int savingAmount = monthlySaving.getSaving();
int achievementRate = 0;
if (targetAmount > 0) {
achievementRate = (int) ((double) savingAmount
/ targetAmount
* 100);
}
achievementList.add(
new MonthlyAchievementForm(
monthlySaving.getMonth(),
savingAmount,
achievementRate));
}
model.addAttribute(
PageReturnAttributeKeyword.ACHIEVEMENT_LIST,
achievementList);
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
}
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.EDIT)
public String editGoal(Model model, HttpSession session, Long goalId) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
Long userId = loginUser.getUserId();
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm);
return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML;
}
@SessionCheck
@PostMapping(TransitionTargetPageNameKeyword.UPDATE)
public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
Long userId = loginUser.getUserId();
// // 本人の目標かどうかを確認してから更新する
// GoalModel currentGoal = goalService.getGoalByUserId(userId);
//
// if (!currentGoal.getGoalId().equals(goalForm.getGoalId())) {
// return "redirect:/goal"; // 他人のデータを更新しようとしたら弾く
// }
GoalModel goalModel = GoalModel.convertFrom(goalForm);
goalService.updateGoal(goalModel, userId);
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
}
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.CREATE)
public String createGoalGet(@ModelAttribute GoalForm goalForm, HttpSession session, Model model) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
Long userId = loginUser.getUserId();
int currentAmount = goalService.getCurrentAmount(userId);
model.addAttribute("currentAmount", currentAmount);
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
}
@SessionCheck
@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 TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
} else {
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL + TransitionTargetPageNameKeyword.RECORD;
}
}
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.RECORD)
public String getRecord(HttpSession session, Model model) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
Long userId = loginUser.getUserId();
goalService.updateGoalComplete(userId);
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
List<GoalForm> goalFormList = GoalForm.convertFrom(goalModelList);
List<GoalForm> goalCompleteFormList = new ArrayList<>();
goalFormList.stream().forEach(goalForm -> {
if (goalForm.getGoalComplete() == 1) {
goalCompleteFormList.add(goalForm);
}
});
model.addAttribute(
PageReturnAttributeKeyword.GOAL_COMPLETE_FORM_LIST,
goalCompleteFormList);
return TransitionTargetPageNameKeyword.GOAL_RECORD_HTML;
}
}

View File

@@ -0,0 +1,60 @@
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.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.LoginForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class LoginController {
private final LoginService loginService;
@GetMapping(TransitionTargetPageNameKeyword.LOGIN)
public String showLogin(@ModelAttribute LoginForm loginForm, HttpSession session) {
if (session.getAttribute(SessionKeyword.LOGIN_USER) != null) {
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
}
return TransitionTargetPageNameKeyword.LOGIN_HTML;
}
@PostMapping(TransitionTargetPageNameKeyword.LOGIN)
public String login(
@ModelAttribute LoginForm loginForm,
Model model,
HttpSession session) {
LoginModel loginModel = loginService.login(
loginForm.getMailAddress(),
loginForm.getPassword());
if (loginModel == null) {
model.addAttribute(
PageReturnAttributeKeyword.ERROR_MESSAGE,
"IDまたはパスワードが間違っています.");
return TransitionTargetPageNameKeyword.LOGIN_HTML;
}
session.setAttribute(SessionKeyword.LOGIN_USER, loginModel);
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
}
}

View File

@@ -0,0 +1,70 @@
package com.example.demo.app.presentation.controller;
import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.PasswordResetService;
import com.example.demo.app.presentation.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.PasswordResetForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class PasswordResetController {
private final PasswordResetService passwordResetService;
@GetMapping(TransitionTargetPageNameKeyword.PASSWORD_RESET)
public String showPasswordReset(Model model) {
model.addAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_FORM, new PasswordResetForm());
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
}
@PostMapping(TransitionTargetPageNameKeyword.PASSWORD_RESET)
public String resetPassword(
PasswordResetForm passwordResetForm,
Model model,
HttpSession session) {
Long userId = (Long) session.getAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID);
if (userId == null) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
if (loginUser != null) {
userId = loginUser.getUserId();
}
}
if (userId == null) {
return TransitionTargetPageNameKeyword.REDIRECT +
TransitionTargetPageNameKeyword.LOGIN;
}
boolean isReset = passwordResetService.resetPassword(userId, passwordResetForm);
if (!isReset) {
model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "パスワードが一致しません。");
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
}
session.removeAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID);
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
if (loginUser != null) {
return TransitionTargetPageNameKeyword.REDIRECT +
TransitionTargetPageNameKeyword.PROFILE;
}
return TransitionTargetPageNameKeyword.REDIRECT +
TransitionTargetPageNameKeyword.LOGIN;
}
}

View File

@@ -0,0 +1,100 @@
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.aop.aspect.SessionCheck;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.model.ProfileModel;
import com.example.demo.app.domain.service.ProfileService;
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.ProfileEditForm;
import com.example.demo.app.presentation.form.ProfileForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class ProfileController {
private final ProfileService profileService;
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.PROFILE)
public String profile(Model model, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
ProfileModel profileModel = profileService.findOne(loginUser.getUserId());
ProfileForm profileForm = ProfileForm.convertForm(profileModel);
model.addAttribute(PageReturnAttributeKeyword.PROFILE_FORM, profileForm);
return TransitionTargetPageNameKeyword.PROFILE_HTML;
}
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.PROFILE_EDIT)
public String showEditProfile(
Model model,
HttpSession session) {
LoginModel loginUser =
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
ProfileModel profileModel =
profileService.findOne(loginUser.getUserId());
ProfileEditForm profileEditForm =
new ProfileEditForm(
profileModel.getUserName(),
profileModel.getMailAddress(),
profileModel.getBirthDate(),
profileModel.getSaving(),
profileModel.getAnnualIncome(),
profileModel.getMonthlyBudget());
model.addAttribute(PageReturnAttributeKeyword.PROFILE_EDIT_FORM, profileEditForm);
return TransitionTargetPageNameKeyword.PROFILE_EDIT_HTML;
}
@PostMapping(TransitionTargetPageNameKeyword.PROFILE_EDIT)
public String updateProfile(
@ModelAttribute ProfileEditForm profileEditForm,
HttpSession session) {
LoginModel loginUser =
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
profileService.update(
loginUser.getUserId(),
profileEditForm);
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.PROFILE;
}
@PostMapping(TransitionTargetPageNameKeyword.WITHDRAW)
public String withdraw(HttpSession session) {
LoginModel loginUser =
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
profileService.withdraw(loginUser.getUserId());
session.invalidate();
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
}
@PostMapping(TransitionTargetPageNameKeyword.LOGOUT)
public String logout(HttpSession session) {
session.invalidate();
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
}
}

View File

@@ -0,0 +1,446 @@
package com.example.demo.app.presentation.controller;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
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.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.domain.service.GoalService;
import com.example.demo.app.domain.service.TransactionService;
import com.example.demo.app.domain.service.UserService;
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.Expense;
import com.example.demo.app.presentation.form.FixedCostForm;
import com.example.demo.app.presentation.form.GoalForm;
import com.example.demo.app.presentation.form.Income;
import com.example.demo.app.presentation.form.TransactionForm;
import com.example.demo.app.presentation.form.UserForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class TransactionController {
private final TransactionService transactionService;
private final CategoryService categoryService;
private final GoalService goalService;
private final UserService userService;
private final FixedCostService fixedCostService;
// 一覧画面
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_LIST)
public String transactionList(
@RequestParam(required = false, defaultValue = "0") String years,
@RequestParam(required = false, defaultValue = "0") String months,
Model model,
HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
LocalDate today = LocalDate.now();
int year = years.equals("0")
? today.getYear()
: Integer.parseInt(years);
int month = months.equals("0")
? today.getMonthValue()
: Integer.parseInt(months);
YearMonth yearMonth = YearMonth.of(year, month);
YearMonth previousYearMonth = yearMonth.minusMonths(1);
int previousYear = previousYearMonth.getYear();
int previousMonth = previousYearMonth.getMonthValue();
YearMonth nextYearMonth = yearMonth.plusMonths(1);
int nextYear = nextYearMonth.getYear();
int nextMonth = nextYearMonth.getMonthValue();
LocalDate startDate = yearMonth.atDay(1);
LocalDate endDate = yearMonth.atEndOfMonth();
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
transactionService
.findAllByDate(
startDate,
endDate,
loginUser.getUserId())
.forEach((date, list) -> {
List<TransactionForm> transactionFormList = list.stream()
.map(transaction -> {
CategoryForm categoryForm = CategoryForm.convertFrom(
categoryService.findOne(
transaction.getCategoryId()));
return TransactionForm.convertFrom(
transaction,
categoryForm.getCategoryName(),
transactionService.findTotalExpense(
startDate,
endDate,
loginUser.getUserId()),
transactionService.findTotalIncome(
startDate,
endDate,
loginUser.getUserId()),
categoryForm.getTransactionType());
})
.collect(Collectors.toList());
transactionFormMap.put(date, transactionFormList);
});
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousYear);
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousMonth);
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear);
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth);
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM_MAP, transactionFormMap);
return TransitionTargetPageNameKeyword.TRANSACTION_LIST_HTML;
}
// 詳細画面
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.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(SessionKeyword.LOGIN_USER);
List<TransactionForm> transactionFormList = transactionService
.findByUserIdAndDate(todayDate, loginUser.getUserId()).stream()
.map(transaction -> {
int type = CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getTransactionType();
TransactionForm transactionForm;
if (type == 1) {
transactionForm = TransactionForm.convertFrom(
transaction,
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getCategoryName(),
0,
transactionService.findMoneyRecord(transaction.getTransactionId()),
type);
} else if (type == 0) {
transactionForm = TransactionForm.convertFrom(
transaction,
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getCategoryName(),
transactionService.findMoneyRecord(transaction.getTransactionId()),
0,
type);
} else {
transactionForm = TransactionForm.convertFrom(
transaction,
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getCategoryName(),
0,
0,
type);
}
return transactionForm;
}).collect(Collectors.toList());
model.addAttribute(PageReturnAttributeKeyword.TODAY, todayDate);
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM_LIST, transactionFormList);
return TransitionTargetPageNameKeyword.TRANSACTION_DETAIL_HTML;
}
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_CREATE)
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
Long fixedCostId,
Model model, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
if (today == null) {
today = LocalDate.now();
}
TransactionForm transactionForm = new TransactionForm();
transactionForm.setTransactionDate(today);
if (fixedCostId != null) {
FixedCostForm fixedCostForm = FixedCostForm.convertFrom(fixedCostService.findById(fixedCostId));
transactionForm.setCategoryId(fixedCostForm.getCategoryId());
transactionForm.setAmount(fixedCostForm.getAmount());
transactionForm.setTransactionType(CategoryForm
.convertFrom(categoryService.findOne(fixedCostForm.getCategoryId())).getTransactionType());
}
List<CategoryForm> categoryFormList = new ArrayList<>(
CategoryForm.convertFrom(categoryService.findAllExceptCustom()));
List<CategoryForm> categoryFormCustomList = CategoryForm
.convertFrom(categoryService.findAllByuserId(loginUser.getUserId()));
if (!categoryFormCustomList.isEmpty()) {
for (CategoryForm form : categoryFormCustomList) {
categoryFormList.add(form);
}
}
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));
return TransitionTargetPageNameKeyword.TRANSACTION_CREATE_HTML;
}
@SessionCheck
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_CREATE)
public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today,
Model model,
HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
transactionForm.setUserId(loginUser.getUserId());
if (transactionService.createTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
return TransitionTargetPageNameKeyword.ERROR_HTML;
}
return TransitionTargetPageNameKeyword.REDIRECT +
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
TransitionTargetPageNameKeyword.INTERROGATION +
TransitionTargetPageNameKeyword.TODAY_DATES +
TransitionTargetPageNameKeyword.EQUAL +
transactionForm.getTransactionDate();
}
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_UPDATE)
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
Model model, HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
if (today == null) {
today = LocalDate.now();
}
List<CategoryForm> categoryFormList = new ArrayList<>(
CategoryForm.convertFrom(categoryService.findAllExceptCustom()));
List<CategoryForm> categoryFormCustomList = CategoryForm
.convertFrom(categoryService.findAllByuserId(loginUser.getUserId()));
if (!categoryFormCustomList.isEmpty()) {
for (CategoryForm form : categoryFormCustomList) {
categoryFormList.add(form);
}
}
TransactionForm transactionForm = TransactionForm.convertFrom(
transactionService.findByTransactionId(transactionId),
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getCategoryName(),
transactionService.findMoneyRecord(transactionId),
transactionService.findMoneyRecord(transactionId),
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType());
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_ID, transactionId);
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
return TransitionTargetPageNameKeyword.TRANSACTION_UPDATE_HTML;
}
@SessionCheck
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_UPDATE)
public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm,
@RequestParam LocalDate today, Model model,
HttpSession session) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
transactionForm.setUserId(loginUser.getUserId());
transactionForm.setTransactionId(transactionId);
if (transactionService.updateTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
return TransitionTargetPageNameKeyword.ERROR_HTML;
}
return TransitionTargetPageNameKeyword.REDIRECT +
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
TransitionTargetPageNameKeyword.INTERROGATION +
TransitionTargetPageNameKeyword.TODAY_DATES +
TransitionTargetPageNameKeyword.EQUAL +
transactionForm.getTransactionDate();
}
@SessionCheck
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_DELETE)
public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
transactionService.deleteTransaction(transactionId);
return TransitionTargetPageNameKeyword.REDIRECT +
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
TransitionTargetPageNameKeyword.INTERROGATION +
TransitionTargetPageNameKeyword.TODAY_DATES +
TransitionTargetPageNameKeyword.EQUAL +
today;
}
@SessionCheck
@GetMapping(TransitionTargetPageNameKeyword.MENU)
public String menu(HttpSession session, Model model,
@RequestParam(required = false, defaultValue = "0") String years,
@RequestParam(required = false, defaultValue = "0") String months) {
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
LocalDate today = LocalDate.now();
int year = (years.equals("0")) ? today.getYear() : Integer.parseInt(years);
int month = (months.equals("0")) ? today.getMonthValue() : Integer.parseInt(months);
YearMonth yearMonth = YearMonth.of(year, month);
int lastDay = yearMonth.lengthOfMonth();
int firstDayOfWeek = yearMonth.atDay(1).getDayOfWeek().getValue() % 7;
YearMonth previousYearMonth = yearMonth.minusMonths(1);
int previousYear = previousYearMonth.getYear();
int previousMonth = previousYearMonth.getMonthValue();
YearMonth nextYearMonth = yearMonth.plusMonths(1);
int nextYear = nextYearMonth.getYear();
int nextMonth = nextYearMonth.getMonthValue();
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
model.addAttribute(PageReturnAttributeKeyword.DAY, today.getDayOfMonth());
model.addAttribute(PageReturnAttributeKeyword.LAST_DAY, lastDay);
model.addAttribute(PageReturnAttributeKeyword.FIRST_DAY_OF_WEEK, firstDayOfWeek);
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousYear);
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousMonth);
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear);
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth);
LocalDate startDate = yearMonth.atDay(1);
LocalDate endDate = yearMonth.atEndOfMonth();
List<Income> incomeList = transactionService.findTotalIncomeList(startDate, endDate, loginUser.getUserId());
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId());
int totalExpense = transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId());
model.addAttribute(PageReturnAttributeKeyword.TOTAL_INCOME, totalIncome);
model.addAttribute(PageReturnAttributeKeyword.TOTAL_EXPENSE, totalExpense);
List<GoalForm> goalForm = GoalForm.convertFrom(goalService.getGoalByUserId(loginUser.getUserId()));
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0)
.collect(Collectors.toList());
if (!resultList.isEmpty()) {
GoalForm result = resultList.getFirst();
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, result.getAchievementRate());
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, result.getCurrentAmount());
model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, result.getTargetAmount());
model.addAttribute(PageReturnAttributeKeyword.SAVING, userForm.getSaving());
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, result.getDeadline());
} else {
final String MESSAGE = "目標を設定してください";
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, MESSAGE);
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, MESSAGE);
model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, MESSAGE);
model.addAttribute(PageReturnAttributeKeyword.SAVING, userForm.getSaving());
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, MESSAGE);
}
return TransitionTargetPageNameKeyword.MENU_HTML;
}
}

View File

@@ -0,0 +1,100 @@
package com.example.demo.app.presentation.controller;
import java.util.List;
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.service.CourseService;
import com.example.demo.app.domain.service.QuestionService;
import com.example.demo.app.domain.service.UserService;
import com.example.demo.app.infra.entity.QuestionEntity;
import com.example.demo.app.presentation.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;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class UserController {
private final UserService userService;
private final CourseService courseService;
private final QuestionService questionService;
@GetMapping(TransitionTargetPageNameKeyword.USER_RESISTER)
public String showRegister(Model model, HttpSession session) {
UserForm userForm = new UserForm();
List<QuestionEntity> questionList = questionService.findAll();
session.setAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionList);
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
return TransitionTargetPageNameKeyword.USER_RESISTER_HTML;
}
@PostMapping(TransitionTargetPageNameKeyword.USER_RESISTER_RETURN)
public String showRegisterReturn(@RequestParam(required = false) Long courseId, Model model, HttpSession session) {
UserForm userForm = (UserForm) session.getAttribute(PageReturnAttributeKeyword.USER_FORM);
if (userForm.getUserName().equals("")) {
userForm = new UserForm();
userForm.setCourseId(courseId);
}
if (courseId != null) {
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
}
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;
}
@GetMapping(TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM)
public String confirmRegisterGet(@ModelAttribute UserForm userForm,
String selectedCourseName, Model model,
HttpSession session) {
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;
}
@PostMapping(TransitionTargetPageNameKeyword.USER_RESISTER_COMPLETE)
public String confirmRegister(
@ModelAttribute UserForm userForm,
Model model,
HttpSession session) {
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);
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
}
}

View File

@@ -0,0 +1,65 @@
package com.example.demo.app.presentation.controller.pageproperty;
public class PageReturnAttributeKeyword {
public static final String ERROR_MESSAGE = "errorMessage";
public static final String MESSAGE = "message";
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 COURSE_ID = "courseId";
public static final String PASSWOR_RESET_FORM = "passwordResetForm";
public static final String PASSWOR_RESET_USER_ID = "passwordResetUserId";
public static final String AUTHENTICATION_FORM = "authenticationForm";
public static final String PROFILE_FORM = "profileForm";
public static final String PROFILE_EDIT_FORM = "profileEditForm";
public static final String MODE = "mode";
public static final String CURRENT_COURSE_ID = "currentCourseId";
public static final String COURSE_LIST = "courseList";
public static final String COURSE_INFO_LIST = "courseInfoList";
public static final String YEAR = "year";
public static final String MONTH = "month";
public static final String DAY = "day";
public static final String PREVIOUS_YEAR = "previousYear";
public static final String PREVIOUS_MONTH = "previousMonth";
public static final String LAST_DAY = "lastDay";
public static final String FIRST_DAY_OF_WEEK = "firstDayOfWeek";
public static final String NEXT_YEAR = "nextYear";
public static final String NEXT_MONTH = "nextMonth";
public static final String TODAY = "today";
public static final String TRANSACTION_FORM_MAP = "transactionFormMap";
public static final String TRANSACTION_FORM_LIST = "transactionFormList";
public static final String TRANSACTION_FORM = "transactionForm";
public static final String TRANSACTION_ID = "transactionId";
public static final String CATEGORY_FORM_LIST = "categoryFormList";
public static final String INCOME_LIST = "incomeList";
public static final String EXPENSE_LIST = "expenseList";
public static final String TOTAL_INCOME = "totalIncome";
public static final String TOTAL_EXPENSE = "totalExpense";
public static final String ACHIEVEMENT_RATE = "achievementRate";
public static final String CURRENT_AMOUNT = "currentAmount";
public static final String TARGET_AMOUNT = "targetAmount";
public static final String SAVING = "saving";
public static final String DEADLINE = "deadline";
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

@@ -0,0 +1,12 @@
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

@@ -0,0 +1,104 @@
package com.example.demo.app.presentation.controller.pageproperty;
public class TransitionTargetPageNameKeyword {
// HTML
public static final String ERROR_HTML = "error";
public static final String USER_RESISTER_HTML = "user_register";
public static final String USER_RESISTER_RETURN_HTML = "user_register_return";
public static final String USER_RESISTER_CONFIRM_HTML = "user_register_confirm";
public static final String LOGIN_HTML = "login";
public static final String PASSWORD_RESET_HTML = "password_reset";
public static final String AUTHENTICATION_HTML = "authentication";
public static final String MENU_HTML = "menu";
public static final String PROFILE_HTML = "profile";
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";
public static final String TRANSACTION_CREATE_HTML = "transaction_create";
public static final String TRANSACTION_UPDATE_HTML = "transaction_update";
public static final String ANALYSIS_HTML = "analysis";
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";
public static final String USER_RESISTER = "/user/register";
public static final String USER_RESISTER_RETURN = "/user/register/return";
public static final String USER_RESISTER_CONFIRM = "/user/register/confirm";
public static final String USER_RESISTER_COMPLETE = "/user/register/complete";
public static final String REDIRECT = "redirect:";
public static final String LOGIN = "/login";
public static final String LOGOUT = "/logout";
public static final String AUTHENTICATION = "/authentication";
public static final String PASSWORD_RESET = "/password/reset";
public static final String MENU = "/menu";
public static final String PROFILE = "/profile";
public static final String PROFILE_EDIT = "/profile/edit";
public static final String WITHDRAW = "/withdraw";
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 = "=";
public static final String TRANSACTION_LIST = "/transaction/list";
public static final String TRANSACTION_DETAIL = "/transaction/detail";
public static final String TRANSACTION_CREATE = "/transaction/create";
public static final String TRANSACTION_UPDATE = "/transaction/update";
public static final String TRANSACTION_DELETE = "/transaction/delete";
public static final String TODAY_DATES = "todayDates";
public static final String ANALYSIS = "/analysis";
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

@@ -0,0 +1,28 @@
package com.example.demo.app.presentation.form;
import java.util.List;
import com.example.demo.app.domain.model.AllocationModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AllocationForm {
private Long categoryId;
private Long courseId;
private Integer allocationRatio;
public static AllocationForm convertFrom(AllocationModel allocationModel) {
return new AllocationForm(allocationModel.getCategoryId(), allocationModel.getCourseId(), allocationModel.getAllocationRatio());
}
public static List<AllocationForm> convertFrom(List<AllocationModel> allocationModelList){
return allocationModelList.stream().map(AllocationForm::convertFrom).toList();
}
}

View File

@@ -0,0 +1,45 @@
package com.example.demo.app.presentation.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AllocationFormList {
private Long categoryId1 = 1L;
private Integer allocationRatio1;
private Long categoryId2 = 2L;
private Integer allocationRatio2;
private Long categoryId3 = 3L;
private Integer allocationRatio3;
private Long categoryId4 = 4L;
private Integer allocationRatio4;
private Long categoryId5 = 5L;
private Integer allocationRatio5;
private Long categoryId6 = 6L;
private Integer allocationRatio6;
private Long categoryId7 = 7L;
private Integer allocationRatio7;
private Long categoryId8 = 8L;
private Integer allocationRatio8;
private Long categoryId9 = 9L;
private Integer allocationRatio9;
private Long categoryId10 = 10L;
private Integer allocationRatio10;
private Long categoryId11 = 11L;
private Integer allocationRatio11;
}

View File

@@ -0,0 +1,35 @@
package com.example.demo.app.presentation.form;
import java.util.List;
import com.example.demo.app.domain.model.AnalysisModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AnalysisForm {
private Integer currentMonthTotalAmount;
private Integer previousMonthTotalAmount;
private Integer totalDifferenceAmount;
private List<CategoryAnalysisForm>
categoryAnalysisFormList;
public static AnalysisForm convertFrom(
AnalysisModel analysisModel) {
return new AnalysisForm(
analysisModel.getCurrentMonthTotalAmount(),
analysisModel.getPreviousMonthTotalAmount(),
analysisModel.getTotalDifferenceAmount(),
CategoryAnalysisForm.convertFrom(
analysisModel.getCategoryAnalysisModelList()));
}
}

View File

@@ -0,0 +1,14 @@
package com.example.demo.app.presentation.form;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class AuthenticationForm {
private String mailAddress;
private Long secretQuestionId;
private String secretAnswer;
}

View File

@@ -0,0 +1,47 @@
package com.example.demo.app.presentation.form;
import java.util.List;
import com.example.demo.app.domain.model.CategoryAnalysisModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CategoryAnalysisForm {
private String categoryName;
private Integer currentMonthAmount;
private Integer previousMonthAmount;
private Integer monthDifferenceAmount;
private Integer courseLimitAmount;
private Integer courseDifferenceAmount;
public static CategoryAnalysisForm convertFrom(
CategoryAnalysisModel categoryAnalysisModel) {
return new CategoryAnalysisForm(
categoryAnalysisModel.getCategoryName(),
categoryAnalysisModel.getCurrentMonthAmount(),
categoryAnalysisModel.getPreviousMonthAmount(),
categoryAnalysisModel.getMonthDifferenceAmount(),
categoryAnalysisModel.getCourseLimitAmount(),
categoryAnalysisModel.getCourseDifferenceAmount());
}
public static List<CategoryAnalysisForm> convertFrom(
List<CategoryAnalysisModel> categoryAnalysisModelList) {
return categoryAnalysisModelList.stream()
.map(CategoryAnalysisForm::convertFrom)
.toList();
}
}

View File

@@ -0,0 +1,35 @@
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();
}
public static CategoryModel convertTo(CategoryForm categoryForm) {
return new CategoryModel(
categoryForm.getCategoryId(),
categoryForm.getCategoryName(),
categoryForm.getTransactionType());
}
}

View File

@@ -0,0 +1,41 @@
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();
}
public static CourseModel convertTo(CourseForm courseForm) {
return new CourseModel(
courseForm.getCourseId(),
courseForm.getCourseName(),
courseForm.getDescription()
);
}
}

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.getCourseId(), 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,17 @@
package com.example.demo.app.presentation.form;
import java.time.LocalDate;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Expense {
private LocalDate date;
private Long amount;
}

View File

@@ -0,0 +1,55 @@
package com.example.demo.app.presentation.form;
import java.util.List;
import com.example.demo.app.domain.model.FixedCostModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FixedCostForm {
private Long fixedCostId;
private Long userId;
private Long categoryId;
private String fixedCostName;
private Integer amount;
private String categoryName;
public static FixedCostForm convertFrom(FixedCostModel fixedCostModel) {
return new FixedCostForm(
fixedCostModel.getFixedCostId(),
fixedCostModel.getUserId(),
fixedCostModel.getCategoryId(),
fixedCostModel.getFixedCostName(),
fixedCostModel.getAmount(),
"");
}
public static List<FixedCostForm> convertFrom(List<FixedCostModel> fixedCostModelList) {
return fixedCostModelList.stream().map(fixedCostModel -> FixedCostForm.convertFrom(fixedCostModel)).toList();
}
public static FixedCostModel convertTo(FixedCostForm fixedCostForm) {
return new FixedCostModel(
fixedCostForm.getFixedCostId(),
fixedCostForm.getUserId(),
fixedCostForm.getCategoryId(),
fixedCostForm.getFixedCostName(),
fixedCostForm.getAmount());
}
}

View File

@@ -0,0 +1,55 @@
package com.example.demo.app.presentation.form;
import java.time.LocalDate;
import java.util.List;
import org.springframework.format.annotation.DateTimeFormat;
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;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate deadline;
private Integer goalComplete;
private Integer achievementRate; // 達成率
private Integer currentAmount; // 現在の資産
private Long userId;
public static GoalForm convertFrom(GoalModel goalModel) {
return new GoalForm(
goalModel.getGoalId(),
goalModel.getGoalTitle(),
goalModel.getGoalSubtitle(),
goalModel.getTargetAmount(),
goalModel.getDeadline(),
goalModel.getGoalComplete(),
goalModel.getAchievementRate(),
goalModel.getCurrentAmount(),
goalModel.getUserId());
}
public static List<GoalForm> convertFrom(List<GoalModel> goalModelList) {
return goalModelList.stream().map(GoalForm::convertFrom).toList();
}
}

View File

@@ -0,0 +1,17 @@
package com.example.demo.app.presentation.form;
import java.time.LocalDate;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Income {
private LocalDate date;
private Long amount;
}

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,17 @@
package com.example.demo.app.presentation.form;
import java.time.YearMonth;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class MonthlyAchievementForm {
private YearMonth month;
private Integer saving;
private Integer achievementRate;
}

View File

@@ -0,0 +1,19 @@
package com.example.demo.app.presentation.form;
import java.time.YearMonth;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class MonthlySavingForm {
private YearMonth month;
private Integer income;
private Integer expense;
private Integer saving;
}

View File

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

View File

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

View File

@@ -0,0 +1,33 @@
package com.example.demo.app.presentation.form;
import java.time.LocalDate;
import com.example.demo.app.domain.model.ProfileModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ProfileForm {
private Long userId;
private String userName;
private String mailAddress;
private LocalDate birthDate;
private Integer saving;
private Integer annualIncome;
private Integer monthlyBudget;
public static ProfileForm convertForm(ProfileModel profileModel) {
return new ProfileForm(
profileModel.getUserId(),
profileModel.getUserName(),
profileModel.getMailAddress(),
profileModel.getBirthDate(),
profileModel.getSaving(),
profileModel.getAnnualIncome(),
profileModel.getMonthlyBudget());
}
}

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,43 @@
package com.example.demo.app.presentation.form;
import java.time.LocalDate;
import com.example.demo.app.domain.model.UserModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserForm {
private String userName;
private String mailAddress;
private LocalDate birthDate;
private String password;
private Long secretQuestionId;
private String secretAnswer;
private Integer saving;
private Integer annualIncome;
private Integer monthlyBudget;
private Long goalId;
private Long courseId;
public static UserForm convertFrom(UserModel userModel) {
return new UserForm(
userModel.getUserName(),
userModel.getMailAddress(),
userModel.getBrithDate(),
userModel.getPassword(),
userModel.getSecretQuestionId(),
userModel.getSecretAnswer(),
userModel.getSaving(),
userModel.getAnnualIncome(),
userModel.getMonthlyBudget(),
0L,
userModel.getCourseId()
);
}
}

Some files were not shown because too many files have changed in this diff Show More