Commit b7e54815 authored by lemin's avatar lemin

commit

parent c0eed78e
...@@ -14,31 +14,31 @@ import java.util.Map; ...@@ -14,31 +14,31 @@ import java.util.Map;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@RestController @RestController
@RequestMapping("/api/msa/product") @RequestMapping("/api/msa/wms")
@CrossOrigin(origins = "*") @CrossOrigin(origins = "*")
public class WMSController { public class WMSController {
final InventoryService productService; final InventoryService inventoryService;
public WMSController(InventoryService productService) { public WMSController(InventoryService inventoryService) {
this.productService = productService; this.inventoryService = inventoryService;
} }
@GetMapping("/") @GetMapping("/")
public ResponseEntity<List<InventoryEntity>> getProducts() throws ExecutionException, InterruptedException { public ResponseEntity<List<InventoryEntity>> getProducts() throws ExecutionException, InterruptedException {
List<InventoryEntity> productEntities = productService.getProducts(); List<InventoryEntity> inventoryEntities = inventoryService.getProducts();
return ResponseEntity.ok(productEntities); return ResponseEntity.ok(inventoryEntities);
} }
@PostMapping("/") @PostMapping("/")
public ResponseEntity<Map<String, String>> productCreate(@RequestBody InventoryCreateDto productCreateDto) { public ResponseEntity<Map<String, String>> inventoryCreate(@RequestBody InventoryCreateDto inventoryCreateDto) {
String productId = productService.createProduct(productCreateDto.getName(), String inventoryId = inventoryService.createInventory(inventoryCreateDto.getName(),
productCreateDto.getComment(), inventoryCreateDto.getComment(),
BigDecimal.valueOf(productCreateDto.getPrice())); BigDecimal.valueOf(inventoryCreateDto.getPrice()));
HashMap<String, String> m = new HashMap<>(); HashMap<String, String> m = new HashMap<>();
m.put("productId", productId); m.put("inventoryId", inventoryId);
m.put("productName", productCreateDto.getName()); m.put("productName", inventoryCreateDto.getName());
return ResponseEntity.ok(m); return ResponseEntity.ok(m);
} }
......
...@@ -28,7 +28,7 @@ public class InventoryService { ...@@ -28,7 +28,7 @@ public class InventoryService {
this.queryGateway = queryGateway; this.queryGateway = queryGateway;
} }
public String createProduct(String name, String comment, BigDecimal price) { public String createInventory(String name, String comment, BigDecimal price) {
log.info("[@Service createProduct] new CreateInventoryCommand"); log.info("[@Service createProduct] new CreateInventoryCommand");
// command생성 // command생성
CreateInventoryCommand createProductCommand = new CreateInventoryCommand( CreateInventoryCommand createProductCommand = new CreateInventoryCommand(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment