9 changed files with 208 additions and 0 deletions
@ -0,0 +1,31 @@ |
|||||
|
package com.mathvision.diet.controller; |
||||
|
|
||||
|
import com.mathvision.diet.service.MenuDishService; |
||||
|
import com.mathvision.diet.service.MenuReleaseService; |
||||
|
import org.springframework.stereotype.Controller; |
||||
|
import org.springframework.util.Assert; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMethod; |
||||
|
import org.springframework.web.bind.annotation.RequestParam; |
||||
|
import org.springframework.web.bind.annotation.ResponseBody; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.time.LocalDate; |
||||
|
|
||||
|
@RequestMapping("/api/menu/display") |
||||
|
@Controller |
||||
|
public class MenuDisplayController extends BaseController { |
||||
|
@Resource |
||||
|
MenuDishService menuDishService; |
||||
|
@Resource |
||||
|
MenuReleaseService menuReleaseService; |
||||
|
@ResponseBody |
||||
|
@RequestMapping(method = RequestMethod.GET) |
||||
|
public Object query(@RequestParam(required = false) Long menuId) { |
||||
|
Assert.isTrue(!isAdmin(), "[参数错误] 非管理端操作!"); |
||||
|
if (menuId == null) { |
||||
|
return menuReleaseService.list(getVender()); |
||||
|
} |
||||
|
return menuDishService.query(menuId, getVender(), (long) LocalDate.now().getDayOfWeek().getValue()); |
||||
|
} |
||||
|
} |
@ -0,0 +1,78 @@ |
|||||
|
<h1>大屏展示</h1> |
||||
|
<h1>1. 查询今日食谱列表(大屏显示)</h1> |
||||
|
<blockquote> |
||||
|
<p>GET /api/menu/display</p> |
||||
|
</blockquote> |
||||
|
<h3>输出:</h3> |
||||
|
<pre><code class="json">{ |
||||
|
"body": [ |
||||
|
{"id": 1, "name": "食谱名字"} |
||||
|
], |
||||
|
"code": 200, |
||||
|
"desc": "成功", |
||||
|
"success": true |
||||
|
} |
||||
|
</code></pre> |
||||
|
<h1>2. 查询今日带量菜品(大屏显示)</h1> |
||||
|
<blockquote> |
||||
|
<p>GET /api/menu/display?menuId=1</p> |
||||
|
</blockquote> |
||||
|
<h3>输出:</h3> |
||||
|
<pre><code class="json">{ |
||||
|
"body": [ |
||||
|
{ |
||||
|
"day": 1, |
||||
|
"dish": 1, |
||||
|
"id": 1, |
||||
|
"ingredient": [ |
||||
|
{ |
||||
|
"isMain": true, |
||||
|
"key": "011101", |
||||
|
"value": { |
||||
|
"轻体力": 500, |
||||
|
"重体力": 300 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"isMain": false, |
||||
|
"key": "2101001", |
||||
|
"value": { |
||||
|
"轻体力": 500, |
||||
|
"重体力": 300 |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
"marks": "主食", |
||||
|
"poly": "蒸", |
||||
|
"meal": "早餐", |
||||
|
"menu": 1, |
||||
|
"name": "番茄炒蛋", |
||||
|
"vender": 1 |
||||
|
}, |
||||
|
{ |
||||
|
"day": 1, |
||||
|
"dish": 2, |
||||
|
"id": 3, |
||||
|
"ingredient": [ |
||||
|
{ |
||||
|
"isMain": true, |
||||
|
"key": "011101", |
||||
|
"value": { |
||||
|
"轻体力": 500, |
||||
|
"重体力": 300 |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
"marks": "主食", |
||||
|
"poly": "蒸", |
||||
|
"meal": "早餐", |
||||
|
"menu": 1, |
||||
|
"name": "番茄炒鸡蛋", |
||||
|
"vender": 1 |
||||
|
} |
||||
|
], |
||||
|
"code": 200, |
||||
|
"desc": "成功", |
||||
|
"success": true |
||||
|
}</code></pre> |
||||
|
|
@ -0,0 +1,81 @@ |
|||||
|
# 大屏展示 |
||||
|
|
||||
|
# 1. 查询今日食谱列表(大屏显示) |
||||
|
|
||||
|
> GET /api/menu/display |
||||
|
|
||||
|
### 输出: |
||||
|
~~~json |
||||
|
{ |
||||
|
"body": [ |
||||
|
{"id": 1, "name": "食谱名字"} |
||||
|
], |
||||
|
"code": 200, |
||||
|
"desc": "成功", |
||||
|
"success": true |
||||
|
} |
||||
|
~~~ |
||||
|
|
||||
|
# 2. 查询今日带量菜品(大屏显示) |
||||
|
|
||||
|
> GET /api/menu/display?menuId=1 |
||||
|
|
||||
|
### 输出: |
||||
|
~~~json |
||||
|
{ |
||||
|
"body": [ |
||||
|
{ |
||||
|
"day": 1, |
||||
|
"dish": 1, |
||||
|
"id": 1, |
||||
|
"ingredient": [ |
||||
|
{ |
||||
|
"isMain": true, |
||||
|
"key": "011101", |
||||
|
"value": { |
||||
|
"轻体力": 500, |
||||
|
"重体力": 300 |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
"isMain": false, |
||||
|
"key": "2101001", |
||||
|
"value": { |
||||
|
"轻体力": 500, |
||||
|
"重体力": 300 |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
"marks": "主食", |
||||
|
"poly": "蒸", |
||||
|
"meal": "早餐", |
||||
|
"menu": 1, |
||||
|
"name": "番茄炒蛋", |
||||
|
"vender": 1 |
||||
|
}, |
||||
|
{ |
||||
|
"day": 1, |
||||
|
"dish": 2, |
||||
|
"id": 3, |
||||
|
"ingredient": [ |
||||
|
{ |
||||
|
"isMain": true, |
||||
|
"key": "011101", |
||||
|
"value": { |
||||
|
"轻体力": 500, |
||||
|
"重体力": 300 |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
"marks": "主食", |
||||
|
"poly": "蒸", |
||||
|
"meal": "早餐", |
||||
|
"menu": 1, |
||||
|
"name": "番茄炒鸡蛋", |
||||
|
"vender": 1 |
||||
|
} |
||||
|
], |
||||
|
"code": 200, |
||||
|
"desc": "成功", |
||||
|
"success": true |
||||
|
} |
Loading…
Reference in new issue