예제 #1
0
파일: Util.cs 프로젝트: ikvm/sdbBank
        /// <summary>
        /// 已开通银行卡列表查询
        /// </summary>
        /// <param name="customerId"></param>
        /// <returns></returns>
        public static string UnionAPI_OpenedData(string customerId)
        {
            com.ecc.emp.data.KeyedCollection input  = new com.ecc.emp.data.KeyedCollection("input");
            com.ecc.emp.data.KeyedCollection output = new com.ecc.emp.data.KeyedCollection("output");

            input.put("masterId", SDKConfig.MasterID); //商户号,注意生产环境上要替换成商户自己的生产商户号
            input.put("customerId", customerId);       //会员号,商户自行生成

            KeyedCollection recv         = new KeyedCollection();
            String          businessCode = "UnionAPI_Opened";
            String          toOrig       = input.toString().replace("\n", "").replace("\t", "");
            String          toUrl        = SDKConfig.sdbUnionUrl + "UnionAPI_Opened.do";

            output = NETExecute(businessCode, toOrig, toUrl);

            String errorCode = (String)output.getDataValue("errorCode");
            String errorMsg  = (String)output.getDataValue("errorMsg");


            if ((errorCode == null || errorCode.Equals("")) && (errorMsg == null || errorMsg.Equals("")))
            {
                //System.out.println("---订单状态---" + output.getDataValue("status"));
                //System.out.println("---支付完成时间---" + output.getDataValue("date"));
                String OpenId               = null;
                String accNo                = null;
                String plantBankName        = null;
                String plantBankId          = null;
                List <UnionBankModel> Mlist = new List <UnionBankModel>();
                IndexedCollection     icoll = (IndexedCollection)output.getDataElement("unionInfo");
                for (int i = 0; i < icoll.size(); i++)
                {
                    //取出index为i的一条记录,结构为KeyedCollection
                    com.ecc.emp.data.KeyedCollection kcoll = (com.ecc.emp.data.KeyedCollection)icoll.getElementAt(i);
                    OpenId        = (String)kcoll.getDataValue("OpenId");
                    accNo         = (String)kcoll.getDataValue("accNo");
                    plantBankName = (String)kcoll.getDataValue("plantBankName");

                    plantBankId = (String)kcoll.getDataValue("plantBankId");
                    UnionBankModel m = new UnionBankModel();
                    m.OpenId        = OpenId;
                    m.accNo         = accNo;
                    m.plantBankName = plantBankName;
                    m.plantBankId   = plantBankId;
                    Mlist.Add(m);
                }
                return(DynamicJson.Serialize(Mlist));

                //      return output.getDataValue("status").toString();
            }
            else
            {
                //   System.out.println("---错误码---" + output.getDataValue("errorCode"));
                //    System.out.println("---错误说明---" + output.getDataValue("errorMsg"));
                return(output.getDataValue("errorMsg").toString());
            }
            return(output.toString());
        }