Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
bf2194c331
|
|
@ -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() + ")";
|
||||
}
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@ public class AllocStallMealtime extends BaseEntity {
|
|||
/** 餐次类型 */
|
||||
@Excel(name = "餐次类型")
|
||||
@ApiModelProperty(value = "餐次类型")
|
||||
private Long mealtimeType;
|
||||
private Integer mealtimeType;
|
||||
|
||||
/** 餐次名称 */
|
||||
@Excel(name = "餐次名称")
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
/**
|
||||
* 批量删除移动端菜谱绑定关系
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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<AppletReserveCanteenVO> getReserveMealCanteenList();
|
||||
|
||||
public List<LocalDate> listReserveDate(AllocMobileCanteenQueryDTO queryDTO);
|
||||
|
||||
public List<AppletReserveRecipeVO> getReserveRecipeDetailList(AppletReserveRecipeDTO content);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<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());
|
||||
}
|
||||
|
||||
private List<LocalDate> listMatchData(Integer reserveLimitDayNum, String ifAllowReserveToday) {
|
||||
log.info(String.format("查询日期,天数:%d", reserveLimitDayNum));
|
||||
List<LocalDate> reserveDateList = new ArrayList();
|
||||
LocalDate startDate;
|
||||
if (BnsConstants.COMMON_YES.equals(ifAllowReserveToday)) {
|
||||
log.info("允许预定当天");
|
||||
startDate = LocalDate.now();
|
||||
} else {
|
||||
log.info("不允许预定当天");
|
||||
startDate = LocalDate.now().plusDays(1L);
|
||||
}
|
||||
|
||||
for(int i = 0; i < reserveLimitDayNum; ++i) {
|
||||
reserveDateList.add(startDate.plusDays((long)i));
|
||||
}
|
||||
|
||||
return reserveDateList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AppletReserveRecipeVO> getReserveRecipeDetailList(AppletReserveRecipeDTO content) {
|
||||
List<AppletReserveRecipeVO> resultList = 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<Long> 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<AppletReserveRecipeTypeVO> typeList;
|
||||
do {
|
||||
if (!var10.hasNext()) {
|
||||
return resultList;
|
||||
}
|
||||
|
||||
AppletReserveRecipeVO mealtime = (AppletReserveRecipeVO) var10.next();
|
||||
typeList = mealtime.getTypeList();
|
||||
} while (!ObjectUtil.isNotEmpty(typeList));
|
||||
|
||||
List<AppletReserveRecipeDishesVO> recommendList = Lists.newArrayList();
|
||||
|
||||
for (AppletReserveRecipeTypeVO type : typeList) {
|
||||
List<AppletReserveRecipeDishesVO> dishesList = type.getDishesList();
|
||||
if (ObjectUtil.isNotEmpty(dishesList)) {
|
||||
List<AppletReserveRecipeDishesVO> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Integer> 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<Integer> 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<Integer> 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<Integer> 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<Integer> 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<MenuDishesAddMaterialDTO> materialList= menuDishesDTO.getMaterialList();
|
||||
List<NutritionEntity> nutritionEntityList = new ArrayList<>();
|
||||
System.err.println("长度:"+materialList.size());
|
||||
|
|
@ -244,18 +197,20 @@ 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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -371,12 +371,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="baseDishesId != null">base_dishes_id,</if>
|
||||
<if test="dishesName != null">dishes_name,</if>
|
||||
<if test="crby != null">crby,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test=" baseDishesId!= null">#{baseDishesId},</if>
|
||||
<if test=" dishesName!= null">#{dishesName},</if>
|
||||
<if test="crby != null">#{crby},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
|
@ -401,7 +401,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="styleId != null">style_id,</if>
|
||||
<if test="cookId != null">cook_id,</if>
|
||||
<if test="classifyId != null">classify_id,</if>
|
||||
<if test="crby != null">create_by,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="customId != null">custom_id,</if>
|
||||
|
||||
</trim>
|
||||
|
|
@ -424,83 +424,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="styleId != null">#{styleId},</if>
|
||||
<if test="cookId != null">#{cookId},</if>
|
||||
<if test="classifyId != null">#{classifyId},</if>
|
||||
<if test="crby != null">#{crby},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="customId != null">#{customId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<insert id="adddishesLabel" parameterType="com.bonus.canteen.core.menu.domain.MenuDishesRelation">
|
||||
insert into menu_dishes_label_relation
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="keyWordId != null">label_id,</if>
|
||||
<if test="dishesId != null">dishes_id,</if>
|
||||
<if test="crby != null">crby,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="keyWordId != null">#{keyWordId},</if>
|
||||
<if test="dishesId != null">#{dishesId},</if>
|
||||
<if test="crby != null">#{crby},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<insert id="adddishesTaste" parameterType="com.bonus.canteen.core.menu.domain.MenuDishesRelation">
|
||||
insert into menu_dishes_taste_relation
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="keyWordId != null">taste_id,</if>
|
||||
<if test="dishesId != null">dishes_id,</if>
|
||||
<if test="crby != null">crby,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="keyWordId != null">#{keyWordId},</if>
|
||||
<if test="dishesId != null">#{dishesId},</if>
|
||||
<if test="crby != null">#{crby},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="adddishesSeason" parameterType="com.bonus.canteen.core.menu.domain.MenuDishesRelation">
|
||||
insert into menu_dishes_season_relation
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="keyWordId != null">season_id,</if>
|
||||
<if test="dishesId != null">dishes_id,</if>
|
||||
<if test="crby != null">crby,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="keyWordId != null">#{keyWordId},</if>
|
||||
<if test="dishesId != null">#{dishesId},</if>
|
||||
<if test="crby != null">#{crby},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="adddishesSuit" parameterType="com.bonus.canteen.core.menu.domain.MenuDishesRelation">
|
||||
insert into menu_dishes_suit_relation
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="keyWordId != null">suit_id,</if>
|
||||
<if test="dishesId != null">dishes_id,</if>
|
||||
<if test="crby != null">crby,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="keyWordId != null">#{keyWordId},</if>
|
||||
<if test="dishesId != null">#{dishesId},</if>
|
||||
<if test="crby != null">#{crby},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="adddishesMeal" parameterType="com.bonus.canteen.core.menu.domain.MenuDishesRelation">
|
||||
insert into menu_dishes_meal_relation
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="keyWordId != null">meal_id,</if>
|
||||
<if test="dishesId != null">dishes_id,</if>
|
||||
<if test="crby != null">crby,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="keyWordId != null">#{keyWordId},</if>
|
||||
<if test="dishesId != null">#{dishesId},</if>
|
||||
<if test="crby != null">#{crby},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="getNutritionEntity" resultType="com.bonus.canteen.core.utils.NutritionEntity" parameterType="com.bonus.canteen.core.menu.dto.MenuDishesAddMaterialDTO">
|
||||
select calories,fat,protein,carbohydrate,dietary_fiber as dietaryFiber,
|
||||
cholesterol,calcium,sodium,purine,iron,
|
||||
|
|
|
|||
Loading…
Reference in New Issue