摄像头相关接口添加
parent
111091664f
commit
08148c093e
|
|
@ -36,6 +36,9 @@ using Hopetry.App.SugarModel.FeiXianModel.YingJingJu;
|
||||||
using Infrastructure.Helpers;
|
using Infrastructure.Helpers;
|
||||||
using Yitter.IdGenerator;
|
using Yitter.IdGenerator;
|
||||||
using static Org.BouncyCastle.Math.EC.ECCurve;
|
using static Org.BouncyCastle.Math.EC.ECCurve;
|
||||||
|
using DocumentFormat.OpenXml.Wordprocessing;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using DocumentFormat.OpenXml.Vml.Wordprocessing;
|
||||||
|
|
||||||
namespace OpenAuth.App.ServiceApp.FireManagement
|
namespace OpenAuth.App.ServiceApp.FireManagement
|
||||||
{
|
{
|
||||||
|
|
@ -1530,6 +1533,428 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
||||||
return "fail";
|
return "fail";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<Response<dynamic>> ListCameraWithInRange(string lng, string lat, int radius)
|
||||||
|
{
|
||||||
|
// '{lng}', '{lat}'
|
||||||
|
var sql =
|
||||||
|
@$"WITH reference_point AS ( SELECT ST_SetSRID ( ST_MakePoint ( '{lng}', '{lat}' )::geography, 4326 ) AS geom ) SELECT
|
||||||
|
l.*
|
||||||
|
FROM
|
||||||
|
fm_camera l,
|
||||||
|
reference_point r
|
||||||
|
WHERE
|
||||||
|
ST_DWithin ( ST_SetSRID ( ST_MakePoint ( l.""Lng"" :: FLOAT, l.""Lat"" :: FLOAT )::geography, 4326 ), r.geom, {radius}
|
||||||
|
)
|
||||||
|
ORDER BY
|
||||||
|
ST_Distance ( ST_SetSRID ( ST_MakePoint ( l.""Lng"" :: FLOAT, l.""Lat"" :: FLOAT )::geography, 4326 ), r.geom ) ";
|
||||||
|
var x = await Repository.AsSugarClient().SqlQueryable<dynamic>(sql).ToListAsync();
|
||||||
|
return new Response<dynamic>
|
||||||
|
{
|
||||||
|
Result = x
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Response<dynamic>> ListDaHuaCameraInfo(int pageNum, int pageSize, int isOnline)
|
||||||
|
{
|
||||||
|
var daHuaApi = new DaHuaApi("https://icc-dev.hibetatest.com:4077");
|
||||||
|
var channelCategoryRequest = new ChannelCategoryRequest
|
||||||
|
{
|
||||||
|
pageNum = pageNum,
|
||||||
|
pageSize = pageSize,
|
||||||
|
isOnline = 1,
|
||||||
|
unitTypeList = new List<int> { 1 },
|
||||||
|
};
|
||||||
|
Console.WriteLine(JsonConvert.SerializeObject(channelCategoryRequest));
|
||||||
|
var channelCategoryResponse = await daHuaApi.GetChannelCategoriesAsync(channelCategoryRequest);
|
||||||
|
if (channelCategoryResponse.success)
|
||||||
|
{
|
||||||
|
return new Response<dynamic>
|
||||||
|
{
|
||||||
|
Result = channelCategoryResponse.data.pageData
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response<dynamic>
|
||||||
|
{
|
||||||
|
Code = channelCategoryResponse.code,
|
||||||
|
Message = channelCategoryResponse.errMsg
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<Response<dynamic>> GetDaHuaRtsp(string channelCode, string streamType)
|
||||||
|
{
|
||||||
|
var daHuaApi = new DaHuaApi("https://icc-dev.hibetatest.com:4077");
|
||||||
|
|
||||||
|
var request = new RtspPreviewRequest
|
||||||
|
{
|
||||||
|
data = new RtspPreviewData
|
||||||
|
{
|
||||||
|
channelId = channelCode,
|
||||||
|
dataType = "1",
|
||||||
|
streamType = streamType //主码流
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var y = await daHuaApi.StartRtspPreviewAsync(request);
|
||||||
|
if (y.success)
|
||||||
|
{
|
||||||
|
return new Response<dynamic>
|
||||||
|
{
|
||||||
|
Result = y.data
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Response<dynamic>
|
||||||
|
{
|
||||||
|
Code = y.code,
|
||||||
|
Message = y.errMsg
|
||||||
|
};
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 获取设备信息
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="county"></param>
|
||||||
|
/// <param name="pageIndex"></param>
|
||||||
|
/// <param name="pageSize"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public TableData LoadCameraInfo(string county, int pageIndex, int pageSize)
|
||||||
|
{
|
||||||
|
TableData data = new TableData();
|
||||||
|
ConnectionConfig connectionConfig = new ConnectionConfig
|
||||||
|
{
|
||||||
|
ConnectionString = "server=10.176.126.121;Port=33066;Database=inspur_ztk;Uid=lyyj;Pwd=Lyyj1024",
|
||||||
|
DbType = DbType.MySql,
|
||||||
|
IsAutoCloseConnection = true,
|
||||||
|
MoreSettings = new ConnMoreSettings()
|
||||||
|
{
|
||||||
|
PgSqlIsAutoToLower = false,//增删查改支持驼峰表
|
||||||
|
}
|
||||||
|
};
|
||||||
|
using (SqlSugarClient db = new SqlSugarClient(connectionConfig))
|
||||||
|
{
|
||||||
|
int totalCount = 0;
|
||||||
|
var list = db.Queryable<ztk_jcjk_jkdw>()
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(county), r => r.qx.Contains(county))
|
||||||
|
.Select(r => new ztk_jcjk_jkdw()
|
||||||
|
{
|
||||||
|
id = r.id.SelectAll(),
|
||||||
|
})
|
||||||
|
.ToPageList(pageIndex, pageSize, ref totalCount);
|
||||||
|
data.data = list;
|
||||||
|
data.count = totalCount;
|
||||||
|
data.code = 200;
|
||||||
|
data.msg = "请求成功";
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取应急局摄像头信息---添加到数据库表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="county"></param>
|
||||||
|
/// <param name="pageIndex"></param>
|
||||||
|
/// <param name="pageSize"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<Response<bool>> AddCameraInfoYingJi(string county)
|
||||||
|
{
|
||||||
|
ConnectionConfig connectionConfig = new ConnectionConfig
|
||||||
|
{
|
||||||
|
ConnectionString = "server=10.176.126.121;Port=33066;Database=inspur_ztk;Uid=lyyj;Pwd=Lyyj1024",
|
||||||
|
DbType = DbType.MySql,
|
||||||
|
IsAutoCloseConnection = true,
|
||||||
|
MoreSettings = new ConnMoreSettings()
|
||||||
|
{
|
||||||
|
PgSqlIsAutoToLower = false,//增删查改支持驼峰表
|
||||||
|
}
|
||||||
|
};
|
||||||
|
List<FmCamera> fclist=new List<FmCamera>();
|
||||||
|
using (SqlSugarClient db = new SqlSugarClient(connectionConfig))
|
||||||
|
{
|
||||||
|
//var list = db.Queryable<ztk_jcjk_jkdw>()
|
||||||
|
// .WhereIF(!string.IsNullOrEmpty(county), r => r.qx.Contains(county))
|
||||||
|
// .Select(r => new ztk_jcjk_jkdw()
|
||||||
|
// {
|
||||||
|
// id = r.id.SelectAll(),
|
||||||
|
// })
|
||||||
|
// .ToList();
|
||||||
|
//foreach(var item in list)
|
||||||
|
//{
|
||||||
|
// FmCamera fc=new FmCamera();
|
||||||
|
// fc.Id = Guid.NewGuid().ToString();
|
||||||
|
// fc.Name = item.jkdmckjg+"_热成像";
|
||||||
|
// fc.Model = "ShiYingJiReChengXiang";
|
||||||
|
// fc.Status = item.tyzt; //停用状态
|
||||||
|
// fc.Manufacturer = "大华";
|
||||||
|
// fc.SerialNumber = item.jkdgbidzlkjg;
|
||||||
|
// fc.Ip = "221.2.83.254";
|
||||||
|
// fc.Channel = 0;
|
||||||
|
// fc.Lng = item.jd.ToString();
|
||||||
|
// fc.Lat = item.wd.ToString();
|
||||||
|
// fc.UpdateTime = DateTime.Now;
|
||||||
|
// fc.AppKey = null;
|
||||||
|
// fc.AppSecret = null;
|
||||||
|
// fc.Port = "7012";
|
||||||
|
// fc.RegionPathName = item.ssfz;
|
||||||
|
// fc.CameraType = null;
|
||||||
|
// fc.SerialNumberRcx = item.jkdgbidzlrcx;
|
||||||
|
// fclist.Add(fc);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
using (var db = base.UnitWork.CreateContext())
|
||||||
|
{
|
||||||
|
var list = db.FmCamera_yjj.AsQueryable().ToList();
|
||||||
|
foreach (var item in list)
|
||||||
|
{
|
||||||
|
FmCamera fc = new FmCamera();
|
||||||
|
fc.Id = Guid.NewGuid().ToString();
|
||||||
|
fc.Name = item.jkdmckjg + "_热成像";
|
||||||
|
fc.Model = "ShiYingJiReChengXiang";
|
||||||
|
fc.Status = item.tyzt; //停用状态
|
||||||
|
fc.Manufacturer = "大华";
|
||||||
|
fc.SerialNumber = item.jkdgbidzlkjg;
|
||||||
|
fc.Ip = "221.2.83.254";
|
||||||
|
fc.Channel = 0;
|
||||||
|
fc.Lng = item.jd.ToString();
|
||||||
|
fc.Lat = item.wd.ToString();
|
||||||
|
fc.UpdateTime = DateTime.Now;
|
||||||
|
fc.AppKey = null;
|
||||||
|
fc.AppSecret = null;
|
||||||
|
fc.Port = "7012";
|
||||||
|
fc.RegionPathName = item.ssfz;
|
||||||
|
fc.CameraType = null;
|
||||||
|
fc.SerialNumberRcx = item.jkdgbidzlrcx;
|
||||||
|
fclist.Add(fc);
|
||||||
|
}
|
||||||
|
var flag= await db.FmCamera.InsertRangeAsync(fclist);
|
||||||
|
if (db.Commit()&&flag==true)
|
||||||
|
{
|
||||||
|
return new Response<bool> { Result = true, Message = "操作成功" };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new Response<bool> { Result = false, Message = "操作失败" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 海康摄像头添加
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ip">海康平台ip</param>
|
||||||
|
/// <param name="port">海康平台端口</param>
|
||||||
|
/// <param name="pathid">组织架构路径id</param>
|
||||||
|
/// <param name="appkey">appkey</param>
|
||||||
|
/// <param name="appsecret">appsecret</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<Response<bool>>AddHaiKangCameraInfo(string ip, int port,string pathid,string appkey, string appsecret,int pageno=1,int pagesize=100)
|
||||||
|
{
|
||||||
|
// 设置平台信息
|
||||||
|
HttpUtillib.SetPlatformInfo(appkey, appsecret, ip, port, true);
|
||||||
|
|
||||||
|
// 构建请求参数
|
||||||
|
var obj = new
|
||||||
|
{
|
||||||
|
regionIndexCodes = new string[] { pathid }, // 确保是数组格式
|
||||||
|
isSubRegion = true,
|
||||||
|
pageNo = pageno,
|
||||||
|
pageSize = pagesize, // 建议不要设置过大,海康可能有最大限制
|
||||||
|
orderBy="name",
|
||||||
|
orderType= "desc"
|
||||||
|
};
|
||||||
|
|
||||||
|
string body = JsonConvert.SerializeObject(obj);
|
||||||
|
string uri = "/artemis/api/resource/v2/camera/search";
|
||||||
|
byte[] result = HttpUtillib.HttpPost(uri, body, 15,1);
|
||||||
|
List<FmCamera> fclist = new List<FmCamera>();
|
||||||
|
var param = JsonConvert.DeserializeObject<JObject>(Encoding.UTF8.GetString(result));
|
||||||
|
var data= param["data"]["list"];
|
||||||
|
|
||||||
|
using (var db = base.UnitWork.CreateContext())
|
||||||
|
{
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
//string sql = @"select * from fm_camera1 WHERE ""SerialNumber""='" + item["indexCode"] + "'";
|
||||||
|
//var cam=await Repository.AsSugarClient().SqlQueryable<dynamic>(sql).ToListAsync();
|
||||||
|
//if (cam.Count>0)
|
||||||
|
//{
|
||||||
|
FmCamera fc = new FmCamera();
|
||||||
|
fc.Id = Guid.NewGuid().ToString();
|
||||||
|
fc.Name = item["name"].ToString();
|
||||||
|
var type = item["regionPathName"].ToString();
|
||||||
|
if (type.IndexOf("林场") > -1)
|
||||||
|
{
|
||||||
|
fc.Model = "LinQuSheXiangTou";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (type.IndexOf("林下") > -1)
|
||||||
|
{
|
||||||
|
fc.Model = "ShengTaiLinShiPinJianKong";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (type.IndexOf("高空瞭望") > -1)
|
||||||
|
{
|
||||||
|
fc.Model = "GaoKongLiaoWang";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fc.Model = "ShiPinJianKong";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fc.Status = "0"; //停用状态
|
||||||
|
fc.Manufacturer = "海康";
|
||||||
|
fc.SerialNumber = item["indexCode"].ToString();
|
||||||
|
fc.Ip = ip;
|
||||||
|
fc.Channel = 0;
|
||||||
|
fc.Lng = item["longitude"].ToString();
|
||||||
|
fc.Lat = item["latitude"].ToString();
|
||||||
|
fc.UpdateTime = Convert.ToDateTime(item["createTime"].ToString());
|
||||||
|
fc.AppKey = appkey;
|
||||||
|
fc.AppSecret = appsecret;
|
||||||
|
fc.Port = port.ToString();
|
||||||
|
fc.RegionPathName = item["regionPathName"].ToString();
|
||||||
|
fc.CameraType = Convert.ToInt32(item["cameraType"]);
|
||||||
|
fc.SerialNumberRcx = null;
|
||||||
|
fclist.Add(fc);
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// continue;
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
var flag = await db.FmCamera.InsertRangeAsync(fclist);
|
||||||
|
if (db.Commit() && flag == true)
|
||||||
|
{
|
||||||
|
return new Response<bool> { Result = true, Message = "操作成功" };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new Response<bool> { Result = false, Message = "操作失败" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public async Task<Response<bool>> AddHaiKangCameraInfoBeiFen(string ip, int port, string pathid, string appkey, string appsecret, int pageno = 1, int pagesize = 100)
|
||||||
|
{
|
||||||
|
// 设置平台信息
|
||||||
|
HttpUtillib.SetPlatformInfo(appkey, appsecret, ip, port, true);
|
||||||
|
|
||||||
|
// 构建请求参数
|
||||||
|
var obj = new
|
||||||
|
{
|
||||||
|
regionIndexCodes = new string[] { pathid }, // 确保是数组格式
|
||||||
|
isSubRegion = true,
|
||||||
|
pageNo = pageno,
|
||||||
|
pageSize = pagesize, // 建议不要设置过大,海康可能有最大限制
|
||||||
|
orderBy = "name",
|
||||||
|
orderType = "desc"
|
||||||
|
};
|
||||||
|
|
||||||
|
string body = JsonConvert.SerializeObject(obj);
|
||||||
|
string uri = "/artemis/api/resource/v2/camera/search";
|
||||||
|
byte[] result = HttpUtillib.HttpPost(uri, body, 15, 1);
|
||||||
|
List<FmCamera> fclist = new List<FmCamera>();
|
||||||
|
var param = JsonConvert.DeserializeObject<JObject>(Encoding.UTF8.GetString(result));
|
||||||
|
var data = param["data"]["list"];
|
||||||
|
|
||||||
|
using (var db = base.UnitWork.CreateContext())
|
||||||
|
{
|
||||||
|
foreach (var item in data)
|
||||||
|
{
|
||||||
|
string sql = @"select * from fm_camera1 WHERE ""SerialNumber""='" + item["indexCode"] + "'";
|
||||||
|
var cam = await Repository.AsSugarClient().SqlQueryable<dynamic>(sql).ToListAsync();
|
||||||
|
if (cam.Count > 0)
|
||||||
|
{
|
||||||
|
FmCamera fc = new FmCamera();
|
||||||
|
fc.Id = Guid.NewGuid().ToString();
|
||||||
|
fc.Name = item["name"].ToString();
|
||||||
|
var type = item["regionPathName"].ToString();
|
||||||
|
if (type.IndexOf("林场") > -1)
|
||||||
|
{
|
||||||
|
fc.Model = "LinQuSheXiangTou";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (type.IndexOf("生态林") > -1)
|
||||||
|
{
|
||||||
|
fc.Model = "ShengTaiLinShiPinJianKong";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (type.IndexOf("高空瞭望") > -1)
|
||||||
|
{
|
||||||
|
fc.Model = "GaoKongLiaoWang";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fc.Model = "ShiPinJianKong";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fc.Status = "0"; //停用状态
|
||||||
|
fc.Manufacturer = "海康";
|
||||||
|
fc.SerialNumber = item["indexCode"].ToString();
|
||||||
|
fc.Ip = ip;
|
||||||
|
fc.Channel = 0;
|
||||||
|
fc.Lng = item["longitude"].ToString();
|
||||||
|
fc.Lat = item["latitude"].ToString();
|
||||||
|
fc.UpdateTime = Convert.ToDateTime(item["createTime"].ToString());
|
||||||
|
fc.AppKey = appkey;
|
||||||
|
fc.AppSecret = appsecret;
|
||||||
|
fc.Port = port.ToString();
|
||||||
|
fc.RegionPathName = item["regionPathName"].ToString();
|
||||||
|
fc.CameraType = Convert.ToInt32(item["cameraType"]);
|
||||||
|
fc.SerialNumberRcx = null;
|
||||||
|
fclist.Add(fc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
var flag = await db.FmCamera.InsertRangeAsync(fclist);
|
||||||
|
if (db.Commit() && flag == true)
|
||||||
|
{
|
||||||
|
return new Response<bool> { Result = true, Message = "操作成功" };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return new Response<bool> { Result = false, Message = "操作失败" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询摄像头信息--后台使用
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<Response<PageInfo<List<FmCamera>>>> GetCameraInfoPageList(FmCameraReq req)
|
||||||
|
{
|
||||||
|
using (var db = base.UnitWork.CreateContext())
|
||||||
|
{
|
||||||
|
RefAsync<int> totalNumber = 0;
|
||||||
|
var infos = await db.FmCamera.AsQueryable()
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(req.name), r => r.Name.Contains(req.name))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(req.model), r => r.Model==req.model)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(req.manufacturer), r => r.Manufacturer.Contains(req.manufacturer))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(req.serialnumber), r => r.SerialNumber.Contains(req.serialnumber))
|
||||||
|
.ToPageListAsync(req.page, req.limit, totalNumber);
|
||||||
|
return new Response<PageInfo<List<FmCamera>>>
|
||||||
|
{
|
||||||
|
Result = new PageInfo<List<FmCamera>> { Items = infos, Total = totalNumber }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 人员类型统计
|
#region 人员类型统计
|
||||||
|
|
@ -1782,120 +2207,6 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public async Task<Response<dynamic>> ListCameraWithInRange(string lng, string lat, int radius)
|
|
||||||
{
|
|
||||||
// '{lng}', '{lat}'
|
|
||||||
var sql =
|
|
||||||
@$"WITH reference_point AS ( SELECT ST_SetSRID ( ST_MakePoint ( '{lng}', '{lat}' )::geography, 4326 ) AS geom ) SELECT
|
|
||||||
l.*
|
|
||||||
FROM
|
|
||||||
fm_camera l,
|
|
||||||
reference_point r
|
|
||||||
WHERE
|
|
||||||
ST_DWithin ( ST_SetSRID ( ST_MakePoint ( l.""Lng"" :: FLOAT, l.""Lat"" :: FLOAT )::geography, 4326 ), r.geom, {radius}
|
|
||||||
)
|
|
||||||
ORDER BY
|
|
||||||
ST_Distance ( ST_SetSRID ( ST_MakePoint ( l.""Lng"" :: FLOAT, l.""Lat"" :: FLOAT )::geography, 4326 ), r.geom ) ";
|
|
||||||
var x = await Repository.AsSugarClient().SqlQueryable<dynamic>(sql).ToListAsync();
|
|
||||||
return new Response<dynamic>
|
|
||||||
{
|
|
||||||
Result = x
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Response<dynamic>> ListDaHuaCameraInfo(int pageNum, int pageSize, int isOnline)
|
|
||||||
{
|
|
||||||
var daHuaApi = new DaHuaApi("https://icc-dev.hibetatest.com:4077");
|
|
||||||
var channelCategoryRequest = new ChannelCategoryRequest
|
|
||||||
{
|
|
||||||
pageNum = pageNum,
|
|
||||||
pageSize = pageSize,
|
|
||||||
isOnline = 1,
|
|
||||||
unitTypeList = new List<int> { 1 },
|
|
||||||
};
|
|
||||||
Console.WriteLine(JsonConvert.SerializeObject(channelCategoryRequest));
|
|
||||||
var channelCategoryResponse = await daHuaApi.GetChannelCategoriesAsync(channelCategoryRequest);
|
|
||||||
if (channelCategoryResponse.success)
|
|
||||||
{
|
|
||||||
return new Response<dynamic>
|
|
||||||
{
|
|
||||||
Result = channelCategoryResponse.data.pageData
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Response<dynamic>
|
|
||||||
{
|
|
||||||
Code = channelCategoryResponse.code,
|
|
||||||
Message = channelCategoryResponse.errMsg
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Response<dynamic>> GetDaHuaRtsp(string channelCode,string streamType)
|
|
||||||
{
|
|
||||||
var daHuaApi = new DaHuaApi("https://icc-dev.hibetatest.com:4077");
|
|
||||||
|
|
||||||
var request = new RtspPreviewRequest
|
|
||||||
{
|
|
||||||
data = new RtspPreviewData
|
|
||||||
{
|
|
||||||
channelId = channelCode,
|
|
||||||
dataType = "1",
|
|
||||||
streamType = streamType //主码流
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var y = await daHuaApi.StartRtspPreviewAsync(request);
|
|
||||||
if (y.success)
|
|
||||||
{
|
|
||||||
return new Response<dynamic>
|
|
||||||
{
|
|
||||||
Result = y.data
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Response<dynamic>
|
|
||||||
{
|
|
||||||
Code = y.code,
|
|
||||||
Message = y.errMsg
|
|
||||||
};
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 获取设备信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="county"></param>
|
|
||||||
/// <param name="pageIndex"></param>
|
|
||||||
/// <param name="pageSize"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public TableData LoadCameraInfo(string county, int pageIndex, int pageSize)
|
|
||||||
{
|
|
||||||
TableData data = new TableData();
|
|
||||||
ConnectionConfig connectionConfig = new ConnectionConfig
|
|
||||||
{
|
|
||||||
ConnectionString = "server=10.176.126.121;Port=33066;Database=inspur_ztk;Uid=lyyj;Pwd=Lyyj1024",
|
|
||||||
DbType = DbType.MySql,
|
|
||||||
IsAutoCloseConnection = true,
|
|
||||||
MoreSettings = new ConnMoreSettings()
|
|
||||||
{
|
|
||||||
PgSqlIsAutoToLower = false,//增删查改支持驼峰表
|
|
||||||
}
|
|
||||||
};
|
|
||||||
using (SqlSugarClient db = new SqlSugarClient(connectionConfig))
|
|
||||||
{
|
|
||||||
int totalCount = 0;
|
|
||||||
var list = db.Queryable<ztk_jcjk_jkdw>()
|
|
||||||
.WhereIF(!string.IsNullOrEmpty(county), r => r.qx.Contains(county))
|
|
||||||
.Select(r => new ztk_jcjk_jkdw()
|
|
||||||
{
|
|
||||||
id = r.id.SelectAll(),
|
|
||||||
})
|
|
||||||
.ToPageList(pageIndex, pageSize, ref totalCount);
|
|
||||||
data.data = list;
|
|
||||||
data.count = totalCount;
|
|
||||||
data.code = 200;
|
|
||||||
data.msg = "请求成功";
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#region 感知中心--摄像头类型
|
#region 感知中心--摄像头类型
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,29 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace OpenAuth.App.ServiceApp.FireManagement.Request
|
||||||
|
{
|
||||||
|
public class FmCameraReq
|
||||||
|
{
|
||||||
|
//摄像头类型,与字典对应
|
||||||
|
public string model { get; set; }
|
||||||
|
//摄像头名称
|
||||||
|
public string name { get; set; }
|
||||||
|
//厂商
|
||||||
|
public string manufacturer { get; set; }
|
||||||
|
//序列号
|
||||||
|
public string serialnumber { get; set; }
|
||||||
|
//当前页
|
||||||
|
public int page { get; set; }
|
||||||
|
//每页条数
|
||||||
|
public int limit { get; set; }
|
||||||
|
public FmCameraReq()
|
||||||
|
{
|
||||||
|
page = 1;
|
||||||
|
limit = 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -21,7 +21,7 @@ namespace OpenAuth.Repository.Domain
|
||||||
/// Nullable:False
|
/// Nullable:False
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(IsPrimaryKey=true)]
|
[SugarColumn(IsPrimaryKey=true)]
|
||||||
public long Id {get;set;}
|
public string Id {get;set;}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Desc:名称或编号
|
/// Desc:名称或编号
|
||||||
|
|
@ -121,12 +121,17 @@ namespace OpenAuth.Repository.Domain
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string RegionPathName {get;set;}
|
public string RegionPathName {get;set;}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Desc:监控点类型 枪机 0 半球 1 快球 2 带云台枪机 3
|
/// Desc:监控点类型 枪机 0 半球 1 快球 2 带云台枪机 3
|
||||||
/// Default:
|
/// Default:
|
||||||
/// Nullable:True
|
/// Nullable:True
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? CameraType {get;set;}
|
public int? CameraType {get;set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 大华热成像序列号
|
||||||
|
/// </summary>
|
||||||
|
public string SerialNumberRcx { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ using OpenAuth.App.ServiceApp.FireManagement.Request;
|
||||||
using OpenAuth.App.ServiceApp.FireManagement.Response;
|
using OpenAuth.App.ServiceApp.FireManagement.Response;
|
||||||
using OpenAuth.Repository.Domain.FireManagement;
|
using OpenAuth.Repository.Domain.FireManagement;
|
||||||
using DocumentFormat.OpenXml.EMMA;
|
using DocumentFormat.OpenXml.EMMA;
|
||||||
|
using OpenAuth.Repository.Domain;
|
||||||
|
|
||||||
namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
|
namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
|
||||||
{
|
{
|
||||||
|
|
@ -857,5 +858,77 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 摄像头信息处理
|
||||||
|
/// <summary>
|
||||||
|
/// 大华摄像头添加
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="county">所属县区</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<Response<bool>> AddCameraInfoYingJi(string county)
|
||||||
|
{
|
||||||
|
Response<bool> response = new Response<bool>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _app.AddCameraInfoYingJi(county);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
response.Code = 500;
|
||||||
|
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取海康平台摄像头列表信息,添加到数据库
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ip">海康平台ip</param>
|
||||||
|
/// <param name="port">海康平台端口</param>
|
||||||
|
/// <param name="pathid">组织架构路径id</param>
|
||||||
|
/// <param name="appkey">appkey</param>
|
||||||
|
/// <param name="appsecret">appsecret</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<Response<bool>> AddHaiKangCameraInfo(string ip, int port, string pathid, string appkey, string appsecret)
|
||||||
|
{
|
||||||
|
Response<bool> response = new Response<bool>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _app.AddHaiKangCameraInfo(ip,port,pathid,appkey,appsecret);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
response.Code = 500;
|
||||||
|
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询摄像头列表--后台使用
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public async Task<Response<PageInfo<List<FmCamera>>>> GetCameraInfoPageList([FromQuery]FmCameraReq req)
|
||||||
|
{
|
||||||
|
Response<PageInfo<List<FmCamera>>> response = new Response<PageInfo<List<FmCamera>>>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return await _app.GetCameraInfoPageList(req);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
response.Code = 500;
|
||||||
|
response.Message = ex.InnerException?.Message ?? ex.Message;
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue