package com.weaver.seconddev.interfaces.srmoa;

import java.rmi.RemoteException;
import java.lang.*;

import com.weaver.seconddev.interfaces.prop.ConfigProp;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.weaver.verupgrade.general.BaseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class CallSrmServices extends BaseBean {

	private static final org.slf4j.Logger logger_a535240a = LoggerFactory.getLogger(CallSrmServices.class);

	private OaSrmVendorPropmtionServiceServiceStub.OaInputVendor oainputvendor = null;
	@Autowired
	private  ConfigProp configProp;
	public void setOainputvendor(OaSrmVendorPropmtionServiceServiceStub.OaInputVendor oasrm) {
		this.oainputvendor = oasrm;
	}

	public String[] call() throws RemoteException {
//                    this(configurationContext, Prop.getPropValue("htsrmoasync","gyszznew"));
		String[] rtInfo = new String[3];
		try{
		logger_a535240a.error(String.valueOf("调用接口------------------------开始"));
		String url = configProp.getGyszznew();
		logger_a535240a.error(String.valueOf("url-----------------------"+ url));
		OaSrmVendorPropmtionServiceServiceStub stub = new OaSrmVendorPropmtionServiceServiceStub(url);
		// 设置传入参数
		OaSrmVendorPropmtionServiceServiceStub.OA_SRM_VENDOR_PROPMTIONE createRequest = new OaSrmVendorPropmtionServiceServiceStub.OA_SRM_VENDOR_PROPMTIONE();
		OaSrmVendorPropmtionServiceServiceStub.OA_SRM_VENDOR_PROPMTION oasrmvendor = new OaSrmVendorPropmtionServiceServiceStub.OA_SRM_VENDOR_PROPMTION();
		oasrmvendor.setInputTab(oainputvendor);
		createRequest.setOA_SRM_VENDOR_PROPMTION(oasrmvendor);
		OaSrmVendorPropmtionServiceServiceStub.OA_SRM_VENDOR_PROPMTIONResponseE resp = null;
		resp = stub.oA_SRM_VENDOR_PROPMTION(createRequest);
//		resp = stub.OA_SRM_VENDOR_PROPMTION(createRequest);
		logger_a535240a.error(String.valueOf("调用接口------------------------完成"));
		OaSrmVendorPropmtionServiceServiceStub.OaOutputVendor oaoutvendor = resp.getOA_SRM_VENDOR_PROPMTIONResponse().getOutputTab();
		// 封装返回
		logger_a535240a.error(oainputvendor.getRequestId() + " result:" + oaoutvendor.getIstat() + " " + oaoutvendor.getSrmsage());
		rtInfo[0] = oaoutvendor.getRequestId();
		rtInfo[1] = oaoutvendor.getIstat();
		rtInfo[2] = oaoutvendor.getSrmsage();
		}catch(Exception e ){
			e.printStackTrace();
			logger_a535240a.error(" CallSrmServices Exception " + e );
		}
		return rtInfo;
	}
}
