OrderStockHandler.java 348 B

1234567891011121314
  1. package responsibilityPattern.handler;
  2. import responsibilityPattern.entity.Order;
  3. public class OrderStockHandler extends OrderHandler {
  4. @Override
  5. boolean proceed(Order order) throws Exception {
  6. //检查库存
  7. if(order.getStock()<1){
  8. throw new Exception("库存不足");
  9. }
  10. return true;
  11. }
  12. }