From 6eafc81a275b14cc6a2fc653f883e94c0313bc43 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 08 二月 2023 10:31:49 +0800 Subject: [PATCH] 1 --- DataLoader/Model/ViewData.cs | 10 +- DataLoader/MainWindow.xaml.cs | 1 DataLoader/CS/Importor.cs | 11 ++ ExportMap/up.html | 145 +++++++++++++---------------------- DataLoader/DataLoader.csproj | 1 DataLoader/CS/StaticData.cs | 46 +++++++++++ JavaCode/JavaCode.csproj | 8 +- 7 files changed, 122 insertions(+), 100 deletions(-) diff --git a/DataLoader/CS/Importor.cs b/DataLoader/CS/Importor.cs index 55c839e..c493907 100644 --- a/DataLoader/CS/Importor.cs +++ b/DataLoader/CS/Importor.cs @@ -14,6 +14,14 @@ { public class Importor { + private static List<String> Exclusions = new List<string>() { + "jp2.aux.xml", + ".midx", ".strmi", + ".rrd", ".img.aux.xml", ".hdr", ".img.enp", ".img.xml", + ".tfw", ".tif.ovr", ".tif.aux.xml", ".tif.enp", ".tif.xml", ".prj", + ".shx", ".dbf", ".cpg" //, ".prj" + }; + private static PostgreHelper _ph = null; public static PostgreHelper Helper @@ -65,6 +73,7 @@ ViewData vd = new ViewData(); vd.ID = i + 1; vd.FilePath = files[i]; + vd.Ext = System.IO.Path.GetExtension(files[i]); vd.Status = "鍑嗗"; viewDatas.Add(vd); @@ -94,7 +103,7 @@ { vd.Status = "鐢熸垚MD5鐮�..."; string guid = MD5Helper.GetMD5Hash(vd.FilePath); - if (IsFileExists(guid)) + if (!Exclusions.Contains(vd.Ext) && IsFileExists(guid)) { vd.Status = "宸插瓨鍦紒"; return; diff --git a/DataLoader/CS/StaticData.cs b/DataLoader/CS/StaticData.cs new file mode 100644 index 0000000..fc7e954 --- /dev/null +++ b/DataLoader/CS/StaticData.cs @@ -0,0 +1,46 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DataLoader.CS +{ + public class StaticData + { + /** + * JP2鏂囦欢鎵╁睍鍚� + */ + public static List<String> JP2_EXT = new List<String> { "jp2.aux.xml" }; + + /** + * MPT鏂囦欢鎵╁睍鍚� + */ + public static List<String> MPT_EXT = new List<String> { ".midx", ".strmi" }; + + /** + * IMG鏂囦欢鎵╁睍鍚� + */ + public static List<String> IMG_EXT = new List<String> { ".rrd", ".img.aux.xml", ".hdr", ".img.enp", ".img.xml" }; + + /** + * TIF鏂囦欢鎵╁睍鍚� + */ + public static List<String> TIF_EXT = new List<String> { ".prj", ".tfw", ".tif.ovr", ".tif.aux.xml", ".tif.enp", ".tif.xml" }; + + /** + * TIFF鏂囦欢鎵╁睍鍚� + */ + public static List<String> TIFF_EXT = new List<String> { ".prj", ".tfw", ".tiff.ovr", ".tiff.aux.xml", ".tiff.enp", ".tiff.xml" }; + + /** + * SHP鏂囦欢鎵╁睍鍚� + */ + public static List<String> SHP_EXT = new List<String> { ".shx", ".dbf", ".prj", ".cpg" }; + + /** + * 鎵�鏈夋枃浠舵墿灞曞悕 + */ + public static List<String> ALL_EXTENSION = new List<String> { ".pdf", ".xls", ".xlsx", ".doc", ".docx", ".ppt", ".pptx", ".shp", ".gdb", ".mdb", ".dwg", ".las", ".laz", ".cpt", ".mpt", ".fly", ".efb", ".g3d", ".fbx", ".obj", ".3dm", ".3dml", ".osgb", ".rvt", ".ifc", ".jpg", ".png", ".img", ".tif", ".tiff", ".bmp", ".gif", ".rmvb", ".rm", ".mp3", ".mp4", ".avi", ".wma", ".wmv", ".7z", ".rar", ".zip", ".db", ".jp2", ".txt", ".xml" }; + } +} diff --git a/DataLoader/DataLoader.csproj b/DataLoader/DataLoader.csproj index 4f53b84..35a59d8 100644 --- a/DataLoader/DataLoader.csproj +++ b/DataLoader/DataLoader.csproj @@ -94,6 +94,7 @@ <Compile Include="CS\Importor.cs" /> <Compile Include="CS\LogOut.cs" /> <Compile Include="CS\MD5Helper.cs" /> + <Compile Include="CS\StaticData.cs" /> <Compile Include="Model\Tool.cs" /> <Compile Include="CS\ModelHandler.cs" /> <Compile Include="Model\NtstWeb.cs" /> diff --git a/DataLoader/MainWindow.xaml.cs b/DataLoader/MainWindow.xaml.cs index d2265d2..d6103d2 100644 --- a/DataLoader/MainWindow.xaml.cs +++ b/DataLoader/MainWindow.xaml.cs @@ -152,6 +152,7 @@ MessageBox.Show("璇烽�夋嫨鍏ュ簱鐩綍锛�", "鎻愮ず"); return; } + string[] files = Directory.GetFiles(SourcePath); if (null == files || files.Length == 0) { diff --git a/DataLoader/Model/ViewData.cs b/DataLoader/Model/ViewData.cs index 5f1ec30..2086ee0 100644 --- a/DataLoader/Model/ViewData.cs +++ b/DataLoader/Model/ViewData.cs @@ -11,11 +11,9 @@ { public event PropertyChangedEventHandler PropertyChanged; + public string Ext { set; get; } + private int _id; - - private string _filePath; - - private string _status; public ViewData() { @@ -37,6 +35,8 @@ } } + private string _filePath; + public string FilePath { set @@ -53,6 +53,8 @@ } } + private string _status; + public string Status { set diff --git a/ExportMap/up.html b/ExportMap/up.html index e57d8b2..0b38045 100644 --- a/ExportMap/up.html +++ b/ExportMap/up.html @@ -11,7 +11,7 @@ var app = {}; var path = "20230127"; var url = "http://127.0.0.1:12316/server/"; - var token = "b2d58c3c-9d98-4e7f-a9c5-7682cc83bc38"; + var token = "dca04924-122a-4b1a-88b7-aca0c4a7ba47"; $(function () { $("#pathSpan").html(path); @@ -52,6 +52,15 @@ } </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(); @@ -93,81 +102,6 @@ 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("dataUpload/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("dataUpload/deleteFiles"), "POST", JSON.stringify([data[0]]), null, null, function (rs) { console.log(rs); alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result); @@ -186,7 +120,7 @@ }); } - // Xls鍏ュ簱 + // Xls鍏ュ簱 * function insertXls() { if (app.data == null) return; @@ -362,6 +296,42 @@ }); } + // 鎸傝浇闄勪欢 + 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", 1209); + 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) { @@ -402,25 +372,18 @@ <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="Xls鍏ュ簱" type="button" onclick="insertXls();" /> + <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="璇诲彇鏄犲皠 *" 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 /> diff --git a/JavaCode/JavaCode.csproj b/JavaCode/JavaCode.csproj index a8c2647..80daa9a 100644 --- a/JavaCode/JavaCode.csproj +++ b/JavaCode/JavaCode.csproj @@ -113,16 +113,16 @@ </None> </ItemGroup> <ItemGroup> - <EmbeddedResource Include="BsTemplate\Entity.java"> + <EmbeddedResource Include="cs\BsTemplate\Entity.java"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </EmbeddedResource> - <EmbeddedResource Include="BsTemplate\Mapper.java"> + <EmbeddedResource Include="cs\BsTemplate\Mapper.java"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </EmbeddedResource> - <EmbeddedResource Include="BsTemplate\GeoMapper.java"> + <EmbeddedResource Include="cs\BsTemplate\GeoMapper.java"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </EmbeddedResource> - <EmbeddedResource Include="BsTemplate\GeoEntity.java"> + <EmbeddedResource Include="cs\BsTemplate\GeoEntity.java"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </EmbeddedResource> <Content Include="DLL\Mono.Security.dll" /> -- Gitblit v1.9.3