From 110685ca201361af20d758fce7cf8a89ab5362b6 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期日, 30 七月 2023 11:03:49 +0800 Subject: [PATCH] 1 --- ExportMap/cs/Tools.cs | 35 ----------- ExportMap/Controllers/ConvertController.cs | 29 +++++++++ ExportMap/cs/CommonUtils.cs | 67 ++++++++++++++++++++++ JavaCode/App.config | 4 ExportMap/ExportMap.csproj | 1 5 files changed, 98 insertions(+), 38 deletions(-) diff --git a/ExportMap/Controllers/ConvertController.cs b/ExportMap/Controllers/ConvertController.cs index a851b75..4b71662 100644 --- a/ExportMap/Controllers/ConvertController.cs +++ b/ExportMap/Controllers/ConvertController.cs @@ -230,7 +230,34 @@ if (null != msg) return msg; string err = null; - List<int> rs = Tools.DeleteFiles(args, ref err); + List<int> rs = CommonUtils.DeleteFiles(args, ref err); + if (null == rs || rs.Count == 0) + { + return ResponseMsg<string>.fail(null == err ? "澶辫触" : err); + } + + return ResponseMsg<string>.success("鎴愬姛", string.Join(",", rs), rs.Count); + } + catch (Exception ex) + { + LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); + return ResponseMsg<string>.fail(ex.Message); + } + } + + /// <summary> + /// 鍒犻櫎浠诲姟 + /// </summary> + [HttpPost] + public ResponseMsg<string> DeleteTask([FromBody]XYZArgs args) + { + try + { + ResponseMsg<string> msg = checkArgs(args, true); + if (null != msg) return msg; + + string err = null; + List<int> rs = CommonUtils.DeleteTask(args, ref err); if (null == rs || rs.Count == 0) { return ResponseMsg<string>.fail(null == err ? "澶辫触" : err); diff --git a/ExportMap/ExportMap.csproj b/ExportMap/ExportMap.csproj index f8d6ae2..0887cd3 100644 --- a/ExportMap/ExportMap.csproj +++ b/ExportMap/ExportMap.csproj @@ -145,6 +145,7 @@ <Compile Include="Controllers\TerraController.cs" /> <Compile Include="Controllers\UploadController.cs" /> <Compile Include="cs\CacheUtils.cs" /> + <Compile Include="cs\CommonUtils.cs" /> <Compile Include="cs\ConvertUtils.cs" /> <Compile Include="cs\CustomMultipartFormDataStreamProvider.cs" /> <Compile Include="cs\ExportUtil.cs" /> diff --git a/ExportMap/cs/CommonUtils.cs b/ExportMap/cs/CommonUtils.cs new file mode 100644 index 0000000..05102e3 --- /dev/null +++ b/ExportMap/cs/CommonUtils.cs @@ -0,0 +1,67 @@ +锘縰sing ExportMap.db; +using ExportMap.Models; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Web; + +namespace ExportMap.cs +{ + public class CommonUtils + { + /// <summary> + /// 鍒犻櫎鏂囦欢 + /// </summary> + public static List<int> DeleteFiles(XYZArgs args, ref string err) + { + List<SysPublish> pubs = PubDBHelper.SelectPublishs(args.ids); + if (null == pubs || pubs.Count == 0) return null; + + List<int> list = new List<int>(); + foreach (SysPublish pub in pubs) + { + try + { + if (string.IsNullOrEmpty(pub.url) || string.IsNullOrEmpty(pub.path)) continue; + + String path = SGUtils.LFData + "\\" + pub.path.Replace("\\tileset.json", ""); + if (pub.url.Contains("/SG/") || !Directory.Exists(path)) + { + list.Add(pub.id); + continue; + } + + Tools.DelPath(path); + list.Add(pub.id); + } + catch (Exception ex) + { + LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); + err = ex.Message; + } + } + + return list; + } + + /// <summary> + /// 鍒犻櫎浠诲姟 + /// </summary> + public static List<int> DeleteTask(XYZArgs args, ref string err) + { + List<int> list = new List<int>(); + try + { + + } + catch (Exception ex) + { + LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); + err = ex.Message; + } + + return list; + } + } +} diff --git a/ExportMap/cs/Tools.cs b/ExportMap/cs/Tools.cs index 6c8223d..000724c 100644 --- a/ExportMap/cs/Tools.cs +++ b/ExportMap/cs/Tools.cs @@ -288,41 +288,6 @@ } } - /// <summary> - /// 鍒犻櫎鏂囦欢 - /// </summary> - public static List<int> DeleteFiles(XYZArgs args, ref string err) - { - List<SysPublish> pubs = PubDBHelper.SelectPublishs(args.ids); - if (null == pubs || pubs.Count == 0) return null; - - List<int> list = new List<int>(); - foreach (SysPublish pub in pubs) - { - try - { - if (string.IsNullOrEmpty(pub.url) || string.IsNullOrEmpty(pub.path)) continue; - - String path = SGUtils.LFData + "\\" + pub.path.Replace("\\tileset.json", ""); - if (pub.url.Contains("/SG/") || !Directory.Exists(path)) - { - list.Add(pub.id); - continue; - } - - DelPath(path); - list.Add(pub.id); - } - catch (Exception ex) - { - LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); - err = ex.Message; - } - } - - return list; - } - [DllImport("ReadLas.dll")] public extern static int get_las_cs(string file_name); } diff --git a/JavaCode/App.config b/JavaCode/App.config index 16a5051..152f377 100644 --- a/JavaCode/App.config +++ b/JavaCode/App.config @@ -1,9 +1,9 @@ <?xml version="1.0"?> <configuration> <appSettings> - <!--<add key="pgConn" value="Server=127.0.0.1;Port=5433;Database=langfang;User Id=postgres;Password=postgres;"/>--> + <add key="pgConn" value="Server=127.0.0.1;Port=5433;Database=langfang;User Id=postgres;Password=postgres;"/> <!--<add key="pgConn" value="Server=192.168.20.205;Port=5433;Database=langfang;User Id=postgres;Password=Postgres!_14_Lf;"/>--> - <add key="pgConn" value="Server=192.168.20.83;Port=5433;Database=moon;User Id=postgres;Password=Postgres!_14_moon;"/> + <!--<add key="pgConn" value="Server=192.168.20.83;Port=5433;Database=moon;User Id=postgres;Password=Postgres!_14_moon;"/>--> </appSettings> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/> -- Gitblit v1.9.3