From 73a1a2b861db44a9519e434152934b627747efcb Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期二, 21 三月 2023 10:15:59 +0800 Subject: [PATCH] 1 --- ExportMap/cs/SGUtils.cs | 1 + ExportMap/cs/XYZUtils.cs | 1 + ExportMap/Controllers/ConvertController.cs | 44 ++++++++++++++++++++++---------------------- ExportMap/cs/ConvertUtils.cs | 3 ++- ExportMap/up.html | 2 +- ExportMap/Web.config | 4 ++-- ExportMap/db/PubDBHelper.cs | 5 +++-- 7 files changed, 32 insertions(+), 28 deletions(-) diff --git a/ExportMap/Controllers/ConvertController.cs b/ExportMap/Controllers/ConvertController.cs index f74ead1..ddbf285 100644 --- a/ExportMap/Controllers/ConvertController.cs +++ b/ExportMap/Controllers/ConvertController.cs @@ -15,35 +15,35 @@ /// 杞崲涓篢ileset /// </summary> [HttpPost] - public ResponseMsg<int> ToTileset([FromBody]XYZArgs args) + public ResponseMsg<string> ToTileset([FromBody]XYZArgs args) { try { if (null == args || null == args.ids || args.ids.Count == 0) { - return ResponseMsg<int>.fail("璇疯緭鍏ュ厓鏁版嵁ID"); + return ResponseMsg<string>.fail("璇疯緭鍏ュ厓鏁版嵁ID"); } if (string.IsNullOrWhiteSpace(args.token)) { - return ResponseMsg<int>.fail("娌℃湁浠ょ墝"); + return ResponseMsg<string>.fail("娌℃湁浠ょ墝"); } if (!ExportUtil.VerifyToken(args.token)) { - return ResponseMsg<int>.fail("浠ょ墝鏃犳晥"); + return ResponseMsg<string>.fail("浠ょ墝鏃犳晥"); } int count = ConvertUtils.Convert(args); if (0 == count) { - return ResponseMsg<int>.fail("澶辫触"); + return ResponseMsg<string>.fail("澶辫触"); } - return ResponseMsg<int>.success("鎴愬姛", count); + return ResponseMsg<string>.success("鎴愬姛", "ok", count); } catch (Exception ex) { LogOut.Error(ex.StackTrace); - return ResponseMsg<int>.fail(ex.Message); + return ResponseMsg<string>.fail(ex.Message); } } @@ -51,40 +51,40 @@ /// 杞崲涓虹摝鐗� /// </summary> [HttpPost] - public ResponseMsg<int> ToTiles([FromBody]XYZArgs args) + public ResponseMsg<string> ToTiles([FromBody]XYZArgs args) { try { if (null == args || null == args.ids || args.ids.Count == 0) { - return ResponseMsg<int>.fail("璇疯緭鍏ュ厓鏁版嵁ID"); + return ResponseMsg<string>.fail("璇疯緭鍏ュ厓鏁版嵁ID"); } if (string.IsNullOrWhiteSpace(args.token)) { - return ResponseMsg<int>.fail("娌℃湁浠ょ墝"); + return ResponseMsg<string>.fail("娌℃湁浠ょ墝"); } if (!ExportUtil.VerifyToken(args.token)) { - return ResponseMsg<int>.fail("浠ょ墝鏃犳晥"); + return ResponseMsg<string>.fail("浠ょ墝鏃犳晥"); } if (args.min < 0 || args.max > 20 || string.IsNullOrWhiteSpace(args.dircode)) { - return ResponseMsg<int>.fail("杈撳叆鐨勫弬鏁版湁璇�"); + return ResponseMsg<string>.fail("杈撳叆鐨勫弬鏁版湁璇�"); } string err = null; int count = XYZUtils.Generate(args, ref err); if (0 == count) { - return ResponseMsg<int>.fail(null == err ? "澶辫触" : err); + return ResponseMsg<string>.fail(null == err ? "澶辫触" : err); } - return ResponseMsg<int>.success("鎴愬姛", count); + return ResponseMsg<string>.success("鎴愬姛", "ok", count); } catch (Exception ex) { LogOut.Error(ex.StackTrace); - return ResponseMsg<int>.fail(ex.Message); + return ResponseMsg<string>.fail(ex.Message); } } @@ -92,21 +92,21 @@ /// 杞崲涓虹摝鐗� /// </summary> [HttpPost] - public ResponseMsg<int> ToSG([FromBody]XYZArgs args) + public ResponseMsg<string> ToSG([FromBody]XYZArgs args) { try { if (null == args || null == args.ids || args.ids.Count == 0) { - return ResponseMsg<int>.fail("璇疯緭鍏ュ厓鏁版嵁ID"); + return ResponseMsg<string>.fail("璇疯緭鍏ュ厓鏁版嵁ID"); } if (string.IsNullOrWhiteSpace(args.token)) { - return ResponseMsg<int>.fail("娌℃湁浠ょ墝"); + return ResponseMsg<string>.fail("娌℃湁浠ょ墝"); } if (!ExportUtil.VerifyToken(args.token)) { - return ResponseMsg<int>.fail("浠ょ墝鏃犳晥"); + return ResponseMsg<string>.fail("浠ょ墝鏃犳晥"); } SGUtils utils = new SGUtils(); @@ -115,15 +115,15 @@ int count = utils.Release(args, ref err); if (0 == count) { - return ResponseMsg<int>.fail(null == err ? "澶辫触" : err); + return ResponseMsg<string>.fail(null == err ? "澶辫触" : err); } - return ResponseMsg<int>.success("鎴愬姛", count); + return ResponseMsg<string>.success("鎴愬姛", "ok", count); } catch (Exception ex) { LogOut.Error(ex.StackTrace); - return ResponseMsg<int>.fail(ex.Message); + return ResponseMsg<string>.fail(ex.Message); } } } diff --git a/ExportMap/Web.config b/ExportMap/Web.config index 15e206d..18e3f4e 100644 --- a/ExportMap/Web.config +++ b/ExportMap/Web.config @@ -16,8 +16,8 @@ <!-- SG鐨凞B搴� --> <add key="sgDB" value="E:\soft\SGConfig\catalog.db"/> <!-- PG杩炴帴 --> - <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=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="webpages:Version" value="3.0.0.0"/> <add key="webpages:Enabled" value="false"/> <add key="ClientValidationEnabled" value="true"/> diff --git a/ExportMap/cs/ConvertUtils.cs b/ExportMap/cs/ConvertUtils.cs index 36a5e36..b9fbcae 100644 --- a/ExportMap/cs/ConvertUtils.cs +++ b/ExportMap/cs/ConvertUtils.cs @@ -131,7 +131,8 @@ int pubid = PubDBHelper.InsertPublish(sys); if (pubid > 0) { - PubDBHelper.InsertLayer(sys, meta); + sys.id = pubid; + PubDBHelper.InsertLayer(sys, meta, 100); PubDBHelper.InsertMetaPub(meta.id, pubid, args.userId); } } diff --git a/ExportMap/cs/SGUtils.cs b/ExportMap/cs/SGUtils.cs index f9d4455..c9bda39 100644 --- a/ExportMap/cs/SGUtils.cs +++ b/ExportMap/cs/SGUtils.cs @@ -195,6 +195,7 @@ int pubid = PubDBHelper.InsertPublish(sys); if (pubid > 0) { + sys.id = pubid; PubDBHelper.InsertLayer(sys, meta); PubDBHelper.InsertMetaPub(meta.id, pubid, args.userId); } diff --git a/ExportMap/cs/XYZUtils.cs b/ExportMap/cs/XYZUtils.cs index 2db0fcf..c809e7c 100644 --- a/ExportMap/cs/XYZUtils.cs +++ b/ExportMap/cs/XYZUtils.cs @@ -191,6 +191,7 @@ int pubid = PubDBHelper.InsertPublish(sys); if (pubid > 0) { + sys.id = pubid; PubDBHelper.InsertLayer(sys, new SysMeta() { name = args.name, diff --git a/ExportMap/db/PubDBHelper.cs b/ExportMap/db/PubDBHelper.cs index d2c82f1..b0ae290 100644 --- a/ExportMap/db/PubDBHelper.cs +++ b/ExportMap/db/PubDBHelper.cs @@ -19,7 +19,7 @@ private static string insertMetaPubSql = "insert into lf.sys_meta_pub (metaid, pubid, create_user) select {0}, {1}, {2} from (select 1) temp where not exists (select 1 from lf.sys_meta_pub where metaid = {0} and pubid = {1})"; // 妯″瀷-@cnName锛宮odel-@enName锛岃嚜鍔ㄥ彂甯冩ā鍨�-@name锛宧ttp:// - @url锛孴ileset-@serve锛�1-@user锛�7-@pubid - private static string insertLayerSql = "insert into lf.sys_layer (pid, cn_name, en_name, url, type, level, order_num, is_show, create_user, data_type, serve_type, pubid) values ((select coalesce(id, 0) from lf.sys_layer where cn_name = @name limit 1), @cnName, @enName, @url, 2, (select coalesce(level, 0) + 1 from lf.sys_layer where cn_name = @name limit 1), (select coalesce(max(order_num), 0) from lf.sys_layer where pid = (select id from lf.sys_layer where cn_name = @name limit 1)), 0, @user, @name, @serve, @pubid);"; + private static string insertLayerSql = "insert into lf.sys_layer (pid, cn_name, en_name, url, type, level, order_num, is_show, create_user, data_type, serve_type, pubid, elev) values ((select coalesce(id, 0) from lf.sys_layer where cn_name = @name limit 1), @cnName, @enName, @url, 2, (select coalesce(level, 0) + 1 from lf.sys_layer where cn_name = @name limit 1), (select coalesce(max(order_num), 0) from lf.sys_layer where pid = (select id from lf.sys_layer where cn_name = @name limit 1)), 0, @user, @name, @serve, @pubid, @elev);"; /// <summary> /// 鏄�/鍚﹀彂甯冭繃 @@ -74,7 +74,7 @@ /// <summary> /// 鎻掑叆鍥惧眰琛ㄨ褰� /// </summary> - public static int InsertLayer(SysPublish sys, SysMeta meta) + public static int InsertLayer(SysPublish sys, SysMeta meta, double elev = 0) { bool isImg = imgList.Contains(meta.type); string cnName = meta.name.Split(new char[] { '.' })[0]; @@ -89,6 +89,7 @@ list.Add(new NpgsqlParameter("@serve", serve)); list.Add(new NpgsqlParameter("@pubid", sys.id)); list.Add(new NpgsqlParameter("@user", sys.create_user)); + list.Add(new NpgsqlParameter("@elev", elev)); int rows = Tool.DBHelper.ExecuteNonQuery(insertLayerSql, list.ToArray()); diff --git a/ExportMap/up.html b/ExportMap/up.html index 8748877..f01ac95 100644 --- a/ExportMap/up.html +++ b/ExportMap/up.html @@ -481,7 +481,7 @@ var vals = $("#selectPubType").find("option:selected").val(); console.log("娴嬭瘯鍙戝竷", type, vals); - var data = { "type": type, "name": "DOM_0.2m", "min": 12, "max": 18, depcode: "000305", dircode: "0102" }; + 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); -- Gitblit v1.9.3