package com.usoft.credit.rest.domain;

import com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse;
import com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest;
import com.usoft.credit.grpc.api.protobuf.GrpcQueryServiceGrpc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author liuam
 * @since 2018/8/7 0007 下午 14:31
 */
@Service
public class EnterPriseJsonDomain {

    @Autowired
    private GrpcQueryServiceGrpc.GrpcQueryServiceBlockingStub grpcQueryServiceBlockingStub;

    /**
     * 返回企业信用信息
     * @param request
     * @return
     * @throws Exception
     */
    public EnterpriseJsonResponse.Builder queryEn(EnterpriseQueryRequest request) throws Exception {
        EnterpriseJsonResponse response = grpcQueryServiceBlockingStub.queryEn(request);
        return response.toBuilder();
    }

}
