package net.northking.cctp.testbug.feign.server;

import net.northking.cctp.common.exception.PlatformRuntimeException;
import net.northking.cctp.common.http.ResultWrapper;
import net.northking.cctp.testbug.constants.TestBugError;
import net.northking.cctp.testbug.dto.cases.CltBusinessNoQueryDto;
import net.northking.cctp.testbug.feign.client.CasesFeignClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import java.util.List;

/**
 * @author: puchao.ma
 * @date: 2021/10/18 16:17
 */
@Configuration
public class CasesFeignServer {

    /**
     * 日志
     */
    private final static Logger logger = LoggerFactory.getLogger(CasesFeignServer.class);

    @Autowired
    private CasesFeignClient casesFeignClient;

    public Long genBusinessNoList(CltBusinessNoQueryDto dto) {
        ResultWrapper<List<Long>> wrapper;
        try {
            wrapper = casesFeignClient.genBusinessNoList(dto);
        } catch (Exception e) {
            throw new PlatformRuntimeException(TestBugError.GET_BUG_ORDER_FAILED,e);
        }
        return wrapper.getData().get(0);
    }

}
