Compare commits
10 Commits
d71194659b
...
702dd24d2e
| Author | SHA1 | Date | |
|---|---|---|---|
| 702dd24d2e | |||
| f685b10d01 | |||
| 7e91071379 | |||
| abe5573c88 | |||
| 46fd6ee60c | |||
| e40c64c2a9 | |||
| 05dbbb4053 | |||
| aa2a511d2b | |||
| 6d494e1ac1 | |||
| 1c61909a48 |
@@ -24,15 +24,15 @@ public class AnalysisController {
|
||||
public String showAnalysis(Model model, HttpSession session) {
|
||||
|
||||
//ログインユーザーの取得(セッション)
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
|
||||
LoginModel loginUser = (LoginModel) session.getAttribute("loginUser");
|
||||
|
||||
//分析結果の取得(Service)
|
||||
AnalysisModel analysisModel = analysisService.getAnalysis(loginUser.getUserId());
|
||||
|
||||
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
|
||||
|
||||
AnalysisModel analysisModel = analysisService.getAnalysis(loginUser.getUserId());
|
||||
|
||||
AnalysisForm analysisForm = AnalysisForm.convertFrom(analysisModel);
|
||||
|
||||
//model格納
|
||||
model.addAttribute("analysisForm", analysisForm);
|
||||
model.addAttribute("analysisForm", analysisForm);
|
||||
|
||||
return "analysis";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.example.demo.app.presentation.form;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.example.demo.app.domain.model.AnalysisModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class AnalysisForm {
|
||||
|
||||
private Integer currentMonthTotalAmount;
|
||||
|
||||
private Integer previousMonthTotalAmount;
|
||||
|
||||
private Integer totalDifferenceAmount;
|
||||
|
||||
private List<CategoryAnalysisForm>
|
||||
categoryAnalysisFormList;
|
||||
|
||||
public static AnalysisForm convertFrom(
|
||||
AnalysisModel analysisModel) {
|
||||
|
||||
return new AnalysisForm(
|
||||
analysisModel.getCurrentMonthTotalAmount(),
|
||||
analysisModel.getPreviousMonthTotalAmount(),
|
||||
analysisModel.getTotalDifferenceAmount(),
|
||||
CategoryAnalysisForm.convertFrom(
|
||||
analysisModel.getCategoryAnalysisModelList()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.example.demo.app.presentation.form;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.example.demo.app.domain.model.CategoryAnalysisModel;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class CategoryAnalysisForm {
|
||||
|
||||
private String categoryName;
|
||||
|
||||
private Integer currentMonthAmount;
|
||||
|
||||
private Integer previousMonthAmount;
|
||||
|
||||
private Integer monthDifferenceAmount;
|
||||
|
||||
private Integer courseLimitAmount;
|
||||
|
||||
private Integer courseDifferenceAmount;
|
||||
|
||||
public static CategoryAnalysisForm convertFrom(
|
||||
CategoryAnalysisModel categoryAnalysisModel) {
|
||||
|
||||
return new CategoryAnalysisForm(
|
||||
categoryAnalysisModel.getCategoryName(),
|
||||
categoryAnalysisModel.getCurrentMonthAmount(),
|
||||
categoryAnalysisModel.getPreviousMonthAmount(),
|
||||
categoryAnalysisModel.getMonthDifferenceAmount(),
|
||||
categoryAnalysisModel.getCourseLimitAmount(),
|
||||
categoryAnalysisModel.getCourseDifferenceAmount());
|
||||
}
|
||||
|
||||
public static List<CategoryAnalysisForm> convertFrom(
|
||||
List<CategoryAnalysisModel> categoryAnalysisModelList) {
|
||||
|
||||
return categoryAnalysisModelList.stream()
|
||||
.map(CategoryAnalysisForm::convertFrom)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ja"xmlns:th="http://www.thymeleaf.org">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>新規会員登録確認</title>
|
||||
|
||||
Reference in New Issue
Block a user