管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-03-16 76861803e45e1e8746577f08661cccbb3cf13eb1
1
已修改4个文件
40 ■■■■ 文件已修改
ExportMap/Controllers/ConvertController.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/Models/SpatialItem.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/cs/SGUtils.cs 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/export.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ExportMap/Controllers/ConvertController.cs
@@ -85,7 +85,8 @@
                    return ResponseMsg<int>.fail("请输入元数据ID");
                }
                int count = SGUtils.Release(args);
                SGUtils utils = new SGUtils();
                int count = utils.Release(args);
                if (0 == count)
                {
                    return ResponseMsg<int>.fail("失败");
ExportMap/Models/SpatialItem.cs
@@ -12,7 +12,7 @@
    {
        public SpatialItem() { }
        public int id { set; get; }
        public Int64 id { set; get; }
        public string Name { set; get; }
@@ -20,7 +20,7 @@
        public string LayerName { set; get; }
        public int DataSourceId { set; get; }
        public Int64 DataSourceId { set; get; }
        public string Description { set; get; }
    }
ExportMap/cs/SGUtils.cs
@@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
@@ -60,12 +61,17 @@
        /// </summary>
        /// <param name="args">XYZ参数</param>
        /// <returns>行数</returns>
        public static int Release(XYZArgs args)
        public int Release(XYZArgs args)
        {
            List<SysMeta> list = XYZUtils.selectMetas(args.ids, "and type in ('mpt', '3dml')");
            if (null == list || list.Count == 0) return 0;
            int maxId = GetMaxId();
            RomoveNoneFiles(list);
            List<SpatialItem> items = SelectItems(maxId);
            if (null == items || items.Count == 0) return 0;
@@ -94,8 +100,29 @@
            DataTable dt = SQLiteHelper.GetDataTable(sql);
            List<SpatialItem> list = ModelHandler.FillModel<SpatialItem>(dt);
            return list;
        }
        /// <summary>
        /// 移除空文件
        /// </summary>
        private void RomoveNoneFiles(List<SysMeta> list)
        {
            string uploadFolder = Tool.GetSetting("uploadFolder");
            int i = 0;
            while (i < list.Count)
            {
                SysMeta meta = list[i];
                string filePath = Path.Combine(uploadFolder, meta.path);
                if (!File.Exists(filePath))
                {
                    list.RemoveAt(i);
                    continue;
                }
                //
            }
        }
    }
}
ExportMap/export.html
@@ -114,7 +114,7 @@
    // 测试SG
    function toSG() {
      var data = { ids: [1523, 1525] };
      ajax("Convert/ToTileset", "POST", JSON.stringify(data), null, null, function (rs) {
      ajax("Convert/ToSG", "POST", JSON.stringify(data), null, null, function (rs) {
        alert("code = " + rs.code + ", msg = " + rs.msg + ", result = " + rs.result);
        console.log(rs);
      });