打卡点排序,无人机火情线索上报,mqtt

DataMaintenance
洁 任 2026-01-20 16:16:38 +08:00
parent 5b0ebbcc10
commit f09891b466
4 changed files with 130 additions and 1 deletions

View File

@ -88,6 +88,7 @@ namespace OpenAuth.App.ServiceApp.FireManagement
.Where((a, b) => a.IsDelete == false) .Where((a, b) => a.IsDelete == false)
.WhereIF(!string.IsNullOrEmpty(pointName), (a, b, c) => a.PointName.Contains(pointName)) .WhereIF(!string.IsNullOrEmpty(pointName), (a, b, c) => a.PointName.Contains(pointName))
.WhereIF(areaid != 0, (a, b, c) => chileorg.Contains(c.AreaId)) .WhereIF(areaid != 0, (a, b, c) => chileorg.Contains(c.AreaId))
.OrderBy((a,b,c)=>a.PointName)
.Select((a, b) => new CheckPointInfo .Select((a, b) => new CheckPointInfo
{ {
id = a.Id, id = a.Id,

View File

@ -221,6 +221,70 @@ namespace OpenAuth.App.ServiceApp.FireManagement
} }
} }
/// <summary>
/// 从态势感知平台添加无人机上报火情线索
/// </summary>
/// <param name="info"></param>
/// <returns></returns>
public async Task<Response<bool>> AddFireClueInfoUAV(string info)
{
using (var db = base.UnitWork.CreateContext())
{
var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<ReciveFireClueInfo>(info);
FmFireclueInfo fm = new FmFireclueInfo();
fm.Id = YitIdHelper.NextId();
fm.State = (int)State.;
fm.ReportTime = DateTime.Now;
fm.Lat = obj.Lat;
fm.Lng=obj.Lng;
fm.Address=obj.Address;
fm.AreaName=obj.AreaName;
fm.Image=obj.Image;
fm.SourceType = 3;
fm.ReportPerson = obj.ReportPerson;
fm.Describe=obj.Describe;
fm.DegreeType = obj.DegreeType;
var today = DateTime.Now.Date;
var tomorrow = today.AddDays(1);
var exitinfo = db.FmFireclueInfo
.AsQueryable()
.Count(a => a.ReportTime >= today && a.ReportTime < tomorrow);
string excount = exitinfo.ToString("D3");
string sourceType = fm.SourceType switch
{
1 => "R",
2 => "J",
3 => "W",
4 => "R",
5 => "G",
6 => "Y",
_ => "R"
};
// 生成线索编号
fm.ClueNo = $"LH{DateTime.Now:yyyyMMdd}{excount}{sourceType}";
await db.FmFireclueInfo.InsertAsync(fm);
await db.FmFireclueinfoLog.InsertAsync(new FmFireclueinfoLog
{
Id = YitIdHelper.NextId(),
Fireclueid = fm.Id,
Title = "无人机火情线索上报",
CreateTime = DateTime.Now,
CreateId = fm.CreateId,
Content = fm.Describe
});
if (db.Commit())
{
JPushInfo("火情信息", 0);
return new Response<bool> { Result = true, Message = "操作成功" };
}
else
{
return new Response<bool> { Result = false, Message = "操作失败" };
}
}
}
class ReciveTaskInfo class ReciveTaskInfo
{ {
public long taskid { get; set; } public long taskid { get; set; }

View File

@ -0,0 +1,52 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenAuth.App.ServiceApp.FireManagement.Request
{
public class ReciveFireClueInfo
{
/// <summary>
/// 人员名称
/// </summary>
public string ReportPerson { get; set; }
/// <summary>
/// 描述
/// </summary>
public string Describe { get; set; }
/// <summary>
/// 经度
/// </summary>
public string Lng { get; set; }
/// <summary>
/// 纬度
/// </summary>
public string Lat { get; set; }
/// <summary>
/// 地址
/// </summary>
public string Address { get; set; }
/// <summary>
/// 地区名称
/// </summary>
public string AreaName { get; set; }
/// <summary>
/// 图片地址
/// </summary>
public string Image { get; set; }
/// <summary>
/// 程度类型1-特大2-重大3-其他
/// </summary>
public int DegreeType { get; set; }
}
}

View File

@ -45,7 +45,18 @@ namespace Infrastructure.Mqtt
var payload = Encoding.UTF8.GetString(e.ApplicationMessage.Payload); var payload = Encoding.UTF8.GetString(e.ApplicationMessage.Payload);
Console.WriteLine(payload); Console.WriteLine(payload);
// TODO: 可在这里写入数据库、调用业务逻辑等 // TODO: 可在这里写入数据库、调用业务逻辑等
if (topic == "fire")
{
await _app.ReceiveTaskImage(payload); await _app.ReceiveTaskImage(payload);
}
else
{
if (topic == "fireclueinfo")
{
await _app.AddFireClueInfoUAV(payload);
}
}
await Task.CompletedTask; await Task.CompletedTask;
} }
catch (Exception ex) catch (Exception ex)
@ -75,6 +86,7 @@ namespace Infrastructure.Mqtt
// 订阅主题 // 订阅主题
await _client.SubscribeAsync("fire"); await _client.SubscribeAsync("fire");
await _client.SubscribeAsync("fireclueinfo");
} }
catch (Exception ex) catch (Exception ex)