<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

<script src="${ctx}/static/jquery/jquery-1.8.3.min.js"
	type="text/javascript"></script>
</head>
<body>
	<input id="" type="button" name="" value="测试login" onclick="testLogin()" /><br />
	<input id="" type="button" name="" value="测试customP!form"
		onclick="testGRDKQuery()" /><br /> 
	<input id="" type="button" name="" value="测试package" onclick="testBJ()" /><br />
	<input id="" type="button" name="" value="测试CompositePackage" onclick="testZYBJ()" /><br />
	<input id="" type="button" name="" value="测试pSearch" onclick="testDangan()" /><br />
	<input id="" type="button" name="" value="测试stdPModify!form" onclick="testGRDJ()" /><br />
	<input id="" type="button" name="" value="测试stdPSearch" onclick="testZDYB()" /><br /> 
	<input id="" type="button" name="" value="测试stdQSearch" onclick="testStdQSearch()" /><br />
	<input id="" type="button" name="" value="测试Mongo上传" onclick="testMongo()" /><br />
	<input id="" type="button" name="" value="测试Mongo下载"
		onclick="testMongoDown()" /><br />
	<input id="" type="button" name="" value="测试Mongo数据库写" onclick="testMongoWrite()" /><br />
	<input id="" type="button" name="" value="测试Mongo数据库读" onclick="testMongoRead()" /><br />
	<input id="" type="button" name="" value="测试打印" onclick="testPrint()" /><br />
	<input id="" type="button" name="" value="测试导出" onclick="testExport()" /><br />
	<input id="" type="button" name="" value="测试FTP" onclick="testFTP()" /><br />
	<br />
