diff --git a/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/shop/AdminOrderController.java b/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/shop/AdminOrderController.java index 0642f38..ccfbb29 100644 --- a/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/shop/AdminOrderController.java +++ b/waynboot-admin-api/src/main/java/com/wayn/admin/api/controller/shop/AdminOrderController.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.wayn.admin.framework.config.properties.ExpressProperties; import com.wayn.common.base.BaseController; import com.wayn.common.core.domain.shop.Order; +import com.wayn.common.core.domain.vo.ShipVO; import com.wayn.common.core.service.shop.IAdminOrderService; import com.wayn.common.util.R; import org.springframework.beans.factory.annotation.Autowired; @@ -48,9 +49,9 @@ public class AdminOrderController extends BaseController { return R.success().add("data", expressProperties.getVendors()); } - @PostMapping("ship/{orderId}") - public R ship(@PathVariable Long orderId) { - return iAdminOrderService.ship(orderId); + @PostMapping("ship") + public R ship(ShipVO shipVO) { + return iAdminOrderService.ship(shipVO); } } diff --git a/waynboot-common/src/main/java/com/wayn/common/core/domain/vo/ShipVO.java b/waynboot-common/src/main/java/com/wayn/common/core/domain/vo/ShipVO.java new file mode 100644 index 0000000..2c484d5 --- /dev/null +++ b/waynboot-common/src/main/java/com/wayn/common/core/domain/vo/ShipVO.java @@ -0,0 +1,25 @@ +package com.wayn.common.core.domain.vo; + +import lombok.Data; + +/** + * 订单发货VO + */ +@Data +public class ShipVO { + + /** + * 订单ID + */ + private Long orderId; + + /** + * 发货渠道 + */ + private String shipChannel; + + /** + * 发货编号 + */ + private String shipSn; +} diff --git a/waynboot-common/src/main/java/com/wayn/common/core/service/shop/IAdminOrderService.java b/waynboot-common/src/main/java/com/wayn/common/core/service/shop/IAdminOrderService.java index 3f6c1a0..a8a5fb5 100644 --- a/waynboot-common/src/main/java/com/wayn/common/core/service/shop/IAdminOrderService.java +++ b/waynboot-common/src/main/java/com/wayn/common/core/service/shop/IAdminOrderService.java @@ -3,6 +3,7 @@ package com.wayn.common.core.service.shop; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.wayn.common.core.domain.shop.Order; +import com.wayn.common.core.domain.vo.ShipVO; import com.wayn.common.util.R; /** @@ -47,10 +48,10 @@ public interface IAdminOrderService extends IService { * 1. 检测当前订单是否能够发货 * 2. 设置订单发货状态 * - * @param orderId 订单信息,{ orderId:xxx, shipSn: xxx, shipChannel: xxx } + * @param shipVO 订单信息,{ orderId:xxx, shipSn: xxx, shipChannel: xxx } * @return r */ - R ship(Long orderId); + R ship(ShipVO shipVO); /** * 获取订单详情(包含订单信息,订单商品信息,用户信息) diff --git a/waynboot-common/src/main/java/com/wayn/common/core/service/shop/impl/AdminOrderServiceImpl.java b/waynboot-common/src/main/java/com/wayn/common/core/service/shop/impl/AdminOrderServiceImpl.java index f46c60c..50518ff 100644 --- a/waynboot-common/src/main/java/com/wayn/common/core/service/shop/impl/AdminOrderServiceImpl.java +++ b/waynboot-common/src/main/java/com/wayn/common/core/service/shop/impl/AdminOrderServiceImpl.java @@ -9,6 +9,7 @@ import com.wayn.common.core.domain.shop.Order; import com.wayn.common.core.domain.shop.OrderGoods; import com.wayn.common.core.domain.tool.MailConfig; import com.wayn.common.core.domain.vo.SendMailVO; +import com.wayn.common.core.domain.vo.ShipVO; import com.wayn.common.core.mapper.shop.AdminOrderMapper; import com.wayn.common.core.service.shop.IAdminOrderService; import com.wayn.common.core.service.shop.IGoodsProductService; @@ -143,9 +144,12 @@ public class AdminOrderServiceImpl extends ServiceImpl } @Override - public R ship(Long orderId) { + public R ship(ShipVO shipVO) { + Long orderId = shipVO.getOrderId(); + String shipChannel = shipVO.getShipChannel(); + String shipSn = shipVO.getShipSn(); Order order = getById(orderId); - if (order == null) { + if (order == null || StringUtils.isEmpty(shipChannel) || StringUtils.isEmpty(shipSn)) { return R.error(); } @@ -155,8 +159,8 @@ public class AdminOrderServiceImpl extends ServiceImpl } order.setOrderStatus(OrderUtil.STATUS_SHIP); - order.setShipSn("xxxx"); - order.setShipChannel("申通"); + order.setShipSn(shipSn); + order.setShipChannel(shipChannel); order.setShipTime(LocalDateTime.now()); order.setUpdateTime(new Date()); updateById(order);