From a12c2baf8246d0af0e15756b7e008ded544e9b1c Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 02 八月 2023 10:17:04 +0800 Subject: [PATCH] 1 --- ExportMap/cs/SGUtils.cs | 10 ++++- ExportMap/cs/XYZUtils.cs | 17 +++++++- ExportMap/cs/OsgbUtils.cs | 10 ++++- ExportMap/cs/ConvertUtils.cs | 10 ++++- ExportMap/cs/TerraUtils.cs | 1 ExportMap/db/PubDBHelper.cs | 17 +++++++- ExportMap/cs/LasUtils.cs | 10 ++++- 7 files changed, 61 insertions(+), 14 deletions(-) diff --git a/ExportMap/cs/ConvertUtils.cs b/ExportMap/cs/ConvertUtils.cs index 0c2e875..821242f 100644 --- a/ExportMap/cs/ConvertUtils.cs +++ b/ExportMap/cs/ConvertUtils.cs @@ -126,11 +126,17 @@ /// </summary> private static int InsertToDB(SysMeta meta, XYZArgs args, string path) { - if (PubDBHelper.IsPublish(meta.id)) return 1; + //if (PubDBHelper.IsPublish(meta.id)) return 1; + int pubid = PubDBHelper.GetPushlishId(meta.id); + if (pubid > 0) + { + PubDBHelper.UpdatePublish(pubid, args.name, args.userId, null); + return pubid; + } SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(meta), path); - int pubid = PubDBHelper.InsertPublish(sys); + pubid = PubDBHelper.InsertPublish(sys); if (pubid > 0) { sys.id = pubid; diff --git a/ExportMap/cs/LasUtils.cs b/ExportMap/cs/LasUtils.cs index 5f38402..2d9d823 100644 --- a/ExportMap/cs/LasUtils.cs +++ b/ExportMap/cs/LasUtils.cs @@ -130,11 +130,17 @@ /// </summary> private static int InsertToDB(SysMeta meta, XYZArgs args, string path) { - if (PubDBHelper.IsPublish(meta.id)) return 1; + //if (PubDBHelper.IsPublish(meta.id)) return 1; + int pubid = PubDBHelper.GetPushlishId(meta.id); + if (pubid > 0) + { + PubDBHelper.UpdatePublish(pubid, args.name, args.userId, null); + return pubid; + } SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(path), path); - int pubid = PubDBHelper.InsertPublish(sys); + pubid = PubDBHelper.InsertPublish(sys); if (pubid > 0) { sys.id = pubid; diff --git a/ExportMap/cs/OsgbUtils.cs b/ExportMap/cs/OsgbUtils.cs index 802b2d2..7010994 100644 --- a/ExportMap/cs/OsgbUtils.cs +++ b/ExportMap/cs/OsgbUtils.cs @@ -142,11 +142,17 @@ /// </summary> private static int InsertToDB(SysMeta meta, XYZArgs args, string path) { - if (PubDBHelper.IsPublish(meta.id)) return 1; + //if (PubDBHelper.IsPublish(meta.id)) return 1; + int pubid = PubDBHelper.GetPushlishId(meta.id); + if (pubid > 0) + { + PubDBHelper.UpdatePublish(pubid, args.name, args.userId, null); + return pubid; + } SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(meta), path); - int pubid = PubDBHelper.InsertPublish(sys); + pubid = PubDBHelper.InsertPublish(sys); if (pubid > 0) { sys.id = pubid; diff --git a/ExportMap/cs/SGUtils.cs b/ExportMap/cs/SGUtils.cs index 37b7c31..8a11d93 100644 --- a/ExportMap/cs/SGUtils.cs +++ b/ExportMap/cs/SGUtils.cs @@ -205,11 +205,17 @@ /// </summary> private static int InsertToDB(SysMeta meta, XYZArgs args) { - if (PubDBHelper.IsPublish(meta.id)) return 1; + //if (PubDBHelper.IsPublish(meta.id)) return 1; + int pubid = PubDBHelper.GetPushlishId(meta.id); + if (pubid > 0) + { + PubDBHelper.UpdatePublish(pubid, args.name, args.userId, null); + return pubid; + } SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(meta, meta.verid), meta.id + "\\" + meta.name); - int pubid = PubDBHelper.InsertPublish(sys); + pubid = PubDBHelper.InsertPublish(sys); if (pubid > 0) { sys.id = pubid; diff --git a/ExportMap/cs/TerraUtils.cs b/ExportMap/cs/TerraUtils.cs index b61f87e..8e4f59d 100644 --- a/ExportMap/cs/TerraUtils.cs +++ b/ExportMap/cs/TerraUtils.cs @@ -271,7 +271,6 @@ if (!ids.Contains(m.id)) PubDBHelper.InsertMetaPub(m.id, pubid, args.userId); } string geom = GetPointZ(args); - //if (!string.IsNullOrEmpty(geom)) PubDBHelper.UpdatePublishGeom(pubid, geom); PubDBHelper.UpdatePublish(pubid, args.name, args.userId, geom); return pubid; diff --git a/ExportMap/cs/XYZUtils.cs b/ExportMap/cs/XYZUtils.cs index 96d9f47..76c4d64 100644 --- a/ExportMap/cs/XYZUtils.cs +++ b/ExportMap/cs/XYZUtils.cs @@ -162,7 +162,20 @@ /// </summary> private static int InsertToDB(List<SysMeta> metas, XYZArgs args, string path) { - if (PubDBHelper.IsPublish(args.dircode)) return 1; + //if (PubDBHelper.IsPublish(args.dircode, "DOM")) return 1; + int pubid = PubDBHelper.GetPushlishId(args.dircode, "DOM"); + if (pubid > 0) // 鏇存柊鍙戝竷 + { + List<int> ids = PubDBHelper.GetPublishMetaId(pubid); + foreach (SysMeta m in metas) + { + if (!ids.Contains(m.id)) PubDBHelper.InsertMetaPub(m.id, pubid, args.userId); + } + string geom = GetPointZ(args); + PubDBHelper.UpdatePublish(pubid, args.name, args.userId, geom); + + return pubid; + } SysMeta meta = metas[0]; meta.type = "DOM"; @@ -171,7 +184,7 @@ SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(args.dircode), path); sys.geom = GetPointZ(args); - int pubid = PubDBHelper.InsertPublish(sys); + pubid = PubDBHelper.InsertPublish(sys); if (pubid > 0) { sys.id = pubid; diff --git a/ExportMap/db/PubDBHelper.cs b/ExportMap/db/PubDBHelper.cs index 658ad31..3cf8dea 100644 --- a/ExportMap/db/PubDBHelper.cs +++ b/ExportMap/db/PubDBHelper.cs @@ -31,7 +31,7 @@ private static string selectLayerSql = "select id from lf.sys_layer where pid = @pid and en_name = @en_name"; /// <summary> - /// 鏄�/鍚﹀彂甯冭繃 + /// 鏄�/鍚﹀彂甯冭繃 * /// </summary> public static bool IsPublish(int metaid) { @@ -44,7 +44,7 @@ } /// <summary> - /// 鏄�/鍚﹀彂甯冭繃 + /// 鏄�/鍚﹀彂甯冭繃 * /// </summary> public static bool IsPublish(string dirid, string type = "DOM") { @@ -55,6 +55,17 @@ int count = obj == null ? 0 : Convert.ToInt32(obj); return count > 0; + } + + /// <summary> + /// 鑾峰彇鍙戝竷ID + /// </summary> + public static int GetPushlishId(int metaid) + { + string sql = string.Format("select pubid from lf.sys_meta_pub where metaid={0} order by id desc limit 1", metaid); + object obj = Tools.DBHelper.GetScalar(sql); + + return null == obj ? 0 : Convert.ToInt32(obj); } /// <summary> @@ -101,7 +112,7 @@ public static int UpdatePublish(int pubid, string name, int userId, string geom) { string str = null == geom ? "" : string.Format(", geom={0}", geom); - string sql = string.Format("update lf.sys_publish set name=@name, update_user=@userId, create_time=now(), update_time=now(){0} where id=@id", str); + string sql = string.Format("update lf.sys_publish set name=@name, create_time=now(), update_user=@userId, update_time=now(){0} where id=@id", str); DbParameter dp1 = new NpgsqlParameter("@name", name); DbParameter dp2 = new NpgsqlParameter("@userId", userId); -- Gitblit v1.9.3