import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.StringTokenizer;
/**
* @author the Great Ke
*
*/
public class InternetFoodOrderSystem {
private static BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
private static PrintWriter stdOut = new PrintWriter(System.out, true);
private static PrintWriter stdErr = new PrintWriter(System.err, true);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
private ShopList shopList = new ShopList();
private OrderRecordList orderRecordList = new OrderRecordList();
private List<Customer> customersList = new ArrayList<Customer>();
/**
* @param args
*/
/**
* @throws ParseException
*
*/
public InternetFoodOrderSystem() throws ParseException {
loadSaleInformations();
// TODO Auto-generated constructor stub
}
public void loadSaleInformations() throws ParseException { // 增加一个customers 的 list 用来容纳。 3个
Customer customer001 = new Customer("Lucy", "2017303067", "15983981356", "NWPU", "626202 3788887657768");
Customer customer002 = new Customer("Tom", "2017303020", "13883989034", "NWPU", "622267 3788887657768");
Customer customer003 = new Customer("Mark", "2017303019", "17783988075", "NWPU", "454452 7788887657798");
Shop shop001 = new Shop("兰州拉面馆", "0001");
Shop shop002 = new Shop("海底捞火锅全国连锁店", "0002");
Shop shop003 = new Shop("西工大云天苑餐厅", "0003");
Shop shop004 = new Shop("西工大南餐", "0004");
Shop shop005 = new Shop("KFC快餐店", "0005");
Shop shop006 = new Shop("Mcdonalds快餐店", "0006");
Shop shop007 = new Shop("川川川菜馆", "0007");
Shop shop008 = new Shop("骨汤砂锅饭店", "0008");
shopList.add(shop001);
shopList.add(shop002);
shopList.add(shop003);
shopList.add(shop004);
shopList.add(shop005);
shopList.add(shop006);
shopList.add(shop007);
shopList.add(shop008);
shop001.getFoodList().add(new Food("01", "牛肉面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:这个牛肉面挺好吃的,就是里面的牛肉太少了。。"));
shop001.getFoodList().add(new Food("02", "肥肠面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:面挺好吃的,就是里面的肥肠太少了。。"));
shop002.getFoodList()
.add(new Food("03", "微辣火锅", "火锅(英语:Hot Pot),古称“古董羹”,因食物投入沸水时发出的“咕咚”声而得名,它是中国独创的美食,历史悠久,是一种老少皆宜的食物。",
simpleDateFormat.parse("2018-09-21"), 200, 12, "评论:这个火锅挺好吃的,就是里面的肉太少了。。"));
shop002.getFoodList()
.add(new Food("04", "鸳鸯锅", "火锅(英语:Hot Pot),古称“古董羹”,因食物投入沸水时发出的“咕咚”声而得名,它是中国独创的美食,历史悠久,是一种老少皆宜的食物。",
simpleDateFormat.parse("2018-09-21"), 200, 12, "评论:这个火锅挺好吃的,就是里面的肉太少了。。。"));
shop003.getFoodList().add(new Food("05", "云天苑定制牛肉面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:这个牛肉面挺好吃的,就是里面的牛肉太少了。。"));
shop003.getFoodList().add(new Food("06", "云天苑定制肥肠面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:面挺好吃的,就是里面的肥肠太少了。。"));
shop004.getFoodList().add(new Food("07", "西工大牛肉面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:这个牛肉面挺好吃的,就是里面的牛肉太少了。。"));
shop004.getFoodList().add(new Food("08", "西工大肥肠面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:面挺好吃的,就是里面的肥肠太少了。。"));
shop005.getFoodList().add(new Food("07", "KFC牛肉面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:这个牛肉面挺好吃的,就是里面的牛肉太少了。。"));
shop005.getFoodList().add(new Food("08", "KFC肥肠面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:面挺好吃的,就是里面的肥肠太少了。。"));
shop006.getFoodList().add(new Food("07", "Mcdonalds牛肉面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200,
12, "评论:这个牛肉面挺好吃的,就是里面的牛肉太少了。。"));
shop006.getFoodList().add(new Food("08", "Mcdonalds肥肠面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200,
12, "评论:面挺好吃的,就是里面的肥肠太少了。。"));
shop007.getFoodList().add(new Food("09", "川味牛肉面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:这个牛肉面挺好吃的,就是里面的牛肉太少了。。"));
shop007.getFoodList().add(new Food("10", "川味肥肠面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:面挺好吃的,就是里面的肥肠太少了。。"));
shop008.getFoodList().add(new Food("11", "牛肉砂锅", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:这个砂锅挺好吃的,就是里面的牛肉太少了。。"));
shop008.getFoodList().add(new Food("12", "肥肠砂锅", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:砂锅挺好吃的,就是里面的肥肠太少了。。"));
customer001.getShopList().add(shop001);
customer001.getShopList().add(shop002);
customer002.getShopList().add(shop003);
customer002.getShopList().add(shop004);
customer003.getShopList().add(shop005);
customer003.getShopList().add(shop006);
customer003.getShopList().add(shop007);
customer003.getShopList().add(shop008);
customersList.add(customer001);
customersList.add(customer002);
customersList.add(customer003);
DeliveryMan deliveryMan001 = new DeliveryMan("老王", "0001", "1234567890", "饿了么西工大骑手店", 2, "633203 666738877389");
OrderRecord orderRecord001 = new OrderRecord("0001",
new Food("05", "云天苑定制牛肉面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:这个牛肉面挺好吃的,就是里面的牛肉太少了。。"),
customer001, deliveryMan001, simpleDateFormat.parse("2017-09-21"));
OrderRecord orderRecord002 = new OrderRecord("0002",
new Food("03", "微辣火锅", "火锅(英语:Hot Pot),古称“古董羹”,因食物投入沸水时发出的“咕咚”声而得名,它是中国独创的美食,历史悠久,是一种老少皆宜的食物。",
simpleDateFormat.parse("2018-09-21"), 200, 12, "评论:这个火锅挺好吃的,就是里面的肉太少了。。"),
customer002, deliveryMan001, simpleDateFormat.parse("2017-09-23"));
OrderRecord orderRecord003 = new OrderRecord("0003",
new Food("07", "Mcdonalds牛肉面", "老少皆宜的美味", simpleDateFormat.parse("2017-09-21"), 200, 12,
"评论:这个牛肉面挺好吃的,就是里面的牛肉太少了。。"),
customer003, deliveryMan001, simpleDateFormat.parse("2017-09-13"));
orderRecordList.add(orderRecord001);
orderRecordList.add(orderRecord002);
orderRecordList.add(orderRecord003);
}
public static void main(String[] args) throws Exception {
InternetFoodOrderSystem internetFoodOrderSystem = new InternetFoodOrderSystem();
try {
internetFoodOrderSystem.run();
} catch (IOException e) {
e.printStackTrace();
}
}
public void displayShopList() {
for (Shop shop : shopList) {
System.out.println("--------------------restaurant----------------------\n" + shop.toString());
}
}
public void displayShopList(String customerName) {
for (Customer customer : customersList) {
if (customerName.equals(customer.getName())) {
stdOut.println("\nHere are the restaurants close to " + customerName);
stdOut.println(
"--------------------restaurants----------------------\n" + customer.getShopList().toString());
return;
}
}
stdErr.println("sorry, customer not found !");
}
public void displayCustomers() {
for (Customer customer : customersList) {
stdOut.println("--------------------customer----------------------\n" + customer.toString());
}
}
public void displayFoodList(String shopIdCode) throws Exception {
if