spring in action 使用Spring Web Flow 构建定披萨流程

定披萨流程


spring in action 使用Spring Web Flow 构建定披萨流程_第1张图片
image.png


  
  
    
    
  
  
    
    
  
  
    
    
  
  
    
    
  
  
    
  
  
  
    
  

Order 带有披萨订单的所有细节信息

package com.springination.pizza.domain;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Order implements Serializable{
    private static final long serialVersionUID = 1L;
    private Customer customer;
    private List pizzas;
    private Payment payment;
    public Order(){
        pizzas = new ArrayList();
        customer = new Customer();
    }
    public Customer getCustomer(){
        return customer;
    }
    public void setCustomer(Customer customer){
        this.customer = customer;
    }
    public List getPizzas(){
        return pizzas;
    }
    public void setPizzas(List pizzas){
        this.pizzas = pizzas;
    }
    public void addPizza(Pizza pizza){
        pizzas.add(pizza);
    }
    public float getTotal(){
        return 0.0f;
    }
    public Payment getPayment(){
        return payment;
    }
    public void setPayment(Payment payment){
        this.payment = payment;
    }
}

identifyCustomer状态



...

感谢客户流程


  
  
  Spizza>
  
    

Thank you for your order!

Finish ]]>

识别客户


spring in action 使用Spring Web Flow 构建定披萨流程_第2张图片
image.png

 
    
    
        
    
    
        
        
        
    
    
      
        
      
      
    
    
        
    
    
        
    
    
        
        
    
    
    
        
    
    
      
    


  
  
  Spizza>
  
    

Thank you for your order!

Finish ]]> 欢迎并询问电话号码 Spizza

Welcome to Spizza!!!


注册新客户


  
  

    Spizza


  

Customer Registration

Phone Number:
Name:
Address:
City:
State:
Zip Code:

判断配送地址 告知客户能不能送披萨


    
    
    Spizza
    
        

Delivery Unavailable

The address is outside of our delivery area. You may still place the order. but you will need to pick it up yourself.

Continue,I'll pick up the order | Never mind ]]>
spring in action 使用Spring Web Flow 构建定披萨流程_第3张图片
image.png

订单和添加披萨



    
    
    
        
        
        
    
    
        
        
        
        
        
            
        
    
    

实现添加披萨到订单中

Create Pizza

Size:





Toppings:


支付流程


spring in action 使用Spring Web Flow 构建定披萨流程_第4张图片
image.png


    
    
        
            
            
        
        
        
    
    
        
        
    
    
    
 

支付的枚举类型

import static org.apache.commons.lang.WordUtils.*;
import java.util.List;
import java.util.Arrays;
public enum PaymentType {
    CASH,CHECK,CREDIT_CARD;
    public static List asList(){
        PaymentType[] all = PaymentType.values();
        return Arrays.asList(all);
    }
    @Override
    public String toString(){
        return capitalizeFully(name().replace('_',' '));
    }
}

如果感兴趣,请关注我的微信公众号:

spring in action 使用Spring Web Flow 构建定披萨流程_第5张图片
Capture.PNG

你可能感兴趣的:(spring in action 使用Spring Web Flow 构建定披萨流程)