|
@@ -30,7 +30,6 @@ import com.yami.shop.utils.CullenUtils;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -59,6 +58,7 @@ public class OrderController {
|
|
|
private final ProductService productService;
|
|
private final ProductService productService;
|
|
|
private final SkuService skuService;
|
|
private final SkuService skuService;
|
|
|
private final UserService userService;
|
|
private final UserService userService;
|
|
|
|
|
+ private final DeliveryService deliveryService;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -140,11 +140,11 @@ public class OrderController {
|
|
|
@ApiOperation("发货")
|
|
@ApiOperation("发货")
|
|
|
@PutMapping("/delivery")
|
|
@PutMapping("/delivery")
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public ResponseEntity<Void> delivery(@RequestBody DeliveryOrderParam deliveryOrderParam) {
|
|
|
|
|
|
|
+ public R<Void> delivery(@RequestBody DeliveryOrderParam deliveryOrderParam) {
|
|
|
Order order = orderService.getOne(new LambdaUpdateWrapper<Order>().eq(Order::getOrderNumber, deliveryOrderParam.getOrderNumber()));
|
|
Order order = orderService.getOne(new LambdaUpdateWrapper<Order>().eq(Order::getOrderNumber, deliveryOrderParam.getOrderNumber()));
|
|
|
if (!Objects.equals(order.getHbOrderStatus(), OrderStatus.PADYED.value()) && Objects.equals(order.getDvyType(), DvyType.FETCH.value())){
|
|
if (!Objects.equals(order.getHbOrderStatus(), OrderStatus.PADYED.value()) && Objects.equals(order.getDvyType(), DvyType.FETCH.value())){
|
|
|
throw new GlobalException("订单不处于待入库状态,无法进行入库");
|
|
throw new GlobalException("订单不处于待入库状态,无法进行入库");
|
|
|
- }else if (!Objects.equals(order.getHbOrderStatus(), OrderStatus.PADYED.value())){
|
|
|
|
|
|
|
+ }else if (!Objects.equals(order.getHbOrderStatus(), 1)){
|
|
|
throw new GlobalException("订单不处于待发货状态,无法进行发货");
|
|
throw new GlobalException("订单不处于待发货状态,无法进行发货");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -154,12 +154,13 @@ public class OrderController {
|
|
|
CullenUtils.validateDataThrowException(orderItemService.refundIngCount(orderItem.getOrderItemId())!=0,"该订单存在售后中商品,请处理后发货..."));
|
|
CullenUtils.validateDataThrowException(orderItemService.refundIngCount(orderItem.getOrderItemId())!=0,"该订单存在售后中商品,请处理后发货..."));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ //Delivery delivery = deliveryService.getById(deliveryOrderParam.getDvyId());
|
|
|
Order orderParam = new Order();
|
|
Order orderParam = new Order();
|
|
|
if (deliveryOrderParam.getDvyType().equals(2)){
|
|
if (deliveryOrderParam.getDvyType().equals(2)){
|
|
|
orderParam.setOrderId(order.getOrderId());
|
|
orderParam.setOrderId(order.getOrderId());
|
|
|
orderParam.setDvyType(2);
|
|
orderParam.setDvyType(2);
|
|
|
orderService.updateById(orderParam);
|
|
orderService.updateById(orderParam);
|
|
|
- return ResponseEntity.ok().build();
|
|
|
|
|
|
|
+ return R.SUCCESS();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
orderParam.setOrderId(order.getOrderId());
|
|
orderParam.setOrderId(order.getOrderId());
|
|
@@ -178,7 +179,7 @@ public class OrderController {
|
|
|
productService.removeProductCacheByProdId(orderItem.getProdId());
|
|
productService.removeProductCacheByProdId(orderItem.getProdId());
|
|
|
skuService.removeSkuCacheBySkuId(orderItem.getSkuId(),orderItem.getProdId());
|
|
skuService.removeSkuCacheBySkuId(orderItem.getSkuId(),orderItem.getProdId());
|
|
|
}
|
|
}
|
|
|
- return ResponseEntity.ok().build();
|
|
|
|
|
|
|
+ return R.SUCCESS();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|