This commit is contained in:
dzc committed 2026-04-10 14:37:22 +08:00
commit df32a862af
20 files changed
+711 -5

No files matched your search

@@ -22,6 +22,7 @@ import com.bsd.pjcloud.canteen.api.feign.RemoteOnlineCanteenSpuService;
import com.bsd.pjcloud.canteen.dto.CanteenSpuUpdateStockReqDTO;
import com.bsd.pjcloud.canteen.dto.delivery.CanteenDeliveryCartItemDTO;
import com.bsd.pjcloud.canteen.dto.delivery.CanteenDeliveryOrderSyncDTO;
import com.bsd.pjcloud.canteen.vo.app.OnlineSpuChoiceGroupsVO;
import com.bsd.pjcloud.common.core.constant.CacheConstants;
import com.bsd.pjcloud.common.core.constant.CommonConstants;
import com.bsd.pjcloud.common.core.constant.CommonRoleConstant;
@@ -150,6 +151,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
private final MiniAlipayService miniAlipayService;
private final HardOrderAddressService hardOrderAddressService;
private final RemoteOnlineCanteenSpuService remoteOnlineCanteenSpuService;
private final RemoteMchService remoteMchService;
private final RemoteMchPickUpService remoteMchPickUpService;
private final RemoteCodeUseService remoteCodeUseService;
@@ -601,6 +603,7 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
// 查询用户
UserInfo userDetail = userService.getInnerByUserId(dto.getUserId()).getData();
if (ObjectUtil.isEmpty(userDetail)) throw new RuntimeException("用户不存在不存在");
// 如果是预约判断是否在预约时间段内
boolean inReserveTime = isInReserveTime(dto.getApptId());
if (!inReserveTime) throw new RuntimeException("不在预约时间段内");
@@ -613,12 +616,20 @@ public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrder
// 查询父订单
HardParentCarEntity parentCar = hardCarService.getParentCarById(dto.getCarParentId());
if (ObjectUtil.isEmpty(parentCar)) throw new RuntimeException("购物车不存在");
//效验是否有选择必选品
R<OnlineSpuChoiceGroupsVO> choiceGroups = remoteOnlineCanteenSpuService.getChoiceGroups(String.valueOf(parentCar.getMerchantId()));
if (!choiceGroups.isOk()){
throw new RuntimeException("未选择必选菜品");
}
// 查询商户
MchManageVo hardManager = remoteMchService.getById(parentCar.getMerchantId()).getData();
if (ObjectUtil.isEmpty(hardManager)) throw new RuntimeException("商户不存在");
// 查询父购物车
List<HardCarEntity> carList = hardCarService.getByParentCarId(dto.getCarParentId());
if (ObjectUtil.isEmpty(carList)) throw new RuntimeException("购物车不存在");
Integer balance = wallet.getBalance();
int carPrice = (int) carList.stream().mapToLong(HardCarEntity::getTotalPrice).sum();
int totalPrice = carPrice;