jsk 添加预定餐时间段
This commit is contained in:
parent
5a67781af5
commit
357cdc204c
|
|
@ -4,10 +4,12 @@ import cn.hutool.core.bean.BeanUtil;
|
|||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bonus.canteen.core.menu.model.AllocMealtimeModel;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.houqin.constant.DelFlagEnum;
|
||||
import com.bonus.canteen.core.allocation.api.AllocCanteenApi;
|
||||
|
|
@ -37,6 +39,7 @@ import com.bonus.canteen.core.order.api.OrderMenuApi;
|
|||
import com.bonus.canteen.core.order.common.vo.OrderGoodsNumVO;
|
||||
import com.bonus.common.houqin.i18n.I18n;
|
||||
import com.bonus.common.houqin.utils.id.Id;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -285,6 +288,33 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
|
|||
if (ObjectUtil.isEmpty(resultList)) {
|
||||
return resultList;
|
||||
} else {
|
||||
for(AppletReserveRecipeVO vo:resultList){
|
||||
List<AppletReserveRecipeTypeVO> typeList=vo.getTypeList();
|
||||
if (ObjectUtil.isNotEmpty(typeList)) {
|
||||
for(AppletReserveRecipeTypeVO vo1:typeList){
|
||||
List<AppletReserveRecipeDishesVO> dishesList=vo1.getDishesList();
|
||||
if (ObjectUtil.isNotEmpty(dishesList)) {
|
||||
for(AppletReserveRecipeDishesVO vo2:dishesList){
|
||||
String mealtime=vo2.getMealTime();
|
||||
if(mealtime!=null&&mealtime.contains("\"endTime\":")){
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
AllocMealtimeModel person =new AllocMealtimeModel();
|
||||
try{
|
||||
person = (AllocMealtimeModel) JSONObject.parseObject(mealtime, AllocMealtimeModel.class);
|
||||
}catch (Exception e){e.printStackTrace();}
|
||||
if(person!=null){
|
||||
vo2.setStartTime(person.getStartTime());
|
||||
}
|
||||
if(person!=null){
|
||||
vo2.setEndTime(person.getEndTime());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
resultList.sort(Collections.reverseOrder((s1, s2) -> {
|
||||
return s2.getMealtimeType() - s1.getMealtimeType();
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModel;
|
|||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("菜品详情")
|
||||
|
|
@ -45,6 +46,12 @@ public class AppletReserveRecipeDishesVO {
|
|||
private List<String> tasteNameList;
|
||||
@ApiModelProperty("预定时间")
|
||||
private String reserveEndTime;
|
||||
@ApiModelProperty("当日预定时间")
|
||||
private String mealTime;
|
||||
@ApiModelProperty("当日预定结束时间")
|
||||
private LocalTime endTime;
|
||||
@ApiModelProperty("当日预定开始时间")
|
||||
private LocalTime startTime;
|
||||
|
||||
public String getDishesImgUrl() {
|
||||
return ObjectUtil.isNotEmpty(this.dishesImgUrl) ? SysUtil.getCutFileUrl(this.dishesImgUrl.split(",")[0]) : this.dishesImgUrl;
|
||||
|
|
@ -181,4 +188,28 @@ public class AppletReserveRecipeDishesVO {
|
|||
public void setReserveEndTime(String reserveEndTime) {
|
||||
this.reserveEndTime = reserveEndTime;
|
||||
}
|
||||
|
||||
public String getMealTime() {
|
||||
return mealTime;
|
||||
}
|
||||
|
||||
public void setMealTime(String mealTime) {
|
||||
this.mealTime = mealTime;
|
||||
}
|
||||
|
||||
public LocalTime getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(LocalTime endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public LocalTime getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(LocalTime startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@
|
|||
<result property="canteenName" column="canteen_name"/>
|
||||
<result property="stallId" column="stall_id"/>
|
||||
<result property="reserveEndTime" column="reserveEndTime"/>
|
||||
<result property="mealTime" column="mealTime"/>
|
||||
<result property="stallName" column="stall_name"/>
|
||||
<result property="recommendFlag" column="recommend_flag"/>
|
||||
<collection property="dishesDetailList" ofType="com.bonus.canteen.core.menu.vo.AppletCurrentDishesDetailVO">
|
||||
|
|
@ -193,7 +194,7 @@
|
|||
md.size_json,
|
||||
mdtt.taste_name,
|
||||
mdsr.monthly_sales,
|
||||
mdsr.good_probability,amd.model_value as reserveEndTime
|
||||
mdsr.good_probability,amd.model_value as reserveEndTime,amd2.model_value as mealTime
|
||||
from
|
||||
menu_recipe_detail mrd
|
||||
inner join menu_recipe_dishes m on mrd.detail_id = m.detail_id
|
||||
|
|
@ -211,6 +212,16 @@
|
|||
left join menu_taste_dishes mtd on md.dishes_id = mtd.dishes_id
|
||||
left join menu_dishes_taste mdtt on mtd.taste_id = mdtt.taste_id
|
||||
left join alloc_metadata amd on mr.canteen_id = amd.canteen_id and mr.stall_id = amd.stall_id and amd.model_key='reserveEndTime'
|
||||
left join (
|
||||
select a.*,case when a.model_key='mealtimeBreakfast' then '1'
|
||||
when a.model_key='mealtimeLunch' then '2'
|
||||
when a.model_key='mealtimeAfternoonTea' then '3'
|
||||
when a.model_key='mealtimeDinner' then '4'
|
||||
when a.model_key='mealtimeMidnightSnack' then '5'
|
||||
else '0' end as model_keyd
|
||||
from alloc_metadata a where a.model_type='mealtime'
|
||||
) amd2
|
||||
on mrd.mealtime_type=amd2.model_keyd and mr.canteen_id = amd2.canteen_id and mr.stall_id = amd2.stall_id
|
||||
where
|
||||
mrd.apply_date = #{applyDate}
|
||||
and mr.recipe_id = #{recipeId}
|
||||
|
|
|
|||
Loading…
Reference in New Issue