mall + trade:

1、获取订单结算信息,增加门店自提编号
This commit is contained in:
YunaiV 2023-07-01 00:26:09 +08:00
parent 0a20f7fe9e
commit 6206dd94e2
6 changed files with 27 additions and 7 deletions

View File

@ -66,9 +66,9 @@ public class AppTradeOrderController {
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建订单") @Operation(summary = "创建订单")
@PreAuthenticated @PreAuthenticated
public CommonResult<Long> createOrder(@RequestBody AppTradeOrderCreateReqVO createReqVO) { public CommonResult<AppTradeOrderCreateRespVO> createOrder(@RequestBody AppTradeOrderCreateReqVO createReqVO) {
Long orderId = tradeOrderService.createOrder(getLoginUserId(), getClientIP(), createReqVO); TradeOrderDO order = tradeOrderService.createOrder(getLoginUserId(), getClientIP(), createReqVO);
return success(orderId); return success(new AppTradeOrderCreateRespVO().setId(order.getId()).setPayOrderId(order.getPayOrderId()));
} }
@PostMapping("/update-paid") @PostMapping("/update-paid")

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "用户 App - 交易订单创建 Response VO")
@Data
public class AppTradeOrderCreateRespVO {
@Schema(description = "订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "支付订单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long payOrderId;
}

View File

@ -43,6 +43,8 @@ public class AppTradeOrderSettlementReqVO {
@Schema(description = "收件地址编号", example = "1") @Schema(description = "收件地址编号", example = "1")
private Long addressId; private Long addressId;
@Schema(description = "自提门店编号", example = "1088")
private Long pickupStoreId;
@Schema(description = "收件人名称", example = "芋艿") // 选择门店自提时该字段为联系人名 @Schema(description = "收件人名称", example = "芋艿") // 选择门店自提时该字段为联系人名
private String receiverName; private String receiverName;
@Schema(description = "收件人手机", example = "15601691300") // 选择门店自提时该字段为联系人手机 @Schema(description = "收件人手机", example = "15601691300") // 选择门店自提时该字段为联系人手机

View File

@ -197,6 +197,7 @@ public class TradeOrderDO extends BaseDO {
*/ */
private LocalDateTime deliveryTime; private LocalDateTime deliveryTime;
// TODO @芋艿pickUpStoreId;
/** /**
* 收货时间 * 收货时间
*/ */

View File

@ -40,9 +40,9 @@ public interface TradeOrderService {
* @param userId 登录用户 * @param userId 登录用户
* @param userIp 用户 IP 地址 * @param userIp 用户 IP 地址
* @param createReqVO 创建交易订单请求模型 * @param createReqVO 创建交易订单请求模型
* @return 交易订单的编号 * @return 交易订单的
*/ */
Long createOrder(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO); TradeOrderDO createOrder(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO);
/** /**
* 更新交易订单已支付 * 更新交易订单已支付

View File

@ -152,7 +152,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Long createOrder(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO) { public TradeOrderDO createOrder(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO) {
// 1. 用户收件地址的校验 // 1. 用户收件地址的校验
AddressRespDTO address = validateAddress(userId, createReqVO.getAddressId()); AddressRespDTO address = validateAddress(userId, createReqVO.getAddressId());
@ -167,7 +167,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
// 订单创建完后的逻辑 // 订单创建完后的逻辑
afterCreateTradeOrder(userId, createReqVO, order, orderItems, calculateRespBO); afterCreateTradeOrder(userId, createReqVO, order, orderItems, calculateRespBO);
// TODO @LeeYan9: 是可以思考下, 订单的营销优惠记录, 应该记录在哪里, 微信讨论起来! // TODO @LeeYan9: 是可以思考下, 订单的营销优惠记录, 应该记录在哪里, 微信讨论起来!
return order.getId(); return order;
} }
/** /**
@ -250,6 +250,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
// 更新到交易单上 // 更新到交易单上
tradeOrderMapper.updateById(new TradeOrderDO().setId(order.getId()).setPayOrderId(payOrderId)); tradeOrderMapper.updateById(new TradeOrderDO().setId(order.getId()).setPayOrderId(payOrderId));
order.setPayOrderId(payOrderId);
} }
@Override @Override