diff --git a/doc/basic.md b/doc/basic.md index db4dec9..6442a3f 100644 --- a/doc/basic.md +++ b/doc/basic.md @@ -84,45 +84,119 @@ password=BE56E057F20F883E // 修改密码 "body": { "nutrient": [ { - "key": "vitamin-a", - "measurement": "μgRAE", - "nrv": 1.10, - "value": "维生素A" + "key": "fiber", + "measurement": "g", + "nrv": 25.00, + "value": "膳食纤维" }, { "key": "calcium", "measurement": "mg", - "nrv": 2.20, + "nrv": 800.00, "value": "钙" }, { - "key": "protein", + "key": "vb1", + "measurement": "mg", + "nrv": 1.40, + "value": "维生素B1" + }, + { + "key": "carbs", "measurement": "g", - "nrv": 3.30, - "value": "蛋白质" + "nrv": 300.00, + "value": "碳水化合物" }, { - "key": "energy", - "measurement": "kcal", - "nrv": 5.00, - "value": "能量" + "key": "vb2", + "measurement": "mg", + "nrv": 1.40, + "value": "维生素B2" + }, + { + "key": "va", + "measurement": "μgRAE", + "nrv": 800.00, + "value": "维生素A" + }, + { + "key": "vc", + "measurement": "mg", + "nrv": 100.00, + "value": "维生素C" + }, + { + "key": "protein", + "measurement": "g", + "nrv": 60.00, + "value": "蛋白质" }, { "key": "fat", "measurement": "g", - "nrv": 8.80, + "nrv": 60.00, "value": "脂肪" + }, + { + "key": "iron", + "measurement": "mg", + "nrv": 15.00, + "value": "铁" + }, + { + "key": "zinc", + "measurement": "mg", + "nrv": 15.00, + "value": "锌" + }, + { + "key": "energy", + "measurement": "kcal", + "nrv": 2000.00, + "value": "能量kcal" } ], "category": [ { - "key": "谷薯类", - "value": "谷薯类" + "key": "蛋类", + "value": "蛋类" }, { "key": "大豆类及其制品", "value": "大豆类及其制品" }, + { + "key": "婴幼儿食品", + "value": "婴幼儿食品" + }, + { + "key": "鱼虾类", + "value": "鱼虾类" + }, + { + "key": "畜肉类", + "value": "畜肉类" + }, + { + "key": "坚果", + "value": "坚果" + }, + { + "key": "含酒精饮料", + "value": "含酒精饮料" + }, + { + "key": "调味品", + "value": "调味品" + }, + { + "key": "糖类", + "value": "糖类" + }, + { + "key": "其他", + "value": "其他" + }, { "key": "蔬菜类", "value": "蔬菜类" @@ -132,46 +206,108 @@ password=BE56E057F20F883E // 修改密码 "value": "水果类" }, { - "key": "坚果", - "value": "坚果" + "key": "菌藻类", + "value": "菌藻类" + }, + { + "key": "小吃、甜饼", + "value": "小吃、甜饼" }, { - "key": "畜禽肉类", - "value": "畜禽肉类" + "key": "谷类", + "value": "谷类" + }, + { + "key": "禽肉类", + "value": "禽肉类" }, { "key": "奶及奶制品", "value": "奶及奶制品" }, { - "key": "蛋类", - "value": "蛋类" + "key": "烹调油", + "value": "烹调油" }, { - "key": "鱼虾类", - "value": "鱼虾类" + "key": "速食食品", + "value": "速食食品" }, { - "key": "婴幼儿食品", - "value": "婴幼儿食品" + "key": "薯类", + "value": "薯类" + }, + { + "key": "饮料类", + "value": "饮料类" } ], "mark": [ { - "key": "汤类", - "value": "汤类" + "key": "主荤", + "value": "主荤" }, { - "key": "主食", - "value": "主食" + "key": "水果", + "value": "水果" }, { - "key": "主荤", - "value": "主荤" + "key": "辅食", + "value": "辅食" + }, + { + "key": "糕点", + "value": "糕点" }, { "key": "次荤", "value": "次荤" + }, + { + "key": "主食", + "value": "主食" + }, + { + "key": "面食", + "value": "面食" + }, + { + "key": "素菜", + "value": "素菜" + }, + { + "key": "奶", + "value": "奶" + }, + { + "key": "粥类", + "value": "粥类" + }, + { + "key": "汤类", + "value": "汤类" + }, + { + "key": "饮料类", + "value": "饮料类" + } + ], + "venderType": [ + { + "key": "学校", + "value": "学校" + }, + { + "key": "医院", + "value": "医院" + }, + { + "key": "事业单位", + "value": "事业单位" + }, + { + "key": "其他", + "value": "其他" } ] }, diff --git a/doc/change.md b/doc/change.md index a5ebc51..94beaa0 100644 --- a/doc/change.md +++ b/doc/change.md @@ -21,4 +21,7 @@ 食材接口: mark接口的(PUT, DELETE) ingredient(DELETE)参数名字改了下, 单位接口: vender接口的(GET) 增加keyword参数,并改为分页查询; 增加/api/vender/select(GET), 用于管理端其他部分下来狂选择单位 - +单位接口: 添加和修改增加category字段,代表单位类型, 查询接口select支持批量查询单位信息 +枚举接口: 添加单位类型枚举取值范围 +食材接口: 增加select接口用于批量查询, 增加下载导入模板接口, 增加数据导入接口 +菜品接口: 完善营养标签接口 diff --git a/doc/dish.md b/doc/dish.md index 6079d4a..4285738 100644 --- a/doc/dish.md +++ b/doc/dish.md @@ -102,17 +102,56 @@ id=1 // 两个查询参数二选一 } ``` -# 3. 分析标签(未完成) +# 3. 营养标签 > GET /api/dish/label ### 输入: ``` -id=1 // 传了ID返回单个对象,不传返回所有菜品的标签列表 +ids=1,2,3 // 传了ID返回指定标签,不传返回所有菜品的标签列表 ``` ### 输出: ``` - +{ + "body": [ + { + "component": [ + { + "name": "钙", + "nutrition": "60.00(mg)", + "nvr": "0.00%" + }, + { + "name": "vitamin-a", + "nutrition": "115.00(-)", + "nvr": "-" + }, + { + "name": "蛋白质", + "nutrition": "75.00(g)", + "nvr": "1.00%" + }, + { + "name": "脂肪", + "nutrition": "50.00(g)", + "nvr": "1.00%" + }, + { + "name": "能量kcal", + "nutrition": "50.00(kcal)", + "nvr": "0.00%" + } + ], + "ingredients": [ + "小麦" + ], + "name": "番茄炒鸡蛋" + } + ], + "code": 200, + "desc": "成功", + "success": true +} ``` # 4. 添加菜品 @@ -123,7 +162,7 @@ id=1 // 传了ID返回单个对象,不传返回所有菜品的标签列表 ``` Content-Type:application/x-www-form-urlencoded name=番茄炒鸡蛋 // 必填 名称 -vendors=1,2.3 // 单位列表, 管理端必填,业务端没用 +vendors=1,2,3 // 单位列表, 管理端必填,业务端没用 icon= // 图片 month=1,2,3 //月份 mark=汤类 // 必填 标签 取值参照GET /api/basic/enum 接口中的 mark @@ -148,7 +187,7 @@ ingredient={"011101": 200} // 食材列表 Content-Type:application/x-www-form-urlencoded id=1 // 必填 name=番茄炒鸡蛋 // 必填 名称 -vendors=1,2.3 // 单位列表 +vendors=1,2,3 // 单位列表 icon= // 图片 month=1,2,3 // 月份 mark=汤类 // 标签 取值参照GET /api/basic/enum 接口中的 mark diff --git a/doc/index.md b/doc/index.md index bf882b9..32f5683 100644 --- a/doc/index.md +++ b/doc/index.md @@ -11,6 +11,9 @@ * [基础协议](basic.md) * [用户权限](user.md) * [单位协议](vender.md) +* [食材协议](ingredient.md) +* [营养计划](nutrition.md) +* [菜品协议](dish.md) ``` ### 响应示例 diff --git a/doc/ingredient.md b/doc/ingredient.md index 2111db1..0533fb0 100644 --- a/doc/ingredient.md +++ b/doc/ingredient.md @@ -45,7 +45,31 @@ mark=常用 // 食材标记. 业务端用标记,管理端没用 } ``` -# 2. 添加食材(管理端接口) +# 2. 查询食材(根据ID批量查询) + +> GET /api/ingredient/select + +### 输入: +``` +keys=011101,011102,011103 +``` +### 输出: +``` +{ + "body": [ + { + "key": "011101", + "name": "小麦", + "type": "谷薯类" + } + ], + "code": 200, + "desc": "成功", + "success": true +} +``` + +# 3. 添加食材(管理端接口) > PUT /api/ingredient @@ -68,7 +92,7 @@ nutrient={"fat": 10, "energy": 10, "calcium": 12, "protein": 15, "vitamin-a": 23 } ``` -# 3. 修改食材(管理端接口) +# 4. 修改食材(管理端接口) > POST /api/ingredient @@ -90,7 +114,7 @@ nutrient={"fat": 10, "energy": 10, "calcium": 12, "protein": 15, "vitamin-a": 23 "success": true } ``` -# 4. 删除食材(管理端接口) +# 5. 删除食材(管理端接口) > DELETE /api/ingredient @@ -110,7 +134,7 @@ keys=010101,0101012,0101013 // 必填 } ``` -# 5. 食材打标(业务端接口) +# 6. 食材打标(业务端接口) > PUT /api/ingredient/mark @@ -131,7 +155,7 @@ mark=常用 // 必填, 取值: 常用/忌用 } ``` -# 6. 取消打标(业务端接口) +# 7. 取消打标(业务端接口) > DELETE /api/ingredient/mark @@ -151,22 +175,36 @@ key=010101 // 食材编号 } ``` -# 7. 批量导入(管理端接口, 暂不可用) +# 8. 批量导入(管理端接口) -> PUT /api/ingredient/upload +> PUT http://localhost:9527/api/ingredient/excel ### 输入: ``` -Content-Type: multipart/form-data -files // 必传 +Content-Type: multipart/form-data; boundary=boundary + +--boundary +Content-Disposition: form-data; name="file"; filename="a.xlsx" + +< C:\Users\CCC\Documents\WeChat Files\wxid_40aqnb839lkd12\FileStorage\File\2023-09\谷物及制品.xlsx +--boundary +Content-Disposition: form-data; name="extraInfo"; ``` ### 输出: ``` -{ - "code": 200, - "desc": "成功", - "success": true -} -``` \ No newline at end of file +Content-Disposition: attachment;filename*=utf-8''%5B%E5%AF%BC%E5%85%A5%E7%BB%93%E6%9E%9C%5Da.xlsx +Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8 +Transfer-Encoding: chunked +Date: Sun, 17 Sep 2023 18:49:10 GMT +Keep-Alive: timeout=60 +Connection: keep-alive + +Response file saved. +> [导入结果]a-2.xlsx +``` + +# 9.下载导入模板 + +> GET /api/ingredient/excel \ No newline at end of file diff --git a/doc/nutrition.md b/doc/nutrition.md index 93b0630..e92cc8a 100644 --- a/doc/nutrition.md +++ b/doc/nutrition.md @@ -172,7 +172,7 @@ overflow=0.5 // 必填 溢出 Content-Type:application/x-www-form-urlencoded id=1 // 必填 name=青少年就餐指导 // 名称 -vendors=1,2.3 // 单位列表 +vendors=1,2,3 // 单位列表 overflow=0.5 // 溢出 foodCategoryDay={"水果类": 20, "蔬菜类": 50, "谷薯类": 10, "畜肉禽类": 30} foodCategoryWeek={"水果类": 200, "蔬菜类": 500, "谷薯类": 100, "畜肉禽类": 300} diff --git a/doc/vender.md b/doc/vender.md index 21364bb..6dbb895 100644 --- a/doc/vender.md +++ b/doc/vender.md @@ -79,6 +79,7 @@ Content-Type:application/x-www-form-urlencoded account=ccc // 必填, 初始管理员账号, 不能重复 password=BE56E057F20F883E // 必填, MD5加密后大写取后16位,示例原密码为123456 name=曹 // 必填, 单位名称 +category=学校 // 必填, 单位类型 expire=2019-10-10 // 必填, 过期时间 icon=23423 //单位logo, 前端可用的base64字符串 address= @@ -125,10 +126,10 @@ vender=1 // 必填 ### 输入: ``` Content-Type:application/x-www-form-urlencoded -vender=1 // 必填 +venderId=1 // 必填 expire=2019-10-10 // 仅管理端可以改过期时间 status=false // 仅管理端可以改状态, false-关闭,true-打开 - +category=学校 // 单位类型 account=ccc // 改绑定的主账户, 将自动为改账户赋管理员权限, 不能重复 name=曹 // 改单位名称 icon=23423 //单位logo, 前端可用的base64字符串, 最大好像就几十KB吧,不能太大 @@ -157,6 +158,8 @@ email= ``` keyword=1 // 根据单位名称模糊匹配 +pageSize=20 // 默认20, 全部非必填 +pageNo=0 // 默认0, 从0开始 ``` ### 输出: ``` @@ -198,6 +201,7 @@ keyword=1 // 根据单位名称模糊匹配 ``` keyword=1 // 根据单位名称模糊匹配 +vendors=1,2,3 // 根据ID批量获取单位信息 ``` ### 输出: ``` diff --git a/projects/admin/src/app/pages/organization/organization-list/organization-list.component.ts b/projects/admin/src/app/pages/organization/organization-list/organization-list.component.ts index 62b32b3..0f2e2ae 100644 --- a/projects/admin/src/app/pages/organization/organization-list/organization-list.component.ts +++ b/projects/admin/src/app/pages/organization/organization-list/organization-list.component.ts @@ -77,7 +77,7 @@ export class OrganizationListComponent { } toggleStatus(v: any) { - this.api.saveOrg({ ...v, venderId: v.id, status: !v.status }).subscribe((res) => { + this.api.saveOrg({ category: v.category, id: v.id, venderId: v.id, status: !v.status }).subscribe((res) => { this.msg.success(res.desc); this.tableList.run(); });