h5预订餐

This commit is contained in:
sxu 2025-06-06 14:52:57 +08:00
parent db925f3fc1
commit a3fe487e36
17 changed files with 1127 additions and 4 deletions

View File

@ -0,0 +1,32 @@
package com.bonus.canteen.core.basic.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
@Data
@ApiModel("移动端查询食堂相关信息 DTO")
public class AllocMobileCanteenQueryDTO {
@ApiModelProperty("食堂id")
private Long canteenId;
@ApiModelProperty("档口id")
private Long stallId;
@ApiModelProperty("报餐天数")
private Integer reportMealDays;
@ApiModelProperty("开始日期")
private LocalDate startDate;
@ApiModelProperty("报餐是否跳过节假日 默认:是")
private String ifBookSkipHoliday;
@ApiModelProperty("订餐限制天数")
private Integer reserveLimitDayNum;
@ApiModelProperty("是否允许预定当天")
private String ifAllowReserveToday;
@Override
public String toString() {
Long var10000 = this.getCanteenId();
return "AllocMobileCanteenQueryDTO(canteenId=" + var10000 + ", stallId=" + this.getStallId() + ", reportMealDays=" + this.getReportMealDays() + ", startDate=" + String.valueOf(this.getStartDate()) + ", ifBookSkipHoliday=" + this.getIfBookSkipHoliday() + ")";
}
}

View File

@ -0,0 +1,103 @@
package com.bonus.canteen.core.basic.domain;
import cn.hutool.core.collection.CollUtil;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalTime;
import java.util.List;
@ApiModel("获取预定餐食堂列表(食堂嵌套档口版)")
public class AppletReserveCanteenVO {
@ApiModelProperty("食堂id")
private Long canteenId;
@ApiModelProperty("食堂名称")
private String canteenName;
@ApiModelProperty("食堂营业状态")
private Integer canteenState;
@ApiModelProperty("食堂图片")
private String canteenImgUrl;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("营业开始时间")
private LocalTime startBusinessTime;
@ApiModelProperty("营业结束时间")
private LocalTime endBusinessTime;
@ApiModelProperty("食堂营业状态")
private Integer businessState;
@ApiModelProperty("档口菜谱")
private List<AppletReserveStallVO> stallList;
public String getCanteenImgUrl() {
return FileUrlUtil.getFileUrl(this.canteenImgUrl);
}
public Integer getMonthlySales() {
return CollUtil.isNotEmpty(this.stallList) ? this.stallList.stream().mapToInt(AppletReserveStallVO::getMonthlySales).sum() : 0;
}
public Long getCanteenId() {
return this.canteenId;
}
public String getCanteenName() {
return this.canteenName;
}
public Integer getCanteenState() {
return this.canteenState;
}
public LocalTime getStartBusinessTime() {
return this.startBusinessTime;
}
public LocalTime getEndBusinessTime() {
return this.endBusinessTime;
}
public Integer getBusinessState() {
return this.businessState;
}
public List<AppletReserveStallVO> getStallList() {
return this.stallList;
}
public void setCanteenId(final Long canteenId) {
this.canteenId = canteenId;
}
public void setCanteenName(final String canteenName) {
this.canteenName = canteenName;
}
public void setCanteenState(final Integer canteenState) {
this.canteenState = canteenState;
}
public void setCanteenImgUrl(final String canteenImgUrl) {
this.canteenImgUrl = canteenImgUrl;
}
public void setMonthlySales(final Integer monthlySales) {
this.monthlySales = monthlySales;
}
public void setStartBusinessTime(final LocalTime startBusinessTime) {
this.startBusinessTime = startBusinessTime;
}
public void setEndBusinessTime(final LocalTime endBusinessTime) {
this.endBusinessTime = endBusinessTime;
}
public void setBusinessState(final Integer businessState) {
this.businessState = businessState;
}
public void setStallList(final List<AppletReserveStallVO> stallList) {
this.stallList = stallList;
}
}

View File

