Compare commits
2 Commits
4058bd60a2
...
19455f5f0c
| Author | SHA1 | Date |
|---|---|---|
|
|
19455f5f0c | |
|
|
ceb2f610a7 |
|
|
@ -512,17 +512,17 @@ namespace OpenAuth.App
|
||||||
{
|
{
|
||||||
using (var uow = base.UnitWork.CreateContext())
|
using (var uow = base.UnitWork.CreateContext())
|
||||||
{
|
{
|
||||||
foreach (var item in uow.Db.DbMaintenance.GetTableInfoList().Where(r => r.Name.ToLower().StartsWith("drone_docktask")))
|
foreach (var item in uow.Db.DbMaintenance.GetTableInfoList().Where(r => r.Name.ToLower().StartsWith("lasa_annotation")))
|
||||||
{
|
{
|
||||||
string entityName = item.Name.Substring(0, 1).ToUpper() + item.Name.Substring(1, 4).ToLower() + item.Name.Substring(6, 1).ToUpper() + item.Name.Substring(7).ToLower();/*实体名大写*/
|
//string entityName = item.Name.Substring(0, 1).ToUpper() + item.Name.Substring(1, 4).ToLower() + item.Name.Substring(6, 1).ToUpper() + item.Name.Substring(7).ToLower();/*实体名大写*/
|
||||||
//string entityName = "LasaShpData";
|
string entityName = "LasaAnnotation";
|
||||||
uow.Db.MappingTables.Add(entityName, item.Name);
|
uow.Db.MappingTables.Add(entityName, item.Name);
|
||||||
//foreach (var col in db.DbMaintenance.GetColumnInfosByTableName(item.Name))
|
//foreach (var col in db.DbMaintenance.GetColumnInfosByTableName(item.Name))
|
||||||
//{
|
//{
|
||||||
// db.MappingColumns.Add(col.DbColumnName.ToUpper() /*类的属性大写*/, col.DbColumnName, entityName);
|
// db.MappingColumns.Add(col.DbColumnName.ToUpper() /*类的属性大写*/, col.DbColumnName, entityName);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
uow.Db.DbFirst.Where(r => r.ToLower().StartsWith("drone_docktask")).IsCreateAttribute().CreateClassFile("E:\\低空态势感知\\code\\OpenAuth.Repository\\Domain", "OpenAuth.Repository.Domain");
|
uow.Db.DbFirst.Where(r => r.ToLower().StartsWith("lasa_annotation")).IsCreateAttribute().CreateClassFile("E:\\低空态势感知\\code\\OpenAuth.Repository\\Domain", "OpenAuth.Repository.Domain");
|
||||||
uow.Commit();
|
uow.Commit();
|
||||||
}
|
}
|
||||||
return "更新实体成功";
|
return "更新实体成功";
|
||||||
|
|
|
||||||
|
|
@ -975,6 +975,159 @@ namespace OpenAuth.App.ServiceApp
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 添加地图标注
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加地图标注
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<Response<string>> AddAnnotation(LasaAnnotation model)
|
||||||
|
{
|
||||||
|
var _user = _auth.GetCurrentUser().User;
|
||||||
|
model.CreateTime = DateTime.Now;
|
||||||
|
model.CreateUser = _user.Id.ToString();
|
||||||
|
model.CreateUserName = _user.Name.ToString();
|
||||||
|
using (var db = base.UnitWork.CreateContext().Db.CopyNew())
|
||||||
|
{
|
||||||
|
//获取主键
|
||||||
|
string id = Guid.NewGuid().ToString();
|
||||||
|
model.Id = id;
|
||||||
|
|
||||||
|
//格式化数据
|
||||||
|
string _wktModel = _commonDataManager.WktDataConvert(model.Geom, "MULTIPOLYGON ZM", 4);
|
||||||
|
|
||||||
|
model.Geom = null;
|
||||||
|
|
||||||
|
StringBuilder geomSql = new StringBuilder();
|
||||||
|
geomSql.AppendFormat(
|
||||||
|
$" update lasa_shpdata set \"Geom\" = st_geomfromtext('{_wktModel}',4326) where \"Id\" = '{id}'");
|
||||||
|
|
||||||
|
////更新面积
|
||||||
|
//StringBuilder sql = new StringBuilder();
|
||||||
|
//sql.AppendFormat(
|
||||||
|
// $" update lasa_shpdata set \"Area\" = st_area(st_transform(\"Geom\",4527)) where \"Geom\" is not null and \"Id\" = '{id}'");
|
||||||
|
|
||||||
|
////更新周长
|
||||||
|
//StringBuilder sqlle = new StringBuilder();
|
||||||
|
//sqlle.AppendFormat(
|
||||||
|
// $" update lasa_shpdata set \"Length\" = ST_Perimeter(st_transform(\"Geom\",4527)) where \"Geom\" is not null and \"Id\" = '{id}'");
|
||||||
|
|
||||||
|
//使用事务提交数据
|
||||||
|
var transFlag = await db.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
//插入图斑数据
|
||||||
|
var flag = await db.Insertable(model).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
//修改图斑数据
|
||||||
|
var flagGeom = await db.Ado.ExecuteCommandAsync(geomSql.ToString());
|
||||||
|
|
||||||
|
////修改图斑面积
|
||||||
|
//var flagUpdate = await db.Ado.ExecuteCommandAsync(sql.ToString());
|
||||||
|
|
||||||
|
////修改图斑周长
|
||||||
|
//var lengthUpdate = await db.Ado.ExecuteCommandAsync(sqlle.ToString());
|
||||||
|
});
|
||||||
|
if (transFlag.IsSuccess)
|
||||||
|
return new Response<string>
|
||||||
|
{
|
||||||
|
Result = id,
|
||||||
|
Message = "新增成功"
|
||||||
|
};
|
||||||
|
else
|
||||||
|
return new Response<string>
|
||||||
|
{
|
||||||
|
Message = "新增失败"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新地图标注
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<Response<string>> UpdateAnnotation(LasaAnnotation model)
|
||||||
|
{
|
||||||
|
using (var db = base.UnitWork.CreateContext().Db.CopyNew())
|
||||||
|
{
|
||||||
|
//格式化数据
|
||||||
|
string _wktModel = _commonDataManager.WktDataConvert(model.Geom, "MULTIPOLYGON ZM", 4);
|
||||||
|
|
||||||
|
model.Geom = null;
|
||||||
|
|
||||||
|
StringBuilder geomSql = new StringBuilder();
|
||||||
|
geomSql.AppendFormat(
|
||||||
|
$" update lasa_shpdata set \"Geom\" = st_geomfromtext('{_wktModel}',4326) where \"Id\" = '{model.Id}'");
|
||||||
|
|
||||||
|
//使用事务提交数据
|
||||||
|
var transFlag = await db.UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
//插入图斑数据
|
||||||
|
var flag = await db.Updateable(model).ExecuteCommandAsync();
|
||||||
|
|
||||||
|
//修改图斑数据
|
||||||
|
var flagGeom = await db.Ado.ExecuteCommandAsync(geomSql.ToString());
|
||||||
|
|
||||||
|
});
|
||||||
|
if (transFlag.IsSuccess)
|
||||||
|
return new Response<string>
|
||||||
|
{
|
||||||
|
Result = model.Id,
|
||||||
|
Message = "更新成功"
|
||||||
|
};
|
||||||
|
else
|
||||||
|
return new Response<string>
|
||||||
|
{
|
||||||
|
Message = "更新失败"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//删除地图标注
|
||||||
|
public async Task<Response<bool>> DeleteAnnotation(string id)
|
||||||
|
{
|
||||||
|
using (var db = UnitWork.CreateContext())
|
||||||
|
{
|
||||||
|
await db.LasaAnnotation.DeleteByIdAsync(id);
|
||||||
|
if (db.Commit())
|
||||||
|
return new Response<bool> { Result = true, Message = "删除成功" };
|
||||||
|
else
|
||||||
|
return new Response<bool> { Result = false, Message = "删除失败" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取地图标注列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="workspaceid">项目id</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<Response<List<LasaAnnotation>>> GetAnnotationList(string workspaceid, int? state, int? type)
|
||||||
|
{
|
||||||
|
using (var db = UnitWork.CreateContext())
|
||||||
|
{
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.AppendFormat($" Select * from lasa_annotation where \"WorkSpaceId\" = '{workspaceid}'");
|
||||||
|
var list = db.Db.SqlQueryable<LasaAnnotation>(sql.ToString()).ToList();
|
||||||
|
if (type!=null && list.Count > 0)
|
||||||
|
{
|
||||||
|
list = list.Where(r => r.Type == type).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state != null)
|
||||||
|
{
|
||||||
|
list = list.Where(r => r.State == state).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response<List<LasaAnnotation>>
|
||||||
|
{
|
||||||
|
Result = list
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
public async Task<string> TestExecuteFlyTask(string flightid)
|
public async Task<string> TestExecuteFlyTask(string flightid)
|
||||||
{
|
{
|
||||||
// flighttask_prepare method
|
// flighttask_prepare method
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,104 @@
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace OpenAuth.Repository.Domain
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
///地图标注表
|
||||||
|
///</summary>
|
||||||
|
[SugarTable("lasa_annotation")]
|
||||||
|
public partial class LasaAnnotation
|
||||||
|
{
|
||||||
|
public LasaAnnotation(){
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:主键
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsPrimaryKey=true)]
|
||||||
|
public string Id {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:名称
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string Name {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:类型(0点,1线,2多边行,3圈)
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public int? Type {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:属性(边框属性,颜色,宽度等,json格式)
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string Properties {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:创建时间
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? CreateTime {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:创建人
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string CreateUser {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:区域
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string Geom {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:项目id
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string WorkSpaceId {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:状态(0已启用,1禁用)
|
||||||
|
/// Default:0
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public int State {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:创建人姓名
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string CreateUserName {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:是否展示
|
||||||
|
/// Default:0.00
|
||||||
|
/// Nullable:False
|
||||||
|
/// </summary>
|
||||||
|
public short Display {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Desc:简介
|
||||||
|
/// Default:
|
||||||
|
/// Nullable:True
|
||||||
|
/// </summary>
|
||||||
|
public string Remark {get;set;}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -66,6 +66,7 @@ namespace OpenAuth.Repository
|
||||||
public SugarRepositiry<LasaAirLine> LasaAirLine { get; set; }
|
public SugarRepositiry<LasaAirLine> LasaAirLine { get; set; }
|
||||||
public SugarRepositiry<LasaWorkspace> LasaWorkspace { get; set; }
|
public SugarRepositiry<LasaWorkspace> LasaWorkspace { get; set; }
|
||||||
public SugarRepositiry<LasaShpData> LasaShpData { get; set; }
|
public SugarRepositiry<LasaShpData> LasaShpData { get; set; }
|
||||||
|
public SugarRepositiry<LasaAnnotation> LasaAnnotation { get; set; }
|
||||||
public SugarRepositiry<LasaSpaceUser> LasaSpaceUser { get; set; }
|
public SugarRepositiry<LasaSpaceUser> LasaSpaceUser { get; set; }
|
||||||
public SugarRepositiry<LasaSpaceDevice> LasaSpaceDevice { get; set; }
|
public SugarRepositiry<LasaSpaceDevice> LasaSpaceDevice { get; set; }
|
||||||
public SugarRepositiry<LasaSpaceLockFly> LasaSpaceLockFly { get; set; }
|
public SugarRepositiry<LasaSpaceLockFly> LasaSpaceLockFly { get; set; }
|
||||||
|
|
|
||||||
|
|
@ -654,6 +654,90 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 添加地图标注
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加地图标注
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<Response<string>> AddAnnotation([FromBody] LasaAnnotation model)
|
||||||
|
{
|
||||||
|
var res = new Response<string>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _app.AddAnnotation(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
res.Code = 500;
|
||||||
|
res.Message = ex.InnerException?.Message ?? ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新地图标注
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="model"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<Response<string>> UpdateAnnotation([FromBody] LasaAnnotation model)
|
||||||
|
{
|
||||||
|
var res = new Response<string>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _app.UpdateAnnotation(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
res.Code = 500;
|
||||||
|
res.Message = ex.InnerException?.Message ?? ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除地图标注
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">地图标注id</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<Response<bool>> DeleteAnnotation(string id)
|
||||||
|
{
|
||||||
|
return await _app.DeleteAnnotation(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取地图标注列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="workspaceid">项目id</param>
|
||||||
|
/// <param name="state">项目状态(0已启用,1已禁用,null全部)</param>
|
||||||
|
/// <param name="type">区域类型(0点,1线,2多边行,3圈)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
public async Task<Response<List<LasaAnnotation>>> GetAnnotationList(string workspaceid, int? state, int? type)
|
||||||
|
{
|
||||||
|
var result = new Response<List<LasaAnnotation>>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
result = await _app.GetAnnotationList(workspaceid, state, type);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
result.Code = 500;
|
||||||
|
result.Message = ex.Message;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region 基本信息
|
#region 基本信息
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取基本信息
|
/// 获取基本信息
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue