h5周菜谱
This commit is contained in:
parent
f24d7330ea
commit
3144a21a8d
|
|
@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -69,5 +70,16 @@ public class CookRecipeH5Controller extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取一周菜谱详情")
|
||||||
|
@GetMapping({"/week/recipe/detail"})
|
||||||
|
public TableDataInfo getWeekRecipeDetailList(@Valid AppletWeekRecipeDTO content) {
|
||||||
|
try {
|
||||||
|
startPage();
|
||||||
|
content.setApplyDate(LocalDate.parse(content.getDate()));
|
||||||
|
return getDataTable(this.cookRecipeH5Service.getWeekRecipeDetailList(content));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.toString(), e);
|
||||||
|
return getDataTable(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.bonus.canteen.core.cook.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class AppletWeekRecipeDTO {
|
||||||
|
@ApiModelProperty("菜谱日期")
|
||||||
|
private LocalDate applyDate;
|
||||||
|
@ApiModelProperty("人员id")
|
||||||
|
private Long userId;
|
||||||
|
@ApiModelProperty("菜谱id")
|
||||||
|
private Long recipeId;
|
||||||
|
private String date;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,76 @@
|
||||||
|
package com.bonus.canteen.core.cook.enums;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public enum BasicMealtimeTypeEnum {
|
||||||
|
MEALTIME_BREAKFAST(1, "早餐"),
|
||||||
|
MEALTIME_LUNCH(2, "午餐"),
|
||||||
|
MEALTIME_AFTERNOON_TEA(3, "下午茶"),
|
||||||
|
MEALTIME_DINNER(4, "晚餐"),
|
||||||
|
MEALTIME_MIDNIGHT_SNACK(5, "夜宵");
|
||||||
|
|
||||||
|
private final Integer key;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
private BasicMealtimeTypeEnum(Integer key, String desc) {
|
||||||
|
this.key = key;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BasicMealtimeTypeEnum getTypeEnum(Integer key) {
|
||||||
|
BasicMealtimeTypeEnum[] var1 = values();
|
||||||
|
int var2 = var1.length;
|
||||||
|
|
||||||
|
for(int var3 = 0; var3 < var2; ++var3) {
|
||||||
|
BasicMealtimeTypeEnum typeEnum = var1[var3];
|
||||||
|
if (typeEnum.getKey().equals(key)) {
|
||||||
|
return typeEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDescByKey(Integer key) {
|
||||||
|
BasicMealtimeTypeEnum[] enums = values();
|
||||||
|
BasicMealtimeTypeEnum[] var2 = enums;
|
||||||
|
int var3 = enums.length;
|
||||||
|
|
||||||
|
for(int var4 = 0; var4 < var3; ++var4) {
|
||||||
|
BasicMealtimeTypeEnum anEnum = var2[var4];
|
||||||
|
if (anEnum.getKey().equals(key)) {
|
||||||
|
return anEnum.getDesc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getKeyByDesc(String desc) {
|
||||||
|
BasicMealtimeTypeEnum[] enums = values();
|
||||||
|
BasicMealtimeTypeEnum[] var2 = enums;
|
||||||
|
int var3 = enums.length;
|
||||||
|
|
||||||
|
for(int var4 = 0; var4 < var3; ++var4) {
|
||||||
|
BasicMealtimeTypeEnum anEnum = var2[var4];
|
||||||
|
if (anEnum.getDesc().equals(desc)) {
|
||||||
|
return anEnum.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<Integer> allTypeList() {
|
||||||
|
return ListUtil.toList(new Integer[]{MEALTIME_BREAKFAST.getKey(), MEALTIME_LUNCH.getKey(), MEALTIME_AFTERNOON_TEA.getKey(), MEALTIME_DINNER.getKey(), MEALTIME_MIDNIGHT_SNACK.getKey()});
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getKey() {
|
||||||
|
return this.key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDesc() {
|
||||||
|
return this.desc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -6,6 +6,7 @@ import com.bonus.canteen.core.cook.domain.CookRecipe;
|
||||||
import com.bonus.canteen.core.cook.dto.*;
|
import com.bonus.canteen.core.cook.dto.*;
|
||||||
import com.bonus.canteen.core.cook.vo.AllocRecipeStallVO;
|
import com.bonus.canteen.core.cook.vo.AllocRecipeStallVO;
|
||||||
import com.bonus.canteen.core.cook.vo.AppletReserveRecipeVO;
|
import com.bonus.canteen.core.cook.vo.AppletReserveRecipeVO;
|
||||||
|
import com.bonus.canteen.core.cook.vo.AppletWeekRecipeVO;
|
||||||
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
|
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
|
@ -25,4 +26,6 @@ public interface ICookRecipeH5Service {
|
||||||
public List<LocalDate> listReserveDate(AllocMobileCanteenQueryDTO queryDTO);
|
public List<LocalDate> listReserveDate(AllocMobileCanteenQueryDTO queryDTO);
|
||||||
|
|
||||||
public List<AppletReserveRecipeVO> getReserveRecipeDetailList(AppletReserveRecipeDTO content);
|
public List<AppletReserveRecipeVO> getReserveRecipeDetailList(AppletReserveRecipeDTO content);
|
||||||
|
|
||||||
|
public List<AppletWeekRecipeVO> getWeekRecipeDetailList(AppletWeekRecipeDTO content);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,9 @@ import com.bonus.canteen.core.cook.mapper.CookRecipeH5Mapper;
|
||||||
import com.bonus.canteen.core.cook.service.ICookRecipeH5Service;
|
import com.bonus.canteen.core.cook.service.ICookRecipeH5Service;
|
||||||
import com.bonus.canteen.core.cook.vo.*;
|
import com.bonus.canteen.core.cook.vo.*;
|
||||||
import com.bonus.canteen.core.utils.BnsConstants;
|
import com.bonus.canteen.core.utils.BnsConstants;
|
||||||
|
import com.bonus.common.core.exception.ServiceException;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -121,4 +123,58 @@ public class CookRecipeServiceH5Impl implements ICookRecipeH5Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AppletWeekRecipeVO> getWeekRecipeDetailList(AppletWeekRecipeDTO content) {
|
||||||
|
// List<Long> recipeIdList = Lists.newArrayList();
|
||||||
|
// if (ObjectUtil.isNull(content.getRecipeId())) {
|
||||||
|
// recipeIdList = this.cookRecipeH5Mapper.selectWeekRecipeId(content.getRecipeId());
|
||||||
|
// if (ObjectUtil.isEmpty(recipeIdList)) {
|
||||||
|
// return Lists.newArrayList();
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// LocalDate applyDate = LocalDate.parse(content.getDate());
|
||||||
|
// LocalDate now = LocalDate.now();
|
||||||
|
//
|
||||||
|
// if (applyDate.isBefore(now)) {
|
||||||
|
// System.out.println("applyDate 早于当前日期");
|
||||||
|
// //获取当前菜谱绑定的日期
|
||||||
|
// String bindTime = this.cookRecipeH5Mapper.getBingTimeByRecipeId(content.getRecipeId());
|
||||||
|
// if(bindTime !=null){
|
||||||
|
// bindTime = bindTime.substring(0,10);
|
||||||
|
// LocalDate bindDate = LocalDate.parse(bindTime);
|
||||||
|
// System.out.println("Parsed date and time: " + bindDate);
|
||||||
|
// if(bindDate.isBefore(applyDate)){
|
||||||
|
// System.out.println("绑定日期早于查询历史信息日期");
|
||||||
|
// recipeIdList = this.cookRecipeH5Mapper.selectWeekRecipeId(content.getRecipeId());
|
||||||
|
// }else{
|
||||||
|
// System.out.println("绑定日期迟于查询历史信息日期");
|
||||||
|
// List<Long> repeIdList = this.cookRecipeH5Mapper.getRecipeIdListByRecipeId(content.getRecipeId());
|
||||||
|
// recipeIdList = this.cookRecipeH5Mapper.selectWeekRecipeIdHistory(repeIdList, null,applyDate);
|
||||||
|
// if(recipeIdList == null || recipeIdList.size() == 0){
|
||||||
|
// ((List) recipeIdList).add(content.getRecipeId());
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } else if (applyDate.isAfter(now)) {
|
||||||
|
// System.out.println("applyDate 晚于当前日期");
|
||||||
|
// recipeIdList = this.cookRecipeH5Mapper.selectWeekRecipeId(content.getRecipeId());
|
||||||
|
// } else {
|
||||||
|
// System.out.println("applyDate 等于当前日期");
|
||||||
|
// recipeIdList = this.cookRecipeH5Mapper.selectWeekRecipeId(content.getRecipeId());
|
||||||
|
// }
|
||||||
|
// if(recipeIdList == null || recipeIdList.size() == 0){
|
||||||
|
// throw new ServiceException("本档口没有更早的历史菜谱记录");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// this.generateRecipe((List) recipeIdList, content.getApplyDate());
|
||||||
|
// List<AppletWeekRecipeVO> resultList = cookRecipeH5Mapper.selectWeekRecipe(content.getApplyDate(), content.getRecipeId(), (List) recipeIdList);
|
||||||
|
// resultList.sort(Collections.reverseOrder((s1, s2) -> {
|
||||||
|
// return s2.getMealtimeType() - s1.getMealtimeType();
|
||||||
|
// }));
|
||||||
|
// return resultList;
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.bonus.canteen.core.cook.vo;
|
||||||
|
|
||||||
|
import com.bonus.canteen.core.common.utils.FileUrlUtil;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApiModel("菜品详情")
|
||||||
|
public class AppletWeekRecipeDishesVO {
|
||||||
|
@ApiModelProperty("菜品id")
|
||||||
|
private Long baseDishesId;
|
||||||
|
@ApiModelProperty("菜品名称")
|
||||||
|
private String dishesName;
|
||||||
|
@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 List<AppletCurrentDishesDetailVO> dishesDetailList;
|
||||||
|
|
||||||
|
public String getDishesImgUrl() {
|
||||||
|
return FileUrlUtil.getFileUrl(dishesImgUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getBaseDishesId() {
|
||||||
|
return this.baseDishesId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDishesName() {
|
||||||
|
return this.dishesName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getDetailId() {
|
||||||
|
return this.detailId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCanteenId() {
|
||||||
|
return this.canteenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCanteenName() {
|
||||||
|
return this.canteenName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getStallId() {
|
||||||
|
return this.stallId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStallName() {
|
||||||
|
return this.stallName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AppletCurrentDishesDetailVO> getDishesDetailList() {
|
||||||
|
return this.dishesDetailList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBaseDishesId(final Long baseDishesId) {
|
||||||
|
this.baseDishesId = baseDishesId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDishesName(final String dishesName) {
|
||||||
|
this.dishesName = dishesName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDishesImgUrl(final String dishesImgUrl) {
|
||||||
|
this.dishesImgUrl = dishesImgUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDetailId(final Long detailId) {
|
||||||
|
this.detailId = detailId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCanteenId(final Long canteenId) {
|
||||||
|
this.canteenId = canteenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCanteenName(final String canteenName) {
|
||||||
|
this.canteenName = canteenName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStallId(final Long stallId) {
|
||||||
|
this.stallId = stallId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStallName(final String stallName) {
|
||||||
|
this.stallName = stallName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDishesDetailList(final List<AppletCurrentDishesDetailVO> dishesDetailList) {
|
||||||
|
this.dishesDetailList = dishesDetailList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.bonus.canteen.core.cook.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApiModel("分类详情")
|
||||||
|
public class AppletWeekRecipeTypeVO {
|
||||||
|
@ApiModelProperty("菜品类别id")
|
||||||
|
private Long typeId;
|
||||||
|
@ApiModelProperty("菜品类别名称")
|
||||||
|
private String typeName;
|
||||||
|
@ApiModelProperty("菜品详情")
|
||||||
|
private List<AppletWeekRecipeDishesVO> dishesList;
|
||||||
|
|
||||||
|
public Long getTypeId() {
|
||||||
|
return this.typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTypeName() {
|
||||||
|
return this.typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AppletWeekRecipeDishesVO> getDishesList() {
|
||||||
|
return this.dishesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeId(final Long typeId) {
|
||||||
|
this.typeId = typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeName(final String typeName) {
|
||||||
|
this.typeName = typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDishesList(final List<AppletWeekRecipeDishesVO> dishesList) {
|
||||||
|
this.dishesList = dishesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.bonus.canteen.core.cook.vo;
|
||||||
|
|
||||||
|
import com.bonus.canteen.core.cook.enums.BasicMealtimeTypeEnum;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApiModel("获取一周菜谱详情")
|
||||||
|
public class AppletWeekRecipeVO {
|
||||||
|
@ApiModelProperty("餐次类型")
|
||||||
|
private Integer mealtimeType;
|
||||||
|
@ApiModelProperty("餐次名称")
|
||||||
|
private String mealtimeName;
|
||||||
|
@ApiModelProperty("分类详情")
|
||||||
|
private List<AppletWeekRecipeTypeVO> typeList;
|
||||||
|
|
||||||
|
public String getMealtimeName() {
|
||||||
|
return BasicMealtimeTypeEnum.getDescByKey(this.mealtimeType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getMealtimeType() {
|
||||||
|
return this.mealtimeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AppletWeekRecipeTypeVO> getTypeList() {
|
||||||
|
return this.typeList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMealtimeType(final Integer mealtimeType) {
|
||||||
|
this.mealtimeType = mealtimeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMealtimeName(final String mealtimeName) {
|
||||||
|
this.mealtimeName = mealtimeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTypeList(final List<AppletWeekRecipeTypeVO> typeList) {
|
||||||
|
this.typeList = typeList;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue