| | |
| | | <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/rollups.js"></script> |
| | | <script src="js/turf.min.6.5.js"></script> |
| | | <script src="js/insertFiles.js"></script> |
| | | <script> |
| | | var app = {}; |
| | | var path = "20230110010101"; |
| | | var path = "20230803"; |
| | | var url = "http://127.0.0.1:12316/server/"; |
| | | var token = "bb079561-da66-4a68-9fbc-889f50707b82"; |
| | | //var token = "c36e4f94-dfde-401e-9967-2c4a449f1300"; |
| | | var token = "50b3fd35-7f5b-471e-974c-6240da4b3855"; |
| | | |
| | | $(function () { |
| | | //var flag = testArcGISServer(); |
| | | |
| | | $("#pathSpan").html(path); |
| | | $("#tokenSpan").html(token); |
| | | getPublicKey(); |
| | | //getPublicKey(); |
| | | }); |
| | | |
| | | // Ajax |
| | |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | fn(); |
| | | } |
| | | }); |
| | | } |
| | |
| | | } |
| | | </script> |
| | | <script> |
| | | // 查询目录 |
| | | function selectPath() { |
| | | ajax(getUrl("dataUpload/selectPath"), "GET", null, null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | path = rs.result; |
| | | }); |
| | | } |
| | | |
| | | // 上传文件 |
| | | function uploadFiles() { |
| | | var formData = new FormData(); |
| | |
| | | function deleteFiles() { |
| | | if (app.data == null) return; |
| | | |
| | | ajax(getUrl("dataUpload/deleteFiles"), "POST", JSON.stringify([app.data[0]]), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | selectFiles(); |
| | | }); |
| | | } |
| | | |
| | | // 文件入库 |
| | | function insertFiles() { |
| | | 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-03 15:00:00", |
| | | descr: "测试文件上传", |
| | | }, |
| | | fileEntities: app.data |
| | | }; |
| | | |
| | | ajax(getUrl("dataUpload/insertFiles"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | | console.log(rs); |
| | | app.data = null; |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | </script> |
| | | <script> |
| | | // 上传文件 |
| | | function uploadFiles2() { |
| | | var formData = new FormData(); |
| | | var fs = document.getElementById("file1"); |
| | | for (var i = 0, c = fs.files.length; i < c; i++) { |
| | | formData.append(fs.files[i].name, fs.files[i]); // fs.files[i].name,file |
| | | } |
| | | |
| | | $.ajax(getUrl("dataLoader/uploadFiles") + "&path=" + path, { |
| | | type: "post", |
| | | data: formData, |
| | | async: true, |
| | | cache: false, |
| | | processData: false, |
| | | contentType: false, |
| | | success: function (rs) { |
| | | document.getElementById("file1").value = ""; |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }, |
| | | error: function (e) { |
| | | document.getElementById("file1").value = ""; |
| | | console.error(e); |
| | | alert("上传文件失败!"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 查询文件 |
| | | function selectFiles2() { |
| | | ajax(getUrl("dataLoader/selectFiles") + "&path=" + path, "GET", null, null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | app.data = rs.result; |
| | | }); |
| | | } |
| | | |
| | | // 删除文件 |
| | | function deleteFiles2() { |
| | | if (app.data == null) return; |
| | | |
| | | ajax(getUrl("dataLoader/deleteFiles"), "POST", JSON.stringify([data[0]]), null, null, function (rs) { |
| | | ajax(getUrl("dataUpload/deleteFiles"), "POST", JSON.stringify([data[0]]), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | selectFiles(); |
| | |
| | | |
| | | // 读取映射 |
| | | function readMappers() { |
| | | ajax(getUrl("dataLoader/selectMappers") + "&path=" + path, "GET", null, null, null, function (rs) { |
| | | ajax(getUrl("dataUpload/selectMappers") + "&path=" + path + "&dirid=163&verid=0&epsgCode=EPSG:4490", "GET", null, null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | if (rs.code == 200) { |
| | |
| | | |
| | | // 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); |
| | | }); |
| | | } |
| | | |
| | | // Shp入库 |
| | | function insertShps() { |
| | | 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: [ |
| | | { |
| | | "entity": "dlg25wboul", |
| | | "fileName": "test.shp.zip", |
| | | "subPath": "20221128010101_zip\\test.shp\\pgShp\\dlg_25w_boul.shp", |
| | | "tab": "dlg_25w_boul.shp", |
| | | "type": "shp" |
| | | }, |
| | | { |
| | | "entity": "dlg25wresa", |
| | | "fileName": "test.shp.zip", |
| | | "subPath": "20221128010101_zip\\test.shp\\pgShp\\dlg_25w_resa.shp", |
| | | "tab": "dlg_25w_resa.shp", |
| | | "type": "shp" |
| | | }, |
| | | { |
| | | "entity": "dlgagnp", |
| | | "fileName": "test.shp.zip", |
| | | "subPath": "20221128010101_zip\\test.shp\\pgShp\\dlg_agnp.shp", |
| | | "tab": "dlg_agnp.shp", |
| | | "type": "shp" |
| | | }] |
| | | }; |
| | | |
| | | ajax(getUrl("dataLoader/insertFiles"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | | console.log(rs); |
| | | app.data = null; |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // GDB入库 |
| | | function insertGdb() { |
| | | 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: [ |
| | | { |
| | | "entity": "dlg25wboul", |
| | | "fileName": "test.gdb.zip", |
| | | "subPath": "20221128010101_zip\\test.gdb\\pg.gdb", |
| | | "tab": "dlg_25w_boul", |
| | | "type": "gdb" |
| | | }, |
| | | { |
| | | "entity": "dlg25wresa", |
| | | "fileName": "test.gdb.zip", |
| | | "subPath": "20221128010101_zip\\test.gdb\\pg.gdb", |
| | | "tab": "dlg_25w_resa", |
| | | "type": "gdb" |
| | | }, |
| | | { |
| | | "entity": "dlgagnp", |
| | | "fileName": "test.gdb.zip", |
| | | "subPath": "20221128010101_zip\\test.gdb\\pg.gdb", |
| | | "tab": "dlg_agnp", |
| | | "type": "gdb" |
| | | }] |
| | | }; |
| | | |
| | | ajax(getUrl("dataLoader/insertFiles"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | | console.log(rs); |
| | | app.data = null; |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // MDB |
| | | function insertMdb() { |
| | | 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: [ |
| | | { |
| | | "entity": "dlg25wboul", |
| | | "fileName": "test.mdb", |
| | | "subPath": "20221128010101\\test.mdb", |
| | | "tab": "dlg_25w_boul", |
| | | "type": "mdb" |
| | | }, |
| | | { |
| | | "entity": "dlg25wresa", |
| | | "fileName": "test.mdb", |
| | | "subPath": "20221128010101\\test.mdb", |
| | | "tab": "dlg_25w_resa", |
| | | "type": "mdb" |
| | | }/*, |
| | | { |
| | | "entity": "dlgagnp", |
| | | "fileName": "test.mdb", |
| | | "subPath": "20221128010101\\test.mdb", |
| | | "tab": "dlg_agnp", |
| | | "type": "mdb" |
| | | }*/] |
| | | }; |
| | | |
| | | ajax(getUrl("dataLoader/insertFiles"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | | console.log(rs); |
| | | app.data = null; |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | </script> |
| | | <script> |
| | | // 上传附件 |
| | | function uploadAttach() { |
| | | var formData = new FormData(); |
| | | var fs = document.getElementById("file3"); |
| | |
| | | } |
| | | </script> |
| | | <script> |
| | | function downloadReq() { |
| | | // 元数据-请求下载 |
| | | function metaDownloadReq() { |
| | | var obj = { |
| | | pwd: encrypt.encrypt("Test!321&456"), |
| | | ids: [113, 120, 121, 122] |
| | | ids: [1411, 1412, 8, 2140] |
| | | }; |
| | | |
| | | ajax(getUrl("meta/downloadReq"), "POST", JSON.stringify(obj), null, null, function (rs) { |
| | |
| | | }); |
| | | } |
| | | |
| | | // 下载文件 |
| | | function selectDownloadFile() { |
| | | var guid = "af68c8d6d847070e3a3055ba58e05929"; // "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) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 下载DB数据 |
| | | function downloadDbData() { |
| | | var obj = { |
| | | 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/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() { |
| | | ajax(getUrl("dataUpload/insertFiles"), "POST", JSON.stringify(metaFiles), null, null, function (rs) { |
| | | 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 insertMultiFiles() { |
| | | if (!app.mappers) return; |
| | | ajax(getUrl("dataUpload/insertFiles"), "POST", JSON.stringify(app.mappers), null, null, function (rs) { |
| | | console.log(rs); |
| | | app.mappers = null; |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 挂载附件 |
| | | function uploadAnnex() { |
| | | var formData = new FormData(); |
| | | var fs = document.getElementById("file1"); |
| | | if (fs.files.length == 0) { |
| | | alert("请选择要上传的文件!"); |
| | | return; |
| | | } |
| | | for (var i = 0, c = fs.files.length; i < c; i++) { |
| | | formData.append("file", fs.files[i]); // fs.files[i].name,file |
| | | } |
| | | formData.append("ids", 1658); |
| | | //formData.append("ids", 1180); |
| | | //formData.append("ids", 1387); |
| | | |
| | | //$.ajax(getUrl("dataUpload/uploadXlsAnnex") + "&path=" + path + "&ids=1209&ids=1180&ids=1387", { |
| | | $.ajax(getUrl("dataUpload/uploadXlsAnnex") + "&path=" + path, { |
| | | type: "post", |
| | | data: formData, |
| | | async: true, |
| | | cache: false, |
| | | processData: false, |
| | | contentType: false, |
| | | success: function (rs) { |
| | | console.log(rs); |
| | | document.getElementById("file1").value = ""; |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }, |
| | | error: function (e) { |
| | | console.error(e); |
| | | document.getElementById("file3").value = ""; |
| | | alert("上传文件失败!"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | // 空间数据入库 |
| | | function insertDbFiles() { |
| | | ajax(getUrl("dataUpload/insertFiles"), "POST", JSON.stringify(dbFiles), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 附件下载1-样式表 |
| | | function downloadReqForGuids() { |
| | | var data = { |
| | | guids: ["e5b6ae0889b88111f13a4b6e048348db", "fa4f299e901a0c46e634f8fcc8185c0c"] |
| | | }; |
| | | ajax(getUrl("res/downloadReqForGuids"), "POST", JSON.stringify(data), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 附件下载2-附件表 |
| | | function downloadReqForTabGuids() { |
| | | var data = { |
| | | tab: "bd.b_borehole", |
| | | guids: ["08e5b4ad-93b8-46f6-adaa-46a6274af4ce", "6f94f4f8-6e8d-44e7-8803-3d068d34983f"] |
| | | }; |
| | | ajax(getUrl("res/downloadReqForTabGuids"), "POST", JSON.stringify(data), null, null, function (rs) { |
| | | console.log(rs); |
| | | alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); |
| | | }); |
| | | } |
| | | |
| | | // 生成缓冲区 |
| | | function generateBuffer() { |
| | | var strs = $("#inpPoint").val().replace("POINT (", "").replace(")", "").split(" "); |
| | | var x = parseFloat(strs[0]), y = parseFloat(strs[1]); |
| | | |
| | | var buffer = parseFloat($("#buffer").val()) / 1000; |
| | | var steps = parseInt($("#steps").val()); |
| | | //var point = turf.point([x, y]); |
| | | //var buffered = turf.buffer(point, buffer, { units: 'kilometers', steps: 16 }); |
| | | //var options = { precision: 6, coordinates: 2 }; |
| | | //var truncated = turf.truncate(buffered, options); |
| | | |
| | | var circle = turf.circle([x, y], buffer, { steps: steps, units: 'kilometers' }); |
| | | var cc = turf.truncate(circle, { precision: 6, coordinates: 2 }); |
| | | |
| | | var arr = [], cs = cc.geometry.coordinates[0]; |
| | | for (var i = 0, c = cs.length; i < c; i++) { |
| | | arr.push(cs[i][0] + " " + cs[i][1]); |
| | | } |
| | | var wkt = "POLYGON((" + arr.join(",") + "))"; |
| | | |
| | | $("#oupArea").html(wkt); |
| | | } |
| | | |
| | | // 测试发布 |
| | | function testPublish() { |
| | | var type = $("#selectPubType").find("option:selected").text().split("(")[0]; |
| | | var vals = $("#selectPubType").find("option:selected").val(); |
| | | console.log("测试发布", type, vals); |
| | | |
| | | var data = { "ids": vals.split(","), "type": type, "name": "DOM_0.2m", "min": 12, "max": 18, depcode: "000305", dircode: "0102" }; |
| | | ajax(getUrl("publish/insertForPub"), "POST", JSON.stringify(data), null, null, function (rs) { |
| | | console.log(rs); |
| | | 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); |
| | | }); |
| | | } |
| | | |
| | | // downFrame |
| | | function downFastbeeFile() { |
| | | var url = "http://192.168.11.203/prod-api/model/downloadFile?guid=babbfbedd596f2dfd6b45c1f17e6861b"; |
| | | var token = "Bearer " + "eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjM1MmJlZGQxLTg0YzctNDQxNC1hODA0LTg5NzU0NjU3NDEwMyJ9.agRhJllLb8IrUk5VhZKJBdyu8SaW2H_-PFgmot5ZlsIJQv-pqsdcdH0jlwnh0nuFc7qLf0NdR59v1yYqnnbZhA"; |
| | | |
| | | /*var xhr = new XMLHttpRequest(); |
| | | xhr.open("GET", url); |
| | | xhr.setRequestHeader("Authorization", token); |
| | | xhr.onload = function (res, status, xhr) { |
| | | var url = URL.createObjectURL(res.currentTarget.response); |
| | | var filename = decodeURL(res.headers['content-disposition'].split("filename="))[1]; |
| | | var link = document.createElement('a'); |
| | | link.style.display = 'none'; |
| | | link.href = downloadUrl; |
| | | link.setAttribute('download', filename); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | // 释放URL对象所占资源 |
| | | URL.revokeObjectURL(downloadUrl); |
| | | // 销毁节点 |
| | | document.body.removeChild(link); |
| | | }; |
| | | xhr.send();*/ |
| | | |
| | | //Admin-Token=eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjFiNDI0NWU0LWViY2MtNDc3Ni1hNDQ0LTc5MzdiYzk3YjUwMiJ9.agyF7aFvfm4JzFAuWtRCPWnagjlpL-O792r-6ihyCXRHXMlim6MF5D6ZU3Mvy33DmP6gAKVjc4l-KlCs7cCZ9A |
| | | |
| | | //$("#downFrame").attr("src", url).click(); |
| | | |
| | | var doc = document.getElementById("downFrame").contentWindow.document; |
| | | doc.cookie = "Admin-Token=eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjFiNDI0NWU0LWViY2MtNDc3Ni1hNDQ0LTc5MzdiYzk3YjUwMiJ9.agyF7aFvfm4JzFAuWtRCPWnagjlpL-O792r-6ihyCXRHXMlim6MF5D6ZU3Mvy33DmP6gAKVjc4l-KlCs7cCZ9A" + "; path=/;"; |
| | | |
| | | $("#downFrame").attr("src", url).click(); |
| | | } |
| | | |
| | | function readSignal() { |
| | | /*var xhr = new XMLHttpRequest(); |
| | | xhr.open("GET", "http://192.168.11.69:8086/cs/getSignalByTime?time=202407130000"); |
| | | xhr.onload = function () { |
| | | if (xhr.status == 200) { |
| | | var bytes = xhr.response; |
| | | //var buffer = xhr. |
| | | |
| | | var dv = new DataView(buffer); |
| | | for (var i = 0, c = dv.byteLength; i < c; i += 10) { |
| | | var x = dv.getFloat16(i, true); |
| | | var y = dv.getFloat16(i + 4, true); |
| | | var v = dv.getInt16(i + 6, true); |
| | | console.log("x=" + x + " y=" + y + " v=" + v); |
| | | } |
| | | } |
| | | } |
| | | xhr.send();*/ |
| | | |
| | | $.ajax({ |
| | | method: "GET", |
| | | responseType: "arraybuffer", |
| | | url: "http://192.168.11.69:8086/cs/getSignalByTime?time=202407171500", |
| | | success: function (rs, s, e) { |
| | | var b = new Blob([rs]); |
| | | b.arrayBuffer().then(function (buffer) { |
| | | var dv = new DataView(buffer); |
| | | for (var i = 0, c = dv.byteLength; i < c; i += 10) { |
| | | var x = dv.getFloat32(i, true); |
| | | var y = dv.getFloat32(i + 4, true); |
| | | var v = dv.getInt16(i + 6, true); |
| | | console.log("i=" + i + " x=" + x + " y=" + y + " v=" + v); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | </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 id="file1" type="file" multiple="multiple" /> |
| | | <input value="上传文件" type="button" onclick="uploadFiles();" /> |
| | | <input value="查询文件" type="button" onclick="selectFiles();" /> |
| | | <input value="删除文件" type="button" onclick="deleteFiles();" /> |
| | | <input value="文件入库" type="button" onclick="insertFiles();" /> |
| | | <hr /> |
| | | <br /> |
| | | |
| | | 数据入库: |
| | | <input id="file2" type="file" multiple="multiple" accept=".xls,.xlsx,.mdb,.shp.zip,.gdb.zip" /> |
| | | <input value="上传文件" type="button" onclick="uploadFiles2();" /> |
| | | <input value="查询文件" type="button" onclick="selectFiles2();" /> |
| | | <input value="删除文件" type="button" onclick="deleteFiles2();" /> |
| | | <input value="读取映射" type="button" onclick="readMappers();" /> |
| | | <input id="file1" type="file" multiple="multiple" accept=".xls,.xlsx,.mdb,.zip" /> |
| | | <input value="查询目录 *" type="button" onclick="selectPath();" /> |
| | | <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="Shp入库" type="button" onclick="insertShps();" /> |
| | | <input value="Gdb入库" type="button" onclick="insertGdb();" /> |
| | | <input value="Mdb入库" type="button" onclick="insertMdb();" /> |
| | | <input value="* 综合数据入库 *" type="button" onclick="insertAllFiles();" /> |
| | | <input value="读取映射 *" type="button" onclick="readMappers();" /> |
| | | <input value="综合数据入库 *" type="button" onclick="insertAllFiles();" /> |
| | | <input value="空间数据入库 *" type="button" onclick="insertDbFiles();" /> |
| | | <input value="多文件入库 *" type="button" onclick="insertMultiFiles();" /> |
| | | <input value="挂载附件 *" type="button" onclick="uploadAnnex();" /> |
| | | <hr /> |
| | | <br /> |
| | | |
| | |
| | | <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="下载DB数据" type="button" onclick="downloadDbData();" /> |
| | | <hr /> |
| | | <br /> |
| | | |
| | |
| | | <input value="管线分析结果下载" type="button" onclick="downloadPipeAnalysis();" /> |
| | | <hr /> |
| | | <br /> |
| | | |
| | | 附件下载: |
| | | <input value="附件下载1" type="button" onclick="downloadReqForGuids();" /> |
| | | <input value="附件下载2" type="button" onclick="downloadReqForTabGuids();" /> |
| | | <hr /> |
| | | |
| | | Turf: |
| | | <input id="inpPoint" type="text" value="POINT (100.746244878 35.588071316)" style="width: 256px;" /> |
| | | <input id="buffer" value="1" type="text" style="width: 30px;" />米 |
| | | <input id="steps" value="8" type="text" style="width: 30px;" />步数 |
| | | <textarea id="oupArea" style="width: 512px; vertical-align: bottom;"></textarea> |
| | | <input value="生成" type="button" onclick="generateBuffer();" /> |
| | | <hr /> |
| | | <br /> |
| | | |
| | | 发布管理: |
| | | <select id="selectPubType"> |
| | | <option value="1526,1527" selected="selected">DOM</option> |
| | | <option value="1521">BIM(rvt)</option> |
| | | <option value="1522">BIM(fbx)</option> |
| | | <option value="1528">BIM(ifc)</option> |
| | | <option value="1523">3DML</option> |
| | | <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> |
| | | |
| | | Fastbee下载文件:<input value="蜂信下载" type="button" onclick="downFastbeeFile();" /> |
| | | <input value="读取信令" type="button" onclick="readSignal();" /> |
| | | <hr /> |
| | | <br /> |
| | | </form> |
| | | <br /> |
| | | <br /> |