预订餐档口信息

This commit is contained in:
sxu 2025-04-18 14:17:51 +08:00
parent 2ea049b31e
commit 008f4f6dd4
10 changed files with 381 additions and 5 deletions

View File

@ -0,0 +1,102 @@
package com.bonus.canteen.core.alloc.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,124 @@
package com.bonus.canteen.core.alloc.domain;
import com.bonus.canteen.core.common.utils.FileUrlUtil;
import com.bonus.canteen.core.common.utils.SysUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.time.LocalTime;
import java.util.List;
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

@ -0,0 +1,31 @@
package com.bonus.canteen.core.alloc.domain;
import io.swagger.annotations.ApiModel;
@ApiModel
public class MenuStallSaleModel {
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 MenuStallSaleModel;
}
}

View File

@ -2,6 +2,7 @@ package com.bonus.canteen.core.alloc.service;
import java.util.List;
import com.bonus.canteen.core.alloc.domain.AllocCanteen;
import com.bonus.canteen.core.alloc.domain.AppletReserveCanteenVO;
/**
* 食堂信息Service接口
@ -57,4 +58,5 @@ public interface IAllocCanteenService {
* @return 结果
*/
public int deleteAllocCanteenByCanteenId(Long canteenId);
}

View File

@ -1,15 +1,22 @@
package com.bonus.canteen.core.alloc.service.impl;
import java.math.BigDecimal;
import java.util.List;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bonus.canteen.core.alloc.domain.AllocCanteen;
import com.bonus.canteen.core.alloc.domain.AllocStall;
import com.bonus.canteen.core.alloc.domain.AppletReserveCanteenVO;
import com.bonus.canteen.core.alloc.domain.AppletReserveStallVO;
import com.bonus.canteen.core.alloc.mapper.AllocCanteenMapper;
import com.bonus.canteen.core.utils.BnsConstants;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.houqin.constant.GlobalConstants;
import com.bonus.common.houqin.constant.LeConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.alloc.service.IAllocCanteenService;

View File

@ -2,6 +2,7 @@ package com.bonus.canteen.core.menu.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import com.bonus.canteen.core.alloc.domain.AllocMobileCanteenQueryDTO;
import com.bonus.canteen.core.menu.domain.MenuAppRecipe;
@ -118,6 +119,18 @@ public class MenuAppRecipeController extends BaseController {
return toAjax(menuAppRecipeService.deleteMenuAppRecipeByIds(ids));
}
@ApiOperation("获取预定餐食堂列表")
@GetMapping({"/reserve/canteen/shopstall/list"})
public TableDataInfo getReserveMealCanteenList() {
try {
startPage();
return getDataTable(this.menuAppRecipeService.getReserveMealCanteenList());
} catch (Exception e) {
log.error(e.toString(), e);
return getDataTable(null);
}
}
@ApiOperation("移动端-查询预订日期列表")
@PostMapping({"/reserve-date/list"})
public AjaxResult listReserveDate(@RequestBody AllocMobileCanteenQueryDTO bean) {

View File

@ -2,8 +2,11 @@ package com.bonus.canteen.core.menu.mapper;
import java.time.LocalDate;
import java.util.List;
import java.util.Set;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.bonus.canteen.core.alloc.domain.AppletReserveCanteenVO;
import com.bonus.canteen.core.alloc.domain.MenuStallSaleModel;
import com.bonus.canteen.core.menu.domain.MenuAppRecipe;
import com.bonus.canteen.core.menu.domain.MenuRecipe;
import com.bonus.canteen.core.menu.vo.AppletReserveRecipeVO;
@ -57,6 +60,10 @@ public interface MenuAppRecipeMapper {
*/
public int deleteMenuAppRecipeById(Long id);
List<AppletReserveCanteenVO> selectReserveMealCanteenList();
List<MenuStallSaleModel> selectMonthSalesStall(@Param("stallIdList") List<Long> stallIdList);
/**
* 批量删除移动端菜谱绑定关系
*

View File

@ -4,6 +4,7 @@ import java.time.LocalDate;
import java.util.List;
import com.bonus.canteen.core.alloc.domain.AllocMobileCanteenQueryDTO;
import com.bonus.canteen.core.alloc.domain.AppletReserveCanteenVO;
import com.bonus.canteen.core.menu.domain.MenuAppRecipe;
import com.bonus.canteen.core.menu.dto.AppletReserveRecipeDTO;
import com.bonus.canteen.core.menu.vo.AppletReserveRecipeVO;
@ -63,6 +64,8 @@ public interface IMenuAppRecipeService {
*/
public int deleteMenuAppRecipeById(Long id);
public List<AppletReserveCanteenVO> getReserveMealCanteenList();
public List<LocalDate> listReserveDate(AllocMobileCanteenQueryDTO queryDTO);
public List<AppletReserveRecipeVO> getReserveRecipeDetailList(AppletReserveRecipeDTO content);

View File

@ -9,12 +9,12 @@ import java.util.stream.Collectors;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.bonus.canteen.core.alloc.domain.AllocMobileCanteenQueryDTO;
import com.bonus.canteen.core.alloc.domain.AllocStall;
import com.bonus.canteen.core.alloc.domain.AllocStallMealtime;
import com.bonus.canteen.core.alloc.domain.*;
import com.bonus.canteen.core.alloc.mapper.AllocStallMapper;
import com.bonus.canteen.core.alloc.service.IAllocCanteenService;
import com.bonus.canteen.core.menu.domain.MenuRecipe;
import com.bonus.canteen.core.menu.dto.AppletReserveRecipeDTO;
import com.bonus.canteen.core.menu.mapper.MenuRecipeMapper;
import com.bonus.canteen.core.menu.service.IMenuAppRecipeService;
import com.bonus.canteen.core.menu.vo.AppletReserveRecipeDishesVO;
import com.bonus.canteen.core.menu.vo.AppletReserveRecipeTypeVO;
@ -24,6 +24,7 @@ import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import com.bonus.common.houqin.constant.DelFlagEnum;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -43,6 +44,8 @@ public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService {
private MenuAppRecipeMapper menuAppRecipeMapper;
@Autowired
AllocStallMapper allocStallMapper;
@Autowired
IAllocCanteenService allocCanteenService;
/**
* 查询移动端菜谱绑定关系
@ -120,6 +123,32 @@ public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService {
return menuAppRecipeMapper.deleteMenuAppRecipeById(id);
}
@Override
public List<AppletReserveCanteenVO> getReserveMealCanteenList() {
List<AppletReserveCanteenVO> resultList = this.menuAppRecipeMapper.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<MenuStallSaleModel> stallMonthSalesList = this.menuAppRecipeMapper.selectMonthSalesStall(stallIdList);
Map<Long, Integer> stallSaleMap = (Map)stallMonthSalesList.stream().collect(Collectors.toMap(MenuStallSaleModel::getStallId, MenuStallSaleModel::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());

View File

@ -51,6 +51,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</collection>
</resultMap>
<resultMap id="appletReserveCanteenVO" type="com.bonus.canteen.core.alloc.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.alloc.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>
<sql id="selectMenuAppRecipeVo">
select id, recipe_id, bind_type, bind_time, meal_line_id, create_by, create_time, update_by, update_time, remark from menu_app_recipe
</sql>
@ -123,6 +141,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</delete>
<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
menu_app_recipe mar
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
left join alloc_canteen ac on mr.canteen_id = ac.canteen_id
left join alloc_stall ass on mr.stall_id = ass.stall_id
where
bind_type = 2
</select>
<select id="selectMonthSalesStall" resultType="com.bonus.canteen.core.alloc.domain.MenuStallSaleModel">
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