From 75514ecd3d6ed735e55e8dbad7557a7cd83aee40 Mon Sep 17 00:00:00 2001 From: Jaemin Jung <64348852+woals00@users.noreply.github.com> Date: Fri, 27 Jan 2023 15:03:20 +0900 Subject: [PATCH] complete decide_price (#23) --- .../com/noriton/team9/request/ItemCreationRequest.java | 6 ++++-- src/main/java/com/noriton/team9/service/ItemService.java | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/noriton/team9/request/ItemCreationRequest.java b/src/main/java/com/noriton/team9/request/ItemCreationRequest.java index 83a3998..9758ad1 100644 --- a/src/main/java/com/noriton/team9/request/ItemCreationRequest.java +++ b/src/main/java/com/noriton/team9/request/ItemCreationRequest.java @@ -5,8 +5,10 @@ @Data public class ItemCreationRequest { private String name; - private int laborCost; - private int materialCost; + + private int laborCost; // 인건비 + private int materialCost; // 원자재값 + private int circulationCost; // 유통비 private Long sampleId; private int stockQuantity; diff --git a/src/main/java/com/noriton/team9/service/ItemService.java b/src/main/java/com/noriton/team9/service/ItemService.java index 644afbc..ae879a5 100644 --- a/src/main/java/com/noriton/team9/service/ItemService.java +++ b/src/main/java/com/noriton/team9/service/ItemService.java @@ -43,7 +43,9 @@ public Item createItem(ItemCreationRequest item) { } Item itemToCreate = new Item(); BeanUtils.copyProperties(item, itemToCreate); - int totalCost = (item.getLaborCost() + item.getMaterialCost()); + + //가격 측정 + int totalCost = (item.getLaborCost() + item.getMaterialCost() + item.getCirculationCost()) * 2; itemToCreate.setPrice(totalCost); itemToCreate.setCount(0); itemToCreate.setSample(sample.get()); @@ -69,7 +71,9 @@ public Item updateItem(Long itemId, ItemCreationRequest request){ } Item item = getItem.get(); item.setName(request.getName()); - int totalPrice = (request.getLaborCost() + request.getMaterialCost()); + + //가격 측정 + int totalPrice = (request.getLaborCost() + request.getMaterialCost() + request.getCirculationCost()) * 2; item.setPrice(totalPrice); item.setStockQuantity(request.getStockQuantity()); Optional getSample = sampleRepository.findById(request.getSampleId());