From ace01ae9fd7476ef7f2d29627cbd8e530970a5cd Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Wed, 28 May 2025 15:38:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=8C=87=E5=AE=9A=E6=97=A5?= =?UTF-8?q?=E6=9C=9F=E8=8F=9C=E8=B0=B1=E8=AE=A1=E5=88=92=E8=8F=9C=E5=93=81?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cook/controller/CookRecipeController.java | 11 ++- .../core/cook/mapper/CookRecipeMapper.java | 5 ++ .../core/cook/service/ICookRecipeService.java | 4 + .../service/impl/CookRecipeServiceImpl.java | 8 ++ .../core/cook/vo/CookRecipeDetailVO.java | 67 +++++++++++++++ .../core/cook/vo/CookRecipeDishesVO.java | 81 +++++++++++++++++++ .../mapper/cook/CookRecipeMapper.xml | 34 ++++++++ 7 files changed, 209 insertions(+), 1 deletion(-) create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDetailVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDishesVO.java diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeController.java index 4331ff1..e733f88 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeController.java @@ -2,8 +2,9 @@ package com.bonus.canteen.core.cook.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; - import com.bonus.canteen.core.cook.dto.CookRecipeDTO; +import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO; +import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO; import com.bonus.common.log.enums.OperaType; //import com.bonus.canteen.core.cook.common.annotation.PreventRepeatSubmit; import io.swagger.annotations.Api; @@ -75,6 +76,14 @@ public class CookRecipeController extends BaseController { return success(cookRecipeService.selectCookRecipeByRecipeId(recipeId)); } + @ApiOperation("获取指定日期菜谱计划菜品详情") + //@RequiresPermissions("cook:recipe:query") + @PostMapping({"/getRecipeDetailByDate"}) + public AjaxResult getRecipeDetailByDate(@RequestBody CookRecipeDetailDTO dto) { + List list = cookRecipeService.getRecipeDetailByDate(dto); + return success(list); + } + /** * 新增菜品计划信息 */ diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java index f88e08f..d550f75 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java @@ -1,8 +1,11 @@ package com.bonus.canteen.core.cook.mapper; +import java.time.LocalDate; import java.util.List; import com.bonus.canteen.core.cook.domain.CookRecipe; import com.bonus.canteen.core.cook.dto.CookRecipeDTO; +import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO; +import org.apache.ibatis.annotations.Param; /** * 菜品计划信息Mapper接口 @@ -33,6 +36,8 @@ public interface CookRecipeMapper { public int getDishesCount4Recycle(Long recipeId); + List selectRecipeDetailList(@Param("recipeId") Long recipeId, @Param("applyDate") LocalDate applyDate); + /** * 新增菜品计划信息 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeService.java index 1181ed2..00e097d 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeService.java @@ -3,6 +3,8 @@ package com.bonus.canteen.core.cook.service; import java.util.List; import com.bonus.canteen.core.cook.domain.CookRecipe; import com.bonus.canteen.core.cook.dto.CookRecipeDTO; +import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO; +import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO; /** * 菜品计划信息Service接口 @@ -27,6 +29,8 @@ public interface ICookRecipeService { */ public List selectCookRecipeList(CookRecipe cookRecipe); + public List getRecipeDetailByDate(CookRecipeDetailDTO dto); + /** * 新增菜品计划信息 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java index 07180aa..6c46696 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java @@ -12,6 +12,7 @@ import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO; import com.bonus.canteen.core.cook.dto.CookRecipeDishesDTO; import com.bonus.canteen.core.cook.mapper.CookRecipeDetailMapper; import com.bonus.canteen.core.cook.mapper.CookRecipeDishesMapper; +import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.security.utils.SecurityUtils; @@ -75,6 +76,13 @@ public class CookRecipeServiceImpl implements ICookRecipeService { return list; } + @Override + public List getRecipeDetailByDate(CookRecipeDetailDTO dto) { + //this.generateRecipe(dto.getRecipeId(), dto.getApplyDate()); + List menuRecipeDetails = cookRecipeMapper.selectRecipeDetailList(dto.getRecipeId(), dto.getApplyDate()); + return menuRecipeDetails.stream().sorted(Comparator.comparing(CookRecipeDetailVO::getMealtimeType)).collect(Collectors.toList()); + } + /** * 新增菜品计划信息 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDetailVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDetailVO.java new file mode 100644 index 0000000..aa9aea8 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDetailVO.java @@ -0,0 +1,67 @@ +package com.bonus.canteen.core.cook.vo; + +import com.bonus.canteen.core.cook.dto.CookRecipeDishesDTO; +import com.bonus.common.core.annotation.Excel; +import com.bonus.common.core.web.domain.BaseEntity; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +import java.time.LocalDate; +import java.util.List; + +/** + * 菜品计划详情信息对象 cook_recipe_detail + * + * @author xsheng + * @date 2025-05-25 + */ + + +@Data +@ToString +public class CookRecipeDetailVO extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 菜谱详情id */ + private Long recipeDetailId; + + /** 菜品计划销售类别id(数据同步) */ + @Excel(name = "菜品计划销售类别id(数据同步)") + @ApiModelProperty(value = "菜品计划销售类别id(数据同步)") + private String saleTypeId; + + /** 菜谱id */ + @Excel(name = "菜谱id") + @ApiModelProperty(value = "菜谱id") + private Long recipeId; + + /** 启用时间(天) */ + @ApiModelProperty(value = "启用时间(天)") + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "启用时间(天)", width = 30, dateFormat = "yyyy-MM-dd") + private LocalDate applyDate; + + /** 启用时间(周) */ + @Excel(name = "启用时间(周)") + @ApiModelProperty(value = "启用时间(周)") + private Long applyWeek; + + /** 启用时间(月) */ + @Excel(name = "启用时间(月)") + @ApiModelProperty(value = "启用时间(月)") + private Long applyMonth; + + /** 餐次类型 */ + @Excel(name = "餐次类型") + @ApiModelProperty(value = "餐次类型") + private Long mealtimeType; + + /** 详情类型(1-模板,2-详情) */ + @Excel(name = "详情类型(1-模板,2-详情)") + @ApiModelProperty(value = "详情类型(1-模板,2-详情)") + private Long detailType; + + private List dishesList; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDishesVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDishesVO.java new file mode 100644 index 0000000..ddb97ae --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDishesVO.java @@ -0,0 +1,81 @@ +package com.bonus.canteen.core.cook.vo; + +import com.bonus.common.core.annotation.Excel; +import com.bonus.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; + +/** + * 菜品计划菜品关联对象 cook_recipe_dishes + * + * @author xsheng + * @date 2025-05-25 + */ + + +@Data +@ToString +public class CookRecipeDishesVO extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** 主键id */ + private Long id; + + /** 菜谱详情id */ + @Excel(name = "菜谱详情id") + @ApiModelProperty(value = "菜谱详情id") + private Long recipeDetailId; + + /** 菜品id */ + @Excel(name = "菜品id") + @ApiModelProperty(value = "菜品id") + private Long dishesId; + + /** 菜品单价 */ + @Excel(name = "菜品单价") + @ApiModelProperty(value = "菜品单价") + private Long price; + + /** 菜品售价(优惠价) */ + @Excel(name = "菜品售价(优惠价)") + @ApiModelProperty(value = "菜品售价(优惠价)") + private Long salePrice; + + /** 规格类型(1-标准,2-大份,3-小份,4-50g,5-100g) */ + @Excel(name = "规格类型(1-标准,2-大份,3-小份,4-50g,5-100g)") + @ApiModelProperty(value = "规格类型(1-标准,2-大份,3-小份,4-50g,5-100g)") + private Long sizeType; + + /** 供应数量 */ + @Excel(name = "供应数量") + @ApiModelProperty(value = "供应数量") + private Long supplyNum; + + /** 销售数量 */ + @Excel(name = "销售数量") + @ApiModelProperty(value = "销售数量") + private Long saleNum; + + /** 剩余数量 */ + @Excel(name = "剩余数量") + @ApiModelProperty(value = "剩余数量") + private Integer remanentNum; + + /** 个人限购数量 */ + @Excel(name = "个人限购数量") + @ApiModelProperty(value = "个人限购数量") + private Long limitNum; + + /** 厨师id */ + @Excel(name = "厨师id") + @ApiModelProperty(value = "厨师id") + private Long chefId; + + /** 是否推荐(1-推荐,2-不推荐) */ + @Excel(name = "是否推荐(1-推荐,2-不推荐)") + @ApiModelProperty(value = "是否推荐(1-推荐,2-不推荐)") + private Long recommendFlag; + + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml index 95530d1..9112238 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml @@ -54,6 +54,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select count(1) from cook_recipe_dishes where recipe_detail_id in (select recipe_detail_id from cook_recipe_detail where recipe_id = #{recipeId} and detail_type = 1) + + +