package com.weaver.seconddev.interfaces.easoa;

import java.lang.*;

import org.apache.axis2.kernel.http.HTTPConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.weaver.verupgrade.general.BaseBean;

/**
 * EAS007电子档案凭证号修改流程
 */
public class CallSieOAVoucherService extends BaseBean {

    private static final org.slf4j.Logger logger_89eeb72f = LoggerFactory.getLogger(CallSieOAVoucherService.class);

    String url = "";

    public CallSieOAVoucherService(String url) {
        this.url = url;
    }

    /**
     * @param list
     * @return
     * @throws Exception
     */
    public String[] syncVoucherInfo(SieOaVoucherServiceStub.SieOaVoucherDO param) throws Exception {
        logger_89eeb72f.error(String.valueOf("CallSieOAVoucherService excute start ------------------------"));
        String[] resultArray = new String[2];
        BaseBean basebean = new BaseBean();
        try {
            SieOaVoucherServiceStub.SieOaVoucherService input = new SieOaVoucherServiceStub.SieOaVoucherService();
            SieOaVoucherServiceStub.SieOaVoucherSynchronization info = new SieOaVoucherServiceStub.SieOaVoucherSynchronization();
            info.setSieOaVoucherDO(param);
            input.setSieOaVoucherSynchronization(info);
            SieOaVoucherServiceStub stub = new SieOaVoucherServiceStub(url);
            stub._getServiceClient().getOptions().setProperty("__CHUNKED__", Boolean.FALSE);
            stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(300000);
            stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,300000);
            stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,300000);
            SieOaVoucherServiceStub.SieOaVoucherServiceResponse response = stub.sieOaVoucherService(input);
            logger_89eeb72f.error(String.valueOf("------- do webservice success -------"));
            SieOaVoucherServiceStub.ResultInfoOA resultInfo = response.get_return();
            resultArray[0] = resultInfo.getISTAT();
            resultArray[1] = resultInfo.getMESSAGE();
            logger_89eeb72f.error(String.valueOf("do syncVoucherInfo webservice：[state : " + resultArray[0] + "][message : " + resultArray[1] + "]"));
            logger_89eeb72f.error(String.valueOf("CallSieOAVoucherService excute success syncVoucherInfo------------------------"));
        } catch (Exception e) {
            logger_89eeb72f.error(String.valueOf("syncVoucherInfo error:" + e.getMessage()));
            resultArray[0] = "E";
            resultArray[1] = e.getMessage();
        }
        return resultArray;
    }
}
