From e4473d5c8a1abf99e0d494c9fe8f9d42c2a4ab4d Mon Sep 17 00:00:00 2001 From: liux <963924687@qq.com> Date: Sat, 19 Apr 2025 14:50:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8F=9C=E5=93=81=EF=BC=8C=E8=8F=9C=E8=B0=B1?= =?UTF-8?q?=EF=BC=8C=E6=A1=A3=E5=8F=A3=E7=9B=B8=E5=85=B3=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=8C=E6=8E=A5=E5=8F=A3=E7=BC=96=E5=86=99?= =?UTF-8?q?=EF=BC=8C=E6=9B=B4=E6=96=B0=E6=AD=A4=E7=89=88=E6=9C=AC=20?= =?UTF-8?q?=E6=9C=AC=E5=9C=B0=E6=95=B0=E6=8D=AE=E5=BA=93=E9=9C=80=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E6=B7=BB=E5=8A=A0=E4=BB=A5=E4=B8=8Bsql=E8=AF=AD?= =?UTF-8?q?=E5=8F=A5=EF=BC=9A=20ALTER=20TABLE=20menu=5Fdishes=20ADD=20COLU?= =?UTF-8?q?MN=20label=5Fid=20VARCHAR(32)=20COMMENT=20'=E6=A0=87=E7=AD=BEid?= =?UTF-8?q?'=20=20AFTER=20remark,=20ADD=20COLUMN=20taste=5Fid=20VARCHAR(32?= =?UTF-8?q?)=20COMMENT=20'=E5=8F=A3=E5=91=B3id'=20AFTER=20label=5Fid,=20AD?= =?UTF-8?q?D=20COLUMN=20season=5Fid=20VARCHAR(32)=20COMMENT=20'=E5=88=86?= =?UTF-8?q?=E7=B1=BBid'=20AFTER=20taste=5Fid,=20ADD=20COLUMN=20suit=5Fid?= =?UTF-8?q?=20VARCHAR(32)=20COMMENT=20'=E9=80=82=E5=AE=9C=E4=BA=BA?= =?UTF-8?q?=E7=BE=A4id'=20AFTER=20season=5Fid,=20ADD=20COLUMN=20meal=5Fid?= =?UTF-8?q?=20VARCHAR(32)=20COMMENT=20'=E9=A4=90=E6=AC=A1id'=20AFTER=20sui?= =?UTF-8?q?t=5Fid;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../menu/controller/MenuDishesController.java | 14 +- .../menu/controller/MenuRecipeController.java | 22 +- .../canteen/core/menu/domain/MenuDishes.java | 33 ++ .../core/menu/domain/MenuNutrition.java | 2 +- .../menu/domain/MenuRecipeDetailAndDish.java | 8 + .../core/menu/domain/MenuRecipeDishes.java | 4 +- .../core/menu/dto/AllocRecipeStallDTO.java | 148 ++++++++ .../canteen/core/menu/dto/MenuDishesDTO.java | 7 + .../core/menu/dto/MenuRecipeBindDTO.java | 21 ++ .../core/menu/dto/MenuRecipeV2PageDTO.java | 96 ++++++ .../core/menu/dto/StallAndRecipeBindDto.java | 31 ++ .../core/menu/mapper/MenuDishesMapper.java | 14 +- .../core/menu/mapper/MenuRecipeMapper.java | 13 + .../core/menu/service/IMenuDishesService.java | 4 +- .../core/menu/service/IMenuRecipeService.java | 10 + .../service/impl/MenuDishesServiceImpl.java | 96 +++++- .../impl/MenuMaterialCategoryServiceImpl.java | 2 +- .../service/impl/MenuRecipeServiceImpl.java | 100 +++++- .../core/menu/vo/AllocRecipeStallVO.java | 146 ++++++++ .../core/menu/vo/MenuRecipeDateVO.java | 39 +++ .../core/menu/vo/MenuRecipeV2PageVO.java | 172 +++++++++ .../core/utils/CurrentToNextSunday.java | 86 +++++ .../mapper/menu/AppletRecipeH5Mapper.xml | 14 +- .../mapper/menu/MenuDishesMapper.xml | 101 +++++- .../mapper/menu/MenuNutritionMapper.xml | 6 +- .../mapper/menu/MenuRecipeMapper.xml | 326 ++++++++++++++---- 26 files changed, 1389 insertions(+), 126 deletions(-) create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDetailAndDish.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/AllocRecipeStallDTO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeV2PageDTO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/StallAndRecipeBindDto.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/AllocRecipeStallVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/MenuRecipeDateVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/MenuRecipeV2PageVO.java create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/utils/CurrentToNextSunday.java diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuDishesController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuDishesController.java index 83323d7..6478869 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuDishesController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuDishesController.java @@ -118,13 +118,13 @@ public class MenuDishesController extends BaseController { //@PreventRepeatSubmit //@RequiresPermissions("menu:dishes:edit") @SysLog(title = "菜品信息", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改菜品信息") - @PostMapping("/edit") - public AjaxResult edit(@RequestBody MenuDishes menuDishes) { - try { - return toAjax(menuDishesService.updateMenuDishes(menuDishes)); - } catch (Exception e) { - return error("系统错误, " + e.getMessage()); - } + @PostMapping("/deitMenuDishes") + public AjaxResult deitMenuDishes(@RequestBody MenuDishesDTO menuDishesDTO) { + //try { + return toAjax(menuDishesService.updateMenuDishes(menuDishesDTO)); + // } catch (Exception e) { + // return error("系统错误, " + e.getMessage()); + // } } /** diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuRecipeController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuRecipeController.java index f0a4df0..ca50a60 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuRecipeController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/controller/MenuRecipeController.java @@ -7,11 +7,12 @@ import javax.validation.Valid; import com.bonus.canteen.core.common.utils.RedisUtil; import com.bonus.canteen.core.common.utils.TenantContextHolder; -import com.bonus.canteen.core.menu.dto.MenuRecipeAddDTO; -import com.bonus.canteen.core.menu.dto.MenuRecipeBindDTO; -import com.bonus.canteen.core.menu.dto.MenuRecipeParamDTO; -import com.bonus.canteen.core.menu.dto.MenuTypeDishesDTO; +import com.bonus.canteen.core.menu.dto.*; import com.bonus.canteen.core.menu.service.IMenuRecipeService; +import com.bonus.canteen.core.menu.vo.AllocRecipeStallVO; +import com.bonus.canteen.core.menu.vo.MenuDishesTypeAllVO; +import com.bonus.canteen.core.menu.vo.MenuRecipeVO; +import com.bonus.canteen.core.menu.vo.MenuRecipeDetailDateVO; import com.bonus.canteen.core.menu.vo.*; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.houqin.constant.GlobalConstants; @@ -48,12 +49,21 @@ public class MenuRecipeController extends BaseController { /** * 查询菜品计划信息列表 */ +// @ApiOperation(value = "查询菜品计划信息列表") +// //@RequiresPermissions("menu:recipe:list") +// @GetMapping("/list") +// public TableDataInfo list(MenuRecipe menuRecipe) { +// startPage(); +// List list = menuRecipeService.selectMenuRecipeList(menuRecipe); +// return getDataTable(list); +// } + @ApiOperation(value = "查询菜品计划信息列表") //@RequiresPermissions("menu:recipe:list") @GetMapping("/list") - public TableDataInfo list(MenuRecipe menuRecipe) { + public TableDataInfo list(AllocRecipeStallDTO dto) { startPage(); - List list = menuRecipeService.selectMenuRecipeList(menuRecipe); + List list = menuRecipeService.selectMenuRecipeListV2(dto); return getDataTable(list); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuDishes.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuDishes.java index b04d710..49e7077 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuDishes.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuDishes.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.activerecord.Model; import com.bonus.canteen.core.common.utils.FileUrlUtil; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Getter; import java.math.BigDecimal; import java.time.LocalDateTime; @@ -186,6 +187,38 @@ public class MenuDishes extends Model { @ApiModelProperty("备注") private String remark; + @ApiModelProperty("食堂名称") + @TableField(exist = false) + private String canteenName; + @ApiModelProperty("档口名称") + @TableField(exist = false) + private String stallName; + + @Getter + @ApiModelProperty("区域名称") + @TableField(exist = false) + private String areaName; + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getCanteenName() { + return canteenName; + } + + public void setCanteenName(String canteenName) { + this.canteenName = canteenName; + } + + public String getStallName() { + return stallName; + } + + public void setStallName(String stallName) { + this.stallName = stallName; + } + public String getSort() { return sort; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuNutrition.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuNutrition.java index 0876dd0..c170ac3 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuNutrition.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuNutrition.java @@ -2,6 +2,7 @@ package com.bonus.canteen.core.menu.domain; import java.math.BigDecimal; import java.time.LocalDateTime; +import java.util.List; import com.bonus.common.core.annotation.Excel; import io.swagger.annotations.ApiModelProperty; @@ -15,7 +16,6 @@ import com.bonus.common.core.web.domain.BaseEntity; * @date 2025-04-03 */ - @Data public class MenuNutrition extends BaseEntity { private static final long serialVersionUID = 1L; diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDetailAndDish.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDetailAndDish.java new file mode 100644 index 0000000..25dd8b7 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDetailAndDish.java @@ -0,0 +1,8 @@ +package com.bonus.canteen.core.menu.domain; + +/** + * @author xliu + * @date 2025/4/18 9:44 + */ +public class MenuRecipeDetailAndDish { +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDishes.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDishes.java index 0f0dc01..0ac8e2f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDishes.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/domain/MenuRecipeDishes.java @@ -18,7 +18,7 @@ import com.bonus.common.core.web.domain.BaseEntity; /** * 菜品计划菜品关联对象 menu_recipe_dishes - * + * * @author xsheng * @date 2025-04-03 */ @@ -52,7 +52,7 @@ public class MenuRecipeDishes extends Model { @ApiModelProperty("是否推荐") private Integer recommendFlag; @ApiModelProperty("排序号") - private Integer sortNum; + private Integer sortNum = -1; @ApiModelProperty("乐观锁") private Integer revision; @TableField( diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/AllocRecipeStallDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/AllocRecipeStallDTO.java new file mode 100644 index 0000000..d178812 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/AllocRecipeStallDTO.java @@ -0,0 +1,148 @@ +package com.bonus.canteen.core.menu.dto; + +import io.swagger.annotations.ApiModelProperty; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; +import java.util.List; + +public class AllocRecipeStallDTO { + @ApiModelProperty("区域id") + private Long areaId; + private List areaIds; + @ApiModelProperty("食堂id") + private Long canteenId; + private List canteenIds; + @ApiModelProperty("档口id") + private Long stallId; + private List stallIds; + @ApiModelProperty("餐线类型") + private Integer mealLineType; + @ApiModelProperty("餐线id") + private Long mealLineId; + @ApiModelProperty("菜谱名称") + private String recipeName; + @ApiModelProperty("菜谱绑定类型") + private Integer bindType; + @ApiModelProperty("设备类型") + private List deviceTypeList; + @ApiModelProperty("是否查询餐线") + private Integer ifQueryMealLine; + private Integer key; + + @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) // for "yyyy-MM-dd" format + private LocalDate applyDate; + + public Long getAreaId() { + return this.areaId; + } + + public List getAreaIds() { + return this.areaIds; + } + + public Long getCanteenId() { + return this.canteenId; + } + + public List getCanteenIds() { + return this.canteenIds; + } + + public Long getStallId() { + return this.stallId; + } + + public List getStallIds() { + return this.stallIds; + } + + public Integer getMealLineType() { + return this.mealLineType; + } + + public Long getMealLineId() { + return this.mealLineId; + } + + public String getRecipeName() { + return this.recipeName; + } + + public Integer getBindType() { + return this.bindType; + } + + public List getDeviceTypeList() { + return this.deviceTypeList; + } + + public Integer getIfQueryMealLine() { + return this.ifQueryMealLine; + } + + public Integer getKey() { + return this.key; + } + + public LocalDate getApplyDate() { + return this.applyDate; + } + + public void setAreaId(final Long areaId) { + this.areaId = areaId; + } + + public void setAreaIds(final List areaIds) { + this.areaIds = areaIds; + } + + public void setCanteenId(final Long canteenId) { + this.canteenId = canteenId; + } + + public void setCanteenIds(final List canteenIds) { + this.canteenIds = canteenIds; + } + + public void setStallId(final Long stallId) { + this.stallId = stallId; + } + + public void setStallIds(final List stallIds) { + this.stallIds = stallIds; + } + + public void setMealLineType(final Integer mealLineType) { + this.mealLineType = mealLineType; + } + + public void setMealLineId(final Long mealLineId) { + this.mealLineId = mealLineId; + } + + public void setRecipeName(final String recipeName) { + this.recipeName = recipeName; + } + + public void setBindType(final Integer bindType) { + this.bindType = bindType; + } + + public void setDeviceTypeList(final List deviceTypeList) { + this.deviceTypeList = deviceTypeList; + } + + public void setIfQueryMealLine(final Integer ifQueryMealLine) { + this.ifQueryMealLine = ifQueryMealLine; + } + + public void setKey(final Integer key) { + this.key = key; + } + + public void setApplyDate(final LocalDate applyDate) { + this.applyDate = applyDate; + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuDishesDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuDishesDTO.java index fdfb621..09cc06f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuDishesDTO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuDishesDTO.java @@ -126,7 +126,14 @@ public class MenuDishesDTO { @ApiModelProperty("餐次") private List mealList; + private String labelId; + private String tasteId; + private String seasonId; + private String suitId; + private String mealId; + private Integer customId; + } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeBindDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeBindDTO.java index 871f515..b7a0d93 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeBindDTO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeBindDTO.java @@ -21,6 +21,27 @@ public class MenuRecipeBindDTO implements Serializable { @ApiModelProperty("餐线id") private Long mealLineId; + @ApiModelProperty("档口id") + private Long stallId; + @ApiModelProperty("食堂id") + private Long canteenId; + + public Long getStallId() { + return stallId; + } + + public void setStallId(Long stallId) { + this.stallId = stallId; + } + + public Long getCanteenId() { + return canteenId; + } + + public void setCanteenId(Long canteenId) { + this.canteenId = canteenId; + } + public Long getRecipeId() { return this.recipeId; } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeV2PageDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeV2PageDTO.java new file mode 100644 index 0000000..c7d8daa --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/MenuRecipeV2PageDTO.java @@ -0,0 +1,96 @@ +package com.bonus.canteen.core.menu.dto; + +import io.swagger.annotations.ApiModelProperty; + +import java.util.List; + +public class MenuRecipeV2PageDTO { + @ApiModelProperty("菜谱id") + private Long recipeId; + @ApiModelProperty("菜谱名称") + private String recipeName; + @ApiModelProperty("区域Id") + private Long areaId; + private List areaIds; + @ApiModelProperty("食堂id") + private Long canteenId; + private List canteenIds; + @ApiModelProperty("档口id") + private Long stallId; + private List stallIds; + @ApiModelProperty("菜谱类型") + private Integer recipeType; + + public Long getRecipeId() { + return this.recipeId; + } + + public String getRecipeName() { + return this.recipeName; + } + + public Long getAreaId() { + return this.areaId; + } + + public List getAreaIds() { + return this.areaIds; + } + + public Long getCanteenId() { + return this.canteenId; + } + + public List getCanteenIds() { + return this.canteenIds; + } + + public Long getStallId() { + return this.stallId; + } + + public List getStallIds() { + return this.stallIds; + } + + public Integer getRecipeType() { + return this.recipeType; + } + + public void setRecipeId(final Long recipeId) { + this.recipeId = recipeId; + } + + public void setRecipeName(final String recipeName) { + this.recipeName = recipeName; + } + + public void setAreaId(final Long areaId) { + this.areaId = areaId; + } + + public void setAreaIds(final List areaIds) { + this.areaIds = areaIds; + } + + public void setCanteenId(final Long canteenId) { + this.canteenId = canteenId; + } + + public void setCanteenIds(final List canteenIds) { + this.canteenIds = canteenIds; + } + + public void setStallId(final Long stallId) { + this.stallId = stallId; + } + + public void setStallIds(final List stallIds) { + this.stallIds = stallIds; + } + + public void setRecipeType(final Integer recipeType) { + this.recipeType = recipeType; + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/StallAndRecipeBindDto.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/StallAndRecipeBindDto.java new file mode 100644 index 0000000..203a4a8 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/dto/StallAndRecipeBindDto.java @@ -0,0 +1,31 @@ +package com.bonus.canteen.core.menu.dto; + +public class StallAndRecipeBindDto { + 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/java/com/bonus/canteen/core/menu/mapper/MenuDishesMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuDishesMapper.java index 4269f69..1c60106 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuDishesMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuDishesMapper.java @@ -8,6 +8,7 @@ import com.bonus.canteen.core.menu.domain.MenuDishesRelation; import com.bonus.canteen.core.menu.dto.MenuDishesAddMaterialDTO; import com.bonus.canteen.core.menu.dto.MenuDishesDTO; import com.bonus.canteen.core.utils.NutritionEntity; +import org.apache.ibatis.annotations.Param; /** * 菜品信息Mapper接口 @@ -43,10 +44,10 @@ public interface MenuDishesMapper { /** * 修改菜品信息 * - * @param menuDishes 菜品信息 + * @param menuDishesDTO 菜品信息 * @return 结果 */ - public int updateMenuDishes(MenuDishes menuDishes); + public int updateMenuDishes(MenuDishesDTO menuDishesDTO); /** * 删除菜品信息 @@ -62,17 +63,22 @@ public interface MenuDishesMapper { * @param ids 需要删除的数据主键集合 * @return 结果 */ - public int deleteMenuDishesByIds(Long[] ids); + public int deleteMenuDishesByIds(@Param("dishesIds") Long[] ids); + List getBassIdByDishesId(@Param("dishesIds") Long[] ids); + + int deleteBaseDishesByIds(@Param("baseDishesIds") Long[] ids); List getDishesType(MapBean mapBean); MenuDishes getOne(MenuDishesDTO menuDishesDTO); int addMenuDishesBase(MenuDishesDTO menuDishesDTO); + int updateMenuDishesBase(MenuDishesDTO menuDishesDTO); int addMenuDishes(MenuDishesDTO menuDishesDTO); + int editMenuDishes(MenuDishesDTO menuDishesDTO); NutritionEntity getNutritionEntity(MenuDishesAddMaterialDTO dto); - int addFinalNutrition(NutritionEntity nutritionEntity); + int addFinalNutrition(@Param("nutritionEntity") NutritionEntity nutritionEntity,@Param("dishesId") Long dishesId); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java index 27024cb..3843eab 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/mapper/MenuRecipeMapper.java @@ -57,6 +57,11 @@ public interface MenuRecipeMapper extends BaseMapper { * @return 菜品计划信息集合 */ public List selectMenuRecipeList(MenuRecipe menuRecipe); + public List selectMenuRecipeListV2(AllocRecipeStallDTO menuRecipe); + + List selectRecipeByStallIdsAndBindType(@Param("stallIds") List stallIds, @Param("bindType") Integer bindType); + + List selectTmpBetweenDateDetailList(@Param("recipeIds") List recipeIds, @Param("applyStartDate") LocalDate applyStartDate, @Param("applyEndDate") LocalDate applyEndDate); ListgetDishesListByDetailId(String detailsId); @@ -110,6 +115,8 @@ public interface MenuRecipeMapper extends BaseMapper { */ List getDishesCountByRecipeIds(@Param("recipeIds") List recipeIds); + List getMenuDishDeatilList(@Param("recipeIds") List recipeIds); + /** * 根据recipeIds获取日期 * @@ -217,4 +224,10 @@ public interface MenuRecipeMapper extends BaseMapper { List getMealTimeList(Long stallId); List getBasicsTimeIntervals(Long stallId); + + + List MenuRecipeDetailList(Long recipeId); + + + List getMenuRecipeList(MenuRecipeV2PageDTO dto); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuDishesService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuDishesService.java index 9faebfb..11604d9 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuDishesService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuDishesService.java @@ -40,10 +40,10 @@ public interface IMenuDishesService { /** * 修改菜品信息 * - * @param menuDishes 菜品信息 + * @param menuDishesDTO 菜品信息 * @return 结果 */ - public int updateMenuDishes(MenuDishes menuDishes); + public int updateMenuDishes(MenuDishesDTO menuDishesDTO); /** * 批量删除菜品信息 diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuRecipeService.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuRecipeService.java index 46a39e1..cb9f3fa 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuRecipeService.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/IMenuRecipeService.java @@ -5,6 +5,11 @@ import java.util.List; import com.baomidou.mybatisplus.extension.service.IService; import com.bonus.canteen.core.menu.domain.MenuRecipe; +import com.bonus.canteen.core.menu.dto.*; +import com.bonus.canteen.core.menu.vo.AllocRecipeStallVO; +import com.bonus.canteen.core.menu.vo.MenuRecipeVO; +import com.bonus.canteen.core.menu.vo.MenuDishesTypeAllVO; +import com.bonus.canteen.core.menu.vo.MenuRecipeDetailDateVO; import com.bonus.canteen.core.menu.dto.MenuRecipeBindDTO; import com.bonus.canteen.core.menu.vo.*; import com.bonus.canteen.core.menu.dto.MenuRecipeAddDTO; @@ -41,6 +46,9 @@ public interface IMenuRecipeService extends IService { public List selectMenuRecipeList(MenuRecipe menuRecipe); AjaxResult getDishesList(MenuRecipeParamDTO dto); + AjaxResult getDishesListV2(MenuRecipeV2PageDTO dto); + + /** * 新增菜品计划信息 * @@ -95,4 +103,6 @@ public interface IMenuRecipeService extends IService { IssueRecipeCompressVO getMenuInfoBySn(String machineSn); DviceTimeIntervalVO intervalConfig(String machineSn); + + List selectMenuRecipeListV2(AllocRecipeStallDTO dto); } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java index d5db3fb..53d202e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuDishesServiceImpl.java @@ -6,6 +6,7 @@ import java.lang.reflect.Method; import java.time.LocalDateTime; import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import com.bonus.canteen.core.menu.domain.MapBean; import com.bonus.canteen.core.menu.domain.MenuDishesRelation; @@ -84,17 +85,53 @@ public class MenuDishesServiceImpl implements IMenuDishesService { /** * 修改菜品信息 * - * @param menuDishes 菜品信息 + * @param menuDishesDTO 菜品信息 * @return 结果 */ @Override - public int updateMenuDishes(MenuDishes menuDishes) { - menuDishes.setUpdateTime(LocalDateTime.now()); - try { - return menuDishesMapper.updateMenuDishes(menuDishes); - } catch (Exception e) { - throw new ServiceException("错误信息描述"); - } + public int updateMenuDishes(MenuDishesDTO menuDishesDTO) { + // try { + if(menuDishesDTO.getDishesId() == null){ + throw new ServiceException("菜品ID不能为空"); + } + if(menuDishesDTO.getBaseDishesId() == null){ + throw new ServiceException("菜品基础ID不能为空"); + } + MenuDishes menuDishesOne = menuDishesMapper.getOne(menuDishesDTO); + if(menuDishesOne !=null && !String.valueOf(menuDishesOne.getDishesId()).equals(menuDishesDTO.getDishesId())){ + throw new ServiceException("菜品已存在"); + } + addIds(menuDishesDTO); + menuDishesDTO.setUpdateBy(SecurityUtils.getUsername()); + int baseNum = menuDishesMapper.updateMenuDishesBase(menuDishesDTO); + int dishesNum = menuDishesMapper.editMenuDishes(menuDishesDTO); + List materialList= menuDishesDTO.getMaterialList(); + List nutritionEntityList = new ArrayList<>(); + System.err.println("长度:"+materialList.size()); + for (MenuDishesAddMaterialDTO i: materialList) { + NutritionEntity nutritionEntity = menuDishesMapper.getNutritionEntity(i); + if(nutritionEntity !=null){ + System.err.println(i.getMaterialId()+",开始值:"+nutritionEntity.getCalcium()); + nutritionEntity.setWeight(i.getWeight()); + nutritionEntity.setBaseWeight(100.0); + nutritionEntityList.add(nutritionEntity); + } + } + NutritionEntityUtil nutritionEntityUtil = new NutritionEntityUtil(); + NutritionEntity nutritionEntity = nutritionEntityUtil.countNutrition(nutritionEntityList); + if(nutritionEntityList !=null && nutritionEntityList.size() >0){ + System.err.println("总和:"+nutritionEntity.getCalcium()); + //计算营养成分 + nutritionEntity = countNum(nutritionEntity,menuDishesDTO.getWeight()); + System.err.println("计算后:"+nutritionEntity.getCalcium()); + return menuDishesMapper.addFinalNutrition(nutritionEntity,Long.parseLong(menuDishesDTO.getDishesId())); + } + + + return menuDishesMapper.editMenuDishes(menuDishesDTO); +// } catch (Exception e) { +// throw new ServiceException(e.toString()); +// } } /** @@ -105,6 +142,11 @@ public class MenuDishesServiceImpl implements IMenuDishesService { */ @Override public int deleteMenuDishesByIds(Long[] ids) { + List baseDishesIds = menuDishesMapper.getBassIdByDishesId(ids); + if(baseDishesIds != null && baseDishesIds.size() >0){ + menuDishesMapper.deleteBaseDishesByIds(baseDishesIds.toArray(new Long[baseDishesIds.size()])); + } + return menuDishesMapper.deleteMenuDishesByIds(ids); } @@ -140,6 +182,7 @@ public class MenuDishesServiceImpl implements IMenuDishesService { menuDishesDTO.setBaseDishesId(baseDishesId+""); menuDishesDTO.setDishesId(dishesId+""); menuDishesDTO.setCustomId(-1); + addIds(menuDishesDTO); int baseNum = menuDishesMapper.addMenuDishesBase(menuDishesDTO); //添加主要信息 int dishesNum = menuDishesMapper.addMenuDishes(menuDishesDTO); @@ -163,11 +206,46 @@ public class MenuDishesServiceImpl implements IMenuDishesService { //计算营养成分 nutritionEntity = countNum(nutritionEntity,menuDishesDTO.getWeight()); System.err.println("计算后:"+nutritionEntity.getCalcium()); - return menuDishesMapper.addFinalNutrition(nutritionEntity); + return menuDishesMapper.addFinalNutrition(nutritionEntity,dishesId); } return 1; } + private void addIds(MenuDishesDTO menuDishesDTO){ + + List labelIdList = menuDishesDTO.getLabelIdList(); + + List tasteIdList = menuDishesDTO.getTasteIdList(); + + List season = menuDishesDTO.getSeason(); + + List suitIdList = menuDishesDTO.getSuitIdList(); + + List mealList = menuDishesDTO.getMealList(); + + if(labelIdList !=null && !labelIdList.isEmpty()){ + String result = labelIdList.stream() .map(String::valueOf).collect(Collectors.joining(",")); + menuDishesDTO.setLabelId(result); + } + if(tasteIdList !=null && !tasteIdList.isEmpty()){ + String result = tasteIdList.stream() .map(String::valueOf).collect(Collectors.joining(",")); + menuDishesDTO.setTasteId(result); + } + if(season !=null && !season.isEmpty()){ + String result = season.stream() .map(String::valueOf).collect(Collectors.joining(",")); + menuDishesDTO.setSeasonId(result); + } + if(suitIdList !=null && !suitIdList.isEmpty()){ + String result = suitIdList.stream() .map(String::valueOf).collect(Collectors.joining(",")); + menuDishesDTO.setSuitId(result); + } + if(mealList !=null && !mealList.isEmpty()){ + String result = mealList.stream() .map(String::valueOf).collect(Collectors.joining(",")); + menuDishesDTO.setMealId(result); + } + + } + private NutritionEntity countNum(NutritionEntity nutritionEntity,Double weight) { Field[] fields = nutritionEntity.getClass().getDeclaredFields(); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuMaterialCategoryServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuMaterialCategoryServiceImpl.java index 826151e..355ea68 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuMaterialCategoryServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/service/impl/MenuMaterialCategoryServiceImpl.java @@ -91,7 +91,7 @@ public class MenuMaterialCategoryServiceImpl extends ServiceImpl selectMenuRecipeListV2(AllocRecipeStallDTO content) { + Map bindTypeMap = MenuRecipeSortEnum.getKeyMap(); + MenuRecipeSortEnum sortEnum = bindTypeMap.get(content.getKey()); + List records = new ArrayList<>(); + if (ObjectUtil.isEmpty(sortEnum)) { + throw new ServiceException(I18n.getMessage("参数错误", new Object[0])); + }else{ + content.setDeviceTypeList(sortEnum.getDeviceType()); + content.setBindType(sortEnum.getBindType()); + records = menuRecipeMapper.selectMenuRecipeListV2(content); + if (ObjectUtil.isNotEmpty(records)) { + List recipeIds; + Map maping; + List menuRecipeDateVOS; + menuRecipeDateVOS = records.stream().map(AllocRecipeStallVO::getStallId).collect(Collectors.toList()); + List stallAndRecipeBindDtos = this.menuRecipeMapper.selectRecipeByStallIdsAndBindType(menuRecipeDateVOS, content.getBindType()); + maping = stallAndRecipeBindDtos.stream().collect(Collectors.toMap(StallAndRecipeBindDto::getStallId, StallAndRecipeBindDto::getRecipeId)); + recipeIds = stallAndRecipeBindDtos.stream().map(StallAndRecipeBindDto::getRecipeId).distinct().collect(Collectors.toList()); + this.generateRecipe(recipeIds, content.getApplyDate()); + List menuRecipeDateVOS1 = this.menuRecipeMapper.selectTmpBetweenDateDetailList(recipeIds, content.getApplyDate(), content.getApplyDate()); + Map recipeMap = (recipeIds == null || recipeIds.isEmpty()) + ? new HashMap<>() + : this.list(Wrappers.lambdaQuery(MenuRecipe.class) + .in(MenuRecipe::getRecipeId, recipeIds)) + .stream() + .collect(Collectors.toMap(MenuRecipe::getRecipeId, Function.identity())); + Map detailMap = menuRecipeDateVOS1.stream().collect(Collectors.toMap(MenuRecipeDateVO::getRecipeId, Function.identity(), (t1, t2) -> { + return t1; + })); + + AllocRecipeStallVO 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(MenuRecipe::getRecipeName).orElse(null)); + // item.setUptime(Optional.ofNullable(recipeMap.get(recipeId)).map(MenuRecipe::getUptime).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(MenuRecipeDetailDishesVO::getDishesId).distinct().count(); + } + } + + } + } + return records; + } @Override public void bindAppRecipe(MenuRecipeBindDTO content) { MenuRecipe menuRecipe = this.menuRecipeMapper.selectMenuRecipe(content.getRecipeId()); + if(content.getStallId() !=null && content.getCanteenId() !=null){ + List deviceInfoList = this.menuRecipeMapper.getDeviceIdByDevivce(String.valueOf(content.getCanteenId()), String.valueOf(content.getStallId())); + if(deviceInfoList == null || deviceInfoList.isEmpty()){ + throw new ServiceException(I18n.getMessage("该食堂档口下没有设备信息", new Object[0])); + } + } MenuRecipeSortEnum sortEnum = MenuRecipeSortEnum.getBindTypeMap().get(content.getBindType()); MenuAppRecipe mar = new MenuAppRecipe(); mar.setRecipeId(content.getRecipeId()); @@ -152,7 +215,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl sourceRecipeList = this.menuRecipeMapper.selectRecipeInSameShop(menuRecipe.getStallId(), null, content.getBindType(), content.getMealLineId()); if (ObjectUtil.isNotEmpty(sourceRecipeList)) { @@ -319,6 +382,15 @@ public class MenuRecipeServiceImpl extends ServiceImpl list = menuRecipeMapper.getMenuRecipeList(dto); + + + return null; + } + /** * 批量删除菜品计划信息 * @@ -372,10 +444,24 @@ public class MenuRecipeServiceImpl extends ServiceImpl dateMap = CurrentToNextSunday.getDatesFromTodayToNextSunday(LocalDate.now()); + + List menuRecipeDetailList = menuRecipeMapper.MenuRecipeDetailList(recipeId); + + + + + } + @Override public List getDetail(MenuRecipeParamDTO dto) { return this.menuRecipeMapper.getDetail(dto); @@ -387,9 +473,9 @@ public class MenuRecipeServiceImpl extends ServiceImpl 0) { - throw new ServiceException(I18n.getMessage("menu_recipe_mac_bind_del", new Object[0])); + throw new ServiceException(I18n.getMessage("设备已被绑定", new Object[0])); } else if (appCount > 0) { - throw new ServiceException(I18n.getMessage("menu_recipe_applet_bind_del", new Object[0])); + throw new ServiceException(I18n.getMessage("菜谱已绑定设备", new Object[0])); } else { // this.baseMapper.delete( Wrappers.lambdaUpdate(MenuRecipe.class) // .in(MenuRecipe::getRecipeId, recipeId)); @@ -908,7 +994,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl list.get(0)) .map(MenuRecipeDetailAddDTO::getMealtimeType) - .orElseThrow(() -> new ServiceException(I18n.getMessage("menu_interval_id_null"))); + .orElseThrow(() -> new ServiceException(I18n.getMessage("详情id为空"))); } return menuRecipeMapper.selectDetailIds(getRecipeDto, mealType); } @@ -924,7 +1010,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl list.get(0)) .map(MenuRecipeDetailAddDTO::getMealtimeType) - .orElseThrow(() -> new ServiceException(I18n.getMessage("menu_interval_id_null"))); + .orElseThrow(() -> new ServiceException(I18n.getMessage("详情id为空"))); } return this.menuRecipeMapper.selectDetailsList(getRecipeDto, LocalDate.now(), mealType); } @@ -1126,7 +1212,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl 99L) { - throw new ServiceException(I18n.getMessage("menu_issue_dishes_max", new Object[0])); + throw new ServiceException(I18n.getMessage("菜谱信息达到上限", new Object[0])); } else { dishesList.stream().filter((x) -> { return x.getSizeType() == 3L; @@ -1137,7 +1223,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl 3L) { - throw new ServiceException(I18n.getMessage("menu_recommend_dishes_over_three", new Object[0])); + throw new ServiceException(I18n.getMessage("无推荐菜谱", new Object[0])); } } } diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/AllocRecipeStallVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/AllocRecipeStallVO.java new file mode 100644 index 0000000..326d3bc --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/AllocRecipeStallVO.java @@ -0,0 +1,146 @@ +package com.bonus.canteen.core.menu.vo; + +import com.bonus.canteen.core.menu.vo.MenuRecipeDateVO; +import io.swagger.annotations.ApiModelProperty; + +import java.time.LocalDateTime; + +public class AllocRecipeStallVO { + @ApiModelProperty("区域id") + private Long areaId; + @ApiModelProperty("当前区域名称") + private String areaName; + @ApiModelProperty("食堂id") + private Long canteenId; + @ApiModelProperty("食堂名称") + private String canteenName; + @ApiModelProperty("档口id") + private Long stallId; + @ApiModelProperty("档口名称") + private String stallName; + @ApiModelProperty("餐线类型") + private Integer mealLineType; + @ApiModelProperty("餐线id") + private Long mealLineId; + @ApiModelProperty("餐线名称") + private String mealLineName; + @ApiModelProperty("菜谱id") + private Long recipeId; + @ApiModelProperty("菜谱名称") + private String recipeName; + private Long DishesCount; + private MenuRecipeDateVO detail; + private LocalDateTime uptime; + + public Long getAreaId() { + return this.areaId; + } + + public String getAreaName() { + return this.areaName; + } + + 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 Integer getMealLineType() { + return this.mealLineType; + } + + public Long getMealLineId() { + return this.mealLineId; + } + + public String getMealLineName() { + return this.mealLineName; + } + + public Long getRecipeId() { + return this.recipeId; + } + + public String getRecipeName() { + return this.recipeName; + } + + public Long getDishesCount() { + return this.DishesCount; + } + + public MenuRecipeDateVO getDetail() { + return this.detail; + } + + public LocalDateTime getUptime() { + return this.uptime; + } + + public void setAreaId(final Long areaId) { + this.areaId = areaId; + } + + public void setAreaName(final String areaName) { + this.areaName = areaName; + } + + 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 setMealLineType(final Integer mealLineType) { + this.mealLineType = mealLineType; + } + + public void setMealLineId(final Long mealLineId) { + this.mealLineId = mealLineId; + } + + public void setMealLineName(final String mealLineName) { + this.mealLineName = mealLineName; + } + + public void setRecipeId(final Long recipeId) { + this.recipeId = recipeId; + } + + public void setRecipeName(final String recipeName) { + this.recipeName = recipeName; + } + + public void setDishesCount(final Long DishesCount) { + this.DishesCount = DishesCount; + } + + public void setDetail(final MenuRecipeDateVO detail) { + this.detail = detail; + } + + public void setUptime(final LocalDateTime uptime) { + this.uptime = uptime; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/MenuRecipeDateVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/MenuRecipeDateVO.java new file mode 100644 index 0000000..8037b86 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/MenuRecipeDateVO.java @@ -0,0 +1,39 @@ +package com.bonus.canteen.core.menu.vo; + +import io.swagger.annotations.ApiModelProperty; + +import java.time.LocalDate; +import java.util.List; + +public class MenuRecipeDateVO { + @ApiModelProperty("日期") + private LocalDate day; + private Long recipeId; + @ApiModelProperty("数据详情") + private List details; + + public LocalDate getDay() { + return this.day; + } + + public Long getRecipeId() { + return this.recipeId; + } + + public List getDetails() { + return this.details; + } + + public void setDay(final LocalDate day) { + this.day = day; + } + + public void setRecipeId(final Long recipeId) { + this.recipeId = recipeId; + } + + public void setDetails(final List details) { + this.details = details; + } + +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/MenuRecipeV2PageVO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/MenuRecipeV2PageVO.java new file mode 100644 index 0000000..38ddc0e --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/menu/vo/MenuRecipeV2PageVO.java @@ -0,0 +1,172 @@ +package com.bonus.canteen.core.menu.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + +@ApiModel("菜谱计划发布记录列表") +public class MenuRecipeV2PageVO { + @ApiModelProperty("菜谱id") + private Long recipeId; + @ApiModelProperty("菜谱类型") + private Integer recipeType; + @ApiModelProperty("菜谱名称") + private String recipeName; + @ApiModelProperty("区域id") + private Long areaId; + @ApiModelProperty("区域名称") + private String areaName; + @ApiModelProperty("食堂id") + private Long canteenId; + @ApiModelProperty("食堂名称") + private String canteenName; + @ApiModelProperty("档口id") + private Long stallId; + @ApiModelProperty("档口名称") + private String stallName; + @ApiModelProperty("菜品数量") + private Integer dishesCount; + @ApiModelProperty("生效范围id") + private Long effId; + @ApiModelProperty("生效范围名称") + private String effName; + @ApiModelProperty("创建人") + private String crby; + @ApiModelProperty("创建时间") + private LocalDateTime crtime; + @ApiModelProperty("已排菜日期") + private List applyDateList; + @ApiModelProperty("已排菜日期(月-日)") + private List applyDateStringList; + + public Long getRecipeId() { + return this.recipeId; + } + + public Integer getRecipeType() { + return this.recipeType; + } + + public String getRecipeName() { + return this.recipeName; + } + + public Long getAreaId() { + return this.areaId; + } + + public String getAreaName() { + return this.areaName; + } + + 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 Integer getDishesCount() { + return this.dishesCount; + } + + public Long getEffId() { + return this.effId; + } + + public String getEffName() { + return this.effName; + } + + public String getCrby() { + return this.crby; + } + + public LocalDateTime getCrtime() { + return this.crtime; + } + + public List getApplyDateList() { + return this.applyDateList; + } + + public List getApplyDateStringList() { + return this.applyDateStringList; + } + + public void setRecipeId(final Long recipeId) { + this.recipeId = recipeId; + } + + public void setRecipeType(final Integer recipeType) { + this.recipeType = recipeType; + } + + public void setRecipeName(final String recipeName) { + this.recipeName = recipeName; + } + + public void setAreaId(final Long areaId) { + this.areaId = areaId; + } + + public void setAreaName(final String areaName) { + this.areaName = areaName; + } + + 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 setDishesCount(final Integer dishesCount) { + this.dishesCount = dishesCount; + } + + public void setEffId(final Long effId) { + this.effId = effId; + } + + public void setEffName(final String effName) { + this.effName = effName; + } + + public void setCrby(final String crby) { + this.crby = crby; + } + + public void setCrtime(final LocalDateTime crtime) { + this.crtime = crtime; + } + + public void setApplyDateList(final List applyDateList) { + this.applyDateList = applyDateList; + } + + public void setApplyDateStringList(final List applyDateStringList) { + this.applyDateStringList = applyDateStringList; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/utils/CurrentToNextSunday.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/utils/CurrentToNextSunday.java new file mode 100644 index 0000000..e971058 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/utils/CurrentToNextSunday.java @@ -0,0 +1,86 @@ +package com.bonus.canteen.core.utils; + +import java.time.DayOfWeek; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.time.temporal.TemporalAdjusters; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * @author xliu + * @date 2025/4/17 18:45 + */ +public class CurrentToNextSunday { + public static void main(String[] args) { + // 假设今天是周四(可以替换为LocalDate.now()获取真实当前日期) + LocalDate today = LocalDate.of(2025, 4, 26); // 2025-04-17 周四 + System.out.println("当前日期: " + today.format(DateTimeFormatter.ISO_LOCAL_DATE)); + + // 获取从今天到下周日的日期信息 + Map dateMap = getDatesFromTodayToNextSunday(today); + + // 打印结果 + System.out.println("\n从今天到下周日的日期信息:"); + System.out.println("星期\t日期\t\t天数差"); + dateMap.forEach((day, info) -> + System.out.printf("%s\t%s\t%s%n", + getChineseWeekday(day), + info.date.format(DateTimeFormatter.ISO_LOCAL_DATE), + formatDayDifference(info.difference)) + ); + } + + /** + * 获取从今天到下周日的日期信息 + * @param today 当前日期(周四) + * @return 有序的日期信息Map + */ + public static Map getDatesFromTodayToNextSunday(LocalDate today) { + Map result = new LinkedHashMap<>(); + + // 获取下周日日期 + LocalDate nextSunday = today.with(TemporalAdjusters.next(DayOfWeek.SUNDAY)); + + // 从今天开始,直到下周日,逐个日期处理 + LocalDate currentDate = today; + while (!currentDate.isAfter(nextSunday)) { + long difference = currentDate.toEpochDay() - today.toEpochDay(); + result.put(currentDate.getDayOfWeek(), new DateInfo(currentDate, difference)); + currentDate = currentDate.plusDays(1); + } + + return result; + } + + // 以下辅助方法与之前相同 + private static String getChineseWeekday(DayOfWeek day) { + switch (day) { + case MONDAY: return "周一"; + case TUESDAY: return "周二"; + case WEDNESDAY: return "周三"; + case THURSDAY: return "周四"; + case FRIDAY: return "周五"; + case SATURDAY: return "周六"; + case SUNDAY: return "周日"; + default: return day.toString(); + } + } + + private static String formatDayDifference(long difference) { + if (difference == 0) return "今天"; + else if (difference < 0) return Math.abs(difference) + "天前"; + else return difference + "天后"; + } + + public static class DateInfo { + LocalDate date; + long difference; + + DateInfo(LocalDate date, long difference) { + this.date = date; + this.difference = difference; + } + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/AppletRecipeH5Mapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/AppletRecipeH5Mapper.xml index 169b8cb..d25ab92 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/AppletRecipeH5Mapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/AppletRecipeH5Mapper.xml @@ -114,13 +114,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" left join menu_recipe mr on mar.recipe_id = mr.recipe_id where bind_type = 3 - and mr.eff_id in - - #{effId} - - - and mar.recipe_id = #{recipeId} - + + + + + + + diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuDishesMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuDishesMapper.xml index 37645aa..1951e9a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuDishesMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuDishesMapper.xml @@ -81,12 +81,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + - select b.*,a.type_name + select b.*,a.type_name,aa.area_name,ac.canteen_name,als.stall_name from menu_dishes b LEFT JOIN menu_dishes_type a on a.type_id = b.type_id + LEFT JOIN alloc_area aa on aa.area_id = b.area_id + LEFT JOIN alloc_canteen ac on ac.canteen_id = b.canteen_id + LEFT JOIN alloc_stall als on als.stall_id = b.shopstall_id + select base_dishes_id from menu_dishes where dishes_id in + + #{item} + + + + + delete from menu_dishes_base where base_dishes_id in + + #{item} @@ -410,6 +431,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" create_by, custom_id, type_id, + + label_id, + taste_id, + season_id, + suit_id, + meal_id, + + + #{dishesId}, @@ -433,6 +463,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{createBy}, #{customId}, #{typeId}, + + #{labelId}, + #{tasteId}, + #{seasonId}, + #{suitId}, + #{mealId}, @@ -441,19 +477,54 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" cholesterol,calcium,sodium,purine,iron, iodine,kalium,vitamin_a as vitaminA,vitamin_c as vitaminC,vitamin_e as vitaminE, magnesium,zinc,glycemic_index as glycemicIndex - from menu_nutrition where nutrition_id = #{materialId} + from menu_material_nutrition where material_id = #{materialId} + + + update menu_dishes_base set dishes_name = #{dishesName},update_by = #{updateBy} + where base_dishes_id = #{baseDishesId} + + + + update menu_dishes + + size_type = #{sizeType}, + material_cost = #{materialCost}, + public_dishes = #{publicDishes}, + area_id = #{areaId}, + canteen_id =#{canteenId}, + shopstall_id =#{shopstallId}, + dishes_num = #{dishesNum}, + dishes_name = #{dishesName}, + price = #{price}, + weight = #{weight}, + weight_deviation = #{weightDeviation}, + image_url = #{imageUrl}, + effect_id = #{effectId}, + style_id = #{styleId}, + cook_id = #{cookId}, + classify_id = #{classifyId}, + custom_id = #{customId}, + type_id = #{typeId}, + + label_id = #{labelId}, + taste_id = #{tasteId}, + season_id = #{seasonId}, + suit_id = #{suitId}, + meal_id = #{mealId}, + + + where dishes_id = #{dishesId} + diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuNutritionMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuNutritionMapper.xml index eb904dc..6c48cdf 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuNutritionMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuNutritionMapper.xml @@ -131,9 +131,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and nutrition_code like concat('%', #{nutritionCode}, '%') and nutrition_name like concat('%', #{nutritionName}, '%') - and big_type = #{bigType} - and little_type = #{littleType} - and category_id = #{categoryId} + + + and category_id in diff --git a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml index 2006e03..e75ff49 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml +++ b/bonus-modules/bonus-smart-canteen/src/main/resources/mapper/menu/MenuRecipeMapper.xml @@ -844,79 +844,77 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + insert into menu_recipe_detail - detail_id, - sale_type_id, - recipe_id, - apply_date, - apply_week, - mealtime_type, - detail_type, - revision, - create_by, - create_time, - update_by, - update_time, + detail_id, + sale_type_id, + recipe_id, + apply_date, + apply_week, + mealtime_type, + detail_type, + revision, + create_by, + create_time, + update_by, + update_time, values - - - #{menuDetail.detailId}, - #{menuDetail.saleTypeId}, - #{menuDetail.recipeId}, - #{menuDetail.applyDate}, - #{menuDetail.applyWeek}, - #{menuDetail.mealtimeType}, - #{menuDetail.detailType}, - #{menuDetail.revision}, - #{menuDetail.createBy}, - #{menuDetail.createTime}, - #{menuDetail.updateBy}, - #{menuDetail.updateTime}, - + + #{menuDetail.detailId}, + #{menuDetail.saleTypeId}, + #{menuDetail.recipeId}, + #{menuDetail.applyDate}, + #{menuDetail.applyWeek}, + #{menuDetail.mealtimeType}, + #{menuDetail.detailType}, + #{menuDetail.revision}, + #{menuDetail.createBy}, + #{menuDetail.createTime}, + #{menuDetail.updateBy}, + #{menuDetail.updateTime}, + + insert into menu_recipe_dishes - detail_id, - dishes_id, - price, - size_type, - supply_num, - sale_num, - surplus_num, - restrict_num, - sale_price, - recommend_flag, - sort_num, - revision, - create_by, - create_time, - update_by, - update_time, + detail_id, + dishes_id, + price, + size_type, + supply_num, + sale_num, + surplus_num, + restrict_num, + sale_price, + recommend_flag, + revision, + create_by, + create_time, + update_by, + update_time, values - - - #{menuDish.detailId}, - #{menuDish.dishesId}, - #{menuDish.price}, - #{menuDish.sizeType}, - #{menuDish.supplyNum}, - #{menuDish.saleNum}, - #{menuDish.surplusNum}, - #{menuDish.restrictNum}, - #{menuDish.salePrice}, - #{menuDish.recommendFlag}, - #{menuDish.sortNum}, - #{menuDish.revision}, - #{menuDish.createBy}, - #{menuDish.createTime}, - #{menuDish.updateBy}, - #{menuDish.updateTime}, - + + #{menuDish.detailId}, + #{menuDish.dishesId}, + #{menuDish.price}, + #{menuDish.sizeType}, + #{menuDish.supplyNum}, + #{menuDish.saleNum}, + #{menuDish.surplusNum}, + #{menuDish.restrictNum}, + #{menuDish.salePrice}, + #{menuDish.recommendFlag}, + #{menuDish.revision}, + #{menuDish.createBy}, + #{menuDish.createTime}, + #{menuDish.updateBy}, + #{menuDish.updateTime}, + @@ -1063,5 +1061,209 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN device_bind b on a.device_id = b.device_id where b.canteen_id = #{canteenId} and b.stall_id = #{stallId} + + + + + + + + + + + + + +