| | |
| | | <html xmlns="http://www.w3.org/1999/xhtml"> |
| | | <head> |
| | | <title>上传接口测试</title> |
| | | <meta http-equiv="Expires" content="0" /> |
| | | <meta http-equiv="Cache" content="no-cache" /> |
| | | <meta http-equiv="Pragma" content="no-cache" /> |
| | | <meta http-equiv="Cache-control" content="no-cache" /> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> |
| | | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| | | <script src="js/jquery.1.12.4.js"></script> |
| | | <script src="js/rsa.min.js"></script> |
| | |
| | | <script src="js/insertFiles.js"></script> |
| | | <script> |
| | | var app = {}; |
| | | var path = "20230228"; |
| | | var path = "20230627"; |
| | | var url = "http://127.0.0.1:12316/server/"; |
| | | var token = "c36e4f94-dfde-401e-9967-2c4a449f1300"; |
| | | //var token = "c36e4f94-dfde-401e-9967-2c4a449f1300"; |
| | | var token = "8a17604e-3865-43c8-a14f-d4b17ed33656"; |
| | | |
| | | $(function () { |
| | | $("#pathSpan").html(path); |
| | |
| | | }); |
| | | } |
| | | |
| | | // Xls入库 * |
| | | // Xls入库 |
| | | function insertXls() { |
| | | if (app.data == null) return; |
| | | |
| | | var obj = { |
| | | metaEntity: { |
| | | depid: 1, |
| | | dirid: 10, |
| | | verid: 0, |
| | | //type: "file", |
| | | //cs: "CGCS 2000", |
| | | //scale: "1:1000", |
| | | //resolution: "0.5m", |
| | | gather: "2022-10-05 15:00:00", |
| | | descr: "测试Xls", |
| | | }, |
| | | fileEntities: app.data, |
| | | tabEntities: [ |
| | | { filename: "2-2 管线成果表.xlsx", subPath: "20221128010101\2-2 管线成果表.xlsx", tab: null, entity: "mdGdcg", type: "xls" }, |
| | | { filename: "海原县中线成果表.xlsx", subPath: "20221128010101\海原县中线成果表.xlsx", tab: null, entity: "mdZxcg", type: "xls" } |
| | | ] |
| | | }; |
| | | |
| | | ajax(getUrl("dataLoader/insertFiles"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | | ajax(getUrl("dataUpload/insertFiles"), "POST", JSON.stringify(xlsFiles), null, null, function (rs) { |
| | | console.log(rs); |
| | | app.data = null; |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | |
| | | } |
| | | </script> |
| | | <script> |
| | | // 请求下载 |
| | | function downloadReq() { |
| | | // 元数据-请求下载 |
| | | function metaDownloadReq() { |
| | | var obj = { |
| | | pwd: encrypt.encrypt("Test!321&456"), |
| | | ids: [1411, 1412] |
| | | ids: [1411, 1412, 8, 2140] |
| | | }; |
| | | |
| | | ajax(getUrl("meta/downloadReq"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | |
| | | }); |
| | | } |
| | | |
| | | // 下载文件 |
| | | function selectDownloadFile() { |
| | | var guid = "55269c88c147fb894c27e3de7076877d"; // "5ce046cc05b186332775c03ac6792caf"; |
| | | var guid = $.trim($("#fileId").val()); // var guid = "55269c88c147fb894c27e3de7076877d"; |
| | | if (!guid) return; |
| | | var pwd = encodeURIComponent(encrypt.encrypt("Test!321&456")); // Admin@123 |
| | | |
| | | ajax(getUrl("meta/selectDownloadFile") + "&guid=" + guid + "&pwd=" + pwd, "GET", null, null, null, function (rs) { |
| | |
| | | } |
| | | </script> |
| | | <script> |
| | | function downloadDbReq() { |
| | | // 请求下载 |
| | | function downloadReq() { |
| | | var obj = { |
| | | pwd: encrypt.encrypt("Test!321&456"), |
| | | entities: ["dlgagnp", "dlg25wboul", "dlg25wresa"], |
| | | // entities: ["dlgagnp"], |
| | | wkt: aesEncrypt("POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))") |
| | | wkt: aesEncrypt("POLYGON ((115.949 32.375 0,121.989 32.276 0,121.850 29.687 0,115.972 29.783 0,115.949 32.375 0))") |
| | | }; |
| | | |
| | | ajax(getUrl("dataLib/downloadDbReq"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | |
| | | }); |
| | | } |
| | | |
| | | // 请求实体下载 |
| | | function downloadEntityReq() { |
| | | // 下载DB数据 |
| | | function downloadDbData() { |
| | | var obj = { |
| | | entities: ["sexplorationpoint"], // bpachydrogeology,bhydrogeologyattach |
| | | filter: "exppointid = '001'", |
| | | pwd: encrypt.encrypt("Test!321&456") |
| | | pwd: encrypt.encrypt("Test!321&456"), |
| | | entities: ["dlgagnp", "dlg25wboul", "dlg25wresa"], // "sexplorationpoint" |
| | | filter: "gid > 1", // "exppointid like 'EA12'" |
| | | //ids: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], |
| | | dirs: "01,02,03,04,06,07", |
| | | depcode: "00", |
| | | wkt: aesEncrypt("POLYGON ((115.949 32.375 0,121.989 32.276 0,121.850 29.687 0,115.972 29.783 0,115.949 32.375 0))") |
| | | }; |
| | | |
| | | ajax(getUrl("dataLib/downloadEntityReq"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | | ajax(getUrl("dataLib/downloadDbData"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | |
| | | function aesDecrypt(word) { |
| | | return CryptoJS.enc.Utf8.stringify(CryptoJS.AES.decrypt(word, CryptoJS.enc.Utf8.parse(base64Decode("QSNzX2xGX3NFcnZlX2sueQ==")), { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 })).toString(); |
| | | } |
| | | </script> |
| | | </script> |
| | | <script> |
| | | function selectDbOverflowDep() { |
| | | // 查询元数据中溢出的单位ID |
| | | function selectMetaOverflowDep() { |
| | | ajax(getUrl("meta/selectMetaOverflowDep"), "POST", JSON.stringify({ ids: [1393, 1392, 1383, 1382] }), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 插入元数据申请 |
| | | function insertMetaApply() { |
| | | /*var obj = { |
| | | ids: [1393, 1392, 1383, 1382], |
| | | pwd: aesEncrypt("Test!321&456"), |
| | | tabs: ["元数据表"], |
| | | entities: ["sysmeta"], |
| | | descr: "测试元数据申请~", |
| | | depcodes: ["00"] |
| | | };*/ |
| | | var obj = { |
| | | // entities: ["dlgagnp"], |
| | | ids: [7095, 7079], |
| | | pwd: aesEncrypt("Test!321&456"), |
| | | tabs: ["元数据表"], |
| | | entities: ["sysmeta"], |
| | | descr: "测试元数据申请~", |
| | | depcodes: ["00"], |
| | | descr: "请审核~" |
| | | }; |
| | | |
| | | ajax(getUrl("apply/insertApply"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | function selectDbOverflowDep() { |
| | | //selectDbOverflowDep4Wkt(); |
| | | //selectDbOverflowDep4Prop1(); |
| | | selectDbOverflowDep4Prop2(); |
| | | } |
| | | |
| | | function selectDbOverflowDep4Wkt() { |
| | | var obj = { |
| | | entities: ["dlgagnp", "dlg25wboul", "dlg25wresa"], |
| | | wkt: aesEncrypt("POLYGON ((115.94927385452 32.3754479115071 0,121.989371092554 32.2766788010181 0,121.850621222894 29.6874200067864 0,115.9727267226 29.7835368627922 0,115.94927385452 32.3754479115071 0))") |
| | | }; |
| | | |
| | | ajax(getUrl("dataLib/selectDbOverflowDep"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | function selectDbOverflowDep4Prop1() { |
| | | var obj = { |
| | | entities: ["dlgagnp"], |
| | | filter: "name like '县'" |
| | | }; |
| | | |
| | | ajax(getUrl("dataLib/selectDbOverflowDep"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | function selectDbOverflowDep4Prop2() { |
| | | var obj = { |
| | | entities: ["dlgagnp"], |
| | | ids: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |
| | | }; |
| | | |
| | | ajax(getUrl("dataLib/selectDbOverflowDep"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | |
| | | |
| | | // 综合数据入库 |
| | | function insertAllFiles() { |
| | | var metaFiles = [{ |
| | | "createTime": null, |
| | | "createUser": 1, |
| | | "depcode": "000305", |
| | | "dircode": "01", |
| | | "entity": "mpipeline", |
| | | "epsgCode": "EPSG:4490", |
| | | "eventid": "24c073cc-e77b-4a7d-9a35-14319c231c81", |
| | | "extName": ".shp", |
| | | "guid": "85ec314d7c8aad8f7d6e89ea97c8c139", |
| | | "isMeta": false, |
| | | "msg": null, |
| | | "name": "m_pipeline.shp", |
| | | "path": "20230228_zip\\model_data\\m_pipeline.shp", |
| | | "rows": 0, |
| | | "sizes": 0.025, |
| | | "tab": "m_pipeline", |
| | | "type": "shp", |
| | | "verid": 0, |
| | | "tabDesc": "管线", |
| | | "tabs": "m_pipeline", |
| | | "ns": "bs" |
| | | }, { |
| | | "createTime": null, |
| | | "createUser": 1, |
| | | "depcode": "000305", |
| | | "dircode": "01", |
| | | "entity": "msitepoint", |
| | | "epsgCode": "EPSG:4490", |
| | | "eventid": "792c2d99-decd-4748-bd4b-33a4bebe7f5b", |
| | | "extName": ".shp", |
| | | "guid": "66031af8de9ab24feec3b1f06f738d0e", |
| | | "isMeta": false, |
| | | "msg": null, |
| | | "name": "m_sitepoint.shp", |
| | | "path": "20230228_zip\\model_data\\m_sitepoint.shp", |
| | | "rows": 0, |
| | | "sizes": 0.003, |
| | | "tab": "m_sitepoint", |
| | | "type": "shp", |
| | | "verid": 0, |
| | | "tabDesc": "站场点", |
| | | "tabs": "m_sitepoint", |
| | | "ns": "bs" |
| | | }]; |
| | | |
| | | //JSON.stringify(metaFiles) |
| | | //app.mappers = metaFiles; |
| | | ajax(getUrl("dataUpload/insertFiles"), "POST", JSON.stringify(app.mappers), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | |
| | | |
| | | // 测试发布 |
| | | function testPublish() { |
| | | //debugger |
| | | var type = $("#selectPubType").find("option:selected").text().split("(")[0]; |
| | | var vals = $("#selectPubType").find("option:selected").val(); |
| | | console.log("测试发布", type, vals); |
| | |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 下载瓦片 |
| | | function downloadTiles() { |
| | | var data = { |
| | | pwd: encrypt.encrypt("Test!321&456"), |
| | | //pubid: 15, xmin: 112.9534213185, ymin: 32.1588839103, xmax: 112.9734893228, ymax: 32.1736306779 |
| | | pubid: 15, xmin: 112.943013, ymin: 32.158525, xmax: 112.974408, ymax: 32.174741 |
| | | }; |
| | | ajax(getUrl("inquiry/downloadTiles"), "POST", JSON.stringify(data), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | </script> |
| | | </head> |
| | | <body> |
| | | <form id="upForm" name="upForm" method="post" enctype="multipart/form-data" action="http://127.0.0.1:12316/file/upload"> |
| | | <!--<form id="upForm" name="upForm" method="post" enctype="multipart/form-data" action="http://127.0.0.1:12316/file/upload">--> |
| | | <form id="upForm" name="upForm" method="post" enctype="multipart/form-data" action="Upload/Post?path=20230728"> |
| | | 上传路径:<span id="pathSpan"></span>,当前令牌:<span id="tokenSpan"></span> |
| | | <hr /> |
| | | <br /> |
| | |
| | | <input value="上传文件" type="button" onclick="uploadFiles();" /> |
| | | <input value="查询文件 *" type="button" onclick="selectFiles();" /> |
| | | <input value="删除文件" type="button" onclick="deleteFiles();" /> |
| | | <!--<input value="Xls入库" type="button" onclick="insertXls();" />--> |
| | | <input value="Xls入库" type="button" onclick="insertXls();" /> |
| | | <input value="读取映射 *" type="button" onclick="readMappers();" /> |
| | | <input value="综合数据入库 *" type="button" onclick="insertAllFiles();" /> |
| | | <input value="空间数据入库 *" type="button" onclick="insertDbFiles();" /> |
| | |
| | | <br /> |
| | | |
| | | 元数据: |
| | | <input value="请求下载" type="button" onclick="downloadReq();" /> |
| | | <input value="查询元数据中溢出的单位ID" type="button" onclick="selectMetaOverflowDep();" /> |
| | | <input value="插入元数据申请" type="button" onclick="insertMetaApply();" /> |
| | | <input value="请求下载" type="button" onclick="metaDownloadReq();" /> |
| | | <input value="下载文件" type="button" onclick="selectDownloadFile();" /> |
| | | <iframe id="downFrame" src="" style="display: none; border: 0; padding: 0; height: 0; width: 0"></iframe> |
| | | <hr /> |
| | | <br /> |
| | | |
| | | 空间数据: |
| | | <input value="请求下载" type="button" onclick="downloadDbReq();" /> |
| | | <!--<input value="请求下载" type="button" onclick="downloadReq();" />--> |
| | | <input id="fileId" value="" type="text" /> |
| | | <input value="下载文件" type="button" onclick="selectDownloadFile();" /> |
| | | <input value="请求实体下载" type="button" onclick="downloadEntityReq();" /> |
| | | <input value="下载DB数据" type="button" onclick="downloadDbData();" /> |
| | | <hr /> |
| | | <br /> |
| | | |
| | |
| | | <input value="附件下载1" type="button" onclick="downloadReqForGuids();" /> |
| | | <input value="附件下载2" type="button" onclick="downloadReqForTabGuids();" /> |
| | | <hr /> |
| | | <br /> |
| | | |
| | | Turf: |
| | | <input id="inpPoint" type="text" value="POINT (100.746244878 35.588071316)" style="width: 256px;" /> |
| | |
| | | <option value="1525">MPT</option> |
| | | </select> |
| | | <input value="测试发布" type="button" onclick="testPublish();" /> |
| | | <input value="下载瓦片" type="button" onclick="downloadTiles();" /> |
| | | <hr /> |
| | | <br /> |
| | | |
| | | 上传测试: |
| | | <div> |
| | | <label for="apifiles">请选择文件:</label> |
| | | <input name="apifiles" type="file" multiple="multiple" /> |
| | | <input type="submit" value="Upload" /> |
| | | </div> |
| | | </form> |
| | | <br /> |
| | | <br /> |