|
|
|
@@ -57,6 +57,8 @@ public class GoalController {
|
|
|
|
|
|
|
|
|
|
|
|
Long userId = loginUser.getUserId();
|
|
|
|
Long userId = loginUser.getUserId();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalDate today = LocalDate.now();
|
|
|
|
|
|
|
|
|
|
|
|
goalService.updateGoalComplete(userId);
|
|
|
|
goalService.updateGoalComplete(userId);
|
|
|
|
|
|
|
|
|
|
|
|
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
|
|
|
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
|
|
|
@@ -64,7 +66,8 @@ public class GoalController {
|
|
|
|
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
|
|
|
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
|
|
|
|
|
|
|
|
|
|
|
List<GoalForm> goalFormList = goalFormList1.stream()
|
|
|
|
List<GoalForm> goalFormList = goalFormList1.stream()
|
|
|
|
.filter(goalForm -> goalForm.getGoalComplete() == 0)
|
|
|
|
.filter(goalForm -> goalForm.getGoalComplete() == 0
|
|
|
|
|
|
|
|
&& !goalForm.getDeadline().isBefore(today))
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
model.addAttribute(
|
|
|
|
model.addAttribute(
|
|
|
|
@@ -107,8 +110,6 @@ public class GoalController {
|
|
|
|
1,
|
|
|
|
1,
|
|
|
|
1);
|
|
|
|
1);
|
|
|
|
|
|
|
|
|
|
|
|
LocalDate today = LocalDate.now();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
|
|
|
|
Map<LocalDate, List<TransactionForm>> transactionFormMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
transactionService
|
|
|
|
transactionService
|
|
|
|
@@ -233,15 +234,14 @@ public class GoalController {
|
|
|
|
@GetMapping(TransitionTargetPageNameKeyword.EDIT)
|
|
|
|
@GetMapping(TransitionTargetPageNameKeyword.EDIT)
|
|
|
|
public String editGoal(Model model, HttpSession session, Long goalId) {
|
|
|
|
public String editGoal(Model model, HttpSession session, Long goalId) {
|
|
|
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
|
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
|
|
|
|
|
|
|
|
|
|
Long userId = loginUser.getUserId();
|
|
|
|
Long userId = loginUser.getUserId();
|
|
|
|
|
|
|
|
|
|
|
|
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
|
|
|
|
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm);
|
|
|
|
model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm);
|
|
|
|
return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML;
|
|
|
|
return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@SessionCheck
|
|
|
|
@SessionCheck
|
|
|
|
@@ -272,11 +272,11 @@ public class GoalController {
|
|
|
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
|
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
|
|
|
|
|
|
|
|
|
|
Long userId = loginUser.getUserId();
|
|
|
|
Long userId = loginUser.getUserId();
|
|
|
|
|
|
|
|
|
|
|
|
int currentAmount = goalService.getCurrentAmount(userId);
|
|
|
|
int currentAmount = goalService.getCurrentAmount(userId);
|
|
|
|
|
|
|
|
|
|
|
|
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount);
|
|
|
|
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, currentAmount);
|
|
|
|
|
|
|
|
|
|
|
|
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
|
|
|
return TransitionTargetPageNameKeyword.GOAL_CREATE_HTML;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -305,7 +305,8 @@ public class GoalController {
|
|
|
|
if (record == null) {
|
|
|
|
if (record == null) {
|
|
|
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
|
|
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL + TransitionTargetPageNameKeyword.RECORD;
|
|
|
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL
|
|
|
|
|
|
|
|
+ TransitionTargetPageNameKeyword.RECORD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -314,6 +315,8 @@ public class GoalController {
|
|
|
|
@GetMapping(TransitionTargetPageNameKeyword.RECORD)
|
|
|
|
@GetMapping(TransitionTargetPageNameKeyword.RECORD)
|
|
|
|
public String getRecord(HttpSession session, Model model) {
|
|
|
|
public String getRecord(HttpSession session, Model model) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LocalDate today = LocalDate.now();
|
|
|
|
|
|
|
|
|
|
|
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
|
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
|
|
|
|
|
|
|
|
|
|
|
Long userId = loginUser.getUserId();
|
|
|
|
Long userId = loginUser.getUserId();
|
|
|
|
@@ -325,7 +328,13 @@ public class GoalController {
|
|
|
|
List<GoalForm> goalCompleteFormList = new ArrayList<>();
|
|
|
|
List<GoalForm> goalCompleteFormList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
goalFormList.stream().forEach(goalForm -> {
|
|
|
|
goalFormList.stream().forEach(goalForm -> {
|
|
|
|
if (goalForm.getGoalComplete() == 1) {
|
|
|
|
if (goalForm.getGoalComplete() == 1 || goalForm.getDeadline().isBefore(today)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
goalForm.setStatus(
|
|
|
|
|
|
|
|
goalForm.getGoalComplete() == 1
|
|
|
|
|
|
|
|
? "達成"
|
|
|
|
|
|
|
|
: "未達成");
|
|
|
|
|
|
|
|
|
|
|
|
goalCompleteFormList.add(goalForm);
|
|
|
|
goalCompleteFormList.add(goalForm);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|