jsk getReserveMealCanteenList 修正

This commit is contained in:
skjia 2025-02-20 15:14:34 +08:00
parent ac0a15597c
commit 7fa5b3d685
4 changed files with 79 additions and 7 deletions

View File

@ -10,6 +10,7 @@ import com.bonus.core.allocation.canteen.service.AllocAreaService;
import com.bonus.core.allocation.canteen.service.AllocCanteenService; import com.bonus.core.allocation.canteen.service.AllocCanteenService;
import com.bonus.core.allocation.canteen.service.AllocMealLineService; import com.bonus.core.allocation.canteen.service.AllocMealLineService;
import com.bonus.core.allocation.canteen.vo.AllocAreaFullNameVO; import com.bonus.core.allocation.canteen.vo.AllocAreaFullNameVO;
import com.bonus.core.menu.vo.AppletReserveCanteenVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -145,9 +146,9 @@ public class AllocCanteenApi {
// return this.allocCanteenService.checkCanteenIfReserve(canteenId, stallId); // return this.allocCanteenService.checkCanteenIfReserve(canteenId, stallId);
// } // }
// //
// public void checkAndDelReserveCanteen(List<AppletReserveCanteenVO> reserveCanteenList) { public void checkAndDelReserveCanteen(List<AppletReserveCanteenVO> reserveCanteenList) {
// this.allocCanteenService.checkAndDelReserveCanteen(reserveCanteenList); this.allocCanteenService.checkAndDelReserveCanteen(reserveCanteenList);
// } }
// //
// public boolean checkCanteenBookExist() { // public boolean checkCanteenBookExist() {
// long bookNum = this.allocCanteenService.count((Wrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(AllocCanteen.class).eq(AllocCanteen::getIfBook, LeConstants.COMMON_YES)).eq(AllocCanteen::getIfDel, LeConstants.COMMON_NO)); // long bookNum = this.allocCanteenService.count((Wrapper)((LambdaQueryWrapper)Wrappers.lambdaQuery(AllocCanteen.class).eq(AllocCanteen::getIfBook, LeConstants.COMMON_YES)).eq(AllocCanteen::getIfDel, LeConstants.COMMON_NO));

View File

@ -3,6 +3,7 @@ package com.bonus.core.allocation.canteen.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.bonus.core.allocation.canteen.model.AllocCanteen; import com.bonus.core.allocation.canteen.model.AllocCanteen;
import com.bonus.core.allocation.canteen.vo.AllocCanteenStallVO; import com.bonus.core.allocation.canteen.vo.AllocCanteenStallVO;
import com.bonus.core.menu.vo.AppletReserveCanteenVO;
import java.util.List; import java.util.List;
@ -12,4 +13,6 @@ public interface AllocCanteenService extends IService<AllocCanteen> {
List<Long> getCanteenIdListByAreaIdList(List<Long> areaIdList); List<Long> getCanteenIdListByAreaIdList(List<Long> areaIdList);
List<AllocCanteenStallVO> listAllCanteenStall(); List<AllocCanteenStallVO> listAllCanteenStall();
void checkAndDelReserveCanteen(List<AppletReserveCanteenVO> reserveCanteenList);
} }

View File

