订单详细

This commit is contained in:
2025-03-04 15:34:43 +08:00
parent 39c0e43ceb
commit 800dfd956d
4 changed files with 6 additions and 14 deletions

View File

@@ -44,7 +44,7 @@ public class AdminOrderController {
}
@GetMapping("/getOrderById")
public CzgResult<Map<String, Object>> getOrderById(Long orderId) {
public CzgResult<HistoryOrderVo> getOrderById(Long orderId) {
return orderInfoService.getOrderDetails(orderId);
}

View File

@@ -41,7 +41,7 @@ public class UserOrderController {
}
@GetMapping("/getOrderById")
public CzgResult<Map<String, Object>> getOrderById(Long orderId) {
public CzgResult<HistoryOrderVo> getOrderById(Long orderId) {
return orderInfoService.getOrderDetails(orderId);
}

View File

@@ -31,7 +31,7 @@ public interface OrderInfoService extends IService<OrderInfo> {
Page<OrderInfoVo> getOrderByPage(OrderInfoQueryDTO param);
CzgResult<Map<String, Object>> getOrderDetails(Long orderId);
CzgResult<HistoryOrderVo> getOrderDetails(Long orderId);
HistoryOrderVo historyOrder(Long orderId, String tableCode);

View File

@@ -130,15 +130,9 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
}
@Override
public CzgResult<Map<String, Object>> getOrderDetails(Long orderId) {
public CzgResult<HistoryOrderVo> getOrderDetails(Long orderId) {
AssertUtil.isNull(orderId, "订单id不能为空");
OrderInfo orderInfo = getById(orderId);
AssertUtil.isNull(orderInfo, "订单信息不存在");
List<OrderDetail> orderDetails = orderDetailService.queryChain().select().eq(OrderDetail::getOrderId, orderId).list();
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("orderInfo", orderInfo);
resultMap.put("orderDetails", orderDetails);
return CzgResult.success(resultMap);
return CzgResult.success(historyOrder(orderId, null));
}
@Override
@@ -156,8 +150,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
.oneAs(HistoryOrderVo.class);
} else {
historyOrderVo = getOneAs(new QueryWrapper()
.eq(OrderInfo::getId, orderId)
.eq(OrderInfo::getStatus, OrderStatusEnums.UNPAID.getCode()), HistoryOrderVo.class);
.eq(OrderInfo::getId, orderId), HistoryOrderVo.class);
}
if (historyOrderVo == null || historyOrderVo.getId() == null) {
return null;
@@ -173,7 +166,6 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
Integer placeNum = orderDetail.getPlaceNum();
// 检查 Map 中是否已经存在该 placeNum 对应的列表
resultMap.computeIfAbsent(placeNum.toString(), k -> new ArrayList<>()).add(orderDetail);
}
historyOrderVo.setDetailMap(resultMap);
return historyOrderVo;