h5周菜谱
This commit is contained in:
parent
83c20f2bc4
commit
705d15794c
|
|
@ -78,7 +78,7 @@ public interface CookRecipeDetailMapper {
|
||||||
|
|
||||||
List<CookRecipeDetail> getByRecipeIdAndDatesAndIntervalId(@Param("recipeId") Long recipeId, @Param("dateList") Set<LocalDate> dateList, @Param("mealtimeType") Long mealtimeType);
|
List<CookRecipeDetail> getByRecipeIdAndDatesAndIntervalId(@Param("recipeId") Long recipeId, @Param("dateList") Set<LocalDate> dateList, @Param("mealtimeType") Long mealtimeType);
|
||||||
|
|
||||||
List<CookRecipeDetail> getCookRecipeDetailsByApplyDateAndRecipeIds(@Param("recipeIdList") List<Long> recipeIdList, @Param("applyDate") LocalDate applyDate);
|
List<CookRecipeDetail> getCookRecipeDetailsByApplyDateAndRecipeIds(@Param("recipeIdList") List<Long> recipeIdList, @Param("applyDate") String applyDate);
|
||||||
|
|
||||||
List<CookRecipeDetail> getCookRecipeDetailsByDetailTypeAndRecipeIds(@Param("recipeIdList") List<Long> recipeIdList);
|
List<CookRecipeDetail> getCookRecipeDetailsByDetailTypeAndRecipeIds(@Param("recipeIdList") List<Long> recipeIdList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.canteen.core.cook.service.impl;
|
package com.bonus.canteen.core.cook.service.impl;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
@ -54,6 +55,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class CookRecipeServiceImpl implements ICookRecipeService {
|
public class CookRecipeServiceImpl implements ICookRecipeService {
|
||||||
|
private static final String YYYY_MM_DD = "yyyy-MM-dd";
|
||||||
@Autowired
|
@Autowired
|
||||||
private CookRecipeMapper cookRecipeMapper;
|
private CookRecipeMapper cookRecipeMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -527,7 +529,8 @@ public class CookRecipeServiceImpl implements ICookRecipeService {
|
||||||
public synchronized void generateRecipe(List<Long> inputRecipeIdList, LocalDate applyDate) {
|
public synchronized void generateRecipe(List<Long> inputRecipeIdList, LocalDate applyDate) {
|
||||||
if (!ObjectUtil.isEmpty(inputRecipeIdList) && !ObjectUtil.isEmpty(applyDate)) {
|
if (!ObjectUtil.isEmpty(inputRecipeIdList) && !ObjectUtil.isEmpty(applyDate)) {
|
||||||
List<Long> recipeIdList = new ArrayList(inputRecipeIdList);
|
List<Long> recipeIdList = new ArrayList(inputRecipeIdList);
|
||||||
List<CookRecipeDetail> cookRecipeDetails = cookRecipeDetailMapper.getCookRecipeDetailsByApplyDateAndRecipeIds(recipeIdList, applyDate);
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(YYYY_MM_DD);
|
||||||
|
List<CookRecipeDetail> cookRecipeDetails = cookRecipeDetailMapper.getCookRecipeDetailsByApplyDateAndRecipeIds(recipeIdList, applyDate.format(formatter));
|
||||||
Map<Long, Long> recipeDetailContMap = cookRecipeDetails.stream().collect(Collectors.groupingBy(CookRecipeDetail::getRecipeId, Collectors.counting()));
|
Map<Long, Long> recipeDetailContMap = cookRecipeDetails.stream().collect(Collectors.groupingBy(CookRecipeDetail::getRecipeId, Collectors.counting()));
|
||||||
recipeIdList.removeAll(recipeDetailContMap.keySet());
|
recipeIdList.removeAll(recipeDetailContMap.keySet());
|
||||||
if (!ObjectUtil.isEmpty(recipeIdList)) {
|
if (!ObjectUtil.isEmpty(recipeIdList)) {
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="getCookRecipeDetailsByApplyDateAndRecipeIds" resultMap="CookRecipeDetailResult">
|
<select id="getCookRecipeDetailsByApplyDateAndRecipeIds" resultMap="CookRecipeDetailResult">
|
||||||
<include refid="selectCookRecipeDetailVo"/>
|
<include refid="selectCookRecipeDetailVo"/>
|
||||||
where apply_date = ${applyDate} and recipe_id in
|
where apply_date = #{applyDate} and recipe_id in
|
||||||
<foreach item="recipeId" collection="recipeIdList" open="(" separator="," close=")">
|
<foreach item="recipeId" collection="recipeIdList" open="(" separator="," close=")">
|
||||||
#{recipeId}
|
#{recipeId}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue