From 008f4f6dd49f14b00f3cfab3c50eff843716b6d1 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Fri, 18 Apr 2025 14:17:51 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E8=AE=A2=E9=A4=90=E6=A1=A3=E5=8F=A3?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alloc/domain/AppletReserveCanteenVO.java | 102 ++++++++++++++ .../alloc/domain/AppletReserveStallVO.java | 124 ++++++++++++++++++ .../core/alloc/domain/MenuStallSaleModel.java | 31 +++++ .../alloc/service/IAllocCanteenService.java | 2 + .../service/impl/AllocCanteenServiceImpl.java | 11 +- .../controller/MenuAppRecipeController.java | 13 ++ .../core/menu/mapper/MenuAppRecipeMapper.java | 7 + .../menu/service/IMenuAppRecipeService.java | 3 + .../impl/MenuAppRecipeServiceImpl.java | 35 ++++- .../mapper/menu/MenuAppRecipeMapper.xml | 58 ++++++++ 10 files changed, 381 insertions(+), 5 deletions(-) create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AppletReserveCanteenVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AppletReserveStallVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/MenuStallSaleModel.java diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AppletReserveCanteenVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AppletReserveCanteenVO.java new file mode 100644 index 0000000..b9f2199 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AppletReserveCanteenVO.java @@ -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 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 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 stallList) { + this.stallList = stallList; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AppletReserveStallVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AppletReserveStallVO.java new file mode 100644 index 0000000..1201674 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AppletReserveStallVO.java @@ -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; + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/MenuStallSaleModel.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/MenuStallSaleModel.java new file mode 100644 index 0000000..f823bc2 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/MenuStallSaleModel.java @@ -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; + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/IAllocCanteenService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/IAllocCanteenService.java index 5fac553..c649b19 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/IAllocCanteenService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/IAllocCanteenService.java @@ -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); + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java index 24f2bde..4d4f787 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/service/impl/AllocCanteenServiceImpl.java @@ -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; diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuAppRecipeController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuAppRecipeController.java index 77b7b1e..e32331b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuAppRecipeController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuAppRecipeController.java @@ -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) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuAppRecipeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuAppRecipeMapper.java index 73d1bea..72161a1 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuAppRecipeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuAppRecipeMapper.java @@ -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 selectReserveMealCanteenList(); + + List selectMonthSalesStall(@Param("stallIdList") List stallIdList); + /** * 批量删除移动端菜谱绑定关系 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuAppRecipeService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuAppRecipeService.java index 7a0c122..6c829c6 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuAppRecipeService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuAppRecipeService.java @@ -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 getReserveMealCanteenList(); + public List listReserveDate(AllocMobileCanteenQueryDTO queryDTO); public List getReserveRecipeDetailList(AppletReserveRecipeDTO content); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuAppRecipeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuAppRecipeServiceImpl.java index 5fe3451..41021a7 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuAppRecipeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuAppRecipeServiceImpl.java @@ -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 getReserveMealCanteenList() { + List resultList = this.menuAppRecipeMapper.selectReserveMealCanteenList(); + if (ObjectUtil.isEmpty(resultList)) { + return resultList; + } else { + //this.allocCanteenService.checkAndDelReserveCanteen(resultList); + List stallIdList = (List)resultList.stream().flatMap((canteen) -> { + return canteen.getStallList().stream().map(AppletReserveStallVO::getStallId); + }).collect(Collectors.toList()); + if (ObjectUtil.isNotEmpty(stallIdList)) { + List stallMonthSalesList = this.menuAppRecipeMapper.selectMonthSalesStall(stallIdList); + Map stallSaleMap = (Map)stallMonthSalesList.stream().collect(Collectors.toMap(MenuStallSaleModel::getStallId, MenuStallSaleModel::getMonthlySales)); + resultList.forEach((canteen) -> { + List stallList = canteen.getStallList(); + if (ObjectUtil.isNotEmpty(stallList)) { + stallList.forEach((stall) -> { + stall.setMonthlySales((Integer)stallSaleMap.get(stall.getStallId())); + }); + } + }); + } + return resultList; + } + } + @Override public List listReserveDate(AllocMobileCanteenQueryDTO queryDTO) { return this.listMatchData(queryDTO.getReserveLimitDayNum(), queryDTO.getIfAllowReserveToday()); diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuAppRecipeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuAppRecipeMapper.xml index ffc4ec8..884330e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuAppRecipeMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuAppRecipeMapper.xml @@ -51,6 +51,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + + + + + + select id, recipe_id, bind_type, bind_time, meal_line_id, create_by, create_time, update_by, update_time, remark from menu_app_recipe @@ -123,6 +141,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + +