h5历史菜谱功能薪增
This commit is contained in:
parent
5d1ca83851
commit
796a91fa5d
|
|
@ -62,8 +62,12 @@ public class AppletRecipeH5Controller extends BaseController {
|
||||||
@PostMapping({"/detail"})
|
@PostMapping({"/detail"})
|
||||||
@ApiOperation("根据菜品id获取菜品详情")
|
@ApiOperation("根据菜品id获取菜品详情")
|
||||||
public AjaxResult getRecipeDetail(@RequestBody AppletDishesDetailDTO dto) {
|
public AjaxResult getRecipeDetail(@RequestBody AppletDishesDetailDTO dto) {
|
||||||
AppletDishesDetailVO dishesDetailVO = this.appletRecipeH5Service.getDishesDetailByDishesId(dto);
|
try {
|
||||||
return success(dishesDetailVO);
|
AppletDishesDetailVO dishesDetailVO = this.appletRecipeH5Service.getDishesDetailByDishesId(dto);
|
||||||
|
return success(dishesDetailVO);
|
||||||
|
}catch (Exception e) {
|
||||||
|
return AjaxResult.error(e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,4 +38,10 @@ public interface AppletRecipeH5Mapper {
|
||||||
|
|
||||||
@Select({"select md.dishes_name from menu_package_dishes mpd left join menu_dishes md on mpd.dishes_id = md.dishes_id where mpd.del_flag = 2 and mpd.package_id = #{dishesId}"})
|
@Select({"select md.dishes_name from menu_package_dishes mpd left join menu_dishes md on mpd.dishes_id = md.dishes_id where mpd.del_flag = 2 and mpd.package_id = #{dishesId}"})
|
||||||
List<String> selectDishesName(@Param("dishesId") Long dishesId);
|
List<String> selectDishesName(@Param("dishesId") Long dishesId);
|
||||||
|
|
||||||
|
List<Long> selectWeekRecipeIdHistory(@Param("recipeIdList") List<Long> recipeId, @Param("effIdSet") Set<Long> effIdSet, @Param("applyDate") LocalDate applyDate);
|
||||||
|
|
||||||
|
List<Long> getRecipeIdListByRecipeId(@Param("recipeId") Long recipeId);
|
||||||
|
|
||||||
|
String getBingTimeByRecipeId(@Param("recipeId") Long recipeId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,18 +141,55 @@ public class AppletRecipeH5ServiceImpl extends ServiceImpl<MenuRecipeMapper, Men
|
||||||
@Override
|
@Override
|
||||||
public List<AppletWeekRecipeVO> getWeekRecipeDetailList(AppletWeekRecipeDTO content) {
|
public List<AppletWeekRecipeVO> getWeekRecipeDetailList(AppletWeekRecipeDTO content) {
|
||||||
List<Long> recipeIdList = Lists.newArrayList();
|
List<Long> recipeIdList = Lists.newArrayList();
|
||||||
|
Set<Long> effIdSet = this.getShopstallIdListByCustId(content.getCustId(), false);
|
||||||
if (ObjectUtil.isNull(content.getRecipeId())) {
|
if (ObjectUtil.isNull(content.getRecipeId())) {
|
||||||
Set<Long> effIdSet = this.getShopstallIdListByCustId(content.getCustId(), false);
|
|
||||||
if (ObjectUtil.isEmpty(effIdSet)) {
|
if (ObjectUtil.isEmpty(effIdSet)) {
|
||||||
effIdSet = Sets.newTreeSet();
|
effIdSet = Sets.newTreeSet();
|
||||||
effIdSet.add(-1L);
|
effIdSet.add(-1L);
|
||||||
}
|
}
|
||||||
recipeIdList = this.appletRecipeH5Mapper.selectWeekRecipeId(content.getRecipeId(), (Set) effIdSet);
|
recipeIdList = this.appletRecipeH5Mapper.selectWeekRecipeId(content.getRecipeId(), (Set) effIdSet);
|
||||||
|
|
||||||
if (ObjectUtil.isEmpty(recipeIdList)) {
|
if (ObjectUtil.isEmpty(recipeIdList)) {
|
||||||
return Lists.newArrayList();
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
recipeIdList.add(content.getRecipeId());
|
LocalDate applyDate = content.getApplyDate();
|
||||||
|
LocalDate now = LocalDate.now();
|
||||||
|
if (applyDate.isBefore(now)) {
|
||||||
|
System.out.println("applyDate 早于当前日期");
|
||||||
|
//获取当前菜谱绑定的日期
|
||||||
|
String bindTime = this.appletRecipeH5Mapper.getBingTimeByRecipeId(content.getRecipeId());
|
||||||
|
if(bindTime !=null){
|
||||||
|
bindTime = bindTime.substring(0,10);
|
||||||
|
LocalDate bindDate = LocalDate.parse(bindTime);
|
||||||
|
System.out.println("Parsed date and time: " + bindDate);
|
||||||
|
if(bindDate.isBefore(applyDate)){
|
||||||
|
System.out.println("绑定日期早于查询历史信息日期");
|
||||||
|
recipeIdList = this.appletRecipeH5Mapper.selectWeekRecipeId(content.getRecipeId(), effIdSet);
|
||||||
|
}else{
|
||||||
|
System.out.println("绑定日期迟于查询历史信息日期");
|
||||||
|
|
||||||
|
List<Long> repeIdList = this.appletRecipeH5Mapper.getRecipeIdListByRecipeId(content.getRecipeId());
|
||||||
|
|
||||||
|
recipeIdList = this.appletRecipeH5Mapper.selectWeekRecipeIdHistory(repeIdList, null,applyDate);
|
||||||
|
if(recipeIdList == null || recipeIdList.size() == 0){
|
||||||
|
recipeIdList.add(content.getRecipeId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
throw new ServiceException("菜谱档口绑定日期为空");
|
||||||
|
}
|
||||||
|
} else if (applyDate.isAfter(now)) {
|
||||||
|
System.out.println("applyDate 晚于当前日期");
|
||||||
|
recipeIdList = this.appletRecipeH5Mapper.selectWeekRecipeId(content.getRecipeId(), null);
|
||||||
|
} else {
|
||||||
|
System.out.println("applyDate 等于当前日期");
|
||||||
|
recipeIdList = this.appletRecipeH5Mapper.selectWeekRecipeId(content.getRecipeId(), null);
|
||||||
|
}
|
||||||
|
if(recipeIdList == null || recipeIdList.size() == 0){
|
||||||
|
throw new ServiceException("本档口没有更早的历史菜谱记录");
|
||||||
|
// recipeIdList.add(content.getRecipeId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.generateRecipe(recipeIdList, content.getApplyDate());
|
this.generateRecipe(recipeIdList, content.getApplyDate());
|
||||||
|
|
|
||||||
|
|
@ -118,9 +118,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<!-- <foreach collection="effIdSet" item="effId" separator="," open="(" close=")">-->
|
<!-- <foreach collection="effIdSet" item="effId" separator="," open="(" close=")">-->
|
||||||
<!-- #{effId}-->
|
<!-- #{effId}-->
|
||||||
<!-- </foreach>-->
|
<!-- </foreach>-->
|
||||||
<!-- <if test="recipeId != null">-->
|
<if test="recipeId != null">
|
||||||
<!-- and mar.recipe_id = #{recipeId}-->
|
and mar.recipe_id = #{recipeId}
|
||||||
<!-- </if>-->
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -215,4 +215,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
and mmd.del_flag = 2
|
and mmd.del_flag = 2
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectWeekRecipeIdHistory" resultType="java.lang.Long">
|
||||||
|
select
|
||||||
|
mar.recipe_id
|
||||||
|
from
|
||||||
|
menu_app_recipe_history mar
|
||||||
|
left join menu_recipe mr on mar.recipe_id = mr.recipe_id
|
||||||
|
where
|
||||||
|
bind_type = 3
|
||||||
|
<!-- and mr.eff_id in-->
|
||||||
|
<!-- <foreach collection="effIdSet" item="effId" separator="," open="(" close=")">-->
|
||||||
|
<!-- #{effId}-->
|
||||||
|
<!-- </foreach>-->
|
||||||
|
and mar.recipe_id in
|
||||||
|
<foreach collection="recipeIdList" item="repiceId" separator="," open="(" close=")">
|
||||||
|
#{repiceId}
|
||||||
|
</foreach>
|
||||||
|
and #{applyDate} >= DATE(mar.bind_time)
|
||||||
|
ORDER BY bind_time desc limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getRecipeIdListByRecipeId" resultType="java.lang.Long">
|
||||||
|
select recipe_id from menu_recipe where stall_id = (select stall_id from menu_recipe where recipe_id = #{recipeId})
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getBingTimeByRecipeId" resultType="java.lang.String">
|
||||||
|
select bind_time from menu_app_recipe where recipe_id = #{recipeId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue