|
|
@@ -108,9 +108,10 @@ public class OrderInfoService {
|
|
|
OrderInfo orderInfo = new OrderInfo();
|
|
|
BeanUtil.copyProperties(userOrderDTO, orderInfo);
|
|
|
BeanUtil.copyProperties(cart, orderInfo);
|
|
|
- orderInfo.setMerchantStatus(MerchantStatus.NOT_RECEIVED);
|
|
|
+ //orderInfo.setMerchantStatus(MerchantStatus.NOT_RECEIVED);
|
|
|
orderInfo.setCancel(false);
|
|
|
orderInfo.setOrderTime(now);
|
|
|
+ orderInfo.setStatus(OrderStatus.UNPAID);
|
|
|
orderInfo.setEnabled(true);
|
|
|
// orderInfo.setGoodsAmount(cart.getRealAmount().subtract(cart.getDeliveryAmount()));
|
|
|
|
|
|
@@ -222,6 +223,8 @@ public class OrderInfoService {
|
|
|
OrderInfo orderInfo = orderInfoRepo.findById(orderId).orElseThrow(new BusinessException("无订单"));
|
|
|
//设置状态已支付
|
|
|
orderInfo.setStatus(OrderStatus.PAID);
|
|
|
+ //设置商家未接单
|
|
|
+ orderInfo.setMerchantStatus(MerchantStatus.NOT_RECEIVED);
|
|
|
orderInfoRepo.save(orderInfo);
|
|
|
|
|
|
//商家
|
|
|
@@ -246,6 +249,9 @@ public class OrderInfoService {
|
|
|
*/
|
|
|
public OrderInfo merReceiveOrder(Long orderId, Boolean pass) {
|
|
|
OrderInfo orderInfo = orderInfoRepo.findById(orderId).orElseThrow(new BusinessException("无订单"));
|
|
|
+ if (!OrderStatus.PAID.equals(orderInfo.getStatus())) {
|
|
|
+ throw new BusinessException("订单状态错误");
|
|
|
+ }
|
|
|
if (pass) {
|
|
|
orderInfo.setMerchantStatus(MerchantStatus.RECEIVED);
|
|
|
orderInfo.setRiderStatus(RiderStatus.NOT_RECEIVED);
|
|
|
@@ -364,31 +370,6 @@ public class OrderInfoService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 按用户ID查出用户/商家/骑手订单
|
|
|
- *
|
|
|
- * @param userId 登录的ID
|
|
|
- * @return 订单列表
|
|
|
- */
|
|
|
- public List<OrderInfo> my(Long userId) {
|
|
|
- User user = userRepo.findById(userId).orElseThrow(new BusinessException("无用户"));
|
|
|
- if (user.getIdentity() == null) {
|
|
|
- throw new BusinessException("身份错误");
|
|
|
- }
|
|
|
- switch (user.getIdentity()) {
|
|
|
- case USER:
|
|
|
- return orderInfoRepo.findAllByUserId(userId);
|
|
|
- case MERCHANT:
|
|
|
- Long merchantId = merchantService.findMerchantId(userId);
|
|
|
- return orderInfoRepo.findAllByMerchantId(merchantId);
|
|
|
- case RIDER:
|
|
|
- Rider rider = riderRepo.findByUserId(userId).orElseThrow(new BusinessException("无用户"));
|
|
|
- return orderInfoRepo.findAllByRiderId(rider.getId());
|
|
|
- }
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/*
|
|
|
用户取消订单
|
|
|
*/
|