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

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.order.OperationCenterOrderDetailsVo;
import cn.superdesk.uniorder.dto.vo.operationCenter.order.OperationCenterOrderFormVo;
import cn.superdesk.uniorder.dto.vo.operationCenter.order.OperationCenterOrderVo;
import cn.superdesk.uniorder.dubbo.facade.operationCenter.order.DubboOperationCenterOrderService;
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/3/24 16:34
 * Description : 运营中心 订单管理页面 service层-dubbo
 */
@Slf4j
@Component
public class OperationCenterOrderDubboService {
    @Reference(version = "1.0.0", timeout = 30000, retries = -1)
    private DubboOperationCenterOrderService dubboOperationCenterOrderService;

    public R<OperationCenterOrderFormVo> list(OperationCenterOrderParam param) {
        return dubboOperationCenterOrderService.list(param);
    }

    public R<OperationCenterOrderDetailsVo> getOperationCenterOrderDetails(Long id) {
        return dubboOperationCenterOrderService.getOperationCenterOrderDetails(id);
    }

    public String exportExcelOperationCenterOrder(OperationCenterOrderParam param, String token) {
        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
        return dubboOperationCenterOrderService.exportExcelOperationCenterOrder(param,loginSysUser);
    }

    public String exportExcelOperationCenterOrderId(Long id, String token) {
        LoginSysUser loginSysUser = JwtUtil.getLoginSysUser(token);
        OperationCenterOrderParam param =new OperationCenterOrderParam();
        param.setId(id);
        return dubboOperationCenterOrderService.exportExcelOperationCenterOrder(param,loginSysUser);
    }
}
