You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
928 lines
27 KiB
928 lines
27 KiB
using System.Text.Json; |
|
using System.Text.Json.Serialization; |
|
|
|
namespace Common.Shared.Application.SafetyFirePro.ResponseDto |
|
{ |
|
#region 太阳宫看板-综合安全态势返回体 |
|
|
|
/// <summary> |
|
/// 第三方风险点数据 |
|
/// </summary> |
|
public class DangerRiskAreaResDto |
|
{ |
|
/// <summary> |
|
/// 获得单位风险点汇总数据 |
|
/// </summary> |
|
[JsonPropertyName("existingRisks")] |
|
public List<ProductionRiskStatsResDto>? ProductionRiskStats { get; set; } |
|
|
|
/// <summary> |
|
/// 隐患数据 |
|
/// </summary> |
|
public List<DangerInfo>? DangerInfos { get; set; } |
|
} |
|
|
|
/// <summary> |
|
/// 生产风险识别 |
|
/// </summary> |
|
public class ProductionRiskStatsResDto |
|
{ |
|
/// <summary> |
|
/// 风险名称(如 "重大风险") |
|
/// </summary> |
|
[JsonPropertyName("name")] |
|
public string Name { get; set; } // |
|
|
|
/// <summary> |
|
/// 风险数量 |
|
/// </summary> |
|
[JsonPropertyName("count")] |
|
public int Count { get; set; } // |
|
|
|
/// <summary> |
|
/// 颜色编码(如 "#ff0000") |
|
/// </summary> |
|
[JsonPropertyName("color")] |
|
public string Color { get; set; } // |
|
} |
|
|
|
/// <summary> |
|
/// 安全隐患信息列表 |
|
/// </summary> |
|
public class DangerInfo |
|
{ |
|
/// <summary> |
|
/// 隐患状态 |
|
/// </summary> |
|
public string? Status { get; set; } //隐患状态:0待核查,1待整改,2待验收,3待排查 |
|
|
|
/// <summary> |
|
/// 隐患状态数量 |
|
/// </summary> |
|
public int StatusCount { get; set; } = 0; |
|
|
|
/// <summary> |
|
/// 隐患等级数量 |
|
/// </summary> |
|
public int DangerLevelCount { get; set; } = 0; |
|
} |
|
|
|
#endregion 太阳宫看板-综合安全态势返回体 |
|
|
|
#region 太阳宫看板-设备设施态势返回体 |
|
|
|
/// <summary> |
|
/// 资产仪表盘 |
|
/// </summary> |
|
public class AssetOverviewResDto |
|
{ |
|
/// <summary> |
|
/// 排序 |
|
/// </summary> |
|
public int OrderBy { get; set; } = 1; |
|
|
|
/// <summary> |
|
/// 资产名字 |
|
/// </summary> |
|
public string Name { get; set; } = default!; |
|
|
|
/// <summary> |
|
/// 资产总数 |
|
/// </summary> |
|
public double TotalAssetCount { get; set; } |
|
|
|
/// <summary> |
|
/// 所有百分比的 |
|
/// </summary> |
|
public double? TotalAssetCountGrowthRate { get; set; } |
|
|
|
///// <summary> |
|
///// 总资产数 |
|
///// </summary> |
|
//public int TotalAssetCount { get; set; } |
|
|
|
///// <summary> |
|
///// 总资产数较上月增长百分比(如 5.2 表示增长 5.2%) |
|
///// </summary> |
|
//public double TotalAssetCountGrowthRate { get; set; } |
|
|
|
///// <summary> |
|
///// 总资产价值(单位:万元) |
|
///// </summary> |
|
//public double TotalAssetValue { get; set; } |
|
|
|
///// <summary> |
|
///// 总资产价值较上月增长百分比 |
|
///// </summary> |
|
//public decimal TotalAssetValueGrowthRate { get; set; } |
|
|
|
///// <summary> |
|
///// 资产盘点进度(如 0.92 表示 92%) |
|
///// </summary> |
|
//public decimal InventoryProgressRate { get; set; } |
|
|
|
///// <summary> |
|
///// 资产分布楼层数 |
|
///// </summary> |
|
//public int AssetFloorCoverage { get; set; } |
|
|
|
///// <summary> |
|
///// 在保资产数量 |
|
///// </summary> |
|
//public int InsuredAssetCount { get; set; } |
|
|
|
///// <summary> |
|
///// 在保资产较上月减少百分比(如 -2.1 表示减少 2.1%) |
|
///// </summary> |
|
//public decimal InsuredAssetChangeRate { get; set; } |
|
|
|
///// <summary> |
|
///// 待维修资产数量 |
|
///// </summary> |
|
//public int RepairPendingAssetCount { get; set; } |
|
|
|
///// <summary> |
|
///// 待维修资产较上月增长百分比 |
|
///// </summary> |
|
//public decimal RepairPendingGrowthRate { get; set; } |
|
|
|
///// <summary> |
|
///// 本月折旧金额(单位:元) |
|
///// </summary> |
|
//public decimal DepreciationThisMonth { get; set; } |
|
|
|
///// <summary> |
|
///// 折旧金额较上月增长百分比 |
|
///// </summary> |
|
//public decimal DepreciationGrowthRate { get; set; } |
|
|
|
///// <summary> |
|
///// 今日报警数量(待处理) |
|
///// </summary> |
|
//public int TodayAlarmCount { get; set; } |
|
} |
|
|
|
/// <summary> |
|
/// 资产类型统计返回体 |
|
/// </summary> |
|
public class AssetTypeResDto |
|
{ |
|
/// <summary> |
|
/// 类型名 |
|
/// </summary> |
|
public string AssetType { get; set; } = default!; |
|
|
|
/// <summary> |
|
/// 数量 |
|
/// </summary> |
|
public int AssetCount { get; set; } = 0; |
|
} |
|
|
|
/// <summary> |
|
/// 折旧率对比 |
|
/// </summary> |
|
public class AvgDepreciationResDto |
|
{ |
|
/// <summary> |
|
/// 设备名 |
|
/// </summary> |
|
public string DeviceName { get; set; } = default!; |
|
|
|
/// <summary> |
|
/// 折旧率 |
|
/// </summary> |
|
public double TotalAssetCount |
|
{ |
|
get; set; |
|
} |
|
} |
|
|
|
/// <summary> |
|
/// 资产报警分析 |
|
/// </summary> |
|
public class AssetAlarmTrendResDto |
|
{ |
|
/// <summary> |
|
/// 资产名字 |
|
/// </summary> |
|
public string? AssetName { get; set; } |
|
|
|
/// <summary> |
|
/// 月份 |
|
/// </summary> |
|
public int Monthly { get; set; } |
|
|
|
/// <summary> |
|
/// 资产数量 |
|
/// </summary> |
|
public int AssetCount { get; set; } = 0; |
|
} |
|
|
|
/// <summary> |
|
/// 合规证件预警 |
|
/// </summary> |
|
public class IdCardAlarmResDto |
|
{ |
|
/// <summary> |
|
/// 证件名称 |
|
/// </summary> |
|
public string CardName { get; set; } = default!; |
|
|
|
/// <summary> |
|
/// 有效期 |
|
/// </summary> |
|
public DateTime ValidityPeriod { get; set; } = default!; |
|
|
|
/// <summary> |
|
/// 剩余天数 |
|
/// </summary> |
|
public int RemainingDays { get; set; } = 0; |
|
} |
|
|
|
#endregion 太阳宫看板-设备设施态势返回体 |
|
|
|
#region 太阳宫看板-风险管控可视化 |
|
|
|
// 1) 定义响应模型 |
|
public class FloorDto |
|
{ |
|
[JsonPropertyName("id")] |
|
public int Id { get; set; } |
|
|
|
[JsonPropertyName("name")] |
|
public string Name { get; set; } |
|
|
|
[JsonPropertyName("floor_number")] |
|
public int Floor_number { get; set; } |
|
|
|
[JsonPropertyName("sort")] |
|
public int Sort { get; set; } |
|
|
|
[JsonPropertyName("region_id")] |
|
public int Region_id { get; set; } |
|
|
|
[JsonPropertyName("is_3d")] |
|
public int Is_3d { get; set; } |
|
|
|
[JsonPropertyName("jiaodu")] |
|
public int Jiaodu { get; set; } |
|
} |
|
|
|
/// <summary> |
|
/// 四色图图层列表 |
|
/// </summary> |
|
public class FloorResDto |
|
{ |
|
public List<FloorDto> Data { get; set; } = []; |
|
} |
|
|
|
#endregion 太阳宫看板-风险管控可视化 |
|
|
|
#region 太阳宫看板-障碍数据 |
|
|
|
/// <summary> |
|
/// 根节点 |
|
/// </summary> |
|
public class RootReqDto |
|
{ |
|
/// <summary> |
|
/// 地图缩放系数 |
|
/// </summary> |
|
[JsonPropertyName("zoom")] |
|
public string Zoom { get; set; } |
|
|
|
/// <summary> |
|
/// 地图中心坐标 [经度,纬度] |
|
/// </summary> |
|
[JsonPropertyName("center")] |
|
[JsonConverter(typeof(FlexibleCenterConverter))] |
|
public List<List<double>> Center { get; set; } |
|
|
|
/// <summary> |
|
/// 底图数据 |
|
/// </summary> |
|
[JsonPropertyName("changquArr")] |
|
public List<ChangquDto> ChangquArr { get; set; } |
|
|
|
/// <summary> |
|
/// 色块区域相关数据 |
|
/// </summary> |
|
[JsonPropertyName("seKualArr")] |
|
public List<SeKualDto> SeKualArr { get; set; } |
|
} |
|
|
|
public class ChangquDto |
|
{ |
|
[JsonPropertyName("drawType")] |
|
public string DrawType { get; set; } |
|
|
|
[JsonPropertyName("center")] |
|
[JsonConverter(typeof(FlexibleCenterConverter))] |
|
public List<List<double>> Center { get; set; } |
|
|
|
[JsonPropertyName("imgurl")] |
|
public string Imgurl { get; set; } |
|
|
|
[JsonPropertyName("region_id")] |
|
public int Region_id { get; set; } |
|
|
|
[JsonPropertyName("parent_id")] |
|
public int Parent_id { get; set; } |
|
|
|
[JsonPropertyName("name")] |
|
public string Name { get; set; } |
|
|
|
[JsonPropertyName("point")] |
|
public List<List<double>> Point { get; set; } |
|
|
|
[JsonPropertyName("id")] |
|
public int Id { get; set; } |
|
|
|
[JsonPropertyName("monitor")] |
|
public List<MonitorDto> Monitor { get; set; } |
|
} |
|
|
|
public class MonitorDto |
|
{ |
|
[JsonPropertyName("id")] |
|
public int Id { get; set; } |
|
|
|
[JsonPropertyName("uid")] |
|
public int Uid { get; set; } |
|
|
|
[JsonPropertyName("ubpid")] |
|
public int Ubpid { get; set; } |
|
|
|
[JsonPropertyName("user_id")] |
|
public string User_id { get; set; } |
|
|
|
[JsonPropertyName("enterprise_region_id")] |
|
public int Enterprise_region_id { get; set; } |
|
|
|
[JsonPropertyName("name")] |
|
public string Name { get; set; } |
|
|
|
[JsonPropertyName("category_id")] |
|
public int? Category_id { get; set; } |
|
|
|
[JsonPropertyName("channel")] |
|
public string Channel { get; set; } |
|
|
|
[JsonPropertyName("location")] |
|
public string Location { get; set; } |
|
|
|
[JsonPropertyName("status")] |
|
public string Status { get; set; } |
|
|
|
[JsonPropertyName("pull_url")] |
|
public string Pull_url { get; set; } |
|
|
|
[JsonPropertyName("push_url")] |
|
public string Push_url { get; set; } |
|
|
|
[JsonPropertyName("content")] |
|
public string Content { get; set; } |
|
|
|
[JsonPropertyName("created_at")] |
|
public string Created_at { get; set; } |
|
|
|
[JsonPropertyName("updated_at")] |
|
public string Updated_at { get; set; } |
|
|
|
[JsonPropertyName("deleted_at")] |
|
public string Deleted_at { get; set; } |
|
} |
|
|
|
/// <summary> |
|
/// 色块区域相关数据 |
|
/// </summary> |
|
public class SeKualDto |
|
{ |
|
[JsonPropertyName("region_id")] |
|
public int Region_id { get; set; } |
|
|
|
[JsonPropertyName("parent_id")] |
|
public int Parent_id { get; set; } |
|
|
|
[JsonPropertyName("name")] |
|
public string Name { get; set; } |
|
|
|
[JsonPropertyName("drawType")] |
|
public string DrawType { get; set; } |
|
|
|
[JsonPropertyName("textPoint")] |
|
[JsonConverter(typeof(FlexiblePointConverter))] |
|
public PointDto TextPoint { get; set; } |
|
|
|
[JsonPropertyName("center")] |
|
[JsonConverter(typeof(FlexibleCenterConverter))] |
|
public List<List<double>> Center { get; set; } |
|
|
|
[JsonPropertyName("gaodu")] |
|
public int? Gaodu { get; set; } |
|
|
|
[JsonPropertyName("id")] |
|
public int Id { get; set; } |
|
|
|
[JsonPropertyName("monitor")] |
|
public List<MonitorDto> Monitor { get; set; } |
|
|
|
[JsonPropertyName("unigueCode")] |
|
public string? UnigueCode { get; set; } |
|
|
|
[JsonPropertyName("ristType")] |
|
public RistTypeWrapper RistType { get; set; } |
|
|
|
[JsonPropertyName("riskPointCount")] |
|
public List<RiskPointCountDto> RiskPointCount { get; set; } |
|
|
|
[JsonPropertyName("color")] |
|
public string Color { get; set; } |
|
|
|
[JsonPropertyName("sumCount")] |
|
public int SumCount { get; set; } |
|
|
|
[JsonPropertyName("dangerStatistics")] |
|
public DangerStatisticsDto DangerStatistics { get; set; } |
|
|
|
[JsonPropertyName("ticket_do_count")] |
|
public int Ticket_do_count { get; set; } |
|
|
|
[JsonPropertyName("contingency_material_count")] |
|
public int Contingency_material_count { get; set; } |
|
|
|
[JsonPropertyName("fire_equipment_count")] |
|
public int Fire_equipment_count { get; set; } |
|
} |
|
|
|
public struct PointDto |
|
{ |
|
[JsonPropertyName("x")] |
|
public double X { get; set; } |
|
|
|
[JsonPropertyName("y")] |
|
public double Y { get; set; } |
|
} |
|
|
|
public class RistTypeWrapper |
|
{ |
|
[JsonPropertyName("sumCount")] |
|
public int SumCount { get; set; } |
|
|
|
[JsonPropertyName("ristType")] |
|
public List<RistTypeDto> RistType { get; set; } |
|
} |
|
|
|
public class RistTypeDto |
|
{ |
|
[JsonPropertyName("id")] |
|
public int Id { get; set; } |
|
|
|
[JsonPropertyName("name")] |
|
public string Name { get; set; } |
|
|
|
[JsonPropertyName("count")] |
|
public int Count { get; set; } |
|
} |
|
|
|
public class RiskPointCountDto |
|
{ |
|
[JsonPropertyName("name")] |
|
public string Name { get; set; } |
|
|
|
[JsonPropertyName("count")] |
|
public string Count { get; set; } |
|
} |
|
|
|
public class DangerStatisticsDto |
|
{ |
|
[JsonPropertyName("sumDanger")] |
|
public int SumDanger { get; set; } |
|
|
|
[JsonPropertyName("majorDanger")] |
|
public int MajorDanger { get; set; } |
|
|
|
[JsonPropertyName("generalDanger")] |
|
public int GeneralDanger { get; set; } |
|
|
|
[JsonPropertyName("dangerNum")] |
|
public int DangerNum { get; set; } |
|
|
|
[JsonPropertyName("delay")] |
|
public int Delay { get; set; } |
|
} |
|
|
|
#endregion 太阳宫看板-障碍数据 |
|
|
|
#region 太阳宫看板-使用条件组合查询隐患数据返回dto |
|
|
|
public class DangerInfoRootResDto |
|
{ |
|
[JsonPropertyName("current_page")] |
|
public int CurrentPage { get; set; } |
|
|
|
[JsonPropertyName("data")] |
|
public List<DangerRecordDto> Records { get; set; } = new(); |
|
|
|
[JsonPropertyName("first_page_url")] |
|
public string FirstPageUrl { get; set; } |
|
|
|
[JsonPropertyName("last_page")] |
|
public int LastPage { get; set; } |
|
|
|
[JsonPropertyName("last_page_url")] |
|
public string LastPageUrl { get; set; } |
|
|
|
[JsonPropertyName("next_page_url")] |
|
public string NextPageUrl { get; set; } |
|
|
|
[JsonPropertyName("path")] |
|
public string Path { get; set; } |
|
|
|
[JsonPropertyName("per_page")] |
|
public int PerPage { get; set; } |
|
|
|
[JsonPropertyName("prev_page_url")] |
|
public string PrevPageUrl { get; set; } |
|
|
|
[JsonPropertyName("to")] |
|
public int? To { get; set; } |
|
|
|
[JsonPropertyName("total")] |
|
public int Total { get; set; } |
|
} |
|
|
|
public class DangerRecordDto |
|
{ |
|
/// <summary>隐患ID</summary> |
|
[JsonPropertyName("id")] |
|
public int Id { get; set; } |
|
|
|
/// <summary>流水号</summary> |
|
[JsonPropertyName("serial_number")] |
|
public int Serial_number { get; set; } |
|
|
|
/// <summary>隐患编号</summary> |
|
[JsonPropertyName("numbers")] |
|
public string Numbers { get; set; } |
|
|
|
/// <summary>一级分类名称</summary> |
|
[JsonPropertyName("cates_name")] |
|
public string Cates_name { get; set; } |
|
|
|
/// <summary>二级分类名称</summary> |
|
[JsonPropertyName("cates_subs_name")] |
|
public string Cates_subs_name { get; set; } |
|
|
|
/// <summary>风险点名称</summary> |
|
[JsonPropertyName("name")] |
|
public string Name { get; set; } |
|
|
|
/// <summary>隐患等级</summary> |
|
[JsonPropertyName("risk_level")] |
|
public string Risk_level { get; set; } |
|
|
|
/// <summary>责任部门名称</summary> |
|
[JsonPropertyName("branch_name")] |
|
public string Branch_name { get; set; } |
|
|
|
/// <summary>风险点所在区域名称</summary> |
|
[JsonPropertyName("region_name")] |
|
public string Region_name { get; set; } |
|
|
|
/// <summary>联系人手机号</summary> |
|
[JsonPropertyName("user_mobile")] |
|
public string User_mobile { get; set; } |
|
|
|
/// <summary>联系人姓名</summary> |
|
[JsonPropertyName("user_name")] |
|
public string User_name { get; set; } |
|
|
|
/// <summary>隐患描述</summary> |
|
[JsonPropertyName("danger_desc")] |
|
public string Danger_desc { get; set; } |
|
|
|
/// <summary>隐患发生区域</summary> |
|
[JsonPropertyName("danger_region")] |
|
public string Danger_region { get; set; } |
|
|
|
/// <summary>隐患来源</summary> |
|
[JsonPropertyName("danger_source")] |
|
public string Danger_source { get; set; } |
|
|
|
/// <summary>隐患上报人</summary> |
|
[JsonPropertyName("register_user")] |
|
public string Register_user { get; set; } |
|
|
|
/// <summary>隐患上报登记时间</summary> |
|
[JsonPropertyName("register_at")] |
|
public string Register_at { get; set; } |
|
|
|
/// <summary>隐患上报图片</summary> |
|
[JsonPropertyName("register_file")] |
|
public List<RegisterFileDto> Register_file { get; set; } = new(); |
|
|
|
/// <summary>隐患核查结果</summary> |
|
[JsonPropertyName("check_result")] |
|
public string Check_result { get; set; } |
|
|
|
/// <summary>隐患核查人姓名</summary> |
|
[JsonPropertyName("check_user")] |
|
public string Check_user { get; set; } |
|
|
|
/// <summary>隐患核查时间</summary> |
|
[JsonPropertyName("check_at")] |
|
public string Check_at { get; set; } |
|
|
|
/// <summary>隐患整改措施</summary> |
|
[JsonPropertyName("zg_measures")] |
|
public string Zg_measures { get; set; } |
|
|
|
/// <summary>隐患整改责任部门</summary> |
|
[JsonPropertyName("zg_branch")] |
|
public string Zg_branch { get; set; } |
|
|
|
/// <summary>隐患整改人</summary> |
|
[JsonPropertyName("zg_user")] |
|
public string Zg_user { get; set; } |
|
|
|
/// <summary>隐患整改投入资金(元)</summary> |
|
[JsonPropertyName("zg_funds")] |
|
public string Zg_funds { get; set; } |
|
|
|
/// <summary>隐患整改时间</summary> |
|
[JsonPropertyName("zg_at")] |
|
public string Zg_at { get; set; } |
|
|
|
/// <summary>隐患整改图片</summary> |
|
[JsonPropertyName("zg_file")] |
|
public List<RegisterFileDto> Zg_file { get; set; } = new(); |
|
|
|
/// <summary>隐患验收人</summary> |
|
[JsonPropertyName("ys_user")] |
|
public string Ys_user { get; set; } |
|
|
|
/// <summary>隐患验收时间</summary> |
|
[JsonPropertyName("ys_at")] |
|
public string Ys_at { get; set; } |
|
|
|
/// <summary>隐患验收情况</summary> |
|
[JsonPropertyName("ys_info")] |
|
public string Ys_info { get; set; } |
|
|
|
/// <summary>上报来源</summary> |
|
[JsonPropertyName("register_from")] |
|
public string Register_from { get; set; } |
|
|
|
/// <summary>是否挂账</summary> |
|
[JsonPropertyName("is_hang")] |
|
public string Is_hang { get; set; } |
|
|
|
/// <summary>挂账详情</summary> |
|
[JsonPropertyName("hang")] |
|
public JsonElement Hang { get; set; } |
|
|
|
/// <summary>隐患状态</summary> |
|
[JsonPropertyName("status_name")] |
|
public string Status_name { get; set; } |
|
|
|
/// <summary>设备信息(复杂结构或 null)</summary> |
|
[JsonPropertyName("datum_equipment_item")] |
|
public JsonElement Datum_equipment_item { get; set; } |
|
} |
|
|
|
public class RegisterFileDto |
|
{ |
|
[JsonPropertyName("id")] |
|
public int Id { get; set; } |
|
|
|
[JsonPropertyName("tables")] |
|
public string Tables { get; set; } |
|
|
|
[JsonPropertyName("subject_id")] |
|
public int Subject_id { get; set; } |
|
|
|
[JsonPropertyName("paths")] |
|
public string Paths { get; set; } |
|
|
|
[JsonPropertyName("types")] |
|
public int Types { get; set; } |
|
|
|
[JsonPropertyName("status")] |
|
public int Status { get; set; } |
|
|
|
[JsonPropertyName("name")] |
|
public string Name { get; set; } |
|
|
|
[JsonPropertyName("created_at")] |
|
public string Created_at { get; set; } |
|
|
|
[JsonPropertyName("updated_at")] |
|
public string Updated_at { get; set; } |
|
|
|
[JsonPropertyName("file_name")] |
|
public string File_name { get; set; } |
|
} |
|
|
|
public class DatumEquipmentItemDto |
|
{ |
|
[JsonPropertyName("id")] |
|
public int Id { get; set; } |
|
|
|
[JsonPropertyName("aid")] |
|
public int Aid { get; set; } |
|
|
|
[JsonPropertyName("category_id")] |
|
public int Category_id { get; set; } |
|
|
|
[JsonPropertyName("name")] |
|
public string Name { get; set; } |
|
|
|
[JsonPropertyName("content")] |
|
public string Content { get; set; } |
|
|
|
[JsonPropertyName("according_name")] |
|
public string According_name { get; set; } |
|
|
|
[JsonPropertyName("according_content")] |
|
public string According_content { get; set; } |
|
|
|
[JsonPropertyName("created_at")] |
|
public string Created_at { get; set; } |
|
|
|
[JsonPropertyName("updated_at")] |
|
public string Updated_at { get; set; } |
|
|
|
[JsonPropertyName("category")] |
|
public CategoryDto Category { get; set; } |
|
} |
|
|
|
public class CategoryDto |
|
{ |
|
[JsonPropertyName("id")] |
|
public int Id { get; set; } |
|
|
|
[JsonPropertyName("aid")] |
|
public int Aid { get; set; } |
|
|
|
[JsonPropertyName("parent_id")] |
|
public int Parent_id { get; set; } |
|
|
|
[JsonPropertyName("name")] |
|
public string Name { get; set; } |
|
|
|
[JsonPropertyName("sort")] |
|
public int Sort { get; set; } |
|
|
|
[JsonPropertyName("infos")] |
|
public string Infos { get; set; } |
|
|
|
[JsonPropertyName("created_at")] |
|
public string Created_at { get; set; } |
|
|
|
[JsonPropertyName("updated_at")] |
|
public string Updated_at { get; set; } |
|
} |
|
|
|
#endregion 太阳宫看板-使用条件组合查询隐患数据返回dto |
|
|
|
public sealed class FlexibleCenterConverter : JsonConverter<List<List<double>>> |
|
{ |
|
public override List<List<double>> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) |
|
{ |
|
using var doc = JsonDocument.ParseValue(ref reader); |
|
var root = doc.RootElement; |
|
|
|
if (root.ValueKind != JsonValueKind.Array) |
|
return new List<List<double>>(); |
|
|
|
// 空数组 -> [] |
|
if (root.GetArrayLength() == 0) |
|
return new List<List<double>>(); |
|
|
|
// 判断第一项是数字还是数组 |
|
var first = root[0]; |
|
if (first.ValueKind == JsonValueKind.Number || first.ValueKind == JsonValueKind.String) |
|
{ |
|
// 一维: [x, y] 或 ["116.1","39.9"] -> [[x, y]] |
|
var list = new List<double>(root.GetArrayLength()); |
|
foreach (var e in root.EnumerateArray()) |
|
{ |
|
if (e.ValueKind == JsonValueKind.String) |
|
{ |
|
if (double.TryParse(e.GetString(), out var v)) list.Add(v); |
|
} |
|
else if (e.ValueKind == JsonValueKind.Number) |
|
{ |
|
list.Add(e.GetDouble()); |
|
} |
|
} |
|
return new List<List<double>> { list }; |
|
} |
|
else if (first.ValueKind == JsonValueKind.Array) |
|
{ |
|
// 二维: [[x1,y1],[x2,y2]] |
|
var outer = new List<List<double>>(root.GetArrayLength()); |
|
foreach (var inner in root.EnumerateArray()) |
|
{ |
|
var pair = new List<double>(inner.GetArrayLength()); |
|
foreach (var e in inner.EnumerateArray()) |
|
{ |
|
if (e.ValueKind == JsonValueKind.String) |
|
{ |
|
if (double.TryParse(e.GetString(), out var v)) pair.Add(v); |
|
} |
|
else if (e.ValueKind == JsonValueKind.Number) |
|
{ |
|
pair.Add(e.GetDouble()); |
|
} |
|
} |
|
outer.Add(pair); |
|
} |
|
return outer; |
|
} |
|
|
|
return new List<List<double>>(); |
|
} |
|
|
|
public override void Write(Utf8JsonWriter writer, List<List<double>> value, JsonSerializerOptions options) |
|
=> JsonSerializer.Serialize(writer, value, options); |
|
} |
|
|
|
public sealed class FlexiblePointConverter : JsonConverter<PointDto> |
|
{ |
|
public override PointDto Read( |
|
ref Utf8JsonReader reader, |
|
Type typeToConvert, |
|
JsonSerializerOptions options) |
|
{ |
|
// 解析JSON节点,避免直接操作reader导致位置偏移 |
|
using var doc = JsonDocument.ParseValue(ref reader); |
|
var root = doc.RootElement; |
|
|
|
// 1. 处理「对象格式」(如 {"x":609.5,"y":309.703125}) |
|
if (root.ValueKind == JsonValueKind.Object) |
|
{ |
|
// 兼容属性缺失的异常场景(避免崩溃,返回默认值) |
|
bool hasX = root.TryGetProperty("x", out var xElement); |
|
bool hasY = root.TryGetProperty("y", out var yElement); |
|
|
|
if (hasX && hasY && TryParseDouble(xElement, out var x) && TryParseDouble(yElement, out var y)) |
|
{ |
|
return new PointDto { X = x, Y = y }; |
|
} |
|
return default; |
|
} |
|
|
|
// 2. 处理「数组格式」(含数字数组[338,129.203125]和字符串数组["116.079126","39.927465"]) |
|
if (root.ValueKind == JsonValueKind.Array && root.GetArrayLength() >= 2) |
|
{ |
|
var xElement = root[0]; // 数组第一个元素(x值) |
|
var yElement = root[1]; // 数组第二个元素(y值) |
|
|
|
// 解析x和y(兼容数字/字符串类型) |
|
if (TryParseDouble(xElement, out var x) && TryParseDouble(yElement, out var y)) |
|
{ |
|
return new PointDto { X = x, Y = y }; |
|
} |
|
return default; |
|
} |
|
|
|
// 3. 其他未定义格式(返回默认PointDto) |
|
return default; |
|
} |
|
|
|
public override void Write( |
|
Utf8JsonWriter writer, |
|
PointDto value, |
|
JsonSerializerOptions options) |
|
{ |
|
// 序列化时统一按「对象格式」输出(与实体类定义一致,便于后续使用) |
|
writer.WriteStartObject(); |
|
writer.WriteNumber("x", value.X); |
|
writer.WriteNumber("y", value.Y); |
|
writer.WriteEndObject(); |
|
} |
|
|
|
#region 私有辅助方法:统一处理JsonElement(数字/字符串)转double |
|
|
|
/// <summary> |
|
/// 兼容「数字类型」和「字符串类型」的JsonElement,解析为double |
|
/// 例:116.079126 → 116.079126;"116.079126" → 116.079126 |
|
/// </summary> |
|
private bool TryParseDouble(JsonElement element, out double result) |
|
{ |
|
return element.ValueKind switch |
|
{ |
|
// 若元素是数字,直接获取double |
|
JsonValueKind.Number => element.TryGetDouble(out result), |
|
// 若元素是字符串,尝试解析为double |
|
JsonValueKind.String => double.TryParse(element.GetString(), out result), |
|
// 其他类型(如布尔值),解析失败 |
|
_ => (result = 0, false).Item2 |
|
}; |
|
} |
|
|
|
#endregion 私有辅助方法:统一处理JsonElement(数字/字符串)转double |
|
} |
|
} |