Compare commits
12 Commits
k-oshita
...
2ed56f2413
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ed56f2413 | |||
| baab2a822d | |||
| 25986b455e | |||
| c7a33c997c | |||
| 3818da7b4e | |||
| f37dd792a0 | |||
| 109b8125d6 | |||
| 626c4d6721 | |||
| e43958a1fb | |||
| 57a76ae044 | |||
| 4880a4285e | |||
| 03b1b7d982 |
@@ -49,7 +49,7 @@ public class GlobalExceptionHandler {
|
|||||||
|
|
||||||
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE_ILLEGAL_TRANSITION, e);
|
||||||
|
|
||||||
System.out.println("session invalidated");
|
System.out.println("session invalidated method not supported exception");
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
|
|||||||
@@ -133,8 +133,6 @@ public class CourseServiceImpl implements CourseService {
|
|||||||
System.out.println("***********************ここでエラー1");
|
System.out.println("***********************ここでエラー1");
|
||||||
if (userEntity.getCourseEntity().getCourseId() == courseId) {
|
if (userEntity.getCourseEntity().getCourseId() == courseId) {
|
||||||
return "selected";
|
return "selected";
|
||||||
} else if (courseId <= 6) {
|
|
||||||
return "original";
|
|
||||||
}
|
}
|
||||||
System.out.println("***********************ここでエラー2");
|
System.out.println("***********************ここでエラー2");
|
||||||
allocationRepository.deleteByCourseId(courseId);
|
allocationRepository.deleteByCourseId(courseId);
|
||||||
|
|||||||
@@ -141,13 +141,9 @@ public class CourseController {
|
|||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
||||||
|
|
||||||
} else if (condition.equals("original")) {
|
|
||||||
model.addAttribute("message", "既存のデータは削除できません");
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
|
||||||
} else if (condition.equals("ok")) {
|
} else if (condition.equals("ok")) {
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
||||||
}
|
}
|
||||||
model.addAttribute("message", "エラーが発生しました");
|
model.addAttribute("message", "エラーが発生しました");
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.COURSE;
|
||||||
|
|||||||
@@ -275,9 +275,7 @@ public class GoalController {
|
|||||||
|
|
||||||
int currentAmount = goalService.getCurrentAmount(userId);
|
int currentAmount = goalService.getCurrentAmount(userId);
|
||||||
|
|
||||||
System.out.println("************************currentAmount : " + currentAmount);
|
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount);
|
||||||
|
|
||||||
session.setAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount);
|
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
||||||
}
|
}
|
||||||
@@ -294,7 +292,7 @@ public class GoalController {
|
|||||||
model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "現在所持金より高い金額を設定してください。");
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "現在所持金より高い金額を設定してください。");
|
||||||
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -372,29 +372,29 @@ public class TransactionController {
|
|||||||
@RequestParam(required = false, defaultValue = "0") String months) {
|
@RequestParam(required = false, defaultValue = "0") String months) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
int year = (years.equals("0")) ? today.getYear() : Integer.parseInt(years);
|
int year = (years.equals("0")) ? today.getYear() : Integer.parseInt(years);
|
||||||
|
|
||||||
int month = (months.equals("0")) ? today.getMonthValue() : Integer.parseInt(months);
|
int month = (months.equals("0")) ? today.getMonthValue() : Integer.parseInt(months);
|
||||||
|
|
||||||
YearMonth yearMonth = YearMonth.of(year, month);
|
YearMonth yearMonth = YearMonth.of(year, month);
|
||||||
|
|
||||||
int lastDay = yearMonth.lengthOfMonth();
|
int lastDay = yearMonth.lengthOfMonth();
|
||||||
|
|
||||||
int firstDayOfWeek = yearMonth.atDay(1).getDayOfWeek().getValue() % 7;
|
int firstDayOfWeek = yearMonth.atDay(1).getDayOfWeek().getValue() % 7;
|
||||||
|
|
||||||
YearMonth previousYearMonth = yearMonth.minusMonths(1);
|
YearMonth previousYearMonth = yearMonth.minusMonths(1);
|
||||||
|
|
||||||
int previousYear = previousYearMonth.getYear();
|
int previousYear = previousYearMonth.getYear();
|
||||||
int previousMonth = previousYearMonth.getMonthValue();
|
int previousMonth = previousYearMonth.getMonthValue();
|
||||||
|
|
||||||
YearMonth nextYearMonth = yearMonth.plusMonths(1);
|
YearMonth nextYearMonth = yearMonth.plusMonths(1);
|
||||||
|
|
||||||
int nextYear = nextYearMonth.getYear();
|
int nextYear = nextYearMonth.getYear();
|
||||||
int nextMonth = nextYearMonth.getMonthValue();
|
int nextMonth = nextYearMonth.getMonthValue();
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.DAY, today.getDayOfMonth());
|
model.addAttribute(PageReturnAttributeKeyword.DAY, today.getDayOfMonth());
|
||||||
@@ -410,26 +410,27 @@ public class TransactionController {
|
|||||||
|
|
||||||
LocalDate startDate = yearMonth.atDay(1);
|
LocalDate startDate = yearMonth.atDay(1);
|
||||||
LocalDate endDate = yearMonth.atEndOfMonth();
|
LocalDate endDate = yearMonth.atEndOfMonth();
|
||||||
|
|
||||||
List<Income> incomeList = transactionService.findTotalIncomeList(startDate, endDate, loginUser.getUserId());
|
List<Income> incomeList = transactionService.findTotalIncomeList(startDate, endDate, loginUser.getUserId());
|
||||||
|
|
||||||
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
|
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
model.addAttribute(PageReturnAttributeKeyword.EXPENSE_LIST, expenseList);
|
||||||
|
|
||||||
int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId());
|
int totalIncome = transactionService.findTotalIncome(startDate, endDate, loginUser.getUserId());
|
||||||
|
|
||||||
int totalExpense = transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId());
|
int totalExpense = transactionService.findTotalExpense(startDate, endDate, loginUser.getUserId());
|
||||||
|
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TOTAL_INCOME, totalIncome);
|
model.addAttribute(PageReturnAttributeKeyword.TOTAL_INCOME, totalIncome);
|
||||||
model.addAttribute(PageReturnAttributeKeyword.TOTAL_EXPENSE, totalExpense);
|
model.addAttribute(PageReturnAttributeKeyword.TOTAL_EXPENSE, totalExpense);
|
||||||
|
|
||||||
List<GoalForm> goalForm = GoalForm.convertFrom(goalService.getGoalByUserId(loginUser.getUserId()));
|
List<GoalForm> goalForm = GoalForm.convertFrom(goalService.getGoalByUserId(loginUser.getUserId()));
|
||||||
|
|
||||||
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
UserForm userForm = UserForm.convertFrom(userService.findByUserId(loginUser.getUserId()));
|
||||||
|
|
||||||
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0 && goal.getDeadline().isAfter(today) )
|
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0 && goal.getDeadline().isAfter(today) )
|
||||||
|
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
if (!resultList.isEmpty()) {
|
if (!resultList.isEmpty()) {
|
||||||
|
|||||||
@@ -214,10 +214,6 @@ td:hover {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.goal {
|
|
||||||
min-width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* =======================
|
/* =======================
|
||||||
ボタン
|
ボタン
|
||||||
======================= */
|
======================= */
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="transactionType">収入・支出</label>
|
<label class="form-label" for="transactionType">収入・支出</label>
|
||||||
|
|
||||||
<select class="form-select" id="transactionType" required>
|
<select class="form-select" id="transactionType">
|
||||||
|
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
<option value="0">支出</option>
|
<option value="0">支出</option>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="categoryId">カテゴリ</label>
|
<label class="form-label" for="categoryId">カテゴリ</label>
|
||||||
|
|
||||||
<select class="form-select" id="categoryId" th:field="*{categoryId}" required>
|
<select class="form-select" id="categoryId" th:field="*{categoryId}">
|
||||||
<option value="">選択してください</option>
|
<option value="">選択してください</option>
|
||||||
|
|
||||||
<option class="expenseListClass" th:each="category : ${expenseList}"
|
<option class="expenseListClass" th:each="category : ${expenseList}"
|
||||||
|
|||||||
@@ -37,9 +37,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<label>目標金額</label>
|
<label>目標金額</label>
|
||||||
<input type="number" th:field="*{targetAmount}" required min="1">
|
<input type="number" th:field="*{targetAmount}" required min="1">
|
||||||
<br>
|
<span th:text="|所持金:${currentAmount}円|"></span>
|
||||||
<span th:text="|所持金:${session.currentAmount}円|"></span>
|
|
||||||
<input type="hidden" name="currentAmount" th:value="${currentAmount}">
|
|
||||||
<span th:if="${message != null}">
|
<span th:if="${message != null}">
|
||||||
<span th:text="${message}" style="color: red;"></span>
|
<span th:text="${message}" style="color: red;"></span>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -128,32 +128,27 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標名</th>
|
<th>目標名</th>
|
||||||
<td th:text="${goalForm.goalTitle}"
|
<td th:text="${goalForm.goalTitle}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標説明</th >
|
<th>目標説明</th>
|
||||||
<td th:text="${goalForm.goalSubtitle}"
|
<td th:text="${goalForm.goalSubtitle}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標金額</th>
|
<th>目標金額</th>
|
||||||
<td th:text="${goalForm.targetAmount}"
|
<td th:text="${goalForm.targetAmount}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標達成期限</th>
|
<th>目標達成期限</th>
|
||||||
<td th:text="${goalForm.deadline}"
|
<td th:text="${goalForm.deadline}"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>達成率</th>
|
<th>達成率</th>
|
||||||
<td th:text="${goalForm.achievementRate} + '%'"
|
<td th:text="${goalForm.achievementRate} + '%'"></td>
|
||||||
class="goal"></td>
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -21,6 +21,12 @@
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</th:block>
|
</th:block>
|
||||||
|
|
||||||
|
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
|
||||||
|
<th:block th:if="${mode == 'change'}">
|
||||||
|
<form th:action="@{/course/create}" method="get">
|
||||||
|
<button type="submit">新規登録</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
</th:block>
|
</th:block>
|
||||||
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" id="totalForm" method="post">
|
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" id="totalForm" method="post">
|
||||||
@@ -36,8 +42,7 @@
|
|||||||
aria-controls="'collapse' + ${course.courseId}">
|
aria-controls="'collapse' + ${course.courseId}">
|
||||||
<span th:text="${course.courseName}"></span>
|
<span th:text="${course.courseName}"></span>
|
||||||
</button>
|
</button>
|
||||||
|
<p style="width: 120px;"><button type="button" class="btn btn-danger w-100"
|
||||||
<p th:if="${course.courseId > 6}" style="width: 120px;"><button type="button" class="btn btn-danger w-100"
|
|
||||||
th:attr="data-course-id=${course.courseId}" onclick="deleteCourse(this)">削除</button></p>
|
th:attr="data-course-id=${course.courseId}" onclick="deleteCourse(this)">削除</button></p>
|
||||||
</h2>
|
</h2>
|
||||||
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse"
|
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse"
|
||||||
|
|||||||
@@ -122,16 +122,6 @@
|
|||||||
|
|
||||||
const tType = '[[${session.tType}]]';
|
const tType = '[[${session.tType}]]';
|
||||||
|
|
||||||
console.log("tType: " + tType);
|
|
||||||
|
|
||||||
if (tType.includes("0")) {
|
|
||||||
console.log("okokokokokokokkkokokokoko");
|
|
||||||
transactionType.value = "0";
|
|
||||||
} else if (tType.includes("1")) {
|
|
||||||
transactionType.value = "1";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function toggleCategory() {
|
function toggleCategory() {
|
||||||
|
|
||||||
if (transactionType.value === "0") {
|
if (transactionType.value === "0") {
|
||||||
@@ -174,6 +164,12 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (tType == "0") {
|
||||||
|
transactionType.value = "0";
|
||||||
|
} else if (tType == "1") {
|
||||||
|
transactionType.value = "1";
|
||||||
|
}
|
||||||
|
|
||||||
toggleCategory();
|
toggleCategory();
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user