This commit is contained in:
wangjinlei
2023-11-01 16:50:56 +08:00
parent 5a15ba417c
commit eff309f8cb
12 changed files with 90 additions and 7 deletions

View File

@@ -260,7 +260,6 @@ public class BuyOrderController {
totalPrice = totalPrice.add(getShoppingAmount(buyOrder));
String orderSn = IdWorker.getTimeId().substring(0, 32);
buyOrder.setOrderSn(orderSn);
// buyOrder.setPaymentDate(new Date());//这个是支付时间
QueryWrapper<UserAddress> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("id", buyOrder.getAddressId());
UserAddress userAddress = userAddressService.getOne(queryWrapper);
@@ -272,6 +271,7 @@ public class BuyOrderController {
buyOrder.setAddress(userAddress.getDetailAddress());
buyOrderService.save(buyOrder);
//解决购物车相关问题
for (BuyOrderProduct buyOrderProduct : buyOrderProductList) {
buyOrderProduct.setOrderId(buyOrder.getOrderId());
if (Constants.BUY_TYPE_CART.equals(buyOrder.getBuyType())) {
@@ -458,6 +458,12 @@ public class BuyOrderController {
paymentInfo.setBuyOrderId(Integer.valueOf(buyOrderEntity.getProductId()));
paymentInfo.setTotalAmount(buyOrderEntity.getRealMoney());
wxpayService.prepay(paymentInfo);
rabbitTemplate.convertAndSend(
DelayQueueConfig.ORDER_TO_BE_PAY_EXCHANGE,
DelayQueueConfig.ORDER_TO_BE_PAY_ROUTING_KEY,
buyOrder.getOrderId(),
messagePostProcessor()
);
return R.ok().put("orderSn", timeId);
}