@ -0,0 +1,122 @@
package com.bonus.canteen.core.basic.domain;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalTime;
import java.util.Optional;
@ApiModel("档口菜谱")
public class AppletReserveStallVO {
@ApiModelProperty("档口id")
private Long stallId;
@ApiModelProperty("档口名称")
private String stallName;
@ApiModelProperty("档口营业状态")
private Integer stallState;
@ApiModelProperty("档口图片")
private String stallImgUrl;
@ApiModelProperty("营业开始时间")
private LocalTime stallStartTime;
@ApiModelProperty("营业结束时间")
private LocalTime stallEndTime;
@ApiModelProperty("菜谱id")
private Long recipeId;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("营业开始时间")
private LocalTime startBusinessTime;
@ApiModelProperty("营业结束时间")
private LocalTime endBusinessTime;
@ApiModelProperty("食堂营业状态")
private Integer businessState;
public String getStallImgUrl() {
return FileUrlUtil.getFileUrl(this.stallImgUrl);
}
public Integer getMonthlySales() {
return (Integer)Optional.ofNullable(this.monthlySales).orElse(0);
}
public Long getStallId() {
return this.stallId;
}
public String getStallName() {
return this.stallName;
}
public Integer getStallState() {
return this.stallState;
}
public LocalTime getStallStartTime() {
return this.stallStartTime;
}
public LocalTime getStallEndTime() {
return this.stallEndTime;
}
public Long getRecipeId() {
return this.recipeId;
}
public LocalTime getStartBusinessTime() {
return this.startBusinessTime;
}
public LocalTime getEndBusinessTime() {
return this.endBusinessTime;
}
public Integer getBusinessState() {
return this.businessState;
}
public void setStallId(final Long stallId) {
this.stallId = stallId;
}
public void setStallName(final String stallName) {
this.stallName = stallName;
}
public void setStallState(final Integer stallState) {
this.stallState = stallState;
}
public void setStallImgUrl(final String stallImgUrl) {
this.stallImgUrl = stallImgUrl;
}
public void setStallStartTime(final LocalTime stallStartTime) {
this.stallStartTime = stallStartTime;
}
public void setStallEndTime(final LocalTime stallEndTime) {
this.stallEndTime = stallEndTime;
}
public void setRecipeId(final Long recipeId) {
this.recipeId = recipeId;
}
public void setMonthlySales(final Integer monthlySales) {
this.monthlySales = monthlySales;
}
public void setStartBusinessTime(final LocalTime startBusinessTime) {
this.startBusinessTime = startBusinessTime;
}
public void setEndBusinessTime(final LocalTime endBusinessTime) {
this.endBusinessTime = endBusinessTime;
}
public void setBusinessState(final Integer businessState) {
this.businessState = businessState;
}
}

View File

@ -1,6 +1,6 @@
package com.bonus.canteen.core.basic.domain;
import java.util.Date;
import java.time.LocalTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
@ -43,13 +43,13 @@ public class BasicStallMealtime extends BaseEntity {
@ApiModelProperty(value = "开始时间")
@JsonFormat(pattern = "HH:mm:ss")
@Excel(name = "开始时间", width = 10, dateFormat = "HH:mm:ss")
private Date startTime;
private LocalTime startTime;
/** 结束时间 */
@ApiModelProperty(value = "结束时间")
@JsonFormat(pattern = "HH:mm:ss")
@Excel(name = "结束时间", width = 10, dateFormat = "HH:mm:ss")
private Date endTime;
private LocalTime endTime;
/** 是否启用1是2否 */
@Excel(name = "是否启用", readConverterExp = "1=是2否")

View File

@ -0,0 +1,31 @@
package com.bonus.canteen.core.basic.domain;
import io.swagger.annotations.ApiModel;
@ApiModel
public class CookStallSaleModel {
private Long stallId;
private Integer monthlySales;
public Long getStallId() {
return this.stallId;
}
public Integer getMonthlySales() {
return this.monthlySales;
}
public void setStallId(final Long stallId) {
this.stallId = stallId;
}
public void setMonthlySales(final Integer monthlySales) {
this.monthlySales = monthlySales;
}
protected boolean canEqual(final Object other) {
return other instanceof CookStallSaleModel;
}
}

View File

@ -62,4 +62,6 @@ public interface BasicStallMealtimeMapper {
public int deleteBasicStallMealtimeByIds(Long[] ids);
public int deleteBasicStallMealtimeByStallId(Long stallId);
public List<BasicStallMealtime> selectBasicStallMealtimeByStallId(Long stallId);
}

View File

@ -0,0 +1,73 @@
package com.bonus.canteen.core.cook.controller;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.basic.domain.AllocMobileCanteenQueryDTO;
import com.bonus.canteen.core.cook.domain.CookRecipe;
import com.bonus.canteen.core.cook.dto.*;
import com.bonus.canteen.core.cook.service.ICookRecipeH5Service;
import com.bonus.canteen.core.cook.service.ICookRecipeService;
import com.bonus.canteen.core.cook.vo.AllocRecipeStallVO;
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
/**
* 菜品计划信息Controller
*
* @author xsheng
* @date 2025-05-25
*/
@Api(tags = "菜品计划信息接口")
@RestController
@RequestMapping("/cook_recipe_h5")
@Slf4j
public class CookRecipeH5Controller extends BaseController {
@Autowired
private ICookRecipeH5Service cookRecipeH5Service;
@ApiOperation("获取预定餐食堂列表")
@GetMapping({"/reserve/canteen/shopstall/list"})
public TableDataInfo getReserveMealCanteenList() {
try {
startPage();
return getDataTable(this.cookRecipeH5Service.getReserveMealCanteenList());
} catch (Exception e) {
log.error(e.toString(), e);
return getDataTable(null);
}
}
@ApiOperation("移动端-查询预订日期列表")
@PostMapping({"/reserve-date/list"})
public AjaxResult listReserveDate(@RequestBody AllocMobileCanteenQueryDTO bean) {
return AjaxResult.success(this.cookRecipeH5Service.listReserveDate(bean));
}
@ApiOperation("获取预定餐菜谱详情")
@PostMapping({"/reserve/recipe/detail"})
public TableDataInfo getReserveRecipeDetailList(@RequestBody AppletReserveRecipeDTO content) {
try {
startPage();
return getDataTable(this.cookRecipeH5Service.getReserveRecipeDetailList(content));
} catch (Exception e) {
log.error(e.toString(), e);
return getDataTable(null);
}
}
}

View File

@ -0,0 +1,52 @@
package com.bonus.canteen.core.cook.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.time.LocalDate;
@Data
public class AppletReserveRecipeDTO {
@ApiModelProperty("菜谱日期")
private @NotNull(
message = "{menu_apply_date_null}"
) LocalDate applyDate;
@ApiModelProperty("菜谱id")
private @NotNull(
message = "{menu_recipe_id_null}"
) Long recipeId;
@ApiModelProperty("人员id")
private Long custId;
public LocalDate getApplyDate() {
return this.applyDate;
}
public Long getRecipeId() {
return this.recipeId;
}
public Long getCustId() {
return this.custId;
}
public void setApplyDate(final LocalDate applyDate) {
this.applyDate = applyDate;
}
public void setRecipeId(final Long recipeId) {
this.recipeId = recipeId;
}
public void setCustId(final Long custId) {
this.custId = custId;
}
@Override
public String toString() {
String var10000 = String.valueOf(this.getApplyDate());
return "AppletReserveRecipeDTO(applyDate=" + var10000 + ", recipeId=" + this.getRecipeId() + ", custId=" + this.getCustId() + ")";
}
}

View File

@ -0,0 +1,35 @@
package com.bonus.canteen.core.cook.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.bonus.canteen.core.basic.domain.AppletReserveCanteenVO;
import com.bonus.canteen.core.basic.domain.CookStallSaleModel;
import com.bonus.canteen.core.cook.domain.CookAppRecipe;
import com.bonus.canteen.core.cook.domain.CookRecipe;
import com.bonus.canteen.core.cook.dto.AllocRecipeStallDTO;
import com.bonus.canteen.core.cook.dto.CookRecipeDTO;
import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO;
import com.bonus.canteen.core.cook.dto.StallAndRecipeBindDto;
import com.bonus.canteen.core.cook.vo.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDate;
import java.util.List;
/**
* 菜品计划信息Mapper接口
*
* @author xsheng
* @date 2025-05-25
*/
public interface CookRecipeH5Mapper {
List<AppletReserveCanteenVO> selectReserveMealCanteenList();
List<CookStallSaleModel> selectMonthSalesStall(@Param("stallIdList") List<Long> stallIdList);
List<AppletReserveRecipeVO> selectReserveRecipe(@Param("applyDate") LocalDate applyDate, @Param("recipeId") Long recipeId);
@Select({"select stall_id from menu_recipe ${ew.customSqlSegment}"})
Long selectStallIdByWrappers(@Param("ew") Wrapper<CookRecipe> wrapper);
}

View File

@ -0,0 +1,28 @@
package com.bonus.canteen.core.cook.service;
import com.bonus.canteen.core.basic.domain.AllocMobileCanteenQueryDTO;
import com.bonus.canteen.core.basic.domain.AppletReserveCanteenVO;
import com.bonus.canteen.core.cook.domain.CookRecipe;
import com.bonus.canteen.core.cook.dto.*;
import com.bonus.canteen.core.cook.vo.AllocRecipeStallVO;
import com.bonus.canteen.core.cook.vo.AppletReserveRecipeVO;
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
import org.springframework.web.multipart.MultipartFile;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;
/**
* 菜品计划信息Service接口
*
* @author xsheng
* @date 2025-05-25
*/
public interface ICookRecipeH5Service {
public List<AppletReserveCanteenVO> getReserveMealCanteenList();
public List<LocalDate> listReserveDate(AllocMobileCanteenQueryDTO queryDTO);
public List<AppletReserveRecipeVO> getReserveRecipeDetailList(AppletReserveRecipeDTO content);
}

View File

@ -0,0 +1,124 @@
package com.bonus.canteen.core.cook.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bonus.canteen.core.basic.domain.*;
import com.bonus.canteen.core.basic.mapper.BasicStallMealtimeMapper;
import com.bonus.canteen.core.cook.domain.CookRecipe;
import com.bonus.canteen.core.cook.dto.*;
import com.bonus.canteen.core.cook.mapper.CookRecipeH5Mapper;
import com.bonus.canteen.core.cook.service.ICookRecipeH5Service;
import com.bonus.canteen.core.cook.vo.*;
import com.bonus.canteen.core.utils.BnsConstants;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalTime;
import java.util.*;
import java.util.stream.Collectors;
/**
* 菜品计划信息Service业务层处理
*
* @author xsheng
* @date 2025-05-25
*/
@Service
@Slf4j
public class CookRecipeServiceH5Impl implements ICookRecipeH5Service {
@Autowired
private CookRecipeH5Mapper cookRecipeH5Mapper;
@Autowired
private BasicStallMealtimeMapper basicStallMealtimeMapper;
@Override
public List<AppletReserveCanteenVO> getReserveMealCanteenList() {
List<AppletReserveCanteenVO> resultList = this.cookRecipeH5Mapper.selectReserveMealCanteenList();
if (ObjectUtil.isEmpty(resultList)) {
return resultList;
} else {
//this.allocCanteenService.checkAndDelReserveCanteen(resultList);
List<Long> stallIdList = (List)resultList.stream().flatMap((canteen) -> {
return canteen.getStallList().stream().map(AppletReserveStallVO::getStallId);
}).collect(Collectors.toList());
if (ObjectUtil.isNotEmpty(stallIdList)) {
List<CookStallSaleModel> stallMonthSalesList = this.cookRecipeH5Mapper.selectMonthSalesStall(stallIdList);
Map<Long, Integer> stallSaleMap = (Map)stallMonthSalesList.stream().collect(Collectors.toMap(CookStallSaleModel::getStallId, CookStallSaleModel::getMonthlySales));
resultList.forEach((canteen) -> {
List<AppletReserveStallVO> stallList = canteen.getStallList();
if (ObjectUtil.isNotEmpty(stallList)) {
stallList.forEach((stall) -> {
stall.setMonthlySales((Integer)stallSaleMap.get(stall.getStallId()));
});
}
});
}
return resultList;
}
}
@Override
public List<LocalDate> listReserveDate(AllocMobileCanteenQueryDTO queryDTO) {
return this.listMatchData(queryDTO.getReserveLimitDayNum(), queryDTO.getIfAllowReserveToday());
}
private List<LocalDate> listMatchData(Integer reserveLimitDayNum, String ifAllowReserveToday) {
log.info(String.format("查询日期,天数:%d", reserveLimitDayNum));
List<LocalDate> reserveDateList = new ArrayList();
LocalDate startDate;
if (BnsConstants.COMMON_YES.equals(ifAllowReserveToday)) {
log.info("允许预定当天");
startDate = LocalDate.now();
} else {
log.info("不允许预定当天");
startDate = LocalDate.now().plusDays(1L);
}
for(int i = 0; i < reserveLimitDayNum; ++i) {
reserveDateList.add(startDate.plusDays((long)i));
}
return reserveDateList;
}
@Override
public List<AppletReserveRecipeVO> getReserveRecipeDetailList(AppletReserveRecipeDTO content) {
List<AppletReserveRecipeVO> resultList = cookRecipeH5Mapper.selectReserveRecipe(content.getApplyDate(), content.getRecipeId());
if (ObjectUtil.isEmpty(resultList)) {
return resultList;
} else {
resultList.sort(Collections.reverseOrder((s1, s2) -> {
return s2.getMealtimeType() - s1.getMealtimeType();
}));
Long stallId = cookRecipeH5Mapper.selectStallIdByWrappers(Wrappers.lambdaQuery(CookRecipe.class).eq(CookRecipe::getRecipeId, content.getRecipeId()));
List<BasicStallMealtime> allocStallMealtimes = basicStallMealtimeMapper.selectBasicStallMealtimeByStallId(stallId);
List<BasicStallMealtime> mealTimeList = allocStallMealtimes;
log.info("配置api查询的档口餐次,档口id: {}, 配置: {}", stallId, JSON.toJSONString(mealTimeList));
if (ObjectUtil.isEmpty(mealTimeList)) {
log.info("未获取到开启餐次");
return Lists.newArrayList();
} else {
if (LocalDate.now().isEqual(content.getApplyDate())) {
mealTimeList = mealTimeList.stream().filter((time) -> {
return LocalTime.now().isBefore(time.getStartTime());
}).collect(Collectors.toList());
}
if (ObjectUtil.isEmpty(mealTimeList)) {
log.info("未获取到餐次");
return Lists.newArrayList();
} else {
List<BasicStallMealtime> finalMealTimeList = mealTimeList;
resultList = resultList.stream().filter((time) -> {
return finalMealTimeList.stream().map(BasicStallMealtime::getMealtimeType).collect(Collectors.toList()).contains(time.getMealtimeType());
}).collect(Collectors.toList());
return resultList;
}
}
}
}
}

View File

@ -0,0 +1,111 @@
package com.bonus.canteen.core.cook.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;
}
}

View File

@ -0,0 +1,173 @@
package com.bonus.canteen.core.cook.vo;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.List;
@ApiModel("菜品详情")
public class AppletReserveRecipeDishesVO {
@ApiModelProperty("菜品id")
private Long baseDishesId;
@ApiModelProperty("菜品名称")
private String dishesName;
@ApiModelProperty("菜品类型")
private Integer detailType;
@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 Integer initialScore;
@ApiModelProperty("月销量")
private Integer monthlySales;
@ApiModelProperty("好评率")
private BigDecimal goodProbability;
@ApiModelProperty("是否推荐")
private Integer recommendFlag;
@ApiModelProperty("大小份详情")
private List<AppletCurrentDishesDetailVO> dishesDetailList;
// @ApiModelProperty("配送方式列表")
// private List<AllocDeliveryCostModel> costModelList;
@ApiModelProperty("口味列表")
private List<String> tasteNameList;
public String getDishesImgUrl() {
return ObjectUtil.isNotEmpty(this.dishesImgUrl) ? FileUrlUtil.getFileUrl(this.dishesImgUrl.split(",")[0]) : this.dishesImgUrl;
}
public Long getBaseDishesId() {
return baseDishesId;
}
public void setBaseDishesId(Long baseDishesId) {
this.baseDishesId = baseDishesId;
}
public String getDishesName() {
return dishesName;
}
public void setDishesName(String dishesName) {
this.dishesName = dishesName;
}
public Integer getDetailType() {
return detailType;
}
public void setDetailType(Integer detailType) {
this.detailType = detailType;
}
public void setDishesImgUrl(String dishesImgUrl) {
this.dishesImgUrl = dishesImgUrl;
}
public Long getDetailId() {
return detailId;
}
public void setDetailId(Long detailId) {
this.detailId = detailId;
}
public Long getCanteenId() {
return canteenId;
}
public void setCanteenId(Long canteenId) {
this.canteenId = canteenId;
}
public String getCanteenName() {
return canteenName;
}
public void setCanteenName(String canteenName) {
this.canteenName = canteenName;
}
public Long getStallId() {
return stallId;
}
public void setStallId(Long stallId) {
this.stallId = stallId;
}
public String getStallName() {
return stallName;
}
public void setStallName(String stallName) {
this.stallName = stallName;
}
public Integer getInitialScore() {
return initialScore;
}
public void setInitialScore(Integer initialScore) {
this.initialScore = initialScore;
}
public Integer getMonthlySales() {
return monthlySales;
}
public void setMonthlySales(Integer monthlySales) {
this.monthlySales = monthlySales;
}
public BigDecimal getGoodProbability() {
return goodProbability;
}
public void setGoodProbability(BigDecimal goodProbability) {
this.goodProbability = goodProbability;
}
public Integer getRecommendFlag() {
return recommendFlag;
}
public void setRecommendFlag(Integer recommendFlag) {
this.recommendFlag = recommendFlag;
}
public List<AppletCurrentDishesDetailVO> getDishesDetailList() {
return dishesDetailList;
}
public void setDishesDetailList(List<AppletCurrentDishesDetailVO> dishesDetailList) {
this.dishesDetailList = dishesDetailList;
}
// public List<AllocDeliveryCostModel> getCostModelList() {
// return costModelList;
// }
//
// public void setCostModelList(List<AllocDeliveryCostModel> costModelList) {
// this.costModelList = costModelList;
// }
public List<String> getTasteNameList() {
return tasteNameList;
}
public void setTasteNameList(List<String> tasteNameList) {
this.tasteNameList = tasteNameList;
}
}