</body>
<script type="text/javascript">
	function testZYBJ(){
		var data = {};
		data.type = 'compositepackage';
		data.package='BJQC_DWZHCHECK';
		data.BJQCARRAY="[{\"DWZH\":\"422800010008\",\"GRZH\":\"422800001478\",\"ZGXM\":\"\u5218\u8d8a\u6e05\",\"ZJHM\":\"42282719540923001X\",\"JNNYQ\":\"2016-08\",\"JNNYZ\":\"2016-08\",\"DWBJJE\":0,\"GRBJJE\":0},{\"DWZH\":\"422800010008\",\"GRZH\":\"422800000275\",\"ZGXM\":\"\u96f7\u5929\u656c\",\"ZJHM\":\"42280119690521321X\",\"JNNYQ\":\"2016-08\",\"JNNYZ\":\"2016-08\",\"DWBJJE\":1037,\"GRBJJE\":1037}]";
		data.params="{\"V_DWZH\":\"422800010008\"}";
		
		$.ajax({
			type : 'get',
			async : false,
			url : "${ctx}/DbHelper/OracleServerPage",
			data : data,
			dataType : 'jsonp',
			jsonp : 'callback',
			success : function(json) {
				alert(123);
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
	}
    function testPrint(){
    	var data = {};
    	data.batch = true;
    	data.params = "[{\"template\":\"\u4e2a\u4eba\u660e\u7ec6\u8d26.docx\",\"mergeOption\":\"create\",\"params\":{\"ReportDes\":\"\u4e2a\u4eba\u660e\u7ec6\u8d26\",\"NAME\":\"\u5218\u5efa\u6069\",\"GRZH\":\"422800023900\",\"ZJHM\":\"422801197004251635\",\"DWZH\":\"422800010008\",\"DWMCMC\":\"\u5355\u4f4d\u540d\u79f0\uff1a\",\"DWMC\":\"\u4e2d\u5171\u6069\u65bd\u5dde\u59d4\u7edf\u6218\u90e8\",\"CJNY\":\"\",\"GRMXZ\":[{\"RN\":1,\"RZRQ\":\"2016-07-01\",\"YWLSH\":\"\",\"ZY\":\"\u5e74\u521d\u91d1\u989d\",\"QCJE\":\"45,952.86\",\"JFBJ\":\"0.00\",\"JFLX\":\"0.00\",\"DFBJ\":\"0.00\",\"DFLX\":\"0.00\",\"QMYE\":\"45,952.86\"},{\"RN\":2,\"RZRQ\":\"2016-07-26\",\"YWLSH\":501,\"ZY\":\"\u5218\u5efa\u60692016-07\u6c47\u7f34-(\u56fd\u5e93\u96c6\u4e2d\u652f\u4ed8\u51ed\u8bc1-61015228)\",\"QCJE\":\"45,952.86\",\"JFBJ\":\"0.00\",\"JFLX\":\"0.00\",\"DFBJ\":\"1,156.00\",\"DFLX\":\"0.00\",\"QMYE\":\"47,108.86\"},{\"RN\":3,\"RZRQ\":\"2016-07-26\",\"YWLSH\":502,\"ZY\":\"\u5218\u5efa\u60692015-12\u8865\u7f34-(\u56fd\u5e93\u96c6\u4e2d\u652f\u4ed8\u51ed\u8bc1-61015222)\",\"QCJE\":\"47,108.86\",\"JFBJ\":\"0.00\",\"JFLX\":\"0.00\",\"DFBJ\":\"3,840.00\",\"DFLX\":\"0.00\",\"QMYE\":\"50,948.86\"}],\"JFBJHJ\":\"0.00\",\"JFLXHJ\":\"0.00\",\"DFBJHJ\":\"4,996.00\",\"DFLXHJ\":\"0.00\"}}]";
    	
    	$.ajax({
			type : 'post',
			async : false,
			url : "${ctx}/FileHelper/ExportPdf",
			data : data,
			dataType : 'json',
			success : function(json) {
				window.open("http://192.168.101.228/DoNetServer_es_test/FileHelper/output/newcreate20160824044410_0个人明细账.pdf"); 
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
    }
	function testExport(){
		var data = {};
    	data.batch = true;
    	var params = [];
    	params.push({
    		"template":"\u4e2a\u4eba\u660e\u7ec6\u8d26.docx",
    		"mergeOption":"create",
    		"params":"[{\"template\":\"\u4e2a\u4eba\u660e\u7ec6\u8d26.docx\",\"mergeOption\":\"create\",\"params\":{\"ReportDes\":\"\u4e2a\u4eba\u660e\u7ec6\u8d26\",\"NAME\":\"\u5218\u5efa\u6069\",\"GRZH\":\"422800023900\",\"ZJHM\":\"422801197004251635\",\"DWZH\":\"422800010008\",\"DWMCMC\":\"\u5355\u4f4d\u540d\u79f0\uff1a\",\"DWMC\":\"\u4e2d\u5171\u6069\u65bd\u5dde\u59d4\u7edf\u6218\u90e8\",\"CJNY\":\"\",\"GRMXZ\":[{\"RN\":1,\"RZRQ\":\"2016-07-01\",\"YWLSH\":\"\",\"ZY\":\"\u5e74\u521d\u91d1\u989d\",\"QCJE\":\"45,952.86\",\"JFBJ\":\"0.00\",\"JFLX\":\"0.00\",\"DFBJ\":\"0.00\",\"DFLX\":\"0.00\",\"QMYE\":\"45,952.86\"},{\"RN\":2,\"RZRQ\":\"2016-07-26\",\"YWLSH\":501,\"ZY\":\"\u5218\u5efa\u60692016-07\u6c47\u7f34-(\u56fd\u5e93\u96c6\u4e2d\u652f\u4ed8\u51ed\u8bc1-61015228)\",\"QCJE\":\"45,952.86\",\"JFBJ\":\"0.00\",\"JFLX\":\"0.00\",\"DFBJ\":\"1,156.00\",\"DFLX\":\"0.00\",\"QMYE\":\"47,108.86\"},{\"RN\":3,\"RZRQ\":\"2016-07-26\",\"YWLSH\":502,\"ZY\":\"\u5218\u5efa\u60692015-12\u8865\u7f34-(\u56fd\u5e93\u96c6\u4e2d\u652f\u4ed8\u51ed\u8bc1-61015222)\",\"QCJE\":\"47,108.86\",\"JFBJ\":\"0.00\",\"JFLX\":\"0.00\",\"DFBJ\":\"3,840.00\",\"DFLX\":\"0.00\",\"QMYE\":\"50,948.86\"}],\"JFBJHJ\":\"0.00\",\"JFLXHJ\":\"0.00\",\"DFBJHJ\":\"4,996.00\",\"DFLXHJ\":\"0.00\"}}]"
    	});
    	data.params = JSON.stringify(params);
    	
    	$.ajax({
			type : 'post',
			async : false,
			url : "${ctx}/FileHelper/ExportPdf",
			data : data,
			dataType : 'json',
			success : function(json) {
				window.open("http://192.168.101.228/DoNetServer_es_test/FileHelper/output/newcreate20160824044410_0个人明细账.docx"); 
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
    }
	function testFTP(){
    	
    }
	function testMongoWrite(){
		$.ajax({
			type : 'get',
			async : false,
			url : "${ctx}/MongoHelper/write",
			dataType : 'jsonp',
			jsonp : 'callback',
			success : function(json) {
				alert(123);
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
	}
	
	function testMongoRead(){
		$.ajax({
			type : 'get',
			async : false,
			url : "${ctx}/MongoHelper/read",
			dataType : 'jsonp',
			jsonp : 'callback',
			success : function(json) {
				alert(123);
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
	}

	function testMongoDown() {
		var turnForm = document.createElement("form");
		//一定要加入到body中！！   
		document.body.appendChild(turnForm);
		turnForm.method = 'post';
		turnForm.action = '${ctx}/FileHelper/MongoFsDown';
		turnForm.target = '_blank';

		turnForm.submit();
	}
	
	function testMongo() {
		$.ajax({
			type : 'get',
			async : false,
			url : "${ctx}/FileHelper/MongoFs",
			dataType : 'jsonp',
			jsonp : 'callback',
			success : function(json) {
				alert(123);
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
	}
	function testStdQSearch() {
		var data = {};
		data.type = 'stdQSearch';
		data.sqlText = 'select * from WF_TACHES t';

		$.ajax({
			type : 'get',
			async : false,
			url : "${ctx}/DbHelper/OracleServerPage",
			data : data,
			dataType : 'jsonp',
			jsonp : 'callback',
			success : function(json) {
				alert(123);
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
	}
	function testZDYB() {
		var data = {};
		data.type = 'stdPSearch';
		data.tableName = 'GJ_DWZZ';
		data.fields = 'DWZH,DWXHRS';

		$.ajax({
			type : 'get',
			async : false,
			url : "${ctx}/DbHelper/OracleServerPage",
			data : data,
			dataType : 'jsonp',
			jsonp : 'callback',
			success : function(json) {
				alert(123);
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
	}
	function testGRDJ() {
		var data = {};
		data.type = 'stdPModify';
		data.pname = 'GRYW_ZHDJ.INS_TMP_YW_GRZHDJRYLB';
		var records = [];
		records.push({
			"GRZH" : "422800000471",
			"ZGXM" : "\u5f6d\u8dc3\u9f99",
			"XB" : "1",
			"ZJHM" : "422801196910060772",
			"ZHYE" : 21058.12,
			"ZHZT" : "01",
			"ZHZTMC" : "\u6b63\u5e38",
			"DJLX" : "4",
			"DJLXMC" : "\u6cd5\u9662\u4f20\u7968",
			"DJFS" : "1",
			"DJFSMC" : "\u8d26\u6237\u51bb\u7ed3",
			"DJJE" : 0,
			"GRDWZH" : "422800010002000471"
		});
		records.push({
			"GRZH" : "422800000111",
			"ZGXM" : "\u5218\u7ca4\u6c5f",
			"XB" : "1",
			"ZJHM" : "422801196011290216",
			"ZHYE" : 33475.8,
			"ZHZT" : "01",
			"ZHZTMC" : "\u6b63\u5e38",
			"DJLX" : "4",
			"DJLXMC" : "\u6cd5\u9662\u4f20\u7968",
			"DJFS" : "1",
			"DJFSMC" : "\u8d26\u6237\u51bb\u7ed3",
			"DJJE" : 0,
			"GRDWZH" : "422800010002000111"
		});
		data.records = JSON.stringify(records);

		var params = {};
		params.V_DWZH = "422800010002";
		params.V_GRZH = null;
		params.V_GRDWZH = null;
		params.V_DJLX = null;
		params.V_DJFS = null;
		params.V_DJJE = null;
		data.params = JSON.stringify(params);
		var addition = [];
		addition
				.push({
					"pName" : "GRYW_ZHDJ.GRZHDJ_COMMIT",
					"params" : "{\"V_YWBH\":null,\"V_LCSL\":null,\"V_DWZH\":\"422800010002\",\"V_ZXDQBM\":\"422800\",\"V_ZJZXID\":\"422800001\",\"V_YYWDID\":\"422800001001\",\"V_CZYID\":\"8BE4D80E92914D399EF451F19A571ACC\",\"V_CZYMC\":\"\\u738b\\u5219\\u521a\",\"V_GZZ\":\"[ip]\",\"V_ZY\":null,\"V_TZFS\":0,\"V_ROLEID\":\"740499DAC8084C07970B518A5296D8D7\"}"
				});
		data.addition = JSON.stringify(addition);

		$.ajax({
			type : 'get',
			async : false,
			url : "${ctx}/DbHelper/OracleServerPage",
			data : data,
			dataType : 'jsonp',
			jsonp : 'callback',
			success : function(json) {
				alert(123);
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
	}

	function testDangan() {
		var data = {};
		data.type = 'pSearch';
		data.pname = 'DA_DossierManage.CabinetQuery';
		var params = {};
		params.v_OrgCode = "422800001001";
		params.v_HouseNo = 1;
		data.params = JSON.stringify(params);
		data.page = 1;
		data.start = 0;
		data.limit = 25;
		var sort = [];
		sort.push({
			"property" : "CABINETNOTEXT",
			"direction" : "ASC"
		});
		data.sort = JSON.stringify(sort);

		$.ajax({
			type : 'get',
			async : false,
			url : "${ctx}/DbHelper/OracleServerPage",
			data : data,
			dataType : 'jsonp',
			jsonp : 'callback',
			success : function(json) {
				alert(123);
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
	}

	function testBJ() {
		var data = {};
		data.type = 'package';
		data.pname = 'BJQC_COMMIT';
		var params = {};
		params.DWZH = '422800010004';
		params.JNNYQ = '2016-08';
		params.JNNYZ = '2016-08';
		params.JJLY = '3';
		params.RZRQ = '2016-08-19';
		params.DWBJJE = '1028.00';
		params.GRBJJE = '1028.00';
		params.BJJE = '2056.00';
		params.ZCKYE = '18671.00';
		params.SJJE = '0';
		params.BJRS = 1;
		params.JJDH = '';
		params.YHBM = null;
		params.PJLX = null;
		params.PJBH = null;
		params.ZY = '2016-08\u81f32016-08';
		params.ZXDQBM = '422800';
		params.ZJZXID = '422800001';
		params.YYWDID = '422800001001';
		params.CZYID = '8BE4D80E92914D399EF451F19A571ACC';
		params.CZYMC = '\u738b\u5219\u521a';
		params.GZZ = '[ip]';
		params.BZ = '2016-08\u81f32016-08';
		params.TZFS = '0';
		params.ROLEID = '740499DAC8084C07970B518A5296D8D7';
		data.params = JSON.stringify(params);

		var BJQCARRAY = [];
		BJQCARRAY.push({
			"DWZH" : "422800010004",
			"GRZH" : "422800000157",
			"ZGXM" : "\u65b9\u56fd\u5bcc",
			"ZJHM" : "422801195611270636",
			"JNNYQ" : "2016-08",
			"JNNYZ" : "2016-08",
			"DWBJJE" : 1028,
			"GRBJJE" : 1028
		});

		data.BJQCARRAY = JSON.stringify(BJQCARRAY);

		var HBJPJARRAY = {};
		data.HBJPJARRAY = JSON.stringify(HBJPJARRAY);

		$.ajax({
			type : 'get',
			async : false,
			url : "${ctx}/DbHelper/OracleServerPage",
			data : data,
			dataType : 'jsonp',
			jsonp : 'callback',
			success : function(json) {
				alert(123);
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
	}

	function testGRDKQuery() {
		var data = {};
		data.type = 'customP';
		data.pname = 'GD_ZB.ZB_GRDKMX';
		var params = {};
		data.params = JSON.stringify(params);
		data.V_CXRQQ = '2005-01-01';
		data.V_CXRQZ = '2005-01-04';
		data.V_GRDKBM = '0302006052216';
		data.page = 1;
		data.start = 0;
		data.limit = 25;
		var sort = [];
		sort.push({
			"property" : "ZY",
			"direction" : "ASC"
		});
		data.sort = JSON.stringify(sort);

		$.ajax({
			type : 'get',
			async : false,
			url : "${ctx}/DbHelper/OracleServerPage",
			data : data,
			dataType : 'jsonp',
			jsonp : 'callback',
			success : function(json) {
				alert(json);
			},
			error : function(e) {
				alert(321);
			}
		});
	}

	function testLogin() {
		var data = {};
		data.type = 'login';
		data.pname = 'XTGL.USER_LOGIN';
		var params = {};
		params.I_LOGNAME = 'wzg';
		params.I_PASSWORD = '1';
		params.I_USRIP = '[ip]';
		data.params = JSON.stringify(params);

		$.ajax({
			type : 'get',
			async : false,
			url : "${ctx}/DbHelper/OracleServerPage",
			data : data,
			dataType : 'jsonp',
			jsonp : 'callback',
			success : function(json) {
				alert(123);
			},
			error : function(e) {
				//allPrpos(e);
			}
		});
	}

	function allPrpos(obj) {
		// 用来保存所有的属性名称和值 
		var props = "";
		// 开始遍历 
		for ( var p in obj) { // 方法 
			if (typeof (obj[p]) == " function ") {
				obj[p]();
			} else { // p 为属性名称，obj[p]为对应属性的值 
				alert(p + " = " + obj[p]);
			}
		} // 最后显示所有的属性 
	}
</script>
</html>