处理订单快递单号错误时重新发货
This commit is contained in:
@ -75,6 +75,14 @@ public interface YxStoreOrderService extends BaseService<YxStoreOrder>{
|
|||||||
*/
|
*/
|
||||||
void orderDelivery(String orderId,String deliveryId,String deliveryName,String deliveryType);
|
void orderDelivery(String orderId,String deliveryId,String deliveryName,String deliveryType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改快递单号
|
||||||
|
* @param orderId 单号
|
||||||
|
* @param deliveryId 快递单号
|
||||||
|
* @param deliveryName 快递公司code
|
||||||
|
* @param deliveryType 快递方式
|
||||||
|
*/
|
||||||
|
void updateDelivery(String orderId,String deliveryId,String deliveryName,String deliveryType);
|
||||||
/**
|
/**
|
||||||
* 修改订单价格
|
* 修改订单价格
|
||||||
* @param orderId 单号
|
* @param orderId 单号
|
||||||
|
@ -724,7 +724,7 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
throw new YshopException("订单状态错误");
|
throw new YshopException("订单状态错误");
|
||||||
}
|
}
|
||||||
|
|
||||||
YxExpress expressQueryVo = expressService.getById(Integer.valueOf(deliveryName));
|
YxExpress expressQueryVo = expressService.getOne(new LambdaQueryWrapper<YxExpress>().eq(YxExpress::getName,deliveryName));
|
||||||
if(ObjectUtil.isNull(expressQueryVo)) {
|
if(ObjectUtil.isNull(expressQueryVo)) {
|
||||||
throw new YshopException("请后台先添加快递公司");
|
throw new YshopException("请后台先添加快递公司");
|
||||||
}
|
}
|
||||||
@ -772,6 +772,42 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<StoreOrderMapper, Y
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改快递单号
|
||||||
|
* @param orderId 单号
|
||||||
|
* @param deliveryId 快递单号
|
||||||
|
* @param deliveryName 快递公司code
|
||||||
|
* @param deliveryType 快递方式
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void updateDelivery(String orderId,String deliveryId,String deliveryName,String deliveryType) {
|
||||||
|
YxStoreOrderQueryVo orderQueryVo = this.getOrderInfo(orderId,null);
|
||||||
|
if(ObjectUtil.isNull(orderQueryVo)) {
|
||||||
|
throw new YshopException("订单不存在");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!OrderInfoEnum.STATUS_1.getValue().equals(orderQueryVo.getStatus()) ||
|
||||||
|
OrderInfoEnum.PAY_STATUS_0.getValue().equals( orderQueryVo.getPaid())){
|
||||||
|
throw new YshopException("订单状态错误");
|
||||||
|
}
|
||||||
|
|
||||||
|
YxExpress expressQueryVo = expressService.getOne(new LambdaQueryWrapper<YxExpress>().eq(YxExpress::getName,deliveryName));
|
||||||
|
if(ObjectUtil.isNull(expressQueryVo)) {
|
||||||
|
throw new YshopException("请后台先添加快递公司");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
YxStoreOrder storeOrder = YxStoreOrder.builder()
|
||||||
|
.id(orderQueryVo.getId())
|
||||||
|
.deliveryId(deliveryId)
|
||||||
|
.deliveryName(expressQueryVo.getName())
|
||||||
|
.deliveryType(deliveryType)
|
||||||
|
.deliverySn(expressQueryVo.getCode())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
yxStoreOrderMapper.updateById(storeOrder);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改订单价格
|
* 修改订单价格
|
||||||
|
@ -211,6 +211,24 @@ public class StoreOrderController {
|
|||||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "修改快递单号")
|
||||||
|
@PutMapping(value = "/yxStoreOrder/updateDelivery")
|
||||||
|
@PreAuthorize("hasAnyAuthority('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
|
public ResponseEntity updateDelivery(@Validated @RequestBody YxStoreOrder resources) {
|
||||||
|
if (StrUtil.isBlank(resources.getDeliveryName())) {
|
||||||
|
throw new BadRequestException("请选择快递公司");
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(resources.getDeliveryId())) {
|
||||||
|
throw new BadRequestException("快递单号不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
yxStoreOrderService.updateDelivery(resources.getOrderId(),resources.getDeliveryId(),
|
||||||
|
resources.getDeliveryName(),resources.getDeliveryType());
|
||||||
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation(value = "订单核销")
|
@ApiOperation(value = "订单核销")
|
||||||
@PutMapping(value = "/yxStoreOrder/check")
|
@PutMapping(value = "/yxStoreOrder/check")
|
||||||
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
@PreAuthorize("hasAnyRole('admin','YXSTOREORDER_ALL','YXSTOREORDER_EDIT')")
|
||||||
|
Reference in New Issue
Block a user