Compare commits
18 Commits
6b207018db
...
s-morimoto
| Author | SHA1 | Date | |
|---|---|---|---|
| 7e2017a341 | |||
|
|
9d5dd5b9b2 | ||
|
|
378c169c1f | ||
|
|
e67912a259 | ||
| 26c9be6f71 | |||
| 181adcd933 | |||
| 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);
|
||||
|
||||
System.out.println("session invalidated");
|
||||
System.out.println("session invalidated method not supported exception");
|
||||
session.invalidate();
|
||||
|
||||
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||
|
||||
@@ -372,29 +372,29 @@ public class TransactionController {
|
||||
@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());
|
||||
@@ -410,26 +410,27 @@ public class TransactionController {
|
||||
|
||||
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 && goal.getDeadline().isAfter(today) )
|
||||
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!resultList.isEmpty()) {
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.example.demo.utility;
|
||||
|
||||
public class Constant {
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.example.demo.utility;
|
||||
|
||||
public class TestController1 {
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
.transaction-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.transaction-buttons {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.transaction-buttons form {
|
||||
margin: 0;
|
||||
}
|
||||
@@ -54,74 +54,46 @@
|
||||
|
||||
const myChart =
|
||||
new Chart(myCt, {
|
||||
|
||||
type: 'bar',
|
||||
|
||||
data: {
|
||||
|
||||
labels: labels,
|
||||
|
||||
datasets: [
|
||||
{
|
||||
label: '達成率',
|
||||
|
||||
data: achievementRates,
|
||||
|
||||
backgroundColor:
|
||||
'rgba(54, 162, 235, 0.5)',
|
||||
|
||||
borderColor:
|
||||
'rgba(54, 162, 235, 1)',
|
||||
|
||||
borderWidth: 1
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
options: {
|
||||
|
||||
responsive: true,
|
||||
|
||||
maintainAspectRatio: false,
|
||||
|
||||
scales: {
|
||||
|
||||
y: {
|
||||
|
||||
beginAtZero: true,
|
||||
|
||||
max: 100,
|
||||
|
||||
ticks: {
|
||||
|
||||
callback: function (value) {
|
||||
return value + '%';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<ul>
|
||||
|
||||
<li th:each="goalForm : ${goalFormList}">
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
|
||||
<form th:action="@{/goal}" method="get" class="w-100">
|
||||
|
||||
<div class="table-responsive">
|
||||
|
||||
<table class="table mb-0">
|
||||
|
||||
<input type="radio" name="goalId" th:value="${goalForm.goalId}"
|
||||
th:checked="${graphGoal != null and graphGoal.goalId == goalForm.goalId}"
|
||||
onchange="this.form.submit()">
|
||||
@@ -137,65 +109,47 @@
|
||||
<td th:text="${goalForm.goalSubtitle}"
|
||||
class="goal"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>目標金額</th>
|
||||
<td th:text="${goalForm.targetAmount}"
|
||||
class="goal"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>目標達成期限</th>
|
||||
<td th:text="${goalForm.deadline}"
|
||||
class="goal"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th>達成率</th>
|
||||
<td th:text="${goalForm.achievementRate} + '%'"
|
||||
class="goal"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end gap-2 mt-3">
|
||||
|
||||
<form th:action="@{/goal/edit}" method="get">
|
||||
|
||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||
|
||||
<button type="submit" class="btn btn-sm btn-primary">
|
||||
編集
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
<form th:action="@{/goal/delete}" method="post">
|
||||
|
||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||
|
||||
<button type="submit" class="btn btn-sm btn-danger">
|
||||
削除
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="d-grid gap-2 mt-4">
|
||||
|
||||
<form th:action="@{/goal/create}" method="get">
|
||||
|
||||
<button type="submit" class="btn btn-success w-100">
|
||||
@@ -205,7 +159,6 @@
|
||||
</form>
|
||||
|
||||
<form th:action="@{/goal/record}" method="get">
|
||||
|
||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||
履歴
|
||||
</button>
|
||||
@@ -213,7 +166,6 @@
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div th:replace="~{footer :: footer}"></div>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
<title>Calendar</title>
|
||||
<title>カレンダー</title>
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
@@ -55,51 +55,35 @@
|
||||
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr th:each="week : ${#numbers.sequence(0, 5)}">
|
||||
|
||||
<td th:each="weekDay : ${#numbers.sequence(0, 6)}">
|
||||
|
||||
<a th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1
|
||||
and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}" th:href="@{/transaction/detail(
|
||||
todayDates=${T(java.time.LocalDate).of(year, month, week * 7 + weekDay - firstDayOfWeek + 1)}
|
||||
)}" class="a-footer">
|
||||
|
||||
|
||||
<div
|
||||
th:if="${week * 7 + weekDay - firstDayOfWeek + 1 >= 1 and week * 7 + weekDay - firstDayOfWeek + 1 <= lastDay}">
|
||||
|
||||
<div class="date" th:text="${week * 7 + weekDay - firstDayOfWeek + 1}">
|
||||
</div>
|
||||
|
||||
<div th:each="income : ${incomeList}"
|
||||
th:if="${income.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
||||
class="income" th:text="|収入 +${income.amount}円|">
|
||||
</div>
|
||||
|
||||
<div th:each="expense : ${expenseList}"
|
||||
th:if="${expense.date.dayOfMonth == week * 7 + weekDay - firstDayOfWeek + 1}"
|
||||
class="expense" th:text="|支出 -${expense.amount}円|">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</a>
|
||||
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
<div class="card shadow-sm mb-3">
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<div class="d-flex justify-content-between mb-2">
|
||||
<span>収入</span>
|
||||
<span th:text="'¥' + ${totalIncome}"></span>
|
||||
@@ -124,25 +108,19 @@
|
||||
<span>目標資金</span>
|
||||
<span th:text="'¥' + ${targetAmount}"></span>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between mb-2">
|
||||
<span>現在高</span>
|
||||
<span th:text="'¥' + ${currentAmount}"></span>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<span>貯金額</span>
|
||||
<span th:text="'¥' + ${saving}"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="card shadow-sm">
|
||||
|
||||
<div class="card-body">
|
||||
|
||||
<div class="d-flex justify-content-between mb-2">
|
||||
<span>達成率</span>
|
||||
<span th:text="${achievementRate} + '%'"
|
||||
|
||||
Reference in New Issue
Block a user