[EDIT] ショートカット機能を適用しました。
This commit is contained in:
@@ -20,11 +20,13 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import com.example.demo.aop.aspect.SessionCheck;
|
||||
import com.example.demo.app.domain.model.LoginModel;
|
||||
import com.example.demo.app.domain.service.CategoryService;
|
||||
import com.example.demo.app.domain.service.FixedCostService;
|
||||
import com.example.demo.app.domain.service.GoalService;
|
||||
import com.example.demo.app.domain.service.TransactionService;
|
||||
import com.example.demo.app.domain.service.UserService;
|
||||
import com.example.demo.app.presentation.form.CategoryForm;
|
||||
import com.example.demo.app.presentation.form.Expense;
|
||||
import com.example.demo.app.presentation.form.FixedCostForm;
|
||||
import com.example.demo.app.presentation.form.GoalForm;
|
||||
import com.example.demo.app.presentation.form.Income;
|
||||
import com.example.demo.app.presentation.form.TransactionForm;
|
||||
@@ -40,6 +42,7 @@ public class TransactionController {
|
||||
private final CategoryService categoryService;
|
||||
private final GoalService goalService;
|
||||
private final UserService userService;
|
||||
private final FixedCostService fixedCostService;
|
||||
|
||||
// 一覧画面
|
||||
@SessionCheck
|
||||
@@ -182,16 +185,23 @@ public class TransactionController {
|
||||
@SessionCheck
|
||||
@GetMapping("/transaction/create")
|
||||
public String createOneGet(@RequestParam(defaultValue = "") LocalDate today,
|
||||
Long fixedCostId,
|
||||
Model model) {
|
||||
|
||||
if (today == null) {
|
||||
today = LocalDate.now();
|
||||
}
|
||||
TransactionForm transactionForm = new TransactionForm();
|
||||
transactionForm.setTransactionDate(today);
|
||||
if (fixedCostId != null) {
|
||||
FixedCostForm fixedCostForm = FixedCostForm.convertFrom(fixedCostService.findById(fixedCostId));
|
||||
transactionForm.setCategoryId(fixedCostForm.getCategoryId());
|
||||
transactionForm.setAmount(fixedCostForm.getAmount());
|
||||
transactionForm.setTransactionType(CategoryForm.convertFrom(categoryService.findOne(fixedCostForm.getCategoryId())).getTransactionType());
|
||||
}
|
||||
|
||||
List<CategoryForm> categoryFormList = CategoryForm.convertFrom(categoryService.findAll());
|
||||
|
||||
TransactionForm transactionForm = new TransactionForm();
|
||||
transactionForm.setTransactionDate(today);
|
||||
|
||||
System.out.println(transactionForm.getCategoryName() + " " + transactionForm.getAmount());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user