Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3ae6e86cc7
|
|
@ -8,6 +8,7 @@ import com.bonus.canteen.core.cook.dto.CookRecipeBindDTO;
|
|||
import com.bonus.canteen.core.cook.dto.CookRecipeDTO;
|
||||
import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO;
|
||||
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
|
||||
import com.bonus.canteen.core.cook.vo.CookRecipeVO;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
//import com.bonus.canteen.core.cook.common.annotation.PreventRepeatSubmit;
|
||||
import io.swagger.annotations.Api;
|
||||
|
|
@ -43,6 +44,15 @@ public class CookRecipeController extends BaseController {
|
|||
@Autowired
|
||||
private ICookRecipeService cookRecipeService;
|
||||
|
||||
@ApiOperation(value = "当前菜谱")
|
||||
//@RequiresPermissions("menu:recipe:list")
|
||||
@GetMapping("/currentList")
|
||||
public TableDataInfo currentList(CookRecipeDTO content) {
|
||||
startPage();
|
||||
List<CookRecipeVO> list = cookRecipeService.selectCookRecipeListV2(content);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜品计划信息列表
|
||||
*/
|
||||
|
|
@ -94,6 +104,13 @@ public class CookRecipeController extends BaseController {
|
|||
return success(list);
|
||||
}
|
||||
|
||||
@PostMapping({"/template/detail"})
|
||||
@ApiOperation("获取循环菜谱计划-菜谱详情")
|
||||
public AjaxResult getTemplateRecipeDetail(@RequestBody CookRecipeDetailDTO dto) {
|
||||
List<CookRecipeDetailVO> list = cookRecipeService.selectTemplateDetailList(dto);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜品计划信息
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -40,5 +40,6 @@ public class CookRecipeBindApp extends BaseEntity {
|
|||
@Excel(name = "绑定时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date bindTime;
|
||||
|
||||
private Long mealLineId;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,5 +67,15 @@ public class CookRecipeDTO extends BaseEntity {
|
|||
*/
|
||||
private String delFlag;
|
||||
|
||||
private Long areaId;
|
||||
|
||||
private Integer key;
|
||||
|
||||
@ApiModelProperty("菜谱绑定类型")
|
||||
private Integer bindType;
|
||||
|
||||
@ApiModelProperty("设备类型")
|
||||
private List<Integer> deviceTypeList;
|
||||
|
||||
private List<CookRecipeDateDTO> recipeDateList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,14 @@ package com.bonus.canteen.core.cook.mapper;
|
|||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
import com.bonus.canteen.core.cook.domain.CookAppRecipe;
|
||||
import com.bonus.canteen.core.cook.domain.CookRecipe;
|
||||
import com.bonus.canteen.core.cook.dto.CookRecipeDTO;
|
||||
import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO;
|
||||
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
|
||||
import com.bonus.canteen.core.cook.vo.CookRecipeVO;
|
||||
import com.bonus.canteen.core.cook.vo.StallAndRecipeBindVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
|
|
@ -41,6 +45,8 @@ public interface CookRecipeMapper {
|
|||
|
||||
List<CookRecipeDetailVO> getRecipeDetail(@Param("params") CookRecipeDetailDTO dto);
|
||||
|
||||
List<CookRecipeDetailVO> selectTemplateDetailList(@Param("params") CookRecipeDetailDTO dto);
|
||||
|
||||
/**
|
||||
* 新增菜品计划信息
|
||||
*
|
||||
|
|
@ -57,6 +63,20 @@ public interface CookRecipeMapper {
|
|||
*/
|
||||
public int updateCookRecipe(CookRecipeDTO cookRecipeDTO);
|
||||
|
||||
List<Integer> getDeviceIdByDevivce(@Param("canteenId")String canteenId, @Param("stallId")String stallId);
|
||||
|
||||
List<String> getDeviceSnByIds(@Param("list") List<Integer> deviceInfoList);
|
||||
|
||||
boolean checkIfAlreadyBind(CookAppRecipe appRecipe);
|
||||
|
||||
List<Long> selectRecipeInSameShop(@Param("stallId") Long stallId, @Param("bindType") Integer bindType, @Param("mealLineId") Long mealLineId);
|
||||
|
||||
void deleteBind(CookAppRecipe appRecipe);
|
||||
|
||||
int insertBind(CookAppRecipe appRecipe);
|
||||
|
||||
void updateRecipeByCanteenStallMeal(@Param("recipeId")String recipeId, @Param("canteenId")String canteenId, @Param("stallId")String stallId, @Param("deviceIds")List<Integer> deviceIds);
|
||||
|
||||
/**
|
||||
* 删除菜品计划信息
|
||||
*
|
||||
|
|
@ -72,4 +92,8 @@ public interface CookRecipeMapper {
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteCookRecipeByRecipeIds(Long[] recipeIds);
|
||||
|
||||
public List<CookRecipeVO> selectCookRecipeListV2(CookRecipeDTO content);
|
||||
|
||||
List<StallAndRecipeBindVO> selectRecipeByStallIdsAndBindType(@Param("stallIds") List<Long> stallIds, @Param("bindType") Integer bindType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.bonus.canteen.core.cook.dto.CookRecipeBindDTO;
|
|||
import com.bonus.canteen.core.cook.dto.CookRecipeDTO;
|
||||
import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO;
|
||||
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
|
||||
import com.bonus.canteen.core.cook.vo.CookRecipeVO;
|
||||
|
||||
/**
|
||||
* 菜品计划信息Service接口
|
||||
|
|
@ -22,6 +23,8 @@ public interface ICookRecipeService {
|
|||
*/
|
||||
public CookRecipe selectCookRecipeByRecipeId(Long recipeId);
|
||||
|
||||
public List<CookRecipeVO> selectCookRecipeListV2(CookRecipeDTO dto);
|
||||
|
||||
/**
|
||||
* 查询菜品计划信息列表
|
||||
*
|
||||
|
|
@ -34,6 +37,8 @@ public interface ICookRecipeService {
|
|||
|
||||
public List<CookRecipeDetailVO> getRecipeDetail(CookRecipeDetailDTO dto);
|
||||
|
||||
public List<CookRecipeDetailVO> selectTemplateDetailList(CookRecipeDetailDTO dto);
|
||||
|
||||
/**
|
||||
* 新增菜品计划信息
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ package com.bonus.canteen.core.cook.service.impl;
|
|||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.bonus.canteen.core.common.utils.MqUtil;
|
||||
import com.bonus.canteen.core.cook.domain.CookAppRecipe;
|
||||
import com.bonus.canteen.core.cook.domain.CookRecipeDetail;
|
||||
|
|
@ -17,12 +19,13 @@ import com.bonus.canteen.core.cook.enums.RecipeDetailTypeEnum;
|
|||
import com.bonus.canteen.core.cook.enums.RecipeTypeEnum;
|
||||
import com.bonus.canteen.core.cook.mapper.CookRecipeDetailMapper;
|
||||
import com.bonus.canteen.core.cook.mapper.CookRecipeDishesMapper;
|
||||
import com.bonus.canteen.core.cook.vo.CookRecipeDetailVO;
|
||||
import com.bonus.canteen.core.cook.vo.*;
|
||||
import com.bonus.canteen.core.user.domain.DeviceMqPersonalUpdateMessageDTO;
|
||||
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.mq.constant.LeMqConstant;
|
||||
import com.bonus.common.houqin.utils.LeBeanUtil;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -65,6 +68,61 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
return cookRecipeMapper.selectCookRecipeByRecipeId(recipeId);
|
||||
}
|
||||
|
||||
public List<CookRecipeVO> selectCookRecipeListV2(CookRecipeDTO content) {
|
||||
Map<Integer, CookRecipeSortEnum> bindTypeMap = CookRecipeSortEnum.getKeyMap();
|
||||
CookRecipeSortEnum sortEnum = bindTypeMap.get(content.getKey());
|
||||
List<CookRecipeVO> records = new ArrayList<>();
|
||||
if (ObjectUtil.isEmpty(sortEnum)) {
|
||||
throw new ServiceException("参数错误");
|
||||
}else{
|
||||
content.setDeviceTypeList(sortEnum.getDeviceType());
|
||||
content.setBindType(sortEnum.getBindType());
|
||||
content.setRecipeName(LeBeanUtil.fieldLikeHandle(content.getRecipeName()));
|
||||
records = cookRecipeMapper.selectCookRecipeListV2(content);
|
||||
if (ObjectUtil.isNotEmpty(records)) {
|
||||
List<Long> recipeIds;
|
||||
Map<Long ,Long> maping;
|
||||
List<Long> menuRecipeDateVOS;
|
||||
menuRecipeDateVOS = records.stream().map(CookRecipeVO::getStallId).collect(Collectors.toList());
|
||||
List<StallAndRecipeBindVO> stallAndRecipeBindDtos = this.cookRecipeMapper.selectRecipeByStallIdsAndBindType(menuRecipeDateVOS, content.getBindType());
|
||||
maping = stallAndRecipeBindDtos.stream().collect(Collectors.toMap(StallAndRecipeBindVO::getStallId, StallAndRecipeBindVO::getRecipeId));
|
||||
recipeIds = stallAndRecipeBindDtos.stream().map(StallAndRecipeBindVO::getRecipeId).distinct().collect(Collectors.toList());
|
||||
|
||||
// this.generateRecipe(recipeIds, content.getApplyDate());
|
||||
// List<CookRecipeDateVO> menuRecipeDateVOS1 = this.cookRecipeMapper.selectTmpBetweenDateDetailList(recipeIds, content.getApplyDate(), content.getApplyDate());
|
||||
// Map<Long, CookRecipe> recipeMap = (recipeIds == null || recipeIds.isEmpty())
|
||||
// ? new HashMap<>()
|
||||
// : this.list(Wrappers.lambdaQuery(CookRecipe.class)
|
||||
// .in(CookRecipe::getRecipeId, recipeIds))
|
||||
// .stream()
|
||||
// .collect(Collectors.toMap(CookRecipe::getRecipeId, Function.identity()));
|
||||
// Map<Long, CookRecipeDateVO> detailMap = menuRecipeDateVOS1.stream().collect(Collectors.toMap(CookRecipeDateVO::getRecipeId, Function.identity(), (t1, t2) -> {
|
||||
// return t1;
|
||||
// }));
|
||||
// System.err.println("records = " + records.size());
|
||||
// CookRecipeVO item;
|
||||
// long count;
|
||||
// for(Iterator<CookRecipeVO> var12 = records.iterator(); var12.hasNext(); item.setDishesCount(count)) {
|
||||
// item = var12.next();
|
||||
// Long recipeId;
|
||||
// recipeId = maping.get(item.getStallId());
|
||||
// item.setRecipeId(recipeId);
|
||||
// item.setDetail(detailMap.get(recipeId));
|
||||
// item.setRecipeName(Optional.ofNullable(recipeMap.get(recipeId)).map(CookRecipe::getRecipeName).orElse(null));
|
||||
// count = 0L;
|
||||
// if (ObjectUtil.isNotEmpty(item.getDetail()) && ObjectUtil.isNotEmpty(item.getDetail().getDetails())) {
|
||||
// count = item.getDetail().getDetails().stream().filter((x) -> {
|
||||
// return ObjectUtil.isNotEmpty(x.getDishesList());
|
||||
// }).flatMap((x) -> {
|
||||
// return x.getDishesList().stream();
|
||||
// }).map(CookRecipeDishesVO::getDishesId).distinct().count();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
return records;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询菜品计划信息列表
|
||||
*
|
||||
|
|
@ -95,6 +153,11 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
return cookRecipeMapper.getRecipeDetail(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CookRecipeDetailVO> selectTemplateDetailList(CookRecipeDetailDTO dto) {
|
||||
return cookRecipeMapper.selectTemplateDetailList(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜品计划信息
|
||||
*
|
||||
|
|
@ -250,65 +313,68 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
|||
}
|
||||
|
||||
public void bindCookRecipe(CookRecipeBindDTO cookRecipeDTO) {
|
||||
// CookRecipe menuRecipe = this.cookRecipeMapper.selectCookRecipeByRecipeId(cookRecipeDTO.getRecipeId());
|
||||
// List<Integer> deviceInfoList = new ArrayList<>();
|
||||
// if(cookRecipeDTO.getStallId() !=null){
|
||||
// deviceInfoList = this.cookRecipeMapper.getDeviceIdByDevivce(null, String.valueOf(cookRecipeDTO.getStallId()));
|
||||
// if(deviceInfoList == null || deviceInfoList.isEmpty() || deviceInfoList.size() == 0){
|
||||
// throw new ServiceException("该食堂档口下没有设备信息");
|
||||
// }
|
||||
// }
|
||||
// List<String> deviceSnList = this.cookRecipeMapper.getDeviceSnByIds(deviceInfoList);
|
||||
// CookRecipeSortEnum sortEnum = CookRecipeSortEnum.getBindTypeMap().get(cookRecipeDTO.getBindType());
|
||||
// CookAppRecipe mar = new CookAppRecipe();
|
||||
// mar.setRecipeId(cookRecipeDTO.getRecipeId());
|
||||
// mar.setMealLineId(cookRecipeDTO.getMealLineId());
|
||||
// mar.setBindType(cookRecipeDTO.getBindType());
|
||||
// List<Integer> deviceTypeList = cookRecipeMapper.getDeviceIdByDevivce(null, String.valueOf(menuRecipe.getStallId()));
|
||||
// if (ObjectUtil.isEmpty(sortEnum)) {
|
||||
// throw new ServiceException("bingType值异常");
|
||||
// } else {
|
||||
// List<Integer> deviceTypes = sortEnum.getDeviceType();
|
||||
// if (cookRecipeDTO.getHandleType().equals(1)) {
|
||||
// boolean exists;
|
||||
CookRecipe menuRecipe = this.cookRecipeMapper.selectCookRecipeByRecipeId(cookRecipeDTO.getRecipeId());
|
||||
List<Integer> deviceInfoList = new ArrayList<>();
|
||||
List<String> deviceSnList = new ArrayList<>();
|
||||
if(cookRecipeDTO.getStallId() !=null){
|
||||
deviceInfoList = this.cookRecipeMapper.getDeviceIdByDevivce(null, String.valueOf(cookRecipeDTO.getStallId()));
|
||||
if(deviceInfoList == null || deviceInfoList.isEmpty() || deviceInfoList.size() == 0){
|
||||
throw new ServiceException("该食堂档口下没有设备信息");
|
||||
}
|
||||
deviceSnList = this.cookRecipeMapper.getDeviceSnByIds(deviceInfoList);
|
||||
}
|
||||
CookRecipeSortEnum sortEnum = CookRecipeSortEnum.getBindTypeMap().get(cookRecipeDTO.getBindType());
|
||||
CookAppRecipe mar = new CookAppRecipe();
|
||||
mar.setRecipeId(cookRecipeDTO.getRecipeId());
|
||||
mar.setMealLineId(cookRecipeDTO.getMealLineId());
|
||||
mar.setBindType(cookRecipeDTO.getBindType());
|
||||
List<Integer> deviceTypeList = cookRecipeMapper.getDeviceIdByDevivce(null, String.valueOf(menuRecipe.getStallId()));
|
||||
if (ObjectUtil.isEmpty(sortEnum)) {
|
||||
throw new ServiceException("bingType值异常");
|
||||
} else {
|
||||
List<Integer> deviceTypes = sortEnum.getDeviceType();
|
||||
if (cookRecipeDTO.getHandleType().equals(1)) {
|
||||
boolean exists;
|
||||
// if (CookBindTypeEnum.RESERVE.key().equals(cookRecipeDTO.getBindType())) {
|
||||
// exists = this.checkCanteenIfReserve(menuRecipe.getCanteenId(), menuRecipe.getStallId());
|
||||
// if (!exists) {
|
||||
// throw new ServiceException("不支持预订餐");
|
||||
// }
|
||||
// }
|
||||
// exists = this.cookRecipeMapper.exists(mar);
|
||||
// if (exists) {
|
||||
// throw new ServiceException("菜谱已被使用,请勿重复绑定");
|
||||
// }
|
||||
// List<Long> sourceRecipeList = this.cookRecipeMapper.selectRecipeInSameShop(menuRecipe.getStallId(), null, cookRecipeDTO.getBindType(), content.getMealLineId());
|
||||
// if (ObjectUtil.isNotEmpty(sourceRecipeList)) {
|
||||
// mar.setRecipeIds(sourceRecipeList);
|
||||
// this.cookRecipeMapper.delete(mar);
|
||||
// }
|
||||
// CookAppRecipe appRecipe = new CookAppRecipe();
|
||||
// appRecipe.setRecipeId(cookRecipeDTO.getRecipeId());
|
||||
// appRecipe.setBindType(cookRecipeDTO.getBindType());
|
||||
// appRecipe.setMealLineId(cookRecipeDTO.getMealLineId());
|
||||
// appRecipe.setBindTime(LocalDateTime.now());
|
||||
// this.cookRecipeMapper.insert(appRecipe);
|
||||
// if (ObjectUtil.isNotEmpty(deviceTypes) && deviceTypeList!= null && !deviceTypeList.isEmpty()) {
|
||||
// this.cookRecipeMapper.updateRecipeByCanteeStallMeal(String.valueOf(cookRecipeDTO.getRecipeId()), String.valueOf(menuRecipe.getCanteenId()), String.valueOf(menuRecipe.getStallId()),deviceTypeList);
|
||||
// }
|
||||
// MqUtil.sendDataChange(menuRecipe, LeMqConstant.DataChangeType.ADD, LeMqConstant.Topic.DATA_CHANGE_RECIPE_RELEASE);
|
||||
// } else {
|
||||
// mar.setRecipeIds(Collections.singletonList(mar.getRecipeId()));
|
||||
// this.cookRecipeMapper.delete(mar);
|
||||
// if (ObjectUtil.isNotEmpty(deviceTypes) && deviceTypeList!= null && !deviceTypeList.isEmpty()) {
|
||||
// this.cookRecipeMapper.updateRecipeByCanteeStallMeal("-1", String.valueOf(menuRecipe.getCanteenId()), String.valueOf(menuRecipe.getStallId()), deviceTypeList);
|
||||
// }
|
||||
// }
|
||||
// //发送mq
|
||||
// for (String deviceSn : deviceSnList){
|
||||
// DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(0,cookRecipeDTO.getHandleType().equals(1) ? "update" : "del");
|
||||
// MqUtil.pushToSingleDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, deviceSn);
|
||||
// }
|
||||
// }
|
||||
exists = this.cookRecipeMapper.checkIfAlreadyBind(mar);
|
||||
if (exists) {
|
||||
throw new ServiceException("菜谱已被使用,请勿重复绑定");
|
||||
}
|
||||
List<Long> sourceRecipeList = this.cookRecipeMapper.selectRecipeInSameShop(menuRecipe.getStallId(), cookRecipeDTO.getBindType(), cookRecipeDTO.getMealLineId());
|
||||
if (ObjectUtil.isNotEmpty(sourceRecipeList)) {
|
||||
mar.setRecipeIds(sourceRecipeList);
|
||||
this.cookRecipeMapper.deleteBind(mar);
|
||||
}
|
||||
CookAppRecipe appRecipe = new CookAppRecipe();
|
||||
appRecipe.setRecipeId(cookRecipeDTO.getRecipeId());
|
||||
appRecipe.setBindType(cookRecipeDTO.getBindType());
|
||||
appRecipe.setMealLineId(cookRecipeDTO.getMealLineId());
|
||||
appRecipe.setBindTime(LocalDateTime.now());
|
||||
this.cookRecipeMapper.insertBind(appRecipe);
|
||||
if (ObjectUtil.isNotEmpty(deviceTypes) && deviceTypeList!= null && !deviceTypeList.isEmpty()) {
|
||||
this.cookRecipeMapper.updateRecipeByCanteenStallMeal(String.valueOf(cookRecipeDTO.getRecipeId()), String.valueOf(menuRecipe.getCanteenId()), String.valueOf(menuRecipe.getStallId()),deviceTypeList);
|
||||
}
|
||||
MqUtil.sendDataChange(menuRecipe, LeMqConstant.DataChangeType.ADD, LeMqConstant.Topic.DATA_CHANGE_RECIPE_RELEASE);
|
||||
} else {
|
||||
mar.setRecipeIds(Collections.singletonList(mar.getRecipeId()));
|
||||
this.cookRecipeMapper.deleteBind(mar);
|
||||
if (ObjectUtil.isNotEmpty(deviceTypes) && deviceTypeList!= null && !deviceTypeList.isEmpty()) {
|
||||
this.cookRecipeMapper.updateRecipeByCanteenStallMeal("-1", String.valueOf(menuRecipe.getCanteenId()), String.valueOf(menuRecipe.getStallId()), deviceTypeList);
|
||||
}
|
||||
}
|
||||
//发送mq
|
||||
if (!CollectionUtils.isEmpty(deviceSnList)) {
|
||||
for (String deviceSn : deviceSnList) {
|
||||
DeviceMqPersonalUpdateMessageDTO bean = new DeviceMqPersonalUpdateMessageDTO().setUpdatePerson(0, cookRecipeDTO.getHandleType().equals(1) ? "update" : "del");
|
||||
MqUtil.pushToSingleDevice(bean, LeMqConstant.Topic.DEVICE_UPDATE_MENU_CONFIG_V4, deviceSn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,50 @@
|
|||
package com.bonus.canteen.core.cook.vo;
|
||||
|
||||
import com.bonus.canteen.core.cook.dto.CookRecipeDetailDTO;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜品计划详情信息对象 cook_recipe_detail
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2025-05-25
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class CookRecipeDateVO extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty("日期")
|
||||
private LocalDate day;
|
||||
|
||||
@ApiModelProperty("菜谱ID")
|
||||
private Long recipeId;
|
||||
|
||||
/** 启用时间(天) */
|
||||
@ApiModelProperty(value = "启用时间(天)")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "启用时间(天)", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private LocalDate applyDate;
|
||||
|
||||
/** 启用时间(周) */
|
||||
@Excel(name = "启用时间(周)")
|
||||
@ApiModelProperty(value = "启用时间(周)")
|
||||
private Long applyWeek;
|
||||
|
||||
/** 启用时间(月) */
|
||||
@Excel(name = "启用时间(月)")
|
||||
@ApiModelProperty(value = "启用时间(月)")
|
||||
private Long applyMonth;
|
||||
|
||||
List<CookRecipeDetailVO> detailList;
|
||||
}
|
||||
|
|
@ -63,5 +63,7 @@ public class CookRecipeDetailVO extends BaseEntity {
|
|||
@ApiModelProperty(value = "详情类型(1-模板,2-详情)")
|
||||
private Long detailType;
|
||||
|
||||
private String dishesName;
|
||||
|
||||
private List<CookRecipeDishesVO> dishesList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,81 @@
|
|||
package com.bonus.canteen.core.cook.vo;
|
||||
|
||||
import com.bonus.canteen.core.cook.dto.CookRecipeDateDTO;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜品计划信息对象 cook_recipe
|
||||
*
|
||||
* @author xsheng
|
||||
* @date 2025-05-25
|
||||
*/
|
||||
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
public class CookRecipeVO extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 菜谱id */
|
||||
private Long recipeId;
|
||||
|
||||
/** 菜谱名称 */
|
||||
@Excel(name = "菜谱名称")
|
||||
@ApiModelProperty(value = "菜谱名称")
|
||||
private String recipeName;
|
||||
|
||||
/** 菜谱类型(1默认,2按天,3按周,4按月) */
|
||||
@Excel(name = "菜谱类型(1默认,2按天,3按周,4按月)")
|
||||
@ApiModelProperty(value = "菜谱类型(1默认,2按天,3按周,4按月)")
|
||||
private Long recipeType;
|
||||
|
||||
/** 档口id */
|
||||
@Excel(name = "档口id")
|
||||
@ApiModelProperty(value = "档口id")
|
||||
private Long stallId;
|
||||
|
||||
private String stallName;
|
||||
|
||||
/** 食堂id */
|
||||
@Excel(name = "食堂id")
|
||||
@ApiModelProperty(value = "食堂id")
|
||||
private Long canteenId;
|
||||
|
||||
private String canteenName;
|
||||
|
||||
private Long areaId;
|
||||
|
||||
private String areaName;
|
||||
|
||||
/** 菜品计划id(数据同步) */
|
||||
@Excel(name = "菜品计划id(数据同步)")
|
||||
@ApiModelProperty(value = "菜品计划id(数据同步)")
|
||||
private String planId;
|
||||
|
||||
/** 生效时间 */
|
||||
@ApiModelProperty(value = "生效时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "生效时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date effectDate;
|
||||
|
||||
/** 到期时间 */
|
||||
@ApiModelProperty(value = "到期时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "到期时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date expireDate;
|
||||
|
||||
/**
|
||||
* 删除标志(0代表存在 2代表删除)
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
private List<CookRecipeDateVO> recipeDateList;
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package com.bonus.canteen.core.cook.vo;
|
||||
|
||||
public class StallAndRecipeBindVO {
|
||||
private Long stallId;
|
||||
private Long recipeId;
|
||||
private Integer bindType;
|
||||
|
||||
public Long getStallId() {
|
||||
return this.stallId;
|
||||
}
|
||||
|
||||
public Long getRecipeId() {
|
||||
return this.recipeId;
|
||||
}
|
||||
|
||||
public Integer getBindType() {
|
||||
return this.bindType;
|
||||
}
|
||||
|
||||
public void setStallId(final Long stallId) {
|
||||
this.stallId = stallId;
|
||||
}
|
||||
|
||||
public void setRecipeId(final Long recipeId) {
|
||||
this.recipeId = recipeId;
|
||||
}
|
||||
|
||||
public void setBindType(final Integer bindType) {
|
||||
this.bindType = bindType;
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="recipeId" column="recipe_id" />
|
||||
<result property="bindType" column="bind_type" />
|
||||
<result property="bindTime" column="bind_time" />
|
||||
<result property="mealLineId" column="meal_line_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
|
|
@ -15,7 +16,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectCookRecipeBindAppVo">
|
||||
select id, recipe_id, bind_type, bind_time, create_by, create_time, update_by, update_time from cook_recipe_bind_app
|
||||
select id, recipe_id, bind_type, bind_time, meal_line_id,
|
||||
create_by, create_time, update_by, update_time
|
||||
from cook_recipe_bind_app
|
||||
</sql>
|
||||
|
||||
<select id="selectCookRecipeBindAppList" parameterType="com.bonus.canteen.core.cook.domain.CookRecipeBindApp" resultMap="CookRecipeBindAppResult">
|
||||
|
|
@ -24,6 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="recipeId != null "> and recipe_id = #{recipeId}</if>
|
||||
<if test="bindType != null "> and bind_type = #{bindType}</if>
|
||||
<if test="bindTime != null "> and bind_time = #{bindTime}</if>
|
||||
<if test="mealLineId != null "> and meal_line_id = #{mealLineId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
|
@ -38,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="recipeId != null">recipe_id,</if>
|
||||
<if test="bindType != null">bind_type,</if>
|
||||
<if test="bindTime != null">bind_time,</if>
|
||||
<if test="mealLineId != null">meal_line_id,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
|
|
@ -47,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="recipeId != null">#{recipeId},</if>
|
||||
<if test="bindType != null">#{bindType},</if>
|
||||
<if test="bindTime != null">#{bindTime},</if>
|
||||
<if test="mealLineId != null">#{mealLineId},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
|
|
@ -60,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="recipeId != null">recipe_id = #{recipeId},</if>
|
||||
<if test="bindType != null">bind_type = #{bindType},</if>
|
||||
<if test="bindTime != null">bind_time = #{bindTime},</if>
|
||||
<if test="mealLineId != null">meal_line_id = #{mealLineId},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
|
|
|
|||
|
|
@ -128,6 +128,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and mrd.detail_type = 1
|
||||
order by mrdd.dishes_id
|
||||
</select>
|
||||
|
||||
<select id="selectTemplateDetailList" resultType="com.bonus.canteen.core.cook.vo.CookRecipeDetailVO">
|
||||
select mrd.mealtime_type,
|
||||
mrd.recipe_detail_id,
|
||||
mdb.base_dishes_id as dishes_id,
|
||||
mdb.dishes_name,
|
||||
mrdd.id,
|
||||
mrdd.price,
|
||||
mrdd.size_type,
|
||||
mrdd.supply_num,
|
||||
mrdd.sale_num,
|
||||
mrdd.remanent_num,
|
||||
mrdd.limit_num,
|
||||
mrdd.sale_price,
|
||||
mrdd.recommend_flag,
|
||||
ac.canteen_name,
|
||||
md.sales_mode,
|
||||
md.unit_price,
|
||||
md.meal_type,
|
||||
md.type_id,
|
||||
mdt.dishes_type_name,
|
||||
md.material_cost
|
||||
from cook_recipe_detail mrd
|
||||
left join cook_recipe_dishes mrdd on mrd.recipe_detail_id = mrdd.recipe_detail_id
|
||||
left join cook_dishes md on mrdd.dishes_id = md.dishes_id
|
||||
left join basic_canteen ac on md.canteen_id = ac.canteen_id
|
||||
left join cook_dishes_base mdb on md.base_dishes_id = mdb.base_dishes_id
|
||||
left join cook_dishes_type mdt on md.type_id = mdt.dishes_type_id
|
||||
where mrd.recipe_id = #{params.recipeId}
|
||||
<if test="params.applyWeek !=null ">
|
||||
and mrd.apply_week = #{params.applyWeek}
|
||||
</if>
|
||||
and mrd.detail_type = 1
|
||||
order by mrdd.dishes_id
|
||||
</select>
|
||||
|
||||
<select id="selectCookRecipeByRecipeId" parameterType="Long" resultMap="CookRecipeResult">
|
||||
<include refid="selectCookRecipeVo"/>
|
||||
|
|
@ -188,6 +223,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where recipe_id = #{recipeId}
|
||||
</update>
|
||||
|
||||
<select id="getDeviceIdByDevivce" parameterType="string" resultType="integer">
|
||||
select a.device_id
|
||||
from device_info a
|
||||
LEFT JOIN cook_recipe_bind_device b on a.device_id = b.device_id
|
||||
where b.stall_id = #{stallId}
|
||||
</select>
|
||||
|
||||
<select id="getDeviceSnByIds" resultType="java.lang.String">
|
||||
select device_sn
|
||||
from device_info
|
||||
where device_id in
|
||||
<foreach collection="list" item="deviceId" separator="," open="(" close=")">
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="checkIfAlreadyBind" resultType="boolean">
|
||||
select count(1) > 0 from cook_recipe_bind_app
|
||||
where recipe_id = #{recipeId}
|
||||
<if test="mealLineId !=null">
|
||||
and meal_line_id = #{mealLineId}
|
||||
</if>
|
||||
and bind_type = #{bindType}
|
||||
</select>
|
||||
|
||||
<select id="selectRecipeInSameShop" resultType="java.lang.Long">
|
||||
select mar.recipe_id
|
||||
from cook_recipe_bind_app mar
|
||||
inner join cook_recipe mr on mar.recipe_id = mr.recipe_id
|
||||
where mar.bind_type = #{bindType}
|
||||
and mr.stall_id = #{stallId}
|
||||
<if test="mealLineId !=null">
|
||||
and mar.meal_line_id= #{mealLineId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="deleteBind" parameterType="com.bonus.canteen.core.cook.domain.CookAppRecipe">
|
||||
delete from cook_recipe_bind_app where recipe_id in
|
||||
<foreach collection="recipeIds" item="recipeId" separator="," open="(" close=")">
|
||||
#{recipeId}
|
||||
</foreach>
|
||||
<if test="mealLineId != null">
|
||||
and meal_line_id = #{mealLineId}
|
||||
</if>
|
||||
and bind_type = #{bindType}
|
||||
</delete>
|
||||
|
||||
<insert id="insertBind" parameterType="com.bonus.canteen.core.cook.domain.CookAppRecipe">
|
||||
insert into cook_recipe_bind_app (recipe_id,bind_type,bind_time,meal_line_id)
|
||||
values (#{recipeId},#{bindType},now(),#{mealLineId})
|
||||
</insert>
|
||||
|
||||
<update id="updateRecipeByCanteenStallMeal">
|
||||
update cook_recipe_bind_device set recipe_id = #{ recipeId}
|
||||
where canteen_id = #{canteenId} and stall_id = #{stallId}
|
||||
and device_id in
|
||||
<foreach collection="deviceIds" separator="," open="(" close=")" item="item">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<delete id="deleteCookRecipeByRecipeId" parameterType="Long">
|
||||
update cook_recipe set del_flag = '2' where recipe_id = #{recipeId}
|
||||
</delete>
|
||||
|
|
@ -198,4 +294,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{recipeId}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectCookRecipeListV2" resultType="com.bonus.canteen.core.cook.vo.CookRecipeVO">
|
||||
SELECT
|
||||
t3.area_id, t3.area_name, t2.canteen_id, t2.canteen_name, t1.stall_id, t1.stall_name
|
||||
FROM
|
||||
basic_stall t1
|
||||
LEFT JOIN basic_canteen t2 ON t1.canteen_id = t2.canteen_id
|
||||
LEFT JOIN basic_area t3 ON t2.area_id = t3.area_id
|
||||
where 1=1
|
||||
<if test="recipeName !=null and recipeName !=''">
|
||||
AND EXISTS (
|
||||
select null
|
||||
from cook_recipe_bind_app t4 INNER JOIN cook_recipe t5 on t4.recipe_id = t5.recipe_id
|
||||
where t5.stall_id = t1.stall_id AND t4.bind_type = #{bindType}
|
||||
and t5.recipe_name like #{recipeName}
|
||||
)
|
||||
</if>
|
||||
<if test="deviceTypeList != null and deviceTypeList.size() > 0">
|
||||
AND EXISTS (
|
||||
SELECT NULL
|
||||
FROM
|
||||
cook_recipe_bind_device t6
|
||||
LEFT JOIN device_info t7 ON t7.device_id = t6.device_id
|
||||
WHERE
|
||||
t6.canteen_id = t2.canteen_id
|
||||
AND t6.stall_id = t1.stall_id
|
||||
AND t7.device_type IN
|
||||
<foreach collection="deviceTypeList" item="deviceType" separator="," open="(" close=")">
|
||||
#{deviceType}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="areaId !=null">
|
||||
and t3.area_id = #{areaId}
|
||||
</if>
|
||||
<if test="canteenId !=null">
|
||||
and t2.canteen_id = #{canteenId}
|
||||
</if>
|
||||
<if test="stallId !=null ">
|
||||
and t1.stall_id = #{stallId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectRecipeByStallIdsAndBindType"
|
||||
resultType="com.bonus.canteen.core.cook.vo.StallAndRecipeBindVO">
|
||||
select
|
||||
mar.recipe_id,
|
||||
mr.stall_id,
|
||||
mar.bind_type
|
||||
from cook_recipe_bind_app mar
|
||||
left join cook_recipe mr on mar.recipe_id = mr.recipe_id
|
||||
where bind_type = #{bindType}
|
||||
<if test="stallIds !=null and stallIds.size() > 0 ">
|
||||
and mr.stall_id IN
|
||||
<foreach collection="stallIds" item="stallId" separator="," open="(" close=")">
|
||||
#{stallId}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue