diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/dto/DeviceDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/dto/DeviceDTO.java index 40ed3e7..c1234a8 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/dto/DeviceDTO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/device/dto/DeviceDTO.java @@ -45,4 +45,6 @@ public class DeviceDTO { private String createBy; @ApiModelProperty("更新人") private String updateBy; + @ApiModelProperty("设备类型") + private String deviceType; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuRecipeController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuRecipeController.java index d8fe79b..935f0ef 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuRecipeController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuRecipeController.java @@ -8,7 +8,9 @@ import com.bonus.canteen.core.common.utils.RedisUtil; import com.bonus.canteen.core.common.utils.TenantContextHolder; import com.bonus.canteen.core.menu.dto.MenuRecipeAddDTO; import com.bonus.canteen.core.menu.dto.MenuRecipeParamDTO; +import com.bonus.canteen.core.menu.dto.MenuTypeDishesDTO; import com.bonus.canteen.core.menu.service.IMenuRecipeService; +import com.bonus.canteen.core.menu.vo.MenuDishesTypeAllVO; import com.bonus.canteen.core.menu.vo.MenuRecipeDetailDateVO; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.houqin.constant.GlobalConstants; @@ -85,4 +87,23 @@ public class MenuRecipeController extends BaseController { this.menuRecipeService.deleteRecipeById(dto.getRecipeId()); return AjaxResult.success(); } + + @PostMapping({"getDishesCategoryList"}) + @ApiOperation("获取类别分类菜品") + public AjaxResult getDishesCategoryList(@RequestBody @Valid MenuTypeDishesDTO dto) { + return AjaxResult.success(this.menuRecipeService.getDishesCategoryList(dto)); + } + + @PostMapping({"getAllDishCategories"}) + @ApiOperation("获取所有菜品类别") + public AjaxResult getAllDishCategories() { + List resultList = this.menuRecipeService.getAllDishCategories(); + return AjaxResult.success(resultList); + } + + @PostMapping({"/getDetailByDate"}) + @ApiOperation("获取指定日期菜谱计划菜品详情") + public List getDetailByDate(@RequestBody MenuRecipeParamDTO dto) { + return this.menuRecipeService.getDetailByDate(dto); + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuDishes.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuDishes.java index 374301e..41f636d 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuDishes.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuDishes.java @@ -1,370 +1,755 @@ package com.bonus.canteen.core.menu.domain; -import java.math.BigDecimal; -import com.bonus.common.core.annotation.Excel; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import lombok.Data; -import lombok.ToString; -import com.bonus.common.core.web.domain.BaseEntity; -/** - * 菜品信息对象 menu_dishes - * - * @author xsheng - * @date 2025-04-03 - */ +import java.math.BigDecimal; +import java.time.LocalDateTime; - -@Data -@ToString -public class MenuDishes extends BaseEntity { +@TableName("menu_dishes") +@ApiModel("菜品信息") +public class MenuDishes extends Model { private static final long serialVersionUID = 1L; - - /** 主键id */ + @TableId + @ApiModelProperty("主键id") private Long id; - - /** 菜品id */ - @Excel(name = "菜品id") - @ApiModelProperty(value = "菜品id") + @ApiModelProperty("菜品id") private Long dishesId; - - /** 菜品基础id */ - @Excel(name = "菜品基础id") - @ApiModelProperty(value = "菜品基础id") + @ApiModelProperty("菜品基础id") private Long baseDishesId; - - /** 类型(1-菜品,2-套餐) */ - @Excel(name = "类型(1-菜品,2-套餐)") - @ApiModelProperty(value = "类型(1-菜品,2-套餐)") - private Long mealType; - - /** 菜品编码 */ - @Excel(name = "菜品编码") - @ApiModelProperty(value = "菜品编码") + @ApiModelProperty("类型(1-菜品,2-套餐)") + private Integer mealType; + @ApiModelProperty("菜品编码") private String dishesNum; - - /** 自定义id */ - @Excel(name = "自定义id") - @ApiModelProperty(value = "自定义id") - private Long customId; - - /** 存货id(数据同步) */ - @Excel(name = "存货id(数据同步)") - @ApiModelProperty(value = "存货id(数据同步)") + @ApiModelProperty("自定义id") + private Integer customId; + @ApiModelProperty("存货id(数据同步)") private String inventoryId; - - /** 菜品名称 */ - @Excel(name = "菜品名称") - @ApiModelProperty(value = "菜品名称") + @ApiModelProperty("菜品名称") private String dishesName; - - /** 菜品别称 */ - @Excel(name = "菜品别称") - @ApiModelProperty(value = "菜品别称") + @ApiModelProperty("菜品别称") private String aliasName; - - /** 菜品名称拼音首字母 */ - @Excel(name = "菜品名称拼音首字母") - @ApiModelProperty(value = "菜品名称拼音首字母") + @ApiModelProperty("菜品名称拼音首字母") private String pinyinInitials; - - /** 菜品名称全拼 */ - @Excel(name = "菜品名称全拼") - @ApiModelProperty(value = "菜品名称全拼") + @ApiModelProperty("菜品名称全拼") private String pinyinFull; - - /** 条形码 */ - @Excel(name = "条形码") - @ApiModelProperty(value = "条形码") - private String barCode; - - /** 菜品简介 */ - @Excel(name = "菜品简介") - @ApiModelProperty(value = "菜品简介") + @ApiModelProperty("菜品简介") private String intro; - - /** 菜品灶类ID */ - @Excel(name = "菜品灶类ID") - @ApiModelProperty(value = "菜品灶类ID") - private Long cookId; - - /** 菜品类型ID */ - @Excel(name = "菜品类型ID") - @ApiModelProperty(value = "菜品类型ID") + @ApiModelProperty("菜品类型ID") private Long typeId; - - /** 菜品分类id(自定义) */ - @Excel(name = "菜品分类id(自定义)") - @ApiModelProperty(value = "菜品分类id(自定义)") + @ApiModelProperty("菜品灶类ID") + private Long cookId; + @ApiModelProperty("菜品分类id(自定义)") private Long classifyId; - - /** 菜品功效id(强筋健骨) */ - @Excel(name = "菜品功效id", readConverterExp = "强=筋健骨") + @ApiModelProperty("菜品功效id(强筋健骨)") private Long effectId; - - /** 菜系id(鲁系主食,沪系主食) */ - @Excel(name = "菜系id(鲁系主食,沪系主食)") - @ApiModelProperty(value = "菜系id(鲁系主食,沪系主食)") + @ApiModelProperty("菜系id(鲁系主食,沪系主食)") private Long styleId; - - /** 是否本地特色(1是2否) */ - @Excel(name = "是否本地特色(1是2否)") - @ApiModelProperty(value = "是否本地特色(1是2否)") - private Long ifLocalFeature; - - /** 菜别(1小荤,2大荤,3素) */ - @Excel(name = "菜别(1小荤,2大荤,3素)") - @ApiModelProperty(value = "菜别(1小荤,2大荤,3素)") - private Long dishesDepart; - - /** 次序(1餐前,2餐后) */ - @Excel(name = "次序", readConverterExp = "1=餐前,2餐后") - private Long sequence; - - /** 辣度 */ - @Excel(name = "辣度") - @ApiModelProperty(value = "辣度") - private Long pungencyDegree; - - /** 销售方式(1按份,2称重) */ - @Excel(name = "销售方式(1按份,2称重)") - @ApiModelProperty(value = "销售方式(1按份,2称重)") - private Long salesMode; - - /** 规格类型(1-标准,2-大小份) */ - @Excel(name = "规格类型(1-标准,2-大小份)") - @ApiModelProperty(value = "规格类型(1-标准,2-大小份)") + @ApiModelProperty("是否本地特色(1是2否)") + private Integer ifLocalFeature; + @ApiModelProperty("菜别(1小荤,2大荤,3素)") + private Integer dishesDepart; + @ApiModelProperty("次序(1餐前,2餐后)") + private Integer sequence; + @ApiModelProperty("辣度") + private Integer pungencyDegree; + @ApiModelProperty("销售方式(1按份,2称重)") + private Integer salesMode; + @ApiModelProperty("规格类型(1-标准,2-大小份)") private Long sizeType; - - /** 菜品规格 */ - @Excel(name = "菜品规格") - @ApiModelProperty(value = "菜品规格") + @ApiModelProperty("规格json") private String sizeJson; - - /** 每份重量(g) */ - @Excel(name = "每份重量(g)") - @ApiModelProperty(value = "每份重量(g)") - private BigDecimal weight; - - /** 大份份量 */ - @Excel(name = "大份份量") - @ApiModelProperty(value = "大份份量") - private BigDecimal largeWeight; - - /** 小份份量 */ - @Excel(name = "小份份量") - @ApiModelProperty(value = "小份份量") - private BigDecimal littleWeight; - - /** 质量偏差(g) */ - @Excel(name = "质量偏差(g)") - @ApiModelProperty(value = "质量偏差(g)") - private BigDecimal weightDeviation; - - /** 菜品基础单价(分) */ - @Excel(name = "菜品基础单价(分)") - @ApiModelProperty(value = "菜品基础单价(分)") - private Long price; - - /** 称重单位多少克(默认100g) */ - @Excel(name = "称重单位多少克(默认100g)") - @ApiModelProperty(value = "称重单位多少克(默认100g)") - private Long unitPrice; - - /** 大份单价 */ - @Excel(name = "大份单价") - @ApiModelProperty(value = "大份单价") - private Long largePrice; - - /** 小份单价 */ - @Excel(name = "小份单价") - @ApiModelProperty(value = "小份单价") - private Long littlePrice; - - /** 菜品图片url */ - @Excel(name = "菜品图片url") - @ApiModelProperty(value = "菜品图片url") - private String imageUrl; - - /** 菜品详情 */ - @Excel(name = "菜品详情") - @ApiModelProperty(value = "菜品详情") - private String particulars; - - /** 菜品推荐 */ - @Excel(name = "菜品推荐") - @ApiModelProperty(value = "菜品推荐") - private String recommend; - - /** 首页推荐(1-推荐,2-不推荐) */ - @Excel(name = "首页推荐(1-推荐,2-不推荐)") - @ApiModelProperty(value = "首页推荐(1-推荐,2-不推荐)") - private Long indexRecommend; - - /** 点赞调查标识(1-是,2-否) */ - @Excel(name = "点赞调查标识(1-是,2-否)") - @ApiModelProperty(value = "点赞调查标识(1-是,2-否)") - private Long likeSurvey; - - /** 点赞调查批次号 */ - @Excel(name = "点赞调查批次号") - @ApiModelProperty(value = "点赞调查批次号") - private Long likeBatch; - - /** 点赞数 */ - @Excel(name = "点赞数") - @ApiModelProperty(value = "点赞数") - private Long likeNum; - - /** 菜品初始推荐值 */ - @Excel(name = "菜品初始推荐值") - @ApiModelProperty(value = "菜品初始推荐值") - private Long initialScore; - - /** 热量(千卡/份) */ - @Excel(name = "热量(千卡/份)") - @ApiModelProperty(value = "热量(千卡/份)") - private BigDecimal calories; - - /** 蛋白质(g/份) */ - @Excel(name = "蛋白质(g/份)") - @ApiModelProperty(value = "蛋白质(g/份)") - private BigDecimal protein; - - /** 脂肪(g/份) */ - @Excel(name = "脂肪(g/份)") - @ApiModelProperty(value = "脂肪(g/份)") - private BigDecimal fat; - - /** 碳水化合物(g/份) */ - @Excel(name = "碳水化合物(g/份)") - @ApiModelProperty(value = "碳水化合物(g/份)") - private BigDecimal carbohydrate; - - /** 膳食纤维(g/份) */ - @Excel(name = "膳食纤维(g/份)") - @ApiModelProperty(value = "膳食纤维(g/份)") - private BigDecimal dietaryFiber; - - /** 胆固醇(mg/份) */ - @Excel(name = "胆固醇(mg/份)") - @ApiModelProperty(value = "胆固醇(mg/份)") - private BigDecimal cholesterol; - - /** 钙(mg/份) */ - @Excel(name = "钙(mg/份)") - @ApiModelProperty(value = "钙(mg/份)") - private BigDecimal calcium; - - /** 钠(mg/份) */ - @Excel(name = "钠(mg/份)") - @ApiModelProperty(value = "钠(mg/份)") - private BigDecimal sodium; - - /** 总嘌呤含量(mg/100g) */ - @Excel(name = "总嘌呤含量(mg/100g)") - @ApiModelProperty(value = "总嘌呤含量(mg/100g)") - private BigDecimal purine; - - /** 铁(mg/100g) */ - @Excel(name = "铁(mg/100g)") - @ApiModelProperty(value = "铁(mg/100g)") - private BigDecimal iron; - - /** 碘(μg/100g) */ - @Excel(name = "碘(μg/100g)") - @ApiModelProperty(value = "碘(μg/100g)") - private BigDecimal iodine; - - /** 钾(mg/100g) */ - @Excel(name = "钾(mg/100g)") - @ApiModelProperty(value = "钾(mg/100g)") - private BigDecimal kalium; - - /** 维生素a(μg/100g) */ - @Excel(name = "维生素a(μg/100g)") - @ApiModelProperty(value = "维生素a(μg/100g)") - private BigDecimal vitaminA; - - /** 维生素c(mg/100g) */ - @Excel(name = "维生素c(mg/100g)") - @ApiModelProperty(value = "维生素c(mg/100g)") - private BigDecimal vitaminC; - - /** 维生素e(g/100g) */ - @Excel(name = "维生素e(g/100g)") - @ApiModelProperty(value = "维生素e(g/100g)") - private BigDecimal vitaminE; - - /** 镁(mg/100g) */ - @Excel(name = "镁(mg/100g)") - @ApiModelProperty(value = "镁(mg/100g)") - private BigDecimal magnesium; - - /** 锌(mg/100g) */ - @Excel(name = "锌(mg/100g)") - @ApiModelProperty(value = "锌(mg/100g)") - private BigDecimal zinc; - - /** 血糖生成指数(GI) */ - @Excel(name = "血糖生成指数(GI)") - @ApiModelProperty(value = "血糖生成指数(GI)") - private BigDecimal glycemicIndex; - - /** 优先级 */ - @Excel(name = "优先级") - @ApiModelProperty(value = "优先级") - private Long sort; - - /** 食堂ID */ - @Excel(name = "食堂ID") - @ApiModelProperty(value = "食堂ID") - private Long canteenId; - - /** 档口或店铺id */ - @Excel(name = "档口或店铺id") - @ApiModelProperty(value = "档口或店铺id") - private Long shopstallId; - - /** 隐藏标识(1隐藏,2展示) */ - @Excel(name = "隐藏标识(1隐藏,2展示)") - @ApiModelProperty(value = "隐藏标识(1隐藏,2展示)") - private Long hideFlag; - - /** 结果图转注册图 */ - @Excel(name = "结果图转注册图") - @ApiModelProperty(value = "结果图转注册图") - private Long convertFlag; - - /** 成本价 */ - @Excel(name = "成本价") - @ApiModelProperty(value = "成本价") - private Long materialCost; - - /** 毛利 */ - @Excel(name = "毛利") - @ApiModelProperty(value = "毛利") - private Long grossProfit; - - /** 毛利率 */ - @Excel(name = "毛利率") - @ApiModelProperty(value = "毛利率") + @ApiModelProperty("菜品质量(g/份)") + private Double weight; + @ApiModelProperty("大份份量") + private Double largeWeight; + @ApiModelProperty("小份份量") + private Double littleWeight; + @ApiModelProperty("质量偏差(g)") + private Double weightDeviation; + @ApiModelProperty("菜品基础单价(分)") + private Integer price; + @ApiModelProperty("称重单位多少克(默认1kg)") + private Integer unitPrice; + @ApiModelProperty("大份单价") + private Integer largePrice; + @ApiModelProperty("小份单价") + private Integer littlePrice; + @ApiModelProperty("结果图转注册图 1 是 2否") + private Integer convertFlag; + private Integer materialCost; + private Integer grossProfit; private BigDecimal grossProfitRate; - - /** 是否是公共菜品(1-是,2-否,) */ - @Excel(name = "是否是公共菜品(1-是,2-否,)") - @ApiModelProperty(value = "是否是公共菜品(1-是,2-否,)") - private Long publicDishes; - - /** 区域id */ - @Excel(name = "区域id") - @ApiModelProperty(value = "区域id") + @ApiModelProperty("菜品图片url") + private String imageUrl; + @ApiModelProperty("菜品详情") + private String particulars; + @ApiModelProperty("菜品推荐") + private String recommend; + @ApiModelProperty("首页推荐(1-推荐,2-不推荐)") + private Integer indexRecommend; + @ApiModelProperty("点赞调查标识(1-是,2-否)") + private Integer likeSurvey; + @ApiModelProperty("点赞调查批次号") + private Long likeBatch; + @ApiModelProperty("点赞数") + private Integer likeNum; + @ApiModelProperty("菜品初始推荐分值") + private Integer initialScore; + @ApiModelProperty("热量(千卡/100g)") + private Double calories; + @ApiModelProperty("蛋白质(g/100g)") + private Double protein; + @ApiModelProperty("脂肪(g/100g)") + private Double fat; + @ApiModelProperty("碳水化合物(g/100g)") + private Double carbohydrate; + @ApiModelProperty("膳食纤维(g/100g)") + private Double dietaryFiber; + @ApiModelProperty("胆固醇(mg/100g)") + private Double cholesterol; + @ApiModelProperty("钙(mg/100g)") + private Double calcium; + @ApiModelProperty("钠(mg/100g)") + private Double sodium; + @ApiModelProperty("总嘌呤含量(mg/100g)") + private Double purine; + @ApiModelProperty("铁(mg/100g)") + private Double iron; + @ApiModelProperty("碘(μg/100g)") + private Double iodine; + @ApiModelProperty("钾(mg/100g)") + private Double kalium; + @ApiModelProperty("维生素a(μg/100g)") + private Double vitaminA; + @ApiModelProperty("维生素c(mg/100g)") + private Double vitaminC; + @ApiModelProperty("维生素e(g/100g)") + private Double vitaminE; + @ApiModelProperty("镁(mg/100g)") + private Double magnesium; + @ApiModelProperty("锌(mg/100g)") + private Double zinc; + @ApiModelProperty("血糖生成指数(GI)") + private Double glycemicIndex; + @ApiModelProperty("区域id") private Long areaId; + @ApiModelProperty("食堂ID") + private Long canteenId; + @ApiModelProperty("档口或店铺id") + private Long shopstallId; + @ApiModelProperty("是否是公共菜品(1-是,2-否,)") + private Integer publicDishes; + @ApiModelProperty("隐藏标识(1隐藏,2展示)") + private Integer hideFlag; + @ApiModelProperty("删除标识") + private Integer delFlag; + @ApiModelProperty("乐观锁") + private Integer revision; + @TableField( + value = "create_by", + fill = FieldFill.INSERT + ) + @ApiModelProperty("创建人") + private String createBy; + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + @TableField( + value = "update_by", + fill = FieldFill.UPDATE + ) + @ApiModelProperty("更新人") + private String updateBy; + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; - /** 乐观锁 */ - @Excel(name = "乐观锁") - @ApiModelProperty(value = "乐观锁") - private Long revision; + public Long getId() { + return this.id; + } + + public Long getDishesId() { + return this.dishesId; + } + + public Long getBaseDishesId() { + return this.baseDishesId; + } + + public Integer getMealType() { + return this.mealType; + } + + public String getDishesNum() { + return this.dishesNum; + } + + public Integer getCustomId() { + return this.customId; + } + + public String getInventoryId() { + return this.inventoryId; + } + + public String getDishesName() { + return this.dishesName; + } + + public String getAliasName() { + return this.aliasName; + } + + public String getPinyinInitials() { + return this.pinyinInitials; + } + + public String getPinyinFull() { + return this.pinyinFull; + } + + public String getIntro() { + return this.intro; + } + + public Long getTypeId() { + return this.typeId; + } + + public Long getCookId() { + return this.cookId; + } + + public Long getClassifyId() { + return this.classifyId; + } + + public Long getEffectId() { + return this.effectId; + } + + public Long getStyleId() { + return this.styleId; + } + + public Integer getIfLocalFeature() { + return this.ifLocalFeature; + } + + public Integer getDishesDepart() { + return this.dishesDepart; + } + + public Integer getSequence() { + return this.sequence; + } + + public Integer getPungencyDegree() { + return this.pungencyDegree; + } + + public Integer getSalesMode() { + return this.salesMode; + } + + public Long getSizeType() { + return this.sizeType; + } + + public String getSizeJson() { + return this.sizeJson; + } + + public Double getWeight() { + return this.weight; + } + + public Double getLargeWeight() { + return this.largeWeight; + } + + public Double getLittleWeight() { + return this.littleWeight; + } + + public Double getWeightDeviation() { + return this.weightDeviation; + } + + public Integer getPrice() { + return this.price; + } + + public Integer getUnitPrice() { + return this.unitPrice; + } + + public Integer getLargePrice() { + return this.largePrice; + } + + public Integer getLittlePrice() { + return this.littlePrice; + } + + public Integer getConvertFlag() { + return this.convertFlag; + } + + public Integer getMaterialCost() { + return this.materialCost; + } + + public Integer getGrossProfit() { + return this.grossProfit; + } + + public BigDecimal getGrossProfitRate() { + return this.grossProfitRate; + } + + public String getImageUrl() { + return this.imageUrl; + } + + public String getParticulars() { + return this.particulars; + } + + public String getRecommend() { + return this.recommend; + } + + public Integer getIndexRecommend() { + return this.indexRecommend; + } + + public Integer getLikeSurvey() { + return this.likeSurvey; + } + + public Long getLikeBatch() { + return this.likeBatch; + } + + public Integer getLikeNum() { + return this.likeNum; + } + + public Integer getInitialScore() { + return this.initialScore; + } + + public Double getCalories() { + return this.calories; + } + + public Double getProtein() { + return this.protein; + } + + public Double getFat() { + return this.fat; + } + + public Double getCarbohydrate() { + return this.carbohydrate; + } + + public Double getDietaryFiber() { + return this.dietaryFiber; + } + + public Double getCholesterol() { + return this.cholesterol; + } + + public Double getCalcium() { + return this.calcium; + } + + public Double getSodium() { + return this.sodium; + } + + public Double getPurine() { + return this.purine; + } + + public Double getIron() { + return this.iron; + } + + public Double getIodine() { + return this.iodine; + } + + public Double getKalium() { + return this.kalium; + } + + public Double getVitaminA() { + return this.vitaminA; + } + + public Double getVitaminC() { + return this.vitaminC; + } + + public Double getVitaminE() { + return this.vitaminE; + } + + public Double getMagnesium() { + return this.magnesium; + } + + public Double getZinc() { + return this.zinc; + } + + public Double getGlycemicIndex() { + return this.glycemicIndex; + } + + public Long getAreaId() { + return this.areaId; + } + + public Long getCanteenId() { + return this.canteenId; + } + + public Long getShopstallId() { + return this.shopstallId; + } + + public Integer getPublicDishes() { + return this.publicDishes; + } + + public Integer getHideFlag() { + return this.hideFlag; + } + + public Integer getDelFlag() { + return this.delFlag; + } + + public Integer getRevision() { + return this.revision; + } + public void setId(final Long id) { + this.id = id; + } + + public void setDishesId(final Long dishesId) { + this.dishesId = dishesId; + } + + public void setBaseDishesId(final Long baseDishesId) { + this.baseDishesId = baseDishesId; + } + + public void setMealType(final Integer mealType) { + this.mealType = mealType; + } + + public void setDishesNum(final String dishesNum) { + this.dishesNum = dishesNum; + } + + public void setCustomId(final Integer customId) { + this.customId = customId; + } + + public void setInventoryId(final String inventoryId) { + this.inventoryId = inventoryId; + } + + public void setDishesName(final String dishesName) { + this.dishesName = dishesName; + } + + public void setAliasName(final String aliasName) { + this.aliasName = aliasName; + } + + public void setPinyinInitials(final String pinyinInitials) { + this.pinyinInitials = pinyinInitials; + } + + public void setPinyinFull(final String pinyinFull) { + this.pinyinFull = pinyinFull; + } + + public void setIntro(final String intro) { + this.intro = intro; + } + + public void setTypeId(final Long typeId) { + this.typeId = typeId; + } + + public void setCookId(final Long cookId) { + this.cookId = cookId; + } + + public void setClassifyId(final Long classifyId) { + this.classifyId = classifyId; + } + + public void setEffectId(final Long effectId) { + this.effectId = effectId; + } + + public void setStyleId(final Long styleId) { + this.styleId = styleId; + } + + public void setIfLocalFeature(final Integer ifLocalFeature) { + this.ifLocalFeature = ifLocalFeature; + } + + public void setDishesDepart(final Integer dishesDepart) { + this.dishesDepart = dishesDepart; + } + + public void setSequence(final Integer sequence) { + this.sequence = sequence; + } + + public void setPungencyDegree(final Integer pungencyDegree) { + this.pungencyDegree = pungencyDegree; + } + + public void setSalesMode(final Integer salesMode) { + this.salesMode = salesMode; + } + + public void setSizeType(final Long sizeType) { + this.sizeType = sizeType; + } + + public void setSizeJson(final String sizeJson) { + this.sizeJson = sizeJson; + } + + public void setWeight(final Double weight) { + this.weight = weight; + } + + public void setLargeWeight(final Double largeWeight) { + this.largeWeight = largeWeight; + } + + public void setLittleWeight(final Double littleWeight) { + this.littleWeight = littleWeight; + } + + public void setWeightDeviation(final Double weightDeviation) { + this.weightDeviation = weightDeviation; + } + + public void setPrice(final Integer price) { + this.price = price; + } + + public void setUnitPrice(final Integer unitPrice) { + this.unitPrice = unitPrice; + } + + public void setLargePrice(final Integer largePrice) { + this.largePrice = largePrice; + } + + public void setLittlePrice(final Integer littlePrice) { + this.littlePrice = littlePrice; + } + + public void setConvertFlag(final Integer convertFlag) { + this.convertFlag = convertFlag; + } + + public void setMaterialCost(final Integer materialCost) { + this.materialCost = materialCost; + } + + public void setGrossProfit(final Integer grossProfit) { + this.grossProfit = grossProfit; + } + + public void setGrossProfitRate(final BigDecimal grossProfitRate) { + this.grossProfitRate = grossProfitRate; + } + + public void setImageUrl(final String imageUrl) { + this.imageUrl = imageUrl; + } + + public void setParticulars(final String particulars) { + this.particulars = particulars; + } + + public void setRecommend(final String recommend) { + this.recommend = recommend; + } + + public void setIndexRecommend(final Integer indexRecommend) { + this.indexRecommend = indexRecommend; + } + + public void setLikeSurvey(final Integer likeSurvey) { + this.likeSurvey = likeSurvey; + } + + public void setLikeBatch(final Long likeBatch) { + this.likeBatch = likeBatch; + } + + public void setLikeNum(final Integer likeNum) { + this.likeNum = likeNum; + } + + public void setInitialScore(final Integer initialScore) { + this.initialScore = initialScore; + } + + public void setCalories(final Double calories) { + this.calories = calories; + } + + public void setProtein(final Double protein) { + this.protein = protein; + } + + public void setFat(final Double fat) { + this.fat = fat; + } + + public void setCarbohydrate(final Double carbohydrate) { + this.carbohydrate = carbohydrate; + } + + public void setDietaryFiber(final Double dietaryFiber) { + this.dietaryFiber = dietaryFiber; + } + + public void setCholesterol(final Double cholesterol) { + this.cholesterol = cholesterol; + } + + public void setCalcium(final Double calcium) { + this.calcium = calcium; + } + + public void setSodium(final Double sodium) { + this.sodium = sodium; + } + + public void setPurine(final Double purine) { + this.purine = purine; + } + + public void setIron(final Double iron) { + this.iron = iron; + } + + public void setIodine(final Double iodine) { + this.iodine = iodine; + } + + public void setKalium(final Double kalium) { + this.kalium = kalium; + } + + public void setVitaminA(final Double vitaminA) { + this.vitaminA = vitaminA; + } + + public void setVitaminC(final Double vitaminC) { + this.vitaminC = vitaminC; + } + + public void setVitaminE(final Double vitaminE) { + this.vitaminE = vitaminE; + } + + public void setMagnesium(final Double magnesium) { + this.magnesium = magnesium; + } + + public void setZinc(final Double zinc) { + this.zinc = zinc; + } + + public void setGlycemicIndex(final Double glycemicIndex) { + this.glycemicIndex = glycemicIndex; + } + + public void setAreaId(final Long areaId) { + this.areaId = areaId; + } + + public void setCanteenId(final Long canteenId) { + this.canteenId = canteenId; + } + + public void setShopstallId(final Long shopstallId) { + this.shopstallId = shopstallId; + } + + public void setPublicDishes(final Integer publicDishes) { + this.publicDishes = publicDishes; + } + + public void setHideFlag(final Integer hideFlag) { + this.hideFlag = hideFlag; + } + + public void setDelFlag(final Integer delFlag) { + this.delFlag = delFlag; + } + + public void setRevision(final Integer revision) { + this.revision = revision; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public LocalDateTime getCreateTime() { + return createTime; + } + + public void setCreateTime(LocalDateTime createTime) { + this.createTime = createTime; + } + + public String getUpdateBy() { + return updateBy; + } + + public void setUpdateBy(String updateBy) { + this.updateBy = updateBy; + } + + public LocalDateTime getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(LocalDateTime updateTime) { + this.updateTime = updateTime; + } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipe.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipe.java index 8119df2..d80aa43 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipe.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipe.java @@ -26,10 +26,10 @@ public class MenuRecipe { private Long canteenId; @ApiModelProperty("档口id") private Long stallId; - @ApiModelProperty("适用人员范围") - private Long effId; - @ApiModelProperty("删除标识") - private Integer delFlag; +// @ApiModelProperty("适用人员范围") +// private Long effId; +// @ApiModelProperty("删除标识") +// private Integer delFlag; @ApiModelProperty("乐观锁") private Integer revision; @ApiModelProperty("创建人") diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDetail.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDetail.java index b540fc7..92a6e32 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDetail.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDetail.java @@ -7,6 +7,7 @@ import java.util.Date; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.extension.activerecord.Model; import com.fasterxml.jackson.annotation.JsonFormat; import com.bonus.common.core.annotation.Excel; @@ -25,6 +26,7 @@ import com.bonus.common.core.web.domain.BaseEntity; @Data @ToString +@TableName("menu_recipe_detail") public class MenuRecipeDetail{ private static final long serialVersionUID = 1L; @TableId diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeParamDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeParamDTO.java index c418b5d..f5be01c 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeParamDTO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeParamDTO.java @@ -5,6 +5,8 @@ import lombok.Data; import lombok.ToString; import javax.validation.constraints.NotNull; +import java.time.LocalDate; +import java.time.LocalDateTime; import java.util.List; @Data @ToString @@ -26,5 +28,6 @@ public class MenuRecipeParamDTO { private Integer recipeType; @ApiModelProperty("发布日期") private Integer applyWeek; - + @ApiModelProperty("发布日期") + private LocalDate applyDate; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuTypeDishesDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuTypeDishesDTO.java new file mode 100644 index 0000000..cac531d --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuTypeDishesDTO.java @@ -0,0 +1,110 @@ +package com.bonus.canteen.core.menu.dto; + +import cn.hutool.core.text.CharSequenceUtil; +import io.swagger.annotations.ApiModelProperty; + +import java.io.Serializable; +import java.util.List; + +public class MenuTypeDishesDTO implements Serializable { + @ApiModelProperty("菜品类型") + private Long typeId; + @ApiModelProperty("区域id") + private List areaIds; + @ApiModelProperty("食堂id") + private List canteenIds; + @ApiModelProperty("档口id") + private List stallIds; + @ApiModelProperty("区域id") + private Long areaId; + @ApiModelProperty("食堂id") + private Long canteenId; + @ApiModelProperty("档口id") + private Long stallId; + @ApiModelProperty("菜品名称") + private String dishesName; + private String pinyinInitials; + private Integer salesMode; + + public String getDishesName() { + return CharSequenceUtil.isBlank(this.dishesName) ? this.dishesName : "%" + this.dishesName + "%"; + } + + public String getPinyinInitials() { + return CharSequenceUtil.isBlank(this.dishesName) ? this.dishesName : "%" + this.dishesName.toUpperCase() + "%"; + } + + + public Long getTypeId() { + return this.typeId; + } + + public List getAreaIds() { + return this.areaIds; + } + + public List getCanteenIds() { + return this.canteenIds; + } + + public List getStallIds() { + return this.stallIds; + } + + public Long getAreaId() { + return this.areaId; + } + + public Long getCanteenId() { + return this.canteenId; + } + + public Long getStallId() { + return this.stallId; + } + + public Integer getSalesMode() { + return this.salesMode; + } + + public void setTypeId(final Long typeId) { + this.typeId = typeId; + } + + public void setAreaIds(final List areaIds) { + this.areaIds = areaIds; + } + + public void setCanteenIds(final List canteenIds) { + this.canteenIds = canteenIds; + } + + public void setStallIds(final List stallIds) { + this.stallIds = stallIds; + } + + public void setAreaId(final Long areaId) { + this.areaId = areaId; + } + + public void setCanteenId(final Long canteenId) { + this.canteenId = canteenId; + } + + public void setStallId(final Long stallId) { + this.stallId = stallId; + } + + public void setDishesName(final String dishesName) { + this.dishesName = dishesName; + } + + public void setPinyinInitials(final String pinyinInitials) { + this.pinyinInitials = pinyinInitials; + } + + public void setSalesMode(final Integer salesMode) { + this.salesMode = salesMode; + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java index b1423d8..75406ef 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java @@ -4,17 +4,17 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.bonus.canteen.core.menu.domain.MenuAppRecipe; -import com.bonus.canteen.core.menu.domain.MenuRecipe; -import com.bonus.canteen.core.menu.domain.MenuRecipeDetail; -import com.bonus.canteen.core.menu.domain.MenuRecipeDishes; +import com.bonus.canteen.core.menu.domain.*; import com.bonus.canteen.core.menu.dto.*; import com.bonus.canteen.core.menu.model.MenuBaseModel; -import com.bonus.canteen.core.menu.vo.MenuRecipeDataVO; -import com.bonus.canteen.core.menu.vo.MenuRecipeDetailDateVO; -import com.bonus.canteen.core.menu.vo.MenuRecipeV2VO; +import com.bonus.canteen.core.menu.model.MenuDishesCostModel; +import com.bonus.canteen.core.menu.vo.*; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.springframework.beans.PropertyValues; /** * 菜品计划信息Mapper接口 @@ -149,4 +149,18 @@ public interface MenuRecipeMapper extends BaseMapper { List getDetailIdList(Long recipeId); int selectMenuAppRecipeCount(Long recipeId); + + List selectTypeDishesList(MenuTypeDishesDTO dto); + + @Select({"select base_dishes_id, material_cost from menu_dishes ${ew.customSqlSegment}"}) + List selectMaterialCostList(@Param("ew") Wrapper wrapper); + @Select({"select type_id, type_name, area_id from menu_dishes_type ${ew.customSqlSegment}"}) + List getAllDishCategories(@Param("ew") Wrapper wrapper); + + List selectDateDetailList(@Param("recipeId") Long recipeId, @Param("applyDate") LocalDate applyDate); + @Select({"select * from menu_recipe_detail ${ew.customSqlSegment}"}) + List selectMenuRecipeDetailList(@Param("ew") Wrapper wrapper); + @Select({"select * from menu_recipe_dishes ${ew.customSqlSegment}"}) + List selectMenuRecipeDishList(@Param("ew") Wrapper wrapper); + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/model/MenuDishesCostModel.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/model/MenuDishesCostModel.java new file mode 100644 index 0000000..5dbad0e --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/model/MenuDishesCostModel.java @@ -0,0 +1,24 @@ +package com.bonus.canteen.core.menu.model; + +import java.util.Optional; + +public class MenuDishesCostModel { + private Long baseDishesId; + private Integer materialCost; + + public Integer getMaterialCost() { + return (Integer)Optional.ofNullable(this.materialCost).orElse(0); + } + + public Long getBaseDishesId() { + return this.baseDishesId; + } + + public void setBaseDishesId(final Long baseDishesId) { + this.baseDishesId = baseDishesId; + } + + public void setMaterialCost(final Integer materialCost) { + this.materialCost = materialCost; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuRecipeService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuRecipeService.java index de3b90e..6a658a5 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuRecipeService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuRecipeService.java @@ -1,11 +1,14 @@ package com.bonus.canteen.core.menu.service; +import java.time.LocalDate; import java.util.List; import com.baomidou.mybatisplus.extension.service.IService; import com.bonus.canteen.core.menu.domain.MenuRecipe; import com.bonus.canteen.core.menu.dto.MenuRecipeAddDTO; import com.bonus.canteen.core.menu.dto.MenuRecipeParamDTO; +import com.bonus.canteen.core.menu.dto.MenuTypeDishesDTO; +import com.bonus.canteen.core.menu.vo.MenuDishesTypeAllVO; import com.bonus.canteen.core.menu.vo.MenuRecipeDetailDateVO; import com.bonus.common.core.web.domain.AjaxResult; @@ -30,4 +33,12 @@ public interface IMenuRecipeService extends IService { List getDetail(MenuRecipeParamDTO dto); void deleteRecipeById(Long id); + + AjaxResult getDishesCategoryList(@Valid MenuTypeDishesDTO dto); + + List getAllDishCategories(); + + List getDetailByDate(MenuRecipeParamDTO dto); + + void generateRecipe(Long recipeId, LocalDate applyDate); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java index 379cc5b..d11efb5 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java @@ -3,6 +3,7 @@ package com.bonus.canteen.core.menu.service.impl; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; @@ -69,7 +70,7 @@ public class MenuDishesServiceImpl implements IMenuDishesService { */ @Override public int insertMenuDishes(MenuDishes menuDishes) { - menuDishes.setCreateTime(DateUtils.getNowDate()); + menuDishes.setCreateTime(LocalDateTime.now()); try { return menuDishesMapper.insertMenuDishes(menuDishes); } catch (Exception e) { @@ -85,7 +86,7 @@ public class MenuDishesServiceImpl implements IMenuDishesService { */ @Override public int updateMenuDishes(MenuDishes menuDishes) { - menuDishes.setUpdateTime(DateUtils.getNowDate()); + menuDishes.setUpdateTime(LocalDateTime.now()); try { return menuDishesMapper.updateMenuDishes(menuDishes); } catch (Exception e) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuRecipeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuRecipeServiceImpl.java index c8f35e2..f66db05 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuRecipeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuRecipeServiceImpl.java @@ -12,30 +12,26 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.text.CharSequenceUtil; import cn.hutool.core.util.ObjectUtil; +import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.core.toolkit.support.SFunction; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.bonus.canteen.core.common.utils.MqUtil; import com.bonus.canteen.core.common.utils.RedisUtil; import com.bonus.canteen.core.common.utils.TenantContextHolder; -import com.bonus.canteen.core.menu.domain.MenuAppRecipe; -import com.bonus.canteen.core.menu.domain.MenuRecipeDetail; -import com.bonus.canteen.core.menu.domain.MenuRecipeDishes; +import com.bonus.canteen.core.menu.domain.*; import com.bonus.canteen.core.menu.dto.*; import com.bonus.canteen.core.menu.enums.MenuRecipeSortEnum; -import com.bonus.canteen.core.menu.mapper.MenuRecipeDishesMapper; import com.bonus.canteen.core.menu.model.MenuBaseDishesModel; import com.bonus.canteen.core.menu.model.MenuBaseModel; +import com.bonus.canteen.core.menu.model.MenuDishesCostModel; import com.bonus.canteen.core.menu.service.IMenuRecipeService; -import com.bonus.canteen.core.menu.vo.MenuRecipeDataVO; -import com.bonus.canteen.core.menu.vo.MenuRecipeDetailDateVO; -import com.bonus.canteen.core.menu.vo.MenuRecipeV2VO; +import com.bonus.canteen.core.menu.vo.*; import com.bonus.common.core.exception.ServiceException; -import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.houqin.constant.DelFlagEnum; import com.bonus.common.houqin.i18n.I18n; @@ -46,7 +42,6 @@ import com.google.common.collect.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.bonus.canteen.core.menu.mapper.MenuRecipeMapper; -import com.bonus.canteen.core.menu.domain.MenuRecipe; import org.springframework.transaction.annotation.Transactional; /** @@ -177,7 +172,6 @@ public class MenuRecipeServiceImpl extends ServiceImpl resultList = this.baseMapper.selectTypeDishesList(dto); + if (CollUtil.isEmpty(resultList)) { + return AjaxResult.success(new ArrayList<>()); + } else { + List costList = this.baseMapper.selectMaterialCostList(new QueryWrapper() + .in("base_dishes_id", resultList.stream() + .map(MenuAllTypeDishesVO::getDishesId) + .collect(Collectors.toList())) + .eq("size_json", "{\"sizeType\":\"小份\"}")); + if (CollUtil.isNotEmpty(costList)) { + Map mostMap = costList.stream().collect(Collectors.toMap(MenuDishesCostModel::getBaseDishesId, MenuDishesCostModel::getMaterialCost)); + resultList.forEach((x) -> x.setLittleMaterialCost((Integer) mostMap.get(x.getDishesId()))); + } + + return AjaxResult.success(resultList); + } + } + + @Override + public List getAllDishCategories() { + return this.baseMapper.getAllDishCategories(Wrappers.lambdaQuery(MenuDishesType.class) + .eq(MenuDishesType::getDelFlag, DelFlagEnum.DEL_FALSE.key()) + .orderByAsc(MenuDishesType::getDefaultFlag) + .orderByDesc(MenuDishesType::getCrtime)); + } + + @Override + public List getDetailByDate(MenuRecipeParamDTO dto) { + this.generateRecipe(dto.getRecipeId(), dto.getApplyDate()); + List menuRecipeDetailDateVOS = this.menuRecipeMapper.selectDateDetailList(dto.getRecipeId(), dto.getApplyDate()); + return menuRecipeDetailDateVOS.stream().sorted(Comparator.comparing(MenuRecipeDetailDateVO::getMealtimeType)).collect(Collectors.toList()); + } + @Override + public void generateRecipe(Long recipeId, LocalDate applyDate) { + if (!ObjectUtil.isEmpty(recipeId) && !ObjectUtil.isEmpty(applyDate)) { + this.generateRecipe(Collections.singletonList(recipeId), applyDate); + } + } + @Transactional(rollbackFor = {Exception.class}) + public synchronized void generateRecipe(List recipeIdList, LocalDate applyDate) { + if (!ObjectUtil.isEmpty(recipeIdList) && !ObjectUtil.isEmpty(applyDate)) { + recipeIdList = new ArrayList<>(recipeIdList); + Map recipeDetailContMap = this.menuRecipeMapper.selectMenuRecipeDetailList(new QueryWrapper() + .eq("apply_date", applyDate) + .in("recipe_id", recipeIdList)) + .stream().collect(Collectors.groupingBy(MenuRecipeDetail::getRecipeId, Collectors.counting())); + recipeIdList.removeAll(recipeDetailContMap.keySet()); + if (!ObjectUtil.isEmpty(recipeIdList)) { + List menuRecipes = this.list(Wrappers.lambdaQuery(MenuRecipe.class).in(MenuRecipe::getRecipeType, new Object[]{2, 3}) + .apply(CollUtil.isNotEmpty(recipeIdList), "recipe_id IN (" + recipeIdList.stream().map(String::valueOf).collect(Collectors.joining(", ")) + ")")); + if (!ObjectUtil.isEmpty(menuRecipes)) { + Map recipeMap = menuRecipes.stream().collect(Collectors.toMap(MenuRecipe::getRecipeId, Function.identity())); + List menuRecipeDetails = this.menuRecipeMapper.selectMenuRecipeDetailList( + new QueryWrapper().eq("detail_type", 1) + .apply(CollUtil.isNotEmpty(recipeIdList), "recipe_id IN (" + recipeIdList.stream().map(String::valueOf).collect(Collectors.joining(", ")) + ")")); + Map recipeTypeMap = menuRecipes.stream().collect(Collectors.toMap(MenuRecipe::getRecipeId, MenuRecipe::getRecipeType)); + menuRecipeDetails = this.filterMenuRecipeDetails(recipeTypeMap, menuRecipeDetails, applyDate); + if (!ObjectUtil.isEmpty(menuRecipeDetails)) { + Map> detailMap = menuRecipeDetails.stream().collect(Collectors.groupingBy(MenuRecipeDetail::getRecipeId)); + List detailIds = menuRecipeDetails.stream().map(MenuRecipeDetail::getDetailId).collect(Collectors.toList()); + Map> recipeDishes = this.menuRecipeMapper.selectMenuRecipeDishList(new QueryWrapper() + .in("detail_id", detailIds)).stream().collect(Collectors.groupingBy(MenuRecipeDishes::getDetailId)); + List recipeDetailV2List = Lists.newArrayList(); + List recipeDishesV2List = Lists.newArrayList(); + Iterator var13 = recipeMap.keySet().iterator(); + + label59: + while (true) { + Long recipeId; + Integer type; + List menuRecipeDetail; + do { + if (!var13.hasNext()) { + this.menuRecipeMapper.insertMenuDetails(recipeDetailV2List); + if (ObjectUtil.isNotEmpty(recipeDishesV2List)) { + this.menuRecipeMapper.insertMenuDishes(recipeDishesV2List); + } + return; + } + recipeId = (Long) var13.next(); + type = (Integer) recipeTypeMap.get(recipeId); + menuRecipeDetail = (List) detailMap.get(recipeId); + } while (!ObjectUtil.isNotEmpty(menuRecipeDetail)); + Iterator var17 = menuRecipeDetail.iterator(); + while (true) { + Long detailId; + List dishes; + do { + if (!var17.hasNext()) { + continue label59; + } + MenuRecipeDetail recipeDetail = (MenuRecipeDetail) var17.next(); + MenuRecipeDetail detailItem = new MenuRecipeDetail(); + detailId = Id.next(); + detailItem.setDetailId(detailId); + detailItem.setRecipeId(recipeId); + if (ObjectUtil.equal(type, 3)) { + detailItem.setApplyWeek(applyDate.getDayOfWeek().getValue()); + } + detailItem.setApplyDate(applyDate); + detailItem.setMealtimeType(recipeDetail.getMealtimeType()); + detailItem.setCreateBy(""); + detailItem.setDetailType(2); + recipeDetailV2List.add(detailItem); + dishes = (List) recipeDishes.get(recipeDetail.getDetailId()); + } while (!ObjectUtil.isNotEmpty(dishes)); + Iterator var22 = dishes.iterator(); + while (var22.hasNext()) { + MenuRecipeDishes dish = (MenuRecipeDishes) var22.next(); + MenuRecipeDishes dishesItem = (MenuRecipeDishes) BeanUtil.copyProperties(dish, MenuRecipeDishes.class, new String[0]); + dishesItem.setDetailId(detailId); + dishesItem.setId((Long) null); + recipeDishesV2List.add(dishesItem); + } + } + } + } + } + } + } + } + public List filterMenuRecipeDetails(Map recipeTypeMap, List menuRecipeDetails, LocalDate applyDate) { + return menuRecipeDetails.stream().filter((item) -> { + Long recipeId = item.getRecipeId(); + Integer type = (Integer) recipeTypeMap.get(recipeId); + if (type == 3) { + return ObjectUtil.equal(item.getApplyWeek(), applyDate.getDayOfWeek().getValue()); + } else { + return type == 2; + } + }).collect(Collectors.toList()); + } public void processResult(RecipeProcessResult result) { List detailIds = result.getTemplateDetailIds(); MenuRecipe menuRecipe = result.getMenuRecipe(); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/MenuAllTypeDishesVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/MenuAllTypeDishesVO.java new file mode 100644 index 0000000..74dc99b --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/MenuAllTypeDishesVO.java @@ -0,0 +1,188 @@ +package com.bonus.canteen.core.menu.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +@ApiModel("菜品详情") +public class MenuAllTypeDishesVO { + @ApiModelProperty("菜品id") + private Long dishesId; + @ApiModelProperty("菜品名称") + private String dishesName; + @ApiModelProperty("菜品价格") + private Integer price; + @ApiModelProperty("食堂名称") + private String canteenName; + @ApiModelProperty("档口名称") + private String stallName; + @ApiModelProperty("区域名称") + private String areaName; + @ApiModelProperty("销售方式(1按份,2称重)") + private Integer salesMode; + @ApiModelProperty("规格类型(1-标准,2-大小份)") + private Long sizeType; + @ApiModelProperty("称重单位多少克(默认1kg)") + private Integer unitPrice; + @ApiModelProperty("大份单价") + private Integer largePrice; + @ApiModelProperty("小份单价") + private Integer littlePrice; + @ApiModelProperty("成本价") + private Integer materialCost; + @ApiModelProperty("成本价-小份") + private Integer littleMaterialCost; + @ApiModelProperty("菜品编号") + private String dishesNum; + @ApiModelProperty("菜品类型") + private Integer mealType; + @ApiModelProperty("类别名称") + private String typeName; + @ApiModelProperty("类别id") + private Long typeId; + @ApiModelProperty("是否是公共菜品(1-是,2-否,)") + private Integer publicDishes; + + public Long getDishesId() { + return this.dishesId; + } + + public String getDishesName() { + return this.dishesName; + } + + public Integer getPrice() { + return this.price; + } + + public String getCanteenName() { + return this.canteenName; + } + + public String getStallName() { + return this.stallName; + } + + public String getAreaName() { + return this.areaName; + } + + public Integer getSalesMode() { + return this.salesMode; + } + + public Long getSizeType() { + return this.sizeType; + } + + public Integer getUnitPrice() { + return this.unitPrice; + } + + public Integer getLargePrice() { + return this.largePrice; + } + + public Integer getLittlePrice() { + return this.littlePrice; + } + + public Integer getMaterialCost() { + return this.materialCost; + } + + public Integer getLittleMaterialCost() { + return this.littleMaterialCost; + } + + public String getDishesNum() { + return this.dishesNum; + } + + public Integer getMealType() { + return this.mealType; + } + + public String getTypeName() { + return this.typeName; + } + + public Long getTypeId() { + return this.typeId; + } + + public Integer getPublicDishes() { + return this.publicDishes; + } + + public void setDishesId(final Long dishesId) { + this.dishesId = dishesId; + } + + public void setDishesName(final String dishesName) { + this.dishesName = dishesName; + } + + public void setPrice(final Integer price) { + this.price = price; + } + + public void setCanteenName(final String canteenName) { + this.canteenName = canteenName; + } + + public void setStallName(final String stallName) { + this.stallName = stallName; + } + + public void setAreaName(final String areaName) { + this.areaName = areaName; + } + + public void setSalesMode(final Integer salesMode) { + this.salesMode = salesMode; + } + + public void setSizeType(final Long sizeType) { + this.sizeType = sizeType; + } + + public void setUnitPrice(final Integer unitPrice) { + this.unitPrice = unitPrice; + } + + public void setLargePrice(final Integer largePrice) { + this.largePrice = largePrice; + } + + public void setLittlePrice(final Integer littlePrice) { + this.littlePrice = littlePrice; + } + + public void setMaterialCost(final Integer materialCost) { + this.materialCost = materialCost; + } + + public void setLittleMaterialCost(final Integer littleMaterialCost) { + this.littleMaterialCost = littleMaterialCost; + } + + public void setDishesNum(final String dishesNum) { + this.dishesNum = dishesNum; + } + + public void setMealType(final Integer mealType) { + this.mealType = mealType; + } + + public void setTypeName(final String typeName) { + this.typeName = typeName; + } + + public void setTypeId(final Long typeId) { + this.typeId = typeId; + } + + public void setPublicDishes(final Integer publicDishes) { + this.publicDishes = publicDishes; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DoubleScreenMachineMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DoubleScreenMachineMapper.xml index c9b4fe3..6750331 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DoubleScreenMachineMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/device/DoubleScreenMachineMapper.xml @@ -5,9 +5,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into device_info(tenant_id,device_ip, device_mac, device_gateway, device_sn, device_name, device_num, device_pwd, - device_addr, device_key) + device_addr, device_key,device_type) values (#{tenantId},#{deviceIp}, #{deviceMac}, #{deviceGateway}, #{deviceSn}, #{deviceName}, #{deviceNum}, #{devicePwd}, - #{deviceAddr}, #{deviceKey}) + #{deviceAddr}, #{deviceKey},#{deviceType}) insert into device_bind(device_id,area_id,canteen_id,stall_id) diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml index 20fe981..f0a8062 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml @@ -389,6 +389,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + select DISTINCT + mrd.mealtime_type, mrd.detail_id, mdb.base_dishes_id as dishes_id, mdb.dishes_name, @@ -426,12 +428,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join menu_dishes_base mdb on md.base_dishes_id = mdb.base_dishes_id left join menu_dishes_type mdt on md.type_id = mdt.type_id where mrd.recipe_id = #{params.recipeId} - + and mrd.apply_week = #{params.applyWeek} and mrd.detail_type = 1 order by mrdd.sort_num + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into menu_recipe @@ -604,7 +734,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - update menu_recipe