package cn.superdesk.uniorder.dubbo.consumer.operationCenter.accounting;

import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.security.JwtUtil;
import cn.superdesk.uniorder.common.security.dto.LoginSysUser;
import cn.superdesk.uniorder.dto.param.operationCenter.order.OperationCenterOrderParam;
import cn.superdesk.uniorder.dto.vo.operationCenter.accounting.UnifiedAccountingOrderInfoVo;
import cn.superdesk.uniorder.dto.vo.operationCenter.order.OperationCenterOrderFormVo;
import cn.superdesk.uniorder.dubbo.facade.operationCenter.accounting.DubboUnifiedAccountingService;
import com.alibaba.dubbo.config.annotation.Reference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author : zx
 * @Create : 2023/4/27 15:46
 * Description :
 */
@Slf4j
@Component
public class UnifiedAccountingDubboService {
    @Reference(version = "1.0.1", timeout = 10000, retries = -1)
    private DubboUnifiedAccountingService dubboUnifiedAccountingService;

    public R<List<UnifiedAccountingOrderInfoVo>> getOrderGoodsList(OperationCenterOrderParam param) {
        return dubboUnifiedAccountingService.getOrderGoodsList(param);
    }

    public R<List<UnifiedAccountingOrderInfoVo>> getOrderCreditList(OperationCenterOrderParam param) {
        return dubboUnifiedAccountingService.getOrderCreditList(param);
    }

    /**
     * 导出入口不同，内部线路都一样
     */
    public R<String> importExcelOrderList(OperationCenterOrderParam param, String token) {
        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
        return dubboUnifiedAccountingService.importExcelOrderList(param, loginSysUser);
    }
}
