package nc.ws.intf.IWSBIGetNCWYData.Test;

import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import cn.com.countrygarden.bi.main.model.bd_psndoc;
import cn.com.countrygarden.bi.main.util.StringToMapUtil;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import nc.vo.pub.BusinessException.BusinessException;
import nc.ws.intf.IWSBIGetNCWYData.IWSBIGetNCWYDataPortTypeProxy;
import nc.ws.vo.KMFZYEVO.KMFZYEVO;
import nc.ws.vo.QueryVO.QueryVO;

public class Test1 {
    public static void main(String[] args) {
    	
    	
    		IWSBIGetNCWYDataPortTypeProxy IPTP = new IWSBIGetNCWYDataPortTypeProxy();
    		//1 获取科目辅助余额
    		String [] bookCodes = new String[]{"F1293-0001"};
        	String year ="2017";
        	String month = "06";
        	QueryVO qv = new QueryVO();
        	qv.setBookCodes(bookCodes);
        	qv.setMonth(month);
        	qv.setYear(year);        	
        	KMFZYEVO[] a = null;
			try {				
					a = IPTP.getKMFZYE(qv);
				} catch (BusinessException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				} catch (RemoteException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			if(a==null){
				System.out.println("我是空值");
			}else{
        	String getAccasoa_name = a[0].getAccasoa_name();
        	System.out.println(getAccasoa_name);
        	for(int i = 0;i<a.length;i++){
        	System.out.println(a[i].getYear());
        	}
		}
        	//（二）获取费用调整数据
    	  /* String [] bookCodes = new String[]{"F1265"};
    	   System.out.println(bookCodes.length);
    	   if(null==bookCodes ||"".equals(bookCodes))
    	   {
    	   System.out.println("1");
    	   }
        	String year ="2017";
        	String month = "06";
        	QueryVO qv = new QueryVO();
        	qv.setBookCodes(bookCodes);
        	qv.setMonth(month);
        	qv.setYear(year);    
        	String subbalance= IPTP.getFYTZ(qv);
        	System.out.println(a);
        	String newsubbalance = subbalance.substring(1,subbalance.length()-1);
        	String [] strarray = newsubbalance.split("\\},");
        	int j = strarray.length;
        	System.out.println(j);
        	for(int i=0;i<strarray.length;i++){
        		String newstrarray =strarray[i]+"}";
        		System.out.println(newstrarray);
        		Map<String,String> map = StringToMapUtil.ToMap(newstrarray);
        		
        		String mon= map.get("assume_amount");
            	System.out.println(mon);
        		
        		}   */ 	
        		
        	//（三）获取预算编制数据
          /* String [] bookCodes = new String[]{"F1830"};
        	String year ="2017";
        	String month = "6";
        	QueryVO qv = new QueryVO();
        	qv.setBookCodes(bookCodes);
        	qv.setMonth(month);
        	qv.setYear(year);
        	String subbalance;
			try {
				subbalance = IPTP.getYSBZ(qv);
				System.out.println(subbalance); 
	        	String newsubbalance = subbalance.substring(1,subbalance.length()-1);
	        	String [] strarray = newsubbalance.split("\\},");
	        	int j = strarray.length;
	        	System.out.println(j);
	        	for(int i=0;i<strarray.length;i++){
	        		String newstrarray =strarray[i]+"}";
	        		System.out.println(newstrarray);
	        		Map<String,String> map = StringToMapUtil.ToMap(newstrarray);
	        		String mon= map.get("year");
	        		System.out.println(mon);
	        	}
			} catch (BusinessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (RemoteException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        */
    		//4 获取档案编码及名称 5//（五）获取档案数据   通过遍历拿到所有的数据    还有  下面的注释是因为去出来的值所有的
    	 /*   String subbalance = IPTP.getBaseDocNames();
    	    System.out.println(subbalance);
    		Map<String,String> map = StringToMapUtil.ToMap(subbalance);
    		Iterator iter = map.entrySet().iterator(); 
    		while (iter.hasNext()) { 
    		    Map.Entry entry = (Map.Entry) iter.next(); 
    		    String key = (String) entry.getKey(); 
    		   String val = (String) entry.getValue(); 
    		    System.out.println(key);
    		  String sub = IPTP.getBaseDoc(key);
    		    System.out.println(val);
    		}*/
    		
    		/*String subbalance = IPTP.getBaseDocNames();*/
    		//获取第五个不同的类型的数据
    	 /*    String dangandata = IPTP.getBaseDoc("F050");
    		 System.out.println(dangandata);
    		    String newdangandata = dangandata.substring(1,dangandata.length()-1);
    		    String [] strarray = newdangandata.split("\\},");
    		    for(int i=0;i<strarray.length;i++){
            		String newstrarray =strarray[i]+"}";
            		Map<String,String> map1 = StringToMapUtil.ToMap(newstrarray);
            		String mon= map1.get("pk_org");
            		System.out.println(mon);
            	}*/
    		//（六）获业务规则
    		//获业务规则	下面是正常情况的时候		
			/*List<String> ruleNamelist = new ArrayList<>();
			ruleNamelist.add("WYA02物业板块_单项目公司_收入表_实际数2018");
			ruleNamelist.add("WYA03物业板块_单项目公司_支出表_实际数2018");
			ruleNamelist.add("WYA04物业板块_多项目公司_收入表_实际数2018");
			ruleNamelist.add("WYA05物业板块_多项目公司_支出表_实际数2018");
			ruleNamelist.add("WYA06物业板块_汇总模型_决算表2018");
			for(String ruleName : ruleNamelist)
			{
				String ruleNames = IPTP.getRules(ruleName);
				System.out.println(ruleNames);
			}*/
			/*String ruleNames = IPTP.getRules("WYA06物业板块_汇总模型_决算表2018");
			System.out.println(ruleNames);*/
		
    	
    	}
}
