Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-morimoto
# Conflicts: # src/main/java/com/example/demo/app/presentation/controller/TransactionController.java
This commit is contained in:
@@ -372,29 +372,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());
|
||||
@@ -407,34 +407,35 @@ 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)
|
||||
|
||||
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0 && goal.getDeadline().isAfter(today) )
|
||||
|
||||
.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());
|
||||
|
||||
Reference in New Issue
Block a user