diff --git a/src/main/java/com/example/demo/app/domain/model/ProfileModel.java b/src/main/java/com/example/demo/app/domain/model/ProfileModel.java
new file mode 100644
index 0000000..64ede94
--- /dev/null
+++ b/src/main/java/com/example/demo/app/domain/model/ProfileModel.java
@@ -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 emailAddress;
+ private LocalDate brithDate;
+ private Integer saving;
+ private Integer annualIncome;
+ private Integer monthlyBudget;
+}
diff --git a/src/main/java/com/example/demo/app/domain/service/PasswordResetService.java b/src/main/java/com/example/demo/app/domain/service/PasswordResetService.java
new file mode 100644
index 0000000..99a3100
--- /dev/null
+++ b/src/main/java/com/example/demo/app/domain/service/PasswordResetService.java
@@ -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);
+}
diff --git a/src/main/java/com/example/demo/app/domain/service/ProfileService.java b/src/main/java/com/example/demo/app/domain/service/ProfileService.java
new file mode 100644
index 0000000..6dd2b8c
--- /dev/null
+++ b/src/main/java/com/example/demo/app/domain/service/ProfileService.java
@@ -0,0 +1,7 @@
+package com.example.demo.app.domain.service;
+
+import com.example.demo.app.domain.model.ProfileModel;
+
+public interface ProfileService {
+ ProfileModel findOne(Long userId);
+}
diff --git a/src/main/java/com/example/demo/app/domain/service/TransactionService.java b/src/main/java/com/example/demo/app/domain/service/TransactionService.java
index 84edc52..ab4aa12 100644
--- a/src/main/java/com/example/demo/app/domain/service/TransactionService.java
+++ b/src/main/java/com/example/demo/app/domain/service/TransactionService.java
@@ -5,6 +5,8 @@ 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 {
@@ -14,10 +16,16 @@ public interface TransactionService {
public int findTotalIncome(LocalDate startDate, LocalDate endDate, Long userId);
- public int findTotalexpense(LocalDate startDate, LocalDate endDate, Long userId);
+ public int findTotalExpense(LocalDate startDate, LocalDate endDate, Long userId);
public int createTransaction(TransactionModel transactionModel);
public int updateTransaction(TransactionModel transactionModel);
+ public void deleteTransaction(Long transactionId);
+
+ public List findTotalIncomeList(LocalDate startDate, LocalDate endDate, Long userId);
+
+ public List findTotalExpenseList(LocalDate startDate, LocalDate endDate, Long userId);
+
}
diff --git a/src/main/java/com/example/demo/app/domain/service/UserService.java b/src/main/java/com/example/demo/app/domain/service/UserService.java
new file mode 100644
index 0000000..6dfecaa
--- /dev/null
+++ b/src/main/java/com/example/demo/app/domain/service/UserService.java
@@ -0,0 +1,7 @@
+package com.example.demo.app.domain.service;
+
+import com.example.demo.app.presentation.form.UserForm;
+
+public interface UserService {
+ void register(UserForm userForm);
+}
diff --git a/src/main/java/com/example/demo/app/domain/service/impl/ProfileServiceImpl.java b/src/main/java/com/example/demo/app/domain/service/impl/ProfileServiceImpl.java
new file mode 100644
index 0000000..7df882c
--- /dev/null
+++ b/src/main/java/com/example/demo/app/domain/service/impl/ProfileServiceImpl.java
@@ -0,0 +1,34 @@
+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 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());
+ }
+}
diff --git a/src/main/java/com/example/demo/app/domain/service/impl/TransactionServiceImpl.java b/src/main/java/com/example/demo/app/domain/service/impl/TransactionServiceImpl.java
index d33dc25..9467f9c 100644
--- a/src/main/java/com/example/demo/app/domain/service/impl/TransactionServiceImpl.java
+++ b/src/main/java/com/example/demo/app/domain/service/impl/TransactionServiceImpl.java
@@ -16,6 +16,8 @@ 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;
@@ -27,19 +29,38 @@ public class TransactionServiceImpl implements TransactionService {
private final UserRepository userRepository;
private final CategoryRepository categoryRepository;
- public Map> findAllByDate(LocalDate startDate, LocalDate endDate, Long userId) {
+ public Map> 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 transactionEntityList = transactionRepository.findAllByDateAndUserId(startDate, endDate,
userId);
- List transactionModelList = TransactionModel
- .convertFrom(transactionEntityList);
+ System.out.println("Entity count = " + transactionEntityList.size());
+
+ transactionEntityList.forEach(t -> {
+ System.out.println(
+ "date = " + t.getTransactionDate()
+ + ", amount = " + t.getAmount());
+ });
+
+ List transactionModelList = TransactionModel.convertFrom(transactionEntityList);
+
+ System.out.println("Model count = " + transactionModelList.size());
Map> transactionModelMap = transactionModelList.stream()
- .collect(Collectors.groupingBy(TransactionModel::getTransactionDate));
+ .collect(Collectors.groupingBy(
+ TransactionModel::getTransactionDate));
+
+ System.out.println("Map = " + transactionModelMap);
return transactionModelMap;
-
}
public int findTotalIncome(LocalDate startDate, LocalDate endDate, Long userId) {
@@ -48,9 +69,21 @@ public class TransactionServiceImpl implements TransactionService {
}
- public int findTotalexpense(LocalDate startDate, LocalDate endDate, Long userId) {
+ public int findTotalExpense(LocalDate startDate, LocalDate endDate, Long userId) {
- return transactionRepository.findTotalIncome(startDate, endDate, userId);
+ return transactionRepository.findTotalExpense(startDate, endDate, userId);
+
+ }
+
+ public List findTotalIncomeList(LocalDate startDate, LocalDate endDate, Long userId) {
+
+ return transactionRepository.findTotalIncomeList(startDate, endDate, userId);
+
+ }
+
+ public List findTotalExpenseList(LocalDate startDate, LocalDate endDate, Long userId) {
+
+ return transactionRepository.findTotalExpenseList(startDate, endDate, userId);
}
@@ -91,7 +124,7 @@ public class TransactionServiceImpl implements TransactionService {
if (!transactionRepository.existsById(transactionModel.getTransactionId())) {
return -1;
}
-
+
Optional userEntityOptional = userRepository.findById(transactionModel.getUserId());
if (userEntityOptional.isEmpty()) {
@@ -115,4 +148,9 @@ public class TransactionServiceImpl implements TransactionService {
}
}
+
+ public void deleteTransaction(Long transactionId) {
+ transactionRepository.deleteById(transactionId);
+ }
+
}
diff --git a/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java b/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java
index 5fe10a1..e68e169 100644
--- a/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java
+++ b/src/main/java/com/example/demo/app/infra/repository/TransactionRepository.java
@@ -7,21 +7,31 @@ 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 {
- @Query("select t from TransactionEntity t where t.userEntity.userId = :userId and t.transactionDate = :transactionDate")
+ @Query("select t from TransactionEntity t where t.userEntity.userId = :userId and t.transactionDate = :todayDate")
public List 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 findAllByDateAndUserId(LocalDate startDate, LocalDate endDate, Long userId);
- @Query("select sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryEntity.categoryId = c.categoryId where (t.userEntity.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 0")
+ @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 sum(t.amount) from TransactionEntity t inner join CategoryEntity c on t.categoryEntity.categoryId = c.categoryId where (t.userEntity.userId = :userId and t.transactionDate between :startDate and :endDate) and c.transactionType = 1")
+ @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 sum(t.amount) from TransactionEntity t where t.userEntity.userId = :userId and t.categoryEntity.categoryId = :categoryId and t.transactionDate between :startDate and :endDate")
+ @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 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 findTotalIncomeList(LocalDate startDate, LocalDate endDate, Long userId);
+
+
}
diff --git a/src/main/java/com/example/demo/app/presentation/controller/ErrorController.java b/src/main/java/com/example/demo/app/presentation/controller/ErrorController.java
new file mode 100644
index 0000000..973d396
--- /dev/null
+++ b/src/main/java/com/example/demo/app/presentation/controller/ErrorController.java
@@ -0,0 +1,12 @@
+package com.example.demo.app.presentation.controller;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@Controller
+public class ErrorController {
+ @GetMapping("/error")
+ public String showError() {
+ return "error";
+ }
+}
diff --git a/src/main/java/com/example/demo/app/presentation/controller/LoginController.java b/src/main/java/com/example/demo/app/presentation/controller/LoginController.java
index 20ac8c5..53cf92f 100644
--- a/src/main/java/com/example/demo/app/presentation/controller/LoginController.java
+++ b/src/main/java/com/example/demo/app/presentation/controller/LoginController.java
@@ -21,11 +21,7 @@ public class LoginController {
private final LoginService loginService;
@GetMapping("/login")
- public String showLogin(Model model) {
-
- model.addAttribute(
- "loginForm",
- new LoginForm());
+ public String showLogin(@ModelAttribute LoginForm loginForm) {
return "login";
}
@@ -50,6 +46,7 @@ public class LoginController {
session.setAttribute("loginUser", loginModel);
- return "menu";
+ return "redirect:/menu";
}
+
}
diff --git a/src/main/java/com/example/demo/app/presentation/controller/ProfileController.java b/src/main/java/com/example/demo/app/presentation/controller/ProfileController.java
new file mode 100644
index 0000000..f9a3f81
--- /dev/null
+++ b/src/main/java/com/example/demo/app/presentation/controller/ProfileController.java
@@ -0,0 +1,32 @@
+package com.example.demo.app.presentation.controller;
+
+import jakarta.servlet.http.HttpSession;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+
+import com.example.demo.app.domain.model.LoginModel;
+import com.example.demo.app.domain.model.ProfileModel;
+import com.example.demo.app.domain.service.ProfileService;
+import com.example.demo.app.presentation.form.ProfileForm;
+
+import lombok.RequiredArgsConstructor;
+
+@Controller
+@RequiredArgsConstructor
+public class ProfileController {
+ private final ProfileService profileService;
+
+ @GetMapping("/profile")
+ public String profile(Model model, HttpSession session) {
+ LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
+
+ ProfileModel profileModel = profileService.findOne(loginUser.getUserId());
+
+ ProfileForm profileForm = ProfileForm.convertForm(profileModel);
+
+ model.addAttribute("profileForm", profileForm);
+ return "profile";
+ }
+}
diff --git a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java
index fed0ca7..053cbd5 100644
--- a/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java
+++ b/src/main/java/com/example/demo/app/presentation/controller/TransactionController.java
@@ -1,6 +1,7 @@
package com.example.demo.app.presentation.controller;
import java.time.LocalDate;
+import java.time.YearMonth;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -19,6 +20,8 @@ import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.CategoryService;
import com.example.demo.app.domain.service.TransactionService;
import com.example.demo.app.presentation.form.CategoryForm;
+import com.example.demo.app.presentation.form.Expense;
+import com.example.demo.app.presentation.form.Income;
import com.example.demo.app.presentation.form.TransactionForm;
import lombok.RequiredArgsConstructor;
@@ -29,8 +32,8 @@ public class TransactionController {
private final TransactionService transactionService;
private final CategoryService categoryService;
- // 一覧画面
+ // 一覧画面
@GetMapping("/transaction/list")
public String transactionList(@RequestParam(required = false) LocalDate startDates,
@RequestParam(required = false) LocalDate endDates, Model model,
@@ -47,19 +50,24 @@ public class TransactionController {
transactionService.findAllByDate(startDate, endDate, loginUser.getUserId()).forEach((date, list) -> {
List transactionFormList = list.stream().map(transaction -> {
+ System.out.println(transaction.getTransactionDate());
TransactionForm transactionForm = TransactionForm.convertFrom(
transaction,
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getCategoryName(),
- transactionService.findTotalexpense(startDate, endDate, loginUser.getUserId()),
+ transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId()),
transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId()),
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getTransactionType());
+ System.out.println("startDate = " + startDate);
+ System.out.println("endDate = " + endDate);
return transactionForm;
}).collect(Collectors.toList());
transactionFormMap.put(date, transactionFormList);
});
-
+
+
+
model.addAttribute("transactionFormMap", transactionFormMap);
return "transaction_list";
@@ -81,32 +89,40 @@ public class TransactionController {
transaction,
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getCategoryName(),
- transactionService.findTotalexpense(todayDate, todayDate, loginUser.getUserId()),
+ transactionService.findTotalExpense(todayDate, todayDate, loginUser.getUserId()),
transactionService.findTotalIncome(todayDate, todayDate, loginUser.getUserId()),
CategoryForm.convertFrom(categoryService.findOne(transaction.getCategoryId()))
.getTransactionType());
return transactionForm;
}).collect(Collectors.toList());
+ model.addAttribute("today", todayDate);
model.addAttribute("transactionFormList", transactionFormList);
- return "";
+ return "transaction_detail";
}
@GetMapping("/transaction/create")
- public String createOneGet(@ModelAttribute TransactionForm transactionForm) {
+ public String createOneGet(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today, Model model) {
- return "";
+ List categoryFormList = CategoryForm.convertFrom(categoryService.findAll());
+
+ model.addAttribute("categoryFormList", categoryFormList);
+ model.addAttribute("today", today);
+
+ return "transaction_create";
}
@PostMapping("/transaction/create")
- public String createOnePost(@ModelAttribute TransactionForm transactionForm, Model model) {
-
+ public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today, Model model, HttpSession session) {
+ LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
+ transactionForm.setUserId(loginUser.getUserId());
+ transactionForm.setTransactionDate(today);
if (transactionService.createTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
return "error";
}
- return "";
+ return "redirect:/transaction/detail?todayDates=" + today;
}
@@ -127,4 +143,62 @@ public class TransactionController {
}
+ @PostMapping("/transaction/delete")
+ public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
+
+ transactionService.deleteTransaction(transactionId);
+ return "redirect:/transaction/detail?todayDates=" + today;
+ }
+
+ @GetMapping("/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("loginUser");
+
+ LocalDate today = LocalDate.now();
+
+ int year = (years.equals("0")) ? today.getYear() : Integer.parseInt(years);
+ int month = (months.equals("0")) ? today.getMonthValue() : Integer.parseInt(months);
+
+ System.out.println("year : " + year + "month : " + month);
+
+ YearMonth yearMonth = YearMonth.of(year, month);
+
+ int lastDay = yearMonth.lengthOfMonth();
+
+ int firstDayOfWeek =
+ yearMonth.atDay(1).getDayOfWeek().getValue() % 7;
+
+ model.addAttribute("year", year);
+ model.addAttribute("month", month);
+ model.addAttribute("day", today.getDayOfMonth());
+
+ model.addAttribute("lastDay", lastDay);
+ model.addAttribute("firstDayOfWeek", firstDayOfWeek);
+
+ LocalDate startDate = LocalDate.now().withDayOfMonth(1);
+
+ LocalDate endDate = LocalDate.now().withDayOfMonth(LocalDate.now().lengthOfMonth());
+
+
+ List incomeList = transactionService.findTotalIncomeList(startDate, endDate, loginUser.getUserId());
+ List expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
+
+ model.addAttribute("incomeList", incomeList);
+
+ model.addAttribute("expenseList", expenseList);
+
+
+ int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId());
+
+ int totalExpense= transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId());
+
+ model.addAttribute("totalIncome", totalIncome);
+ model.addAttribute("totalExpense", totalExpense);
+
+
+ return "menu";
+ }
+
+
}
diff --git a/src/main/java/com/example/demo/app/presentation/controller/UserController.java b/src/main/java/com/example/demo/app/presentation/controller/UserController.java
new file mode 100644
index 0000000..cfcaa0d
--- /dev/null
+++ b/src/main/java/com/example/demo/app/presentation/controller/UserController.java
@@ -0,0 +1,55 @@
+package com.example.demo.app.presentation.controller;
+
+import jakarta.servlet.http.HttpSession;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+
+import com.example.demo.app.presentation.form.UserForm;
+
+import lombok.RequiredArgsConstructor;
+
+@Controller
+@RequiredArgsConstructor
+public class UserController {
+
+ @GetMapping("/user/register")
+ public String showRegister(Model model, HttpSession session) {
+ UserForm userForm = (UserForm) session.getAttribute("userForm");
+
+ if(userForm == null) {
+ userForm = new UserForm();
+ }
+
+ model.addAttribute("userForm", userForm);
+ return "user_register";
+ }
+
+ @PostMapping("/user/register/confirm")
+ public String confirmRegister(
+ @ModelAttribute UserForm userForm,
+ HttpSession session) {
+
+ session.setAttribute("userForm", userForm);
+
+ return "user_register_confirm";
+ }
+
+ @PostMapping("/user/register/complete")
+ public String completeRegister(HttpSession session) {
+
+ UserForm userForm =
+ (UserForm) session.getAttribute("userForm");
+
+ // DBへの登録処理
+
+ session.removeAttribute("userForm");
+
+ return "redirect:/login";
+ }
+
+
+}
diff --git a/src/main/java/com/example/demo/app/presentation/form/Expense.java b/src/main/java/com/example/demo/app/presentation/form/Expense.java
new file mode 100644
index 0000000..aab7015
--- /dev/null
+++ b/src/main/java/com/example/demo/app/presentation/form/Expense.java
@@ -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;
+
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/demo/app/presentation/form/Income.java b/src/main/java/com/example/demo/app/presentation/form/Income.java
new file mode 100644
index 0000000..9a682a6
--- /dev/null
+++ b/src/main/java/com/example/demo/app/presentation/form/Income.java
@@ -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;
+
+}
diff --git a/src/main/java/com/example/demo/app/presentation/form/PasswordResetForm.java b/src/main/java/com/example/demo/app/presentation/form/PasswordResetForm.java
new file mode 100644
index 0000000..8118b62
--- /dev/null
+++ b/src/main/java/com/example/demo/app/presentation/form/PasswordResetForm.java
@@ -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;
+}
diff --git a/src/main/java/com/example/demo/app/presentation/form/ProfileForm.java b/src/main/java/com/example/demo/app/presentation/form/ProfileForm.java
new file mode 100644
index 0000000..2cdfc20
--- /dev/null
+++ b/src/main/java/com/example/demo/app/presentation/form/ProfileForm.java
@@ -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 emailAddress;
+ private LocalDate brithDate;
+ private Integer saving;
+ private Integer annualIncome;
+ private Integer monthlyBudget;
+
+ public static ProfileForm convertForm(ProfileModel profileModel) {
+ return new ProfileForm(
+ profileModel.getUserId(),
+ profileModel.getUserName(),
+ profileModel.getEmailAddress(),
+ profileModel.getBrithDate(),
+ profileModel.getSaving(),
+ profileModel.getAnnualIncome(),
+ profileModel.getMonthlyBudget());
+ }
+}
diff --git a/src/main/java/com/example/demo/app/presentation/form/UserForm.java b/src/main/java/com/example/demo/app/presentation/form/UserForm.java
new file mode 100644
index 0000000..dd8f655
--- /dev/null
+++ b/src/main/java/com/example/demo/app/presentation/form/UserForm.java
@@ -0,0 +1,24 @@
+package com.example.demo.app.presentation.form;
+
+import java.time.LocalDate;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class UserForm {
+ private String userName;
+ private String mailAddress;
+ private String password;
+ private Long secretQuestionId;
+ private String SecretAnswer;
+ private LocalDate birthDate;
+ private Integer saving;
+ private Integer annualIncome;
+ private Integer monthlyBudget;
+ private Long goalId;
+ private Long courseId;
+}
diff --git a/src/main/java/com/example/demo/exception/GlobalExceptionHandler.java b/src/main/java/com/example/demo/exception/GlobalExceptionHandler.java
new file mode 100644
index 0000000..17c1c7f
--- /dev/null
+++ b/src/main/java/com/example/demo/exception/GlobalExceptionHandler.java
@@ -0,0 +1,22 @@
+package com.example.demo.exception;
+
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.ControllerAdvice;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+
+@ControllerAdvice
+public class GlobalExceptionHandler {
+
+ @ExceptionHandler(Exception.class)
+ public String handleException(
+ Exception e,
+ Model model) {
+
+ model.addAttribute(
+ "errorMessage",
+ "システムエラーが発生しました。"
+ + "初めからやり直してください。");
+
+ return "error";
+ }
+}
diff --git a/src/main/resources/static/css/menu.css b/src/main/resources/static/css/menu.css
new file mode 100644
index 0000000..5195e7c
--- /dev/null
+++ b/src/main/resources/static/css/menu.css
@@ -0,0 +1,15 @@
+table, th, td {border: 1px solid black; border-collapse: collapse;}
+
+td:hover{background-color: lightblue;}
+
+th{font-weight: bold; height: 50px;}
+
+td{text-align: left; vertical-align: text-top; width: 200px; height: 100px; padding: 10px}
+
+.holiday{color: red;}
+
+#today{font-weight: bold; background-color: bisque;}
+
+.year{font-size: 30px;}
+
+.month{font-size: 50px; font-weight: bold;}
\ No newline at end of file
diff --git a/src/main/resources/templates/analysis.html b/src/main/resources/templates/analysis.html
index 87fbc0f..02535b6 100644
--- a/src/main/resources/templates/analysis.html
+++ b/src/main/resources/templates/analysis.html
@@ -1,12 +1,15 @@
-
+
分析画面
+
+
+
支出分析
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/Authentication.html b/src/main/resources/templates/authentication.html
similarity index 100%
rename from src/main/resources/templates/Authentication.html
rename to src/main/resources/templates/authentication.html
diff --git a/src/main/resources/templates/error.html b/src/main/resources/templates/error.html
new file mode 100644
index 0000000..2bf0229
--- /dev/null
+++ b/src/main/resources/templates/error.html
@@ -0,0 +1,32 @@
+
+
+
+
+エラー
+
+
+
+
+
+
+
+
+
+
+
+
+
+ エラーが発生しました
+
+
+
+
+
+ ログイン画面へ
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/footer.html b/src/main/resources/templates/footer.html
new file mode 100644
index 0000000..2274cd3
--- /dev/null
+++ b/src/main/resources/templates/footer.html
@@ -0,0 +1,42 @@
+
+
+
+
+フッター
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/header.html b/src/main/resources/templates/header.html
new file mode 100644
index 0000000..29aac43
--- /dev/null
+++ b/src/main/resources/templates/header.html
@@ -0,0 +1,29 @@
+
+
+
+
+ヘッダー
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html
index 7050ca1..75298d0 100644
--- a/src/main/resources/templates/login.html
+++ b/src/main/resources/templates/login.html
@@ -13,11 +13,11 @@
+
+
+
+
+
+
+
+
+ | 日 |
+ 月 |
+ 火 |
+ 水 |
+ 木 |
+ 金 |
+ 土 |
+
+
+
+
+
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/resources/templates/menu.html b/src/main/resources/templates/menu.html
new file mode 100644
index 0000000..15365cf
--- /dev/null
+++ b/src/main/resources/templates/menu.html
@@ -0,0 +1,72 @@
+
+
+
+