From 9e87e1c9e8fb8861df9458283760bd41c6189e0e Mon Sep 17 00:00:00 2001 From: huangdeliang Date: Fri, 26 Feb 2021 20:14:35 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A3=9F=E8=B0=B1=E5=B1=95=E7=A4=BA=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../custom/SysCustomerController.java | 46 +-- .../custom/SysRecipesController.java | 1 + .../controller/custom/SysWapController.java | 42 ++ .../custom/domain/SysRecipesDetail.java | 12 + .../stdiet/custom/domain/SysRecipesPlan.java | 73 +++- .../custom/domain/SysRecipesPlanListInfo.java | 26 ++ .../custom/mapper/SysRecipesMapper.java | 2 + .../custom/mapper/SysRecipesPlanMapper.java | 7 + .../custom/service/ISysCustomerService.java | 7 + .../service/ISysRecipesPlanService.java | 8 +- .../custom/service/ISysRecipesService.java | 3 + .../custom/service/ISysWapServices.java | 13 + .../service/impl/SysCustomerServiceImpl.java | 91 ++-- .../impl/SysRecipesPlanServiceImpl.java | 16 +- .../service/impl/SysRecipesServiceImpl.java | 5 + .../service/impl/SysWapServicesImp.java | 39 ++ .../mapper/custom/SysRecipesPlanMapper.xml | 40 +- .../framework/config/SecurityConfig.java | 1 + stdiet-ui/src/api/custom/contract.js | 58 +-- stdiet-ui/src/api/custom/recipesShow.js | 31 ++ .../BodySignView/index.vue} | 0 .../HealthyView/index.vue} | 0 stdiet-ui/src/permission.js | 86 ++-- stdiet-ui/src/router/index.js | 7 + stdiet-ui/src/store/modules/recipes.js | 4 - stdiet-ui/src/views/custom/dishes/index.vue | 10 +- .../RecipesView/RecipesAspectCom/BarChart.vue | 8 +- .../RecipesView/RecipesAspectCom/PieChart.vue | 87 ++-- .../RecipesCom/AddDishesDrawer/index.vue | 10 +- .../src/views/custom/recipesBuild/index.vue | 4 +- .../MenuDetail/DishesDetailDialog/index.vue | 87 ++++ .../MenuDetail/NutriComputeCom/index.vue | 159 +++++++ .../custom/recipesShow/MenuDetail/index.vue | 141 +++++++ .../custom/recipesShow/PlanDrawer/index.vue | 120 ++++++ .../recipesShow/UserInfoDrawer/index.vue | 84 ++++ .../src/views/custom/recipesShow/index.vue | 161 ++++++++ .../src/views/custom/recipesShow/utils.js | 42 ++ .../custom/subhealthy/investigation/index.vue | 387 ++++++++++-------- 38 files changed, 1536 insertions(+), 382 deletions(-) create mode 100644 stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWapController.java create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesDetail.java create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlanListInfo.java create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWapServices.java create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWapServicesImp.java create mode 100644 stdiet-ui/src/api/custom/recipesShow.js rename stdiet-ui/src/{views/custom/recipesBuild/BodySignView.vue => components/BodySignView/index.vue} (100%) rename stdiet-ui/src/{views/custom/recipesBuild/HealthyView.vue => components/HealthyView/index.vue} (100%) create mode 100644 stdiet-ui/src/views/custom/recipesShow/MenuDetail/DishesDetailDialog/index.vue create mode 100644 stdiet-ui/src/views/custom/recipesShow/MenuDetail/NutriComputeCom/index.vue create mode 100644 stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue create mode 100644 stdiet-ui/src/views/custom/recipesShow/PlanDrawer/index.vue create mode 100644 stdiet-ui/src/views/custom/recipesShow/UserInfoDrawer/index.vue create mode 100644 stdiet-ui/src/views/custom/recipesShow/index.vue create mode 100644 stdiet-ui/src/views/custom/recipesShow/utils.js diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java index e97616b3e..7accfb8b6 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerController.java @@ -9,19 +9,15 @@ import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.poi.ExcelUtil; import com.stdiet.common.utils.sign.AesUtils; import com.stdiet.custom.domain.SysCustomer; -import com.stdiet.custom.domain.SysCustomerHealthy; import com.stdiet.custom.domain.SysCustomerPhysicalSigns; import com.stdiet.custom.service.ISysCustomerHealthyService; import com.stdiet.custom.service.ISysCustomerPhysicalSignsService; import com.stdiet.custom.service.ISysCustomerService; -import com.stdiet.framework.web.domain.server.Sys; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; -import java.util.HashMap; import java.util.List; -import java.util.Map; /** * 客户体征信息Controller @@ -53,7 +49,7 @@ public class SysCustomerController extends BaseController { for (SysCustomer sysCus : list) { if (StringUtils.isNotEmpty(sysCus.getPhone())) { sysCus.setPhone(StringUtils.hiddenPhoneNumber(sysCus.getPhone())); - sysCus.setEncId(sysCus.getId() != null ? AesUtils.encrypt(sysCus.getId()+"", null) : ""); + sysCus.setEncId(sysCus.getId() != null ? AesUtils.encrypt(sysCus.getId() + "", null) : ""); } } } @@ -88,7 +84,7 @@ public class SysCustomerController extends BaseController { @Log(title = "客户档案", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SysCustomer sysCustomer) throws Exception { - if(!sysCustomerService.isCustomerExistByPhone(sysCustomer)){ + if (!sysCustomerService.isCustomerExistByPhone(sysCustomer)) { return toAjax(sysCustomerService.insertSysCustomer(sysCustomer)); } return AjaxResult.error("该手机号客户已存在"); @@ -101,7 +97,7 @@ public class SysCustomerController extends BaseController { @Log(title = "客户档案", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody SysCustomer sysCustomer) throws Exception { - if(!sysCustomerService.isCustomerExistByPhone(sysCustomer)){ + if (!sysCustomerService.isCustomerExistByPhone(sysCustomer)) { return toAjax(sysCustomerService.updateSysCustomer(sysCustomer)); } return AjaxResult.error("该手机号客户已存在"); @@ -122,51 +118,29 @@ public class SysCustomerController extends BaseController { */ @GetMapping("/getCustomerAndSignByPhone") @PreAuthorize("@ss.hasPermi('custom:customer:query')") - public AjaxResult getCustomerAndSignByPhone(@RequestParam("phone")String phone) - { + public AjaxResult getCustomerAndSignByPhone(@RequestParam("phone") String phone) { SysCustomerPhysicalSigns sysCustomer = null; - if(StringUtils.isNotEmpty(phone)){ - sysCustomer = sysCustomerPhysicalSignsService.selectSysCustomerAndSignByPhone(phone); + if (StringUtils.isNotEmpty(phone)) { + sysCustomer = sysCustomerPhysicalSignsService.selectSysCustomerAndSignByPhone(phone); } return AjaxResult.success(sysCustomer); } /** * 根据客户ID获取体征或健康评估信息,优先健康评估信息 + * * @param id 客户ID * @return */ @GetMapping("/physicalSigns/{id}") public AjaxResult getPhysicalSignsById(@PathVariable("id") Long id) { - Map result = new HashMap<>(); - String key = "customerHealthy"; - result.put("type", 0); - //查询健康评估信息 - SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(id); - if(sysCustomerHealthy != null){ - /* if (StringUtils.isNotEmpty(sysCustomerHealthy.getPhone())) { - sysCustomerHealthy.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerHealthy.getPhone())); - }*/ - result.put(key, sysCustomerHealthy); - }else{ - //查询体征信息 - SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id); - if(sysCustomerPhysicalSigns != null){ - /* if (StringUtils.isNotEmpty(sysCustomerPhysicalSigns.getPhone())) { - sysCustomerPhysicalSigns.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerPhysicalSigns.getPhone())); - }*/ - result.put("type", 1); - } - result.put(key, sysCustomerPhysicalSigns); - } - //对ID进行加密 - result.put("enc_id", id != null ? AesUtils.encrypt(id+"", null) : ""); - return AjaxResult.success(result); + return AjaxResult.success(sysCustomerService.getPhysicalSignsById(id)); } /** * 根据客户ID删除对应体征信息或健康评估信息 - * @param id 客户ID + * + * @param customerId 客户ID * @return */ @GetMapping("/delCustomerHealthy/{id}") diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesController.java index 950b7c1cc..e27b04217 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesController.java @@ -79,4 +79,5 @@ public class SysRecipesController extends BaseController { public AjaxResult delete(@PathVariable Long id) { return toAjax(sysRecipesService.deleteDishes(id)); } + } 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 new file mode 100644 index 000000000..8e6683851 --- /dev/null +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysWapController.java @@ -0,0 +1,42 @@ +package com.stdiet.web.controller.custom; + +import com.stdiet.common.core.controller.BaseController; +import com.stdiet.common.core.domain.AjaxResult; +import com.stdiet.custom.service.ISysRecipesPlanService; +import com.stdiet.custom.service.ISysRecipesService; +import com.stdiet.custom.service.ISysWapServices; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/wap") +public class SysWapController extends BaseController { + @Autowired + ISysWapServices iSysWapServices; + + @Autowired + ISysRecipesService iSysRecipesService; + + /** + * 客户食谱详情 + * @param outId + * @return + */ + @GetMapping(value = "/recipes/plans/{outId}") + public AjaxResult detail(@PathVariable String outId) { + return AjaxResult.success(iSysWapServices.getRecipesPlanListInfo(outId)); + } + + @GetMapping(value = "/healthyInfo/{outId}") + public AjaxResult healthy(@PathVariable String outId) { + return AjaxResult.success(iSysWapServices.getHealthyDataByOutId(outId)); + } + + @GetMapping(value = "/recipes/menu/{id}") + public AjaxResult dayilyMenu(@PathVariable Long id) { + return AjaxResult.success(iSysRecipesService.selectDishesByMenuId(id)); + } +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesDetail.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesDetail.java new file mode 100644 index 000000000..b640c807a --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesDetail.java @@ -0,0 +1,12 @@ +package com.stdiet.custom.domain; + +import lombok.Data; + +import java.util.List; + +@Data +public class SysRecipesDetail { + + private List plans; + +} 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 4892c8d31..3251d3bc7 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,12 +1,10 @@ package com.stdiet.custom.domain; -import java.util.Date; import com.fasterxml.jackson.annotation.JsonFormat; -import lombok.Data; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; import com.stdiet.common.annotation.Excel; -import com.stdiet.common.core.domain.BaseEntity; +import lombok.Data; + +import java.util.Date; /** * 食谱计划对象 sys_recipes_plan @@ -15,14 +13,16 @@ import com.stdiet.common.core.domain.BaseEntity; * @date 2021-01-15 */ @Data -public class SysRecipesPlan extends BaseEntity -{ - private static final long serialVersionUID = 1L; +public class SysRecipesPlan { - /** $column.columnComment */ + /** + * $column.columnComment + */ private Long id; - /** 订单ID */ + /** + * 订单ID + */ //@Excel(name = "订单ID") private Long orderId; @@ -46,12 +46,16 @@ public class SysRecipesPlan extends BaseEntity //处理过的客户手机号 private String hidePhone; - /** 食谱开始日期 */ + /** + * 食谱开始日期 + */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "食谱开始日期", width = 30, dateFormat = "yyyy-MM-dd") private Date startDate; - /** 食谱结束日期 */ + /** + * 食谱结束日期 + */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "食谱结束日期", width = 30, dateFormat = "yyyy-MM-dd") private Date endDate; @@ -78,19 +82,54 @@ public class SysRecipesPlan extends BaseEntity @Excel(name = "营养师助理") private String nutritionistAssis; - /** 食谱ID */ + /** + * 食谱ID + */ //@Excel(name = "食谱ID") private Long recipesId; - /** 食谱是否发送,0未发送 1已发送 */ - @Excel(name = "食谱是否发送", readConverterExp="0=未发送,1=已发送") + /** + * 食谱是否发送,0未发送 1已发送 + */ + @Excel(name = "食谱是否发送", readConverterExp = "0=未发送,1=已发送") private Integer sendFlag; - /** 食谱发送时间 */ + /** + * 食谱发送时间 + */ @JsonFormat(pattern = "yyyy-MM-dd") @Excel(name = "食谱发送时间", width = 30, dateFormat = "yyyy-MM-dd") private Date sendTime; - /** 删除标识 0未删除 1已删除 默认0 */ + /** + * 删除标识 0未删除 1已删除 默认0 + */ private Integer delFlag; + + /** + * 审核标识 0未审核 1已审核 默认0 + */ + private Integer reviewStatus; + + /** + * 创建者 + */ + private String createBy; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + + /** + * 更新者 + */ + private String updateBy; + + /** + * 更新时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlanListInfo.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlanListInfo.java new file mode 100644 index 000000000..f82fd751b --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysRecipesPlanListInfo.java @@ -0,0 +1,26 @@ +package com.stdiet.custom.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +@Data +public class SysRecipesPlanListInfo { + + private Long id; + + @JsonFormat(pattern = "yyyy-MM-dd") + private Date startDate; + + @JsonFormat(pattern = "yyyy-MM-dd") + private Date endDate; + + private Integer startNumDay; + + private Integer endNumDay; + + private List menus; + +} 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 b97792625..da961cc3e 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 @@ -25,4 +25,6 @@ public interface SysRecipesMapper { public int addDishes(SysRecipesDailyDishes sysRecipesDaily); public int deleteDishes(Long id); + + public List selectDishesByMenuId(Long id); } 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 97290f477..9cdcd751f 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 @@ -2,6 +2,7 @@ package com.stdiet.custom.mapper; import java.util.List; import com.stdiet.custom.domain.SysRecipesPlan; +import com.stdiet.custom.domain.SysRecipesPlanListInfo; /** * 食谱计划Mapper接口 @@ -86,4 +87,10 @@ public interface SysRecipesPlanMapper * @return */ List selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan); + + List selectPlanListByOutId(String outId); + + Long getCusIdByOutId(String outId); + + List selectRecipesPlanListInfo(String outId); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java index fae82ddcd..c88766acf 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerService.java @@ -1,6 +1,8 @@ package com.stdiet.custom.service; import java.util.List; +import java.util.Map; + import com.stdiet.custom.domain.SysCustomer; import com.stdiet.custom.dto.request.CustomerInvestigateRequest; @@ -74,4 +76,9 @@ public interface ISysCustomerService * @return */ boolean isCustomerExistByPhone(SysCustomer sysCustomer); + + Map getPhysicalSignsById(Long id); + + Map getPhysicalSignsByOutId(String id); + } \ No newline at end of file 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 c0b66280b..0f333c918 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 @@ -4,6 +4,7 @@ import java.util.List; import com.stdiet.custom.domain.SysOrder; import com.stdiet.custom.domain.SysRecipesPlan; +import com.stdiet.custom.domain.SysRecipesPlanListInfo; import org.springframework.core.annotation.Order; /** @@ -90,5 +91,10 @@ public interface ISysRecipesPlanService */ List selectPlanListByOrderId(SysRecipesPlan sysRecipesPlan); - public void myGenerateRecipesPlan(SysOrder sysOrder); + List selectPlanListByOutId(String outId); + + Long getCusIdByOutId(String outId); + + List selectRecipesPlanListInfo(String outId); + } \ No newline at end of file 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 b23c9b81c..54b7805a2 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 @@ -12,9 +12,12 @@ public interface ISysRecipesService { public List selectSysRecipesByRecipesId(Long id); + public List selectDishesByMenuId(Long id); + public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDaily); public int addDishes(SysRecipesDailyDishes sysRecipesDaily); public int deleteDishes(Long id); + } diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWapServices.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWapServices.java new file mode 100644 index 000000000..2d680229c --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysWapServices.java @@ -0,0 +1,13 @@ +package com.stdiet.custom.service; + +import com.stdiet.custom.domain.SysRecipesPlanListInfo; + +import java.util.List; +import java.util.Map; + +public interface ISysWapServices { + + List getRecipesPlanListInfo(String outId); + + Map getHealthyDataByOutId(String outId); +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java index a3e7c2694..d4e9a85e6 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerServiceImpl.java @@ -1,22 +1,22 @@ package com.stdiet.custom.service.impl; -import java.util.List; - -import com.stdiet.common.core.domain.model.LoginUser; import com.stdiet.common.utils.DateUtils; -import com.stdiet.common.utils.SecurityUtils; import com.stdiet.common.utils.StringUtils; -import com.stdiet.common.utils.bean.ObjectUtils; +import com.stdiet.common.utils.sign.AesUtils; +import com.stdiet.custom.domain.SysCustomer; +import com.stdiet.custom.domain.SysCustomerHealthy; import com.stdiet.custom.domain.SysCustomerPhysicalSigns; -import com.stdiet.custom.dto.request.CustomerInvestigateRequest; +import com.stdiet.custom.mapper.SysCustomerMapper; import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper; +import com.stdiet.custom.service.ISysCustomerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.stdiet.custom.mapper.SysCustomerMapper; -import com.stdiet.custom.domain.SysCustomer; -import com.stdiet.custom.service.ISysCustomerService; import org.springframework.transaction.annotation.Transactional; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * 客户信息Service业务层处理 * @@ -25,14 +25,19 @@ import org.springframework.transaction.annotation.Transactional; */ @Service @Transactional -public class SysCustomerServiceImpl implements ISysCustomerService -{ +public class SysCustomerServiceImpl implements ISysCustomerService { @Autowired private SysCustomerMapper sysCustomerMapper; @Autowired private SysCustomerPhysicalSignsMapper sysCustomerPhysicalSignsMapper; + @Autowired + private SysCustomerHealthyServiceImpl sysCustomerHealthyService; + + @Autowired + private SysCustomerPhysicalSignsServiceImpl sysCustomerPhysicalSignsService; + /** * 查询客户信息 * @@ -40,8 +45,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService * @return 客户信息 */ @Override - public SysCustomer selectSysCustomerById(Long id) - { + public SysCustomer selectSysCustomerById(Long id) { return sysCustomerMapper.selectSysCustomerById(id); } @@ -52,8 +56,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService * @return 客户信息 */ @Override - public List selectSysCustomerList(SysCustomer sysCustomer) - { + public List selectSysCustomerList(SysCustomer sysCustomer) { return sysCustomerMapper.selectSysCustomerList(sysCustomer); } @@ -64,8 +67,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService * @return 结果 */ @Override - public int insertSysCustomer(SysCustomer sysCustomer) - { + public int insertSysCustomer(SysCustomer sysCustomer) { sysCustomer.setCreateTime(DateUtils.getNowDate()); return sysCustomerMapper.insertSysCustomer(sysCustomer); } @@ -77,8 +79,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService * @return 结果 */ @Override - public int updateSysCustomer(SysCustomer sysCustomer) - { + public int updateSysCustomer(SysCustomer sysCustomer) { sysCustomer.setUpdateTime(DateUtils.getNowDate()); return sysCustomerMapper.updateSysCustomer(sysCustomer); } @@ -90,8 +91,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService * @return 结果 */ @Override - public int deleteSysCustomerByIds(Long[] ids) - { + public int deleteSysCustomerByIds(Long[] ids) { return sysCustomerMapper.deleteSysCustomerByIds(ids); } @@ -102,8 +102,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService * @return 结果 */ @Override - public int deleteSysCustomerById(Long id) - { + public int deleteSysCustomerById(Long id) { return sysCustomerMapper.deleteSysCustomerById(id); } @@ -113,26 +112,60 @@ public class SysCustomerServiceImpl implements ISysCustomerService * @param phone 手机号 * @return 结果 */ - public SysCustomer getCustomerByPhone(String phone){ + public SysCustomer getCustomerByPhone(String phone) { return sysCustomerMapper.getCustomerByPhone(phone); } /** * 判断客户手机号是否已存在 + * * @param sysCustomer * @return */ - public boolean isCustomerExistByPhone(SysCustomer sysCustomer){ - if(sysCustomer.getId() != null){ - if(StringUtils.isNotEmpty(sysCustomer.getPhone())){ + public boolean isCustomerExistByPhone(SysCustomer sysCustomer) { + if (sysCustomer.getId() != null) { + if (StringUtils.isNotEmpty(sysCustomer.getPhone())) { SysCustomer phoneCustomer = getCustomerByPhone(sysCustomer.getPhone()); return phoneCustomer != null && phoneCustomer.getId().intValue() != sysCustomer.getId().intValue(); } - }else{ - if(StringUtils.isNotEmpty(sysCustomer.getPhone())){ + } else { + if (StringUtils.isNotEmpty(sysCustomer.getPhone())) { return getCustomerByPhone(sysCustomer.getPhone()) != null; } } return false; } + + @Override + public Map getPhysicalSignsById(Long id) { + Map result = new HashMap<>(); + String key = "customerHealthy"; + result.put("type", 0); + //查询健康评估信息 + SysCustomerHealthy sysCustomerHealthy = sysCustomerHealthyService.selectSysCustomerHealthyByCustomerId(id); + if (sysCustomerHealthy != null) { + /* if (StringUtils.isNotEmpty(sysCustomerHealthy.getPhone())) { + sysCustomerHealthy.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerHealthy.getPhone())); + }*/ + result.put(key, sysCustomerHealthy); + } else { + //查询体征信息 + SysCustomerPhysicalSigns sysCustomerPhysicalSigns = sysCustomerPhysicalSignsService.selectSysCustomerPhysicalSignsByCusId(id); + if (sysCustomerPhysicalSigns != null) { + /* if (StringUtils.isNotEmpty(sysCustomerPhysicalSigns.getPhone())) { + sysCustomerPhysicalSigns.setPhone(StringUtils.hiddenPhoneNumber(sysCustomerPhysicalSigns.getPhone())); + }*/ + result.put("type", 1); + } + result.put(key, sysCustomerPhysicalSigns); + } + //对ID进行加密 + result.put("enc_id", id != null ? AesUtils.encrypt(id + "", null) : ""); + return result; + } + + @Override + public Map getPhysicalSignsByOutId(String id) { + return null; + } } \ No newline at end of file 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 08e1d689e..49df25d1c 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 @@ -5,6 +5,7 @@ import com.stdiet.common.utils.SynchrolockUtil; import com.stdiet.custom.domain.SysOrder; import com.stdiet.custom.domain.SysOrderPause; import com.stdiet.custom.domain.SysRecipesPlan; +import com.stdiet.custom.domain.SysRecipesPlanListInfo; import com.stdiet.custom.mapper.SysRecipesPlanMapper; import com.stdiet.custom.service.ISysOrderPauseService; import com.stdiet.custom.service.ISysOrderService; @@ -293,7 +294,18 @@ public class SysRecipesPlanServiceImpl implements ISysRecipesPlanService { } @Override - public void myGenerateRecipesPlan(SysOrder sysOrder) { - + public List selectPlanListByOutId(String outId) { + return sysRecipesPlanMapper.selectPlanListByOutId(outId); } + + @Override + public Long getCusIdByOutId(String outId) { + return sysRecipesPlanMapper.getCusIdByOutId(outId); + } + + @Override + public List selectRecipesPlanListInfo(String outId) { + return sysRecipesPlanMapper.selectRecipesPlanListInfo(outId); + } + } \ No newline at end of file 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 5b583ff03..34e0ddb24 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 @@ -65,6 +65,11 @@ public class SysRecipesServiceImpl implements ISysRecipesService { return sysRecipesMapper.selectSysRecipesByRecipesId(id); } + @Override + public List selectDishesByMenuId(Long id) { + return sysRecipesMapper.selectDishesByMenuId(id); + } + @Override public int updateDishesDetail(SysRecipesDailyDishes sysRecipesDailyDishes) { return sysRecipesMapper.updateDishesDetail(sysRecipesDailyDishes); diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWapServicesImp.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWapServicesImp.java new file mode 100644 index 000000000..785d57615 --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysWapServicesImp.java @@ -0,0 +1,39 @@ +package com.stdiet.custom.service.impl; + +import com.stdiet.common.utils.StringUtils; +import com.stdiet.custom.domain.SysRecipesPlan; +import com.stdiet.custom.domain.SysRecipesPlanListInfo; +import com.stdiet.custom.service.ISysCustomerService; +import com.stdiet.custom.service.ISysRecipesPlanService; +import com.stdiet.custom.service.ISysWapServices; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +@Service +@Transactional +public class SysWapServicesImp implements ISysWapServices { + + @Autowired + ISysCustomerService iSysCustomerService; + + @Autowired + ISysRecipesPlanService iSysRecipesPlanService; + + @Override + public List getRecipesPlanListInfo(String outId) { + return iSysRecipesPlanService.selectRecipesPlanListInfo(outId); + } + + @Override + public Map getHealthyDataByOutId(String outId) { + Long cusId = iSysRecipesPlanService.getCusIdByOutId(outId); + if(cusId > 0) { + return iSysCustomerService.getPhysicalSignsById(cusId); + } + return null; + } +} diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml index 05904355f..ce4ece5b7 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysRecipesPlanMapper.xml @@ -24,6 +24,7 @@ + @@ -32,8 +33,10 @@ + + - select id, order_id, cus_id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, send_time, create_time, create_by, update_time, update_by, del_flag from sys_recipes_plan + select id, order_id, cus_id, start_date, end_date, start_num_day, end_num_day, recipes_id, send_flag, send_time, create_time, create_by, update_time, update_by, del_flag, review_status from sys_recipes_plan + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java b/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java index 32f8b94bd..603828f51 100644 --- a/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java +++ b/stdiet-framework/src/main/java/com/stdiet/framework/config/SecurityConfig.java @@ -102,6 +102,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { "/custom/wxUserInfo/wx/**", "/custom/wxUserLog/wx/**", "/wx/**", + "/wap/**", "/investigate/**", "/common/customerUploadFile" ).anonymous() diff --git a/stdiet-ui/src/api/custom/contract.js b/stdiet-ui/src/api/custom/contract.js index 31881d27c..d07cde417 100644 --- a/stdiet-ui/src/api/custom/contract.js +++ b/stdiet-ui/src/api/custom/contract.js @@ -1,68 +1,74 @@ -import request from '@/utils/request' +import request from "@/utils/request"; // 查询合同列表 export function listContract(query) { return request({ - url: '/custom/contract/list', - method: 'get', + url: "/custom/contract/list", + method: "get", params: query - }) + }); } // 查询合同详细 export function getContract(id) { return request({ - url: '/custom/contract/' + id, - method: 'get' - }) + url: "/custom/contract/" + id, + method: "get" + }); } // 新增合同 export function addContract(data) { return request({ - url: '/custom/contract', - method: 'post', + url: "/custom/contract", + method: "post", data: data - }) + }); } // 修改合同 export function updateContract(data) { return request({ - url: '/custom/contract', - method: 'put', + url: "/custom/contract", + method: "put", data: data - }) + }); } // 删除合同 export function delContract(id) { return request({ - url: '/custom/contract/' + id, - method: 'delete' - }) + url: "/custom/contract/" + id, + method: "delete" + }); } // 导出合同 export function exportContract(query) { return request({ - url: '/custom/contract/export', - method: 'get', + url: "/custom/contract/export", + method: "get", params: query - }) + }); } export function getFile(id) { return request({ - url: '/custom/contract/file/' + id, - method: 'get', - }) + url: "/custom/contract/file/" + id, + method: "get", + headers: { + isToken: false + } + }); } export function signContract(data) { return request({ - url: '/custom/contract/sign', - method: 'post', - data: data - }) + url: "/custom/contract/sign", + method: "post", + data: data, + headers: { + isToken: false + } + }); } diff --git a/stdiet-ui/src/api/custom/recipesShow.js b/stdiet-ui/src/api/custom/recipesShow.js new file mode 100644 index 000000000..ecdd3523e --- /dev/null +++ b/stdiet-ui/src/api/custom/recipesShow.js @@ -0,0 +1,31 @@ +import request from "@/utils/request"; + +export function getRecipesPlans(id) { + return request({ + url: "/wap/recipes/plans/" + id, + method: "get", + headers: { + isToken: false + } + }); +} + +export function getHealthyInfo(id) { + return request({ + url: "/wap/healthyInfo/" + id, + method: "get", + headers: { + isToken: false + } + }); +} + +export function getRecipesMenuInfoApi(id) { + return request({ + url: "/wap/recipes/menu/" + id, + method: "get", + headers: { + isToken: false + } + }); +} diff --git a/stdiet-ui/src/views/custom/recipesBuild/BodySignView.vue b/stdiet-ui/src/components/BodySignView/index.vue similarity index 100% rename from stdiet-ui/src/views/custom/recipesBuild/BodySignView.vue rename to stdiet-ui/src/components/BodySignView/index.vue diff --git a/stdiet-ui/src/views/custom/recipesBuild/HealthyView.vue b/stdiet-ui/src/components/HealthyView/index.vue similarity index 100% rename from stdiet-ui/src/views/custom/recipesBuild/HealthyView.vue rename to stdiet-ui/src/components/HealthyView/index.vue diff --git a/stdiet-ui/src/permission.js b/stdiet-ui/src/permission.js index c1c9875bb..41a8e5ba6 100644 --- a/stdiet-ui/src/permission.js +++ b/stdiet-ui/src/permission.js @@ -1,43 +1,52 @@ -import router from './router' -import store from './store' -import {Message} from 'element-ui' -import NProgress from 'nprogress' -import 'nprogress/nprogress.css' -import {getToken} from '@/utils/auth' +import router from "./router"; +import store from "./store"; +import { Message } from "element-ui"; +import NProgress from "nprogress"; +import "nprogress/nprogress.css"; +import { getToken } from "@/utils/auth"; -NProgress.configure({showSpinner: false}) +NProgress.configure({ showSpinner: false }); -const whiteList = ['/login', '/auth-redirect', '/bind', '/register', '/question', '/subhealthyInvestigation'] +const whiteList = [ + "/login", + "/auth-redirect", + "/bind", + "/register", + "/question", + "/subhealthyInvestigation" +]; router.beforeEach((to, from, next) => { - NProgress.start() + NProgress.start(); if (getToken()) { /* has token*/ - if (to.path === '/login') { - next({path: '/'}) - NProgress.done() + if (to.path === "/login") { + next({ path: "/" }); + NProgress.done(); } else { if (store.getters.roles.length === 0) { // 判断当前用户是否已拉取完user_info信息 - store.dispatch('GetInfo').then(res => { - // 拉取user_info - const roles = res.roles - store.dispatch('GenerateRoutes', {roles}).then(accessRoutes => { - // 测试 默认静态页面 - // store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => { - // 根据roles权限生成可访问的路由表 - router.addRoutes(accessRoutes) // 动态添加可访问路由表 - next({...to, replace: true}) // hack方法 确保addRoutes已完成 + store + .dispatch("GetInfo") + .then(res => { + // 拉取user_info + const roles = res.roles; + store.dispatch("GenerateRoutes", { roles }).then(accessRoutes => { + // 测试 默认静态页面 + // store.dispatch('permission/generateRoutes', { roles }).then(accessRoutes => { + // 根据roles权限生成可访问的路由表 + router.addRoutes(accessRoutes); // 动态添加可访问路由表 + next({ ...to, replace: true }); // hack方法 确保addRoutes已完成 + }); }) - }) .catch(err => { - store.dispatch('FedLogOut').then(() => { - Message.error(err) - next({path: '/'}) - }) - }) + store.dispatch("FedLogOut").then(() => { + Message.error(err); + next({ path: "/" }); + }); + }); } else { - next() + next(); // 没有动态改变权限的需求可直接next() 删除下方权限判断 ↓ // if (hasPermission(store.getters.roles, to.meta.roles)) { // next() @@ -49,17 +58,22 @@ router.beforeEach((to, from, next) => { } } else { // 没有token - if (whiteList.indexOf(to.path) !== -1 || to.path.startsWith('/f/contract/') || to.path.startsWith('/subhealthyInvestigation/') - || to.path.startsWith('/foodHeatCalculator/')) { + if ( + whiteList.indexOf(to.path) !== -1 || + to.path.startsWith("/f/contract/") || + to.path.startsWith("/recipes/detail/") || + to.path.startsWith("/subhealthyInvestigation/") || + to.path.startsWith("/foodHeatCalculator/") + ) { // 在免登录白名单,直接进入 - next() + next(); } else { - next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页 - NProgress.done() + next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页 + NProgress.done(); } } -}) +}); router.afterEach(() => { - NProgress.done() -}) + NProgress.done(); +}); diff --git a/stdiet-ui/src/router/index.js b/stdiet-ui/src/router/index.js index fea245cae..3437271be 100644 --- a/stdiet-ui/src/router/index.js +++ b/stdiet-ui/src/router/index.js @@ -146,6 +146,13 @@ export const constantRoutes = [ meta: { title: "食谱制作" }, hidden: true }, + { + path: "/recipes/detail/:id", + component: resolve => require(["@/views/custom/recipesShow"], resolve), + props: true, + meta: { title: "健康食谱" }, + hidden: true + }, { path: "/f/contract/:id(\\d+)", hidden: true, diff --git a/stdiet-ui/src/store/modules/recipes.js b/stdiet-ui/src/store/modules/recipes.js index 4311492bd..f8804023e 100644 --- a/stdiet-ui/src/store/modules/recipes.js +++ b/stdiet-ui/src/store/modules/recipes.js @@ -20,7 +20,6 @@ const oriState = { recipesDataLoading: false, cusUnitOptions: [], cusWeightOptions: [], - dishesTypeOptions: [], typeOptions: [], currentDay: -1, startNum: 0, @@ -87,9 +86,6 @@ const actions = { getDicts("cus_dishes_type").then(response => { commit("updateStateData", { typeOptions: response.data }); }); - getDicts("cus_dishes_type").then(response => { - commit("updateStateData", { dishesTypeOptions: response.data }); - }); // 健康数据 if (payload.cusId) { diff --git a/stdiet-ui/src/views/custom/dishes/index.vue b/stdiet-ui/src/views/custom/dishes/index.vue index e7121530b..20b2ea3a7 100644 --- a/stdiet-ui/src/views/custom/dishes/index.vue +++ b/stdiet-ui/src/views/custom/dishes/index.vue @@ -290,14 +290,14 @@ /> - + - + - - - + + diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/BarChart.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/BarChart.vue index 32bb1b6b3..91fd440ad 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/BarChart.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/BarChart.vue @@ -87,7 +87,7 @@ export default { `${seriesName.substring(0, 1)}Weight` ].toFixed(1); arr.push( - `${cur.marker} ${nutriName}:${heatVal}千卡(${weightVal}克)` + `${cur.marker} ${nutriName}:${weightVal}克(${heatVal}千卡)` ); return arr; }, @@ -110,7 +110,7 @@ export default { source, }, grid: { - top: 40, + top: 55, left: 20, right: 20, bottom: 10, @@ -121,6 +121,10 @@ export default { }, yAxis: { type: "value", + name: "热量(千卡)", + nameTextStyle: { + color: "#262626", + }, }, series: ["pHeat", "fHeat", "cHeat"].map((dim, idx) => ({ name: dim, diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/PieChart.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/PieChart.vue index ae5739f8e..b2dceb9ca 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/PieChart.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesAspectCom/PieChart.vue @@ -14,25 +14,14 @@ class="small_table" > - - - + + + +
+
总热量约等于
+
{{ totalHeat.toFixed(1) }}千卡
+
@@ -69,35 +58,37 @@ export default { data() { return { chart: null, + totalHeat: 0, nameDict: { p: "蛋白质", f: "脂肪", c: "碳水", }, + typeDict: { + Weight: "摄入量", + Rate: "供能比", + }, }; }, computed: { mData() { const [data] = this.data; - let totalHeat = 0; - return data - ? ["p", "f", "c"].map((type) => { - if (totalHeat === 0) { - totalHeat = ["p", "f", "c"].reduce((heat, cur) => { - heat += data[`${cur}Heat`]; - return heat; - }, 0); - } - return { - type: this.nameDict[type], - weight: data[`${type}Weight`].toFixed(1), - heat: data[`${type}Heat`].toFixed(1), - heatRate: `${((data[`${type}Heat`] / totalHeat) * 100).toFixed( - 2 - )}%`, - }; - }) - : []; + if (!data) { + this.totalHeat = 0; + return []; + } + this.totalHeat = data.cHeat + data.fHeat + data.pHeat; + const mData = ["Weight", "Rate"].map((t, idx) => ({ + type: this.typeDict[t], + ...["p", "f", "c"].reduce((obj, cur) => { + obj[cur] = idx + ? `${((data[`${cur}Heat`] / this.totalHeat) * 100).toFixed(2)}%` + : `${data[`${cur}Weight`].toFixed(1)}克`; + return obj; + }, {}), + })); + console.log(mData); + return mData; }, }, mounted() { @@ -121,10 +112,10 @@ export default { this.chart.clear(); this.chart.setOption({ title: { - text: `${data.name}营养统计`, + text: `${data.name}营养分析`, }, tooltip: { - position: 'right', + position: "right", trigger: "item", appendToBody: true, formatter: (params) => { @@ -136,9 +127,9 @@ export default { } = params; return [ `${marker} ${name}`, - `含量:${oriData[`${dim}Weight`].toFixed(1)}克`, - `热量:${value.toFixed(1)}千卡`, - `热量占比:${percent}%`, + `摄入量:${oriData[`${dim}Weight`].toFixed(1)}克`, + `摄入热量:${value.toFixed(1)}千卡`, + `供能比:${percent}%`, ].join("
"); }, }, @@ -199,5 +190,17 @@ export default { } } // } + + .summary { + padding: 2px; + border-bottom: 1px solid #dfe6ec; + border-left: 1px solid #dfe6ec; + border-right: 1px solid #dfe6ec; + + & > div { + padding: 3px; + text-align: center; + } + } } diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/index.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/index.vue index 67d4885d9..284353565 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/index.vue @@ -24,7 +24,7 @@ @@ -65,7 +65,7 @@ export default { return { visible: false, active: 0, - typeOptions: [], + dishesTypeOptions: [], selDishes: { name: "", type: "", @@ -76,7 +76,7 @@ export default { }; }, computed: { - ...mapState(["dishesTypeOptions"]), + ...mapState(["typeOptions"]), }, methods: { showDrawer() { @@ -95,11 +95,11 @@ export default { // console.log(data); this.selDishes = data; this.active = 1; - this.typeOptions = data.type.split(",").reduce((arr, cur, idx) => { + this.dishesTypeOptions = data.type.split(",").reduce((arr, cur, idx) => { if (idx === 0) { this.selDishes.type = cur; } - const tarOpt = this.dishesTypeOptions.find( + const tarOpt = this.typeOptions.find( (obj) => obj.dictValue === cur ); if (tarOpt) { diff --git a/stdiet-ui/src/views/custom/recipesBuild/index.vue b/stdiet-ui/src/views/custom/recipesBuild/index.vue index d2184f2b4..9a557b1e3 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/index.vue @@ -24,8 +24,8 @@ const { mapGetters, } = createNamespacedHelpers("recipes"); -import HealthyView from "./HealthyView"; -import BodySignView from "./BodySignView"; +import HealthyView from "@/components/HealthyView"; +import BodySignView from "@/components/BodySignView"; import RecipesView from "./RecipesView/index"; import RecommondView from "./RecommondView"; diff --git a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/DishesDetailDialog/index.vue b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/DishesDetailDialog/index.vue new file mode 100644 index 000000000..eb955493e --- /dev/null +++ b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/DishesDetailDialog/index.vue @@ -0,0 +1,87 @@ + + + + diff --git a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/NutriComputeCom/index.vue b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/NutriComputeCom/index.vue new file mode 100644 index 000000000..cff52f37c --- /dev/null +++ b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/NutriComputeCom/index.vue @@ -0,0 +1,159 @@ + + + diff --git a/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue new file mode 100644 index 000000000..17d7741f1 --- /dev/null +++ b/stdiet-ui/src/views/custom/recipesShow/MenuDetail/index.vue @@ -0,0 +1,141 @@ + + + diff --git a/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/index.vue b/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/index.vue new file mode 100644 index 000000000..1a6cf3d92 --- /dev/null +++ b/stdiet-ui/src/views/custom/recipesShow/PlanDrawer/index.vue @@ -0,0 +1,120 @@ + + + + + diff --git a/stdiet-ui/src/views/custom/recipesShow/UserInfoDrawer/index.vue b/stdiet-ui/src/views/custom/recipesShow/UserInfoDrawer/index.vue new file mode 100644 index 000000000..bc8e392b1 --- /dev/null +++ b/stdiet-ui/src/views/custom/recipesShow/UserInfoDrawer/index.vue @@ -0,0 +1,84 @@ + + + diff --git a/stdiet-ui/src/views/custom/recipesShow/index.vue b/stdiet-ui/src/views/custom/recipesShow/index.vue new file mode 100644 index 000000000..7f4a37f14 --- /dev/null +++ b/stdiet-ui/src/views/custom/recipesShow/index.vue @@ -0,0 +1,161 @@ + + + diff --git a/stdiet-ui/src/views/custom/recipesShow/utils.js b/stdiet-ui/src/views/custom/recipesShow/utils.js new file mode 100644 index 000000000..14c1e5943 --- /dev/null +++ b/stdiet-ui/src/views/custom/recipesShow/utils.js @@ -0,0 +1,42 @@ +export function getProcessMenuData(menuData) { + return menuData.reduce((arr, cur) => { + if ( + cur.dishesId > -1 && + cur.name && + cur.igdList.length > 0 && + cur.type !== "0" + ) { + arr.push({ + id: cur.id, + dishesId: cur.dishesId, + name: cur.name, + menuId: cur.menuId, + methods: cur.methods, + type: cur.type, + isMain: cur.isMain, + igdList: cur.igdList.reduce((igdArr, igdData) => { + if (igdData.id > 0) { + const tarDetail = cur.detail.find(obj => obj.id === igdData.id); + igdArr.push({ + id: igdData.id, + name: igdData.name, + carbonRatio: igdData.carbonRatio, + fatRatio: igdData.fatRatio, + proteinRatio: igdData.proteinRatio, + cusUnit: tarDetail ? tarDetail.cus_unit : igdData.cusUnit, + cusWeight: tarDetail + ? parseFloat(tarDetail.cus_weight) + : igdData.cusWeight, + weight: tarDetail ? parseFloat(tarDetail.weight) : igdData.weight, + notRec: igdData.notRec, + rec: igdData.rec, + type: igdData.type + }); + } + return igdArr; + }, []) + }); + } + return arr; + }, []); +} diff --git a/stdiet-ui/src/views/custom/subhealthy/investigation/index.vue b/stdiet-ui/src/views/custom/subhealthy/investigation/index.vue index 3e1455941..4798dfc6f 100644 --- a/stdiet-ui/src/views/custom/subhealthy/investigation/index.vue +++ b/stdiet-ui/src/views/custom/subhealthy/investigation/index.vue @@ -1,33 +1,71 @@