diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java index d6a0848..a522791 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/service/impl/OrderInfoServiceImpl.java @@ -12,6 +12,8 @@ import com.bonus.canteen.core.account.service.IAccInfoService; import com.bonus.canteen.core.account.service.IAccTradeService; import com.bonus.canteen.core.account.service.IAccWalletInfoService; import com.bonus.canteen.core.account.utils.AccRedisUtils; +import com.bonus.canteen.core.alloc.domain.AllocStall; +import com.bonus.canteen.core.alloc.service.IAllocStallService; import com.bonus.canteen.core.common.utils.MqUtil; import com.bonus.canteen.core.common.utils.RedisUtil; import com.bonus.canteen.core.order.business.OrderBusiness; @@ -30,6 +32,7 @@ import com.bonus.canteen.core.user.domain.DeviceMqPersonalUpdateMessageDTO; import com.bonus.common.core.exception.ServiceException; import com.bonus.common.core.utils.DateUtils; import com.bonus.common.core.utils.StringUtils; +import com.bonus.common.houqin.constant.DelFlagEnum; import com.bonus.common.houqin.constant.SourceTypeEnum; import com.bonus.common.houqin.mq.constant.LeMqConstant; import com.bonus.common.houqin.utils.JacksonUtil; @@ -70,6 +73,8 @@ public class OrderInfoServiceImpl implements IOrderInfoService private OrderBusiness orderBusiness; @Autowired private IAccWalletInfoService accWalletInfoService; + @Autowired + private IAllocStallService allocStallService; /** * 查询订单 @@ -137,6 +142,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId()); accInfoService.checkAccStatus(accInfoVO); List canteenOrderInfoList = new OrderInfo().of(orderAddParam); + checkStallStatus(canteenOrderInfoList); checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount()); List orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList); try { @@ -161,6 +167,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService AccInfoDetailsVO accInfoVO = this.accInfoService.queryAccInfoByUserId(orderAddParam.getUserId()); accInfoService.checkAccStatus(accInfoVO); List canteenOrderInfoList = new OrderInfo().of(orderAddParam); + checkStallStatus(canteenOrderInfoList); checkDeviceOrderExisting(canteenOrderInfoList); checkOrdersTotalAmount(canteenOrderInfoList, orderAddParam.getRealAmount()); List orderInfoList = orderBusiness.orderPlaceHandler(canteenOrderInfoList); @@ -213,6 +220,25 @@ public class OrderInfoServiceImpl implements IOrderInfoService } } + private void checkStallStatus(List orderInfoList) { + if(CollUtil.isEmpty(orderInfoList)) { + throw new ServiceException("订单不能为空"); + } + for(OrderInfo orderInfo : orderInfoList) { + if(orderInfo.getIsOnline() == 1) { + AllocStall allocStall = allocStallService.selectAllocStallByStallId(orderInfo.getStallId()); + if(Objects.isNull(allocStall) || DelFlagEnum.DEL_TRUE.key().toString().equals(allocStall.getDelFlag())) { + throw new ServiceException("档口不存在"); + } + if(1 == allocStall.getBusinessState()) { + throw new ServiceException("档口已休息"); + } + + } + } + + } + @Override public void pay(Long orderId) { if(Objects.isNull(orderId) || orderId <= 0) {