/**
 * 2016年8月24日
 */
package testPkg;

import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;

import com.single.bean.ReturnBean;
import com.singlee.BatchFile.AccountFileDemo;
import com.singlee.BatchFile.AccountRequestDemo;
import com.singlee.BatchFile.ClientUtils;
import com.singlee.BatchFile.FilePayDemo;
import com.singlee.BatchFile.FileQueryDemo;
import com.singlee.BatchFile.SinglePayDemo;
import com.singlee.BatchFile.SingleQueryDemo;
import com.google.gson.*;

import net.sf.json.JSONArray;

/**
 * TODO 请务必添加说明注释！
 * @author Administrator
 * 2016年8月24日
 */
public class Test2 {
	public static void main(String[] args){
		
		
			 String filecontent = ClientUtils.zip("451073776100039|0004|20161205|100|1|02||"+"\n"+
				// "451073776100039|000020|400|01|6216261000000000018|全渠道|||平安银行|01|341126197709218366|13552535506|||||"+"\n"+
				 "451073776100039|000021|100|01|6216261000000000018|全渠道|||平安银行|01|341126197709218366|18668931866|||||");
		 
			String filename="451073776100039201612051814000004.txt";
			

		
			for(int i = 0;i<1;i++) {
//String str="batchNo=0001&bizCode=H0004&errCode=100001&filename=451073720100030201608261414300001.txt&merchantId=451073720100030&respDate=20160829&respTime=025424&signType=1&version=v1.0&key=null";
//批量查询   失败交易的查询
//String returnMsg=FileQueryDemo.QueryClient("20161017", "214600", "451073720100032201610171122000009.txt", "0009", "451073720100032", "","qdtaqdVpNyxTsFUjbDR1ATXQu9LYJIc4");

//String returnMsg=FileQueryDemo.QueryClient("20161017", "214600", "451073720100032201610171122000011.txt", "0010", "451073720100032", "","qdtaqdVpNyxTsFUjbDR1ATXQu9LYJIc4");

//批量代付
//String returnMsg=FilePayDemo.PayClient("20161205", "181400", "", filecontent, filename, "0004", "100", "1", "451073776100039","DYO0wU4lcRapGhlPcIlpvUtAJntoqlMT");

				Map<String, String> map1 = new HashMap<String, String>();
				Map<String, String> map2 = new HashMap<String, String>();
			    map1.put("merchantId", "451073776100039");//451073720100030
			    map1.put("orderDate", "20161205");
			    map1.put("orderTime", "1817");
			    map1.put("accType", "01"); 
			    map1.put("accNo", "6216261000000000018");/
			    String str123="全渠道";
			   // String unicode123 = new String(str123.getBytes(),"GBK"); 
			    map1.put("accName", str123);
			    map1.put("merSeqId", "201612050000024");
			    map1.put("openBank", "平安银行");
			    map1.put("prov", "hb");
			    map1.put("city", "hz");
			    map1.put("transAmt", "100");
			    map1.put("purpose", "1");
			  
			    map2.put("certifTp", "01");
			    map2.put("certifId", "341126197709218366");//370628198004150014
			    map2.put("customerNm", "全渠道");
			    JSONArray json1 = JSONArray.fromObject(map2);
			    map1.put("customerInfo", json1.toString().substring(1,json1.toString().length()-1));
			    JSONArray json = JSONArray.fromObject(map1);
			       		    
		 //   System.out.println(json.toString().substring(1,json.toString().length()-1));
//System.out.println(json1.toString().substring(1,json1.toString().length()-1));
//单笔代付
  String returnMsg=SinglePayDemo.PayClient(json.toString().substring(1,json.toString().length()-1),"","DYO0wU4lcRapGhlPcIlpvUtAJntoqlMT");
//单笔查询
//String returnMsg=SingleQueryDemo.QueryClient("20161205", "1521", "201612050000010", "02", "451073720100032", "", "qdtaqdVpNyxTsFUjbDR1ATXQu9LYJIc4");
   
		    Map<String, String> map11 = new HashMap<String, String>();
		    map11.put("merchantId", "473075600000039");//451073720100030
		    map11.put("orderDate", "20161108");
		    map11.put("orderTime", "135001");
		    map11.put("transDate", "20161107"); 
		    map11.put("bizCode", "H0005");
		    JSONArray json2 = JSONArray.fromObject(map11);
		    
//对账请求
//String returnMsg=AccountRequestDemo.AccountClient(json2.toString().substring(1,json2.toString().length()-1),"","oiwwH8N5l46VNPmYDzbIwp7wgB8dl2aj");

//对账下载
//String returnMsg=AccountFileDemo.AccountFileClient("451073720100032", "20161017", "135001", "20161012", "","qdtaqdVpNyxTsFUjbDR1ATXQu9LYJIc4");




				System.out.println("返回结果："+returnMsg);
				//System.out.println("第"+i+"次查询");
						
			}
	}


}
