菜谱列表-新增
This commit is contained in:
parent
5a9abe6a2c
commit
0cefb29322
|
|
@ -1,6 +1,10 @@
|
|||
package com.bonus.canteen.core.menu.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
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;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -18,32 +22,13 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
|
||||
@Data
|
||||
@ToString
|
||||
public class MenuAppRecipe extends BaseEntity {
|
||||
@TableName("menu_app_recipe")
|
||||
public class MenuAppRecipe extends Model<MenuAppRecipe> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 自增id */
|
||||
private Long id;
|
||||
|
||||
/** 菜谱id */
|
||||
@Excel(name = "菜谱id")
|
||||
@ApiModelProperty(value = "菜谱id")
|
||||
private Long recipeId;
|
||||
|
||||
/** 绑定类型(1-当餐点餐,2-预订餐,3-一周菜谱,4-扫码点餐) */
|
||||
@Excel(name = "绑定类型(1-当餐点餐,2-预订餐,3-一周菜谱,4-扫码点餐)")
|
||||
@ApiModelProperty(value = "绑定类型(1-当餐点餐,2-预订餐,3-一周菜谱,4-扫码点餐)")
|
||||
private Long bindType;
|
||||
|
||||
/** 绑定时间 */
|
||||
@ApiModelProperty(value = "绑定时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "绑定时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date bindTime;
|
||||
|
||||
/** 餐线id */
|
||||
@Excel(name = "餐线id")
|
||||
@ApiModelProperty(value = "餐线id")
|
||||
private Integer bindType;
|
||||
private Long mealLineId;
|
||||
|
||||
|
||||
private LocalDateTime bindTime;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,85 +1,54 @@
|
|||
package com.bonus.canteen.core.menu.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
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_recipe
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@Data
|
||||
@ToString
|
||||
public class MenuRecipe extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
@TableName("menu_recipe")
|
||||
@ApiModel("菜品计划信息")
|
||||
public class MenuRecipe {
|
||||
@TableId
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
/** 菜谱id */
|
||||
@Excel(name = "菜谱id")
|
||||
@ApiModelProperty(value = "菜谱id")
|
||||
@ApiModelProperty("菜谱id")
|
||||
private Long recipeId;
|
||||
|
||||
/** 菜品计划id(数据同步) */
|
||||
@Excel(name = "菜品计划id(数据同步)")
|
||||
@ApiModelProperty(value = "菜品计划id(数据同步)")
|
||||
@ApiModelProperty("菜谱类型 1 默认 3按周")
|
||||
private Integer recipeType;
|
||||
@ApiModelProperty("菜品计划id(数据同步)")
|
||||
private String planId;
|
||||
|
||||
/** 菜谱名称 */
|
||||
@Excel(name = "菜谱名称")
|
||||
@ApiModelProperty(value = "菜谱名称")
|
||||
@ApiModelProperty("菜谱名称")
|
||||
private String recipeName;
|
||||
|
||||
/** 是否为默认(1否, 2是) */
|
||||
@Excel(name = "是否为默认(1否, 2是)")
|
||||
@ApiModelProperty(value = "是否为默认(1否, 2是)")
|
||||
private Long isDefault;
|
||||
|
||||
/** 菜谱类型(1默认,2按天,3按周,4按月) */
|
||||
@Excel(name = "菜谱类型(1默认,2按天,3按周,4按月)")
|
||||
@ApiModelProperty(value = "菜谱类型(1默认,2按天,3按周,4按月)")
|
||||
private Long recipeType;
|
||||
|
||||
/** 生效时间 */
|
||||
@ApiModelProperty(value = "生效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "生效时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date effectDate;
|
||||
|
||||
/** 到期时间 */
|
||||
@ApiModelProperty(value = "到期时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "到期时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date expireDate;
|
||||
|
||||
/** 食堂id */
|
||||
@Excel(name = "食堂id")
|
||||
@ApiModelProperty(value = "食堂id")
|
||||
@ApiModelProperty("食堂id")
|
||||
private Long canteenId;
|
||||
|
||||
/** 档口id */
|
||||
@Excel(name = "档口id")
|
||||
@ApiModelProperty(value = "档口id")
|
||||
@ApiModelProperty("档口id")
|
||||
private Long stallId;
|
||||
|
||||
/** 启用状态(1-启用, 2-禁用) */
|
||||
@Excel(name = "启用状态(1-启用, 2-禁用)")
|
||||
@ApiModelProperty(value = "启用状态(1-启用, 2-禁用)")
|
||||
private Long enableFlag;
|
||||
|
||||
/** 乐观锁 */
|
||||
@Excel(name = "乐观锁")
|
||||
@ApiModelProperty(value = "乐观锁")
|
||||
private Long revision;
|
||||
|
||||
@ApiModelProperty("适用人员范围")
|
||||
private Long effId;
|
||||
@ApiModelProperty("删除标识")
|
||||
private Integer delFlag;
|
||||
@ApiModelProperty("乐观锁")
|
||||
private Integer revision;
|
||||
@ApiModelProperty("创建人")
|
||||
private String createBy;
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
@ApiModelProperty("更新人")
|
||||
private String updateBy;
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
@ApiModelProperty("isDefault")
|
||||
private Integer isDefault;
|
||||
@ApiModelProperty("effectDate")
|
||||
private Integer effectDate;
|
||||
@ApiModelProperty("expireDate")
|
||||
private Integer expireDate;
|
||||
@ApiModelProperty("enableFlag")
|
||||
private Integer enableFlag;
|
||||
@ApiModelProperty("remark")
|
||||
private Integer remark;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
package com.bonus.canteen.core.menu.domain;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
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.extension.activerecord.Model;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -18,57 +25,38 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
|
||||
@Data
|
||||
@ToString
|
||||
public class MenuRecipeDetail extends BaseEntity {
|
||||
public class MenuRecipeDetail{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
@TableId
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
/** 菜谱详情id */
|
||||
@Excel(name = "菜谱详情id")
|
||||
@ApiModelProperty(value = "菜谱详情id")
|
||||
@ApiModelProperty("菜谱详情id")
|
||||
private Long detailId;
|
||||
|
||||
/** 菜品计划销售类别id(数据同步) */
|
||||
@Excel(name = "菜品计划销售类别id(数据同步)")
|
||||
@ApiModelProperty(value = "菜品计划销售类别id(数据同步)")
|
||||
private String saleTypeId;
|
||||
|
||||
/** 菜谱id */
|
||||
@Excel(name = "菜谱id")
|
||||
@ApiModelProperty(value = "菜谱id")
|
||||
@ApiModelProperty("菜品计划销售类别id(数据同步)")
|
||||
private Long saleTypeId;
|
||||
@ApiModelProperty("菜谱id")
|
||||
private Long recipeId;
|
||||
|
||||
/** 启用时间(天) */
|
||||
@ApiModelProperty(value = "启用时间(天)")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "启用时间(天)", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date 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;
|
||||
|
||||
/** 乐观锁 */
|
||||
@Excel(name = "乐观锁")
|
||||
@ApiModelProperty(value = "乐观锁")
|
||||
private Long revision;
|
||||
@ApiModelProperty("启用时间(天)")
|
||||
private LocalDate applyDate;
|
||||
@ApiModelProperty("启用时间(天)")
|
||||
private LocalDate endDate;
|
||||
@ApiModelProperty("餐次类型")
|
||||
private Integer mealtimeType;
|
||||
@ApiModelProperty("详情类型(1-模板,2-详情)")
|
||||
private Integer detailType;
|
||||
@ApiModelProperty("启用时间(周)")
|
||||
private Integer applyWeek;
|
||||
@ApiModelProperty("乐观锁")
|
||||
private Integer revision;
|
||||
@ApiModelProperty("创建人")
|
||||
private String createBy;
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
@ApiModelProperty("更新人")
|
||||
private String updateBy;
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,16 @@
|
|||
package com.bonus.canteen.core.menu.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
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;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
|
@ -18,88 +26,54 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
|
||||
@Data
|
||||
@ToString
|
||||
public class MenuRecipeDishes extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
@TableName("menu_recipe_dishes")
|
||||
@ApiModel("菜品计划菜品关联")
|
||||
public class MenuRecipeDishes extends Model<MenuRecipeDishes> {
|
||||
@ApiModelProperty("主键id")
|
||||
private Long id;
|
||||
|
||||
/** 菜谱详情id */
|
||||
@Excel(name = "菜谱详情id")
|
||||
@ApiModelProperty(value = "菜谱详情id")
|
||||
@ApiModelProperty("菜谱详情id")
|
||||
private Long detailId;
|
||||
|
||||
/** 菜品id */
|
||||
@Excel(name = "菜品id")
|
||||
@ApiModelProperty(value = "菜品id")
|
||||
@ApiModelProperty("菜品id")
|
||||
private Long dishesId;
|
||||
|
||||
/** 菜品单价 */
|
||||
@Excel(name = "菜品单价")
|
||||
@ApiModelProperty(value = "菜品单价")
|
||||
private Long price;
|
||||
|
||||
/** 规格类型(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)")
|
||||
@ApiModelProperty("菜品单价")
|
||||
private Integer price;
|
||||
@ApiModelProperty("规格类型(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 = "剩余数量")
|
||||
@ApiModelProperty("供应数量")
|
||||
private Integer supplyNum;
|
||||
@ApiModelProperty("销售数量")
|
||||
private Integer saleNum;
|
||||
@ApiModelProperty("剩余数量")
|
||||
private Integer surplusNum;
|
||||
|
||||
/** 个人限购数量 */
|
||||
@Excel(name = "个人限购数量")
|
||||
@ApiModelProperty(value = "个人限购数量")
|
||||
private Long restrictNum;
|
||||
|
||||
/** 菜品价格(优惠价) */
|
||||
@Excel(name = "菜品价格(优惠价)")
|
||||
@ApiModelProperty(value = "菜品价格(优惠价)")
|
||||
private Long salePrice;
|
||||
|
||||
/** 优惠开始时间 */
|
||||
@ApiModelProperty(value = "优惠开始时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "优惠开始时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date saleStart;
|
||||
|
||||
/** 优惠结束时间 */
|
||||
@ApiModelProperty(value = "优惠结束时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "优惠结束时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date saleEnd;
|
||||
|
||||
/** 厨师id */
|
||||
@Excel(name = "厨师id")
|
||||
@ApiModelProperty(value = "厨师id")
|
||||
private Long chefId;
|
||||
|
||||
/** 是否推荐(1-推荐,2-非推荐) */
|
||||
@Excel(name = "是否推荐(1-推荐,2-非推荐)")
|
||||
@ApiModelProperty(value = "是否推荐(1-推荐,2-非推荐)")
|
||||
private Long recommendFlag;
|
||||
|
||||
/** 排序号 */
|
||||
@Excel(name = "排序号")
|
||||
@ApiModelProperty(value = "排序号")
|
||||
private Long sortNum;
|
||||
|
||||
/** 乐观锁 */
|
||||
@Excel(name = "乐观锁")
|
||||
@ApiModelProperty(value = "乐观锁")
|
||||
private Long revision;
|
||||
|
||||
@ApiModelProperty("个人限购数量")
|
||||
private Integer restrictNum;
|
||||
@ApiModelProperty("菜品价格(优惠价)")
|
||||
private Integer salePrice;
|
||||
@ApiModelProperty("是否推荐")
|
||||
private Integer recommendFlag;
|
||||
@ApiModelProperty("排序号")
|
||||
private Integer sortNum;
|
||||
@ApiModelProperty("乐观锁")
|
||||
private Integer revision;
|
||||
@TableField(
|
||||
fill = FieldFill.INSERT
|
||||
)
|
||||
@ApiModelProperty("创建人")
|
||||
private String createBy;
|
||||
@TableField(
|
||||
fill = FieldFill.INSERT
|
||||
)
|
||||
@ApiModelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
@TableField(
|
||||
fill = FieldFill.INSERT_UPDATE
|
||||
)
|
||||
@ApiModelProperty("更新人")
|
||||
private String updateBy;
|
||||
@TableField(
|
||||
fill = FieldFill.INSERT_UPDATE
|
||||
)
|
||||
@ApiModelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
package com.bonus.canteen.core.menu.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class GetRecipeDTO {
|
||||
private Long recipeId;
|
||||
private Integer recipeType;
|
||||
private List<Integer> weeks;
|
||||
private Boolean isComplete;
|
||||
private MenuRecipeAddDTO menuRecipeV2Add;
|
||||
|
||||
public Long getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
public Integer getRecipeType() {
|
||||
return this.recipeType;
|
||||
}
|
||||
|
||||
public List<Integer> getWeeks() {
|
||||
return this.weeks;
|
||||
}
|
||||
|
||||
public Boolean getIsComplete() {
|
||||
return this.isComplete;
|
||||
}
|
||||
|
||||
public MenuRecipeAddDTO getMenuRecipeV2Add() {
|
||||
return this.menuRecipeV2Add;
|
||||
}
|
||||
|
||||
public GetRecipeDTO setRecipeId(final Long recipeId) {
|
||||
this.recipeId = recipeId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetRecipeDTO setRecipeType(final Integer recipeType) {
|
||||
this.recipeType = recipeType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetRecipeDTO setWeeks(final List<Integer> weeks) {
|
||||
this.weeks = weeks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetRecipeDTO setIsComplete(final Boolean isComplete) {
|
||||
this.isComplete = isComplete;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetRecipeDTO setMenuRecipeV2Add(final MenuRecipeAddDTO menuRecipeV2Add) {
|
||||
this.menuRecipeV2Add = menuRecipeV2Add;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.bonus.canteen.core.menu.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MenuSendByDTO {
|
||||
@ApiModelProperty("食堂id")
|
||||
Long canteenId;
|
||||
@ApiModelProperty("档口id")
|
||||
Long stallId;
|
||||
@ApiModelProperty("餐线id")
|
||||
Long mealLineId;
|
||||
@ApiModelProperty("设备类型")
|
||||
List<Integer> deviceTypeList;
|
||||
|
||||
public Long getCanteenId() {
|
||||
return this.canteenId;
|
||||
}
|
||||
|
||||
public Long getStallId() {
|
||||
return this.stallId;
|
||||
}
|
||||
|
||||
public Long getMealLineId() {
|
||||
return this.mealLineId;
|
||||
}
|
||||
|
||||
public List<Integer> getDeviceTypeList() {
|
||||
return this.deviceTypeList;
|
||||
}
|
||||
|
||||
public MenuSendByDTO setCanteenId(final Long canteenId) {
|
||||
this.canteenId = canteenId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MenuSendByDTO setStallId(final Long stallId) {
|
||||
this.stallId = stallId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MenuSendByDTO setMealLineId(final Long mealLineId) {
|
||||
this.mealLineId = mealLineId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MenuSendByDTO setDeviceTypeList(final List<Integer> deviceTypeList) {
|
||||
this.deviceTypeList = deviceTypeList;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.canteen.core.menu.dto;
|
||||
|
||||
|
||||
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 lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@Data
|
||||
public class RecipeProcessResult {
|
||||
private List<Long> templateDetailIds;
|
||||
private List<Long> haveDetailIds;
|
||||
private List<MenuRecipeDetail> recipeDetails;
|
||||
private List<MenuRecipeDishes> recipeDishes;
|
||||
private Long recipeId;
|
||||
private Boolean add;
|
||||
private MenuRecipe menuRecipe;
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.bonus.canteen.core.menu.enums;
|
||||
|
||||
public enum MenuBindTypeEnum {
|
||||
CURRENT(1, "当餐点餐"),
|
||||
RESERVE(2, "预订餐"),
|
||||
WEEK(3, "一周菜谱"),
|
||||
QR_CODE(4, "扫码点餐"),
|
||||
SELF_MACHINE(5, "自助终端"),
|
||||
MEAL_LINE(6, "自助餐线/小碗菜餐线"),
|
||||
TABLE(7, "智慧餐台/消费机"),
|
||||
PAD(8, "点餐机/手持机/平板"),
|
||||
SCREEN(9, "信息发布屏"),
|
||||
DISHES_IDENTIFY(10, "菜品识别"),
|
||||
NUTRITIONAL_PRICE_TAG(11, "营养价签");
|
||||
|
||||
private final Integer key;
|
||||
private final String value;
|
||||
|
||||
private MenuBindTypeEnum(Integer key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static Integer getKey(String value) {
|
||||
MenuBindTypeEnum[] enums = values();
|
||||
MenuBindTypeEnum[] var2 = enums;
|
||||
int var3 = enums.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
MenuBindTypeEnum temp = var2[var4];
|
||||
if (temp.value().equals(value)) {
|
||||
return temp.key();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getValue(Integer key) {
|
||||
MenuBindTypeEnum[] enums = values();
|
||||
MenuBindTypeEnum[] var2 = enums;
|
||||
int var3 = enums.length;
|
||||
|
||||
for(int var4 = 0; var4 < var3; ++var4) {
|
||||
MenuBindTypeEnum temp = var2[var4];
|
||||
if (temp.key().equals(key)) {
|
||||
return temp.value();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Integer key() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
package com.bonus.canteen.core.menu.enums;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public enum MenuRecipeSortEnum {
|
||||
MEALLINE(1, "自助餐线/小碗菜餐线", MenuBindTypeEnum.MEAL_LINE.key(), Arrays.asList(35, 32, 44, 30, 55, 58)),
|
||||
TABLE(2, "智慧餐台/消费机", MenuBindTypeEnum.TABLE.key(), Arrays.asList(20, 23, 41, 47, 21, 34)),
|
||||
BUFFET(3, "点餐机/手持机/平板", MenuBindTypeEnum.PAD.key(), Arrays.asList(41, 22, 36, 46, 63)),
|
||||
ISSUE(4, "信息发布屏", MenuBindTypeEnum.SCREEN.key(), Arrays.asList(40, 45)),
|
||||
ANDROID_SELF_RECHARGE(5, "自助终端菜谱公示", MenuBindTypeEnum.SELF_MACHINE.key(), Collections.singletonList(25)),
|
||||
MOBILE_CURRENT(6, "移动端当餐点餐", MenuBindTypeEnum.CURRENT.key(), new ArrayList()),
|
||||
MOBILE_RESERVE(7, "移动端预订餐", MenuBindTypeEnum.RESERVE.key(), new ArrayList()),
|
||||
MOBILE_WEEK(8, "移动端一周菜谱", MenuBindTypeEnum.WEEK.key(), new ArrayList()),
|
||||
DISHES_IDENTIFY(9, "菜品识别", MenuBindTypeEnum.DISHES_IDENTIFY.key(), Arrays.asList(50, 51)),
|
||||
NUTRITIONAL_PRICE_TAG(10, "营养价签", MenuBindTypeEnum.NUTRITIONAL_PRICE_TAG.key(), Collections.singletonList(57));
|
||||
|
||||
private final Integer key;
|
||||
private final String name;
|
||||
private final Integer bindType;
|
||||
private final List<Integer> deviceType;
|
||||
|
||||
private MenuRecipeSortEnum(Integer key, String name, Integer bindType, List deviceType) {
|
||||
this.key = key;
|
||||
this.name = name;
|
||||
this.bindType = bindType;
|
||||
this.deviceType = deviceType;
|
||||
}
|
||||
|
||||
public static Map<Integer, MenuRecipeSortEnum> getKeyMap() {
|
||||
return Arrays.stream(values()).collect(Collectors.toMap(MenuRecipeSortEnum::getKey, Function.identity()));
|
||||
}
|
||||
|
||||
public static Map<Integer, MenuRecipeSortEnum> getBindTypeMap() {
|
||||
return Arrays.stream(values()).collect(Collectors.toMap(MenuRecipeSortEnum::getBindType, Function.identity()));
|
||||
}
|
||||
|
||||
public static MenuRecipeSortEnum getByKey(Integer key) {
|
||||
return (MenuRecipeSortEnum)getKeyMap().get(key);
|
||||
}
|
||||
|
||||
public Integer getKey() {
|
||||
return this.key;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public Integer getBindType() {
|
||||
return this.bindType;
|
||||
}
|
||||
|
||||
public List<Integer> getDeviceType() {
|
||||
return this.deviceType;
|
||||
}
|
||||
|
||||
public static List<Integer> getDeviceBindTypes() {
|
||||
return Arrays.asList(MEALLINE.getBindType(), TABLE.getBindType(), BUFFET.getBindType(), ISSUE.getBindType(), ANDROID_SELF_RECHARGE.getBindType(), NUTRITIONAL_PRICE_TAG.getBindType());
|
||||
}
|
||||
}
|
||||
|
|
@ -1,18 +1,18 @@
|
|||
package com.bonus.canteen.core.menu.mapper;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
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.dto.MenuRecipeParamDTO;
|
||||
import com.bonus.canteen.core.menu.dto.RecipeDishesCountDTO;
|
||||
import com.bonus.canteen.core.menu.domain.MenuRecipeDetail;
|
||||
import com.bonus.canteen.core.menu.domain.MenuRecipeDishes;
|
||||
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.MenuRecipeV2VO;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
|
|
@ -21,10 +21,10 @@ import org.apache.ibatis.annotations.Param;
|
|||
* @author xsheng
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
public interface MenuRecipeMapper {
|
||||
public interface MenuRecipeMapper extends BaseMapper<MenuRecipe> {
|
||||
/**
|
||||
* 查询菜品计划信息
|
||||
*
|
||||
*
|
||||
* @param id 菜品计划信息主键
|
||||
* @return 菜品计划信息
|
||||
*/
|
||||
|
|
@ -32,7 +32,7 @@ public interface MenuRecipeMapper {
|
|||
|
||||
/**
|
||||
* 查询菜品计划信息列表
|
||||
*
|
||||
*
|
||||
* @param menuRecipe 菜品计划信息
|
||||
* @return 菜品计划信息集合
|
||||
*/
|
||||
|
|
@ -40,7 +40,7 @@ public interface MenuRecipeMapper {
|
|||
|
||||
/**
|
||||
* 新增菜品计划信息
|
||||
*
|
||||
*
|
||||
* @param menuRecipe 菜品计划信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -48,7 +48,7 @@ public interface MenuRecipeMapper {
|
|||
|
||||
/**
|
||||
* 修改菜品计划信息
|
||||
*
|
||||
*
|
||||
* @param menuRecipe 菜品计划信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -56,7 +56,7 @@ public interface MenuRecipeMapper {
|
|||
|
||||
/**
|
||||
* 删除菜品计划信息
|
||||
*
|
||||
*
|
||||
* @param id 菜品计划信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -64,7 +64,7 @@ public interface MenuRecipeMapper {
|
|||
|
||||
/**
|
||||
* 批量删除菜品计划信息
|
||||
*
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -72,18 +72,23 @@ public interface MenuRecipeMapper {
|
|||
|
||||
/**
|
||||
* 获取菜品列表
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
List<MenuRecipeV2VO> getDishesList(MenuRecipeParamDTO dto);
|
||||
|
||||
/**
|
||||
* 根据recipeIds获取菜品数量
|
||||
*
|
||||
* @param recipeIds
|
||||
* @return
|
||||
*/
|
||||
List<RecipeDishesCountDTO> getDishesCountByRecipeIds(@Param("recipeIds") List<Long> recipeIds);
|
||||
|
||||
/**
|
||||
* 根据recipeIds获取日期
|
||||
*
|
||||
* @param recipeIds
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -91,8 +96,48 @@ public interface MenuRecipeMapper {
|
|||
|
||||
/**
|
||||
* 查询基础
|
||||
*
|
||||
* @param baseDishesIdList
|
||||
* @return
|
||||
*/
|
||||
List<MenuBaseModel> selectBaseSizeDishesId(@Param("baseDishesIdList") List<Long> baseDishesIdList);
|
||||
|
||||
Long selectCount(MenuRecipeAddDTO dto);
|
||||
|
||||
void insertData(MenuRecipe recipe);
|
||||
|
||||
MenuRecipe getOneById(Long recipeId);
|
||||
|
||||
List<Long> selectDetailIds(@Param("dto") GetRecipeDTO dto, @Param("mealType") Integer mealType);
|
||||
|
||||
List<MenuRecipeDetail> selectDetailsList(
|
||||
@Param("dto") GetRecipeDTO dto,
|
||||
@Param("currentDate") LocalDate currentDate,
|
||||
@Param("mealType") Integer mealType
|
||||
);
|
||||
|
||||
List<MenuRecipeDishes> getMenuRecipeDishesList(@Param("haveDetailIds") List<Long> haveDetailIds);
|
||||
|
||||
List<MenuRecipeDetail> selectMenuRecipeDetail(@Param("bean") MenuRecipeDetail menuRecipeDetailBean,@Param("weeks") List<Integer> weeks);
|
||||
|
||||
List<Long> selectDetailIdListByWrapper(
|
||||
@Param("recipeId") Long recipeId,
|
||||
@Param("applyDateList") List<LocalDate> applyDateList,
|
||||
@Param("isComplete") Boolean isComplete,
|
||||
@Param("recipeDateList") List<MenuRecipeDateAddDTO> recipeDateList
|
||||
);
|
||||
|
||||
List<MenuRecipeDishes> selectBatchIds(@Param("ids") List<Long> ids);
|
||||
|
||||
void deleteMenuRecipeDetailByIds(@Param("list") List<Long> detailIds);
|
||||
|
||||
void deleteMenuRecipeDishesByIds(@Param("list") List<Long> detailIds);
|
||||
|
||||
void insertMenuDetails(@Param("menuDetails") List<MenuRecipeDetail> recipeDetailV2List);
|
||||
|
||||
void insertMenuDishes(@Param("menuDishes") List<MenuRecipeDishes> recipeDishesV2List);
|
||||
|
||||
List<MenuAppRecipe> selectAppRecipeList(Long recipeId);
|
||||
|
||||
void updateMenuRecipeDetail(@Param("recipeId") Long recipeId,@Param("time") LocalDateTime now);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.canteen.core.menu.service;
|
||||
|
||||
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;
|
||||
|
|
@ -14,7 +16,7 @@ import javax.validation.Valid;
|
|||
* @author xsheng
|
||||
* @date 2025-04-03
|
||||
*/
|
||||
public interface IMenuRecipeService {
|
||||
public interface IMenuRecipeService extends IService<MenuRecipe> {
|
||||
/**
|
||||
* 菜谱列表-获取菜品列表
|
||||
* @param dto
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.bonus.canteen.core.menu.service.impl;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
|
|
@ -50,7 +52,7 @@ public class MenuRecipeDetailServiceImpl implements IMenuRecipeDetailService {
|
|||
*/
|
||||
@Override
|
||||
public int insertMenuRecipeDetail(MenuRecipeDetail menuRecipeDetail) {
|
||||
menuRecipeDetail.setCreateTime(DateUtils.getNowDate());
|
||||
menuRecipeDetail.setCreateTime(LocalDateTime.now());
|
||||
try {
|
||||
return menuRecipeDetailMapper.insertMenuRecipeDetail(menuRecipeDetail);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -66,7 +68,7 @@ public class MenuRecipeDetailServiceImpl implements IMenuRecipeDetailService {
|
|||
*/
|
||||
@Override
|
||||
public int updateMenuRecipeDetail(MenuRecipeDetail menuRecipeDetail) {
|
||||
menuRecipeDetail.setUpdateTime(DateUtils.getNowDate());
|
||||
menuRecipeDetail.setUpdateTime(LocalDateTime.now());
|
||||
try {
|
||||
return menuRecipeDetailMapper.updateMenuRecipeDetail(menuRecipeDetail);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.canteen.core.menu.service.impl;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
|
|
@ -50,7 +51,7 @@ public class MenuRecipeDishesServiceImpl implements IMenuRecipeDishesService {
|
|||
*/
|
||||
@Override
|
||||
public int insertMenuRecipeDishes(MenuRecipeDishes menuRecipeDishes) {
|
||||
menuRecipeDishes.setCreateTime(DateUtils.getNowDate());
|
||||
menuRecipeDishes.setCreateTime(LocalDateTime.now());
|
||||
try {
|
||||
return menuRecipeDishesMapper.insertMenuRecipeDishes(menuRecipeDishes);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -66,7 +67,7 @@ public class MenuRecipeDishesServiceImpl implements IMenuRecipeDishesService {
|
|||
*/
|
||||
@Override
|
||||
public int updateMenuRecipeDishes(MenuRecipeDishes menuRecipeDishes) {
|
||||
menuRecipeDishes.setUpdateTime(DateUtils.getNowDate());
|
||||
menuRecipeDishes.setUpdateTime(LocalDateTime.now());
|
||||
try {
|
||||
return menuRecipeDishesMapper.updateMenuRecipeDishes(menuRecipeDishes);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -2,16 +2,31 @@ package com.bonus.canteen.core.menu.service.impl;
|
|||
|
||||
import java.time.DayOfWeek;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.TemporalAccessor;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
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.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;
|
||||
|
|
@ -21,6 +36,11 @@ import com.bonus.canteen.core.menu.vo.MenuRecipeV2VO;
|
|||
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;
|
||||
import com.bonus.common.houqin.mq.constant.LeMqConstant;
|
||||
import com.bonus.common.houqin.utils.id.Id;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -35,7 +55,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
* @date 2025-04-03
|
||||
*/
|
||||
@Service
|
||||
public class MenuRecipeServiceImpl implements IMenuRecipeService {
|
||||
public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRecipe> implements IMenuRecipeService {
|
||||
@Autowired
|
||||
private MenuRecipeMapper menuRecipeMapper;
|
||||
|
||||
|
|
@ -86,9 +106,200 @@ public class MenuRecipeServiceImpl implements IMenuRecipeService {
|
|||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Long add(MenuRecipeAddDTO dto) {
|
||||
this.changeBaseDishesIdTo(dto);
|
||||
return 0L;
|
||||
Long recipeId = dto.getRecipeId();
|
||||
String userName = SecurityUtils.getUsername();
|
||||
Integer recipeType = dto.getRecipeType();
|
||||
MenuRecipe recipe;
|
||||
Boolean add;
|
||||
if (ObjectUtil.isNull(recipeId)) {
|
||||
Long count = menuRecipeMapper.selectCount(dto);
|
||||
if (ObjectUtil.isNotNull(count) && count > 0L) {
|
||||
throw new ServiceException(I18n.getMessage("菜单菜谱名称重复", new Object[0]));
|
||||
}
|
||||
recipeId = Id.next();
|
||||
recipe = new MenuRecipe();
|
||||
recipe.setRecipeId(recipeId);
|
||||
recipe.setRecipeType(dto.getRecipeType());
|
||||
recipe.setRecipeName(dto.getRecipeName());
|
||||
recipe.setCanteenId(ObjectUtil.isNull(dto.getCanteenId()) ? -1L : dto.getCanteenId());
|
||||
recipe.setStallId(ObjectUtil.isNull(dto.getStallId()) ? -1L : dto.getStallId());
|
||||
recipe.setCreateBy(userName);
|
||||
menuRecipeMapper.insertData(recipe);
|
||||
add = true;
|
||||
} else {
|
||||
recipe = menuRecipeMapper.getOneById(recipeId);
|
||||
recipe.setRecipeName(dto.getRecipeName());
|
||||
recipeType = Math.toIntExact(recipe.getRecipeType());
|
||||
add = false;
|
||||
}
|
||||
|
||||
if (ObjectUtil.isEmpty(dto.getRecipeDateList())) {
|
||||
return recipeId;
|
||||
} else {
|
||||
RecipeProcessResult result;
|
||||
if (ObjectUtil.equal(recipeType, 3)) {
|
||||
result = this.processWeek(dto, recipeId);
|
||||
} else if (ObjectUtil.equal(recipeType, 2)) {
|
||||
result = this.processDay(dto, recipeId);
|
||||
} else {
|
||||
result = this.processDefault(dto, recipeId);
|
||||
}
|
||||
|
||||
result.setRecipeId(recipeId);
|
||||
result.setMenuRecipe(recipe);
|
||||
result.setAdd(add);
|
||||
this.processResult(result);
|
||||
return recipeId;
|
||||
}
|
||||
}
|
||||
|
||||
public void processResult(RecipeProcessResult result) {
|
||||
List<Long> detailIds = result.getTemplateDetailIds();
|
||||
MenuRecipe menuRecipe = result.getMenuRecipe();
|
||||
if (ObjectUtil.isNotEmpty(detailIds)) {
|
||||
menuRecipeMapper.deleteMenuRecipeDetailByIds(detailIds);
|
||||
menuRecipeMapper.deleteMenuRecipeDishesByIds(detailIds);
|
||||
}
|
||||
|
||||
List<Long> haveDetailIds = result.getHaveDetailIds();
|
||||
if (ObjectUtil.isNotEmpty(haveDetailIds)) {
|
||||
menuRecipeMapper.deleteMenuRecipeDishesByIds(haveDetailIds);
|
||||
}
|
||||
|
||||
List<MenuRecipeDetail> recipeDetailV2List = result.getRecipeDetails();
|
||||
if (ObjectUtil.isNotEmpty(recipeDetailV2List)) {
|
||||
menuRecipeMapper.insertMenuDetails(recipeDetailV2List);
|
||||
}
|
||||
|
||||
List<MenuRecipeDishes> recipeDishesV2List = result.getRecipeDishes();
|
||||
if (ObjectUtil.isNotEmpty(recipeDishesV2List)) {
|
||||
recipeDishesV2List.forEach((r) -> {
|
||||
r.setId((Long)null);
|
||||
Integer surplusNum = r.getSurplusNum();
|
||||
if (ObjectUtil.isNull(surplusNum) || surplusNum <= 0) {
|
||||
r.setSurplusNum(0);
|
||||
}
|
||||
|
||||
});
|
||||
menuRecipeMapper.insertMenuDishes(recipeDishesV2List);
|
||||
}
|
||||
|
||||
LeMqConstant.DataChangeType type;
|
||||
String redisKey;
|
||||
if (result.getAdd()) {
|
||||
type = LeMqConstant.DataChangeType.ADD;
|
||||
} else {
|
||||
type = LeMqConstant.DataChangeType.UPDATE;
|
||||
redisKey = Optional.ofNullable(menuRecipe).map(MenuRecipe::getRecipeName).orElse(null);
|
||||
this.update(Wrappers.lambdaUpdate(MenuRecipe.class).eq(MenuRecipe::getRecipeId, result.getRecipeId())
|
||||
.set(ObjectUtil.isNotEmpty(redisKey), MenuRecipe::getRecipeName, redisKey)
|
||||
.set(MenuRecipe::getUpdateTime, LocalDateTime.now()));
|
||||
this.menuRecipeMapper.updateMenuRecipeDetail(result.getRecipeId(),LocalDateTime.now());
|
||||
List<MenuAppRecipe> menuAppRecipes = this.menuRecipeMapper.selectAppRecipeList(result.getRecipeId());
|
||||
if (ObjectUtil.isNotEmpty(menuAppRecipes)) {
|
||||
Map<Integer, MenuRecipeSortEnum> bindTypeMap = MenuRecipeSortEnum.getBindTypeMap();
|
||||
List<Integer> deviceBindTypes = MenuRecipeSortEnum.getDeviceBindTypes();
|
||||
List<MenuSendByDTO> menuSendByDTOS = menuAppRecipes.stream()
|
||||
.filter((x) -> deviceBindTypes.contains(x.getBindType())).map((item) -> {
|
||||
MenuSendByDTO menuSendByDTO = new MenuSendByDTO();
|
||||
menuSendByDTO.setStallId(menuRecipe.getStallId());
|
||||
menuSendByDTO.setCanteenId(menuRecipe.getCanteenId());
|
||||
menuSendByDTO.setMealLineId(item.getMealLineId());
|
||||
menuSendByDTO.setDeviceTypeList((bindTypeMap.get(item.getBindType())).getDeviceType());
|
||||
return menuSendByDTO;
|
||||
}).collect(Collectors.toList());
|
||||
//TODO 发送mq
|
||||
// this.deviceApi.sendMenuByCanteen(result.getRecipeId(), menuSendByDTOS);
|
||||
}
|
||||
}
|
||||
|
||||
MqUtil.sendDataChange(menuRecipe, type, LeMqConstant.Topic.DATA_CHANGE_RECIPE);
|
||||
redisKey = String.format("yst:%s:recipe:%s:detail:%s", TenantContextHolder.getTenantId(), result.getRecipeId(), "*");
|
||||
RedisUtil.deleteByPattern(redisKey);
|
||||
}
|
||||
public RecipeProcessResult processDefault(MenuRecipeAddDTO content, Long recipeId) {
|
||||
return this.processDefault(content, recipeId, true);
|
||||
}
|
||||
public RecipeProcessResult processDefault(MenuRecipeAddDTO content, Long recipeId, Boolean isComplete) {
|
||||
RecipeProcessResult result = new RecipeProcessResult();
|
||||
String username = SecurityUtils.getUsername();
|
||||
List<MenuRecipeDateAddDTO> recipeDateList = content.getRecipeDateList();
|
||||
List<MenuRecipeDetail> recipeDetailV2List = Lists.newArrayList();
|
||||
List<MenuRecipeDishes> recipeDishesV2List = Lists.newArrayList();
|
||||
List<Long> ids = recipeDateList.stream()
|
||||
.filter((x) -> ObjectUtil.isNotNull(x.getDetailList()))
|
||||
.flatMap((x) -> x.getDetailList().stream())
|
||||
.filter((x) -> ObjectUtil.isNotNull(x.getDishesList()))
|
||||
.flatMap((x) -> x.getDishesList().stream())
|
||||
.map(MenuRecipeDishesAddDTO::getId)
|
||||
.filter(ObjectUtil::isNotNull).collect(Collectors.toList());
|
||||
Map<Long, Integer> idAndSalesMap = new HashMap<>();
|
||||
if (ObjectUtil.isNotEmpty(ids)) {
|
||||
List<MenuRecipeDishes> menuRecipeDishes = this.menuRecipeMapper.selectBatchIds(ids);
|
||||
idAndSalesMap = menuRecipeDishes.stream().collect(Collectors.groupingBy(MenuRecipeDishes::getId,
|
||||
Collectors.collectingAndThen(Collectors.toList(), (x) -> (x.get(0)).getSaleNum())));
|
||||
}
|
||||
|
||||
Map<Long, Integer> finalIdAndSalesMap = idAndSalesMap;
|
||||
Iterator<MenuRecipeDateAddDTO> var12 = recipeDateList.iterator();
|
||||
|
||||
List<MenuRecipeDetailAddDTO> detailIdList;
|
||||
while(var12.hasNext()) {
|
||||
MenuRecipeDateAddDTO rd = var12.next();
|
||||
detailIdList = rd.getDetailList();
|
||||
detailIdList = detailIdList.stream().filter((d) -> {
|
||||
return ObjectUtil.isNotEmpty(d.getDishesList());
|
||||
}).collect(Collectors.toList());
|
||||
if (!ObjectUtil.isEmpty(detailIdList)) {
|
||||
detailIdList.forEach((in) -> {
|
||||
List<MenuRecipeDishesAddDTO> dishesList = in.getDishesList();
|
||||
if (ObjectUtil.isNotEmpty(dishesList)) {
|
||||
this.checkDishesList(dishesList);
|
||||
}
|
||||
|
||||
});
|
||||
detailIdList.forEach((in) -> {
|
||||
List<MenuRecipeDishesAddDTO> dishesList = in.getDishesList();
|
||||
MenuRecipeDetail detailItem = new MenuRecipeDetail();
|
||||
Long detailId = Id.next();
|
||||
detailItem.setDetailId(detailId);
|
||||
detailItem.setRecipeId(recipeId);
|
||||
detailItem.setApplyDate(rd.getApplyDate());
|
||||
detailItem.setMealtimeType(in.getMealtimeType());
|
||||
detailItem.setCreateBy(username);
|
||||
recipeDetailV2List.add(detailItem);
|
||||
dishesList.forEach((di) -> {
|
||||
MenuRecipeDishes dishesItem = new MenuRecipeDishes();
|
||||
Integer salesSum = Optional.ofNullable(finalIdAndSalesMap.get(di.getId())).orElse(0);
|
||||
dishesItem.setDetailId(detailId);
|
||||
dishesItem.setDishesId(di.getDishesId());
|
||||
dishesItem.setPrice(di.getPrice());
|
||||
dishesItem.setSizeType(di.getSizeType());
|
||||
dishesItem.setSaleNum(salesSum);
|
||||
dishesItem.setSupplyNum(di.getSupplyNum());
|
||||
int surplusNum = di.getSupplyNum() - salesSum;
|
||||
if (surplusNum <= 0) {
|
||||
surplusNum = 0;
|
||||
}
|
||||
|
||||
dishesItem.setSurplusNum(surplusNum);
|
||||
dishesItem.setRestrictNum(di.getRestrictNum());
|
||||
dishesItem.setSalePrice(Optional.ofNullable(di.getSalePrice()).orElse(di.getPrice()));
|
||||
dishesItem.setRecommendFlag(di.getRecommendFlag());
|
||||
dishesItem.setSortNum(di.getSortNum());
|
||||
recipeDishesV2List.add(dishesItem);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
List<LocalDate> applyDateList = recipeDateList.stream().map(MenuRecipeDateAddDTO::getApplyDate).collect(Collectors.toList());
|
||||
List<Long> detailIdLists = this.menuRecipeMapper.selectDetailIdListByWrapper(recipeId,applyDateList,isComplete,recipeDateList);
|
||||
result.setTemplateDetailIds(detailIdLists);
|
||||
result.setRecipeDetails(recipeDetailV2List);
|
||||
result.setRecipeDishes(recipeDishesV2List);
|
||||
return result;
|
||||
}
|
||||
public List<LocalDate> getLastWeekDate() {
|
||||
List<LocalDate> objects = new ArrayList<>();
|
||||
LocalDate sunday = LocalDate.now().with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));
|
||||
|
|
@ -153,5 +364,397 @@ public class MenuRecipeServiceImpl implements IMenuRecipeService {
|
|||
});
|
||||
}
|
||||
}
|
||||
public RecipeProcessResult processDay(MenuRecipeAddDTO content, Long recipeId) {
|
||||
return this.processDay(content, recipeId, true);
|
||||
}
|
||||
|
||||
public RecipeProcessResult processDay(MenuRecipeAddDTO content, Long recipeId, Boolean isComplete) {
|
||||
RecipeProcessResult result = new RecipeProcessResult();
|
||||
List<MenuRecipeDateAddDTO> recipeDateList = content.getRecipeDateList();
|
||||
GetRecipeDTO getRecipeDto = new GetRecipeDTO();
|
||||
getRecipeDto.setRecipeId(recipeId).setRecipeType(2).setIsComplete(isComplete).setMenuRecipeV2Add(content);
|
||||
List<Long> detailIds = this.getTemplateDetailIds(getRecipeDto);
|
||||
MenuRecipeDateAddDTO menuRecipeDateV2AddDTO = recipeDateList.get(0);
|
||||
List<MenuRecipeDetailAddDTO> detailList = menuRecipeDateV2AddDTO.getDetailList();
|
||||
List<MenuRecipeDetail> recipeDetailV2List = Lists.newArrayList();
|
||||
List<MenuRecipeDishes> recipeDishesV2List = Lists.newArrayList();
|
||||
if (ObjectUtil.isNotEmpty(detailList)) {
|
||||
String username = SecurityUtils.getUsername();
|
||||
|
||||
for (MenuRecipeDetailAddDTO menuRecipeDetailV2AddDTO : detailList) {
|
||||
Integer mealtimeType = menuRecipeDetailV2AddDTO.getMealtimeType();
|
||||
MenuRecipeDetail detailItem = new MenuRecipeDetail();
|
||||
Long detailId = Id.next();
|
||||
detailItem.setDetailId(detailId);
|
||||
detailItem.setRecipeId(recipeId);
|
||||
detailItem.setMealtimeType(mealtimeType);
|
||||
detailItem.setCreateBy(username);
|
||||
detailItem.setDetailType(1);
|
||||
recipeDetailV2List.add(detailItem);
|
||||
List<MenuRecipeDishesAddDTO> dishesList = menuRecipeDetailV2AddDTO.getDishesList();
|
||||
if (ObjectUtil.isNotEmpty(dishesList)) {
|
||||
this.checkDishesList(dishesList);
|
||||
this.addMenuDishesToList(recipeDishesV2List, detailId, dishesList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<MenuRecipeDetail> menuRecipeDetails = this.getGeNowMenuRecipeDetail(getRecipeDto);
|
||||
List<Long> haveDetailIds = menuRecipeDetails.stream().map(MenuRecipeDetail::getDetailId)
|
||||
.collect(Collectors.toList());
|
||||
this.getDayActiveMenuRecipeDetailDishes(menuRecipeDetails, detailList, recipeDishesV2List, haveDetailIds);
|
||||
this.creatLastWeekRecipe(menuRecipeDateV2AddDTO, recipeDishesV2List, recipeDetailV2List, recipeId);
|
||||
result.setTemplateDetailIds(detailIds);
|
||||
result.setHaveDetailIds(haveDetailIds);
|
||||
result.setRecipeDetails(recipeDetailV2List);
|
||||
result.setRecipeDishes(recipeDishesV2List);
|
||||
return result;
|
||||
}
|
||||
|
||||
public RecipeProcessResult processWeek(MenuRecipeAddDTO content, Long recipeId) {
|
||||
return this.processWeek(content, recipeId, true);
|
||||
}
|
||||
|
||||
public RecipeProcessResult processWeek(MenuRecipeAddDTO content, Long recipeId, Boolean isComplete) {
|
||||
RecipeProcessResult result = new RecipeProcessResult();
|
||||
List<MenuRecipeDateAddDTO> recipeDateList = content.getRecipeDateList();
|
||||
List<MenuRecipeDetail> recipeDetailV2List = Lists.newArrayList();
|
||||
List<MenuRecipeDishes> recipeDishesV2List = Lists.newArrayList();
|
||||
String username = SecurityUtils.getUsername();
|
||||
List<Integer> weeks = recipeDateList.stream().map(MenuRecipeDateAddDTO::getApplyWeek).collect(Collectors.toList());
|
||||
GetRecipeDTO getRecipeDto = new GetRecipeDTO();
|
||||
getRecipeDto.setRecipeId(recipeId).setRecipeType(3).setMenuRecipeV2Add(content).setWeeks(weeks).setIsComplete(isComplete);
|
||||
List<Long> detailIds = this.getTemplateDetailIds(getRecipeDto);
|
||||
Iterator var12 = recipeDateList.iterator();
|
||||
|
||||
while(true) {
|
||||
Integer applyWeek;
|
||||
List detailList;
|
||||
do {
|
||||
if (!var12.hasNext()) {
|
||||
List<MenuRecipeDetail> menuRecipeDetails = this.getGeNowMenuRecipeDetail(getRecipeDto);
|
||||
List<Long> haveDetailIds = menuRecipeDetails.stream().map(MenuRecipeDetail::getDetailId).collect(Collectors.toList());
|
||||
this.getActiveMenuRecipeDetailDisnes(menuRecipeDetails, recipeDateList, recipeDishesV2List, haveDetailIds);
|
||||
this.creatLastWeekRecipe(recipeDateList, recipeDishesV2List, recipeDetailV2List, recipeId, weeks);
|
||||
result.setTemplateDetailIds(detailIds);
|
||||
result.setHaveDetailIds(haveDetailIds);
|
||||
result.setRecipeDetails(recipeDetailV2List);
|
||||
result.setRecipeDishes(recipeDishesV2List);
|
||||
return result;
|
||||
}
|
||||
|
||||
MenuRecipeDateAddDTO menuRecipeDateV2AddDTO = (MenuRecipeDateAddDTO)var12.next();
|
||||
applyWeek = menuRecipeDateV2AddDTO.getApplyWeek();
|
||||
detailList = menuRecipeDateV2AddDTO.getDetailList();
|
||||
} while(ObjectUtil.isEmpty(detailList));
|
||||
|
||||
Iterator var16 = detailList.iterator();
|
||||
|
||||
while(var16.hasNext()) {
|
||||
MenuRecipeDetailAddDTO menuRecipeDetailV2AddDTO = (MenuRecipeDetailAddDTO)var16.next();
|
||||
Integer mealtimeType = menuRecipeDetailV2AddDTO.getMealtimeType();
|
||||
MenuRecipeDetail detailItem = new MenuRecipeDetail();
|
||||
Long detailId = Id.next();
|
||||
detailItem.setDetailId(detailId);
|
||||
detailItem.setRecipeId(recipeId);
|
||||
detailItem.setApplyWeek(applyWeek);
|
||||
detailItem.setMealtimeType(mealtimeType);
|
||||
detailItem.setCreateBy(username);
|
||||
detailItem.setDetailType(1);
|
||||
recipeDetailV2List.add(detailItem);
|
||||
List<MenuRecipeDishesAddDTO> dishesList = menuRecipeDetailV2AddDTO.getDishesList();
|
||||
if (ObjectUtil.isNotEmpty(dishesList)) {
|
||||
this.checkDishesList(dishesList);
|
||||
this.addMenuDishesToList(recipeDishesV2List, detailId, dishesList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Long> getTemplateDetailIds(GetRecipeDTO getRecipeDto) {
|
||||
// 计算mealType参数
|
||||
Integer mealType = null;
|
||||
if (!getRecipeDto.getIsComplete() && getRecipeDto.getRecipeType() != 3) {
|
||||
mealType = Optional.ofNullable(getRecipeDto)
|
||||
.map(GetRecipeDTO::getMenuRecipeV2Add)
|
||||
.map(MenuRecipeAddDTO::getRecipeDateList)
|
||||
.map(list -> list.get(0))
|
||||
.map(MenuRecipeDateAddDTO::getDetailList)
|
||||
.map(list -> list.get(0))
|
||||
.map(MenuRecipeDetailAddDTO::getMealtimeType)
|
||||
.orElseThrow(() -> new ServiceException(I18n.getMessage("menu_interval_id_null")));
|
||||
}
|
||||
return menuRecipeMapper.selectDetailIds(getRecipeDto, mealType);
|
||||
}
|
||||
|
||||
public List<MenuRecipeDetail> getGeNowMenuRecipeDetail(GetRecipeDTO getRecipeDto) {
|
||||
// 计算mealType参数
|
||||
Integer mealType = null;
|
||||
if (!getRecipeDto.getIsComplete() && getRecipeDto.getRecipeType() != 3) {
|
||||
mealType = Optional.ofNullable(getRecipeDto)
|
||||
.map(GetRecipeDTO::getMenuRecipeV2Add)
|
||||
.map(MenuRecipeAddDTO::getRecipeDateList)
|
||||
.map(list -> list.get(0))
|
||||
.map(MenuRecipeDateAddDTO::getDetailList)
|
||||
.map(list -> list.get(0))
|
||||
.map(MenuRecipeDetailAddDTO::getMealtimeType)
|
||||
.orElseThrow(() -> new ServiceException(I18n.getMessage("menu_interval_id_null")));
|
||||
}
|
||||
return this.menuRecipeMapper.selectDetailsList(getRecipeDto,LocalDate.now(),mealType);
|
||||
}
|
||||
|
||||
public void getActiveMenuRecipeDetailDisnes(List<MenuRecipeDetail> menuRecipeDetails, List<MenuRecipeDateAddDTO> recipeDateList, List<MenuRecipeDishes> recipeDishesV2List, List<Long> haveDetailIds) {
|
||||
if (!ObjectUtil.isEmpty(menuRecipeDetails)) {
|
||||
List<MenuRecipeDishes> menuRecipeDishes = this.menuRecipeMapper.getMenuRecipeDishesList(haveDetailIds);
|
||||
menuRecipeDishes.forEach((dishes) -> {
|
||||
dishes.setSizeType(Optional.ofNullable(dishes.getSizeType()).orElse(1L));
|
||||
});
|
||||
Map<Long, Map<String, MenuRecipeDishes>> dishesMap = menuRecipeDishes.stream()
|
||||
.collect(Collectors.groupingBy(MenuRecipeDishes::getDetailId,
|
||||
Collectors.toMap(this.getDishesUniKeyFunction(), Function.identity())));
|
||||
Map<Integer, Map<Integer, Map<Long, MenuRecipeDetail>>> weekAndMealTimeMap = menuRecipeDetails.stream()
|
||||
.collect(Collectors.groupingBy(MenuRecipeDetail::getApplyWeek, Collectors.groupingBy(MenuRecipeDetail::getMealtimeType, Collectors.toMap(MenuRecipeDetail::getDetailId, Function.identity()))));
|
||||
|
||||
for (MenuRecipeDateAddDTO menuRecipeDateV2AddDTO : recipeDateList) {
|
||||
Integer applyWeek = menuRecipeDateV2AddDTO.getApplyWeek();
|
||||
List<MenuRecipeDetailAddDTO> detailList = menuRecipeDateV2AddDTO.getDetailList();
|
||||
Map<Integer, Map<Long, MenuRecipeDetail>> byApplyWeekMap = Optional.ofNullable(weekAndMealTimeMap.get(applyWeek)).orElse(new HashMap());
|
||||
|
||||
for (MenuRecipeDetailAddDTO detailV2AddDTO : detailList) {
|
||||
Integer mealtimeType = detailV2AddDTO.getMealtimeType();
|
||||
List<MenuRecipeDishesAddDTO> dishesList = detailV2AddDTO.getDishesList();
|
||||
Map<String, MenuRecipeDishesAddDTO> editDishesMap = dishesList.stream().collect(Collectors.toMap(this.getUniKeyFunction(), Function.identity()));
|
||||
Map<Long, MenuRecipeDetail> detailMap = Optional.ofNullable(byApplyWeekMap.get(mealtimeType)).orElse(new HashMap());
|
||||
|
||||
for (Long detailId : detailMap.keySet()) {
|
||||
Map<String, MenuRecipeDishes> haveDishesMap = Optional.ofNullable(dishesMap.get(detailId)).orElse(new HashMap());
|
||||
for (String dishesFlag : editDishesMap.keySet()) {
|
||||
MenuRecipeDishesAddDTO addDishes = editDishesMap.get(dishesFlag);
|
||||
MenuRecipeDishes haveDishes = haveDishesMap.get(dishesFlag);
|
||||
MenuRecipeDishes dishesItem = this.getEditMenuDishes(dishesFlag, addDishes, haveDishes, detailId);
|
||||
recipeDishesV2List.add(dishesItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Function<MenuRecipeDishes, String> getDishesUniKeyFunction() {
|
||||
return (item) -> {
|
||||
Long var10000 = item.getDishesId();
|
||||
return "" + var10000 + "_" + item.getSizeType();
|
||||
};
|
||||
}
|
||||
|
||||
public Function<MenuRecipeDishesAddDTO, String> getUniKeyFunction() {
|
||||
return (item) -> {
|
||||
Long var10000 = item.getDishesId();
|
||||
return "" + var10000 + "_" + item.getSizeType();
|
||||
};
|
||||
}
|
||||
public MenuRecipeDishes getEditMenuDishes(String dishesFlag, MenuRecipeDishesAddDTO addDishes, MenuRecipeDishes haveDishes, Long detailId) {
|
||||
Integer salesSum = Math.toIntExact(Optional.ofNullable(haveDishes).map(MenuRecipeDishes::getSaleNum).orElse(0));
|
||||
MenuRecipeDishes dishesItem = new MenuRecipeDishes();
|
||||
dishesItem.setDetailId(detailId);
|
||||
dishesItem.setDishesId(Long.parseLong(CharSequenceUtil.subBefore(dishesFlag, "_", true)));
|
||||
dishesItem.setPrice(addDishes.getPrice());
|
||||
dishesItem.setSaleNum(salesSum);
|
||||
dishesItem.setSupplyNum(addDishes.getSupplyNum());
|
||||
dishesItem.setSurplusNum(addDishes.getSupplyNum() - salesSum);
|
||||
dishesItem.setRestrictNum(addDishes.getRestrictNum());
|
||||
dishesItem.setSalePrice(Optional.ofNullable(addDishes.getSalePrice()).orElse(addDishes.getPrice()));
|
||||
dishesItem.setRecommendFlag(addDishes.getRecommendFlag());
|
||||
dishesItem.setSizeType(addDishes.getSizeType());
|
||||
dishesItem.setSortNum(addDishes.getSortNum());
|
||||
return dishesItem;
|
||||
}
|
||||
|
||||
public void creatLastWeekRecipe(MenuRecipeDateAddDTO recipeDate, List<MenuRecipeDishes> recipeDishesV2List, List<MenuRecipeDetail> recipeDetailV2List, Long recipeId) {
|
||||
if (!ObjectUtil.isEmpty(recipeDate)) {
|
||||
String username = SecurityUtils.getUsername();
|
||||
LocalDate now = LocalDate.now();
|
||||
List<LocalDate> dates = this.getLastWeek();
|
||||
MenuRecipeDetail menuRecipeDetailBean = new MenuRecipeDetail();
|
||||
menuRecipeDetailBean.setRecipeId(recipeId);
|
||||
menuRecipeDetailBean.setApplyDate(now);
|
||||
menuRecipeDetailBean.setEndDate(now.plusDays(6L));
|
||||
menuRecipeDetailBean.setDetailType(2);
|
||||
List<MenuRecipeDetail> menuRecipeDetails = menuRecipeMapper.selectMenuRecipeDetail(menuRecipeDetailBean,null);
|
||||
Map<LocalDate, Map<Integer, MenuRecipeDetail>> haveDetail = menuRecipeDetails.stream()
|
||||
.collect(Collectors.groupingBy(MenuRecipeDetail::getApplyDate, Collectors.toMap(MenuRecipeDetail::getMealtimeType, Function.identity())));
|
||||
Iterator<LocalDate> var10 = dates.iterator();
|
||||
|
||||
label35:
|
||||
while(var10.hasNext()) {
|
||||
LocalDate date = var10.next();
|
||||
Map<Integer, MenuRecipeDetail> haveDayDetail = Optional.ofNullable(haveDetail.get(date)).orElse(new HashMap());
|
||||
List<MenuRecipeDetailAddDTO> detailList = recipeDate.getDetailList();
|
||||
Iterator<MenuRecipeDetailAddDTO> var14 = detailList.iterator();
|
||||
|
||||
while(true) {
|
||||
MenuRecipeDetailAddDTO addDetail;
|
||||
Integer mealtimeType;
|
||||
MenuRecipeDetail menuRecipeDetail;
|
||||
do {
|
||||
if (!var14.hasNext()) {
|
||||
continue label35;
|
||||
}
|
||||
addDetail = var14.next();
|
||||
mealtimeType = addDetail.getMealtimeType();
|
||||
menuRecipeDetail = haveDayDetail.get(mealtimeType);
|
||||
} while(!ObjectUtil.isEmpty(menuRecipeDetail));
|
||||
|
||||
MenuRecipeDetail detailItem = new MenuRecipeDetail();
|
||||
Long detailId = Id.next();
|
||||
detailItem.setDetailId(detailId);
|
||||
detailItem.setRecipeId(recipeId);
|
||||
detailItem.setApplyDate(date);
|
||||
detailItem.setMealtimeType(mealtimeType);
|
||||
detailItem.setCreateBy(username);
|
||||
recipeDetailV2List.add(detailItem);
|
||||
List<MenuRecipeDishesAddDTO> dishesList = addDetail.getDishesList();
|
||||
|
||||
for (MenuRecipeDishesAddDTO menuRecipeDishesAddDTO : dishesList) {
|
||||
MenuRecipeDishes dishesItem = BeanUtil.copyProperties(menuRecipeDishesAddDTO, MenuRecipeDishes.class, new String[0]);
|
||||
dishesItem.setDetailId(detailId);
|
||||
dishesItem.setSaleNum(0);
|
||||
dishesItem.setSurplusNum(menuRecipeDishesAddDTO.getSupplyNum());
|
||||
dishesItem.setSalePrice(Optional.ofNullable(menuRecipeDishesAddDTO.getSalePrice()).orElse(menuRecipeDishesAddDTO.getPrice()));
|
||||
recipeDishesV2List.add(dishesItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void creatLastWeekRecipe(List<MenuRecipeDateAddDTO> recipeDateList, List<MenuRecipeDishes> recipeDishesV2List, List<MenuRecipeDetail> recipeDetailV2List, Long recipeId, List<Integer> weeks) {
|
||||
if (!ObjectUtil.isEmpty(recipeDateList)) {
|
||||
String username = SecurityUtils.getUsername();
|
||||
LocalDate now = LocalDate.now();
|
||||
HashMap<Integer, LocalDate> dateHashMap = new HashMap<>();
|
||||
|
||||
for(int i = 0; i < 7; ++i) {
|
||||
LocalDate applyWeek = now.plusDays((long)i);
|
||||
dateHashMap.put(applyWeek.getDayOfWeek().getValue(), applyWeek);
|
||||
}
|
||||
MenuRecipeDetail menuRecipeDetailBean = new MenuRecipeDetail();
|
||||
menuRecipeDetailBean.setRecipeId(recipeId);
|
||||
menuRecipeDetailBean.setApplyDate(now);
|
||||
menuRecipeDetailBean.setEndDate(now.plusDays(6L));
|
||||
menuRecipeDetailBean.setDetailType(2);
|
||||
List<MenuRecipeDetail> menuRecipeDetails = menuRecipeMapper.selectMenuRecipeDetail(menuRecipeDetailBean,weeks);
|
||||
Map<Integer, Map<Integer, MenuRecipeDetail>> haveDetail = menuRecipeDetails.stream()
|
||||
.collect(Collectors.groupingBy(MenuRecipeDetail::getApplyWeek,
|
||||
Collectors.toMap(MenuRecipeDetail::getMealtimeType, Function.identity())));
|
||||
Iterator<MenuRecipeDateAddDTO> var11 = recipeDateList.iterator();
|
||||
|
||||
label38:
|
||||
while(var11.hasNext()) {
|
||||
MenuRecipeDateAddDTO menuRecipeDateV2AddDTO = var11.next();
|
||||
Integer applyWeek = menuRecipeDateV2AddDTO.getApplyWeek();
|
||||
Map<Integer, MenuRecipeDetail> haveWeekDetail = Optional.ofNullable(haveDetail.get(applyWeek)).orElse(new HashMap());
|
||||
List<MenuRecipeDetailAddDTO> detailList = menuRecipeDateV2AddDTO.getDetailList();
|
||||
Iterator<MenuRecipeDetailAddDTO> var16 = detailList.iterator();
|
||||
while(true) {
|
||||
MenuRecipeDetailAddDTO addDetail;
|
||||
Integer mealtimeType;
|
||||
MenuRecipeDetail menuRecipeDetail;
|
||||
do {
|
||||
if (!var16.hasNext()) {
|
||||
continue label38;
|
||||
}
|
||||
addDetail = var16.next();
|
||||
mealtimeType = addDetail.getMealtimeType();
|
||||
menuRecipeDetail = haveWeekDetail.get(mealtimeType);
|
||||
} while(!ObjectUtil.isEmpty(menuRecipeDetail));
|
||||
|
||||
MenuRecipeDetail detailItem = new MenuRecipeDetail();
|
||||
Long detailId = Id.next();
|
||||
detailItem.setDetailId(detailId);
|
||||
detailItem.setRecipeId(recipeId);
|
||||
detailItem.setApplyWeek(applyWeek);
|
||||
detailItem.setApplyDate(dateHashMap.get(applyWeek));
|
||||
detailItem.setMealtimeType(mealtimeType);
|
||||
detailItem.setCreateBy(username);
|
||||
recipeDetailV2List.add(detailItem);
|
||||
List<MenuRecipeDishesAddDTO> dishesList = addDetail.getDishesList();
|
||||
|
||||
for (MenuRecipeDishesAddDTO menuRecipeDishesV2AddDTO : dishesList) {
|
||||
MenuRecipeDishes dishesItem = BeanUtil.copyProperties(menuRecipeDishesV2AddDTO, MenuRecipeDishes.class, new String[0]);
|
||||
dishesItem.setDetailId(detailId);
|
||||
dishesItem.setSaleNum(0);
|
||||
dishesItem.setSurplusNum(menuRecipeDishesV2AddDTO.getSupplyNum());
|
||||
dishesItem.setSalePrice(Optional.ofNullable(menuRecipeDishesV2AddDTO.getSalePrice()).orElse(menuRecipeDishesV2AddDTO.getPrice()));
|
||||
recipeDishesV2List.add(dishesItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void checkDishesList(List<MenuRecipeDishesAddDTO> dishesList) {
|
||||
long count = dishesList.stream().filter((x) -> {
|
||||
return x.getSizeType() != 3L;
|
||||
}).count();
|
||||
if (count > 99L) {
|
||||
throw new ServiceException(I18n.getMessage("menu_issue_dishes_max", new Object[0]));
|
||||
} else {
|
||||
dishesList.stream().filter((x) -> {
|
||||
return x.getSizeType() == 3L;
|
||||
}).forEach((dishes) -> {
|
||||
dishes.setRecommendFlag(2);
|
||||
});
|
||||
long dishesCount = dishesList.stream().filter((d) -> {
|
||||
return Integer.valueOf(1).equals(d.getRecommendFlag());
|
||||
}).count();
|
||||
if (dishesCount > 3L) {
|
||||
throw new ServiceException(I18n.getMessage("menu_recommend_dishes_over_three", new Object[0]));
|
||||
}
|
||||
}
|
||||
}
|
||||
public void addMenuDishesToList(List<MenuRecipeDishes> recipeDishesV2List, Long detailId, List<MenuRecipeDishesAddDTO> dishesList) {
|
||||
for (MenuRecipeDishesAddDTO dishesV2AddDTO : dishesList) {
|
||||
MenuRecipeDishes dishesItem = BeanUtil.copyProperties(dishesV2AddDTO, MenuRecipeDishes.class, new String[0]);
|
||||
dishesItem.setSalePrice(Optional.ofNullable(dishesItem.getSalePrice()).orElse(dishesItem.getPrice()));
|
||||
dishesItem.setDetailId(detailId);
|
||||
dishesItem.setSurplusNum(dishesV2AddDTO.getSupplyNum());
|
||||
recipeDishesV2List.add(dishesItem);
|
||||
}
|
||||
}
|
||||
|
||||
public void getDayActiveMenuRecipeDetailDishes(List<MenuRecipeDetail> menuRecipeDetails, List<MenuRecipeDetailAddDTO> recipeDetailV2AddDTOS, List<MenuRecipeDishes> recipeDishesV2List, List<Long> haveDetailIds) {
|
||||
if (!ObjectUtil.isEmpty(menuRecipeDetails)) {
|
||||
List<MenuRecipeDishes> menuRecipeDishes = menuRecipeMapper.getMenuRecipeDishesList(haveDetailIds);
|
||||
menuRecipeDishes.forEach((dishes) -> {
|
||||
dishes.setSizeType(Optional.ofNullable(dishes.getSizeType()).orElse(1L));
|
||||
});
|
||||
Map<Long, Map<String, MenuRecipeDishes>> dishesMap =
|
||||
menuRecipeDishes.stream().collect(Collectors.groupingBy(MenuRecipeDishes::getDetailId,
|
||||
Collectors.toMap(this.getDishesUniKeyFunction(), Function.identity())));
|
||||
Map<Integer, Map<Long, MenuRecipeDetail>> dayAndMealTimeMap = menuRecipeDetails.stream()
|
||||
.collect(Collectors.groupingBy(MenuRecipeDetail::getMealtimeType,
|
||||
Collectors.toMap(MenuRecipeDetail::getDetailId, Function.identity())));
|
||||
|
||||
for (MenuRecipeDetailAddDTO detailV2AddDTO : recipeDetailV2AddDTOS) {
|
||||
Integer mealtimeType = detailV2AddDTO.getMealtimeType();
|
||||
List<MenuRecipeDishesAddDTO> dishesList = detailV2AddDTO.getDishesList();
|
||||
Map<String, MenuRecipeDishesAddDTO> editDishesMap = dishesList.stream().collect(Collectors.toMap(this.getUniKeyFunction(), Function.identity()));
|
||||
Map<Long, MenuRecipeDetail> detailMap = Optional.ofNullable(dayAndMealTimeMap.get(mealtimeType)).orElse(new HashMap());
|
||||
|
||||
for (Long detailId : detailMap.keySet()) {
|
||||
Map<String, MenuRecipeDishes> haveDishesMap = Optional.ofNullable(dishesMap.get(detailId)).orElse(new HashMap());
|
||||
|
||||
for (String dishesFlag : editDishesMap.keySet()) {
|
||||
MenuRecipeDishesAddDTO addDishes = editDishesMap.get(dishesFlag);
|
||||
MenuRecipeDishes haveDishes = haveDishesMap.get(dishesFlag);
|
||||
MenuRecipeDishes dishesItem = this.getEditMenuDishes(dishesFlag, addDishes, haveDishes, detailId);
|
||||
recipeDishesV2List.add(dishesItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -139,7 +139,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
|
||||
</select>
|
||||
<select id="selectBaseSizeDishesId" resultType="com.bonus.canteen.core.menu.model.MenuBaseModel">
|
||||
<resultMap id="menuBaseModel" type="com.bonus.canteen.core.menu.model.MenuBaseModel">
|
||||
<result property="baseDishesId" column="base_dishes_id"/>
|
||||
<collection property="dishesList" ofType="com.bonus.canteen.core.menu.model.MenuBaseDishesModel">
|
||||
<result property="dishesId" column="dishes_id"/>
|
||||
<result property="sizeJson" column="size_json"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
<select id="selectBaseSizeDishesId" resultMap="menuBaseModel">
|
||||
select
|
||||
base_dishes_id,
|
||||
dishes_id,
|
||||
|
|
@ -152,7 +159,243 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{baseDishesId}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="selectCount" resultType="java.lang.Long">
|
||||
select
|
||||
count(1)
|
||||
from menu_recipe
|
||||
where 1 = 1
|
||||
<if test="recipeName != null and recipeName != ''">
|
||||
and recipe_name = #{recipeName}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getOneById" resultType="com.bonus.canteen.core.menu.domain.MenuRecipe">
|
||||
select recipe_id as recipeId,
|
||||
plan_id as planId,
|
||||
recipe_name as recipeName,
|
||||
is_default as isDefault,
|
||||
recipe_type as recipeType,
|
||||
effect_date as effectDate,
|
||||
expire_date as expireDate,
|
||||
canteen_id as canteenId,
|
||||
stall_id as stallId,
|
||||
enable_flag as enableFlag,
|
||||
revision,
|
||||
create_by as createBy,
|
||||
create_time as createTime,
|
||||
update_by as updateBy,
|
||||
update_time as updateTime,
|
||||
remark
|
||||
from menu_recipe
|
||||
where recipe_id = #{recipeId}
|
||||
</select>
|
||||
<!-- MenuRecipeMapper.xml -->
|
||||
<select id="selectDetailIds" resultType="java.lang.Long">
|
||||
SELECT detail_id
|
||||
FROM menu_recipe_detail
|
||||
<where>
|
||||
recipe_id = #{dto.recipeId}
|
||||
AND detail_type = 1
|
||||
<choose>
|
||||
<!-- 当菜谱类型为3(周类型) -->
|
||||
<when test="dto.recipeType == 3">
|
||||
<choose>
|
||||
<!-- 完整模式 -->
|
||||
<when test="dto.isComplete">
|
||||
AND apply_week IN
|
||||
<foreach collection="dto.weeks" item="week" open="(" separator="," close=")">
|
||||
#{week}
|
||||
</foreach>
|
||||
</when>
|
||||
<!-- 非完整模式 -->
|
||||
<otherwise>
|
||||
AND (
|
||||
<foreach collection="dto.menuRecipeV2Add.recipeDateList" item="dateDTO" separator=" OR ">
|
||||
<if test="dateDTO != null and dateDTO.detailList != null and !dateDTO.detailList.isEmpty()">
|
||||
(
|
||||
<foreach collection="dateDTO.detailList" item="detailDTO" separator=" OR ">
|
||||
(apply_week = #{dateDTO.applyWeek} AND mealtime_type = #{detailDTO.mealtimeType})
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</foreach>
|
||||
)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</when>
|
||||
|
||||
<!-- 其他类型且非完整模式 -->
|
||||
<when test="!dto.isComplete">
|
||||
AND mealtime_type = #{dto.mealType}
|
||||
</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectDetailsList" resultType="com.bonus.canteen.core.menu.domain.MenuRecipeDetail">
|
||||
SELECT *
|
||||
FROM menu_recipe_detail
|
||||
<where>
|
||||
recipe_id = #{dto.recipeId}
|
||||
AND apply_date >= #{currentDate}
|
||||
AND detail_type = 2
|
||||
<!-- 动态条件 -->
|
||||
<choose>
|
||||
<!-- 当菜谱类型为3(周类型) -->
|
||||
<when test="dto.recipeType == 3">
|
||||
<choose>
|
||||
<!-- 完全模式 -->
|
||||
<when test="dto.isComplete">
|
||||
AND apply_week IN
|
||||
<foreach collection="dto.weeks" item="week" open="(" separator="," close=")">
|
||||
#{week}
|
||||
</foreach>
|
||||
</when>
|
||||
<!-- 非完全模式 -->
|
||||
<otherwise>
|
||||
AND (
|
||||
<foreach collection="dto.menuRecipeV2Add.recipeDateList" item="dateDTO" separator=" OR ">
|
||||
<if test="dateDTO != null and dateDTO.detailList != null and !dateDTO.detailList.isEmpty()">
|
||||
(
|
||||
<foreach collection="dateDTO.detailList" item="detailDTO" separator=" OR ">
|
||||
(apply_week = #{dateDTO.applyWeek} AND mealtime_type = #{detailDTO.mealtimeType})
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</foreach>
|
||||
)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</when>
|
||||
|
||||
<!-- 其他类型且非完整模式 -->
|
||||
<when test="!dto.isComplete">
|
||||
AND mealtime_type = #{mealType}
|
||||
</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
<select id="getMenuRecipeDishesList" resultType="com.bonus.canteen.core.menu.domain.MenuRecipeDishes">
|
||||
SELECT id,
|
||||
detail_id AS detailId,
|
||||
dishes_id as dishesId,
|
||||
price,
|
||||
size_type as sizeType,
|
||||
supply_num as supplyNum,
|
||||
sale_num as saleNum,
|
||||
surplus_num as surplusNum,
|
||||
restrict_num as restrictNum,
|
||||
sale_price as salePrice,
|
||||
sale_start as saleStart,
|
||||
sale_end as saleEnd,
|
||||
chef_id as chefId,
|
||||
recommend_flag as recommendFlag,
|
||||
sort_num as sortNum,
|
||||
revision,
|
||||
create_by as createBy,
|
||||
create_time as createTime,
|
||||
update_by as updateBy,
|
||||
update_time as updateTime,
|
||||
remark
|
||||
FROM menu_recipe_dishes
|
||||
where
|
||||
detail_id IN
|
||||
<foreach collection="haveDetailIds" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="selectMenuRecipeDetail" resultType="com.bonus.canteen.core.menu.domain.MenuRecipeDetail">
|
||||
SELECT
|
||||
id,
|
||||
detail_id AS detailId,
|
||||
sale_type_id AS saleTypeId,
|
||||
recipe_id AS recipeId,
|
||||
apply_date AS applyDate,
|
||||
apply_week AS applyWeek,
|
||||
apply_month AS applyMonth,
|
||||
mealtime_type AS mealtimeType,
|
||||
detail_type AS detailType,
|
||||
revision
|
||||
FROM menu_recipe_detail
|
||||
<where>
|
||||
<!-- 固定条件 -->
|
||||
recipe_id = #{bean.recipeId}
|
||||
AND apply_date >= #{bean.applyDate}
|
||||
AND apply_date <= #{bean.endDate}
|
||||
AND detail_type = #{bean.detailType}
|
||||
|
||||
<!-- 可扩展的动态条件(示例) -->
|
||||
<if test="bean.mealtimeType != null">
|
||||
AND mealtime_type = #{bean.mealtimeType}
|
||||
</if>
|
||||
<if test="weeks != null and weeks.size() > 0">
|
||||
and apply_week in
|
||||
<foreach collection="weeks" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectDetailIdListByWrapper" resultType="java.lang.Long">
|
||||
SELECT detail_id FROM menu_recipe_detail
|
||||
WHERE del_flag = 0
|
||||
AND recipe_id = #{recipeId}
|
||||
AND apply_date IN
|
||||
<foreach item="date" collection="applyDateList" open="(" separator="," close=")">
|
||||
#{date}
|
||||
</foreach>
|
||||
<if test="isComplete == false">
|
||||
AND (
|
||||
<foreach item="dateItem" collection="recipeDateList" separator=" OR ">
|
||||
<if test="dateItem != null and dateItem.detailList != null and !dateItem.detailList.isEmpty()">
|
||||
(
|
||||
apply_date = #{dateItem.applyDate}
|
||||
AND mealtime_type IN
|
||||
<foreach item="detail" collection="dateItem.detailList" open="(" separator="," close=")">
|
||||
#{detail.mealtimeType}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectBatchIds" resultType="com.bonus.canteen.core.menu.domain.MenuRecipeDishes">
|
||||
select
|
||||
id,
|
||||
detail_id as detailId,
|
||||
dishes_id as dishesId,
|
||||
price,
|
||||
size_type as sizeType,
|
||||
supply_num as supplyNum,
|
||||
sale_num as saleNum,
|
||||
surplus_num as surplusNum,
|
||||
restrict_num as restrictNum,
|
||||
sale_price as salePrice,
|
||||
sale_start as saleStart,
|
||||
sale_end as saleEnd,
|
||||
chef_id as chefId,
|
||||
recommend_flag as recommendFlag,
|
||||
sort_num as sortNum,
|
||||
revision,
|
||||
create_by as createBy,
|
||||
create_time as createTime,
|
||||
update_by as updateBy,
|
||||
update_time as updateTime,
|
||||
remark
|
||||
from menu_recipe_dishes
|
||||
where id in
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="selectAppRecipeList" resultType="com.bonus.canteen.core.menu.domain.MenuAppRecipe">
|
||||
select
|
||||
recipe_id as recipeId,
|
||||
bind_type as bindType,
|
||||
meal_line_id as mealLineId,
|
||||
bind_time as bindTime
|
||||
from menu_app_recipe
|
||||
where recipe_id = #{recipeId}
|
||||
</select>
|
||||
<insert id="insertMenuRecipe" parameterType="com.bonus.canteen.core.menu.domain.MenuRecipe" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into menu_recipe
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -192,6 +435,121 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertData">
|
||||
insert into menu_recipe
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="recipeId != null">recipe_id,</if>
|
||||
<if test="planId != null">plan_id,</if>
|
||||
<if test="recipeName != null and recipeName != ''">recipe_name,</if>
|
||||
<if test="isDefault != null">is_default,</if>
|
||||
<if test="recipeType != null">recipe_type,</if>
|
||||
<if test="effectDate != null">effect_date,</if>
|
||||
<if test="expireDate != null">expire_date,</if>
|
||||
<if test="canteenId != null">canteen_id,</if>
|
||||
<if test="stallId != null">stall_id,</if>
|
||||
<if test="enableFlag != null">enable_flag,</if>
|
||||
<if test="revision != null">revision,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="recipeId != null">#{recipeId},</if>
|
||||
<if test="planId != null">#{planId},</if>
|
||||
<if test="recipeName != null and recipeName != ''">#{recipeName},</if>
|
||||
<if test="isDefault != null">#{isDefault},</if>
|
||||
<if test="recipeType != null">#{recipeType},</if>
|
||||
<if test="effectDate != null">#{effectDate},</if>
|
||||
<if test="expireDate != null">#{expireDate},</if>
|
||||
<if test="canteenId != null">#{canteenId},</if>
|
||||
<if test="stallId != null">#{stallId},</if>
|
||||
<if test="enableFlag != null">#{enableFlag},</if>
|
||||
<if test="revision != null">#{revision},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertMenuDetails">
|
||||
insert into menu_recipe_detail
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="menuDetails[0].detailId != null">detail_id,</if>
|
||||
<if test="menuDetails[0].saleTypeId != null">sale_type_id,</if>
|
||||
<if test="menuDetails[0].recipeId != null">recipe_id,</if>
|
||||
<if test="menuDetails[0].applyDate != null">apply_date,</if>
|
||||
<if test="menuDetails[0].applyWeek != null">apply_week,</if>
|
||||
<if test="menuDetails[0].mealtimeType != null">mealtime_type,</if>
|
||||
<if test="menuDetails[0].detailType != null">detail_type,</if>
|
||||
<if test="menuDetails[0].revision != null">revision,</if>
|
||||
<if test="menuDetails[0].createBy != null">create_by,</if>
|
||||
<if test="menuDetails[0].createTime != null">create_time,</if>
|
||||
<if test="menuDetails[0].updateBy != null">update_by,</if>
|
||||
<if test="menuDetails[0].updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="menuDetails" item="menuDetail" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="menuDetails[0].detailId != null">#{menuDetail.detailId},</if>
|
||||
<if test="menuDetails[0].saleTypeId != null">#{menuDetail.saleTypeId},</if>
|
||||
<if test="menuDetails[0].recipeId != null">#{menuDetail.recipeId},</if>
|
||||
<if test="menuDetails[0].applyDate != null">#{menuDetail.applyDate},</if>
|
||||
<if test="menuDetails[0].applyWeek != null">#{menuDetail.applyWeek},</if>
|
||||
<if test="menuDetails[0].mealtimeType != null">#{menuDetail.mealtimeType},</if>
|
||||
<if test="menuDetails[0].detailType != null">#{menuDetail.detailType},</if>
|
||||
<if test="menuDetails[0].revision != null">#{menuDetail.revision},</if>
|
||||
<if test="menuDetails[0].createBy != null">#{menuDetail.createBy},</if>
|
||||
<if test="menuDetails[0].createTime != null">#{menuDetail.createTime},</if>
|
||||
<if test="menuDetails[0].updateBy != null">#{menuDetail.updateBy},</if>
|
||||
<if test="menuDetails[0].updateTime != null">#{menuDetail.updateTime},</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertMenuDishes">
|
||||
insert into menu_recipe_dishes
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="menuDishes[0].detailId != null">detail_id,</if>
|
||||
<if test="menuDishes[0].dishesId != null">dishes_id,</if>
|
||||
<if test="menuDishes[0].price != null">price,</if>
|
||||
<if test="menuDishes[0].sizeType != null">size_type,</if>
|
||||
<if test="menuDishes[0].supplyNum != null">supply_num,</if>
|
||||
<if test="menuDishes[0].saleNum != null">sale_num,</if>
|
||||
<if test="menuDishes[0].surplusNum != null">surplus_num,</if>
|
||||
<if test="menuDishes[0].restrictNum != null">restrict_num,</if>
|
||||
<if test="menuDishes[0].salePrice != null">sale_price,</if>
|
||||
<if test="menuDishes[0].recommendFlag != null">recommend_flag,</if>
|
||||
<if test="menuDishes[0].sortNum != null">sort_num,</if>
|
||||
<if test="menuDishes[0].revision != null">revision,</if>
|
||||
<if test="menuDishes[0].createBy != null">create_by,</if>
|
||||
<if test="menuDishes[0].createTime != null">create_time,</if>
|
||||
<if test="menuDishes[0].updateBy != null">update_by,</if>
|
||||
<if test="menuDishes[0].updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="menuDishes" item="menuDish" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="menuDishes[0].detailId != null">#{menuDish.detailId},</if>
|
||||
<if test="menuDishes[0].dishesId != null">#{menuDish.dishesId},</if>
|
||||
<if test="menuDishes[0].price != null">#{menuDish.price},</if>
|
||||
<if test="menuDishes[0].sizeType != null">#{menuDish.sizeType},</if>
|
||||
<if test="menuDishes[0].supplyNum != null">#{menuDish.supplyNum},</if>
|
||||
<if test="menuDishes[0].saleNum != null">#{menuDish.saleNum},</if>
|
||||
<if test="menuDishes[0].surplusNum != null">#{menuDish.surplusNum},</if>
|
||||
<if test="menuDishes[0].restrictNum != null">#{menuDish.restrictNum},</if>
|
||||
<if test="menuDishes[0].salePrice != null">#{menuDish.salePrice},</if>
|
||||
<if test="menuDishes[0].recommendFlag != null">#{menuDish.recommendFlag},</if>
|
||||
<if test="menuDishes[0].sortNum != null">#{menuDish.sortNum},</if>
|
||||
<if test="menuDishes[0].revision != null">#{menuDish.revision},</if>
|
||||
<if test="menuDishes[0].createBy != null">#{menuDish.createBy},</if>
|
||||
<if test="menuDishes[0].createTime != null">#{menuDish.createTime},</if>
|
||||
<if test="menuDishes[0].updateBy != null">#{menuDish.updateBy},</if>
|
||||
<if test="menuDishes[0].updateTime != null">#{menuDish.updateTime},</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateMenuRecipe" parameterType="com.bonus.canteen.core.menu.domain.MenuRecipe">
|
||||
update menu_recipe
|
||||
|
|
@ -215,6 +573,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateMenuRecipeDetail">
|
||||
update menu_recipe_detail set update_time = #{time} where recipe_id = #{recipeId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteMenuRecipeById" parameterType="Long">
|
||||
delete from menu_recipe where id = #{id}
|
||||
|
|
@ -226,4 +587,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteMenuRecipeDetailByIds">
|
||||
delete from menu_recipe_detail where id in
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<delete id="deleteMenuRecipeDishesByIds">
|
||||
delete from menu_recipe_dishes where id in
|
||||
<foreach item="id" collection="list" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue