5 Commits

5 changed files with 92 additions and 22 deletions

View File

@@ -0,0 +1,14 @@
package com.example.demo.app.domain.model;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public class CategoryModel {
private Long categoryId;
private String categoryName;
private Integer transactionType;
}

View File

@@ -0,0 +1,9 @@
package com.example.demo.app.domain.service;
import com.example.demo.app.domain.model.AnalysisModel;
public interface AnalysisService {
AnalysisModel getAnalysis(Long userId);
}

View File

@@ -0,0 +1,39 @@
package com.example.demo.app.domain.service;
import org.springframework.stereotype.Service;
import com.example.demo.app.domain.model.AnalysisModel;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class AnalysisServiceImpl implements AnalysisService {
//Repositoryの呼び出し
// private final TransactionRepository transactionRepository;
// private final AllocationRepository allocationRepository;
// private final UserRepository userRepository;
// private final CategoryRepository categoryRepository;
@Override
public AnalysisModel getAnalysis(Long userId) {
// ユーザー情報取得、月別使用可能資金取得
// 今月の期間取得
// 前月の期間取得
// 今月の支出取得
// 前月の支出取得
// コース配分取得
// カテゴリ別集計
// 前月との差額集計
//総支出算出
// コース限度額算出、コース別差額算出
// CategoryAnalysisModel生成
// AnalysisModelの生成
return null;
}
}

View File

@@ -1,22 +0,0 @@
package com.example.demo.app.infra.repository;
import java.time.LocalDate;
import java.util.List;
import com.example.demo.app.infra.entity.AllocationEntity;
import com.example.demo.app.infra.entity.TransactionEntity;
import com.example.demo.app.infra.entity.UserEntity;
public interface AnalysisRepository {
List<TransactionEntity> findExpenseByPeriod(
Integer userId,
LocalDate startDate,
LocalDate endDate);
List<AllocationEntity> findAllocationByCourseId(
Integer courseId);
UserEntity findUserByUserId(
Integer userId);
}

View File

@@ -0,0 +1,30 @@
package com.example.demo.app.presentation.controller;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import com.example.demo.app.domain.service.AnalysisService;
import lombok.RequiredArgsConstructor;
@Controller
@RequiredArgsConstructor
public class AnalysisController {
private final AnalysisService analysisService;
@GetMapping("/analysis")
public String showAnalysis(Model model) {
//ログインユーザーの取得(セッション)
//分析結果の取得(Service)
//model格納
return "analysis";
}
}