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..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 @@ -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); @@ -541,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