Compare commits
2 Commits
89686f639a
...
f996d26928
| Author | SHA1 | Date |
|---|---|---|
|
|
f996d26928 | |
|
|
edf602bf38 |
|
|
@ -22,4 +22,21 @@ namespace OpenAuth.App.Common
|
|||
/// </summary>
|
||||
public string SecretKey { get; set; }
|
||||
}
|
||||
|
||||
public class KikvisionConfig2
|
||||
{
|
||||
/// <summary>
|
||||
/// 综合安防管理平台 url
|
||||
/// </summary>
|
||||
public string Url { get; set; }
|
||||
public int Port { get; set; }
|
||||
/// <summary>
|
||||
/// AppKey
|
||||
/// </summary>
|
||||
public string AppKey { get; set; }
|
||||
/// <summary>
|
||||
/// SecretKey
|
||||
/// </summary>
|
||||
public string SecretKey { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,14 +44,16 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
private ClientWebSocket _socket;
|
||||
private IConfiguration _configuration;
|
||||
IOptions<KikvisionConfig> _options;
|
||||
IOptions<KikvisionConfig2> _options2;
|
||||
IOptions<JPushClientConfig> _jpoptions;
|
||||
|
||||
public FireManagementApp(IConfiguration configuration, IOptions<KikvisionConfig> options,
|
||||
public FireManagementApp(IConfiguration configuration, IOptions<KikvisionConfig> options, IOptions<KikvisionConfig2> options2,
|
||||
IOptions<JPushClientConfig> jpoptions, ISugarUnitOfWork<SugarDbContext> unitWork,
|
||||
ISimpleClient<FmFireclueTask> repository, IAuth auth) : base(unitWork, repository, auth)
|
||||
{
|
||||
_auth = auth;
|
||||
_options = options;
|
||||
_options2 = options2;
|
||||
_configuration = configuration;
|
||||
_jpoptions = jpoptions;
|
||||
}
|
||||
|
|
@ -1220,6 +1222,38 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
return "fail";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取单个设备的视频流---海康平台2
|
||||
/// </summary>
|
||||
/// <param name="cameraIndexCode">视频标识</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[AllowAnonymous]
|
||||
public string GetPreviewURLs2(string cameraIndexCode, string protocol)
|
||||
{
|
||||
HttpUtillib.SetPlatformInfo(_options2.Value.AppKey, _options2.Value.SecretKey, _options2.Value.Url,
|
||||
_options2.Value.Port, true);
|
||||
|
||||
var obj = new
|
||||
{
|
||||
cameraIndexCode,
|
||||
streamType = 0,
|
||||
protocol = protocol,
|
||||
transmode = 1,
|
||||
expand = "transcode=0",
|
||||
streamform = "ps"
|
||||
};
|
||||
string body = JsonConvert.SerializeObject(obj);
|
||||
string uri = "/artemis/api/video/v2/cameras/previewURLs";
|
||||
byte[] result = HttpUtillib.HttpPost(uri, body, 15, 1);
|
||||
if (null != result)
|
||||
{
|
||||
return Encoding.UTF8.GetString(result);
|
||||
}
|
||||
|
||||
return "fail";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 人员类型统计
|
||||
|
|
|
|||
|
|
@ -41,56 +41,65 @@ namespace OpenAuth.App.ServiceApp.FireManagement
|
|||
{
|
||||
var usertime = await db.FmUserTimeSlot.AsQueryable().Where(a => a.CreateId == id).ToListAsync();
|
||||
var user = await db.User.GetFirstAsync(r => r.Id == id);
|
||||
TimeSpan timeSpan = endTime.AddDays(1).Subtract(beginTime);
|
||||
int days = (int)timeSpan.TotalDays;
|
||||
List<UserPatrolInfoResp> upinfo = new List<UserPatrolInfoResp>();
|
||||
var userpoint = await db.FmUserPointHistory.AsQueryable().Where(a => a.CreateTime >= beginTime && a.CreateTime <= endTime && a.CreateId == id)
|
||||
.SplitTable(beginTime, endTime).ToListAsync();
|
||||
var list = db.SysFrontendSettingConfig.AsQueryable().Where(r => r.Code == "TimeSlot").ToList();
|
||||
for (int i = 0; i < days; i++)
|
||||
{
|
||||
if (usertime.Count > 0)
|
||||
{
|
||||
foreach (var item in usertime)
|
||||
{
|
||||
var begslot = item.TimeSlot.Split('-');
|
||||
UserPatrolInfoResp resin = new UserPatrolInfoResp
|
||||
{
|
||||
CreateId = id,
|
||||
Name = user.Name,
|
||||
StartTime = beginTime.ToString("yyyy-MM-dd ") + begslot[0],
|
||||
EndTime = beginTime.ToString("yyyy-MM-dd ") + begslot[1],
|
||||
};
|
||||
|
||||
if (userpoint.Where(a => a.CreateTime >= DateTime.Parse(resin.StartTime) && a.CreateTime <= DateTime.Parse(resin.EndTime)).Count() > 0)
|
||||
{
|
||||
upinfo.Add(resin);
|
||||
}
|
||||
}
|
||||
beginTime = beginTime.AddDays(1);
|
||||
}
|
||||
else
|
||||
if (user != null)
|
||||
{
|
||||
TimeSpan timeSpan = endTime.AddDays(1).Subtract(beginTime);
|
||||
int days = (int)timeSpan.TotalDays;
|
||||
List<UserPatrolInfoResp> upinfo = new List<UserPatrolInfoResp>();
|
||||
var userpoint = await db.FmUserPointHistory.AsQueryable().Where(a => a.CreateTime >= beginTime && a.CreateTime <= endTime && a.CreateId == id)
|
||||
.SplitTable(beginTime, endTime).ToListAsync();
|
||||
var list = db.SysFrontendSettingConfig.AsQueryable().Where(r => r.Code == "TimeSlot").ToList();
|
||||
for (int i = 0; i < days; i++)
|
||||
{
|
||||
foreach (var item in list)
|
||||
if (usertime.Count > 0)
|
||||
{
|
||||
var begslot = item.CodeValue.Split('-');
|
||||
UserPatrolInfoResp resin = new UserPatrolInfoResp
|
||||
foreach (var item in usertime)
|
||||
{
|
||||
CreateId = id,
|
||||
Name = user.Name,
|
||||
StartTime = beginTime.ToString("yyyy-MM-dd ") + begslot[0],
|
||||
EndTime = beginTime.ToString("yyyy-MM-dd ") + begslot[1],
|
||||
};
|
||||
if (userpoint.Where(a => a.CreateTime >= DateTime.Parse(resin.StartTime) && a.CreateTime <= DateTime.Parse(resin.EndTime)).Count() > 0)
|
||||
{
|
||||
upinfo.Add(resin);
|
||||
var begslot = item.TimeSlot.Split('-');
|
||||
UserPatrolInfoResp resin = new UserPatrolInfoResp
|
||||
{
|
||||
CreateId = id,
|
||||
Name = user.Name,
|
||||
StartTime = beginTime.ToString("yyyy-MM-dd ") + begslot[0],
|
||||
EndTime = beginTime.ToString("yyyy-MM-dd ") + begslot[1],
|
||||
};
|
||||
|
||||
if (userpoint.Where(a => a.CreateTime >= DateTime.Parse(resin.StartTime) && a.CreateTime <= DateTime.Parse(resin.EndTime)).Count() > 0)
|
||||
{
|
||||
upinfo.Add(resin);
|
||||
}
|
||||
}
|
||||
beginTime = beginTime.AddDays(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
var begslot = item.CodeValue.Split('-');
|
||||
UserPatrolInfoResp resin = new UserPatrolInfoResp
|
||||
{
|
||||
CreateId = id,
|
||||
Name = user.Name,
|
||||
StartTime = beginTime.ToString("yyyy-MM-dd ") + begslot[0],
|
||||
EndTime = beginTime.ToString("yyyy-MM-dd ") + begslot[1],
|
||||
};
|
||||
if (userpoint.Where(a => a.CreateTime >= DateTime.Parse(resin.StartTime) && a.CreateTime <= DateTime.Parse(resin.EndTime)).Count() > 0)
|
||||
{
|
||||
upinfo.Add(resin);
|
||||
}
|
||||
}
|
||||
beginTime = beginTime.AddDays(1);
|
||||
}
|
||||
beginTime = beginTime.AddDays(1);
|
||||
}
|
||||
upinfo = upinfo.OrderByDescending(r => r.StartTime).ToList();
|
||||
return new Response<List<UserPatrolInfoResp>> { Result = upinfo, Message = "操作成功" };
|
||||
}
|
||||
upinfo = upinfo.OrderByDescending(r => r.StartTime).ToList();
|
||||
return new Response<List<UserPatrolInfoResp>> { Result = upinfo, Message = "操作成功" };
|
||||
else
|
||||
{
|
||||
throw new Exception("用户不存在");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -579,6 +579,26 @@ namespace OpenAuth.WebApi.Controllers.ServiceControllers.FireManagement
|
|||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取视频流---海康平台2
|
||||
/// </summary>
|
||||
/// <param name="deviceCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
public string GetPreviewURLs2(string deviceCode, string protocol)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _app.GetPreviewURLs2(deviceCode, protocol);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ex.Message.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
#region 人员类型统计查询
|
||||
[HttpGet]
|
||||
[AllowAnonymous]
|
||||
|
|
|
|||
|
|
@ -309,6 +309,7 @@ namespace OpenAuth.WebApi
|
|||
#endregion
|
||||
#region 配置文件
|
||||
services.Configure<KikvisionConfig>(Configuration.GetSection("Hik"));
|
||||
services.Configure<KikvisionConfig2>(Configuration.GetSection("Hik2"));
|
||||
services.Configure<JPushClientConfig>(Configuration.GetSection("JPushClient"));
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,12 @@
|
|||
"AppKey": "23604396",
|
||||
"SecretKey": "NZJ8L3bxCOOV6rtTFjsx"
|
||||
},
|
||||
"Hik2": {
|
||||
"Url": "223.99.16.253",
|
||||
"Port": 1443,
|
||||
"AppKey": "28135251",
|
||||
"SecretKey": "V5nOdrZ7llDeNVP3KHX4"
|
||||
},
|
||||
"JPushClient": {
|
||||
"AppKey": "bfee2a863eccbb852baa9140",
|
||||
"MasterSecret": "019f8665e581318dfcbac060"
|
||||
|
|
|
|||
Loading…
Reference in New Issue