@ -1,16 +1,22 @@
package com.bonus.core.allocation.canteen.service.impl; package com.bonus.core.allocation.canteen.service.impl;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bonus.constant.LeConstants; import com.bonus.constant.LeConstants;
import com.bonus.core.allocation.api.AllocPayMetadataApi; import com.bonus.core.allocation.api.AllocPayMetadataApi;
import com.bonus.core.allocation.canteen.mapper.AllocCanteenMapper; import com.bonus.core.allocation.canteen.mapper.AllocCanteenMapper;
import com.bonus.core.allocation.canteen.mapper.AllocStallMapper; import com.bonus.core.allocation.canteen.mapper.AllocStallMapper;
import com.bonus.core.allocation.canteen.model.AllocCanteen; import com.bonus.core.allocation.canteen.model.AllocCanteen;
import com.bonus.core.allocation.canteen.model.AllocStall;
import com.bonus.core.allocation.canteen.service.AllocAreaService; import com.bonus.core.allocation.canteen.service.AllocAreaService;
import com.bonus.core.allocation.canteen.service.AllocCanteenService; import com.bonus.core.allocation.canteen.service.AllocCanteenService;
import com.bonus.core.allocation.canteen.vo.AllocCanteenStallVO; import com.bonus.core.allocation.canteen.vo.AllocCanteenStallVO;
import com.bonus.core.common.enums.AllocCanteenTypeEnum; import com.bonus.core.common.enums.AllocCanteenTypeEnum;
import com.bonus.core.menu.vo.AppletReserveCanteenVO;
import com.bonus.core.menu.vo.AppletReserveStallVO;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -18,10 +24,8 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.HashSet; import java.util.stream.Collectors;
import java.util.Iterator;
import java.util.List;
@Service @Service
public class AllocCanteenServiceImpl extends ServiceImpl<AllocCanteenMapper, AllocCanteen> implements AllocCanteenService { public class AllocCanteenServiceImpl extends ServiceImpl<AllocCanteenMapper, AllocCanteen> implements AllocCanteenService {
@ -61,6 +65,7 @@ public class AllocCanteenServiceImpl extends ServiceImpl<AllocCanteenMapper, All
} }
} }
@Override
public List<AllocCanteenStallVO> listAllCanteenStall() { public List<AllocCanteenStallVO> listAllCanteenStall() {
List<AllocCanteenStallVO> canteenList = ((AllocCanteenMapper)this.baseMapper).listAllCanteenStall(LeConstants.COMMON_NO, AllocCanteenTypeEnum.CANTEEN.getKey()); List<AllocCanteenStallVO> canteenList = ((AllocCanteenMapper)this.baseMapper).listAllCanteenStall(LeConstants.COMMON_NO, AllocCanteenTypeEnum.CANTEEN.getKey());
if (CollUtil.isEmpty(canteenList)) { if (CollUtil.isEmpty(canteenList)) {
@ -72,4 +77,60 @@ public class AllocCanteenServiceImpl extends ServiceImpl<AllocCanteenMapper, All
return canteenList; return canteenList;
} }
} }
@Override
public void checkAndDelReserveCanteen(List<AppletReserveCanteenVO> reserveCanteenList) {
List<Long> canteenIdList = new ArrayList();
List<Long> stallIdList = new ArrayList();
Iterator var4 = reserveCanteenList.iterator();
while(true) {
AppletReserveCanteenVO reserveCanteen;
do {
if (!var4.hasNext()) {
List<AllocCanteen> allocCanteenList = this.list((Wrapper<AllocCanteen>) Wrappers.lambdaQuery(AllocCanteen.class).select(AllocCanteen::getCanteenId, AllocCanteen::getIfReserve).in(AllocCanteen::getCanteenId, canteenIdList));
Map<Long, Integer> allocCanteenMap = (Map)allocCanteenList.stream().collect(Collectors.toMap(AllocCanteen::getCanteenId, AllocCanteen::getIfReserve));
Map<Long, Integer> allocStallMap = new HashMap();
if (CollUtil.isNotEmpty(stallIdList)) {
List<AllocStall> allocStallList = this.allocStallMapper.selectList((Wrapper<AllocStall>)Wrappers.lambdaQuery(AllocStall.class).select(AllocStall::getStallId, AllocStall::getIfReserve).in(AllocStall::getStallId, stallIdList));
allocStallMap = (Map)allocStallList.stream().collect(Collectors.toMap(AllocStall::getStallId, AllocStall::getIfReserve));
}
Iterator<AppletReserveCanteenVO> canteenIterator = reserveCanteenList.iterator();
while(true) {
while(canteenIterator.hasNext()) {
AppletReserveCanteenVO reserveCanteenVO = (AppletReserveCanteenVO)canteenIterator.next();
Integer canteenIfReserve = (Integer)allocCanteenMap.get(reserveCanteenVO.getCanteenId());
if (!LeConstants.COMMON_YES.equals(canteenIfReserve)) {
canteenIterator.remove();
} else if (CollUtil.isNotEmpty(reserveCanteenVO.getStallList())) {
Iterator<AppletReserveStallVO> stallIterator = reserveCanteenVO.getStallList().iterator();
while(stallIterator.hasNext()) {
AppletReserveStallVO reserveStallVO = (AppletReserveStallVO)stallIterator.next();
Integer stallIfReserve = (Integer)((Map)allocStallMap).get(reserveStallVO.getStallId());
if (!LeConstants.COMMON_YES.equals(stallIfReserve)) {
stallIterator.remove();
}
}
}
}
return;
}
}
reserveCanteen = (AppletReserveCanteenVO)var4.next();
canteenIdList.add(reserveCanteen.getCanteenId());
} while(!CollUtil.isNotEmpty(reserveCanteen.getStallList()));
Iterator var6 = reserveCanteen.getStallList().iterator();
while(var6.hasNext()) {
AppletReserveStallVO reserveStall = (AppletReserveStallVO)var6.next();
stallIdList.add(reserveStall.getStallId());
}
}
}
} }

