From e5fb063b579a08d758b365303aeea5698512b702 Mon Sep 17 00:00:00 2001
From: huangdeliang <huangdeliang@skieer.com>
Date: Tue, 11 May 2021 16:00:04 +0800
Subject: [PATCH 1/2] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E9=A3=9F=E8=B0=B1?=
 =?UTF-8?q?=E5=BC=80=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../web/controller/custom/WechatAppletController.java    | 9 ++++++++-
 .../com/stdiet/custom/mapper/SysRecipesPlanMapper.java   | 4 ++++
 .../stdiet/custom/service/ISysRecipesPlanService.java    | 3 +++
 .../custom/service/impl/SysRecipesPlanServiceImpl.java   | 5 +++++
 .../resources/mapper/custom/SysRecipesPlanMapper.xml     | 4 ++++
 .../src/views/custom/recipesShow/MenuDetail/index.vue    | 2 +-
 6 files changed, 25 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 96bf037ec..f3df8b123 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
@@ -39,6 +39,8 @@ public class WechatAppletController extends BaseController {
 
     public static final String[] imageName = {"breakfastImages", "lunchImages", "dinnerImages", "extraMealImages", "bodyImages"};
     @Autowired
+    ISysRecipesService iSysRecipesService;
+    @Autowired
     private ISysCustomerCaseService sysCustomerCaseService;
     @Autowired
     private ISysWxUserLogService sysWxUserLogService;
@@ -449,7 +451,7 @@ public class WechatAppletController extends BaseController {
     public AjaxResult getRecipesPlans(@RequestParam String customerId) {
         Long cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L;
 
-        List<SysRecipesPlan> plans = sysRecipesPlanService.selectPlanListByCusId(cusId);
+        List<SysRecipesPlanListInfo> plans = sysRecipesPlanService.selectRecipesPlanListInfoByCusId(cusId);
 
         SysOrderPause orderPause = new SysOrderPause();
         orderPause.setCusId(cusId);
@@ -476,6 +478,11 @@ public class WechatAppletController extends BaseController {
 
         return AjaxResult.success(result);
     }
+
+    @GetMapping("/getRecipesDetail")
+    public AjaxResult getRecipesDetail(@RequestParam Long menuId) {
+        return AjaxResult.success(iSysRecipesService.selectDishesByMenuId(menuId));
+    }
 }
 
 
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java
index 43cafab6f..2b58ea0b1 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysRecipesPlanMapper.java
@@ -103,10 +103,14 @@ public interface SysRecipesPlanMapper
 
     List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
 
+    List<SysRecipesPlanListInfo> selectRecipesPlanListInfoByCusId(Long cusId);
+
+
     List<SysRecipesPlan> selectPlanListByCusId(Long cusId);
     
     List<SysRecipesPlan> selectRecipesModelList(SysRecipesPlan sysRecipesPlan);
 
+
     /**
      * 批量更新食谱计划的开始时间、结束时间
      * @param list
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java
index 65aa040b6..8a86d0858 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysRecipesPlanService.java
@@ -112,6 +112,9 @@ public interface ISysRecipesPlanService
      */
     List<SysRecipesPlanListInfo> selectRecipesPlanListInfo(String outId);
 
+    List<SysRecipesPlanListInfo> selectRecipesPlanListInfoByCusId(Long cusId);
+
+
     /**
      * 通过客户id查询食谱计划
      * @param cusId
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java
index 23cf963b9..0c342f571 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysRecipesPlanServiceImpl.java
@@ -421,6 +421,11 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService {
         return sysRecipesPlanMapper.selectRecipesPlanListInfo(outId);
     }
 
+    @Override
+    public List<SysRecipesPlanListInfo> selectRecipesPlanListInfoByCusId(Long cusId) {
+        return sysRecipesPlanMapper.selectRecipesPlanListInfoByCusId(cusId);
+    }
+
     @Override
     public List<SysRecipesPlan> selectPlanListByCusId(Long cusId) {
         return sysRecipesPlanMapper.selectPlanListByCusId(cusId);
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml
index 6fe4eca81..aa0c9a6f0 100644
--- a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml
@@ -246,6 +246,10 @@
         select id, start_date, end_date, start_num_day, end_num_day, recipes_id from sys_recipes_plan where out_id=#{outId} and del_flag = 0 and review_status = 2 and send_flag = 1
     </select>
 
+    <select id="selectRecipesPlanListInfoByCusId" resultMap="SysRecipesPlanListInfoResult">
+        select id, start_date, end_date, start_num_day, end_num_day, recipes_id from sys_recipes_plan where cus_id=#{cusId} and del_flag = 0 and review_status = 2 and send_flag = 1
+    </select>
+
     <resultMap type="SysRecipesDaily" id="SysRecipesResult">
         <result property="id" column="id"/>
         <result property="numDay" column="num_day"/>
diff --git a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue
index aca5686bd..ca7088903 100644
--- a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue
+++ b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue
@@ -136,7 +136,7 @@ export default {
         typeName: this.menuTypeDict[type],
         values: mData[type],
       }));
-      console.log(mMenus);
+      // console.log(mMenus);
       return mMenus;
     },
     ...mapState(["cusUnitDict", "cusWeightDict", "menuTypeDict"]),

From 7b165615919e82a0f9080b19c56b4bc3931508f1 Mon Sep 17 00:00:00 2001
From: huangdeliang <huangdeliang@skieer.com>
Date: Wed, 12 May 2021 19:18:05 +0800
Subject: [PATCH 2/2] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../custom/WechatAppletController.java        | 58 +++++++++++--------
 1 file changed, 33 insertions(+), 25 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 5fb299773..c227da1de 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
@@ -1,7 +1,6 @@
 package com.stdiet.web.controller.custom;
 
 import com.aliyun.vod20170321.models.GetPlayInfoResponseBody;
-import com.aliyun.vod20170321.models.GetVideoInfoResponseBody;
 import com.stdiet.common.core.controller.BaseController;
 import com.stdiet.common.core.domain.AjaxResult;
 import com.stdiet.common.core.domain.entity.SysDictData;
@@ -117,7 +116,7 @@ public class WechatAppletController extends BaseController {
         SysCustomer customer = sysCustomerService.getCustomerByPhone(sysWxUserInfo.getPhone());
         //加密ID
         String customerEncId = null;
-        if(customer != null){
+        if (customer != null) {
             sysWxUserInfo.setCusId(customer.getId());
             customerEncId = AesUtils.encrypt(customer.getId() + "", null);
         }
@@ -130,7 +129,7 @@ public class WechatAppletController extends BaseController {
             sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo);
         }
         Map<String, Object> result = new HashMap<>();
-        result.put("customerId",  customerEncId);
+        result.put("customerId", customerEncId);
         //查询未读消息数量
         SysMessageNotice messageParam = new SysMessageNotice();
         messageParam.setReadType(0);
@@ -268,7 +267,7 @@ public class WechatAppletController extends BaseController {
         List<String> allUrlList = new ArrayList<>();
 
         for (String key : imageName) {
-            if(!"bodyImages".equals(key)){
+            if (!"bodyImages".equals(key)) {
                 allUrlList.addAll(downUrlList.get(key));
                 allImagesList.addAll(imageUrlMap.get(key));
             }
@@ -375,10 +374,10 @@ public class WechatAppletController extends BaseController {
         sysNutritionalVideo.setSortType(2);
         //普通用户
         sysNutritionalVideo.setUserType(0);
-        if(StringUtils.isNotEmpty(sysNutritionalVideo.getOpenId())){
+        if (StringUtils.isNotEmpty(sysNutritionalVideo.getOpenId())) {
             //查询是否为客户,存在订单就视为客户
             int orderNum = sysOrderService.getOrderCountByOpenId(sysNutritionalVideo.getOpenId());
-            if(orderNum > 0){
+            if (orderNum > 0) {
                 sysNutritionalVideo.setUserType(1);
             }
         }
@@ -395,25 +394,25 @@ public class WechatAppletController extends BaseController {
     public AjaxResult getVideoDetailById(@RequestParam(value = "videoId") String videoId) {
         AjaxResult result = AjaxResult.success();
         NutritionalVideoResponse nutritionalVideoResponse = new NutritionalVideoResponse();
-        try{
-                SysNutritionalVideo sysNutritionalVideo = sysNutritionalVideoService.selectSysNutritionalVideByVideoId(videoId);
-                if(sysNutritionalVideo != null){
-                    GetPlayInfoResponseBody playInfoResponseBody = AliyunVideoUtils.getVideoVisitDetail(videoId);
-                    List<GetPlayInfoResponseBody.GetPlayInfoResponseBodyPlayInfoListPlayInfo> playList = playInfoResponseBody.playInfoList.playInfo;
-                    if(playList != null && playList.size() > 0){
-                        nutritionalVideoResponse.setPlayUrl(playList.get(0).getPlayURL());
-                    }
-                    if(StringUtils.isNotEmpty(sysNutritionalVideo.getCoverUrl())){
-                        nutritionalVideoResponse.setCoverUrl(AliyunOSSUtils.generatePresignedUrl(sysNutritionalVideo.getCoverUrl()));
-                    }else{
-                        nutritionalVideoResponse.setCoverUrl(AliyunVideoUtils.getVideoCoverUrl(videoId));
-                    }
-                    nutritionalVideoResponse.setDescription(sysNutritionalVideo.getDescription());
-                    nutritionalVideoResponse.setTags(sysNutritionalVideo.getTags());
-                    nutritionalVideoResponse.setTitle(sysNutritionalVideo.getTitle());
-                    nutritionalVideoResponse.setPlayNum(sysNutritionalVideo.getPlayNum());
+        try {
+            SysNutritionalVideo sysNutritionalVideo = sysNutritionalVideoService.selectSysNutritionalVideByVideoId(videoId);
+            if (sysNutritionalVideo != null) {
+                GetPlayInfoResponseBody playInfoResponseBody = AliyunVideoUtils.getVideoVisitDetail(videoId);
+                List<GetPlayInfoResponseBody.GetPlayInfoResponseBodyPlayInfoListPlayInfo> playList = playInfoResponseBody.playInfoList.playInfo;
+                if (playList != null && playList.size() > 0) {
+                    nutritionalVideoResponse.setPlayUrl(playList.get(0).getPlayURL());
                 }
-        }catch (Exception e){
+                if (StringUtils.isNotEmpty(sysNutritionalVideo.getCoverUrl())) {
+                    nutritionalVideoResponse.setCoverUrl(AliyunOSSUtils.generatePresignedUrl(sysNutritionalVideo.getCoverUrl()));
+                } else {
+                    nutritionalVideoResponse.setCoverUrl(AliyunVideoUtils.getVideoCoverUrl(videoId));
+                }
+                nutritionalVideoResponse.setDescription(sysNutritionalVideo.getDescription());
+                nutritionalVideoResponse.setTags(sysNutritionalVideo.getTags());
+                nutritionalVideoResponse.setTitle(sysNutritionalVideo.getTitle());
+                nutritionalVideoResponse.setPlayNum(sysNutritionalVideo.getPlayNum());
+            }
+        } catch (Exception e) {
             e.printStackTrace();
         }
         result.put("videoDetail", nutritionalVideoResponse);
@@ -426,7 +425,7 @@ public class WechatAppletController extends BaseController {
     @GetMapping(value = "/updateVideoPlayNum")
     public AjaxResult updateVideoPlayNum(@RequestParam(value = "videoId") String videoId) {
         AjaxResult result = AjaxResult.error();
-        if(sysNutritionalVideoService.updateVideoPlayNum(videoId) > 0){
+        if (sysNutritionalVideoService.updateVideoPlayNum(videoId) > 0) {
             result = AjaxResult.success();
         }
         return result;
@@ -500,11 +499,15 @@ public class WechatAppletController extends BaseController {
         List<SysDictData> unitDict = iSysDictTypeService.selectDictDataByType("cus_cus_unit");
         List<SysDictData> weightDict = iSysDictTypeService.selectDictDataByType("cus_cus_weight");
         List<SysDictData> menuTypeDict = iSysDictTypeService.selectDictDataByType("cus_dishes_type");
+        List<SysDictData> igdUnitDict = iSysDictTypeService.selectDictDataByType("sys_ingredient_unit");
+        List<SysDictData> idgTypeDict = iSysDictTypeService.selectDictDataByType("cus_ing_type");
 
         Map<String, Object> result = new HashMap<>();
         result.put("unitDict", unitDict);
         result.put("weightDict", weightDict);
         result.put("menuTypeDict", menuTypeDict);
+        result.put("igdUnitDict", igdUnitDict);
+        result.put("idgTypeDict", idgTypeDict);
 
         return AjaxResult.success(result);
     }
@@ -513,6 +516,11 @@ public class WechatAppletController extends BaseController {
     public AjaxResult getRecipesDetail(@RequestParam Long menuId) {
         return AjaxResult.success(iSysRecipesService.selectDishesByMenuId(menuId));
     }
+
+    @GetMapping("/getPlanDetail")
+    public AjaxResult getPlanDetail(@RequestParam Long planId) {
+        return AjaxResult.success(iSysRecipesService.selectSysRecipesByRecipesId(planId));
+    }
 }