Merge branch 's-choi' of https://gitea.it-college.co.jp/2026_09_5H_Spring_KIZAKI/Monegement into s-morimto
# Conflicts: # src/main/resources/templates/select_course.html
This commit is contained in:
5
pom.xml
5
pom.xml
@@ -83,6 +83,11 @@
|
|||||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mindrot</groupId>
|
||||||
|
<artifactId>jbcrypt</artifactId>
|
||||||
|
<version>0.4</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import com.example.demo.app.presentation.form.UserForm;
|
|||||||
|
|
||||||
public interface UserService {
|
public interface UserService {
|
||||||
|
|
||||||
public void register(UserForm userForm, Long courseId, Long userId);
|
public void register(UserForm userForm, Long courseId);
|
||||||
|
|
||||||
public void updateCourse(Long userId, Long courseId);
|
public void updateCourse(Long userId, Long courseId);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.example.demo.app.domain.service.impl;
|
package com.example.demo.app.domain.service.impl;
|
||||||
|
|
||||||
|
import org.mindrot.jbcrypt.BCrypt;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
@@ -18,14 +19,36 @@ public class LoginServiceImpl implements LoginService {
|
|||||||
@Override
|
@Override
|
||||||
public LoginModel login(String mailAddress, String password) {
|
public LoginModel login(String mailAddress, String password) {
|
||||||
|
|
||||||
UserEntity userEntity = userRepository.findByMailAddressAndPassword(
|
UserEntity userEntity = userRepository
|
||||||
mailAddress,
|
.findByMailAddress(mailAddress)
|
||||||
password).orElse(null);
|
.orElse(null);
|
||||||
|
|
||||||
if (userEntity == null) {
|
if (userEntity == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isValidPassword = false;
|
||||||
|
if (userEntity.getPassword().length() <= 24) {
|
||||||
|
if (userEntity.getPassword().equals(password)) {
|
||||||
|
|
||||||
|
userEntity.setPassword(BCrypt.hashpw(password, BCrypt.gensalt()));
|
||||||
|
userRepository.save(userEntity);
|
||||||
|
isValidPassword = true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
isValidPassword = BCrypt.checkpw(password, userEntity.getPassword());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isValidPassword) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return new LoginModel(userEntity.getUserId());
|
return new LoginModel(userEntity.getUserId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.example.demo.app.domain.service.impl;
|
package com.example.demo.app.domain.service.impl;
|
||||||
|
|
||||||
|
import org.mindrot.jbcrypt.BCrypt;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.example.demo.app.domain.service.PasswordResetService;
|
import com.example.demo.app.domain.service.PasswordResetService;
|
||||||
@@ -25,15 +26,16 @@ public class PasswordResetServiceImpl implements PasswordResetService {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
UserEntity userEntity =
|
UserEntity userEntity = userRepository.findById(userId).orElse(null);
|
||||||
userRepository.findById(userId).orElse(null);
|
|
||||||
|
|
||||||
if (userEntity == null) {
|
if (userEntity == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String passwordHashed = BCrypt.hashpw(passwordResetForm.getPassword(), BCrypt.gensalt());
|
||||||
|
|
||||||
userEntity.setPassword(
|
userEntity.setPassword(
|
||||||
passwordResetForm.getPassword());
|
passwordHashed);
|
||||||
|
|
||||||
userRepository.save(userEntity);
|
userRepository.save(userEntity);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.example.demo.app.domain.service.impl;
|
package com.example.demo.app.domain.service.impl;
|
||||||
|
|
||||||
|
import org.mindrot.jbcrypt.BCrypt;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.UserModel;
|
import com.example.demo.app.domain.model.UserModel;
|
||||||
@@ -25,13 +26,16 @@ public class UserServiceImpl implements UserService {
|
|||||||
private final CourseRepository courseRepository;
|
private final CourseRepository courseRepository;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register(UserForm userForm, Long courseId, Long userId) {
|
public void register(UserForm userForm, Long courseId) {
|
||||||
|
|
||||||
UserEntity userEntity = new UserEntity();
|
UserEntity userEntity = new UserEntity();
|
||||||
|
|
||||||
userEntity.setUserName(userForm.getUserName());
|
userEntity.setUserName(userForm.getUserName());
|
||||||
userEntity.setMailAddress(userForm.getMailAddress());
|
userEntity.setMailAddress(userForm.getMailAddress());
|
||||||
userEntity.setPassword(userForm.getPassword());
|
|
||||||
|
String passwordHashed = BCrypt.hashpw(userForm.getPassword(), BCrypt.gensalt());
|
||||||
|
|
||||||
|
userEntity.setPassword(passwordHashed);
|
||||||
userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer());
|
userEntity.setSecretQuestionAnswer(userForm.getSecretAnswer());
|
||||||
userEntity.setBirthDate(userForm.getBirthDate());
|
userEntity.setBirthDate(userForm.getBirthDate());
|
||||||
userEntity.setSaving(userForm.getSaving());
|
userEntity.setSaving(userForm.getSaving());
|
||||||
@@ -44,7 +48,6 @@ public class UserServiceImpl implements UserService {
|
|||||||
|
|
||||||
GoalEntity goalEntity = new GoalEntity();
|
GoalEntity goalEntity = new GoalEntity();
|
||||||
goalEntity.setTargetAmount(Integer.parseInt(String.valueOf(userForm.getGoalId())));
|
goalEntity.setTargetAmount(Integer.parseInt(String.valueOf(userForm.getGoalId())));
|
||||||
goalEntity.setUserEntity(userRepository.findById(userId).get());
|
|
||||||
|
|
||||||
CourseEntity courseEntity = courseRepository.findById(courseId).orElse(null);
|
CourseEntity courseEntity = courseRepository.findById(courseId).orElse(null);
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ import com.example.demo.aop.aspect.SessionCheck;
|
|||||||
import com.example.demo.app.domain.model.AnalysisModel;
|
import com.example.demo.app.domain.model.AnalysisModel;
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.AnalysisService;
|
import com.example.demo.app.domain.service.AnalysisService;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.app.presentation.form.AnalysisForm;
|
import com.example.demo.app.presentation.form.AnalysisForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -25,7 +28,7 @@ public class AnalysisController {
|
|||||||
private final AnalysisService analysisService;
|
private final AnalysisService analysisService;
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/analysis")
|
@GetMapping(TransitionTargetPageNameKeyword.ANALYSIS)
|
||||||
public String showAnalysis(
|
public String showAnalysis(
|
||||||
@RequestParam(required = false) Integer year,
|
@RequestParam(required = false) Integer year,
|
||||||
@RequestParam(required = false) Integer month,
|
@RequestParam(required = false) Integer month,
|
||||||
@@ -33,7 +36,7 @@ public class AnalysisController {
|
|||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
//ログインユーザーの取得(セッション)
|
//ログインユーザーの取得(セッション)
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
//初期年月表示
|
//初期年月表示
|
||||||
LocalDate nowDate = LocalDate.now();
|
LocalDate nowDate = LocalDate.now();
|
||||||
@@ -58,15 +61,15 @@ public class AnalysisController {
|
|||||||
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
|
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
|
||||||
|
|
||||||
//model格納
|
//model格納
|
||||||
model.addAttribute("analysisForm", analysisForm);
|
model.addAttribute(PageReturnAttributeKeyword.ANALYSIS_FORM, analysisForm);
|
||||||
model.addAttribute("year", year);
|
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
||||||
model.addAttribute("month", month);
|
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
||||||
model.addAttribute("previousYear", previousDate.getYear());
|
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousDate.getYear());
|
||||||
model.addAttribute("previousMonth", previousDate.getMonthValue());
|
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousDate.getMonthValue());
|
||||||
model.addAttribute("nextYear", nextDate.getYear());
|
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextDate.getYear());
|
||||||
model.addAttribute("nextMonth", nextDate.getMonthValue());
|
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextDate.getMonthValue());
|
||||||
|
|
||||||
return "analysis";
|
return TransitionTargetPageNameKeyword.ANALYSIS_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import com.example.demo.app.domain.model.AuthenticationModel;
|
import com.example.demo.app.domain.model.AuthenticationModel;
|
||||||
import com.example.demo.app.domain.service.AuthenticationService;
|
import com.example.demo.app.domain.service.AuthenticationService;
|
||||||
import com.example.demo.app.infra.repository.QuestionRepository;
|
import com.example.demo.app.infra.repository.QuestionRepository;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.app.presentation.form.AuthenticationForm;
|
import com.example.demo.app.presentation.form.AuthenticationForm;
|
||||||
import com.example.demo.app.presentation.form.PasswordResetForm;
|
import com.example.demo.app.presentation.form.PasswordResetForm;
|
||||||
|
|
||||||
@@ -22,16 +24,16 @@ public class AuthenticationController {
|
|||||||
private final AuthenticationService authenticationService;
|
private final AuthenticationService authenticationService;
|
||||||
private final QuestionRepository questionRepository;
|
private final QuestionRepository questionRepository;
|
||||||
|
|
||||||
@GetMapping("/authentication")
|
@GetMapping(TransitionTargetPageNameKeyword.AUTHENTICATION)
|
||||||
public String showAuthentication(Model model) {
|
public String showAuthentication(Model model) {
|
||||||
|
|
||||||
model.addAttribute("authenticationForm", new AuthenticationForm());
|
model.addAttribute(PageReturnAttributeKeyword.AUTHENTICATION_FORM, new AuthenticationForm());
|
||||||
model.addAttribute("questionList", questionRepository.findAll());
|
model.addAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionRepository.findAll());
|
||||||
|
|
||||||
return "authentication";
|
return TransitionTargetPageNameKeyword.AUTHENTICATION_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/authentication")
|
@PostMapping(TransitionTargetPageNameKeyword.AUTHENTICATION)
|
||||||
public String authenticate(
|
public String authenticate(
|
||||||
AuthenticationForm authenticationForm,
|
AuthenticationForm authenticationForm,
|
||||||
Model model,
|
Model model,
|
||||||
@@ -41,21 +43,21 @@ public class AuthenticationController {
|
|||||||
authenticationService.authenticate(authenticationForm);
|
authenticationService.authenticate(authenticationForm);
|
||||||
|
|
||||||
if (authenticationModel == null) {
|
if (authenticationModel == null) {
|
||||||
model.addAttribute("errorMessage", "認証情報が正しくありません。");
|
model.addAttribute(PageReturnAttributeKeyword.ERROR_MESSAGE, "認証情報が正しくありません。");
|
||||||
model.addAttribute("questionList", questionRepository.findAll());
|
model.addAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionRepository.findAll());
|
||||||
|
|
||||||
return "authentication";
|
return TransitionTargetPageNameKeyword.AUTHENTICATION_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
session.setAttribute(
|
session.setAttribute(
|
||||||
"passwordResetUserId",
|
PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID,
|
||||||
authenticationModel.getUserId());
|
authenticationModel.getUserId());
|
||||||
|
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
"passwordResetForm",
|
PageReturnAttributeKeyword.PASSWOR_RESET_FORM,
|
||||||
new PasswordResetForm());
|
new PasswordResetForm());
|
||||||
|
|
||||||
return "password_reset";
|
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ import com.example.demo.app.domain.service.AllocationService;
|
|||||||
import com.example.demo.app.domain.service.CourseInfoService;
|
import com.example.demo.app.domain.service.CourseInfoService;
|
||||||
import com.example.demo.app.domain.service.CourseService;
|
import com.example.demo.app.domain.service.CourseService;
|
||||||
import com.example.demo.app.domain.service.UserService;
|
import com.example.demo.app.domain.service.UserService;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.app.presentation.form.AllocationFormList;
|
import com.example.demo.app.presentation.form.AllocationFormList;
|
||||||
import com.example.demo.app.presentation.form.CourseForm;
|
import com.example.demo.app.presentation.form.CourseForm;
|
||||||
import com.example.demo.app.presentation.form.CourseInfoForm;
|
import com.example.demo.app.presentation.form.CourseInfoForm;
|
||||||
@@ -35,46 +38,53 @@ public class CourseController {
|
|||||||
private final UserService userService;
|
private final UserService userService;
|
||||||
private final AllocationService allocationService;
|
private final AllocationService allocationService;
|
||||||
|
|
||||||
|
@PostMapping(TransitionTargetPageNameKeyword.SHOW_SELECT_COURSE)
|
||||||
@PostMapping("/user/register/course")
|
|
||||||
public String showSelectCourse(@ModelAttribute UserForm userForm, Model model, HttpSession session) {
|
public String showSelectCourse(@ModelAttribute UserForm userForm, Model model, HttpSession session) {
|
||||||
|
|
||||||
session.setAttribute("userForm", userForm);
|
final String MODE = "regist";
|
||||||
model.addAttribute("mode", "regist");
|
final String DEFAULT = "バランスコース";
|
||||||
model.addAttribute("currentCourseId", courseService.findByName("バランスコース"));
|
|
||||||
model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll()));
|
|
||||||
model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
|
||||||
|
|
||||||
return "select_course";
|
session.setAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MODE, MODE);
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, courseService.findByName(DEFAULT));
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST, CourseForm.convertFrom(courseService.findAll()));
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
|
||||||
|
CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.SELECT_COURSE_HTML;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/course")
|
@GetMapping(TransitionTargetPageNameKeyword.COURSE)
|
||||||
public String showChangeCourse(Model model, HttpSession session) {
|
public String showChangeCourse(Model model, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
final String MODE = "change";
|
||||||
|
|
||||||
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
Long currentCourseId = userService.findByUserId(userId).getCourseId();
|
Long currentCourseId = userService.findByUserId(userId).getCourseId();
|
||||||
model.addAttribute("mode", "change");
|
|
||||||
model.addAttribute("currentCourseId", currentCourseId);
|
|
||||||
model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll()));
|
|
||||||
model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
|
||||||
|
|
||||||
return "select_course";
|
model.addAttribute(PageReturnAttributeKeyword.MODE, MODE);
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.CURRENT_COURSE_ID, currentCourseId);
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.COURSE_LIST, CourseForm.convertFrom(courseService.findAll()));
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.COURSE_INFO_LIST,
|
||||||
|
CourseInfoForm.convertFrom(courseInfoService.findAll()));
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.SELECT_COURSE_HTML;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping("/change")
|
@PostMapping(TransitionTargetPageNameKeyword.CHANGE)
|
||||||
public String changeCourse(@RequestParam Long courseId, HttpSession httpSession) {
|
public String changeCourse(@RequestParam Long courseId, HttpSession httpSession) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) httpSession.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) httpSession.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
userService.updateCourse(loginUser.getUserId(), courseId);
|
userService.updateCourse(loginUser.getUserId(), courseId);
|
||||||
|
|
||||||
return "redirect:/menu";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@@ -86,12 +96,14 @@ public class CourseController {
|
|||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping("/course/create/ratio")
|
@PostMapping("/course/create/ratio")
|
||||||
public String createCourse(@ModelAttribute CourseForm courseForm, @ModelAttribute AllocationFormList allocationFormList,
|
public String createCourse(@ModelAttribute CourseForm courseForm,
|
||||||
|
@ModelAttribute AllocationFormList allocationFormList,
|
||||||
HttpSession session, Model model) {
|
HttpSession session, Model model) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
CourseForm form = CourseForm.convertFrom(courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId()));
|
CourseForm form = CourseForm
|
||||||
|
.convertFrom(courseService.save(CourseForm.convertTo(courseForm), loginUser.getUserId()));
|
||||||
|
|
||||||
session.setAttribute("courseId", form.getCourseId());
|
session.setAttribute("courseId", form.getCourseId());
|
||||||
|
|
||||||
@@ -102,20 +114,30 @@ public class CourseController {
|
|||||||
@PostMapping("/course/create")
|
@PostMapping("/course/create")
|
||||||
public String createCoursePost(@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
|
public String createCoursePost(@ModelAttribute AllocationFormList allocationFormList, HttpSession session) {
|
||||||
|
|
||||||
|
|
||||||
List<AllocationModel> allocationModelList = new ArrayList<>();
|
List<AllocationModel> allocationModelList = new ArrayList<>();
|
||||||
|
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId1(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio1()));
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId1(),
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId2(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio2()));
|
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio1()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId3(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio3()));
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId2(),
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio4()));
|
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio2()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio5()));
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId3(),
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio6()));
|
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio3()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio7()));
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId4(),
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio8()));
|
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio4()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio9()));
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId5(),
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio10()));
|
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio5()));
|
||||||
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(), (Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio11()));
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId6(),
|
||||||
|
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio6()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId7(),
|
||||||
|
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio7()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId8(),
|
||||||
|
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio8()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId9(),
|
||||||
|
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio9()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId10(),
|
||||||
|
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio10()));
|
||||||
|
allocationModelList.add(new AllocationModel(allocationFormList.getCategoryId11(),
|
||||||
|
(Long) session.getAttribute("courseId"), allocationFormList.getAllocationRatio11()));
|
||||||
|
|
||||||
allocationService.save(allocationModelList);
|
allocationService.save(allocationModelList);
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ package com.example.demo.app.presentation.controller;
|
|||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
public class ErrorController {
|
public class ErrorController {
|
||||||
@GetMapping("/error")
|
@GetMapping(TransitionTargetPageNameKeyword.ERROR)
|
||||||
public String showError() {
|
public String showError() {
|
||||||
return "error";
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ import com.example.demo.app.domain.service.CategoryService;
|
|||||||
import com.example.demo.app.domain.service.GoalService;
|
import com.example.demo.app.domain.service.GoalService;
|
||||||
import com.example.demo.app.domain.service.TransactionService;
|
import com.example.demo.app.domain.service.TransactionService;
|
||||||
import com.example.demo.app.domain.service.UserService;
|
import com.example.demo.app.domain.service.UserService;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.app.presentation.form.CategoryForm;
|
import com.example.demo.app.presentation.form.CategoryForm;
|
||||||
import com.example.demo.app.presentation.form.GoalForm;
|
import com.example.demo.app.presentation.form.GoalForm;
|
||||||
import com.example.demo.app.presentation.form.MonthlyAchievementForm;
|
import com.example.demo.app.presentation.form.MonthlyAchievementForm;
|
||||||
@@ -35,7 +38,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RequestMapping("/goal")
|
@RequestMapping(TransitionTargetPageNameKeyword.GOAL)
|
||||||
public class GoalController {
|
public class GoalController {
|
||||||
|
|
||||||
private final GoalService goalService;
|
private final GoalService goalService;
|
||||||
@@ -53,7 +56,9 @@ public class GoalController {
|
|||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
goalService.updateGoalComplete(userId);
|
goalService.updateGoalComplete(userId);
|
||||||
|
|
||||||
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
List<GoalModel> goalModelList = goalService.getGoalByUserId(userId);
|
||||||
|
|
||||||
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
List<GoalForm> goalFormList1 = GoalForm.convertFrom(goalModelList);
|
||||||
@@ -66,6 +71,10 @@ public class GoalController {
|
|||||||
"goalFormList",
|
"goalFormList",
|
||||||
goalFormList);
|
goalFormList);
|
||||||
|
|
||||||
|
model.addAttribute(
|
||||||
|
"achievementList",
|
||||||
|
new ArrayList<MonthlyAchievementForm>());
|
||||||
|
|
||||||
if (goalFormList.isEmpty()) {
|
if (goalFormList.isEmpty()) {
|
||||||
return "goal_view";
|
return "goal_view";
|
||||||
}
|
}
|
||||||
@@ -188,7 +197,8 @@ public class GoalController {
|
|||||||
month = month.minusMonths(1);
|
month = month.minusMonths(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Collections.reverse(monthlySavingList);
|
Collections.reverse(
|
||||||
|
monthlySavingList);
|
||||||
|
|
||||||
List<MonthlyAchievementForm> achievementList = new ArrayList<>();
|
List<MonthlyAchievementForm> achievementList = new ArrayList<>();
|
||||||
|
|
||||||
@@ -216,27 +226,29 @@ public class GoalController {
|
|||||||
"achievementList",
|
"achievementList",
|
||||||
achievementList);
|
achievementList);
|
||||||
|
|
||||||
return "goal_view";
|
return TransitionTargetPageNameKeyword.GOAL_VIEW_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/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("loginUser");
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
|
GoalForm goalForm = GoalForm.convertFrom(goalService.getGoalById(goalId));
|
||||||
|
|
||||||
model.addAttribute("goalForm", goalForm);
|
|
||||||
return "goal_edit";
|
model.addAttribute(PageReturnAttributeKeyword.GOAL_FORM, goalForm);
|
||||||
|
return TransitionTargetPageNameKeyword.GOAL_EDIT_HTML;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping("/update")
|
@PostMapping(TransitionTargetPageNameKeyword.UPDATE)
|
||||||
public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
public String updateGoal(@ModelAttribute GoalForm goalForm, HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
Long userId = loginUser.getUserId();
|
Long userId = loginUser.getUserId();
|
||||||
|
|
||||||
@@ -250,7 +262,7 @@ public class GoalController {
|
|||||||
GoalModel goalModel = GoalModel.convertFrom(goalForm);
|
GoalModel goalModel = GoalModel.convertFrom(goalForm);
|
||||||
goalService.updateGoal(goalModel, userId);
|
goalService.updateGoal(goalModel, userId);
|
||||||
|
|
||||||
return "redirect:/goal";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.GOAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
|
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.LoginService;
|
import com.example.demo.app.domain.service.LoginService;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.app.presentation.form.LoginForm;
|
import com.example.demo.app.presentation.form.LoginForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -20,13 +23,18 @@ public class LoginController {
|
|||||||
|
|
||||||
private final LoginService loginService;
|
private final LoginService loginService;
|
||||||
|
|
||||||
@GetMapping("/login")
|
@GetMapping(TransitionTargetPageNameKeyword.LOGIN)
|
||||||
public String showLogin(@ModelAttribute LoginForm loginForm) {
|
public String showLogin(@ModelAttribute LoginForm loginForm, HttpSession session) {
|
||||||
|
|
||||||
return "login";
|
if (session.getAttribute("loginUser") != null) {
|
||||||
|
return "redirect:/menu";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/login")
|
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping(TransitionTargetPageNameKeyword.LOGIN)
|
||||||
public String login(
|
public String login(
|
||||||
@ModelAttribute LoginForm loginForm,
|
@ModelAttribute LoginForm loginForm,
|
||||||
Model model,
|
Model model,
|
||||||
@@ -38,15 +46,15 @@ public class LoginController {
|
|||||||
|
|
||||||
if (loginModel == null) {
|
if (loginModel == null) {
|
||||||
model.addAttribute(
|
model.addAttribute(
|
||||||
"errorMessage",
|
PageReturnAttributeKeyword.ERROR_MESSAGE,
|
||||||
"Email address or password is incorrect.");
|
"IDまたはパスワードが間違っています.");
|
||||||
|
|
||||||
return "login";
|
return TransitionTargetPageNameKeyword.LOGIN_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
session.setAttribute("loginUser", loginModel);
|
session.setAttribute(SessionKeyword.LOGIN_USER, loginModel);
|
||||||
|
|
||||||
return "redirect:/menu";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.MENU;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
|
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.service.PasswordResetService;
|
import com.example.demo.app.domain.service.PasswordResetService;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.app.presentation.form.PasswordResetForm;
|
import com.example.demo.app.presentation.form.PasswordResetForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -18,24 +21,22 @@ import lombok.RequiredArgsConstructor;
|
|||||||
public class PasswordResetController {
|
public class PasswordResetController {
|
||||||
private final PasswordResetService passwordResetService;
|
private final PasswordResetService passwordResetService;
|
||||||
|
|
||||||
@GetMapping("/password/reset")
|
@GetMapping(TransitionTargetPageNameKeyword.PASSWORD_RESET)
|
||||||
public String showPasswordReset(Model model) {
|
public String showPasswordReset(Model model) {
|
||||||
model.addAttribute("passwordResetForm", new PasswordResetForm());
|
model.addAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_FORM, new PasswordResetForm());
|
||||||
return "password_reset";
|
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/password/reset")
|
@PostMapping(TransitionTargetPageNameKeyword.PASSWORD_RESET)
|
||||||
public String resetPassword(
|
public String resetPassword(
|
||||||
PasswordResetForm passwordResetForm,
|
PasswordResetForm passwordResetForm,
|
||||||
Model model,
|
Model model,
|
||||||
HttpSession session){
|
HttpSession session) {
|
||||||
|
|
||||||
Long userId =
|
Long userId = (Long) session.getAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID);
|
||||||
(Long) session.getAttribute("passwordResetUserId");
|
|
||||||
|
|
||||||
if (userId == null) {
|
if (userId == null) {
|
||||||
LoginModel loginUser =
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
(LoginModel) session.getAttribute("loginUser");
|
|
||||||
|
|
||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
userId = loginUser.getUserId();
|
userId = loginUser.getUserId();
|
||||||
@@ -43,28 +44,27 @@ public class PasswordResetController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (userId == null) {
|
if (userId == null) {
|
||||||
return "redirect:/login";
|
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||||
|
TransitionTargetPageNameKeyword.LOGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isReset =
|
boolean isReset = passwordResetService.resetPassword(userId, passwordResetForm);
|
||||||
passwordResetService.resetPassword(userId, passwordResetForm);
|
|
||||||
|
|
||||||
System.out.println("isReset=" + isReset);
|
if (!isReset) {
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.MESSAGE, "パスワードが一致しません。");
|
||||||
if(!isReset) {
|
return TransitionTargetPageNameKeyword.PASSWORD_RESET_HTML;
|
||||||
model.addAttribute("message", "パスワードが一致しません。");
|
|
||||||
return "password_reset";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
session.removeAttribute("passwordResetUserId");
|
session.removeAttribute(PageReturnAttributeKeyword.PASSWOR_RESET_USER_ID);
|
||||||
|
|
||||||
LoginModel loginUser =
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
(LoginModel) session.getAttribute("loginUser");
|
|
||||||
|
|
||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
return "redirect:/menu";
|
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||||
|
TransitionTargetPageNameKeyword.PROFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "redirect:/login";
|
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||||
|
TransitionTargetPageNameKeyword.LOGIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,6 +12,9 @@ import com.example.demo.aop.aspect.SessionCheck;
|
|||||||
import com.example.demo.app.domain.model.LoginModel;
|
import com.example.demo.app.domain.model.LoginModel;
|
||||||
import com.example.demo.app.domain.model.ProfileModel;
|
import com.example.demo.app.domain.model.ProfileModel;
|
||||||
import com.example.demo.app.domain.service.ProfileService;
|
import com.example.demo.app.domain.service.ProfileService;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.app.presentation.form.ProfileEditForm;
|
import com.example.demo.app.presentation.form.ProfileEditForm;
|
||||||
import com.example.demo.app.presentation.form.ProfileForm;
|
import com.example.demo.app.presentation.form.ProfileForm;
|
||||||
|
|
||||||
@@ -23,26 +26,26 @@ public class ProfileController {
|
|||||||
private final ProfileService profileService;
|
private final ProfileService profileService;
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/profile")
|
@GetMapping(TransitionTargetPageNameKeyword.PROFILE)
|
||||||
public String profile(Model model, HttpSession session) {
|
public String profile(Model model, HttpSession session) {
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
ProfileModel profileModel = profileService.findOne(loginUser.getUserId());
|
ProfileModel profileModel = profileService.findOne(loginUser.getUserId());
|
||||||
|
|
||||||
ProfileForm profileForm = ProfileForm.convertForm(profileModel);
|
ProfileForm profileForm = ProfileForm.convertForm(profileModel);
|
||||||
|
|
||||||
model.addAttribute("profileForm", profileForm);
|
model.addAttribute(PageReturnAttributeKeyword.PROFILE_FORM, profileForm);
|
||||||
return "profile";
|
return TransitionTargetPageNameKeyword.PROFILE_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/profile/edit")
|
@GetMapping(TransitionTargetPageNameKeyword.PROFILE_EDIT)
|
||||||
public String showEditProfile(
|
public String showEditProfile(
|
||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser =
|
LoginModel loginUser =
|
||||||
(LoginModel) session.getAttribute("loginUser");
|
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
ProfileModel profileModel =
|
ProfileModel profileModel =
|
||||||
profileService.findOne(loginUser.getUserId());
|
profileService.findOne(loginUser.getUserId());
|
||||||
@@ -55,42 +58,42 @@ public class ProfileController {
|
|||||||
profileModel.getAnnualIncome(),
|
profileModel.getAnnualIncome(),
|
||||||
profileModel.getMonthlyBudget());
|
profileModel.getMonthlyBudget());
|
||||||
|
|
||||||
model.addAttribute("profileEditForm", profileEditForm);
|
model.addAttribute(PageReturnAttributeKeyword.PROFILE_EDIT_FORM, profileEditForm);
|
||||||
return "profile_edit";
|
return TransitionTargetPageNameKeyword.PROFILE_EDIT_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/profile/edit")
|
@PostMapping(TransitionTargetPageNameKeyword.PROFILE_EDIT)
|
||||||
public String updateProfile(
|
public String updateProfile(
|
||||||
@ModelAttribute ProfileEditForm profileEditForm,
|
@ModelAttribute ProfileEditForm profileEditForm,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser =
|
LoginModel loginUser =
|
||||||
(LoginModel) session.getAttribute("loginUser");
|
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
profileService.update(
|
profileService.update(
|
||||||
loginUser.getUserId(),
|
loginUser.getUserId(),
|
||||||
profileEditForm);
|
profileEditForm);
|
||||||
|
|
||||||
return "redirect:/profile";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.PROFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/withdraw")
|
@PostMapping(TransitionTargetPageNameKeyword.WITHDRAW)
|
||||||
public String withdraw(HttpSession session) {
|
public String withdraw(HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser =
|
LoginModel loginUser =
|
||||||
(LoginModel) session.getAttribute("loginUser");
|
(LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
profileService.withdraw(loginUser.getUserId());
|
profileService.withdraw(loginUser.getUserId());
|
||||||
|
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
|
|
||||||
return "redirect:/login";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/logout")
|
@PostMapping(TransitionTargetPageNameKeyword.LOGOUT)
|
||||||
public String logout(HttpSession session) {
|
public String logout(HttpSession session) {
|
||||||
session.invalidate();
|
session.invalidate();
|
||||||
return "redirect:/login";
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ import com.example.demo.app.domain.service.FixedCostService;
|
|||||||
import com.example.demo.app.domain.service.GoalService;
|
import com.example.demo.app.domain.service.GoalService;
|
||||||
import com.example.demo.app.domain.service.TransactionService;
|
import com.example.demo.app.domain.service.TransactionService;
|
||||||
import com.example.demo.app.domain.service.UserService;
|
import com.example.demo.app.domain.service.UserService;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.SessionKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.app.presentation.form.CategoryForm;
|
import com.example.demo.app.presentation.form.CategoryForm;
|
||||||
import com.example.demo.app.presentation.form.Expense;
|
import com.example.demo.app.presentation.form.Expense;
|
||||||
import com.example.demo.app.presentation.form.FixedCostForm;
|
import com.example.demo.app.presentation.form.FixedCostForm;
|
||||||
@@ -47,14 +50,14 @@ public class TransactionController {
|
|||||||
|
|
||||||
// 一覧画面
|
// 一覧画面
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/transaction/list")
|
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_LIST)
|
||||||
public String transactionList(
|
public String transactionList(
|
||||||
@RequestParam(required = false, defaultValue = "0") String years,
|
@RequestParam(required = false, defaultValue = "0") String years,
|
||||||
@RequestParam(required = false, defaultValue = "0") String months,
|
@RequestParam(required = false, defaultValue = "0") String months,
|
||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
@@ -115,28 +118,28 @@ public class TransactionController {
|
|||||||
transactionFormMap.put(date, transactionFormList);
|
transactionFormMap.put(date, transactionFormList);
|
||||||
});
|
});
|
||||||
|
|
||||||
model.addAttribute("year", year);
|
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
||||||
model.addAttribute("month", month);
|
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
||||||
|
|
||||||
model.addAttribute("previousYear", previousYear);
|
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousYear);
|
||||||
model.addAttribute("previousMonth", previousMonth);
|
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousMonth);
|
||||||
|
|
||||||
model.addAttribute("nextYear", nextYear);
|
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear);
|
||||||
model.addAttribute("nextMonth", nextMonth);
|
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth);
|
||||||
|
|
||||||
model.addAttribute("transactionFormMap", transactionFormMap);
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM_MAP, transactionFormMap);
|
||||||
|
|
||||||
return "transaction_list";
|
return TransitionTargetPageNameKeyword.TRANSACTION_LIST_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 詳細画面
|
// 詳細画面
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/transaction/detail")
|
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_DETAIL)
|
||||||
public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) {
|
public String findOne(@RequestParam(required = false) LocalDate todayDates, Model model, HttpSession session) {
|
||||||
|
|
||||||
LocalDate todayDate = (todayDates == null) ? LocalDate.now() : todayDates;
|
LocalDate todayDate = (todayDates == null) ? LocalDate.now() : todayDates;
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
List<TransactionForm> transactionFormList = transactionService
|
List<TransactionForm> transactionFormList = transactionService
|
||||||
.findByUserIdAndDate(todayDate, loginUser.getUserId()).stream()
|
.findByUserIdAndDate(todayDate, loginUser.getUserId()).stream()
|
||||||
@@ -177,14 +180,14 @@ public class TransactionController {
|
|||||||
return transactionForm;
|
return transactionForm;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
model.addAttribute("today", todayDate);
|
model.addAttribute(PageReturnAttributeKeyword.TODAY, todayDate);
|
||||||
model.addAttribute("transactionFormList", transactionFormList);
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM_LIST, transactionFormList);
|
||||||
|
|
||||||
return "transaction_detail";
|
return TransitionTargetPageNameKeyword.TRANSACTION_DETAIL_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/transaction/create")
|
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_CREATE)
|
||||||
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
|
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
|
||||||
Long fixedCostId,
|
Long fixedCostId,
|
||||||
Model model, HttpSession session) {
|
Model model, HttpSession session) {
|
||||||
@@ -215,35 +218,38 @@ public class TransactionController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(transactionForm.getCategoryName() + " " + transactionForm.getAmount());
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
||||||
|
|
||||||
model.addAttribute("transactionForm", transactionForm);
|
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
||||||
|
|
||||||
model.addAttribute("categoryFormList", categoryFormList);
|
model.addAttribute(PageReturnAttributeKeyword.TODAY, today.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
||||||
|
|
||||||
model.addAttribute("today", today.format(DateTimeFormatter.ISO_LOCAL_DATE));
|
return TransitionTargetPageNameKeyword.TRANSACTION_CREATE_HTML;
|
||||||
|
|
||||||
return "transaction_create";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping("/transaction/create")
|
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_CREATE)
|
||||||
public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today,
|
public String createOnePost(@ModelAttribute TransactionForm transactionForm, @RequestParam LocalDate today,
|
||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
transactionForm.setUserId(loginUser.getUserId());
|
transactionForm.setUserId(loginUser.getUserId());
|
||||||
if (transactionService.createTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
if (transactionService.createTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
||||||
return "error";
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "redirect:/transaction/detail?todayDates=" + transactionForm.getTransactionDate();
|
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||||
|
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
|
||||||
|
TransitionTargetPageNameKeyword.INTERROGATION +
|
||||||
|
TransitionTargetPageNameKeyword.TODAY_DATES +
|
||||||
|
TransitionTargetPageNameKeyword.EQUAL +
|
||||||
|
transactionForm.getTransactionDate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/transaction/update")
|
@GetMapping(TransitionTargetPageNameKeyword.TRANSACTION_UPDATE)
|
||||||
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
|
public String updateOneGet(@RequestParam Long transactionId, @RequestParam(defaultValue = "") LocalDate today,
|
||||||
Model model, HttpSession session) {
|
Model model, HttpSession session) {
|
||||||
|
|
||||||
@@ -271,22 +277,20 @@ public class TransactionController {
|
|||||||
transactionService.findMoneyRecord(transactionId),
|
transactionService.findMoneyRecord(transactionId),
|
||||||
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType());
|
CategoryForm.convertFrom(categoryService.findByTransactionId(transactionId)).getTransactionType());
|
||||||
|
|
||||||
System.out.println("category: " + transactionForm.getCategoryId() + "金額: " + transactionForm.getAmount());
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_ID, transactionId);
|
||||||
|
|
||||||
model.addAttribute("transactionId", transactionId);
|
model.addAttribute(PageReturnAttributeKeyword.TRANSACTION_FORM, transactionForm);
|
||||||
|
|
||||||
model.addAttribute("transactionForm", transactionForm);
|
model.addAttribute(PageReturnAttributeKeyword.CATEGORY_FORM_LIST, categoryFormList);
|
||||||
|
|
||||||
model.addAttribute("categoryFormList", categoryFormList);
|
model.addAttribute(PageReturnAttributeKeyword.TODAY, today);
|
||||||
|
|
||||||
model.addAttribute("today", today);
|
return TransitionTargetPageNameKeyword.TRANSACTION_UPDATE_HTML;
|
||||||
|
|
||||||
return "transaction_update";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping("/transaction/update")
|
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_UPDATE)
|
||||||
public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm,
|
public String updateOnePost(@RequestParam Long transactionId, @ModelAttribute TransactionForm transactionForm,
|
||||||
@RequestParam LocalDate today, Model model,
|
@RequestParam LocalDate today, Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
@@ -297,28 +301,38 @@ public class TransactionController {
|
|||||||
transactionForm.setTransactionId(transactionId);
|
transactionForm.setTransactionId(transactionId);
|
||||||
|
|
||||||
if (transactionService.updateTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
if (transactionService.updateTransaction(TransactionForm.convertTo(transactionForm)) != 0) {
|
||||||
return "error";
|
return TransitionTargetPageNameKeyword.ERROR_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "redirect:/transaction/detail?todayDates=" + transactionForm.getTransactionDate();
|
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||||
|
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
|
||||||
|
TransitionTargetPageNameKeyword.INTERROGATION +
|
||||||
|
TransitionTargetPageNameKeyword.TODAY_DATES +
|
||||||
|
TransitionTargetPageNameKeyword.EQUAL +
|
||||||
|
transactionForm.getTransactionDate();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@PostMapping("/transaction/delete")
|
@PostMapping(TransitionTargetPageNameKeyword.TRANSACTION_DELETE)
|
||||||
public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
|
public String deleteOne(@RequestParam Long transactionId, @RequestParam LocalDate today) {
|
||||||
|
|
||||||
transactionService.deleteTransaction(transactionId);
|
transactionService.deleteTransaction(transactionId);
|
||||||
return "redirect:/transaction/detail?todayDates=" + today;
|
return TransitionTargetPageNameKeyword.REDIRECT +
|
||||||
|
TransitionTargetPageNameKeyword.TRANSACTION_DETAIL +
|
||||||
|
TransitionTargetPageNameKeyword.INTERROGATION +
|
||||||
|
TransitionTargetPageNameKeyword.TODAY_DATES +
|
||||||
|
TransitionTargetPageNameKeyword.EQUAL +
|
||||||
|
today;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SessionCheck
|
@SessionCheck
|
||||||
@GetMapping("/menu")
|
@GetMapping(TransitionTargetPageNameKeyword.MENU)
|
||||||
public String menu(HttpSession session, Model model,
|
public String menu(HttpSession session, Model model,
|
||||||
@RequestParam(required = false, defaultValue = "0") String years,
|
@RequestParam(required = false, defaultValue = "0") String years,
|
||||||
@RequestParam(required = false, defaultValue = "0") String months) {
|
@RequestParam(required = false, defaultValue = "0") String months) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
LoginModel loginUser = (LoginModel) session.getAttribute(SessionKeyword.LOGIN_USER);
|
||||||
|
|
||||||
LocalDate today = LocalDate.now();
|
LocalDate today = LocalDate.now();
|
||||||
|
|
||||||
@@ -342,18 +356,18 @@ public class TransactionController {
|
|||||||
int nextYear = nextYearMonth.getYear();
|
int nextYear = nextYearMonth.getYear();
|
||||||
int nextMonth = nextYearMonth.getMonthValue();
|
int nextMonth = nextYearMonth.getMonthValue();
|
||||||
|
|
||||||
model.addAttribute("year", year);
|
model.addAttribute(PageReturnAttributeKeyword.YEAR, year);
|
||||||
model.addAttribute("month", month);
|
model.addAttribute(PageReturnAttributeKeyword.MONTH, month);
|
||||||
model.addAttribute("day", today.getDayOfMonth());
|
model.addAttribute(PageReturnAttributeKeyword.DAY, today.getDayOfMonth());
|
||||||
|
|
||||||
model.addAttribute("lastDay", lastDay);
|
model.addAttribute(PageReturnAttributeKeyword.LAST_DAY, lastDay);
|
||||||
model.addAttribute("firstDayOfWeek", firstDayOfWeek);
|
model.addAttribute(PageReturnAttributeKeyword.FIRST_DAY_OF_WEEK, firstDayOfWeek);
|
||||||
|
|
||||||
model.addAttribute("previousYear", previousYear);
|
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_YEAR, previousYear);
|
||||||
model.addAttribute("previousMonth", previousMonth);
|
model.addAttribute(PageReturnAttributeKeyword.PREVIOUS_MONTH, previousMonth);
|
||||||
|
|
||||||
model.addAttribute("nextYear", nextYear);
|
model.addAttribute(PageReturnAttributeKeyword.NEXT_YEAR, nextYear);
|
||||||
model.addAttribute("nextMonth", nextMonth);
|
model.addAttribute(PageReturnAttributeKeyword.NEXT_MONTH, nextMonth);
|
||||||
|
|
||||||
LocalDate startDate = yearMonth.atDay(1);
|
LocalDate startDate = yearMonth.atDay(1);
|
||||||
LocalDate endDate = yearMonth.atEndOfMonth();
|
LocalDate endDate = yearMonth.atEndOfMonth();
|
||||||
@@ -362,15 +376,15 @@ public class TransactionController {
|
|||||||
|
|
||||||
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
|
List<Expense> expenseList = transactionService.findTotalExpenseList(startDate, endDate, loginUser.getUserId());
|
||||||
|
|
||||||
model.addAttribute("incomeList", incomeList);
|
model.addAttribute(PageReturnAttributeKeyword.INCOME_LIST, incomeList);
|
||||||
model.addAttribute("expenseList", 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("totalIncome", totalIncome);
|
model.addAttribute(PageReturnAttributeKeyword.TOTAL_INCOME, totalIncome);
|
||||||
model.addAttribute("totalExpense", 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()));
|
||||||
|
|
||||||
@@ -379,19 +393,32 @@ public class TransactionController {
|
|||||||
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0)
|
List<GoalForm> resultList = goalForm.stream().filter(goal -> goal.getGoalComplete() == 0)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (!resultList.isEmpty()) {
|
||||||
GoalForm result = resultList.getFirst();
|
GoalForm result = resultList.getFirst();
|
||||||
|
|
||||||
model.addAttribute("achievementRate", result.getAchievementRate());
|
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, result.getAchievementRate());
|
||||||
|
|
||||||
model.addAttribute("currentAmount", result.getCurrentAmount());
|
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, result.getCurrentAmount());
|
||||||
|
|
||||||
model.addAttribute("targetAmount", result.getTargetAmount());
|
model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, result.getTargetAmount());
|
||||||
|
|
||||||
model.addAttribute("saving", userForm.getSaving());
|
model.addAttribute(PageReturnAttributeKeyword.SAVING, userForm.getSaving());
|
||||||
|
|
||||||
model.addAttribute("deadline", result.getDeadline());
|
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, result.getDeadline());
|
||||||
|
|
||||||
return "menu";
|
} else {
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.ACHIEVEMENT_RATE, "目標を設定してください");
|
||||||
|
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.CURRENT_AMOUNT, "目標を設定してください");
|
||||||
|
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.TARGET_AMOUNT, "目標を設定してください");
|
||||||
|
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.SAVING, userForm.getSaving());
|
||||||
|
|
||||||
|
model.addAttribute(PageReturnAttributeKeyword.DEADLINE, "目標を設定してください");
|
||||||
|
}
|
||||||
|
|
||||||
|
return TransitionTargetPageNameKeyword.MENU_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,11 +11,12 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import com.example.demo.app.domain.model.LoginModel;
|
|
||||||
import com.example.demo.app.domain.service.CourseService;
|
import com.example.demo.app.domain.service.CourseService;
|
||||||
import com.example.demo.app.domain.service.QuestionService;
|
import com.example.demo.app.domain.service.QuestionService;
|
||||||
import com.example.demo.app.domain.service.UserService;
|
import com.example.demo.app.domain.service.UserService;
|
||||||
import com.example.demo.app.infra.entity.QuestionEntity;
|
import com.example.demo.app.infra.entity.QuestionEntity;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.PageReturnAttributeKeyword;
|
||||||
|
import com.example.demo.app.presentation.controller.pageproperty.TransitionTargetPageNameKeyword;
|
||||||
import com.example.demo.app.presentation.form.UserForm;
|
import com.example.demo.app.presentation.form.UserForm;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -31,24 +32,22 @@ public class UserController {
|
|||||||
private final QuestionService questionService;
|
private final QuestionService questionService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/user/register")
|
@GetMapping(TransitionTargetPageNameKeyword.USER_RESISTER)
|
||||||
public String showRegister(Model model, HttpSession session) {
|
public String showRegister(Model model, HttpSession session) {
|
||||||
UserForm userForm = new UserForm();
|
UserForm userForm = new UserForm();
|
||||||
|
|
||||||
List<QuestionEntity> questionList = questionService.findAll();
|
List<QuestionEntity> questionList = questionService.findAll();
|
||||||
|
|
||||||
session.setAttribute("questionList", questionList);
|
session.setAttribute(PageReturnAttributeKeyword.QUESTION_LIST, questionList);
|
||||||
|
|
||||||
model.addAttribute("userForm", userForm);
|
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
||||||
return "user_register";
|
return TransitionTargetPageNameKeyword.USER_RESISTER_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/user/register/return")
|
@PostMapping(TransitionTargetPageNameKeyword.USER_RESISTER_RETURN)
|
||||||
public String showRegisterReturn(@RequestParam(required = false) Long courseId, Model model, HttpSession session) {
|
public String showRegisterReturn(@RequestParam(required = false) Long courseId, Model model, HttpSession session) {
|
||||||
|
|
||||||
UserForm userForm = (UserForm) session.getAttribute("userForm");
|
UserForm userForm = (UserForm) session.getAttribute(PageReturnAttributeKeyword.USER_FORM);
|
||||||
System.out.println(
|
|
||||||
"######################################################################3" + userForm.getBirthDate());
|
|
||||||
|
|
||||||
if (userForm.getUserName().equals("")) {
|
if (userForm.getUserName().equals("")) {
|
||||||
userForm = new UserForm();
|
userForm = new UserForm();
|
||||||
@@ -56,41 +55,37 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (courseId != null) {
|
if (courseId != null) {
|
||||||
model.addAttribute("selectedCourseName", courseService.findById(courseId).getCourseName());
|
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
||||||
}
|
}
|
||||||
|
|
||||||
session.setAttribute("selectedCourseName", courseService.findById(courseId).getCourseName());
|
session.setAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, courseService.findById(courseId).getCourseName());
|
||||||
model.addAttribute("courseId", courseId);
|
model.addAttribute(PageReturnAttributeKeyword.COURESE_ID, courseId);
|
||||||
System.out.println(
|
model.addAttribute(PageReturnAttributeKeyword.USER_FORM, userForm);
|
||||||
"######################################################################3" + userForm.getBirthDate());
|
|
||||||
model.addAttribute("userForm", userForm);
|
|
||||||
|
|
||||||
return "user_register_return";
|
return TransitionTargetPageNameKeyword.USER_RESISTER_RETURN_HTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/user/register/confirm")
|
@GetMapping(TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM)
|
||||||
public String confirmRegisterGet(@ModelAttribute UserForm userForm,
|
public String confirmRegisterGet(@ModelAttribute UserForm userForm,
|
||||||
String selectedCourseName, Model model,
|
String selectedCourseName, Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
model.addAttribute("selectedCourseName", (String) session.getAttribute("selectedCourseName"));
|
model.addAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME, (String) session.getAttribute("selectedCourseName"));
|
||||||
return "user_register_confirm";
|
return TransitionTargetPageNameKeyword.USER_RESISTER_CONFIRM_HTML;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/user/register/complete")
|
@PostMapping(TransitionTargetPageNameKeyword.USER_RESISTER_COMPLETE)
|
||||||
public String confirmRegister(
|
public String confirmRegister(
|
||||||
@ModelAttribute UserForm userForm,
|
@ModelAttribute UserForm userForm,
|
||||||
Model model,
|
Model model,
|
||||||
HttpSession session) {
|
HttpSession session) {
|
||||||
|
|
||||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
Long courseId = courseService.findByName((String) session.getAttribute(PageReturnAttributeKeyword.SELECTED_COURSE_NAME));
|
||||||
|
|
||||||
Long courseId = courseService.findByName((String) session.getAttribute("selectedCourseName"));
|
userService.register(userForm, courseId);
|
||||||
|
|
||||||
userService.register(userForm, courseId, loginUser.getUserId());
|
return TransitionTargetPageNameKeyword.REDIRECT + TransitionTargetPageNameKeyword.LOGIN;
|
||||||
|
|
||||||
return "redirect:/login";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class PageReturnAttributeKeyword {
|
|||||||
public static final String PASSWOR_RESET_FORM = "passwordResetForm";
|
public static final String PASSWOR_RESET_FORM = "passwordResetForm";
|
||||||
public static final String PASSWOR_RESET_USER_ID = "passwordResetUserId";
|
public static final String PASSWOR_RESET_USER_ID = "passwordResetUserId";
|
||||||
|
|
||||||
public static final String AUTENTICATION_FORM = "authenticationForm";
|
public static final String AUTHENTICATION_FORM = "authenticationForm";
|
||||||
|
|
||||||
public static final String PROFILE_FORM = "profileForm";
|
public static final String PROFILE_FORM = "profileForm";
|
||||||
public static final String PROFILE_EDIT_FORM = "profileEditForm";
|
public static final String PROFILE_EDIT_FORM = "profileEditForm";
|
||||||
|
|||||||
@@ -5,13 +5,13 @@ public class TransitionTargetPageNameKeyword {
|
|||||||
// HTML
|
// HTML
|
||||||
public static final String ERROR_HTML = "error";
|
public static final String ERROR_HTML = "error";
|
||||||
|
|
||||||
public static final String USER_RESISTER_HTML = "user_resiter";
|
public static final String USER_RESISTER_HTML = "user_register";
|
||||||
public static final String USER_RESISTER_RETURN_HTML = "user_resiter_return";
|
public static final String USER_RESISTER_RETURN_HTML = "user_register_return";
|
||||||
public static final String USER_RESISTER_CONFIRM_HTML = "user_resiter_confirm";
|
public static final String USER_RESISTER_CONFIRM_HTML = "user_register_confirm";
|
||||||
|
|
||||||
public static final String LOGIN_HTML = "login";
|
public static final String LOGIN_HTML = "login";
|
||||||
|
|
||||||
public static final String PASSWORD_RESET_HTML = "passsword_reset";
|
public static final String PASSWORD_RESET_HTML = "password_reset";
|
||||||
|
|
||||||
public static final String AUTHENTICATION_HTML = "authentication";
|
public static final String AUTHENTICATION_HTML = "authentication";
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ public class TransitionTargetPageNameKeyword {
|
|||||||
|
|
||||||
public static final String AUTHENTICATION = "/authentication";
|
public static final String AUTHENTICATION = "/authentication";
|
||||||
|
|
||||||
public static final String PASSWORD_RESET = "/passsword/reset";
|
public static final String PASSWORD_RESET = "/password/reset";
|
||||||
|
|
||||||
public static final String MENU = "/menu";
|
public static final String MENU = "/menu";
|
||||||
|
|
||||||
@@ -65,12 +65,13 @@ public class TransitionTargetPageNameKeyword {
|
|||||||
public static final String TRANSACTION_DETAIL = "/transaction/detail";
|
public static final String TRANSACTION_DETAIL = "/transaction/detail";
|
||||||
public static final String TRANSACTION_CREATE = "/transaction/create";
|
public static final String TRANSACTION_CREATE = "/transaction/create";
|
||||||
public static final String TRANSACTION_UPDATE = "/transaction/update";
|
public static final String TRANSACTION_UPDATE = "/transaction/update";
|
||||||
|
public static final String TRANSACTION_DELETE = "/transaction/delete";
|
||||||
public static final String TODAY_DATES = "todayDates";
|
public static final String TODAY_DATES = "todayDates";
|
||||||
|
|
||||||
public static final String ANALYSIS = "/analysis";
|
public static final String ANALYSIS = "/analysis";
|
||||||
|
|
||||||
public static final String GOAL = "/goal";
|
public static final String GOAL = "/goal";
|
||||||
public static final String GOAL_EDIT = "/goal/edit";
|
public static final String EDIT = "/edit";
|
||||||
public static final String GOAL_UPDATE = "/goal/update";
|
public static final String UPDATE = "/update";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns:th="http://www.thymeleaf.org">
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||||
<title>目標作成</title>
|
<title>目標作成</title>
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
</head>
|
</head>
|
||||||
<body class="pb-5 pt-5">
|
|
||||||
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
<h1>目標作成</h1>
|
<div class="main-container">
|
||||||
|
|
||||||
|
<h1 class="page-title">目標作成</h1>
|
||||||
|
|
||||||
|
<div class="card shadow-sm">
|
||||||
|
|
||||||
|
<div class="card-body">
|
||||||
|
|
||||||
<form th:action="@{/goal/create}" th:object="${goalForm}" method="post">
|
<form th:action="@{/goal/create}" th:object="${goalForm}" method="post">
|
||||||
<input type="hidden" th:field="*{goalId}">
|
<input type="hidden" th:field="*{goalId}">
|
||||||
@@ -33,9 +41,10 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標達成期限</label>
|
<label>目標達成期限</label>
|
||||||
<input type="date" th:field="*{deadline}" th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
<input type="date" th:field="*{deadline}"
|
||||||
|
th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit">更新する</button>
|
<button type="submit" class="btn btn-sm btn-primary w-100">更新する</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
@@ -43,4 +52,5 @@
|
|||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -24,17 +24,17 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標名</label>
|
<label>目標名</label>
|
||||||
<input type="text" th:field="*{goalTitle}" required>
|
<input type="text" th:field="*{goalTitle}">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標説明</label>
|
<label>目標説明</label>
|
||||||
<textarea th:field="*{goalSubtitle}" required></textarea>
|
<textarea th:field="*{goalSubtitle}"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label>目標金額</label>
|
<label>目標金額</label>
|
||||||
<input type="number" th:field="*{targetAmount}" min="0" max="1000000000" required>
|
<input type="number" th:field="*{targetAmount}" min="1" max="1000000000" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
@@ -42,12 +42,17 @@
|
|||||||
<input type="date" th:field="*{deadline}" th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
<input type="date" th:field="*{deadline}" th:min="${#temporals.format(#temporals.createNow(), 'yyyy-MM-dd')}" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<input type="hidden" th:field="*{goalComplete}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-sm btn-primary w-100">更新する</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary w-100">更新する</button>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1" http-equiv="Content-Type">
|
||||||
|
|
||||||
<title>目標詳細</title>
|
<title>目標詳細</title>
|
||||||
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
@@ -11,14 +12,13 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body style="padding-top:80px; padding-bottom:80px;">
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
<div th:replace="~{header :: header}"></div>
|
|
||||||
|
|
||||||
|
<div th:replace="~{header :: header}"></div>
|
||||||
|
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
|
|
||||||
<h1 class="page-title">目標詳細</h1>
|
<h1 class="page-title">目標詳細</h1>
|
||||||
|
|
||||||
<!-- -->
|
|
||||||
<div th:if="${graphGoal != null}">
|
<div th:if="${graphGoal != null}">
|
||||||
|
|
||||||
<h2 th:text="${graphGoal.goalTitle}"></h2>
|
<h2 th:text="${graphGoal.goalTitle}"></h2>
|
||||||
@@ -30,11 +30,13 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="card shadow-sm mb-3">
|
||||||
|
|
||||||
<div style="width: 600px; height: 300px;">
|
<div style="height: 400px;">
|
||||||
<canvas id="myChart"></canvas>
|
<canvas id="myChart"></canvas>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
|
|
||||||
@@ -47,11 +49,9 @@
|
|||||||
const labels =
|
const labels =
|
||||||
months.map(month => month + '月');
|
months.map(month => month + '月');
|
||||||
|
|
||||||
|
|
||||||
const myCt =
|
const myCt =
|
||||||
document.getElementById('myChart');
|
document.getElementById('myChart');
|
||||||
|
|
||||||
|
|
||||||
const myChart =
|
const myChart =
|
||||||
new Chart(myCt, {
|
new Chart(myCt, {
|
||||||
|
|
||||||
@@ -82,40 +82,50 @@
|
|||||||
|
|
||||||
responsive: true,
|
responsive: true,
|
||||||
|
|
||||||
|
maintainAspectRatio: false,
|
||||||
|
|
||||||
scales: {
|
scales: {
|
||||||
|
|
||||||
y: {
|
y: {
|
||||||
|
|
||||||
beginAtZero: true,
|
beginAtZero: true,
|
||||||
|
|
||||||
max: 100,
|
max: 100,
|
||||||
|
|
||||||
ticks: {
|
ticks: {
|
||||||
|
|
||||||
callback: function (value) {
|
callback: function (value) {
|
||||||
return value + '%';
|
return value + '%';
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<!-- -->
|
|
||||||
|
|
||||||
<div>
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
|
||||||
<li th:each="goalForm : ${goalFormList}" class="transaction-item">
|
<li th:each="goalForm : ${goalFormList}" class="transaction-item">
|
||||||
|
|
||||||
<div>
|
<div class="d-flex justify-content-between">
|
||||||
|
|
||||||
|
<form th:action="@{/goal}" method="get" class="w-100">
|
||||||
|
|
||||||
<form th:action="@{/goal}" method="get">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
|
||||||
|
<table class="table mb-0">
|
||||||
|
|
||||||
<input type="radio" name="goalId" th:value="${goalForm.goalId}"
|
<input type="radio" name="goalId" th:value="${goalForm.goalId}"
|
||||||
th:checked="${graphGoal != null and graphGoal.goalId == goalForm.goalId}"
|
th:checked="${graphGoal != null and graphGoal.goalId == goalForm.goalId}"
|
||||||
onchange="this.form.submit()">
|
onchange="this.form.submit()">
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標名</th>
|
<th>目標名</th>
|
||||||
<td th:text="${goalForm.goalTitle}"></td>
|
<td th:text="${goalForm.goalTitle}"></td>
|
||||||
@@ -125,10 +135,12 @@
|
|||||||
<th>目標説明</th>
|
<th>目標説明</th>
|
||||||
<td th:text="${goalForm.goalSubtitle}"></td>
|
<td th:text="${goalForm.goalSubtitle}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標金額</th>
|
<th>目標金額</th>
|
||||||
<td th:text="${goalForm.targetAmount}"></td>
|
<td th:text="${goalForm.targetAmount}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th>目標達成期限</th>
|
<th>目標達成期限</th>
|
||||||
<td th:text="${goalForm.deadline}"></td>
|
<td th:text="${goalForm.deadline}"></td>
|
||||||
@@ -138,30 +150,32 @@
|
|||||||
<th>達成率</th>
|
<th>達成率</th>
|
||||||
<td th:text="${goalForm.achievementRate} + '%'"></td>
|
<td th:text="${goalForm.achievementRate} + '%'"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="d-flex justify-content-end gap-2 mt-3">
|
||||||
<div class="transaction-buttons">
|
|
||||||
|
|
||||||
<form th:action="@{/goal/edit}" method="get">
|
<form th:action="@{/goal/edit}" method="get">
|
||||||
|
|
||||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
<button type="submit" class="btn btn-sm btn-primary">
|
||||||
編集
|
編集
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<form th:action="@{/goal/delete}" method="post">
|
<form th:action="@{/goal/delete}" method="post">
|
||||||
|
|
||||||
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
<input type="hidden" name="goalId" th:value="${goalForm.goalId}">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
<button type="submit" class="btn btn-sm btn-danger">
|
||||||
削除
|
削除
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
@@ -175,14 +189,14 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<form th:action="@{/goal/create}" method="get">
|
<form th:action="@{/goal/create}" method="get">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
<button type="submit" class="btn btn-success w-100">
|
||||||
新規登録
|
新規登録
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form th:action="@{/goal/record}" method="get">
|
<form th:action="@{/goal/record}" method="get">
|
||||||
|
|
||||||
<button type="submit" class="btn btn-sm btn-primary w-100">
|
<button type="submit" class="btn btn-sm btn-primary w-100">
|
||||||
@@ -191,7 +205,6 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<div th:replace="~{footer :: footer}"></div>
|
<div th:replace="~{footer :: footer}"></div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html xmlns:th="http://www.thymeleaf.org">
|
<html xmlns:th="http://www.thymeleaf.org">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">
|
<meta charset="UTF-8" name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>ヘッダー</title>
|
<title>ヘッダー</title>
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<header th:fragment="header" class="fixed-top">
|
<header th:fragment="header" class="fixed-top">
|
||||||
@@ -13,7 +15,7 @@
|
|||||||
<nav class="navbar app-header" style="background-color: #e3f2fd;" data-bs-theme="light">
|
<nav class="navbar app-header" style="background-color: #e3f2fd;" data-bs-theme="light">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a th:href="@{/menu}" class="navbar-brand fw-bold">Monegement</a>
|
<a th:href="@{/menu}" class="navbar-brand fw-bold">Monegement</a>
|
||||||
<div class="d-flex gap-2">
|
<div class="d-flex gap-2" th:if="${session.loginUser != null}">
|
||||||
<a class="btn btn-outline-primary btn-sm" th:href="@{/course}">
|
<a class="btn btn-outline-primary btn-sm" th:href="@{/course}">
|
||||||
コース
|
コース
|
||||||
</a>
|
</a>
|
||||||
@@ -21,10 +23,12 @@
|
|||||||
プロフィール
|
プロフィール
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
</header>
|
</header>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.7/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
th:field="*{password}"
|
th:field="*{password}"
|
||||||
minlength="8"
|
minlength="8"
|
||||||
maxlength="255"
|
maxlength="24"
|
||||||
required>
|
required>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
th:field="*{passwordConfirm}"
|
th:field="*{passwordConfirm}"
|
||||||
minlength="8"
|
minlength="8"
|
||||||
maxlength="255"
|
maxlength="24"
|
||||||
required>
|
required>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,26 +13,38 @@
|
|||||||
|
|
||||||
<h1 class="page-title">コース選択</h1>
|
<h1 class="page-title">コース選択</h1>
|
||||||
|
|
||||||
|
<th:block th:if="${mode == 'change'}">
|
||||||
|
<form th:action="@{/course/create}" method="get">
|
||||||
|
<button type="submit">新規登録</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
</th:block>
|
||||||
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
|
<form th:action="${mode == 'regist'} ? @{/user/register/return}: @{/change}" method="post">
|
||||||
<button type="submit" class="btn btn-primary w-100">確定</button>
|
<button type="submit" class="btn btn-primary w-100">確定</button>
|
||||||
|
|
||||||
<div class="accordion" id="accordionExample">
|
<div class="accordion" id="accordionExample">
|
||||||
<div class="accordion-item" th:each="course:${courseList}">
|
<div class="accordion-item" th:each="course:${courseList}">
|
||||||
<h2 class="accordion-header d-flex align-items-center">
|
<h2 class="accordion-header d-flex align-items-center">
|
||||||
<input type="radio" name="courseId" th:value="${course.courseId}" th:checked="${course.courseId==currentCourseId}" class="form-check-input ms-3 me-2">
|
<input type="radio" name="courseId" th:value="${course.courseId}"
|
||||||
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" th:data-bs-target="'#collapse' + ${course.courseId}" aria-expanded="false" aria-controls="'collapse' + ${course.courseId}">
|
th:checked="${course.courseId==currentCourseId}" class="form-check-input ms-3 me-2">
|
||||||
|
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse"
|
||||||
|
th:data-bs-target="'#collapse' + ${course.courseId}" aria-expanded="false"
|
||||||
|
aria-controls="'collapse' + ${course.courseId}">
|
||||||
<span th:text="${course.courseName}"></span>
|
<span th:text="${course.courseName}"></span>
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</h2>
|
||||||
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse" data-bs-parent="#accordionExample">
|
<div th:id="'collapse' + ${course.courseId}" class="accordion-collapse collapse"
|
||||||
|
data-bs-parent="#accordionExample">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
<span th:text="${course.description}"></span>
|
<span th:text="${course.description}"></span>
|
||||||
<table class="table table-bordered">
|
<table class="table table-bordered">
|
||||||
<tr>
|
<tr>
|
||||||
<th>カテゴリ名</th><th>配分(%)</th>
|
<th>カテゴリ名</th>
|
||||||
|
<th>配分(%)</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr th:each="courseInfo:${courseInfoList}" th:if="${course.courseId == courseInfo.courseId}">
|
<tr th:each="courseInfo:${courseInfoList}"
|
||||||
|
th:if="${course.courseId == courseInfo.courseId}">
|
||||||
<td th:text="${courseInfo.categoryName}"></td>
|
<td th:text="${courseInfo.categoryName}"></td>
|
||||||
<td th:text="${courseInfo.allocationRatio}"></td>
|
<td th:text="${courseInfo.allocationRatio}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<link rel="stylesheet" th:href="@{/css/style.css}">
|
<link rel="stylesheet" th:href="@{/css/style.css}">
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body style="padding-top:80px; padding-bottom:80px;">
|
||||||
|
|
||||||
<div th:replace="~{header :: header}"></div>
|
<div th:replace="~{header :: header}"></div>
|
||||||
<div class="main-container">
|
<div class="main-container">
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
th:field="*{password}"
|
th:field="*{password}"
|
||||||
minlength="8"
|
minlength="8"
|
||||||
maxlength="255"
|
maxlength="24"
|
||||||
required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="password" class="form-label">パスワード</label>
|
<label for="password" class="form-label">パスワード</label>
|
||||||
<input type="password" id="password" class="form-control" name="password" th:value="*{password}" minlength="8"
|
<input type="password" id="password" class="form-control" name="password" th:value="*{password}" minlength="8"
|
||||||
maxlength="255" required readonly>
|
maxlength="24" required readonly>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
class="form-control"
|
class="form-control"
|
||||||
th:value="*{password}"
|
th:value="*{password}"
|
||||||
minlength="8"
|
minlength="8"
|
||||||
maxlength="255"
|
maxlength="24"
|
||||||
required>
|
required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user