|
package com.gavin.controller;
import com.gavin.common.SeparatorContext;
import com.gavin.service.GenSeparator;
import com.gavin.service.impl.BoLangXianSeparator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* Created by 传智播客.黑马程序员.太原校区.苗雄 on 2019\8\30
*/
@RestController
public class DemoV2Controller {
@Autowired
private SeparatorContext separatorContext;
@Resource
private GenSeparator boLangXianSeparator;
@Resource
private GenSeparator greaterThanSeparator;
@Resource
private GenSeparator hengGangSeparator;
@GetMapping("/v2/lunch")
public String haveLunch(){
StringBuilder builder = new StringBuilder();
builder.append("<html>");
//排队
appendStr(builder,getSeparator());
appendStr(builder,"(^o^)开始排队(^o^)");
appendStr(builder,"1只羊");
appendStr(builder,"2只羊");
appendStr(builder,"3只羊");
appendStr(builder,"4只羊");
appendStr(builder,"5只羊");
appendStr(builder,"6只羊");
appendStr(builder,"7只羊");
appendStr(builder,"8只羊");
appendStr(builder,"9只羊");
appendStr(builder,"(-o-)结束排队(-o-)");
//点菜
appendStr(builder,getSeparator());
appendStr(builder,"(^o^)开始点菜(^o^)");
appendStr(builder,"蒸羊羔");
appendStr(builder,"蒸熊掌");
appendStr(builder,"蒸鹿尾儿");
appendStr(builder,"烧花鸭");
appendStr(builder,"烧雏鸡");
appendStr(builder,"烧子鹅");
appendStr(builder,"卤猪");
appendStr(builder,"卤鸭");
appendStr(builder,"酱鸡");
appendStr(builder,"腊肉");
appendStr(builder,"松花");
appendStr(builder,"小肚儿");
appendStr(builder,"(-o-)结束点菜(-o-)");
//取餐
appendStr(builder,getSeparator());
appendStr(builder,"(^o^)开始取餐(^o^)");
appendStr(builder,"一盘蒸羊羔");
appendStr(builder,"一盘蒸熊掌");
appendStr(builder,"一盘蒸鹿尾儿");
appendStr(builder,"一盘烧花鸭");
appendStr(builder,"一盘烧雏鸡");
appendStr(builder,"一盘烧子鹅");
appendStr(builder,"一盘卤猪");
appendStr(builder,"一盘卤鸭");
appendStr(builder,"一盘酱鸡");
appendStr(builder,"一盘腊肉");
appendStr(builder,"一盘松花");
appendStr(builder,"一盘小肚儿");
appendStr(builder,"(-o-)结束取餐(-o-)");
//用餐
appendStr(builder,getSeparator());
appendStr(builder,"(^o^)开始用餐(^o^)");
appendStr(builder,"蒸羊羔好吃");
appendStr(builder,"蒸熊掌好吃");
appendStr(builder,"蒸鹿尾儿好吃");
appendStr(builder,"烧花鸭好吃");
appendStr(builder,"烧雏鸡好吃");
appendStr(builder,"烧子鹅好吃");
appendStr(builder,"卤猪好吃");
appendStr(builder,"卤鸭好吃");
appendStr(builder,"酱鸡好吃");
appendStr(builder,"腊肉好吃");
appendStr(builder,"松花好吃");
appendStr(builder,"小肚儿好吃");
appendStr(builder,"(-o-)结束用餐(-o-)");
appendStr(builder,getSeparator());
builder.append("</html>");
return builder.toString();
}
private String getSeparator(){
//return separatorContext.getSeparator(boLangXianSeparator);
//return separatorContext.getSeparator(hengGangSeparator);
return separatorContext.getSeparator(greaterThanSeparator);
}
private void appendStr(StringBuilder builder,String 啊我额){
builder.append(String.format("%s <br/>",啊我额));
}
}
|