View File

@ -0,0 +1,40 @@
package com.bonus.canteen.core.cook.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel("分类详情")
public class AppletReserveRecipeTypeVO {
@ApiModelProperty("菜品类别id")
private Long typeId;
@ApiModelProperty("菜品类别名称")
private String typeName;
@ApiModelProperty("菜品详情")
private List<AppletReserveRecipeDishesVO> dishesList;
public Long getTypeId() {
return typeId;
}
public void setTypeId(Long typeId) {
this.typeId = typeId;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public List<AppletReserveRecipeDishesVO> getDishesList() {
return dishesList;
}
public void setDishesList(List<AppletReserveRecipeDishesVO> dishesList) {
this.dishesList = dishesList;
}
}

View File

@ -0,0 +1,40 @@
package com.bonus.canteen.core.cook.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel("获取预定餐菜谱详情")
public class AppletReserveRecipeVO {
@ApiModelProperty("餐次类型")
private Integer mealtimeType;
@ApiModelProperty("餐次名称")
private String mealtimeName;
@ApiModelProperty("分类详情")
private List<AppletReserveRecipeTypeVO> typeList;
public Integer getMealtimeType() {
return mealtimeType;
}
public void setMealtimeType(Integer mealtimeType) {
this.mealtimeType = mealtimeType;
}
public String getMealtimeName() {
return mealtimeName;
}
public void setMealtimeName(String mealtimeName) {
this.mealtimeName = mealtimeName;
}
public List<AppletReserveRecipeTypeVO> getTypeList() {
return typeList;
}
public void setTypeList(List<AppletReserveRecipeTypeVO> typeList) {
this.typeList = typeList;
}
}

View File

@ -18,7 +18,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectBasicStallMealtimeVo">
select id, stall_id, mealtime_type, mealtime_name, start_time, end_time, if_enable, create_by, create_time, update_by, update_time from basic_stall_mealtime
select id, stall_id, mealtime_type, mealtime_name, start_time, end_time, if_enable,
create_by, create_time, update_by, update_time
from basic_stall_mealtime
</sql>
<select id="selectBasicStallMealtimeList" parameterType="com.bonus.canteen.core.basic.domain.BasicStallMealtime" resultMap="BasicStallMealtimeResult">
@ -38,6 +40,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="selectBasicStallMealtimeByStallId" parameterType="Long" resultMap="BasicStallMealtimeResult">
<include refid="selectBasicStallMealtimeVo"/>
where stall_id = #{stallId}
</select>
<insert id="batchInsertBasicStallMealtime" parameterType="com.bonus.canteen.core.basic.domain.BasicStallMealtime" useGeneratedKeys="true" keyProperty="id">
insert into basic_stall_mealtime(stall_id, mealtime_type, mealtime_name, start_time, end_time)
values

View File

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.cook.mapper.CookRecipeH5Mapper">
<resultMap id="appletReserveCanteenVO" type="com.bonus.canteen.core.basic.domain.AppletReserveCanteenVO">
<result property="canteenId" column="canteen_id"/>
<result property="canteenName" column="canteen_name"/>
<result property="canteenImgUrl" column="canteen_img_url"/>
<result property="startBusinessTime" column="start_business_time_ac"/>
<result property="endBusinessTime" column="end_business_time_ac"/>
<result property="businessState" column="business_state_ac"/>
<collection property="stallList" ofType="com.bonus.canteen.core.basic.domain.AppletReserveStallVO">
<result property="stallId" column="stall_id"/>
<result property="stallName" column="stall_name"/>
<result property="stallImgUrl" column="stall_img_url"/>
<result property="recipeId" column="recipe_id"/>
<result property="startBusinessTime" column="start_business_time"/>
<result property="endBusinessTime" column="end_business_time"/>
<result property="businessState" column="business_state"/>
</collection>
</resultMap>
<resultMap id="appletReserveRecipeVO" type="com.bonus.canteen.core.cook.vo.AppletReserveRecipeVO">
<result property="mealtimeType" column="mealtime_type"/>
<collection property="typeList" ofType="com.bonus.canteen.core.cook.vo.AppletReserveRecipeTypeVO">
<result property="typeId" column="type_id"/>
<result property="typeName" column="type_name"/>
<collection property="dishesList" ofType="com.bonus.canteen.core.cook.vo.AppletReserveRecipeDishesVO">
<result property="baseDishesId" column="base_dishes_id"/>
<result property="dishesName" column="dishes_name"/>
<result property="detailType" column="detail_type"/>
<result property="dishesImgUrl" column="dishes_img_url"/>
<result property="detailId" column="detail_id"/>
<result property="canteenId" column="canteen_id"/>
<result property="canteenName" column="canteen_name"/>
<result property="stallId" column="stall_id"/>
<result property="stallName" column="stall_name"/>
<result property="recommendFlag" column="recommend_flag"/>
<collection property="dishesDetailList" ofType="com.bonus.canteen.core.cook.vo.AppletCurrentDishesDetailVO">
<result property="dishesId" column="dishes_id"/>
<result property="dishesName" column="real_dishes_name"/>
<result property="surplusNum" column="surplus_num"/>
<result property="restrictNum" column="restrict_num"/>
<result property="dishesPrice" column="dishes_price"/>
<result property="prefPrice" column="pref_price"/>
<result property="sizeType" column="size_type"/>
<result property="sizeJson" column="size_json"/>
<result property="monthlySales" column="monthly_sales"/>
<result property="goodProbability" column="good_probability"/>
</collection>
<!-- <collection property="tasteNameList" ofType="string">-->
<!-- <result property="tasteName" column="taste_name"/>-->
<!-- </collection>-->
</collection>
</collection>
</resultMap>
<select id="selectReserveMealCanteenList" resultMap="appletReserveCanteenVO">
select
ac.canteen_id,
ac.canteen_name,
ac.img_url as canteen_img_url,
ass.stall_id,
ass.stall_name,
ass.img_url as stall_img_url,
mr.recipe_id,
ac.start_business_time as start_business_time_ac,
ac.end_business_time as end_business_time_ac,
ac.business_state as business_state_ac,
ass.start_business_time,
ass.end_business_time,
ass.business_state
from
alloc_canteen ac
left join alloc_stall ass on ac.canteen_id = ass.canteen_id
left join menu_recipe mr on mr.stall_id = ass.stall_id
left join menu_app_recipe mar on mar.recipe_id = mr.recipe_id
where
bind_type = 2
and ac.del_flag = 0
and ass.del_flag = 0
</select>
<select id="selectMonthSalesStall" resultType="com.bonus.canteen.core.basic.domain.CookStallSaleModel">
select
stall_id,
sum(monthly_sales) as monthly_sales
from
menu_dishes_sale_record
where
sale_month = month(curdate())
and stall_id in
<foreach collection="stallIdList" item="stallId" open="(" separator="," close=")">
#{stallId}
</foreach>
group by
stall_id
</select>
<!-- 获取预定点餐菜谱 -->
<select id="selectReserveRecipe" resultMap="appletReserveRecipeVO">
select
mrd.mealtime_type,
md.meal_type as type_id,
'菜品' as type_name,
mdb.base_dishes_id,
md.dishes_id,
mdb.dishes_name,
md.dishes_name as real_dishes_name,
md.meal_type as detail_type,
md.image_url as dishes_img_url,
mrd.detail_id,
m.surplus_num,
m.restrict_num,
m.price as dishes_price,
m.sale_price as pref_price,
ac.canteen_id,
ac.canteen_name,
ass.stall_id,
ass.stall_name,
m.size_type,
m.recommend_flag,
md.size_json,
mdsr.monthly_sales,
mdsr.good_probability
from
menu_recipe_detail mrd
inner join menu_recipe_dishes m on mrd.detail_id = m.detail_id
inner join menu_dishes md on m.dishes_id = md.dishes_id
inner join menu_dishes_type mdt on md.type_id = mdt.type_id
inner join menu_recipe mr on mrd.recipe_id = mr.recipe_id
inner join menu_app_recipe mar on mr.recipe_id = mar.recipe_id
and mar.bind_type = 2
left join menu_dishes_sale_record mdsr on md.dishes_id = mdsr.dishes_id
and mr.stall_id = mdsr.stall_id
and mdsr.sale_month = month(curdate())
left join alloc_canteen ac on mr.canteen_id = ac.canteen_id
left join alloc_stall ass on mr.stall_id = ass.stall_id
left join menu_dishes_base mdb on md.base_dishes_id = mdb.base_dishes_id
-- left join menu_taste_dishes mtd on md.dishes_id = mtd.dishes_id
-- left join menu_dishes_taste mdtt on mtd.taste_id = mdtt.taste_id
where
mrd.apply_date = #{applyDate}
and mr.recipe_id = #{recipeId}
order by
m.sort_num asc
</select>
</mapper>