package com.sckw.report.service;

import com.sckw.core.exception.SystemException;
import com.sckw.order.api.feign.TradeOrderApi;
import com.sckw.order.api.model.OrderExecutionDisplayVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单执行情况看板（聚合订单服务）
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class KwOrderExecutionService {

    private final TradeOrderApi tradeOrderApi;

    /**
     * 已下单未结算订单执行列表（前端超过 9 条自行向上轮播）。
     */
    public List<OrderExecutionDisplayVo> orderExecutionDisplay() {
        try {
            return tradeOrderApi.orderExecutionDisplay();
        } catch (Exception e) {
            log.error("调用订单服务「订单执行情况」失败", e);
            throw new SystemException("获取订单执行情况失败：" + e.getMessage());
        }
    }
}
