下单、库存、订单服务~~ 提供接口

master
Administrator 3 years ago
parent 2c4b61f340
commit 62875be373

@ -0,0 +1,32 @@
package com.mashibing.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author zjw
* @description
*/
@RestController
public class PlaceOrderController {
/**
*
* @return
*/
@GetMapping("/po")
public String po(){
//1、调用库存服务扣除商品库存
//2、调用订单服务创建订单
//3、调用优惠券服务预扣除使用的优惠券
//4、调用用户积分服务预扣除用户使用的积分
//5、调用商家服务通知商家用户已下单
return "place order is ok!";
}
}

@ -0,0 +1,23 @@
package com.mashibing.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author zjw
* @description
*/
@RestController
public class ItemStockController {
private static int stock = 10;
@GetMapping("/decr")
public void decr(){
stock--;
if(stock < 0){
throw new RuntimeException("商品库存不足!");
}
System.out.println("扣减库存成功!");
}
}

@ -0,0 +1,18 @@
package com.mashibing.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author zjw
* @description
*/
@RestController
public class OrderManageController {
@GetMapping("create")
public void create(){
System.out.println("创建订单成功!");
}
}
Loading…
Cancel
Save