From a3fe487e366e27f5ba5104c1cd5ed3c9ec77729b Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Fri, 6 Jun 2025 14:52:57 +0800 Subject: [PATCH] =?UTF-8?q?h5=E9=A2=84=E8=AE=A2=E9=A4=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/AllocMobileCanteenQueryDTO.java | 32 ++++ .../basic/domain/AppletReserveCanteenVO.java | 103 +++++++++++ .../basic/domain/AppletReserveStallVO.java | 122 ++++++++++++ .../core/basic/domain/BasicStallMealtime.java | 6 +- .../core/basic/domain/CookStallSaleModel.java | 31 ++++ .../mapper/BasicStallMealtimeMapper.java | 2 + .../controller/CookRecipeH5Controller.java | 73 ++++++++ .../core/cook/dto/AppletReserveRecipeDTO.java | 52 ++++++ .../core/cook/mapper/CookRecipeH5Mapper.java | 35 ++++ .../cook/service/ICookRecipeH5Service.java | 28 +++ .../service/impl/CookRecipeServiceH5Impl.java | 124 +++++++++++++ .../cook/vo/AppletCurrentDishesDetailVO.java | 111 +++++++++++ .../cook/vo/AppletReserveRecipeDishesVO.java | 173 ++++++++++++++++++ .../cook/vo/AppletReserveRecipeTypeVO.java | 40 ++++ .../core/cook/vo/AppletReserveRecipeVO.java | 40 ++++ .../mapper/basic/BasicStallMealtimeMapper.xml | 9 +- .../mapper/cook/CookRecipeH5Mapper.xml | 150 +++++++++++++++ 17 files changed, 1127 insertions(+), 4 deletions(-) create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/AllocMobileCanteenQueryDTO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/AppletReserveCanteenVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/AppletReserveStallVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/CookStallSaleModel.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeH5Controller.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/dto/AppletReserveRecipeDTO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeH5Mapper.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeH5Service.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceH5Impl.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletCurrentDishesDetailVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeDishesVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeTypeVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeH5Mapper.xml diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/AllocMobileCanteenQueryDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/AllocMobileCanteenQueryDTO.java new file mode 100644 index 0000000..b88e7a4 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/AllocMobileCanteenQueryDTO.java @@ -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() + ")"; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/AppletReserveCanteenVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/AppletReserveCanteenVO.java new file mode 100644 index 0000000..b784fee --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/AppletReserveCanteenVO.java @@ -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 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/basic/domain/AppletReserveStallVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/AppletReserveStallVO.java new file mode 100644 index 0000000..588f063 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/AppletReserveStallVO.java @@ -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; + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/BasicStallMealtime.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/BasicStallMealtime.java index bac15fc..5a915ca 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/BasicStallMealtime.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/BasicStallMealtime.java @@ -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否") diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/CookStallSaleModel.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/CookStallSaleModel.java new file mode 100644 index 0000000..c7f2c74 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/domain/CookStallSaleModel.java @@ -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; + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/mapper/BasicStallMealtimeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/mapper/BasicStallMealtimeMapper.java index ee3aaf2..7d884b0 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/mapper/BasicStallMealtimeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/basic/mapper/BasicStallMealtimeMapper.java @@ -62,4 +62,6 @@ public interface BasicStallMealtimeMapper { public int deleteBasicStallMealtimeByIds(Long[] ids); public int deleteBasicStallMealtimeByStallId(Long stallId); + + public List selectBasicStallMealtimeByStallId(Long stallId); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeH5Controller.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeH5Controller.java new file mode 100644 index 0000000..10488d7 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeH5Controller.java @@ -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); + } + } + + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/dto/AppletReserveRecipeDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/dto/AppletReserveRecipeDTO.java new file mode 100644 index 0000000..815a5a9 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/dto/AppletReserveRecipeDTO.java @@ -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() + ")"; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeH5Mapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeH5Mapper.java new file mode 100644 index 0000000..98d2ebf --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeH5Mapper.java @@ -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 selectReserveMealCanteenList(); + + List selectMonthSalesStall(@Param("stallIdList") List stallIdList); + + List selectReserveRecipe(@Param("applyDate") LocalDate applyDate, @Param("recipeId") Long recipeId); + + @Select({"select stall_id from menu_recipe ${ew.customSqlSegment}"}) + Long selectStallIdByWrappers(@Param("ew") Wrapper wrapper); + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeH5Service.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeH5Service.java new file mode 100644 index 0000000..40621e8 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeH5Service.java @@ -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 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/cook/service/impl/CookRecipeServiceH5Impl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceH5Impl.java new file mode 100644 index 0000000..544dee1 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceH5Impl.java @@ -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 getReserveMealCanteenList() { + List resultList = this.cookRecipeH5Mapper.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.cookRecipeH5Mapper.selectMonthSalesStall(stallIdList); + Map stallSaleMap = (Map)stallMonthSalesList.stream().collect(Collectors.toMap(CookStallSaleModel::getStallId, CookStallSaleModel::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()); + } + + private List listMatchData(Integer reserveLimitDayNum, String ifAllowReserveToday) { + log.info(String.format("查询日期,天数:%d", reserveLimitDayNum)); + List 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 getReserveRecipeDetailList(AppletReserveRecipeDTO content) { + List 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 allocStallMealtimes = basicStallMealtimeMapper.selectBasicStallMealtimeByStallId(stallId); + List 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 finalMealTimeList = mealTimeList; + resultList = resultList.stream().filter((time) -> { + return finalMealTimeList.stream().map(BasicStallMealtime::getMealtimeType).collect(Collectors.toList()).contains(time.getMealtimeType()); + }).collect(Collectors.toList()); + return resultList; + } + } + } + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletCurrentDishesDetailVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletCurrentDishesDetailVO.java new file mode 100644 index 0000000..2d78d71 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletCurrentDishesDetailVO.java @@ -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; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeDishesVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeDishesVO.java new file mode 100644 index 0000000..bb26110 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeDishesVO.java @@ -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 dishesDetailList; +// @ApiModelProperty("配送方式列表") +// private List costModelList; + @ApiModelProperty("口味列表") + private List 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 getDishesDetailList() { + return dishesDetailList; + } + + public void setDishesDetailList(List dishesDetailList) { + this.dishesDetailList = dishesDetailList; + } + +// public List getCostModelList() { +// return costModelList; +// } +// +// public void setCostModelList(List costModelList) { +// this.costModelList = costModelList; +// } + + public List getTasteNameList() { + return tasteNameList; + } + + public void setTasteNameList(List tasteNameList) { + this.tasteNameList = tasteNameList; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeTypeVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeTypeVO.java new file mode 100644 index 0000000..0c14905 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeTypeVO.java @@ -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 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 getDishesList() { + return dishesList; + } + + public void setDishesList(List dishesList) { + this.dishesList = dishesList; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeVO.java new file mode 100644 index 0000000..4eda52e --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/AppletReserveRecipeVO.java @@ -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 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 getTypeList() { + return typeList; + } + + public void setTypeList(List typeList) { + this.typeList = typeList; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/basic/BasicStallMealtimeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/basic/BasicStallMealtimeMapper.xml index fa2be53..92e583d 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/basic/BasicStallMealtimeMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/basic/BasicStallMealtimeMapper.xml @@ -18,7 +18,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - 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 + + insert into basic_stall_mealtime(stall_id, mealtime_type, mealtime_name, start_time, end_time) values diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeH5Mapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeH5Mapper.xml new file mode 100644 index 0000000..077fbc9 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeH5Mapper.xml @@ -0,0 +1,150 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +