From d736726b24a872d0b59bf61c0ff3ee1737d55e7d Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Mon, 10 May 2021 14:50:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=AA=E4=BA=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/WechatAppletController.java | 59 ++++++++++++++++--- .../stdiet/custom/domain/SysOrderPause.java | 3 + .../stdiet/custom/domain/SysRecipesPlan.java | 6 +- .../src/components/HealthyView/index.vue | 23 ++++---- stdiet-ui/src/views/custom/customer/index.vue | 4 +- 5 files changed, 74 insertions(+), 21 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 99d2fdfb9..96bf037ec 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 @@ -4,6 +4,7 @@ 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; import com.stdiet.common.core.page.TableDataInfo; import com.stdiet.common.exception.file.FileNameLengthLimitExceededException; import com.stdiet.common.utils.AliyunVideoUtils; @@ -19,6 +20,7 @@ import com.stdiet.custom.dto.response.MessageNoticeResponse; import com.stdiet.custom.dto.response.NutritionalVideoResponse; import com.stdiet.custom.page.WxLogInfo; import com.stdiet.custom.service.*; +import com.stdiet.system.service.ISysDictTypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -50,15 +52,18 @@ public class WechatAppletController extends BaseController { private ISysAskNutritionQuestionService sysAskNutritionQuestionService; @Autowired private ISysCustomerService iSysCustomerService; - @Autowired private ISysMessageNoticeService sysMessageNoticeService; - @Autowired private ISysCustomerService sysCustomerService; - @Autowired private ISysNutritionalVideoService sysNutritionalVideoService; + @Autowired + private ISysRecipesPlanService sysRecipesPlanService; + @Autowired + private ISysOrderPauseService sysOrderPauseService; + @Autowired + private ISysDictTypeService iSysDictTypeService; /** * 查询微信小程序中展示的客户案例 @@ -415,17 +420,23 @@ public class WechatAppletController extends BaseController { return AjaxResult.error(5003, "未查到用户信息,请联系销售顾问"); } + sysWxUserInfo.setCusId(sysCustomer.getId()); if (StringUtils.isNull(curWxUserInfo)) { // 新增sys_wx_user_info - sysWxUserInfo.setCusId(sysCustomer.getId()); sysWxUserInfo.setCreateTime(DateUtils.getNowDate()); sysWxUserInfoService.insertSysWxUserInfo(sysWxUserInfo); } else { // 更新sys_wx_user_info数据, - curWxUserInfo.setCusId(sysCustomer.getId()); - curWxUserInfo.setUpdateTime(DateUtils.getNowDate()); - sysWxUserInfoService.updateSysWxUserInfo(curWxUserInfo); + sysWxUserInfo.setUpdateTime(DateUtils.getNowDate()); + sysWxUserInfoService.updateSysWxUserInfo(sysWxUserInfo); } + // 更新对象 + curWxUserInfo = sysWxUserInfo; + } + + // 更新时间超过7天,重新登录获取最新信息 + if (StringUtils.isEmpty(curWxUserInfo.getAvatarUrl()) || ChronoUnit.DAYS.between(DateUtils.dateToLocalDate(curWxUserInfo.getUpdateTime()), LocalDate.now()) >= 7) { + return AjaxResult.error(5001, "信息缺失或者过期需要重新登录"); } curWxUserInfo.setCustomerId(AesUtils.encrypt(curWxUserInfo.getCusId().toString())); @@ -433,4 +444,38 @@ public class WechatAppletController extends BaseController { // 并返回一系列登录后的数据 return AjaxResult.success(curWxUserInfo); } + + @GetMapping("/getRecipesPlans") + public AjaxResult getRecipesPlans(@RequestParam String customerId) { + Long cusId = StringUtils.isNotEmpty(customerId) ? Long.parseLong(AesUtils.decrypt(customerId)) : 0L; + + List plans = sysRecipesPlanService.selectPlanListByCusId(cusId); + + SysOrderPause orderPause = new SysOrderPause(); + orderPause.setCusId(cusId); + List pauses = sysOrderPauseService.selectSysOrderPauseList(orderPause); + + Map result = new HashMap<>(); + result.put("plans", plans); + result.put("pauses", pauses); + + return AjaxResult.success(result); + } + + @GetMapping("/getDicts") + public AjaxResult getDicts() { + + List unitDict = iSysDictTypeService.selectDictDataByType("cus_cus_unit"); + List weightDict = iSysDictTypeService.selectDictDataByType("cus_cus_weight"); + List menuTypeDict = iSysDictTypeService.selectDictDataByType("cus_dishes_type"); + + Map result = new HashMap<>(); + result.put("unitDict", unitDict); + result.put("weightDict", weightDict); + result.put("menuTypeDict", menuTypeDict); + + return AjaxResult.success(result); + } } + + diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrderPause.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrderPause.java index 085ad81dd..b871990c7 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrderPause.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysOrderPause.java @@ -1,6 +1,7 @@ package com.stdiet.custom.domain; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.stdiet.common.annotation.Excel; import lombok.Data; import org.apache.commons.lang3.builder.ToStringBuilder; @@ -25,8 +26,10 @@ public class SysOrderPause { /** * 订单id */ + @JsonIgnore private Long orderId; + @JsonIgnore private Long cusId; private String outId; diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlan.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlan.java index 8e5c4bfc5..48da9b9b8 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlan.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlan.java @@ -1,6 +1,7 @@ package com.stdiet.custom.domain; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.stdiet.common.annotation.Excel; import lombok.Data; @@ -24,6 +25,7 @@ public class SysRecipesPlan { * 订单ID */ //@Excel(name = "订单ID") + @JsonIgnore private Long orderId; private Long cusId; @@ -116,7 +118,9 @@ public class SysRecipesPlan { */ private Integer reviewStatus; - /** 该食谱计划中暂停日期,使用 | 隔开 */ + /** + * 该食谱计划中暂停日期,使用 | 隔开 + */ //@Excel(name = "该食谱计划中暂停日期,使用 | 隔开") private String pauseDate; diff --git a/stdiet-ui/src/components/HealthyView/index.vue b/stdiet-ui/src/components/HealthyView/index.vue index 85cf0e5ce..c61af37f0 100644 --- a/stdiet-ui/src/components/HealthyView/index.vue +++ b/stdiet-ui/src/components/HealthyView/index.vue @@ -107,6 +107,7 @@ export default { title: "既往病史/用药史评估", content: [ { title: "病史体征", value: "physicalSigns" }, + { title: "忌口过敏食物", value: "dishesIngredient" }, { title: "湿气数据", value: "moistureDate" }, { title: "气血数据", value: "bloodData" }, { title: "家族疾病史", value: "familyIllnessHistory" }, @@ -118,7 +119,16 @@ export default { { title: "是否出现过过敏症状", value: "allergyFlag" }, { title: "过敏症状", value: "allergySituation" }, { title: "过敏源", value: "allergen" }, - { title: "忌口过敏食物", value: "dishesIngredient" }, + ], + }, + { + title: "运动习惯评估", + content: [ + { title: "每周运动次数", value: "motionNum" }, + { title: "每次运动的时长", value: "motionDuration" }, + { title: "每天运动的时间", value: "motionTime" }, + { title: "运动", value: "motion" }, + { title: "运动场地", value: "motionField" }, ], }, { @@ -193,16 +203,7 @@ export default { { title: "排便的颜色", value: "defecationColor" }, ], }, - { - title: "运动习惯评估", - content: [ - { title: "每周运动次数", value: "motionNum" }, - { title: "每次运动的时长", value: "motionDuration" }, - { title: "每天运动的时间", value: "motionTime" }, - { title: "运动", value: "motion" }, - { title: "运动场地", value: "motionField" }, - ], - }, + { title: "睡眠质量评估", content: [ diff --git a/stdiet-ui/src/views/custom/customer/index.vue b/stdiet-ui/src/views/custom/customer/index.vue index d63a018b4..90287895b 100644 --- a/stdiet-ui/src/views/custom/customer/index.vue +++ b/stdiet-ui/src/views/custom/customer/index.vue @@ -83,7 +83,7 @@ /> - +