Compare commits
11 Commits
57a76ae044
...
s-morimto
| Author | SHA1 | Date | |
|---|---|---|---|
| acd7534fdb | |||
| ee5ec5009d | |||
| 7604e9ee76 | |||
| 26fa2365e8 | |||
| 5adb527d7a | |||
| e54e0133f7 | |||
| c3dae348bf | |||
| ea1e18ad93 | |||
| bb3b8965b2 | |||
| 3b239d07bd | |||
| 0c54a42b97 |
@@ -11,7 +11,6 @@ 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 org.springframework.web.servlet.resource.NoResourceFoundException;
|
||||
|
||||
import com.example.demo.exception.NoSessionException;
|
||||
|
||||
@@ -48,14 +47,14 @@ public class GlobalExceptionHandler {
|
||||
|
||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||
|
||||
System.out.println("session invalidated method not supported exception");
|
||||
System.out.println("session invalidated");
|
||||
session.invalidate();
|
||||
|
||||
return "error";
|
||||
}
|
||||
|
||||
@ExceptionHandler(NoResourceFoundException.class)
|
||||
public void noResourceException(Model model, Exception e, HttpSession session) {
|
||||
@ExceptionHandler(Exception.class)
|
||||
public String AllException(Model model, Exception e, HttpSession session) {
|
||||
model.addAttribute("error", SEVERE_ERROR_MESSAGE_BAD_REQUEST);
|
||||
|
||||
e.printStackTrace();
|
||||
@@ -65,16 +64,6 @@ public class GlobalExceptionHandler {
|
||||
System.out.println("session invalidated");
|
||||
session.invalidate();
|
||||
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public String AllException(Model model, Exception e, HttpSession session) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
|
||||
System.out.println(" .well-known/appspecific/com.chrome.devtools.json for request error");
|
||||
|
||||
return "error";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class GoalModel {
|
||||
goalModel.getTargetAmount(),
|
||||
goalModel.getDeadline(),
|
||||
0,
|
||||
userEntity);
|
||||
userEntity, 0);
|
||||
}
|
||||
|
||||
public static GoalModel convertFrom(GoalForm goalForm) {
|
||||
|
||||
@@ -53,13 +53,13 @@ public class UserServiceImpl implements UserService {
|
||||
|
||||
userEntity.setQuestionEntity(questionEntity);
|
||||
|
||||
|
||||
|
||||
userEntity.setCourseEntity(courseEntity);
|
||||
|
||||
userEntity.setDeleteFlag(0);
|
||||
|
||||
goalEntity.setUserEntity(userRepository.save(userEntity));
|
||||
|
||||
goalRepository.save(goalEntity);
|
||||
userRepository.save(userEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ public class CategoryEntity {
|
||||
@Column(name = "category_id")
|
||||
private Long categoryId;
|
||||
|
||||
@Column(name = "category_name", nullable = false, length = 50)
|
||||
@Column(name = "category_name", nullable = false)
|
||||
private String categoryName;
|
||||
|
||||
@Column(name = "transaction_type", nullable = false)
|
||||
|
||||
@@ -27,7 +27,7 @@ public class CourseEntity {
|
||||
@Column(name = "course_id")
|
||||
private Long courseId;
|
||||
|
||||
@Column(name = "course_name", nullable = false, length = 50)
|
||||
@Column(name = "course_name", nullable = false)
|
||||
private String courseName;
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class FixedCostEntity {
|
||||
@JoinColumn(name = "category_id")
|
||||
private CategoryEntity categoryEntity;
|
||||
|
||||
@Column(name = "fixed_cost_name", nullable = false, length = 50)
|
||||
@Column(name = "fixed_cost_name", nullable = false)
|
||||
private String fixedCostName;
|
||||
|
||||
@Column(name = "amount", nullable = false)
|
||||
|
||||
@@ -29,10 +29,10 @@ public class GoalEntity {
|
||||
private Long goalId;
|
||||
|
||||
@Column(name = "goal_title", nullable = true)
|
||||
private String goalTitle = "名前を設定してください";
|
||||
private String goalTitle;
|
||||
|
||||
@Column(name = "goal_subtitle", nullable = true)
|
||||
private String goalSubtitle = "説明を書いてください";
|
||||
private String goalSubtitle;
|
||||
|
||||
@Column(name = "target_amount", nullable = true)
|
||||
private Integer targetAmount;
|
||||
@@ -47,4 +47,6 @@ public class GoalEntity {
|
||||
@JoinColumn(name = "user_id")
|
||||
private UserEntity userEntity;
|
||||
|
||||
private Integer deleteFlag;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.example.demo.app.infra.entity;
|
||||
|
||||
public class TestController6 {
|
||||
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class UserEntity {
|
||||
@Column(name = "user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column(name = "user_name", nullable = false, length = 100)
|
||||
@Column(name = "user_name", nullable = false)
|
||||
private String userName;
|
||||
|
||||
@Column(name = "mail_address", nullable = false)
|
||||
@@ -39,7 +39,7 @@ public class UserEntity {
|
||||
@Column(name = "password", nullable = false)
|
||||
private String password;
|
||||
|
||||
@Column(name = "secret_answer", nullable = false, length = 100)
|
||||
@Column(name = "secret_answer", nullable = false)
|
||||
private String secretQuestionAnswer;
|
||||
|
||||
@Column(name = "birth_date", nullable = false)
|
||||
|
||||
@@ -57,7 +57,8 @@ public class ProfileController {
|
||||
profileModel.getBirthDate(),
|
||||
profileModel.getSaving(),
|
||||
profileModel.getAnnualIncome(),
|
||||
profileModel.getMonthlyBudget());
|
||||
profileModel.getMonthlyBudget(),
|
||||
profileModel.getBirthDate());
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.PROFILE_EDIT_FORM, profileEditForm);
|
||||
return TransitionTargetPageNameKeyword.PROFILE_EDIT_HTML;
|
||||
|
||||
@@ -353,29 +353,29 @@ public class TransactionController {
|
||||
@RequestParam(required = false, defaultValue = "0") String months) {
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||
System.out.println("******************************************::1");
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
System.out.println("******************************************::2");
|
||||
|
||||
int year = (years.equals("0")) ? today.getYear() : Integer.parseInt(years);
|
||||
System.out.println("******************************************::3");
|
||||
|
||||
int month = (months.equals("0")) ? today.getMonthValue() : Integer.parseInt(months);
|
||||
System.out.println("******************************************::4");
|
||||
|
||||
YearMonth yearMonth = YearMonth.of(year, month);
|
||||
System.out.println("******************************************::5");
|
||||
|
||||
int lastDay = yearMonth.lengthOfMonth();
|
||||
System.out.println("******************************************::6");
|
||||
|
||||
int firstDayOfWeek = yearMonth.atDay(1).getDayOfWeek().getValue() % 7;
|
||||
System.out.println("******************************************::7");
|
||||
|
||||
YearMonth previousYearMonth = yearMonth.minusMonths(1);
|
||||
System.out.println("******************************************::8");
|
||||
|
||||
int previousYear = previousYearMonth.getYear();
|
||||
int previousMonth = previousYearMonth.getMonthValue();
|
||||
System.out.println("******************************************::9");
|
||||
|
||||
YearMonth nextYearMonth = yearMonth.plusMonths(1);
|
||||
System.out.println("******************************************::10");
|
||||
|
||||
int nextYear = nextYearMonth.getYear();
|
||||
int nextMonth = nextYearMonth.getMonthValue();
|
||||
System.out.println("******************************************::11");
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
||||
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
||||
model.addAttribute(PageReturnAttributeKeyword.DAY, today.getDayOfMonth());
|
||||
@@ -388,34 +388,34 @@ public class TransactionController {
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear);
|
||||
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth);
|
||||
System.out.println("******************************************::12");
|
||||
|
||||
LocalDate startDate = yearMonth.atDay(1);
|
||||
LocalDate endDate = yearMonth.atEndOfMonth();
|
||||
System.out.println("******************************************::13");
|
||||
|
||||
List<Income> incomeList = transactionService.findTotalIncomeList(startDate, endDate, loginUser.getUserId());
|
||||
System.out.println("******************************************::14");
|
||||
|
||||
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
|
||||
System.out.println("******************************************::15");
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
||||
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
||||
System.out.println("******************************************::16");
|
||||
|
||||
int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId());
|
||||
|
||||
int totalExpense = transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId());
|
||||
System.out.println("******************************************::17");
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.TOTAL_INCOME, totalIncome);
|
||||
model.addAttribute(PageReturnAttributeKeyword.TOTAL_EXPENSE, totalExpense);
|
||||
System.out.println("******************************************::18");
|
||||
|
||||
List<GoalForm> goalForm = GoalForm.convertFrom(goalService.getGoalByUserId(loginUser.getUserId()));
|
||||
System.out.println("******************************************::19");
|
||||
|
||||
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
||||
System.out.println("******************************************::20");
|
||||
|
||||
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0)
|
||||
.collect(Collectors.toList());
|
||||
System.out.println("******************************************::21");
|
||||
|
||||
if (!resultList.isEmpty()) {
|
||||
GoalForm result = resultList.getFirst();
|
||||
System.out.println("******************************************::22");
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, result.getAchievementRate());
|
||||
|
||||
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, result.getCurrentAmount());
|
||||
|
||||
@@ -16,4 +16,5 @@ public class ProfileEditForm {
|
||||
private Integer saving;
|
||||
private Integer annualIncome;
|
||||
private Integer monthlyBudget;
|
||||
private LocalDate birthDate;
|
||||
}
|
||||
|
||||
@@ -138,6 +138,8 @@
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
<title>コース選択</title>
|
||||
</head>
|
||||
|
||||
<body style="padding-bottom: 120px; padding-top: 60px;">
|
||||
<body style="padding-bottom: 120px">
|
||||
<div th:replace="~{header :: header}"></div>
|
||||
|
||||
<h1 class="page-title">コース選択</h1>
|
||||
|
||||
<th:block th:if="${mode == 'change'}">
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="goalId" class="form-label">目標貯金額</label>
|
||||
<label for="goalId" class="form-label">目標</label>
|
||||
<input type="number" id="goalId" class="form-control" th:field="*{goalId}" min="0" required>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user