[FIX]プッシュエラーのため、コミットリセット

This commit is contained in:
2026-09-18 09:46:13 +09:00
parent 4e3477af77
commit e40c64c2a9
9 changed files with 118 additions and 27 deletions

View File

@@ -33,7 +33,9 @@ public class AnalysisServiceImpl implements AnalysisService {
public AnalysisModel getAnalysis(Long userId) {
// ユーザー情報取得、月別使用可能資金取得
UserEntity userEntity = userRepository.findById(userId).orElseThrow();
UserEntity userEntity = userRepository.findById(userId).orElseThrow(() ->
new RuntimeException(
"User not found."));
// コースID取得
Long courseId = userEntity.getCourseEntity().getCourseId();

View File

@@ -8,7 +8,6 @@ import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.OneToMany;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import com.example.demo.app.domain.model.CourseModel;
@@ -39,10 +38,6 @@ public class CourseEntity {
@OneToMany(mappedBy = "courseEntity")
private List<UserEntity> userEntity;
@OneToOne(mappedBy = "courseEntity")
private AllocationEntity allocationEntity;
public static List<CourseModel> createCourseModelList(List<CourseEntity> courseEntityList) {
return courseEntityList

View File

@@ -0,0 +1,11 @@
package com.example.demo.app.infra.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.example.demo.app.infra.entity.GoalEntity;
@Repository
public interface GoalRepository extends JpaRepository<GoalEntity, Long> {
}

View File

@@ -16,5 +16,6 @@ public interface UserRepository extends JpaRepository<UserEntity, Long> {
String mailAddress,
String password);
Optional<UserEntity> findByMailAddress(String mailAddress);
}

View File

@@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import com.example.demo.app.domain.model.AnalysisModel;
import com.example.demo.app.domain.model.LoginModel;
import com.example.demo.app.domain.service.AnalysisService;
import com.example.demo.app.presentation.form.AnalysisForm;
import lombok.RequiredArgsConstructor;

View File

@@ -0,0 +1,52 @@
package com.example.demo.app.presentation.controller;
import java.util.logging.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import com.example.demo.app.domain.service.CourseInfoService;
import com.example.demo.app.domain.service.CourseService;
import com.example.demo.app.presentation.form.CourseForm;
import com.example.demo.app.presentation.form.CourseInfoForm;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class CourseController {
private final static Logger LOGGER = Logger.getLogger(CourseController.class.getName());
// エラーメッセージ用の定数フィールド
private final static String SEVERE_ERROR_MESSAGE = "エラーが発生しました!";
// private final HttpSession httpSession;
private final CourseService courseService;
private final CourseInfoService courseInfoService;
@GetMapping("/select-course")
public String select(Model model) {
//try {
model.addAttribute("courseList", CourseForm.convertFrom(courseService.findAll()));
model.addAttribute("courseInfoList", CourseInfoForm.convertFrom(courseInfoService.findAll()));
return "select_course";
//} catch (Exception e) {
// // ログイン情報の破棄
// httpSession.invalidate();
//
// e.printStackTrace();
//
// // エラーログ出力
// LOGGER.log(Level.SEVERE, SEVERE_ERROR_MESSAGE, e);
// // エラー画面遷移
// return null;
// }
}
}

View File

@@ -12,7 +12,7 @@
<table class="table text-center">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">カテゴリ別</th>
<th scope="col">支出</th>
<th scope="col">前月比</th>
</tr>
@@ -24,8 +24,8 @@
0
</td>
<td th:text="${analysisForm.totalDifferenceAmount >= 0}
? '+' + ${analysisForm.totalDifferenceAmount}
: '-' + ${analysisForm.totalDifferenceAmount}"
? '+' + ${analysisForm.totalDifferenceAmount}
: ${analysisForm.totalDifferenceAmount}"
th:class="${analysisForm.totalDifferenceAmount >= 0}
? 'color-danger;'
: 'color-primary;'">
@@ -42,11 +42,7 @@
<tr>
<th scope="col">カテゴリ別</th>
<th scope="col">支出</th>
<th scope="col">
前月比
<br>
コース比
</th>
<th scope="col">前月比<br>コース比</th>
</tr>
</thead>
<tbody>
@@ -63,16 +59,16 @@
<td>
<span th:text="${category.monthDifferenceAmount >= 0}
? '+' + ${category.monthDifferenceAmount}
: '-' + ${category.monthDifferenceAmount}"
? '+' + ${category.monthDifferenceAmount}
: ${category.monthDifferenceAmount}"
th:class="${category.monthDifferenceAmount >= 0}
? 'color-danger;'
: 'color-primary;'">
</span>
<br>
<span th:text="${category.courseDifferenceAmount >= 0}
? '+' + ${category.courseDifferenceAmount}
: '-' + ${category.courseDifferenceAmount}"
? '+' + ${category.courseDifferenceAmount}
: ${category.courseDifferenceAmount}"
th:class="${category.courseDifferenceAmount >= 0}
? 'color-danger;'
: 'color-primary;'">

View File

@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>コース選択</title>
</head>
<body>
<div class="accordion" id="accordionExample">
<div class="accordion-item" th:each="course:${courseList}">
<h2 class="accordion-header">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
<span th:text="${course.courseName}"></span>
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse show" data-bs-parent="#accordionExample">
<div class="accordion-body">
<span th:text="${course.description}"></span>
<table border="1">
<tr>
<th>カテゴリ名</th><tr>配分(%)</tr>
</tr>
<tr th:each="courseInfo:${courseInfoList}" th:if="course.courseId == courseInfo.courseId">
<td th:text="${courseInfo.categoryName}"></td>
<td th:text="${courseInfo.allocationRatio}"></td>
</tr>
</table>
</div>
</div>
</div>
</div>
</body>
</html>