From 562180c7d4e516922429320ba66de88e3b7ad99c Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Fri, 21 May 2021 09:34:26 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DcustomerId=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=97=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/custom/WechatAppletController.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java index afe347d0f..9b11f3091 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java @@ -488,8 +488,17 @@ public class WechatAppletController extends BaseController { } @GetMapping("/getRecipesPlans") - public AjaxResult getRecipesPlans(@RequestParam String customerId) { - Long cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L; + public AjaxResult getRecipesPlans(@RequestParam String customerId, @RequestParam String openid) { + Long cusId = 0L; + if (StringUtils.isNull(customerId)) { + SysWxUserInfo wxUserInfo = sysWxUserInfoService.selectSysWxUserInfoById(openid); + cusId = StringUtils.isNotNull(wxUserInfo) ? wxUserInfo.getCusId() : 0L; + } else { + cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L; + } + if (cusId == 0L) { + return AjaxResult.error(5000, "需要手机号进一步匹配"); + } List plans = sysRecipesPlanService.selectRecipesPlanListInfoByCusId(cusId); From 0b973ab796edf6b53f5d005468d54a18a95ced33 Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Fri, 21 May 2021 11:56:15 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=A3=9F=E8=B0=B1?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E8=AF=A6=E6=83=85=E5=85=A8=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/WechatAppletController.java | 4 +- .../custom/mapper/SysRecipesMapper.java | 4 + .../custom/service/ISysRecipesService.java | 4 + .../service/impl/SysRecipesServiceImpl.java | 10 +++ .../mapper/custom/SysRecipesMapper.xml | 80 ++++++++++++++++--- 5 files changed, 91 insertions(+), 11 deletions(-) diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java index 9b11f3091..d30ca7002 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/WechatAppletController.java @@ -550,12 +550,12 @@ public class WechatAppletController extends BaseController { @GetMapping("/getRecipesDetail") public AjaxResult getRecipesDetail(@RequestParam Long menuId) { - return AjaxResult.success(iSysRecipesService.selectDishesByMenuId(menuId)); + return AjaxResult.success(iSysRecipesService.selectDishesByMenuIdShow(menuId)); } @GetMapping("/getPlanDetail") public AjaxResult getPlanDetail(@RequestParam Long planId) { - return AjaxResult.success(iSysRecipesService.selectSysRecipesByRecipesId(planId)); + return AjaxResult.success(iSysRecipesService.selectSysRecipesByRecipesIdShow(planId)); } @GetMapping("/authServer") diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesMapper.java index 5f184f629..534a39ae5 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesMapper.java @@ -20,6 +20,8 @@ public interface SysRecipesMapper { public List selectSysRecipesByRecipesId(Long id); + public List selectSysRecipesByRecipesIdShow(Long id); + public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDaily); public int addDishes(SysRecipesDailyDishes sysRecipesDaily); @@ -29,4 +31,6 @@ public interface SysRecipesMapper { public int deleteMenu(Long id); public List selectDishesByMenuId(Long id); + + public List selectDishesByMenuIdShow(Long id); } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesService.java index 1d30b460b..b60da272a 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesService.java @@ -13,8 +13,12 @@ public interface ISysRecipesService { public List selectSysRecipesByRecipesId(Long id); + public List selectSysRecipesByRecipesIdShow(Long id); + public List selectDishesByMenuId(Long id); + public List selectDishesByMenuIdShow(Long id); + public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDaily); public int addDishes(SysRecipesDailyDishes sysRecipesDaily); diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesServiceImpl.java index 5ee6ef763..e11568e7a 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesServiceImpl.java @@ -67,11 +67,21 @@ public class SysRecipesServiceImpl implements ISysRecipesService { return sysRecipesMapper.selectSysRecipesByRecipesId(id); } + @Override + public List selectSysRecipesByRecipesIdShow(Long id) { + return sysRecipesMapper.selectSysRecipesByRecipesIdShow(id); + } + @Override public List selectDishesByMenuId(Long id) { return sysRecipesMapper.selectDishesByMenuId(id); } + @Override + public List selectDishesByMenuIdShow(Long id) { + return sysRecipesMapper.selectDishesByMenuIdShow(id); + } + @Override public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDailyDishes) { return sysRecipesMapper.updateDishesDetail(sysRecipesDailyDishes); diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesMapper.xml index 72e771e3c..ad69948f1 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesMapper.xml @@ -18,7 +18,7 @@ - + @@ -39,13 +39,13 @@ - - - + + + select count(*) from sys_customer_daily_menu where cus_id = #{id} - + insert into sys_customer_menu @@ -149,8 +153,66 @@ insert into sys_customer_menu_dishes (menu_id, type, dishes_id, remark, detail) values - (#{item.menuId}, #{item.type}, #{item.dishesId}, #{item.remark}, #{item.detail, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler}) + (#{item.menuId}, #{item.type}, #{item.dishesId}, #{item.remark}, + #{item.detail, jdbcType=OTHER, typeHandler=com.stdiet.custom.typehandler.ArrayJsonHandler}) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file