// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name:   CallEasServices.java
package com.weaver.seconddev.interfaces.easoa;

import com.weaver.seconddev.interfaces.prop.ConfigProp;
import org.apache.axis2.kernel.http.HTTPConstants;

import org.apache.axis2.transport.http.impl.httpclient4.HttpTransportPropertiesImpl;
import org.springframework.beans.factory.annotation.Autowired;
import java.lang.*;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class CallEasServices  {
    @Autowired
    private ConfigProp configProp; //注入

    private static final org.slf4j.Logger logger_814f159c = LoggerFactory.getLogger(CallEasServices.class);

    // private static String url = "http://10.6.2.35:7001/easws/services/PayControlService?wsdl";
    // private static String url = "http://10.6.34.83:8080/easws/services/PayControlService?wsdl";
//    private String url = Util.null2String(I18nContextUtilcus.getBean(Environment.class).getProperty("hteasoasync.url")).trim();

//    private String url =configProp.getWeaver_secondev_hteasoasync_url();
    // private String url = "http://sappod.hengtong.com:50000/XISOAPAdapter/MessageServlet?senderParty=&senderService=BS_OA&receiverParty=&receiverService=&interface=SI_HTOAPayControl_OUT&interfaceNamespace=http://hengtong.com/OA/HTOAPayControl";
//    public CallEasServices() {
//    }



    /**
     * 获取上线公司信息 提交OA流程requestId：1362923
     * @return
     * @throws Exception
     */
    public PayControlServiceStub.CompanyInfo[] queryOnlineCompanyList() throws Exception {
        logger_814f159c.error(String.valueOf("CallEasServices excute start queryOnlineCompanyList------------------------"));
        PayControlServiceStub easStub = null;
        PayControlServiceStub.CompanyInfo[] company = null;
        try {
            String url =configProp.getWeaver_secondev_hteasoasync_url();
            easStub = new PayControlServiceStub(url);
            easStub._getServiceClient().getOptions().setProperty("__CHUNKED__", Boolean.FALSE);
            easStub._getServiceClient().getOptions().setTimeOutInMilliSeconds(300000);
            easStub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,300000);
            easStub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,300000);
            HttpTransportPropertiesImpl.Authenticator auth = new HttpTransportPropertiesImpl.Authenticator();
            auth.setUsername("pouser");
            auth.setPassword("654321");
//            HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
//            auth.setUsername("pouser");
//            auth.setPassword("654321");
            easStub._getServiceClient().getOptions().setProperty(org.apache.axis2.kernel.http.HTTPConstants.AUTHENTICATE,auth);
            PayControlServiceStub.QueryOnlineCompanyList list = new PayControlServiceStub.QueryOnlineCompanyList();
            list.setCompanyCode("");

            PayControlServiceStub.QueryOnlineCompanyListResponse response = easStub.queryOnlineCompanyList(list);
            PayControlServiceStub.ResultInfo info = response.get_return();
            // S:成功  F：失败
            String result = info.getResult();
            //
            String ErrorMessage = info.getErrorMessage();
            logger_814f159c.error(String.valueOf("queryOnlineCompanyList 返回值 result=" + result + ",ErrorMessage=" + ErrorMessage + "------------------------"));
            company = info.getCompanyList();
            logger_814f159c.error(String.valueOf("CallEasServices excute success queryOnlineCompanyList------------------------"));
        } catch (Exception e) {
            logger_814f159c.error(String.valueOf("queryOnlineCompanyList error:" + e.getMessage()));
        }
        return company;
    }

    /**
     * 获取供应商信息
     * @return
     * @throws Exception
     */
    public PayControlServiceStub.VendorInfo[] queryVendorInfoList() throws Exception {
        logger_814f159c.error(String.valueOf("CallEasServices excute start queryVendorInfoList------------------------"));
        PayControlServiceStub easStub = null;
        PayControlServiceStub.VendorInfo[] vendor = null;
        try {
            String url =configProp.getWeaver_secondev_hteasoasync_url();
            easStub = new PayControlServiceStub(url);
            easStub._getServiceClient().getOptions().setProperty("__CHUNKED__", Boolean.FALSE);
            easStub._getServiceClient().getOptions().setTimeOutInMilliSeconds(300000);
            easStub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,300000);
            easStub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,300000);
            HttpTransportPropertiesImpl.Authenticator auth = new HttpTransportPropertiesImpl.Authenticator();
            auth.setUsername("pouser");
            auth.setPassword("654321");
            easStub._getServiceClient().getOptions().setProperty(org.apache.axis2.kernel.http.HTTPConstants.AUTHENTICATE,auth);
            PayControlServiceStub.QueryVendorInfoList list = new PayControlServiceStub.QueryVendorInfoList();
            list.setVendorCode("");
            PayControlServiceStub.QueryVendorInfoListResponse response = easStub.queryVendorInfoList(list);
            PayControlServiceStub.ResultInfo info = response.get_return();
            // S:成功  F：失败
            String result = info.getResult();
            //
            String ErrorMessage = info.getErrorMessage();
            vendor = info.getVendorList();
            logger_814f159c.error(String.valueOf("queryVendorInfoList 返回值 result=" + result + ",ErrorMessage=" + ErrorMessage + "------------------------"));
            logger_814f159c.error(String.valueOf("CallEasServices excute success queryVendorInfoList------------------------"));
        } catch (Exception e) {
            logger_814f159c.error(String.valueOf("queryVendorInfoList error:" + e.getMessage()));
        }
        return vendor;
    }

    /**
     * 报账单有效性校验
     * @return
     * @throws Exception
     */
    public String[] querySourceBoeNum(String[] bzdh, String[] lx, String[] money) throws Exception {
        logger_814f159c.error(String.valueOf("CallEasServices excute start querySourceBoeNum------------------------"));
        PayControlServiceStub easStub = null;
        String[] resultArray = new String[2];
        logger_814f159c.error(String.valueOf("querySourceBoeNum bzdh:" + bzdh == null ? "" : bzdh.length));
        logger_814f159c.error(String.valueOf("querySourceBoeNum lx:" + lx == null ? "" : lx.length));
        logger_814f159c.error(String.valueOf("querySourceBoeNum money" + money == null ? "" : money.length));
        try {
            String url =configProp.getWeaver_secondev_hteasoasync_url();
            easStub = new PayControlServiceStub(url);
            easStub._getServiceClient().getOptions().setProperty("__CHUNKED__", Boolean.FALSE);
            HttpTransportPropertiesImpl.Authenticator auth = new HttpTransportPropertiesImpl.Authenticator();
            auth.setUsername("pouser");
            auth.setPassword("654321");
            easStub._getServiceClient().getOptions().setProperty(org.apache.axis2.kernel.http.HTTPConstants.AUTHENTICATE,auth);
            PayControlServiceStub.CheckBoeNumParamInfo paraminfo = new PayControlServiceStub.CheckBoeNumParamInfo();
            paraminfo.setSourceBoeNum(bzdh);
            paraminfo.setParamAttribute1(lx);
            paraminfo.setParamAttribute2(money);
            PayControlServiceStub.QuerySourceBoeNum boeNum = new PayControlServiceStub.QuerySourceBoeNum();
            boeNum.setParam(paraminfo);
            PayControlServiceStub.QuerySourceBoeNumResponse response = easStub.querySourceBoeNum(boeNum);
            PayControlServiceStub.ResultInfo info = response.get_return();
            // S:成功  F：失败
            String result = info.getResult();
            //
            String ErrorMessage = info.getErrorMessage();
            logger_814f159c.error(String.valueOf("querySourceBoeNum 返回值 result=" + result + ",ErrorMessage=" + ErrorMessage + "------------------------"));
            resultArray[0] = result;
            resultArray[1] = ErrorMessage;
            logger_814f159c.error(String.valueOf("CallEasServices excute success querySourceBoeNum------------------------"));
        } catch (Exception e) {
            logger_814f159c.error(String.valueOf("querySourceBoeNum error:" + e.getMessage()));
            resultArray[0] = "E";
            resultArray[1] = e.getMessage();
        }
        return resultArray;
    }

    /**
     * 付款卡控
     * @param oprationtype 操作类型：Y冻结、N解冻
     * @param controlobj 控制对象：（1供应商、2报账单）
     * @param requestId 流程ID
     * @param creator 流程申请人 姓名
     * @param gysid 供应商ID 数组
     * @param bzdh 报账单号 数组
     * @param companycode 公司编码 数组
     * @param money 冻结金额 数组
     * @return
     * @throws Exception
     */
    public String[] doPayControl(String oprationtype, String controlobj, String requestId, String lcbh, String creator, String reason, String system_flag, String[] gysid, String[] bzdh, String[] companycode, String[] money, String[] sfhmd, String[] lxArray) throws Exception {
        logger_814f159c.error(String.valueOf("CallEasServices excute start doPayControl------------------------"));
        PayControlServiceStub easStub = null;
        String[] resultArray = new String[2];
        logger_814f159c.error(String.valueOf("doPayControl oprationtype:" + oprationtype));
        logger_814f159c.error(String.valueOf("doPayControl controlobj:" + controlobj));
        logger_814f159c.error(String.valueOf("doPayControl requestId:" + requestId));
        logger_814f159c.error(String.valueOf("doPayControl lcbh:" + lcbh));
        logger_814f159c.error(String.valueOf("doPayControl creator:" + creator));
        logger_814f159c.error(String.valueOf("doPayControl reason:" + reason));
        logger_814f159c.error(String.valueOf("doPayControl system_flag:" + system_flag));
        logger_814f159c.error(String.valueOf("doPayControl gysid:" + gysid == null ? "" : gysid.length));
        logger_814f159c.error(String.valueOf("doPayControl bzdh:" + bzdh == null ? "" : bzdh.length));
        logger_814f159c.error(String.valueOf("doPayControl companycode:" + companycode == null ? "" : companycode.length));
        logger_814f159c.error(String.valueOf("doPayControl money" + money == null ? "" : money.length));
        logger_814f159c.error(String.valueOf("doPayControl sfhmd" + sfhmd == null ? "" : sfhmd.length));
        logger_814f159c.error(String.valueOf("doPayControl lxArray" + lxArray == null ? "" : lxArray.length));
        try {
            String url =configProp.getWeaver_secondev_hteasoasync_url();
            easStub = new PayControlServiceStub(url);
            easStub._getServiceClient().getOptions().setProperty("__CHUNKED__", Boolean.FALSE);
            easStub._getServiceClient().getOptions().setTimeOutInMilliSeconds(300000);
            easStub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT,300000);
            easStub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT,300000);
            HttpTransportPropertiesImpl.Authenticator auth = new HttpTransportPropertiesImpl.Authenticator();
            auth.setUsername("pouser");
            auth.setPassword("654321");
            easStub._getServiceClient().getOptions().setProperty(org.apache.axis2.kernel.http.HTTPConstants.AUTHENTICATE,auth);
            int num = 0;
            if (gysid != null) {
                num = gysid.length;
            }
            if (bzdh != null) {
                num = bzdh.length;
            }
            PayControlServiceStub.SiePayControlLModel[] lmodels = new PayControlServiceStub.SiePayControlLModel[num];
            for (int i = 0; i < num; i++) {
                PayControlServiceStub.SiePayControlLModel lModel = new PayControlServiceStub.SiePayControlLModel();
                // 公司编码
                lModel.setCompanyCode(companycode[i]);
                // 供应商ID
                lModel.setVendorId(gysid[i]);
                // 报账单号
                lModel.setBoeNumber(bzdh[i]);
                // 冻结金额
                lModel.setControlAmount(money[i]);
                // 是否黑名单
                lModel.setIf_black(sfhmd[i]);
                // 冻结类型
                lModel.setControlType(lxArray[i]);
                lmodels[i] = lModel;
            }
            PayControlServiceStub.SiePayControlHModel hModel = new PayControlServiceStub.SiePayControlHModel();
            // 流程ID
            hModel.setFlowId(requestId);
            // 流程编号
            hModel.setFlowCode(lcbh);
            // 控制对象：（1供应商、2报账单）
            hModel.setControlObject(controlobj);
            // 操作类型：Y冻结、N解冻
            hModel.setOperationType(oprationtype);
            // 流程申请人 姓名
            hModel.setOperator(creator);
            // 申请原因
            hModel.setReason(reason);
            // 系统标识
            hModel.setSystem_flag(system_flag);
            hModel.setSiePayControlL(lmodels);
            PayControlServiceStub.DoPayControl doPayControl = new PayControlServiceStub.DoPayControl();
            doPayControl.setSiePayControlH(hModel);
            PayControlServiceStub.DoPayControlResponse response = easStub.doPayControl(doPayControl);
            PayControlServiceStub.ResultInfo info = response.get_return();
            // S:成功  F：失败
            String result = info.getResult();
            //
            String ErrorMessage = info.getErrorMessage();
            logger_814f159c.error(String.valueOf("doPayControl 返回值 result=" + result + ",ErrorMessage=" + ErrorMessage + "------------------------"));
            resultArray[0] = result;
            resultArray[1] = ErrorMessage;
            logger_814f159c.error(String.valueOf("CallEasServices excute success doPayControl------------------------"));
        } catch (Exception e) {
            logger_814f159c.error(String.valueOf("doPayControl error:" + e.getMessage()));
            resultArray[0] = "E";
            resultArray[1] = e.getMessage();
        }
        return resultArray;
    }

    /**
     * 查询冻结状态
     * @param oprationtype 操作类型：Y冻结、N解冻
     * @param companyIds 公司id
     * @return
     * @throws Exception
     */
    public String[] queryPayControlStatus(String type, String[] array, String oprationtype, String[] companyIds) throws Exception {
        logger_814f159c.error(String.valueOf("CallEasServices excute start queryPayControlStatus------------------------"));
        PayControlServiceStub easStub = null;
        String[] resultArray = new String[2];
        logger_814f159c.error(String.valueOf("doPayControl type:" + type));
        logger_814f159c.error(String.valueOf("doPayControl array:" + array == null ? "" : array.length));
        logger_814f159c.error(String.valueOf("doPayControl oprationtype:" + oprationtype));
        logger_814f159c.error(String.valueOf("doPayControl companyIds:" + companyIds == null ? "" : companyIds.length));
        try {
            String url =configProp.getWeaver_secondev_hteasoasync_url();
            // String url = Util.null2String(getPropValue("hteasoasync", "url")).trim();
            easStub = new PayControlServiceStub(url);
            easStub._getServiceClient().getOptions().setProperty("__CHUNKED__", Boolean.FALSE);
            HttpTransportPropertiesImpl.Authenticator auth = new HttpTransportPropertiesImpl.Authenticator();
            auth.setUsername("pouser");
            auth.setPassword("654321");
            easStub._getServiceClient().getOptions().setProperty(org.apache.axis2.kernel.http.HTTPConstants.AUTHENTICATE,auth);
            PayControlServiceStub.CheckStatusParam param = new PayControlServiceStub.CheckStatusParam();
            param.setCheckType(type);
            param.setCheckData(array);
            param.setAttribute1(oprationtype);
            param.setAttribute2(companyIds);
            PayControlServiceStub.QueryPayControlStatus controlStatus = new PayControlServiceStub.QueryPayControlStatus();
            controlStatus.setParam(param);
            PayControlServiceStub.QueryPayControlStatusResponse response = easStub.queryPayControlStatus(controlStatus);
            PayControlServiceStub.ResultInfo info = response.get_return();
            // S:成功  F：失败
            String result = info.getResult();
            //
            String ErrorMessage = info.getErrorMessage();
            logger_814f159c.error(String.valueOf("queryPayControlStatus 返回值 result=" + result + ",ErrorMessage=" + ErrorMessage + "------------------------"));
            resultArray[0] = result;
            resultArray[1] = ErrorMessage;
            logger_814f159c.error(String.valueOf("CallEasServices excute success queryPayControlStatus------------------------"));
        } catch (Exception e) {
            logger_814f159c.error(String.valueOf("queryPayControlStatus error:" + e.getMessage()));
            resultArray[0] = "E";
            resultArray[1] = e.getMessage();
        }
        return resultArray;
    }
}
