Commit b7e54815 authored by lemin's avatar lemin

commit

parent c0eed78e
......@@ -14,31 +14,31 @@ import java.util.Map;
import java.util.concurrent.ExecutionException;
@RestController
@RequestMapping("/api/msa/product")
@RequestMapping("/api/msa/wms")
@CrossOrigin(origins = "*")
public class WMSController {
final InventoryService productService;
final InventoryService inventoryService;
public WMSController(InventoryService productService) {
this.productService = productService;
public WMSController(InventoryService inventoryService) {
this.inventoryService = inventoryService;
}
@GetMapping("/")
public ResponseEntity<List<InventoryEntity>> getProducts() throws ExecutionException, InterruptedException {
List<InventoryEntity> productEntities = productService.getProducts();
return ResponseEntity.ok(productEntities);
List<InventoryEntity> inventoryEntities = inventoryService.getProducts();
return ResponseEntity.ok(inventoryEntities);
}
@PostMapping("/")
public ResponseEntity<Map<String, String>> productCreate(@RequestBody InventoryCreateDto productCreateDto) {
String productId = productService.createProduct(productCreateDto.getName(),
productCreateDto.getComment(),
BigDecimal.valueOf(productCreateDto.getPrice()));
public ResponseEntity<Map<String, String>> inventoryCreate(@RequestBody InventoryCreateDto inventoryCreateDto) {
String inventoryId = inventoryService.createInventory(inventoryCreateDto.getName(),
inventoryCreateDto.getComment(),
BigDecimal.valueOf(inventoryCreateDto.getPrice()));
HashMap<String, String> m = new HashMap<>();
m.put("productId", productId);
m.put("productName", productCreateDto.getName());
m.put("inventoryId", inventoryId);
m.put("productName", inventoryCreateDto.getName());
return ResponseEntity.ok(m);
}
......
......@@ -28,7 +28,7 @@ public class InventoryService {
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");
// command생성
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