一周菜谱
This commit is contained in:
parent
fe7acccf31
commit
2fe6bff85e
|
|
@ -0,0 +1,19 @@
|
|||
package com.bonus.core.menu.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
|
||||
@Data
|
||||
public class AppletWeekRecipeDTO {
|
||||
@ApiModelProperty("菜谱日期")
|
||||
private @NotNull(
|
||||
message = "{menu_apply_date_null}"
|
||||
) LocalDate applyDate;
|
||||
@ApiModelProperty("人员id")
|
||||
private Long custId;
|
||||
@ApiModelProperty("菜谱id")
|
||||
private Long recipeId;
|
||||
|
||||
}
|
||||
|
|
@ -10,4 +10,6 @@ import java.util.Set;
|
|||
public interface MenuAppRecipeMapper {
|
||||
List<AppletWeekCanteenVO> selectWeekCanteenList(@Param("effIdSet") Set<Long> effIdSet);
|
||||
|
||||
List<Long> selectWeekRecipeId(@Param("recipeId") Long recipeId, @Param("effIdSet") Set<Long> effIdSet);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,11 +7,15 @@ import com.bonus.core.marketing.constants.MktEffTypeEnum;
|
|||
import com.bonus.core.marketing.constants.MktUserTypeEnum;
|
||||
import com.bonus.core.marketing.vo.MktEffectiveUserVO;
|
||||
import com.bonus.core.menu.dto.AppletWeekCanteenDTO;
|
||||
import com.bonus.core.menu.dto.AppletWeekRecipeDTO;
|
||||
import com.bonus.core.menu.mapper.MenuRecipeMapper;
|
||||
import com.bonus.core.menu.service.MenuRecipeService;
|
||||
import com.bonus.core.menu.mapper.MenuAppRecipeMapper;
|
||||
import com.bonus.core.menu.vo.AppletWeekCanteenVO;
|
||||
import com.bonus.core.menu.vo.AppletWeekRecipeVO;
|
||||
import com.bonus.domain.CustInfo;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
|
@ -74,4 +78,29 @@ public class MenuRecipeServiceImpl implements MenuRecipeService {
|
|||
}
|
||||
}
|
||||
|
||||
public List<AppletWeekRecipeVO> getWeekRecipeDetailList(AppletWeekRecipeDTO content) {
|
||||
List<Long> recipeIdList = Lists.newArrayList();
|
||||
if (ObjectUtil.isNull(content.getRecipeId())) {
|
||||
Set<Long> effIdSet = this.getShopstallIdListByCustId(content.getCustId(), false);
|
||||
if (ObjectUtil.isEmpty(effIdSet)) {
|
||||
effIdSet = Sets.newTreeSet();
|
||||
((Set)effIdSet).add(-1L);
|
||||
}
|
||||
|
||||
recipeIdList = this.menuAppRecipeMapper.selectWeekRecipeId(content.getRecipeId(), (Set)effIdSet);
|
||||
if (ObjectUtil.isEmpty(recipeIdList)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
} else {
|
||||
((List)recipeIdList).add(content.getRecipeId());
|
||||
}
|
||||
|
||||
this.generateRecipe((List)recipeIdList, content.getApplyDate());
|
||||
List<AppletWeekRecipeVO> resultList = ((MenuRecipeMapper)this.baseMapper).selectWeekRecipe(content.getApplyDate(), content.getRecipeId(), (List)recipeIdList);
|
||||
resultList.sort(Collections.reverseOrder((s1, s2) -> {
|
||||
return s2.getMealtimeType() - s1.getMealtimeType();
|
||||
}));
|
||||
return resultList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,110 @@
|
|||
package com.bonus.core.menu.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Optional;
|
||||
|
||||
@ApiModel("菜品详情(大小份)")
|
||||
public class AppletCurrentDishesDetailVO {
|
||||
@ApiModelProperty("菜品id")
|
||||
private Long dishesId;
|
||||
@ApiModelProperty("菜品名称")
|
||||
private String dishesName;
|
||||
@ApiModelProperty("库存数量")
|
||||
private Integer surplusNum;
|
||||
@ApiModelProperty("限购数量")
|
||||
private Integer restrictNum;
|
||||
@ApiModelProperty("菜品价格")
|
||||
private Integer dishesPrice;
|
||||
@ApiModelProperty("优惠价")
|
||||
private Integer prefPrice;
|
||||
@ApiModelProperty("规格类型(1-标准,2-大份,3-小份,4-50g,5-100g)")
|
||||
private Long sizeType;
|
||||
@ApiModelProperty("菜品规格")
|
||||
private String sizeJson;
|
||||
@ApiModelProperty("月销量")
|
||||
private Integer monthlySales;
|
||||
@ApiModelProperty("好评率")
|
||||
private BigDecimal goodProbability;
|
||||
|
||||
public Integer getMonthlySales() {
|
||||
return (Integer)Optional.ofNullable(this.monthlySales).orElse(0);
|
||||
}
|
||||
|
||||
public BigDecimal getGoodProbability() {
|
||||
return (BigDecimal)Optional.ofNullable(this.goodProbability).orElse(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
public Long getSizeType() {
|
||||
return (Long)Optional.ofNullable(this.sizeType).orElse(1L);
|
||||
}
|
||||
|
||||
public Long getDishesId() {
|
||||
return this.dishesId;
|
||||
}
|
||||
|
||||
public String getDishesName() {
|
||||
return this.dishesName;
|
||||
}
|
||||
|
||||
public Integer getSurplusNum() {
|
||||
return this.surplusNum;
|
||||
}
|
||||
|
||||
public Integer getRestrictNum() {
|
||||
return this.restrictNum;
|
||||
}
|
||||
|
||||
public Integer getDishesPrice() {
|
||||
return this.dishesPrice;
|
||||
}
|
||||
|
||||
public Integer getPrefPrice() {
|
||||
return this.prefPrice;
|
||||
}
|
||||
|
||||
public String getSizeJson() {
|
||||
return this.sizeJson;
|
||||
}
|
||||
|
||||
public void setDishesId(final Long dishesId) {
|
||||
this.dishesId = dishesId;
|
||||
}
|
||||
|
||||
public void setDishesName(final String dishesName) {
|
||||
this.dishesName = dishesName;
|
||||
}
|
||||
|
||||
public void setSurplusNum(final Integer surplusNum) {
|
||||
this.surplusNum = surplusNum;
|
||||
}
|
||||
|
||||
public void setRestrictNum(final Integer restrictNum) {
|
||||
this.restrictNum = restrictNum;
|
||||
}
|
||||
|
||||
public void setDishesPrice(final Integer dishesPrice) {
|
||||
this.dishesPrice = dishesPrice;
|
||||
}
|
||||
|
||||
public void setPrefPrice(final Integer prefPrice) {
|
||||
this.prefPrice = prefPrice;
|
||||
}
|
||||
|
||||
public void setSizeType(final Long sizeType) {
|
||||
this.sizeType = sizeType;
|
||||
}
|
||||
|
||||
public void setSizeJson(final String sizeJson) {
|
||||
this.sizeJson = sizeJson;
|
||||
}
|
||||
|
||||
public void setMonthlySales(final Integer monthlySales) {
|
||||
this.monthlySales = monthlySales;
|
||||
}
|
||||
|
||||
public void setGoodProbability(final BigDecimal goodProbability) {
|
||||
this.goodProbability = goodProbability;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
package com.bonus.core.menu.vo;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.bonus.core.common.utils.SysUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("菜品详情")
|
||||
public class AppletWeekRecipeDishesVO {
|
||||
@ApiModelProperty("菜品id")
|
||||
private Long baseDishesId;
|
||||
@ApiModelProperty("菜品名称")
|
||||
private String dishesName;
|
||||
@ApiModelProperty("菜品图片")
|
||||
private String dishesImgUrl;
|
||||
@ApiModelProperty("菜谱详情id")
|
||||
private Long detailId;
|
||||
@ApiModelProperty("食堂id")
|
||||
private Long canteenId;
|
||||
@ApiModelProperty("食堂名称")
|
||||
private String canteenName;
|
||||
@ApiModelProperty("档口id")
|
||||
private Long stallId;
|
||||
@ApiModelProperty("档口名称")
|
||||
private String stallName;
|
||||
@ApiModelProperty("大小份详情")
|
||||
private List<AppletCurrentDishesDetailVO> dishesDetailList;
|
||||
|
||||
public String getDishesImgUrl() {
|
||||
return ObjectUtil.isNotEmpty(this.dishesImgUrl) ? SysUtil.getCutFileUrl(this.dishesImgUrl.split(",")[0]) : this.dishesImgUrl;
|
||||
}
|
||||
|
||||
public Long getBaseDishesId() {
|
||||
return this.baseDishesId;
|
||||
}
|
||||
|
||||
public String getDishesName() {
|
||||
return this.dishesName;
|
||||
}
|
||||
|
||||
public Long getDetailId() {
|
||||
return this.detailId;
|
||||
}
|
||||
|
||||
public Long getCanteenId() {
|
||||
return this.canteenId;
|
||||
}
|
||||
|
||||
public String getCanteenName() {
|
||||
return this.canteenName;
|
||||
}
|
||||
|
||||
public Long getStallId() {
|
||||
return this.stallId;
|
||||
}
|
||||
|
||||
public String getStallName() {
|
||||
return this.stallName;
|
||||
}
|
||||
|
||||
public List<AppletCurrentDishesDetailVO> getDishesDetailList() {
|
||||
return this.dishesDetailList;
|
||||
}
|
||||
|
||||
public void setBaseDishesId(final Long baseDishesId) {
|
||||
this.baseDishesId = baseDishesId;
|
||||
}
|
||||
|
||||
public void setDishesName(final String dishesName) {
|
||||
this.dishesName = dishesName;
|
||||
}
|
||||
|
||||
public void setDishesImgUrl(final String dishesImgUrl) {
|
||||
this.dishesImgUrl = dishesImgUrl;
|
||||
}
|
||||
|
||||
public void setDetailId(final Long detailId) {
|
||||
this.detailId = detailId;
|
||||
}
|
||||
|
||||
public void setCanteenId(final Long canteenId) {
|
||||
this.canteenId = canteenId;
|
||||
}
|
||||
|
||||
public void setCanteenName(final String canteenName) {
|
||||
this.canteenName = canteenName;
|
||||
}
|
||||
|
||||
public void setStallId(final Long stallId) {
|
||||
this.stallId = stallId;
|
||||
}
|
||||
|
||||
public void setStallName(final String stallName) {
|
||||
this.stallName = stallName;
|
||||
}
|
||||
|
||||
public void setDishesDetailList(final List<AppletCurrentDishesDetailVO> dishesDetailList) {
|
||||
this.dishesDetailList = dishesDetailList;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.core.menu.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("分类详情")
|
||||
public class AppletWeekRecipeTypeVO {
|
||||
@ApiModelProperty("菜品类别id")
|
||||
private Long typeId;
|
||||
@ApiModelProperty("菜品类别名称")
|
||||
private String typeName;
|
||||
@ApiModelProperty("菜品详情")
|
||||
private List<AppletWeekRecipeDishesVO> dishesList;
|
||||
|
||||
public Long getTypeId() {
|
||||
return this.typeId;
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return this.typeName;
|
||||
}
|
||||
|
||||
public List<AppletWeekRecipeDishesVO> getDishesList() {
|
||||
return this.dishesList;
|
||||
}
|
||||
|
||||
public void setTypeId(final Long typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public void setTypeName(final String typeName) {
|
||||
this.typeName = typeName;
|
||||
}
|
||||
|
||||
public void setDishesList(final List<AppletWeekRecipeDishesVO> dishesList) {
|
||||
this.dishesList = dishesList;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.bonus.core.menu.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.bonus.core.common.enums.AllocMealtimeTypeEnum;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("获取一周菜谱详情")
|
||||
public class AppletWeekRecipeVO {
|
||||
@ApiModelProperty("餐次类型")
|
||||
private Integer mealtimeType;
|
||||
@ApiModelProperty("餐次名称")
|
||||
private String mealtimeName;
|
||||
@ApiModelProperty("分类详情")
|
||||
private List<AppletWeekRecipeTypeVO> typeList;
|
||||
|
||||
public String getMealtimeName() {
|
||||
return AllocMealtimeTypeEnum.getDescByKey(this.mealtimeType);
|
||||
}
|
||||
|
||||
public Integer getMealtimeType() {
|
||||
return this.mealtimeType;
|
||||
}
|
||||
|
||||
public List<AppletWeekRecipeTypeVO> getTypeList() {
|
||||
return this.typeList;
|
||||
}
|
||||
|
||||
public void setMealtimeType(final Integer mealtimeType) {
|
||||
this.mealtimeType = mealtimeType;
|
||||
}
|
||||
|
||||
public void setMealtimeName(final String mealtimeName) {
|
||||
this.mealtimeName = mealtimeName;
|
||||
}
|
||||
|
||||
public void setTypeList(final List<AppletWeekRecipeTypeVO> typeList) {
|
||||
this.typeList = typeList;
|
||||
}
|
||||
}
|
||||
Reference in New Issue