Compare commits
3 Commits
6b4221fc05
...
1a3b3d8e80
| Author | SHA1 | Date |
|---|---|---|
|
|
1a3b3d8e80 | |
|
|
a199ca000b | |
|
|
a5f75fcdaf |
|
|
@ -119,6 +119,11 @@ public class ShapeUtil
|
|||
// return NetTopologySuite.IO.Esri.Shapefile.ReadAllGeometries(shpPath);
|
||||
}
|
||||
|
||||
public static bool CheckTextByUtf8()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断是否乱码
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,119 @@
|
|||
using Infrastructure;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.ServiceApp.GoView.Request;
|
||||
using OpenAuth.App.ServiceApp.GoView.Response;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain.GoView;
|
||||
using SqlSugar;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.GoView;
|
||||
|
||||
public class GoViewProjectApp : SqlSugarBaseApp<GoviewProject, SugarDbContext>
|
||||
{
|
||||
public GoViewProjectApp(ISugarUnitOfWork<SugarDbContext> unitWork, ISimpleClient<GoviewProject> repository,
|
||||
IAuth auth) : base(unitWork, repository, auth)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<AjaxResult> DeleteProject(string ids)
|
||||
{
|
||||
var idArray = ids.Split(",");
|
||||
var flag = await Repository.DeleteByIdsAsync(idArray);
|
||||
return flag ? AjaxResult.Success("删除成功") : AjaxResult.Error("删除失败");
|
||||
}
|
||||
|
||||
public async Task<AjaxResult> UpdateProject(GoviewProject project)
|
||||
{
|
||||
var flag = await Repository.AsUpdateable(project).IgnoreNullColumns().ExecuteCommandAsync();
|
||||
return flag > 0 ? AjaxResult.Success("修改成功") : AjaxResult.Error("修改失败");
|
||||
}
|
||||
|
||||
public async Task<AjaxResult> Create(GoviewProject project)
|
||||
{
|
||||
project.State = -1;
|
||||
project.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
var userId = _auth.GetUserId();
|
||||
project.CreateUserId = userId;
|
||||
project.Id = Guid.NewGuid().ToString();
|
||||
var flag = await Repository.InsertAsync(project);
|
||||
return flag ? AjaxResult.Success("创建成功") : AjaxResult.Error("创建失败");
|
||||
}
|
||||
|
||||
public async Task<AjaxResult> Publish(GoViewProjectRequest req)
|
||||
{
|
||||
var prj = new GoviewProject
|
||||
{
|
||||
Id = req.Id,
|
||||
State = req.State
|
||||
};
|
||||
var flag = await Repository.AsUpdateable(prj).IgnoreNullColumns().ExecuteCommandAsync() > 0;
|
||||
return flag ? AjaxResult.Success("操作成功") : AjaxResult.Error("操作失败");
|
||||
}
|
||||
|
||||
public async Task<ResultTable> List(GoViewProjectPage page)
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
var list = await Repository.AsQueryable()
|
||||
.ToPageListAsync(page.page, page.limit, total);
|
||||
|
||||
return new ResultTable()
|
||||
{
|
||||
Code = 200,
|
||||
Msg = "获取成功",
|
||||
Count = total,
|
||||
Data = list
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<AjaxResult> GetData(string projectId)
|
||||
{
|
||||
var prj = await Repository.AsQueryable().SingleAsync(a => a.Id == projectId);
|
||||
if (prj == null)
|
||||
{
|
||||
return AjaxResult.Error("项目不存在");
|
||||
}
|
||||
|
||||
var vo = prj.MapTo<ProjectResponse>();
|
||||
var data = await Repository.ChangeRepository<SugarRepositiry<GoviewProjectData>>().AsQueryable()
|
||||
.SingleAsync(a => a.ProjectId == projectId);
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
vo.Content = data.Content;
|
||||
}
|
||||
|
||||
return AjaxResult.SuccessData(200, vo);
|
||||
}
|
||||
|
||||
public async Task<AjaxResult> SaveData(GoviewProjectData data)
|
||||
{
|
||||
// 更新还是保存,
|
||||
var project = await Repository.AsQueryable().SingleAsync(a => a.Id == data.ProjectId);
|
||||
if (project == null)
|
||||
{
|
||||
throw new Exception("项目不存在");
|
||||
}
|
||||
|
||||
var prjData = await Repository
|
||||
.ChangeRepository<SugarRepositiry<GoviewProjectData>>()
|
||||
.AsQueryable()
|
||||
.SingleAsync(a => a.ProjectId == data.ProjectId);
|
||||
bool flag;
|
||||
if (prjData == null)
|
||||
{
|
||||
data.Id = Guid.NewGuid().ToString();
|
||||
flag = await Repository.ChangeRepository<SugarRepositiry<GoviewProjectData>>().InsertAsync(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = await Repository
|
||||
.ChangeRepository<SugarRepositiry<GoviewProjectData>>()
|
||||
.AsUpdateable(data)
|
||||
.IgnoreNullColumns()
|
||||
.ExecuteCommandAsync() > 0;
|
||||
}
|
||||
|
||||
return flag ? AjaxResult.Success("数据保存成功") : AjaxResult.Error("数据保存失败");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
using OpenAuth.App.Request;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.GoView.Request;
|
||||
|
||||
public class GoViewProjectPage : PageReq
|
||||
{
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
namespace OpenAuth.App.ServiceApp.GoView.Request;
|
||||
|
||||
public class GoViewProjectRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 项目id
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public int State { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
namespace OpenAuth.App.ServiceApp.GoView.Response;
|
||||
|
||||
public class AjaxResult : Dictionary<string, object>
|
||||
{
|
||||
/**
|
||||
* 初始化一个新创建的 Message 对象
|
||||
*/
|
||||
public AjaxResult()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @return 错误消息
|
||||
*/
|
||||
public static AjaxResult Error()
|
||||
{
|
||||
return Error(500, "操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @param msg 内容
|
||||
* @return 错误消息
|
||||
*/
|
||||
public static AjaxResult Error(string msg)
|
||||
{
|
||||
return Error(500, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回错误消息
|
||||
*
|
||||
* @param code 错误码
|
||||
* @param msg 内容
|
||||
* @return 错误消息
|
||||
*/
|
||||
public static AjaxResult Error(int code, string msg)
|
||||
{
|
||||
AjaxResult json = new AjaxResult();
|
||||
json["code"] = code;
|
||||
json["msg"] = msg;
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*
|
||||
* @param msg 内容
|
||||
* @return 成功消息
|
||||
*/
|
||||
public static AjaxResult Success(string msg)
|
||||
{
|
||||
AjaxResult json = new AjaxResult();
|
||||
json["msg"] = msg;
|
||||
json["code"] = 200;
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*
|
||||
* @return 成功消息
|
||||
*/
|
||||
public static AjaxResult Success()
|
||||
{
|
||||
return Success("操作成功");
|
||||
}
|
||||
|
||||
public static AjaxResult SuccessData(int code, object value)
|
||||
{
|
||||
AjaxResult json = new AjaxResult();
|
||||
json["code"] = code;
|
||||
json["data"] = value;
|
||||
return json;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回成功消息
|
||||
*
|
||||
* @param key 键值
|
||||
* @param value 内容
|
||||
* @return 成功消息
|
||||
*/
|
||||
public new AjaxResult Put(string key, object value)
|
||||
{
|
||||
base[key] = value;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
namespace OpenAuth.App.ServiceApp.GoView.Response;
|
||||
|
||||
public class ProjectResponse
|
||||
{
|
||||
private string _id;
|
||||
private string _projectName;
|
||||
private int? _state;
|
||||
private string _createTime;
|
||||
private string _createUserId;
|
||||
private int? _isDelete;
|
||||
private string _indexImage;
|
||||
private string _remarks;
|
||||
private string _content;
|
||||
|
||||
public string Id
|
||||
{
|
||||
get { return _id; }
|
||||
set { _id = value; }
|
||||
}
|
||||
|
||||
public string ProjectName
|
||||
{
|
||||
get { return _projectName; }
|
||||
set { _projectName = value; }
|
||||
}
|
||||
|
||||
public int? State
|
||||
{
|
||||
get { return _state; }
|
||||
set { _state = value; }
|
||||
}
|
||||
|
||||
public string CreateTime
|
||||
{
|
||||
get { return _createTime; }
|
||||
set { _createTime = value; }
|
||||
}
|
||||
|
||||
public string CreateUserId
|
||||
{
|
||||
get { return _createUserId; }
|
||||
set { _createUserId = value; }
|
||||
}
|
||||
|
||||
public int? IsDelete
|
||||
{
|
||||
get { return _isDelete; }
|
||||
set { _isDelete = value; }
|
||||
}
|
||||
|
||||
public string IndexImage
|
||||
{
|
||||
get { return _indexImage; }
|
||||
set { _indexImage = value; }
|
||||
}
|
||||
|
||||
public string Remarks
|
||||
{
|
||||
get { return _remarks; }
|
||||
set { _remarks = value; }
|
||||
}
|
||||
|
||||
public string Content
|
||||
{
|
||||
get { return _content; }
|
||||
set { _content = value; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
namespace OpenAuth.App.ServiceApp.GoView.Response;
|
||||
|
||||
public class ResultTable
|
||||
{
|
||||
/**
|
||||
* 状态码
|
||||
* */
|
||||
private int code;
|
||||
|
||||
/**
|
||||
* 提示消息
|
||||
* */
|
||||
private string msg;
|
||||
|
||||
/**
|
||||
* 消息总量
|
||||
* */
|
||||
private long count;
|
||||
|
||||
/**
|
||||
* 数据对象
|
||||
* */
|
||||
private object data;
|
||||
|
||||
public int Code
|
||||
{
|
||||
get { return code; }
|
||||
set { code = value; }
|
||||
}
|
||||
|
||||
public string Msg
|
||||
{
|
||||
get { return msg; }
|
||||
set { msg = value; }
|
||||
}
|
||||
|
||||
public long Count
|
||||
{
|
||||
get { return count; }
|
||||
set { count = value; }
|
||||
}
|
||||
|
||||
public object Data
|
||||
{
|
||||
get { return data; }
|
||||
set { data = value; }
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建
|
||||
* */
|
||||
public static ResultTable PageTable(long count, object data)
|
||||
{
|
||||
ResultTable resultTable = new ResultTable();
|
||||
resultTable.Data = data;
|
||||
resultTable.Code = 0;
|
||||
resultTable.Count = count;
|
||||
if (data != null)
|
||||
{
|
||||
resultTable.Msg = "获取成功";
|
||||
}
|
||||
else
|
||||
{
|
||||
resultTable.Msg = "获取失败";
|
||||
}
|
||||
|
||||
return resultTable;
|
||||
}
|
||||
|
||||
public static ResultTable DataTable(object data)
|
||||
{
|
||||
ResultTable resultTable = new ResultTable();
|
||||
resultTable.Data = data;
|
||||
resultTable.Code = 0;
|
||||
if (data != null)
|
||||
{
|
||||
resultTable.Msg = "获取成功";
|
||||
}
|
||||
else
|
||||
{
|
||||
resultTable.Msg = "获取失败";
|
||||
}
|
||||
|
||||
return resultTable;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
using NetTopologySuite.IO;
|
||||
|
||||
namespace OpenAuth.Repository.Domain;
|
||||
|
||||
public class DataTableAttr
|
||||
{
|
||||
// 字段名称
|
||||
public string Name { get; set; }
|
||||
|
||||
// 字段类型
|
||||
public string Type { get; set; }
|
||||
|
||||
// 字段长度
|
||||
public int Length { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// 对应数据库列名
|
||||
/// </summary>
|
||||
public string RefName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可能是中文描述
|
||||
/// </summary>
|
||||
public string InitName { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,260 @@
|
|||
using System.Data;
|
||||
using Infrastructure;
|
||||
using Infrastructure.Utils;
|
||||
using Microsoft.Extensions.Options;
|
||||
using NetTopologySuite;
|
||||
using NetTopologySuite.Geometries;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using NPOI.SS.UserModel;
|
||||
using NPOI.XSSF.UserModel;
|
||||
using OpenAuth.App.BaseApp.Base;
|
||||
using OpenAuth.App.Interface;
|
||||
using OpenAuth.App.ServiceApp.LayerManagerApp.Request;
|
||||
using OpenAuth.Repository;
|
||||
using OpenAuth.Repository.Domain;
|
||||
using SqlSugar;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.LayerManagerApp;
|
||||
|
||||
public class LayerApp : SqlSugarBaseApp<DmLayer, SugarDbContext>
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly ISqlSugarClient _client;
|
||||
|
||||
public LayerApp(ISugarUnitOfWork<SugarDbContext> unitWork,
|
||||
ISimpleClient<DmLayer> repository, IAuth auth,
|
||||
IOptions<AppSetting> setOptions, ISqlSugarClient client) : base(unitWork, repository, auth)
|
||||
{
|
||||
_client = client;
|
||||
_filePath = setOptions.Value.UploadPath;
|
||||
if (string.IsNullOrEmpty(_filePath))
|
||||
{
|
||||
_filePath = AppContext.BaseDirectory;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<Response<bool>> UploadExcel(LayerReq req)
|
||||
{
|
||||
using var db = Repository.AsSugarClient();
|
||||
var excelPath = Path.Combine(_filePath, req.FilePath);
|
||||
// excel名称
|
||||
var excelFileName = Path.GetFileNameWithoutExtension(excelPath);
|
||||
// 使用NPOI读取Excel文件
|
||||
using (var fileStream = new FileStream(excelPath, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
IWorkbook workbook;
|
||||
if (Path.GetExtension(excelPath).Equals(".xls"))
|
||||
{
|
||||
workbook = new HSSFWorkbook(fileStream);
|
||||
}
|
||||
else
|
||||
{
|
||||
workbook = new XSSFWorkbook(fileStream);
|
||||
}
|
||||
|
||||
//
|
||||
var sheet = workbook.GetSheetAt(0);
|
||||
// 获取总行数
|
||||
var rowCount = sheet.LastRowNum;
|
||||
if (rowCount < 3)
|
||||
{
|
||||
throw new Exception("只有两行表头");
|
||||
}
|
||||
|
||||
// 获取总列数
|
||||
var columnCount = sheet.GetRow(0).LastCellNum;
|
||||
var headers = new List<DataTableAttr>();
|
||||
// 遍历表头
|
||||
var chineseRow = sheet.GetRow(0);
|
||||
var englishRow = sheet.GetRow(1);
|
||||
|
||||
for (var j = 0; j < columnCount; j++)
|
||||
{
|
||||
var header = new DataTableAttr
|
||||
{
|
||||
InitName = chineseRow.GetCell(j).ToString(), // 中文表头
|
||||
RefName = englishRow.GetCell(j).ToString()?.ToLower(), // 英文表头
|
||||
// 字段类型
|
||||
Type = "string",
|
||||
// 原始字段名称
|
||||
Name = englishRow.GetCell(j).ToString(),
|
||||
// 字段长度
|
||||
Length = 64
|
||||
};
|
||||
headers.Add(header);
|
||||
}
|
||||
|
||||
var keys = headers.Select(a => a.RefName).ToList();
|
||||
if (!keys.Contains("lng") || !keys.Contains("lat"))
|
||||
{
|
||||
throw new Exception("缺少经纬度字段");
|
||||
}
|
||||
|
||||
var typeBuilder = db.DynamicBuilder().CreateClass(req.DataTable,
|
||||
new SugarTable() { TableName = req.DataTable, TableDescription = req.ServerName + "图斑" });
|
||||
//添加主键
|
||||
typeBuilder.CreateProperty("id", typeof(string), new SugarColumn()
|
||||
{
|
||||
IsPrimaryKey = true,
|
||||
IsIdentity = false,
|
||||
ColumnDataType = "varchar",
|
||||
Length = 36,
|
||||
ColumnDescription = "主键",
|
||||
});
|
||||
//添加主键
|
||||
typeBuilder.CreateProperty("geometry", typeof(string), new SugarColumn()
|
||||
{
|
||||
IsPrimaryKey = false,
|
||||
IsIdentity = false,
|
||||
// ColumnDataType = "geometry(GEOMETRY)",
|
||||
ColumnDataType = string.Concat("geometry(GEOMETRY,",
|
||||
req.SpatialRef.AsSpan(req.SpatialRef.LastIndexOf(":", StringComparison.Ordinal) + 1),
|
||||
")"),
|
||||
ColumnDescription = "图斑",
|
||||
});
|
||||
|
||||
headers.ForEach(u =>
|
||||
{
|
||||
if (!u.RefName.Equals("lng") && !u.RefName.Equals("lat"))
|
||||
{
|
||||
typeBuilder.CreateProperty(u.RefName, typeof(string), new SugarColumn()
|
||||
{
|
||||
IsPrimaryKey = false,
|
||||
IsIdentity = false,
|
||||
IsNullable = true,
|
||||
Length = u.Length,
|
||||
ColumnDescription = u.InitName,
|
||||
});
|
||||
}
|
||||
});
|
||||
// 开启事务
|
||||
await db.Ado.BeginTranAsync(IsolationLevel.ReadCommitted);
|
||||
// 创建表
|
||||
//db.CodeFirst.InitTables(typeBuilder.BuilderType());
|
||||
|
||||
var cols = new string[headers.Count];
|
||||
for (var i = 0; i < headers.Count; i++)
|
||||
{
|
||||
if (headers[i].RefName.Equals("lng"))
|
||||
{
|
||||
cols[i] = "geometry";
|
||||
}
|
||||
else if (headers[i].RefName.Equals("lat"))
|
||||
{
|
||||
cols[i] = "id";
|
||||
}
|
||||
else
|
||||
{
|
||||
cols[i] = headers[i].RefName;
|
||||
}
|
||||
}
|
||||
|
||||
var objs = new List<Dictionary<string, object>>(1001);
|
||||
var num = 0;
|
||||
// 遍历数据行
|
||||
for (var i = 2; i < rowCount; i++)
|
||||
{
|
||||
var row = sheet.GetRow(i);
|
||||
if (row == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var data = new Dictionary<string, object>();
|
||||
// 遍历列
|
||||
string lat = null, lng = null;
|
||||
for (var j = 0; j < columnCount; j++)
|
||||
{
|
||||
var cell = row.GetCell(j);
|
||||
if (cell == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var cellValue = cell.ToString();
|
||||
switch (headers[j].RefName)
|
||||
{
|
||||
case "lat":
|
||||
lat = cellValue;
|
||||
continue;
|
||||
case "lng":
|
||||
lng = cellValue;
|
||||
continue;
|
||||
default:
|
||||
data[headers[j].RefName] = cellValue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (lat != null && lng != null)
|
||||
{
|
||||
var geography =
|
||||
NtsGeometryServices.Instance.CreateGeometryFactory(
|
||||
int.Parse(req.SpatialRef.Substring(
|
||||
req.SpatialRef.IndexOf(":", StringComparison.Ordinal) + 1)));
|
||||
var point = geography.CreatePoint(new Coordinate(double.Parse(lng), double.Parse(lat)));
|
||||
data["geometry"] = point.AsText();
|
||||
}
|
||||
|
||||
data["id"] = Guid.NewGuid().ToString();
|
||||
objs.Add(data);
|
||||
if (num++ == 999)
|
||||
{
|
||||
await db.Insertable(objs)
|
||||
.AS(req.DataTable) // 指定目标表名
|
||||
.InsertColumns(cols) // 指定要插入的列
|
||||
.ExecuteCommandAsync();
|
||||
num = 0;
|
||||
objs.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
await db.Insertable(objs)
|
||||
.AS(req.DataTable) // 指定目标表名
|
||||
.InsertColumns(cols) // 指定要插入的列
|
||||
.ExecuteCommandAsync();
|
||||
await db.Ado.CommitTranAsync();
|
||||
workbook.Close();
|
||||
// 关于图层发布失败后,如何处理?
|
||||
// excel 矢量点发布图层
|
||||
var response = await GeoUtil.CreateStoreAndLayer("", req.SpatialRef, req.DataTable, "");
|
||||
// todo 保存图层信息
|
||||
var dmLayer = new DmLayer()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
SeverName = req.ServerName,
|
||||
SpatialRef = req.SpatialRef,
|
||||
SeverType = req.SeverType, // 服务类型
|
||||
StoreType = "", //存储类型
|
||||
DataSourceType = req.DataSourceType,
|
||||
TableRef = req.DataTable,
|
||||
ShapeType = req.ShapeType,
|
||||
StyleName = req.StyleName, // 样式名称
|
||||
Description = req.Description, // 描述
|
||||
Screenshot = req.Screenshot // 截图
|
||||
};
|
||||
await Repository.AsSugarClient().Insertable(dmLayer).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
return new Response<bool>
|
||||
{
|
||||
Result = true
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<Response<bool>> UploadShape(LayerReq req)
|
||||
{
|
||||
try
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new CommonException(ex.Message, 500);
|
||||
}
|
||||
|
||||
return new Response<bool>
|
||||
{
|
||||
Result = true
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,64 @@
|
|||
using OpenAuth.Repository.Domain;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.LayerManagerApp.Request
|
||||
{
|
||||
public class LayerReq
|
||||
{
|
||||
public LayerReq()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Desc:
|
||||
/// Default:
|
||||
/// Nullable:False
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Desc:服务名称
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public string ServerName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 空间参考
|
||||
/// </summary>
|
||||
public string SpatialRef { get; set; }
|
||||
|
||||
public string SeverType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据源类型
|
||||
/// </summary>
|
||||
public string DataSourceType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据表名
|
||||
/// </summary>
|
||||
public string DataTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件路径
|
||||
/// </summary>
|
||||
public string FilePath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 点线面
|
||||
/// </summary>
|
||||
public string ShapeType { get; set; }
|
||||
|
||||
// 头部信息,目前为空
|
||||
public List<DataTableAttr> Headers { get; set; }
|
||||
|
||||
public string Style { get; set; }
|
||||
|
||||
public string StyleName { get; set; }
|
||||
|
||||
public string Description { get; set; }
|
||||
|
||||
public string Screenshot { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
namespace OpenAuth.Repository.Domain;
|
||||
|
||||
public class DmLayer
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
/// <summary>
|
||||
/// 服务名
|
||||
/// </summary>
|
||||
public string SeverName { get; set; }
|
||||
/// <summary>
|
||||
/// 空间参考
|
||||
/// </summary>
|
||||
public string SpatialRef { get; set; }
|
||||
/// <summary>
|
||||
/// 服务类型 矢量 倾斜摄影 栅格
|
||||
/// </summary>
|
||||
public string SeverType { get; set; }
|
||||
/// <summary>
|
||||
/// 存储类型
|
||||
/// </summary>
|
||||
public string StoreType { get; set; }
|
||||
/// <summary>
|
||||
/// 数据源类型
|
||||
/// </summary>
|
||||
public string DataSourceType { get; set; }
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime? CreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 数据表名
|
||||
/// </summary>
|
||||
public string TableRef { get; set; }
|
||||
/// <summary>
|
||||
/// 是否发布
|
||||
/// </summary>
|
||||
public bool IsDisplay { get; set; }
|
||||
/// <summary>
|
||||
/// 矢量类型 点线面
|
||||
/// </summary>
|
||||
public string ShapeType { get; set; }
|
||||
/// <summary>
|
||||
/// 样式名称
|
||||
/// </summary>
|
||||
public string StyleName { get; set; }
|
||||
/// <summary>
|
||||
/// 描述
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// 截图
|
||||
/// </summary>
|
||||
public string Screenshot { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
using SqlSugar;
|
||||
|
||||
namespace OpenAuth.Repository.Domain.GoView;
|
||||
|
||||
/// <summary>
|
||||
/// 项目模型类
|
||||
/// </summary>
|
||||
[SugarTable("t_goview_project")]
|
||||
public class GoviewProject
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true, ColumnName = "id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目名称
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "project_name")]
|
||||
public string ProjectName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目状态 -1 1
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "state")]
|
||||
public int? State { get; set; }
|
||||
|
||||
[SugarColumn(IsNullable = true, ColumnName = "create_time")]
|
||||
public string CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "create_user_id")]
|
||||
public string CreateUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// -1-未删除 1-删除
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "is_delete")]
|
||||
public int? IsDelete { get; set; }
|
||||
[SugarColumn(ColumnName = "index_image")]
|
||||
public string IndexImage { get; set; }
|
||||
[SugarColumn(ColumnName = "remarks")]
|
||||
public string Remarks { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
using SqlSugar;
|
||||
|
||||
namespace OpenAuth.Repository.Domain.GoView;
|
||||
|
||||
/// <summary>
|
||||
/// 项目数据模型类
|
||||
/// </summary>
|
||||
[SugarTable("t_goview_project_data")]
|
||||
public class GoviewProjectData
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true,ColumnName = "id")]
|
||||
public string Id { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "project_id")]
|
||||
public string ProjectId { get; set; }
|
||||
|
||||
[SugarColumn(IsNullable = true, ColumnName = "create_time")]
|
||||
public string CreateTime { get; set; }
|
||||
|
||||
// 创建人
|
||||
[SugarColumn(ColumnName = "create_user_id")]
|
||||
public string CreateUserId { get; set; }
|
||||
|
||||
[SugarColumn(ColumnName = "content")] public string Content { get; set; }
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
using Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using OpenAuth.App.ServiceApp.LayerManagerApp;
|
||||
using OpenAuth.App.ServiceApp.LayerManagerApp.Request;
|
||||
|
||||
namespace OpenAuth.WebApi.Controllers.ServiceControllers.DataMaintenance;
|
||||
|
||||
/// <summary>
|
||||
/// 图层
|
||||
/// </summary>
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
public class LayerController : ControllerBase
|
||||
{
|
||||
private readonly LayerApp _app;
|
||||
|
||||
public LayerController(LayerApp layerApp)
|
||||
{
|
||||
_app = layerApp;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// excel 上传
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Response<bool>> UploadExcel(LayerReq req)
|
||||
{
|
||||
return await _app.UploadExcel(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// shape文件上传
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<Response<bool>> UploadShape(LayerReq req)
|
||||
{
|
||||
return await _app.UploadShape(req);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
using Infrastructure;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using OpenAuth.App.ServiceApp.GoView;
|
||||
using OpenAuth.App.ServiceApp.GoView.Request;
|
||||
using OpenAuth.App.ServiceApp.GoView.Response;
|
||||
using OpenAuth.Repository.Domain.GoView;
|
||||
|
||||
namespace OpenAuth.WebApi.Controllers.ServiceControllers.GoView;
|
||||
|
||||
/// <summary>
|
||||
/// go view 接口
|
||||
/// </summary>
|
||||
[Route("api/goview/project")]
|
||||
[ApiController]
|
||||
public class GoViewProjectController : ControllerBase
|
||||
{
|
||||
private readonly GoViewProjectApp _app;
|
||||
|
||||
public GoViewProjectController(GoViewProjectApp goView)
|
||||
{
|
||||
_app = goView;
|
||||
}
|
||||
|
||||
// 文件上传
|
||||
[HttpPost("uploadFile")]
|
||||
public async Task<Response<bool>> UploadFile(IFormFile file)
|
||||
{
|
||||
return null;
|
||||
//return await _app.UploadFile(file);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 新增项目
|
||||
/// </summary>
|
||||
/// <param name="project"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("create")]
|
||||
public async Task<AjaxResult> Create(GoviewProject project)
|
||||
{
|
||||
return await _app.Create(project);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除项目
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("delete")]
|
||||
public async Task<AjaxResult> DeleteProject(string ids)
|
||||
{
|
||||
return await _app.DeleteProject(ids);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改项目
|
||||
/// </summary>
|
||||
/// <param name="project"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("edit")]
|
||||
public async Task<AjaxResult> UpdateProject(GoviewProject project)
|
||||
{
|
||||
return await _app.UpdateProject(project);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目list集合
|
||||
/// </summary>
|
||||
/// <param name="page"></param>
|
||||
/// <param name="limit"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
public async Task<ResultTable> List([FromQuery] GoViewProjectPage page)
|
||||
{
|
||||
return await _app.List(page);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改发布状态(发布,取消发布)
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("publish")]
|
||||
public async Task<AjaxResult> Publish(GoViewProjectRequest req)
|
||||
{
|
||||
return await _app.Publish(req);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取项目数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getData")]
|
||||
public async Task<AjaxResult> GetData(string projectId)
|
||||
{
|
||||
return await _app.GetData(projectId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存项目数据
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("save/data")]
|
||||
public async Task<AjaxResult> SaveData(GoviewProjectData data)
|
||||
{
|
||||
return await _app.SaveData(data);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace OpenAuth.WebApi.Controllers.ServiceControllers.GoView
|
||||
{
|
||||
public class ProjectsController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -270,7 +270,7 @@ namespace OpenAuth.WebApi
|
|||
//UtilMethods.GetNativeSql(sql, pars);
|
||||
|
||||
//获取无参数化SQL 影响性能只适合调试
|
||||
//Console.WriteLine(UtilMethods.GetSqlString(DbType.PostgreSQL, sql, pars));
|
||||
Console.WriteLine(UtilMethods.GetSqlString(DbType.PostgreSQL, sql, pars));
|
||||
//Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
|
||||
//LogHelper.LogInformation(sql + "\r\n" +db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
|
||||
//Console.WriteLine();
|
||||
|
|
|
|||
Loading…
Reference in New Issue