Merge branch 'Insight' of http://123.132.248.154:10000/HC_YFZX/Infrastructure into Insight
commit
c3f87fb1e7
|
|
@ -0,0 +1,385 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Infrastructure.Helpers
|
||||
{
|
||||
public class HttpClientHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// get请求
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetResponse(string url, out string statusCode)
|
||||
{
|
||||
if (url.StartsWith("https"))
|
||||
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
|
||||
|
||||
var httpClient = new HttpClient();
|
||||
httpClient.DefaultRequestHeaders.Accept.Add(
|
||||
new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
HttpResponseMessage response = httpClient.GetAsync(url).Result;
|
||||
statusCode = response.StatusCode.ToString();
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string result = response.Content.ReadAsStringAsync().Result;
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string RestfulGet(string url)
|
||||
{
|
||||
HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
|
||||
// Get response
|
||||
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
|
||||
{
|
||||
// Get the response stream
|
||||
StreamReader reader = new StreamReader(response.GetResponseStream());
|
||||
// Console application output
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
|
||||
public static T GetResponse<T>(string url)
|
||||
where T : class, new()
|
||||
{
|
||||
if (url.StartsWith("https"))
|
||||
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
|
||||
|
||||
var httpClient = new HttpClient();
|
||||
httpClient.DefaultRequestHeaders.Accept.Add(
|
||||
new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
HttpResponseMessage response = httpClient.GetAsync(url).Result;
|
||||
|
||||
T result = default(T);
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
Task<string> t = response.Content.ReadAsStringAsync();
|
||||
string s = t.Result;
|
||||
|
||||
result = JsonConvert.DeserializeObject<T>(s);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// post请求
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="postData">post数据</param>
|
||||
/// <returns></returns>
|
||||
public static string PostResponse(string url, string postData, out string statusCode)
|
||||
{
|
||||
if (url.StartsWith("https"))
|
||||
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
|
||||
|
||||
HttpContent httpContent = new StringContent(postData);
|
||||
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
httpContent.Headers.ContentType.CharSet = "utf-8";
|
||||
|
||||
HttpClient httpClient = new HttpClient();
|
||||
//httpClient..setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "utf-8");
|
||||
|
||||
HttpResponseMessage response = httpClient.PostAsync(url, httpContent).Result;
|
||||
|
||||
statusCode = response.StatusCode.ToString();
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string result = response.Content.ReadAsStringAsync().Result;
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发起post请求
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="url">url</param>
|
||||
/// <param name="postData">post数据</param>
|
||||
/// <returns></returns>
|
||||
public static T PostResponse<T>(string url, string postData)
|
||||
where T : class, new()
|
||||
{
|
||||
if (url.StartsWith("https"))
|
||||
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
|
||||
|
||||
HttpContent httpContent = new StringContent(postData);
|
||||
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
HttpClient httpClient = new HttpClient();
|
||||
|
||||
T result = default(T);
|
||||
|
||||
HttpResponseMessage response = httpClient.PostAsync(url, httpContent).Result;
|
||||
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
Task<string> t = response.Content.ReadAsStringAsync();
|
||||
string s = t.Result;
|
||||
|
||||
result = JsonConvert.DeserializeObject<T>(s);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 反序列化Xml
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="xmlString"></param>
|
||||
/// <returns></returns>
|
||||
public static T XmlDeserialize<T>(string xmlString)
|
||||
where T : class, new()
|
||||
{
|
||||
try
|
||||
{
|
||||
XmlSerializer ser = new XmlSerializer(typeof(T));
|
||||
using (StringReader reader = new StringReader(xmlString))
|
||||
{
|
||||
return (T)ser.Deserialize(reader);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("XmlDeserialize发生异常:xmlString:" + xmlString + "异常信息:" + ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// POST请求
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="postData"></param>
|
||||
/// <param name="token"></param>
|
||||
/// <param name="appId"></param>
|
||||
/// <param name="serviceURL"></param>
|
||||
/// <param name="statusCode"></param>
|
||||
/// <returns></returns>
|
||||
public static string PostResponse(string url, string postData, string token, string appId, string serviceURL, out string statusCode)
|
||||
{
|
||||
if (url.StartsWith("https"))
|
||||
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
|
||||
|
||||
HttpContent httpContent = new StringContent(postData);
|
||||
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
|
||||
httpContent.Headers.ContentType.CharSet = "utf-8";
|
||||
|
||||
httpContent.Headers.Add("X-Token", token);
|
||||
//httpContent.Headers.Add("appId", appId);
|
||||
//httpContent.Headers.Add("serviceURL", serviceURL);
|
||||
|
||||
|
||||
HttpClient httpClient = new HttpClient();
|
||||
//httpClient..setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "utf-8");
|
||||
|
||||
HttpResponseMessage response = httpClient.PostAsync(url, httpContent).Result;
|
||||
|
||||
statusCode = response.StatusCode.ToString();
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string result = response.Content.ReadAsStringAsync().Result;
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改API
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="postData"></param>
|
||||
/// <returns></returns>
|
||||
public static string ClientPatchResponse(string url, string postData)
|
||||
{
|
||||
var httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
|
||||
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
|
||||
httpWebRequest.Method = "PATCH";
|
||||
|
||||
byte[] btBodys = Encoding.UTF8.GetBytes(postData);
|
||||
httpWebRequest.ContentLength = btBodys.Length;
|
||||
httpWebRequest.GetRequestStream().Write(btBodys, 0, btBodys.Length);
|
||||
|
||||
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
|
||||
var streamReader = new StreamReader(httpWebResponse.GetResponseStream());
|
||||
string responseContent = streamReader.ReadToEnd();
|
||||
|
||||
httpWebResponse.Close();
|
||||
streamReader.Close();
|
||||
httpWebRequest.Abort();
|
||||
httpWebResponse.Close();
|
||||
|
||||
return responseContent;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建API
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="postData"></param>
|
||||
/// <returns></returns>
|
||||
public static string ClientPostResponse(string url, string postData)
|
||||
{
|
||||
if (url.StartsWith("https"))
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
|
||||
HttpContent httpContent = new StringContent(postData);
|
||||
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded") { CharSet = "utf-8" };
|
||||
var httpClient = new HttpClient();
|
||||
HttpResponseMessage response = httpClient.PostAsync(url, httpContent).Result;
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string result = response.Content.ReadAsStringAsync().Result;
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除API
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <returns></returns>
|
||||
public static bool ClientDeleteResponse(string url)
|
||||
{
|
||||
if (url.StartsWith("https"))
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
|
||||
|
||||
var httpClient = new HttpClient();
|
||||
HttpResponseMessage response = httpClient.DeleteAsync(url).Result;
|
||||
return response.IsSuccessStatusCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改或者更改API
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="postData"></param>
|
||||
/// <returns></returns>
|
||||
public static string ClientPutResponse(string url, string postData)
|
||||
{
|
||||
if (url.StartsWith("https"))
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
|
||||
|
||||
HttpContent httpContent = new StringContent(postData);
|
||||
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded") { CharSet = "utf-8" };
|
||||
|
||||
var httpClient = new HttpClient();
|
||||
HttpResponseMessage response = httpClient.PutAsync(url, httpContent).Result;
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string result = response.Content.ReadAsStringAsync().Result;
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检索API
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <returns></returns>
|
||||
public static string ClientGetResponse(string url)
|
||||
{
|
||||
if (url.StartsWith("https"))
|
||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
|
||||
|
||||
var httpClient = new HttpClient();
|
||||
HttpResponseMessage response = httpClient.GetAsync(url).Result;
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
string result = response.Content.ReadAsStringAsync().Result;
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 上传文件请求
|
||||
/// </summary>
|
||||
/// <param name="url"></param>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
public static string ClientUploadResponse(string url, MultipartFormDataContent content, IFormFile file)
|
||||
{
|
||||
using (HttpClient client = new HttpClient())
|
||||
{
|
||||
//添加字符串参数,参数名为qq
|
||||
//content.Add(new StringContent("123456"), "qq");
|
||||
string fileName = file.FileName;
|
||||
|
||||
var byteFile = GetBytesByFormFile(file);
|
||||
//添加文件参数,参数名为files,文件名为123.png
|
||||
content.Add(new ByteArrayContent(byteFile), "file", fileName);
|
||||
|
||||
var requestUri = url;
|
||||
var result = client.PostAsync(requestUri, content).Result.Content.ReadAsStringAsync().Result;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取文件字节
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
public static byte[] GetBytesByFormFile(IFormFile file)
|
||||
{
|
||||
//流
|
||||
var stream = file.OpenReadStream();
|
||||
//字节
|
||||
var bytes = new byte[stream.Length];
|
||||
//开始读取字节
|
||||
stream.Read(bytes, 0, bytes.Length);
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 保存文件到项目路径
|
||||
/// </summary>
|
||||
/// <param name="file"></param>
|
||||
/// <returns></returns>
|
||||
public static bool SaveFile(IFormFileCollection files)
|
||||
{
|
||||
foreach (var file in files)
|
||||
{
|
||||
//文件名
|
||||
string fileName = file.FileName;
|
||||
//扩展名
|
||||
var extName = fileName.Substring(fileName.IndexOf("."));
|
||||
|
||||
var bytes = GetBytesByFormFile(file);
|
||||
//项目路径
|
||||
string path = Environment.CurrentDirectory;
|
||||
//路径是否存在
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
//创建目录
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
//文件目录
|
||||
string filePath = path + "\\" + (Guid.NewGuid().ToString() + extName);
|
||||
//文件流
|
||||
using (FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
//开始保存文件流
|
||||
fs.Write(bytes);
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OpenAuth.App.Request;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
@ -9,6 +14,13 @@ namespace OpenAuth.App.Common
|
|||
{
|
||||
public class CommonData
|
||||
{
|
||||
private ISqlSugarClient db;
|
||||
|
||||
public CommonData(ISqlSugarClient client)
|
||||
{
|
||||
db = client;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行cmd命令
|
||||
/// </summary>
|
||||
|
|
@ -41,5 +53,130 @@ namespace OpenAuth.App.Common
|
|||
p.Close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Pgsql获取GeoJson数据
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <param name="_configuration"></param>
|
||||
/// <returns></returns>
|
||||
public JToken PgsqlGeoJsonCommon(QueryGeoJsonCommonReq req)
|
||||
{
|
||||
//如果有的参数为空,设置参数的默认值
|
||||
req.init();
|
||||
|
||||
//查询列的数据
|
||||
StringBuilder sqlColumn = new StringBuilder();
|
||||
sqlColumn.AppendFormat(" select {1} from {0} {3} order by \"{2}\"", req.tablename, req.column, req.order, req.where);
|
||||
|
||||
StringBuilder sqlGeo = new StringBuilder();
|
||||
sqlGeo.AppendFormat(" select st_asgeojson(\"{0}\") geom from \"{1}\" {3} order by \"{2}\"", req.geom, req.tablename, req.order, req.where);
|
||||
|
||||
return PgsqlGeoJsonCommon(sqlColumn, sqlGeo, req.pageIndex, req.limit);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询GeoJson公共方法
|
||||
/// </summary>
|
||||
/// <param name="sqlColumn"></param>
|
||||
/// <param name="sqlGeom"></param>
|
||||
/// <param name="pageIndex"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <param name="_configuration"></param>
|
||||
/// <returns></returns>
|
||||
public JToken PgsqlGeoJsonCommon(StringBuilder sqlColumn, StringBuilder sqlGeom, int pageIndex, int pageSize)
|
||||
{
|
||||
//获取到数据库操作实例
|
||||
int total = 0;
|
||||
int totalPage = 0;
|
||||
|
||||
//查询列
|
||||
var dt_properties = db.SqlQueryable<dynamic>(sqlColumn.ToString()).ToPageList(pageIndex, pageSize, ref total, ref totalPage);
|
||||
//列数据转换为字符串
|
||||
string str_properties = JsonConvert.SerializeObject(dt_properties);
|
||||
//列数据转换为json对象
|
||||
JToken jtoken_properties = (JToken)JsonConvert.DeserializeObject(str_properties);
|
||||
|
||||
//查询geojson数据
|
||||
var dt_geom = db.SqlQueryable<dynamic>(sqlGeom.ToString()).ToDataTablePage(pageIndex, pageSize);
|
||||
|
||||
//组装最终数据
|
||||
JObject obj = new JObject();
|
||||
JArray array = new JArray();
|
||||
obj.Add("type", "FeatureCollection");
|
||||
obj.Add("totalNumber", total);
|
||||
obj.Add("totalPage", totalPage);
|
||||
//遍历geojson数据
|
||||
for (var i = 0; i < dt_geom.Rows.Count; i++)
|
||||
{
|
||||
//行数据
|
||||
DataRow item = dt_geom.Rows[i];
|
||||
//单条geojson
|
||||
string _geom = item["geom"] == DBNull.Value ? "" : item["geom"].ToString();
|
||||
//给数据赋值
|
||||
JObject featureObj = new JObject();
|
||||
featureObj.Add("type", "Feature");
|
||||
featureObj.Add("geometry", (JToken)JsonConvert.DeserializeObject(_geom));
|
||||
featureObj.Add("properties", jtoken_properties[i]);
|
||||
//添加到数组
|
||||
array.Add(featureObj);
|
||||
}
|
||||
obj.Add("features", array);
|
||||
return obj;
|
||||
|
||||
}
|
||||
|
||||
public string GetMaxKeyVal(string _column, string tablename, int _gid_const)
|
||||
{
|
||||
string _val = "";
|
||||
//查询最大的gid
|
||||
var column_list = SearchColumnsList(tablename);
|
||||
string _type = column_list[0].column_type;
|
||||
if (_type != "integer")
|
||||
{
|
||||
_val = Guid.NewGuid().ToString();
|
||||
return _val;
|
||||
}
|
||||
|
||||
var _maxgid = db.SqlQueryable<dynamic>($"SELECT max(\"{_column}\") \"maxGid\" FROM \"{tablename}\" where \"{_column}\" < 6000000").First().maxGid;
|
||||
//gid为空时,说明一条数据都没有
|
||||
if (_maxgid == null)
|
||||
_val = _gid_const.ToString();
|
||||
else
|
||||
{
|
||||
//如果大于设定值,在此基础上加一,否则设置为默认值
|
||||
if (_maxgid >= _gid_const)
|
||||
_val = (_maxgid + 1).ToString();
|
||||
else
|
||||
_val = _gid_const.ToString();
|
||||
}
|
||||
return _val;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取列名
|
||||
/// </summary>
|
||||
/// <param name="tablename"></param>
|
||||
/// <returns></returns>
|
||||
public List<dynamic> SearchColumnsList(string tablename)
|
||||
{
|
||||
//查询列名和注释描述
|
||||
StringBuilder columnSql = new StringBuilder();
|
||||
columnSql.AppendFormat(@$" SELECT a.attname column_name,col_description(a.attrelid,a.attnum) as description,format_type(a.atttypid,a.atttypmod) as column_type
|
||||
FROM pg_class as c,pg_attribute as a
|
||||
where c.relname = '{tablename}'
|
||||
and a.attrelid = c.oid
|
||||
and a.attnum>0
|
||||
and attstattarget = -1");
|
||||
//查询结果
|
||||
|
||||
var column_list = db.SqlQueryable<dynamic>(columnSql.ToString()).ToList();
|
||||
return column_list;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.Request
|
||||
{
|
||||
public class AddDroneCaseByDroneReq
|
||||
{
|
||||
public string remark { get; set; }
|
||||
public decimal? lng { get; set; }
|
||||
public decimal? lat { get; set; }
|
||||
public List<string> pic_list { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenAuth.Repository.Domain;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.Request
|
||||
{
|
||||
/// <summary>
|
||||
/// 同步案件请求
|
||||
/// </summary>
|
||||
public class AddOrUpdateAsyncDroneCaseDataReq
|
||||
{
|
||||
/// <summary>
|
||||
/// 案件实体
|
||||
/// </summary>
|
||||
public DroneCaseinfo model { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图片文件
|
||||
/// </summary>
|
||||
public List<DroneFiles> files { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// shp图层数据
|
||||
/// </summary>
|
||||
public List<DroneShpData> shps { get; set; }
|
||||
/// <summary>
|
||||
/// 关联案件
|
||||
/// </summary>
|
||||
public List<DroneCaseinfoRelation> relations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 案件标签
|
||||
/// </summary>
|
||||
public List<DroneCaseinfoTag> tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 专题信息
|
||||
/// </summary>
|
||||
public List<Subject> subjects { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.Request
|
||||
{
|
||||
public class AddOrUpdateDownLoadInternetToLocalReq
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求的互联网地址
|
||||
/// </summary>
|
||||
public string uri { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求的图片路径地址
|
||||
/// </summary>
|
||||
public List<string> files { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
using OpenAuth.Repository.Domain;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenAuth.App.ServiceApp.Response
|
||||
{
|
||||
/// <summary>
|
||||
/// 无人机案件添加实体
|
||||
/// </summary>
|
||||
public class AddOrUpdateDroneCaseInfoDataBaseReq
|
||||
{
|
||||
public void Init()
|
||||
{
|
||||
if (this.pic_list == null) pic_list = new List<string>();
|
||||
if (this.video_list == null) video_list = new List<string>();
|
||||
if (this.relationCaseNo == null) relationCaseNo = new List<string>();
|
||||
if (this.tags == null) tags = new List<string>();
|
||||
}
|
||||
|
||||
public DroneCaseinfo info { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图片列表
|
||||
/// </summary>
|
||||
public List<string> pic_list { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 视频列表
|
||||
/// </summary>
|
||||
public List<string> video_list { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 关联案件
|
||||
/// </summary>
|
||||
public List<string> relationCaseNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 案件标签
|
||||
/// </summary>
|
||||
public List<string> tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图片列表
|
||||
/// </summary>
|
||||
public List<DroneFiles> pics { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 视频列表
|
||||
/// </summary>
|
||||
public List<DroneFiles> videos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库id
|
||||
/// </summary>
|
||||
public string[] databaseid { get; set; }
|
||||
|
||||
public List<string> subjectkeys { get; set; }
|
||||
}
|
||||
|
||||
public class AddOrUpdateDroneCaseInfoDataBaseReqExt : AddOrUpdateDroneCaseInfoDataBaseReq
|
||||
{
|
||||
public decimal? lng { get; set; }
|
||||
public decimal? lat { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace OpenAuth.Repository.Domain
|
||||
{
|
||||
/// <summary>
|
||||
/// 日 期:2024.09.19
|
||||
/// 描 述:推送日志
|
||||
/// </summary>
|
||||
[SugarTable("drone_caseinfo_pushlog")]
|
||||
public class DroneCaseinfoPushLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 列主键
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public string Id { get; set; }
|
||||
/// <summary>
|
||||
/// 推送时间
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public DateTime PushTime { get; set; }
|
||||
/// <summary>
|
||||
/// 推送到哪个数据库名称
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string DatabaseName { get; set; }
|
||||
/// <summary>
|
||||
/// 推送的参数
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Data { get; set; }
|
||||
/// <summary>
|
||||
/// 是否推送成功
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool IsSuccess { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型(1数据 2图片)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 推送数据库id
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string DataBaseId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 专题名称
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string SubjectName { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,11 @@
|
|||
using Microsoft.AspNetCore.Http;
|
||||
using Infrastructure;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using OpenAuth.App.ServiceApp.DroneCaseInfo;
|
||||
using OpenAuth.App.ServiceApp.InsTaskHallManager;
|
||||
using OpenAuth.App.ServiceApp.Request;
|
||||
using OpenAuth.App.ServiceApp.Response;
|
||||
|
||||
namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
||||
{
|
||||
|
|
@ -20,5 +24,92 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers
|
|||
{
|
||||
return _app.Test(txt);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 无人机添加案件
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Response<string> AddDroneCaseByDrone([FromBody] AddDroneCaseByDroneReq req)
|
||||
{
|
||||
Response<string> response = new Response<string>();
|
||||
try
|
||||
{
|
||||
response.Result = _app.AddDroneCaseByDrone(req);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Code = 500;
|
||||
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 案件详情
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public Response<AddOrUpdateDroneCaseInfoDataBaseReqExt> GetCaseInfo(string id)
|
||||
{
|
||||
Response<AddOrUpdateDroneCaseInfoDataBaseReqExt> response = new Response<AddOrUpdateDroneCaseInfoDataBaseReqExt>();
|
||||
try
|
||||
{
|
||||
response.Result = _app.GetCaseInfo(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Code = 500;
|
||||
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取GeoJson
|
||||
/// PC获取图层的GeoJson(判读页面用)
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public Response<JToken> GetDroneGeoJson(string id)
|
||||
{
|
||||
Response<JToken> response = new Response<JToken>();
|
||||
try
|
||||
{
|
||||
response.Result = _app.GetDroneGeoJson(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Code = 500;
|
||||
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 案件判读
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public Response<string> UpdateDroneCaseInfoIntact([FromBody] AddOrUpdateDroneCaseInfoDataBaseReq req)
|
||||
{
|
||||
Response<string> response = new Response<string>();
|
||||
try
|
||||
{
|
||||
response.Result = _app.UpdateDroneCaseInfoIntact(req);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
response.Code = 500;
|
||||
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue