package com.weaver.seconddev.interfaces.easoa;

import  com.weaver.seconddev.interfaces.easoa.DelayDateSyncServiceStub.DelayDateSyncService;
import  com.weaver.seconddev.interfaces.easoa.DelayDateSyncServiceStub.DelayDateSyncServiceResponse;
import  com.weaver.seconddev.interfaces.easoa.DelayDateSyncServiceStub.SyncDelayDateInfo;
import com.weaver.common.i18n.tool.util.I18nContextUtil;
import com.weaver.seconddev.interfaces.prop.ConfigProp;
import org.apache.axis2.kernel.http.HTTPConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import java.lang.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.weaver.verupgrade.general.BaseBean;
import com.weaver.verupgrade.general.Util;
import org.springframework.stereotype.Component;

@Component
public class DelayDateService extends BaseBean {

    private static final org.slf4j.Logger logger_cf6b843f = LoggerFactory.getLogger(DelayDateService.class);
    @Autowired
    private ConfigProp configProp;
    public String[] callService(SyncDelayDateInfo param) {
//        String url = Util.null2String(I18nContextUtilcus.getBean(Environment.class).getProperty("hteasoasync.DelayDateSync")).trim();
        String url = configProp.getDelayDateSync();
        logger_cf6b843f.error("url = " + url );
        String[] str = new String[2];
        try {
            logger_cf6b843f.error(String.valueOf("DelayDateService--start"));
            DelayDateSyncServiceStub stub = new DelayDateSyncServiceStub(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);
            DelayDateSyncService req = new DelayDateSyncService();
            req.setSyncDelayDateInfo(param);
            DelayDateSyncServiceResponse res = stub.delayDateSyncService(req);
            logger_cf6b843f.error(String.valueOf("res"));
            DelayDateSyncServiceStub.ResultInfo resultInfo = res.get_return();
            str[0] = resultInfo.getIstat();
            str[1] = resultInfo.getSrmsage();
            logger_cf6b843f.error(String.valueOf("DelayDateService--end--" + str[0] + "|" + str[1]));
        } catch (Exception e) {
            str[0] = "E";
            str[1] = e.toString();
            logger_cf6b843f.error(String.valueOf("DelayDateService--error:" + e.toString()));
        }
        return str;
    }
}
