diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocMobileCanteenQueryDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocMobileCanteenQueryDTO.java new file mode 100644 index 0000000..3090e90 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocMobileCanteenQueryDTO.java @@ -0,0 +1,32 @@ +package com.bonus.canteen.core.alloc.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/alloc/domain/AllocStallMealtime.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocStallMealtime.java index b13f848..a7772bf 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocStallMealtime.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AllocStallMealtime.java @@ -33,7 +33,7 @@ public class AllocStallMealtime extends BaseEntity { /** 餐次类型 */ @Excel(name = "餐次类型") @ApiModelProperty(value = "餐次类型") - private Long mealtimeType; + private Integer mealtimeType; /** 餐次名称 */ @Excel(name = "餐次名称") 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..e5fea44 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/alloc/domain/AppletReserveStallVO.java @@ -0,0 +1,123 @@ +package com.bonus.canteen.core.alloc.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.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 d0d8e44..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,7 +2,9 @@ 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; import com.bonus.canteen.core.menu.dto.AppletReserveRecipeDTO; import com.bonus.canteen.core.menu.service.IMenuAppRecipeService; @@ -117,11 +119,24 @@ public class MenuAppRecipeController extends BaseController { return toAjax(menuAppRecipeService.deleteMenuAppRecipeByIds(ids)); } - /** - * @author jsk - * @param content - * @return - */ + @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) { + return AjaxResult.success(this.menuAppRecipeService.listReserveDate(bean)); + } + @ApiOperation("获取预定餐菜谱详情") @PostMapping({"/reserve/recipe/detail"}) public TableDataInfo getReserveRecipeDetailList(@RequestBody AppletReserveRecipeDTO content) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuDishesDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuDishesDTO.java index 7647d66..d8ea1eb 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuDishesDTO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuDishesDTO.java @@ -86,14 +86,14 @@ public class MenuDishesDTO { @TableField(value = "crby", fill = FieldFill.INSERT) @ApiModelProperty("创建人") - private String crby; + private String createBy; @ApiModelProperty("创建时间") - private LocalDateTime crtime; + private LocalDateTime createTime; @TableField(value = "upby", fill = FieldFill.UPDATE) @ApiModelProperty("更新人") - private String upby; + private String updateBy; @ApiModelProperty("更新时间") - private LocalDateTime uptime; + private LocalDateTime updateTime; @ApiModelProperty("功效") private Integer effectId; 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/mapper/MenuDishesMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuDishesMapper.java index 366562d..4269f69 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuDishesMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuDishesMapper.java @@ -72,12 +72,6 @@ public interface MenuDishesMapper { int addMenuDishes(MenuDishesDTO menuDishesDTO); - int adddishesLabel(MenuDishesRelation menuDishesRelation); - int adddishesTaste(MenuDishesRelation menuDishesRelation); - int adddishesSeason(MenuDishesRelation menuDishesRelation); - int adddishesSuit(MenuDishesRelation menuDishesRelation); - int adddishesMeal(MenuDishesRelation menuDishesRelation); - NutritionEntity getNutritionEntity(MenuDishesAddMaterialDTO dto); int addFinalNutrition(NutritionEntity nutritionEntity); 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 095ff94..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 @@ -1,6 +1,10 @@ package com.bonus.canteen.core.menu.service; +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; @@ -60,5 +64,9 @@ 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 cebbf40..ccb05ce 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,19 +9,22 @@ 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.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; import com.bonus.canteen.core.menu.vo.AppletReserveRecipeVO; +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.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; @@ -41,6 +44,8 @@ public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService { private MenuAppRecipeMapper menuAppRecipeMapper; @Autowired AllocStallMapper allocStallMapper; + @Autowired + IAllocCanteenService allocCanteenService; /** * 查询移动端菜谱绑定关系 @@ -118,6 +123,56 @@ 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()); + } + + 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 = menuAppRecipeMapper.selectReserveRecipe(content.getApplyDate(), content.getRecipeId()); @@ -149,52 +204,7 @@ public class MenuAppRecipeServiceImpl implements IMenuAppRecipeService { resultList = resultList.stream().filter((time) -> { return finalMealTimeList.stream().map(AllocStallMealtime::getMealtimeType).collect(Collectors.toList()).contains(time.getMealtimeType()); }).collect(Collectors.toList()); - Set dishesIdSet = resultList.stream().flatMap((time) -> { - return time.getTypeList().stream().flatMap((type) -> { - return type.getDishesList().stream().map((item) -> { - return (item.getDishesDetailList().get(0)).getDishesId(); - }); - }); - }).collect(Collectors.toSet()); - if (ObjectUtil.isEmpty(dishesIdSet)) { - return resultList; - } else { - Iterator var10 = resultList.iterator(); - - while (true) { - List typeList; - do { - if (!var10.hasNext()) { - return resultList; - } - - AppletReserveRecipeVO mealtime = (AppletReserveRecipeVO) var10.next(); - typeList = mealtime.getTypeList(); - } while (!ObjectUtil.isNotEmpty(typeList)); - - List recommendList = Lists.newArrayList(); - - for (AppletReserveRecipeTypeVO type : typeList) { - List dishesList = type.getDishesList(); - if (ObjectUtil.isNotEmpty(dishesList)) { - List tempList = dishesList.stream().filter((d) -> { - return d.getRecommendFlag() == 1; - }).collect(Collectors.toList()); - if (ObjectUtil.isNotEmpty(tempList)) { - recommendList.addAll(tempList); - } - } - } - - if (ObjectUtil.isNotEmpty(recommendList)) { - AppletReserveRecipeTypeVO recommend = new AppletReserveRecipeTypeVO(); - recommend.setTypeId(999L); - recommend.setTypeName("推荐"); - recommend.setDishesList(recommendList); - typeList.add(0, recommend); - } - } - } + return resultList; } } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java index a994837..d5db3fb 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java @@ -135,7 +135,7 @@ public class MenuDishesServiceImpl implements IMenuDishesService { } Long dishesId = Id.next(); Long baseDishesId = Id.next(); - menuDishesDTO.setCrby(SecurityUtils.getUserId()+""); + menuDishesDTO.setCreateBy(SecurityUtils.getUsername()); //添加基础主表信息 menuDishesDTO.setBaseDishesId(baseDishesId+""); menuDishesDTO.setDishesId(dishesId+""); @@ -144,53 +144,6 @@ public class MenuDishesServiceImpl implements IMenuDishesService { //添加主要信息 int dishesNum = menuDishesMapper.addMenuDishes(menuDishesDTO); - //添加菜品关联信息 - //标签 - List labelIdList = menuDishesDTO.getLabelIdList(); - for (Integer i: labelIdList) { - MenuDishesRelation menuDishesRelation = new MenuDishesRelation(); - menuDishesRelation.setKeyWordId(i); - menuDishesRelation.setCrby(SecurityUtils.getUserId()); - menuDishesRelation.setDishesId(dishesId); - menuDishesMapper.adddishesLabel(menuDishesRelation); - } - //口味 - List tasteIdList = menuDishesDTO.getTasteIdList(); - for (Integer i: tasteIdList) { - MenuDishesRelation menuDishesRelation = new MenuDishesRelation(); - menuDishesRelation.setKeyWordId(i); - menuDishesRelation.setCrby(SecurityUtils.getUserId()); - menuDishesRelation.setDishesId(dishesId); - menuDishesMapper.adddishesTaste(menuDishesRelation); - } - //季节分类 - List seasonList = menuDishesDTO.getSeason(); - for (Integer i: tasteIdList) { - MenuDishesRelation menuDishesRelation = new MenuDishesRelation(); - menuDishesRelation.setKeyWordId(i); - menuDishesRelation.setCrby(SecurityUtils.getUserId()); - menuDishesRelation.setDishesId(dishesId); - menuDishesMapper.adddishesSeason(menuDishesRelation); - } - //适宜人群 - List suitIdList = menuDishesDTO.getSuitIdList(); - for (Integer i: suitIdList) { - MenuDishesRelation menuDishesRelation = new MenuDishesRelation(); - menuDishesRelation.setKeyWordId(i); - menuDishesRelation.setCrby(SecurityUtils.getUserId()); - menuDishesRelation.setDishesId(dishesId); - menuDishesMapper.adddishesSuit(menuDishesRelation); - } - //餐次 - List mealList= menuDishesDTO.getMealList(); - for (Integer i: mealList) { - MenuDishesRelation menuDishesRelation = new MenuDishesRelation(); - menuDishesRelation.setKeyWordId(i); - menuDishesRelation.setCrby(SecurityUtils.getUserId()); - menuDishesRelation.setDishesId(dishesId); - menuDishesMapper.adddishesMeal(menuDishesRelation); - } - List materialList= menuDishesDTO.getMaterialList(); List nutritionEntityList = new ArrayList<>(); System.err.println("长度:"+materialList.size()); @@ -244,17 +197,19 @@ public class MenuDishesServiceImpl implements IMenuDishesService { //首字母转小写 public static String toLowerCaseFirstOne(String s) { - if(Character.isLowerCase(s.charAt(0))) + if(Character.isLowerCase(s.charAt(0))) { return s; - else + } else { return (new StringBuilder()).append(Character.toLowerCase(s.charAt(0))).append(s.substring(1)).toString(); + } } //首字母转大写 public static String toUpperCaseFirstOne(String s) { - if (Character.isUpperCase(s.charAt(0))) + if (Character.isUpperCase(s.charAt(0))) { return s; - else + } else { return (new StringBuilder()).append(Character.toUpperCase(s.charAt(0))).append(s.substring(1)).toString(); + } } 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" + + + + select calories,fat,protein,carbohydrate,dietary_fiber as dietaryFiber, cholesterol,calcium,sodium,purine,iron,