feat(新增): 生成订单,获取订单详情

This commit is contained in:
bunny 2024-04-11 10:50:12 +08:00
parent e5e132a9cb
commit abdd193d2d
2 changed files with 16 additions and 7 deletions

View File

@ -2,6 +2,7 @@ package com.atguigu.ssyx.order.mapper;
import com.atguigu.ssyx.model.order.OrderInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
/**
* <p>
@ -11,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @author bunny
* @since 2024-04-10
*/
@Repository
public interface OrderInfoMapper extends BaseMapper<OrderInfo> {
}

View File

@ -7,11 +7,14 @@ import com.atguigu.ssyx.common.constant.RedisConst;
import com.atguigu.ssyx.common.context.BaseContext;
import com.atguigu.ssyx.model.order.CartInfo;
import com.atguigu.ssyx.model.order.OrderInfo;
import com.atguigu.ssyx.model.order.OrderItem;
import com.atguigu.ssyx.order.mapper.OrderInfoMapper;
import com.atguigu.ssyx.order.service.OrderInfoService;
import com.atguigu.ssyx.order.service.OrderItemService;
import com.atguigu.ssyx.vo.order.OrderConfirmVo;
import com.atguigu.ssyx.vo.order.OrderSubmitVo;
import com.atguigu.ssyx.vo.user.LeaderAddressVo;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
@ -31,6 +34,10 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
private ActivityFeignClient activityFeignClient;
@Autowired
private RedisTemplate<String, Object> redisTemplate;
@Autowired
private OrderInfoMapper orderInfoMapper;
@Autowired
private OrderItemService orderItemService;
/**
* * 确认订单
@ -63,18 +70,18 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
*/
@Override
public OrderInfo getOrderInfoById(Long orderId) {
return null;
OrderInfo orderInfo = orderInfoMapper.selectById(orderId);
orderInfo.getParam().put("orderStatusName", orderInfo.getOrderStatus().getComment());
List<OrderItem> orderItemList = orderItemService.list(Wrappers.<OrderItem>lambdaQuery().eq(OrderItem::getOrderId, orderInfo.getId()));
orderInfo.setOrderItemList(orderItemList);
return orderInfo;
}
/**
* * 生成订单
*
* @param vo 订单提交信息
* @param userId 用户ID
* @return 订单编号
*/
@Override
public Long submitOrder(OrderSubmitVo vo, Long userId) {
return null;
public Long submitOrder(OrderSubmitVo orderSubmitVo, Long userId) {
return System.currentTimeMillis();
}
}