View File

@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.exception.ServiceException;
import com.bonus.constant.DelFlagEnum; import com.bonus.constant.DelFlagEnum;
import com.bonus.core.allocation.api.AllocCanteenApi;
import com.bonus.core.allocation.api.AllocDeliveryApi; import com.bonus.core.allocation.api.AllocDeliveryApi;
import com.bonus.core.allocation.api.AllocMealtimeApi; import com.bonus.core.allocation.api.AllocMealtimeApi;
import com.bonus.core.allocation.canteen.model.AllocDeliveryCostModel; import com.bonus.core.allocation.canteen.model.AllocDeliveryCostModel;
@ -101,6 +102,9 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
@Autowired @Autowired
private TransactionDefinition transactionDefinition; private TransactionDefinition transactionDefinition;
@Autowired
private AllocCanteenApi allocCanteenApi;
@Override @Override
public List<AppletWeekCanteenVO> getWeekMealList(AppletWeekCanteenDTO content) { public List<AppletWeekCanteenVO> getWeekMealList(AppletWeekCanteenDTO content) {
Set<Long> effIdSet = this.getShopstallIdListByCustId(content.getCustId(), false); Set<Long> effIdSet = this.getShopstallIdListByCustId(content.getCustId(), false);
@ -179,10 +183,12 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
effIdSet = Sets.newTreeSet(); effIdSet = Sets.newTreeSet();
((Set)effIdSet).add(-1L); ((Set)effIdSet).add(-1L);
} }
List<AppletReserveCanteenVO> resultList = this.menuAppRecipeMapper.selectReserveMealCanteenList((Set)effIdSet); List<AppletReserveCanteenVO> resultList = this.menuAppRecipeMapper.selectReserveMealCanteenList((Set)effIdSet);
if (ObjectUtil.isEmpty(resultList)) { if (ObjectUtil.isEmpty(resultList)) {
return resultList; return resultList;
} else { } else {
this.allocCanteenApi.checkAndDelReserveCanteen(resultList);
List<Long> stallIdList = (List)resultList.stream().flatMap((canteen) -> { List<Long> stallIdList = (List)resultList.stream().flatMap((canteen) -> {
return canteen.getStallList().stream().map(AppletReserveStallVO::getStallId); return canteen.getStallList().stream().map(AppletReserveStallVO::getStallId);
}).collect(Collectors.toList()); }).collect(Collectors.toList());
@ -461,6 +467,7 @@ public class MenuRecipeServiceImpl extends ServiceImpl<MenuRecipeMapper, MenuRec
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@Override
public Set<Long> changeSurplusNum(List<MenuRecipeChangeSurplusNum> changeSurplusNumList, Long custId, Integer mealtimeType, public Set<Long> changeSurplusNum(List<MenuRecipeChangeSurplusNum> changeSurplusNumList, Long custId, Integer mealtimeType,
LocalDate ordGoodsDate) { LocalDate ordGoodsDate) {
this.checkChangeSurplusNum(changeSurplusNumList, ordGoodsDate, mealtimeType); this.checkChangeSurplusNum(changeSurplusNumList, ordGoodsDate, mealtimeType);