Skip to content

Commit

Permalink
complete decide_price (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
woals00 authored Jan 27, 2023
1 parent 97458a8 commit 75514ec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/com/noriton/team9/service/ItemService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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<Sample> getSample = sampleRepository.findById(request.getSampleId());
Expand Down

0 comments on commit 75514ec

Please sign in to comment.