From 51a9c5c79879fa0acc463f0dea6ff99a6a918495 Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Wed, 24 Mar 2021 17:16:49 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=BD=93=E5=A4=A9?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/recipesBuild/InfoView/index.vue | 5 - .../custom/recipesShow/MenuDetail/index.vue | 49 ++++++++- .../PlanDrawer/ShoppingPlanDrawer/index.vue | 103 +++++++++--------- 3 files changed, 96 insertions(+), 61 deletions(-) diff --git a/stdiet-ui/src/views/custom/recipesBuild/InfoView/index.vue b/stdiet-ui/src/views/custom/recipesBuild/InfoView/index.vue index 894a09f20..4374dfe21 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/InfoView/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/InfoView/index.vue @@ -68,11 +68,6 @@ export default { ]), ...mapGetters(["analyseData"]), }, - watch: { - healthyData(val) { - console.log({ val }); - }, - }, methods: { handleOnTabClick(tab) { this.activeName = tab.name; diff --git a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue index 726dfd36d..7d3f35f54 100644 --- a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue +++ b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue @@ -3,7 +3,16 @@
- logo + +
@@ -34,6 +43,8 @@ + + @@ -106,8 +130,27 @@ export default { .menu_detail_wrapper { padding: 0 12px 12px 12px; .top { - text-align: center; - padding: 10px 14px; + height: 50px; + position: relative; + .logo { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + } + + .shopping_cart { + position: absolute; + right: 5px; + top: 10px; + display: flex; + align-items: center; + &::after { + margin-left: 2px; + content: "采购"; + font-size: 12px; + } + } } .header_style { diff --git a/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/ShoppingPlanDrawer/index.vue b/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/ShoppingPlanDrawer/index.vue index 0134ba2e0..83b27cf0f 100644 --- a/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/ShoppingPlanDrawer/index.vue +++ b/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/ShoppingPlanDrawer/index.vue @@ -74,17 +74,19 @@ export default { }; }, methods: { - showDrawer(data) { - // console.log(data); - const { recipesId, num, label } = data; + showDrawer(obj) { + const { recipesId, num, label, data } = obj; + console.log(obj); this.label = label; // num < 0 全部计算 this.title = `${ num === 3 ? "前3" : num === 4 ? "后4" : Math.abs(num) }天采购计划`; this.visible = true; - if (this.recipes[recipesId]) { - this.processShoppingCart(num, recipesId); + if (data) { + this.processShoppingCart(num, data); + } else if (this.recipes[recipesId]) { + this.processShoppingCart(num, this.recipes[recipesId]); } else { this.loading = true; this.fetchFullRecipes({ @@ -92,61 +94,56 @@ export default { }).then(() => { this.loading = false; setTimeout(() => { - this.processShoppingCart(num, recipesId); + this.processShoppingCart(num, this.recipes[recipesId]); }, 0); }); } }, - processShoppingCart(num, recipesId) { - this.shoppingCart = (this.recipes[recipesId] || []).reduce( - (obj, cur, idx) => { - if ( - num < 0 || // 全部计算 - num === 7 || - (num === 3 && num > idx) || - (num === 4 && idx > 2) - ) { - cur.dishes.forEach((dObj) => { - dObj.igdList.forEach((iObj) => { - const tarTypeName = this.idgTypeDict[iObj.type]; - const tarObj = obj[tarTypeName]; - if (tarObj) { - const tarIObj = tarObj.find( - (zObj) => zObj.name === iObj.name - ); - if (tarIObj) { - tarIObj.weight += this.igdUnitDict[iObj.name] - ? iObj.cusWeight - : iObj.weight; - } else { - tarObj.push({ - type: iObj.type, - name: iObj.name, - weight: this.igdUnitDict[iObj.name] - ? iObj.cusWeight - : iObj.weight, - unit: this.igdUnitDict[iObj.name] || "g", - }); - } + processShoppingCart(num, data = []) { + this.shoppingCart = data.reduce((obj, cur, idx) => { + if ( + num < 0 || // 全部计算 + num === 7 || + (num === 3 && num > idx) || + (num === 4 && idx > 2) + ) { + cur.dishes.forEach((dObj) => { + dObj.igdList.forEach((iObj) => { + const tarTypeName = this.idgTypeDict[iObj.type]; + const tarObj = obj[tarTypeName]; + if (tarObj) { + const tarIObj = tarObj.find((zObj) => zObj.name === iObj.name); + if (tarIObj) { + tarIObj.weight += this.igdUnitDict[iObj.name] + ? iObj.cusWeight + : iObj.weight; } else { - obj[tarTypeName] = [ - { - type: iObj.type, - name: iObj.name, - weight: this.igdUnitDict[iObj.name] - ? iObj.cusWeight - : iObj.weight, - unit: this.igdUnitDict[iObj.name] || "g", - }, - ]; + tarObj.push({ + type: iObj.type, + name: iObj.name, + weight: this.igdUnitDict[iObj.name] + ? iObj.cusWeight + : iObj.weight, + unit: this.igdUnitDict[iObj.name] || "g", + }); } - }); + } else { + obj[tarTypeName] = [ + { + type: iObj.type, + name: iObj.name, + weight: this.igdUnitDict[iObj.name] + ? iObj.cusWeight + : iObj.weight, + unit: this.igdUnitDict[iObj.name] || "g", + }, + ]; + } }); - } - return obj; - }, - {} - ); + }); + } + return obj; + }, {}); // console.log(this.shoppingCart); }, handleOnBackClick() { From 6d1fa36021ee2f5a10bcfa0409ce4cca53e8f10f Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Thu, 25 Mar 2021 11:12:39 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=81=A5=E5=BA=B7?= =?UTF-8?q?=E8=AF=84=E4=BC=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/PhysicalSignsDialog/index.vue | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue index 5d103c93a..86e92ad77 100644 --- a/stdiet-ui/src/components/PhysicalSignsDialog/index.vue +++ b/stdiet-ui/src/components/PhysicalSignsDialog/index.vue @@ -568,13 +568,15 @@ export default { detailHealthy.secondSmoke = detailHealthy.secondSmoke == 1 ? "是" : "否"; let smokeRateString = ""; if (detailHealthy.smokeRate != null) { - detailHealthy.smokeRate.split(",").forEach(function (item, index) { - smokeRateString += - (smokeRateString != "" ? "," : "") + - healthyData["smokeRateArray"][index] + - item + - healthyData["smokeRateUnitArray"][index]; - }); + (detailHealthy.smokeRate || "") + .split(",") + .forEach(function (item, index) { + smokeRateString += + (smokeRateString != "" ? "," : "") + + healthyData["smokeRateArray"][index] + + item + + healthyData["smokeRateUnitArray"][index]; + }); } detailHealthy.smokeRate = smokeRateString; detailHealthy.defecationNum = detailHealthy.defecationNum + "次/天"; @@ -686,7 +688,7 @@ export default { ? medicalReportNameArray[2] : "体检报告(3)" : ""; - detailHealthy.moistureDate = detailHealthy.moistureDate + detailHealthy.moistureDate = (detailHealthy.moistureDate || "") .split(",") .reduce((arr, cur) => { const tarData = healthyData.moistureDateArray.find( @@ -697,7 +699,7 @@ export default { } return arr; }, []); - detailHealthy.bloodData = detailHealthy.bloodData + detailHealthy.bloodData = (detailHealthy.bloodData || "") .split(",") .reduce((arr, cur) => { const tarData = healthyData.bloodDataArray.find( From b4e66b2cdab28a0bbfc1524378d5b8fcf281e9e9 Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Thu, 25 Mar 2021 16:42:05 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A3=9F=E6=9D=90?= =?UTF-8?q?=EF=BC=8C=E8=8F=9C=E5=93=81=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/SysDishesController.java | 6 +- .../custom/SysIngredientController.java | 6 +- .../controller/custom/SysWapController.java | 12 ++- .../custom/mapper/SysIngredientMapper.java | 6 +- .../custom/service/ISysDishesService.java | 2 +- .../custom/service/ISysIngredientService.java | 2 +- .../service/impl/SysDishesServiceImpl.java | 12 +-- .../impl/SysIngredientServiceImpl.java | 28 +++--- .../mapper/custom/SysDishesMapper.xml | 88 ++++++++++--------- .../mapper/custom/SysIngredientMapper.xml | 38 ++++---- stdiet-ui/src/store/modules/recipes.js | 2 + stdiet-ui/src/views/custom/dishes/index.vue | 5 +- .../src/views/custom/ingredient/index.vue | 5 +- .../RecipesView/RecipesCom/index.vue | 10 +++ 14 files changed, 119 insertions(+), 103 deletions(-) diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysDishesController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysDishesController.java index cefa94b18..513f585d4 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysDishesController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysDishesController.java @@ -116,8 +116,8 @@ public class SysDishesController extends BaseController { */ @PreAuthorize("@ss.hasPermi('custom:dishes:remove')") @Log(title = "菜品", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) { - return toAjax(sysDishesService.deleteSysDishesByIds(ids)); + @DeleteMapping("/{id}") + public AjaxResult remove(@PathVariable Long id) { + return toAjax(sysDishesService.deleteSysDishesById(id)); } } \ No newline at end of file diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysIngredientController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysIngredientController.java index e28d40ab7..c5483e276 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysIngredientController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysIngredientController.java @@ -98,9 +98,9 @@ public class SysIngredientController extends BaseController */ @PreAuthorize("@ss.hasPermi('custom:ingredient:remove')") @Log(title = "食材", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") - public AjaxResult remove(@PathVariable Long[] ids) + @DeleteMapping("/{id}") + public AjaxResult remove(@PathVariable Long id) { - return toAjax(sysIngredientService.deleteSysIngredientByIds(ids)); + return toAjax(sysIngredientService.deleteSysIngredientById(id)); } } \ No newline at end of file diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWapController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWapController.java index 02f239ff9..4acf10865 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWapController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWapController.java @@ -11,6 +11,10 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + @RestController @RequestMapping("/wap") public class SysWapController extends BaseController { @@ -69,11 +73,17 @@ public class SysWapController extends BaseController { /** * 获取完整食谱 + * * @param id * @return */ - @GetMapping(value = "recipes/{id}") + @GetMapping(value = "/recipes/{id}") public AjaxResult recipesDetail(@PathVariable Long id) { return AjaxResult.success(iSysRecipesService.selectSysRecipesByRecipesId(id)); } + +// @GetMapping(value = "/qrcode") +// public void qrcodeRediredt(String group, HttpServletRequest request, HttpServletResponse response) throws IOException { +// response.sendRedirect("https://weibo.com/u/1913360251"); +// } } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java index e8f7a718e..063113307 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java @@ -61,7 +61,7 @@ public interface SysIngredientMapper { * @param ids 需要删除的数据ID * @return 结果 */ - int deleteSysIngredientByIds(Long[] ids); +// int deleteSysIngredientByIds(Long[] ids); int batchIngredientRec(List ingredientRecList); @@ -71,9 +71,9 @@ public interface SysIngredientMapper { int deleteIngredientNotRecByIngredientId(Long notRecId); - int deleteIngredientRecByIngredientIds(Long[] id); +// int deleteIngredientRecByIngredientIds(Long[] id); - int deleteIngredientNotRecByIngredientIds(Long[] id); +// int deleteIngredientNotRecByIngredientIds(Long[] id); /** * 根据食材名称查询食材信息 diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysDishesService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysDishesService.java index baecbb30f..d10d38c01 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysDishesService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysDishesService.java @@ -53,7 +53,7 @@ public interface ISysDishesService * @param ids 需要删除的菜品ID * @return 结果 */ - public int deleteSysDishesByIds(Long[] ids); +// public int deleteSysDishesByIds(Long[] ids); /** * 删除菜品信息 diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysIngredientService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysIngredientService.java index 0d8f10d61..026453ffa 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysIngredientService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysIngredientService.java @@ -49,7 +49,7 @@ public interface ISysIngredientService * @param ids 需要删除的食材ID * @return 结果 */ - public int deleteSysIngredientByIds(Long[] ids); +// public int deleteSysIngredientByIds(Long[] ids); /** * 删除食材信息 diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysDishesServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysDishesServiceImpl.java index 39ada4428..322b978ba 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysDishesServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysDishesServiceImpl.java @@ -107,11 +107,11 @@ public class SysDishesServiceImpl implements ISysDishesService { * @param ids 需要删除的菜品ID * @return 结果 */ - @Override - public int deleteSysDishesByIds(Long[] ids) { - sysDishesMapper.deleteIngredientByIds(ids); - return sysDishesMapper.deleteSysDishesByIds(ids); - } +// @Override +// public int deleteSysDishesByIds(Long[] ids) { +// sysDishesMapper.deleteIngredientByIds(ids); +// return sysDishesMapper.deleteSysDishesByIds(ids); +// } /** * 删除菜品信息 @@ -121,7 +121,7 @@ public class SysDishesServiceImpl implements ISysDishesService { */ @Override public int deleteSysDishesById(Long id) { - sysDishesMapper.deleteIngredientById(id); +// sysDishesMapper.deleteIngredientById(id); return sysDishesMapper.deleteSysDishesById(id); } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java index d12714b31..50cb3f521 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java @@ -169,18 +169,18 @@ public class SysIngredientServiceImpl implements ISysIngredientService { return sysIngredientMapper.updateSysIngredient(sysIngredient); } - /** - * 批量删除食材 - * - * @param ids 需要删除的食材ID - * @return 结果 - */ - @Override - public int deleteSysIngredientByIds(Long[] ids) { - sysIngredientMapper.deleteIngredientRecByIngredientIds(ids); - sysIngredientMapper.deleteIngredientNotRecByIngredientIds(ids); - return sysIngredientMapper.deleteSysIngredientByIds(ids); - } +// /** +// * 批量删除食材 +// * +// * @param ids 需要删除的食材ID +// * @return 结果 +// */ +// @Override +// public int deleteSysIngredientByIds(Long[] ids) { +// sysIngredientMapper.deleteIngredientRecByIngredientIds(ids); +// sysIngredientMapper.deleteIngredientNotRecByIngredientIds(ids); +// return sysIngredientMapper.deleteSysIngredientByIds(ids); +// } /** * 删除食材信息 @@ -190,8 +190,8 @@ public class SysIngredientServiceImpl implements ISysIngredientService { */ @Override public int deleteSysIngredientById(Long id) { - sysIngredientMapper.deleteIngredientRecByIngredientId(id); - sysIngredientMapper.deleteIngredientNotRecByIngredientId(id); +// sysIngredientMapper.deleteIngredientRecByIngredientId(id); +// sysIngredientMapper.deleteIngredientNotRecByIngredientId(id); return sysIngredientMapper.deleteSysIngredientById(id); } diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysDishesMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysDishesMapper.xml index 3b13adebe..a9a167234 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysDishesMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysDishesMapper.xml @@ -5,37 +5,37 @@ - - - - - - - - - - - - + + + + + + + + + + + + - - + + - - - - - - - - - - - - + + + + + + + + + + + + @@ -45,12 +45,13 @@ @@ -82,7 +83,7 @@ @@ -140,16 +141,16 @@ where id = #{id} - - delete from sys_dishes where id = #{id} - + + update sys_dishes set del_flag=1 where id = #{id} + - - delete from sys_dishes where id in - - #{id} - - + + + + + + delete from sys_dishes_ingredient where dishes_id = #{id} @@ -163,7 +164,8 @@ - insert into sys_dishes_ingredient(dishes_id, ingredient_id, ingredient_weight, cus_unit, cus_weight, remark) values + insert into sys_dishes_ingredient(dishes_id, ingredient_id, ingredient_weight, cus_unit, cus_weight, remark) + values (#{item.dishesId}, #{item.ingredientId}, #{item.weight}, #{item.cusUnit}, #{item.cusWeight}, #{item.remark}) diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml index e1b867059..c5d659d78 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml @@ -103,6 +103,7 @@ and type = #{type} and area = #{area} and review_status = #{reviewStatus} + and del_flag=0 @@ -167,19 +168,19 @@ delete from sys_ingredient_not_rec where ingredient_id=#{ingredientId} - - delete from sys_ingredient_rec where ingredient_id in - - #{id} - - + + + + + + - - delete from sys_ingredient_not_rec where ingredient_id in - - #{id} - - + + + + + + update sys_ingredient @@ -201,16 +202,9 @@ where id = #{id} - - delete from sys_ingredient where id = #{id} - - - - delete from sys_ingredient where id in - - #{id} - - + + update sys_ingredient set del_flag=1 where id = #{id} +