diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeController.java index 2932299..2810f9b 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/controller/CookRecipeController.java @@ -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 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 list = cookRecipeService.selectTemplateDetailList(dto); + return success(list); + } + /** * 新增菜品计划信息 */ diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookRecipeBindApp.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookRecipeBindApp.java index 762658b..da21629 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookRecipeBindApp.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/domain/CookRecipeBindApp.java @@ -40,5 +40,6 @@ public class CookRecipeBindApp extends BaseEntity { @Excel(name = "绑定时间", width = 30, dateFormat = "yyyy-MM-dd") private Date bindTime; + private Long mealLineId; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/dto/CookRecipeDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/dto/CookRecipeDTO.java index 5fc653e..0399753 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/dto/CookRecipeDTO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/dto/CookRecipeDTO.java @@ -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 deviceTypeList; + private List recipeDateList; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java index 47cf687..84a6ff5 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/mapper/CookRecipeMapper.java @@ -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 getRecipeDetail(@Param("params") CookRecipeDetailDTO dto); + List selectTemplateDetailList(@Param("params") CookRecipeDetailDTO dto); + /** * 新增菜品计划信息 * @@ -57,6 +63,20 @@ public interface CookRecipeMapper { */ public int updateCookRecipe(CookRecipeDTO cookRecipeDTO); + List getDeviceIdByDevivce(@Param("canteenId")String canteenId, @Param("stallId")String stallId); + + List getDeviceSnByIds(@Param("list") List deviceInfoList); + + boolean checkIfAlreadyBind(CookAppRecipe appRecipe); + + List 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 deviceIds); + /** * 删除菜品计划信息 * @@ -72,4 +92,8 @@ public interface CookRecipeMapper { * @return 结果 */ public int deleteCookRecipeByRecipeIds(Long[] recipeIds); + + public List selectCookRecipeListV2(CookRecipeDTO content); + + List selectRecipeByStallIdsAndBindType(@Param("stallIds") List stallIds, @Param("bindType") Integer bindType); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeService.java index 3a1ee9e..68c4860 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/ICookRecipeService.java @@ -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 selectCookRecipeListV2(CookRecipeDTO dto); + /** * 查询菜品计划信息列表 * @@ -34,6 +37,8 @@ public interface ICookRecipeService { public List getRecipeDetail(CookRecipeDetailDTO dto); + public List selectTemplateDetailList(CookRecipeDetailDTO dto); + /** * 新增菜品计划信息 * diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java index 60eac2e..b0bd4d6 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/service/impl/CookRecipeServiceImpl.java @@ -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 selectCookRecipeListV2(CookRecipeDTO content) { + Map bindTypeMap = CookRecipeSortEnum.getKeyMap(); + CookRecipeSortEnum sortEnum = bindTypeMap.get(content.getKey()); + List 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 recipeIds; + Map maping; + List menuRecipeDateVOS; + menuRecipeDateVOS = records.stream().map(CookRecipeVO::getStallId).collect(Collectors.toList()); + List 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 menuRecipeDateVOS1 = this.cookRecipeMapper.selectTmpBetweenDateDetailList(recipeIds, content.getApplyDate(), content.getApplyDate()); +// Map 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 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 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 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 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 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 deviceTypeList = cookRecipeMapper.getDeviceIdByDevivce(null, String.valueOf(menuRecipe.getStallId())); -// if (ObjectUtil.isEmpty(sortEnum)) { -// throw new ServiceException("bingType值异常"); -// } else { -// List deviceTypes = sortEnum.getDeviceType(); -// if (cookRecipeDTO.getHandleType().equals(1)) { -// boolean exists; + CookRecipe menuRecipe = this.cookRecipeMapper.selectCookRecipeByRecipeId(cookRecipeDTO.getRecipeId()); + List deviceInfoList = new ArrayList<>(); + List 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 deviceTypeList = cookRecipeMapper.getDeviceIdByDevivce(null, String.valueOf(menuRecipe.getStallId())); + if (ObjectUtil.isEmpty(sortEnum)) { + throw new ServiceException("bingType值异常"); + } else { + List 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 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 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); + } + } + } } /** diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDateVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDateVO.java new file mode 100644 index 0000000..665a532 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDateVO.java @@ -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 detailList; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDetailVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDetailVO.java index aa9aea8..b4e7d1f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDetailVO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeDetailVO.java @@ -63,5 +63,7 @@ public class CookRecipeDetailVO extends BaseEntity { @ApiModelProperty(value = "详情类型(1-模板,2-详情)") private Long detailType; + private String dishesName; + private List dishesList; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeVO.java new file mode 100644 index 0000000..8a9c133 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/CookRecipeVO.java @@ -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 recipeDateList; +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/StallAndRecipeBindVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/StallAndRecipeBindVO.java new file mode 100644 index 0000000..6ca7b3f --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/cook/vo/StallAndRecipeBindVO.java @@ -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; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeBindAppMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeBindAppMapper.xml index 947d362..f3afcbc 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeBindAppMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeBindAppMapper.xml @@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -15,7 +16,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - 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 @@ -38,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" recipe_id, bind_type, bind_time, + meal_line_id, create_by, create_time, update_by, @@ -47,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{recipeId}, #{bindType}, #{bindTime}, + #{mealLineId}, #{createBy}, #{createTime}, #{updateBy}, @@ -60,6 +66,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" recipe_id = #{recipeId}, bind_type = #{bindType}, bind_time = #{bindTime}, + meal_line_id = #{mealLineId}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml index 20f2d21..3348f54 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/cook/CookRecipeMapper.xml @@ -128,6 +128,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and mrd.detail_type = 1 order by mrdd.dishes_id + + + 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} + + + + + + + + + + delete from cook_recipe_bind_app where recipe_id in + + #{recipeId} + + + and meal_line_id = #{mealLineId} + + and bind_type = #{bindType} + + + + insert into cook_recipe_bind_app (recipe_id,bind_type,bind_time,meal_line_id) + values (#{recipeId},#{bindType},now(),#{mealLineId}) + + + + update cook_recipe_bind_device set recipe_id = #{ recipeId} + where canteen_id = #{canteenId} and stall_id = #{stallId} + and device_id in + + #{item} + + + update cook_recipe set del_flag = '2' where recipe_id = #{recipeId} @@ -198,4 +294,63 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{recipeId} + + + + \ No newline at end of file