| | |
| | | { |
| | | 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 |
| | |
| | | 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); |
| | | |
| | |
| | | { |
| | | vd.Status = "çæMD5ç ..."; |
| | | string guid = MD5Helper.GetMD5Hash(vd.FilePath); |
| | | if (IsFileExists(guid)) |
| | | if (!Exclusions.Contains(vd.Ext) && IsFileExists(guid)) |
| | | { |
| | | vd.Status = "å·²åå¨ï¼"; |
| | | return; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using 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" }; |
| | | } |
| | | } |
| | |
| | | <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" /> |
| | |
| | | MessageBox.Show("è¯·éæ©å
¥åºç®å½ï¼", "æç¤º"); |
| | | return; |
| | | } |
| | | |
| | | string[] files = Directory.GetFiles(SourcePath); |
| | | if (null == files || files.Length == 0) |
| | | { |
| | |
| | | { |
| | | public event PropertyChangedEventHandler PropertyChanged; |
| | | |
| | | public string Ext { set; get; } |
| | | |
| | | private int _id; |
| | | |
| | | private string _filePath; |
| | | |
| | | private string _status; |
| | | |
| | | public ViewData() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private string _filePath; |
| | | |
| | | public string FilePath |
| | | { |
| | | set |
| | |
| | | } |
| | | } |
| | | |
| | | private string _status; |
| | | |
| | | public string Status |
| | | { |
| | | set |
| | |
| | | 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); |
| | |
| | | } |
| | | </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("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); |
| | |
| | | }); |
| | | } |
| | | |
| | | // Xlså
¥åº |
| | | // Xlså
¥åº * |
| | | function insertXls() { |
| | | if (app.data == null) return; |
| | | |
| | |
| | | }); |
| | | } |
| | | |
| | | // æè½½éä»¶ |
| | | 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) { |
| | |
| | | <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 /> |
| | | |
| | |
| | | </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" /> |