Merge pull request 'dev_lx' (#28) from dev_lx into main

Reviewed-on: #28
pull/30/head
刘鑫 3 months ago
commit a54a0c977e
  1. 2
      WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj
  2. 114
      WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs
  3. 264
      WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPalaceBoardResDto.cs
  4. 734
      WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPlaceBoardWorkOrderResDto.cs
  5. 47
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuCe/SunPlaceBoardWorkOrderController.cs
  6. 7
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuTianSuYuan/SunPalaceBoardFacilityController.cs
  7. 34
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs
  8. 4
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.csproj
  9. 2
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/appsettings.json
  10. 4
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/RequestDto/ThirdPartyProviderQueryDto.cs
  11. 66
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/ResponseDto/ThirdPartyProviderResDto.cs
  12. 13
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/ISunPlaceBoardWorkOrderService.cs
  13. 117
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs
  14. 7
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuTianSuYuan/ISunPalaceBoardFacilityService.cs
  15. 15
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuTianSuYuan/SunPalaceBoardFacilityService.cs
  16. 18
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs
  17. 198
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs
  18. 4
      WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ThirdPartyServices.DomainService.csproj

@ -7,7 +7,7 @@
</PropertyGroup>
<PropertyGroup>
<PackageId>Common.Shared.Application</PackageId>
<Version>2.1.0</Version>
<Version>2.5.0</Version>
<Authors>zrh-lx</Authors>
<Company>zrh-lx</Company> <!-- 可选 -->
<Description>包含所有公共使用的 DTO、契约、接口模型等,供微服务之间共享使用</Description>

@ -0,0 +1,114 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Common.Shared.Application.SafetyFirePro.RequestDto
{
/// <summary>
/// 工单查询参数实体类
/// </summary>
public class WorkOrderParamsDto
{
/// <summary>
/// 页码
/// </summary>
/// <example>1</example>
public int PageIndex { get; set; } = 1;
/// <summary>
/// 每页大小
/// </summary>
/// <example>20</example>
public int PageSize { get; set; } = 20;
/// <summary>
/// 紧急程度
/// </summary>
/// <example>5</example>
/// <remarks>5表示一般</remarks>
public int? BxGrade { get; set; }
/// <summary>
/// 工单状态
/// </summary>
public int? Status { get; set; }
/// <summary>
/// 工单类别
/// </summary>
/// <example>11</example>
/// <remarks>11表示总务-配电</remarks>
public int? BxCategoryCode { get; set; }
/// <summary>
/// 派单方式
/// </summary>
/// <example>3</example>
/// <remarks>3表示班组派单</remarks>
public int? DeviceType { get; set; }
/// <summary>
/// 工单id
/// </summary>
/// <example>5</example>
public int? OrderId { get; set; }
/// <summary>
/// 报警设备编号
/// </summary>
public string? DeviceCode { get; set; }
/// <summary>
/// 报修科室
/// </summary>
public string? BxDeptCode { get; set; }
}
/// <summary>
/// 作业任务查询参数实体类
/// </summary>
public class WorkTaskQueryParamsDto
{
/// <summary>
/// 页数
/// </summary>
/// <example>1</example>
/// <remarks>必填项</remarks>
[JsonPropertyName("page")]
public int? Page { get; set; }
/// <summary>
/// 每页数据数量
/// </summary>
/// <example>10</example>
/// <remarks>不传则默认为10</remarks>
[JsonPropertyName("page_size")]
public int? PageSize { get; set; }
/// <summary>
/// 作业状态
/// </summary>
/// <example>3</example>
/// <remarks>1:待审批, 2:待作业前检查, 3:作业中, 4:抽作业前检查, 6:作业结束, 7:延期结束, 8:超时结束, 11:审批不通过, 12:作业中止, 13:强行结束</remarks>
[JsonPropertyName("status")]
public string? Status { get; set; }
/// <summary>
/// 作业活动所在区域id
/// </summary>
/// <example>8888</example>
[JsonPropertyName("region_id")]
public int? RegionId { get; set; }
/// <summary>
/// ubpid参数
/// </summary>
/// <example>"ubpid"</example>
/// <remarks>必填项</remarks>
[JsonPropertyName("ubpid")]
public string Ubpid { get; set; }
}
}

@ -423,7 +423,8 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto
/// 色块名称坐标位置
/// </summary>
[JsonPropertyName("textPoint")]
public List<object> TextPoint { get; set; } // 有时是数字,有时是字符串
[JsonConverter(typeof(FlexiblePointConverter))]
public PointDto TextPoint { get; set; }
/// <summary>
/// 色块图像各顶点经纬度
@ -432,11 +433,14 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto
[JsonConverter(typeof(FlexibleCenterConverter))]
public List<List<double>> Center { get; set; }
[JsonPropertyName("gaodu_x")]
public int GaoduX { get; set; }
//[JsonPropertyName("gaodu_x")]
//public int? GaoduX { get; set; }
[JsonPropertyName("gaodu_y")]
public int GaoduY { get; set; }
//[JsonPropertyName("gaodu_y")]
//public int? GaoduY { get; set; }
[JsonPropertyName("gaodu")]
public int? Gaodu { get; set; }
/// <summary>
/// 色块id
@ -484,6 +488,12 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto
public int FireEquipmentCount { get; set; }
}
public struct PointDto
{
[JsonPropertyName("x")] public double X { get; set; }
[JsonPropertyName("y")] public double Y { get; set; }
}
public class RistTypeWrapper
{
/// <summary>
@ -574,6 +584,175 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto
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
{
[JsonPropertyName("id")]
public int Id { get; set; }
[JsonPropertyName("serial_number")]
public int SerialNumber { get; set; }
[JsonPropertyName("numbers")]
public string Numbers { get; set; }
[JsonPropertyName("cates_name")]
public string CategoryName { get; set; }
[JsonPropertyName("cates_subs_name")]
public string SubCategoryName { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("risk_level")]
public string RiskLevel { get; set; }
[JsonPropertyName("branch_name")]
public string BranchName { get; set; }
[JsonPropertyName("region_name")]
public string RegionName { get; set; }
[JsonPropertyName("user_mobile")]
public string UserMobile { get; set; }
[JsonPropertyName("user_name")]
public string UserName { get; set; }
[JsonPropertyName("danger_desc")]
public string DangerDescription { get; set; }
[JsonPropertyName("danger_region")]
public string DangerRegion { get; set; }
[JsonPropertyName("danger_source")]
public string DangerSource { get; set; }
[JsonPropertyName("register_user")]
public string RegisterUser { get; set; }
[JsonPropertyName("register_at")]
public string RegisterAt { get; set; }
[JsonPropertyName("register_file")]
public List<RegisterFileDto> RegisterFiles { get; set; } = new();
[JsonPropertyName("check_result")]
public string CheckResult { get; set; }
[JsonPropertyName("check_user")]
public string CheckUser { get; set; }
[JsonPropertyName("status_name")]
public string StatusName { get; set; }
// ⚠ 关键:返回里该字段可能是 0 / null / 对象,先用 JsonElement 兜住
[JsonPropertyName("datum_equipment_item")]
public JsonElement DatumEquipmentItem { get; set; }
}
public class RegisterFileDto
{
[JsonPropertyName("id")]
public int Id { get; set; }
[JsonPropertyName("tables")]
public string Tables { get; set; }
[JsonPropertyName("subject_id")]
public int SubjectId { 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 CreatedAt { get; set; }
[JsonPropertyName("updated_at")]
public string UpdatedAt { get; set; }
[JsonPropertyName("file_name")]
public string FileName { get; set; }
}
// 如果你需要用到“设备条目”的详细内容,再单独定义强类型:
public class DatumEquipmentItemDto
{
[JsonPropertyName("id")] public int Id { get; set; }
[JsonPropertyName("aid")] public int Aid { get; set; }
[JsonPropertyName("category_id")] public int CategoryId { get; set; }
[JsonPropertyName("name")] public string Name { get; set; }
[JsonPropertyName("content")] public string Content { get; set; }
[JsonPropertyName("according_name")] public string AccordingName { get; set; }
[JsonPropertyName("according_content")] public string AccordingContent { get; set; }
[JsonPropertyName("created_at")] public string CreatedAt { get; set; }
[JsonPropertyName("updated_at")] public string UpdatedAt { 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 ParentId { 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 CreatedAt { get; set; }
[JsonPropertyName("updated_at")] public string UpdatedAt { 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)
@ -635,7 +814,80 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto
public override void Write(Utf8JsonWriter writer, List<List<double>> value, JsonSerializerOptions options)
=> JsonSerializer.Serialize(writer, value, options);
}
#endregion 太阳宫看板-隐患数据
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
}
}

@ -0,0 +1,734 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace Common.Shared.Application.SafetyFirePro.ResponseDto
{
/// <summary>
/// 工单信息实体类
/// </summary>
public class WorkOrderInfoDto
{
/// <summary>
/// 工单id
/// </summary>
/// <example>29</example>
[JsonPropertyName("orderId")]
public int? OrderId { get; set; }
/// <summary>
/// 工单编码
/// </summary>
/// <example>"GJ3559496"</example>
[JsonPropertyName("orderCode")]
public string? OrderCode { get; set; }
/// <summary>
/// 工单创建时间
/// </summary>
[JsonPropertyName("createTime")]
public string? CreateTime { get; set; }
/// <summary>
/// 报修人
/// </summary>
/// <example>"牙科门诊"</example>
[JsonPropertyName("bxUserName")]
public string? BxUserName { get; set; }
/// <summary>
/// 报修人电话
/// </summary>
/// <example>"18871153411"</example>
[JsonPropertyName("bxUserPhone")]
public string? BxUserPhone { get; set; }
/// <summary>
/// 来电号码
/// </summary>
/// <example>"18871153411"</example>
[JsonPropertyName("bxCallPhone")]
public string? BxCallPhone { get; set; }
/// <summary>
/// 报修时间
/// </summary>
/// <example>"2024-01-04 13:08:58"</example>
[JsonPropertyName("bxTime")]
public string? BxTime { get; set; }
/// <summary>
/// 报修区域
/// </summary>
/// <example>608</example>
[JsonPropertyName("bxDeptCode")]
public int? BxDeptCode { get; set; }
/// <summary>
/// 报修区域名称
/// </summary>
/// <example>"门诊楼"</example>
[JsonPropertyName("bxDeptName")]
public string? BxDeptName { get; set; }
/// <summary>
/// 详细位置
/// </summary>
/// <example>"门诊2楼202室"</example>
[JsonPropertyName("bxAddress")]
public string? BxAddress { get; set; }
/// <summary>
/// 工单类别
/// </summary>
/// <example>"11"</example>
[JsonPropertyName("bxCategoryCode")]
public string? BxCategoryCode { get; set; }
/// <summary>
/// 报修紧急程度
/// </summary>
/// <example>"1"</example>
[JsonPropertyName("bxGrade")]
public string? BxGrade { get; set; }
/// <summary>
/// 派单方式
/// </summary>
/// <example>"3"</example>
[JsonPropertyName("deviceType")]
public string? DeviceType { get; set; }
/// <summary>
/// 报修内容
/// </summary>
/// <example>"门把手坏了"</example>
[JsonPropertyName("bxContent")]
public string? BxContent { get; set; }
/// <summary>
/// 报修视频
/// </summary>
/// <example>null</example>
[JsonPropertyName("bxMp4")]
public string? BxMp4 { get; set; }
/// <summary>
/// 工单状态
/// </summary>
/// <example>"11"</example>
[JsonPropertyName("status")]
public string? Status { get; set; }
/// <summary>
/// 工单处理内容
/// </summary>
/// <example>"维修完成"</example>
[JsonPropertyName("handleContent")]
public string? HandleContent { get; set; }
/// <summary>
/// 工单处理图片
/// </summary>
/// <example>"http://4tjerijg.png"</example>
[JsonPropertyName("handleImg")]
public string? HandleImg { get; set; }
/// <summary>
/// 工单处理时间
/// </summary>
/// <example>"2024-01-04 15:24:20"</example>
[JsonPropertyName("handleTime")]
public string? HandleTime { get; set; }
/// <summary>
/// 派单时间
/// </summary>
/// <example>null</example>
[JsonPropertyName("deviceTime")]
public string? DeviceTime { get; set; }
/// <summary>
/// 接单时间
/// </summary>
/// <example>null</example>
[JsonPropertyName("acceptTime")]
public string? AcceptTime { get; set; }
/// <summary>
/// 接单班组
/// </summary>
/// <example>6</example>
[JsonPropertyName("acceptGroupCode")]
public int? AcceptGroupCode { get; set; }
/// <summary>
/// 接单班组名称
/// </summary>
/// <example>"门诊已处理"</example>
[JsonPropertyName("acceptGroupName")]
public string? AcceptGroupName { get; set; }
/// <summary>
/// 接单人
/// </summary>
/// <example>125</example>
[JsonPropertyName("acceptUserCode")]
public long? AcceptUserCode { get; set; }
/// <summary>
/// 接单人姓名
/// </summary>
[JsonPropertyName("acceptUserName")]
public string? AcceptUserName { get; set; }
/// <summary>
/// 评价时间
/// </summary>
/// <example>"2024-01-04 13:15:50"</example>
[JsonPropertyName("assessTime")]
public string? AssessTime { get; set; }
/// <summary>
/// 效率评分
/// </summary>
/// <example>null</example>
[JsonPropertyName("assessScoreXl")]
public int? AssessScoreXl { get; set; }
/// <summary>
/// 服务评分
/// </summary>
/// <example>2</example>
[JsonPropertyName("assessScoreFw")]
public int? AssessScoreFw { get; set; }
/// <summary>
/// 质量评分
/// </summary>
/// <example>null</example>
[JsonPropertyName("assessScoreZl")]
public int? AssessScoreZl { get; set; }
/// <summary>
/// 评价内容
/// </summary>
/// <example>"维修优秀"</example>
[JsonPropertyName("assessContent")]
public string? AssessContent { get; set; }
/// <summary>
/// 备注
/// </summary>
/// <example>"测试报修"</example>
[JsonPropertyName("remark")]
public string? Remark { get; set; }
}
/// <summary>
/// 工单时间轴实体类
/// </summary>
/// <summary>
/// 工单时间轴节点实体(data数组元素)
/// </summary>
public class WorkOrderTimelineDto
{
/// <summary>
/// 时间轴id
/// </summary>
[JsonPropertyName("timelineId")]
public long? TimelineId { get; set; }
/// <summary>
/// 节点类型(示例:"办结工单"、"登记派发工单")
/// </summary>
[JsonPropertyName("nodeType")]
public string? NodeType { get; set; }
/// <summary>
/// 节点描述(示例:"办结工单,单号:2350"、"保洁")
/// </summary>
[JsonPropertyName("nodeDesc")]
public string? NodeDesc { get; set; }
/// <summary>
/// 节点详情(示例:"【管理员】办结工单,单号:2350")
/// </summary>
[JsonPropertyName("nodeDetail")]
public string? NodeDetail { get; set; }
/// <summary>
/// 处理图片路径(可为null,无图片时返回null)
/// </summary>
[JsonPropertyName("nodeImg")]
public string? NodeImg { get; set; }
/// <summary>
/// 处理视频路径(可为null,无视频时返回null)
/// </summary>
[JsonPropertyName("nodeMp4")]
public string? NodeMp4 { get; set; }
/// <summary>
/// 创建人ID
/// </summary>
[JsonPropertyName("createBy")]
public long? CreateBy { get; set; }
/// <summary>
/// 创建时间(JSON格式:"yyyy-MM-dd HH:mm:ss")
/// </summary>
[JsonPropertyName("createTime")]
[JsonConverter(typeof(FixedPatternDateTimeConverter))]
public DateTime? CreateTime { get; set; }
/// <summary>
/// 工单状态(示例:"11"表示办结,"1"表示已派发)
/// </summary>
[JsonPropertyName("status")]
public string? Status { get; set; }
/// <summary>
/// 工单id
/// </summary>
[JsonPropertyName("orderId")]
public long? OrderId { get; set; }
/// <summary>
/// 操作人员姓名(示例:"管理员")
/// </summary>
[JsonPropertyName("operaterName")]
public string? OperaterName { get; set; }
/// <summary>
/// 节点颜色(示例:"#909399"、"#E6A23C",用于前端显示)
/// </summary>
[JsonPropertyName("nodeColor")]
public string? NodeColor { get; set; }
/// <summary>
/// 效率评分(可为null,无评分时返回null)
/// </summary>
[JsonPropertyName("assessScoreXl")]
public decimal? AssessScoreXl { get; set; }
/// <summary>
/// 服务评分(可为null,无评分时返回null)
/// </summary>
[JsonPropertyName("assessScoreFw")]
public decimal? AssessScoreFw { get; set; }
/// <summary>
/// 质量评分(可为null,无评分时返回null)
/// </summary>
[JsonPropertyName("assessScoreZl")]
public decimal? AssessScoreZl { get; set; }
/// <summary>
/// 评价内容(可为null,无评价时返回null)
/// </summary>
[JsonPropertyName("assessContent")]
public string? AssessContent { get; set; }
}
#region 危险施工作业响应体
public class LedgerDto
{
/// <summary>
/// 当前页码
/// </summary>
[JsonPropertyName("current_page")]
public int CurrentPage { get; set; }
/// <summary>
/// 符合查询条件的数据总数
/// </summary>
[JsonPropertyName("total")]
public int Total { get; set; }
/// <summary>
/// 作业票列表
/// </summary>
[JsonPropertyName("data")]
public List<WorkTicket> Data { get; set; }
}
public class WorkTicket
{
/// <summary>
/// 作业详细地点
/// </summary>
[JsonPropertyName("address")]
public string Address { get; set; }
/// <summary>
/// 作业票申请信息
/// </summary>
[JsonPropertyName("applicant_info")]
public ApplicantInfo ApplicantInfo { get; set; }
/// <summary>
/// 作业票审批过程信息
/// </summary>
[JsonPropertyName("approval_tasks")]
public List<ApprovalTask> ApprovalTasks { get; set; }
/// <summary>
/// 作业活动部门信息
/// </summary>
[JsonPropertyName("branch")]
public Branch Branch { get; set; }
/// <summary>
/// 作业活动内容
/// </summary>
[JsonPropertyName("content")]
public string Content { get; set; }
/// <summary>
/// 作业教育人信息
/// </summary>
[JsonPropertyName("education_info")]
public EducationInfo EducationInfo { get; set; }
/// <summary>
/// 计划结束时间
/// </summary>
[JsonPropertyName("end_at")]
public string EndAt { get; set; }
/// <summary>
/// 实际结束时间
/// </summary>
[JsonPropertyName("finish_time")]
public string FinishTime { get; set; }
/// <summary>
/// 作业ID
/// </summary>
[JsonPropertyName("id")]
public int Id { get; set; }
/// <summary>
/// 作业名称
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
/// <summary>
/// 作业编号
/// </summary>
[JsonPropertyName("number")]
public string Number { get; set; }
/// <summary>
/// 作业人员信息
/// </summary>
[JsonPropertyName("operators")]
public List<Operator> Operators { get; set; }
/// <summary>
/// 作业负责人信息
/// </summary>
[JsonPropertyName("principal_info")]
public PrincipalInfo PrincipalInfo { get; set; }
/// <summary>
/// 实际开始作业时间
/// </summary>
[JsonPropertyName("real_start_at")]
public string RealStartAt { get; set; }
/// <summary>
/// 作业地点id
/// </summary>
[JsonPropertyName("region_id")]
public int RegionId { get; set; }
/// <summary>
/// 作业地点信息
/// </summary>
[JsonPropertyName("region")]
public Region Region { get; set; }
/// <summary>
/// 作业检查信息
/// </summary>
[JsonPropertyName("Supervises")]
public List<Supervise> Supervises { get; set; }
/// <summary>
/// 作业计划开始时间
/// </summary>
[JsonPropertyName("start_at")]
public string StartAt { get; set; }
/// <summary>
/// 作业状态
/// 1待审批,2待作业前检查,3作业中,4抽作业前检查,6作业结束,
/// 7延期结束,8超时结束,11审批不通过,12作业中止,13强行结束
/// </summary>
[JsonPropertyName("status")]
public int Status { get; set; }
/// <summary>
/// 作业类型
/// 1动火,2高处,3受限空间,4临时用电,5盲板抽堵,
/// 6断路,7动土吊装,8吊装,9爆破
/// </summary>
[JsonPropertyName("type")]
public int Type { get; set; }
}
public class ApplicantInfo
{
/// <summary>
/// 申请ID
/// </summary>
[JsonPropertyName("id")]
public int Id { get; set; }
/// <summary>
/// 申请人id
/// </summary>
[JsonPropertyName("uid")]
public int Uid { get; set; }
/// <summary>
/// 申请人姓名
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
}
public class ApprovalTask
{
/// <summary>
/// 审批ID
/// </summary>
[JsonPropertyName("id")]
public int Id { get; set; }
/// <summary>
/// 审批意见
/// </summary>
[JsonPropertyName("infos")]
public string Infos { get; set; }
/// <summary>
/// 审批状态 0待审批,1同意,2不同意
/// </summary>
[JsonPropertyName("status")]
public int Status { get; set; }
/// <summary>
/// 审批人信息
/// </summary>
[JsonPropertyName("user")]
public ApprovalUser User { get; set; }
}
public class ApprovalUser
{
/// <summary>
/// 审批人附加信息
/// </summary>
[JsonPropertyName("extras")]
public Extras Extras { get; set; }
/// <summary>
/// 审批人所在部门
/// </summary>
[JsonPropertyName("branch")]
public List<UserBranchWrapper> Branch { get; set; }
}
public class Extras
{
/// <summary>
/// 审批人姓名
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
}
public class UserBranchWrapper
{
[JsonPropertyName("Branch")]
public Branch Branch { get; set; }
}
public class Branch
{
/// <summary>
/// 部门ID
/// </summary>
[JsonPropertyName("id")]
public int Id { get; set; }
/// <summary>
/// 部门名称
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
}
public class EducationInfo
{
/// <summary>
/// 作业教育人姓名
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
}
public class Operator
{
/// <summary>
/// 作业人信息
/// </summary>
[JsonPropertyName("user_info")]
public UserInfo UserInfo { get; set; }
}
public class PrincipalInfo
{
/// <summary>
/// 作业负责人姓名
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
}
public class Region
{
/// <summary>
/// 作业地点名称
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
}
public class Supervise
{
/// <summary>
/// 作业检查时间
/// </summary>
[JsonPropertyName("check_at")]
public string CheckAt { get; set; }
/// <summary>
/// 检查情况说明
/// </summary>
[JsonPropertyName("infos")]
public string Infos { get; set; }
/// <summary>
/// 安全措施及检查情况
/// </summary>
[JsonPropertyName("measure_check_content")]
public List<MeasureCheckContent> MeasureCheckContent { get; set; }
/// <summary>
/// 气温
/// </summary>
[JsonPropertyName("temperature")]
public string Temperature { get; set; }
/// <summary>
/// 检查人信息
/// </summary>
[JsonPropertyName("user_info")]
public UserInfo UserInfo { get; set; }
/// <summary>
/// 天气情况
/// </summary>
[JsonPropertyName("weather")]
public string Weather { get; set; }
/// <summary>
/// 风力等级
/// </summary>
[JsonPropertyName("wind")]
public string Wind { get; set; }
}
public class MeasureCheckContent
{
/// <summary>
/// 安全措施内容
/// </summary>
[JsonPropertyName("infos")]
public string Infos { get; set; }
/// <summary>
/// 检查结果,1符合,0不符合
/// </summary>
[JsonPropertyName("radio")]
public int Radio { get; set; }
}
public class UserInfo
{
/// <summary>
/// 姓名
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; }
}
#endregion 危险施工作业响应体
public sealed class FixedPatternDateTimeConverter : JsonConverter<DateTime?>
{
private const string Pattern = "yyyy-MM-dd HH:mm:ss";
public override DateTime? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.Null) return null;
if (reader.TokenType == JsonTokenType.String)
{
var s = reader.GetString();
if (string.IsNullOrWhiteSpace(s)) return null;
// 先按固定格式
if (DateTime.TryParseExact(
s, Pattern, System.Globalization.CultureInfo.InvariantCulture,
System.Globalization.DateTimeStyles.AssumeLocal, out var dt))
return dt;
// 退化:再尝试系统通用解析(兼容 ISO8601)
if (DateTime.TryParse(s, out dt))
return dt;
throw new JsonException($"Invalid date format: {s}");
}
// 可选:数字视为 Unix 时间戳(秒/毫秒)
if (reader.TokenType == JsonTokenType.Number && reader.TryGetInt64(out var num))
{
var dto = num > 3_000_000_000
? DateTimeOffset.FromUnixTimeMilliseconds(num)
: DateTimeOffset.FromUnixTimeSeconds(num);
return dto.LocalDateTime;
}
throw new JsonException("Unexpected token for DateTime.");
}
public override void Write(Utf8JsonWriter writer, DateTime? value, JsonSerializerOptions options)
{
if (value.HasValue)
writer.WriteStringValue(value.Value.ToString(Pattern));
else
writer.WriteNullValue();
}
}
}

@ -0,0 +1,47 @@
using Common.Shared.Application.BaseModels;
using Common.Shared.Application.SafetyFirePro.RequestDto;
using Common.Shared.Application.SafetyFirePro.ResponseDto;
using Microsoft.AspNetCore.Mvc;
using ThirdPartyServices.DomainService.PuCe;
namespace ThirdPartyServices.API.Controllers.PuCe
{
/// <summary>
/// 智慧建筑太阳宫看板-工单模块-普策公司接口
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
public class SunPlaceBoardWorkOrderController : ControllerBase
{
private readonly ILogger<SunPlaceBoardWorkOrderController> _logger;
private readonly ISunPlaceBoardWorkOrderService _workOrderService;
public SunPlaceBoardWorkOrderController(ILogger<SunPlaceBoardWorkOrderController> logger, ISunPlaceBoardWorkOrderService workOrderService)
{
_logger = logger;
_workOrderService = workOrderService;
}
/// <summary>
/// 工单列表查询接口
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("orderList")]
public async Task<ApiResult<List<WorkOrderInfoDto>>> GetRepairOrderList(WorkOrderParamsDto dto)
{
return await _workOrderService.GetRepairOrderList(dto);
}
/// <summary>
/// 工单时间轴
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
[HttpGet("orderline")]
public async Task<ApiResult<List<WorkOrderTimelineDto>>> GetTimelineListByOrderId(string orderId)
{
return await _workOrderService.GetTimelineListByOrderId(orderId);
}
}
}

@ -1,4 +1,5 @@
using Common.Shared.Application.SafetyFirePro.RequestDto;
using Common.Shared.Application.BaseModels;
using Common.Shared.Application.SafetyFirePro.RequestDto;
using Common.Shared.Application.SafetyFirePro.ResponseDto;
using Microsoft.AspNetCore.Mvc;
using ThirdPartyServices.DomainService.PuTianSuYuan;
@ -28,7 +29,7 @@ namespace ThirdPartyServices.API.Controllers.PuTianSuYuan
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("assetList")]
public async Task<List<AssetOverviewResDto>> GetAssetDashboardEchart(SecSituationQueryDto dto)
public async Task<ApiResult<List<AssetOverviewResDto>>> GetAssetDashboardEchart(SecSituationQueryDto dto)
{
return await _sunPalaceBoardFacilityService.GetAssetDashboardEchart(dto);
}
@ -38,7 +39,7 @@ namespace ThirdPartyServices.API.Controllers.PuTianSuYuan
/// </summary>
/// <returns></returns>
[HttpPost("assetType")]
public async Task<List<AssetTypeResDto>> GetAssetTypeEchart(SecSituationQueryDto dto)
public async Task<ApiResult<List<AssetTypeResDto>>> GetAssetTypeEchart(SecSituationQueryDto dto)
{
return await _sunPalaceBoardFacilityService.GetAssetTypeEchart(dto);
}

@ -1,4 +1,7 @@
using Common.Shared.Application.SafetyFirePro.ResponseDto;
using Common.Shared.Application.BaseModels;
using Common.Shared.Application.SafetyFirePro.RequestDto;
using Common.Shared.Application.SafetyFirePro.ResponseDto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Text.Json;
using ThirdPartyServices.DomainService.ShenZhouShengAn;
@ -27,17 +30,29 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn
/// </summary>
/// <returns></returns>
[HttpGet("productionRisk")]
public async Task<DangerRiskAreaResDto> GetProductionRiskEchart()
public async Task<ApiResult<DangerRiskAreaResDto>> GetProductionRiskEchart()
{
return await _secSituationService.GetProductionRiskEchart();
}
/// <summary>
/// 获取指定区域ID的隐患数据
/// </summary>
/// <param name="regionId">返回本区域隐患(不包含下属子区域隐患)</param>
/// <param name="pRegionId">返回本区域及下属子区域隐患</param>
/// <returns></returns>
[HttpGet("new/dangerInfo")]
public async Task<ApiResult<DangerInfoRootResDto>> GetDangerInfoEchart(string? regionId, string? pRegionId)
{
return await _secSituationService.GetDangerInfos(regionId, pRegionId);
}
/// <summary>
///获得四色图图层列表
/// </summary>
/// <returns></returns>
[HttpGet("listFloor")]
public async Task<FloorResDto> GetListFloor()
public async Task<ApiResult<FloorResDto>> GetListFloor()
{
return await _secSituationService.GetListFloor();
}
@ -48,9 +63,20 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn
/// <param name="floorId">图层id</param>
/// <returns></returns>
[HttpGet("getRiskMapInfo")]
public async Task<RootReqDto> GetRiskMapInfo(int floorId)
public async Task<ApiResult<RootReqDto>> GetRiskMapInfo(int floorId)
{
return await _secSituationService.GetRiskMapInfo(floorId);
}
/// <summary>
/// 获得危险作业(施工)数据
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
[HttpPost("ledger")]
public async Task<ApiResult<LedgerDto>> GetLedger(WorkTaskQueryParamsDto dto)
{
return await _secSituationService.GetLedger(dto);
}
}
}

@ -7,10 +7,6 @@
<GenerateDocumentationFile>True</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<Folder Include="Controllers\PuCe\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerGen" Version="9.0.4" />

@ -5,7 +5,7 @@
"Microsoft.AspNetCore": "Warning"
}
},
//
///
"ThirdParty": {
"AssetWeb": {
"ServiceUrl": "http://123.56.129.171:8280/services/AssetWeb.asmx",

@ -64,6 +64,10 @@ namespace ThirdPartyServices.Application.ShenZhouShengAn.RequestDto
public string? Start_time { get; set; }
public string? End_time { get; set; }
public long? P_region_id { get; set; }
public long? Region_id { get; set; }
}
/// <summary>

@ -1,4 +1,5 @@
//第三方返回数据
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ThirdPartyServices.Application.ShenZhouShengAn.ResponseDto
@ -32,7 +33,72 @@ namespace ThirdPartyServices.Application.ShenZhouShengAn.ResponseDto
[JsonPropertyName("message")]
public string Message { get; set; }
[JsonPropertyName("msg")]
public string Msg { set { if (string.IsNullOrEmpty(Message)) Message = value; } }
[JsonPropertyName("data")]
public T Data { get; set; }
}
public class HttpClientResultConverter<T> : JsonConverter<HttpClientResult<T>>
{
public override HttpClientResult<T> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.StartObject)
{
throw new JsonException();
}
var result = new HttpClientResult<T>();
while (reader.Read())
{
if (reader.TokenType == JsonTokenType.EndObject)
{
return result;
}
if (reader.TokenType == JsonTokenType.PropertyName)
{
string propertyName = reader.GetString();
reader.Read();
switch (propertyName)
{
case "code":
result.Code = reader.GetString();
break;
case "message":
case "msg": // 👈 支持两个字段名
result.Message = reader.GetString();
break;
case "data":
result.Data = JsonSerializer.Deserialize<T>(ref reader, options);
break;
default:
// 忽略未知属性
reader.Skip();
break;
}
}
}
throw new JsonException("Unexpected end of JSON.");
}
public override void Write(Utf8JsonWriter writer, HttpClientResult<T> value, JsonSerializerOptions options)
{
writer.WriteStartObject();
writer.WriteString("code", value.Code);
writer.WriteString("message", value.Message); // 序列化时统一用 "message"
if (value.Data != null)
{
writer.WritePropertyName("data");
JsonSerializer.Serialize(writer, value.Data, value.Data.GetType(), options);
}
writer.WriteEndObject();
}
}
}

@ -0,0 +1,13 @@
using Common.Shared.Application.BaseModels;
using Common.Shared.Application.SafetyFirePro.RequestDto;
using Common.Shared.Application.SafetyFirePro.ResponseDto;
namespace ThirdPartyServices.DomainService.PuCe
{
public interface ISunPlaceBoardWorkOrderService
{
Task<ApiResult<List<WorkOrderInfoDto>>> GetRepairOrderList(WorkOrderParamsDto dto);
Task<ApiResult<List<WorkOrderTimelineDto>>> GetTimelineListByOrderId(string orderId);
}
}

@ -0,0 +1,117 @@
using Common.Shared.Application.BaseModels;
using Common.Shared.Application.SafetyFirePro.RequestDto;
using Common.Shared.Application.SafetyFirePro.ResponseDto;
using Microsoft.Extensions.Logging;
using System.Net.Http.Json;
using System.Text.Json;
using ThirdPartyServices.Application.ShenZhouShengAn.ResponseDto;
namespace ThirdPartyServices.DomainService.PuCe
{
public class SunPlaceBoardWorkOrderService : ISunPlaceBoardWorkOrderService
{
private readonly ILogger<SunPlaceBoardWorkOrderService> _logger;
public SunPlaceBoardWorkOrderService(ILogger<SunPlaceBoardWorkOrderService> logger)
{
_logger = logger;
}
/// <summary>
/// 开发测试的时候,忽略证书
/// </summary>
private static readonly HttpClient _http = new HttpClient(new HttpClientHandler
{
ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
});
/// <summary>
/// 工单列表查询接口
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task<ApiResult<List<WorkOrderInfoDto>>> GetRepairOrderList(WorkOrderParamsDto dto)
{
ApiResult<List<WorkOrderInfoDto>> result = new ApiResult<List<WorkOrderInfoDto>>() { Code = 200, Msg = "接口调用成功" };
var url = "https://zrh.hservices.online/prod-api/yzs/order/getRepairOrderList";
try
{
using var req = new HttpRequestMessage(HttpMethod.Get, url)
{
Content = JsonContent.Create(dto)
};
using var resp = await _http.SendAsync(req);
var body = await resp.Content.ReadAsStringAsync();
if (!resp.IsSuccessStatusCode)
{
_logger.LogWarning($"工单列表查询接口请求失败,{body}");
return ApiResult<List<WorkOrderInfoDto>>.IsFail($"工单列表查询接口请求失败,{body}");
}
var httppReult = JsonSerializer.Deserialize<HttpClientResult<List<WorkOrderInfoDto>>>(body);
if (httppReult != null && httppReult.Code == "200")
{
result.Data = httppReult.Data;
}
else
{
_logger.LogWarning($"工单列表查询接口请求失败,{body}");
return ApiResult<List<WorkOrderInfoDto>>.IsFail($"工单列表查询接口请求失败,{body}");
}
}
catch (Exception ex)
{
_logger.LogError(ex, "工单列表查询接口请求失败");
return ApiResult<List<WorkOrderInfoDto>>.IsFail($"工单列表查询接口请求失败{ex.Message}");
}
return result;
}
/// <summary>
/// 工单时间轴
/// </summary>
/// <param name="orderId"></param>
/// <returns></returns>
public async Task<ApiResult<List<WorkOrderTimelineDto>>> GetTimelineListByOrderId(string orderId)
{
ApiResult<List<WorkOrderTimelineDto>> result = new ApiResult<List<WorkOrderTimelineDto>>() { Code = 200, Msg = "调用接口成功" };
var url = $"https://zrh.hservices.online/prod-api/yzs/timeline/getTimelineListByOrderId?orderId={orderId}";
try
{
using var req = new HttpRequestMessage(HttpMethod.Get, url);
using var resp = await _http.SendAsync(req);
var body = await resp.Content.ReadAsStringAsync();
if (!resp.IsSuccessStatusCode)
{
_logger.LogWarning($"工单时间轴接口请求失败,{body}");
return ApiResult<List<WorkOrderTimelineDto>>.IsFail($"工单时间轴接口请求失败,{body}");
}
var httppReult = JsonSerializer.Deserialize<HttpClientResult<List<WorkOrderTimelineDto>>>(body);
if (httppReult != null && httppReult.Code == "200")
{
result.Data = httppReult.Data;
}
else
{
_logger.LogWarning($"工单时间轴接口请求失败,{body}");
return ApiResult<List<WorkOrderTimelineDto>>.IsFail($"工单时间轴接口请求失败,{body}");
}
}
catch (Exception ex)
{
_logger.LogError(ex, "工单时间轴接口请求失败");
return ApiResult<List<WorkOrderTimelineDto>>.IsFail($"工单时间轴接口请求失败{ex.Message}");
}
return result;
}
}
}

@ -1,12 +1,13 @@
using Common.Shared.Application.SafetyFirePro.RequestDto;
using Common.Shared.Application.BaseModels;
using Common.Shared.Application.SafetyFirePro.RequestDto;
using Common.Shared.Application.SafetyFirePro.ResponseDto;
namespace ThirdPartyServices.DomainService.PuTianSuYuan
{
public interface ISunPalaceBoardFacilityService
{
Task<List<AssetOverviewResDto>> GetAssetDashboardEchart(SecSituationQueryDto dto);
Task<ApiResult<List<AssetOverviewResDto>>> GetAssetDashboardEchart(SecSituationQueryDto dto);
Task<List<AssetTypeResDto>> GetAssetTypeEchart(SecSituationQueryDto dto);
Task<ApiResult<List<AssetTypeResDto>>> GetAssetTypeEchart(SecSituationQueryDto dto);
}
}

@ -17,9 +17,9 @@ namespace ThirdPartyServices.DomainService.PuTianSuYuan
_assetWebService = assetWebService;
}
public async Task<List<AssetOverviewResDto>> GetAssetDashboardEchart(SecSituationQueryDto dto)
public async Task<ApiResult<List<AssetOverviewResDto>>> GetAssetDashboardEchart(SecSituationQueryDto dto)
{
List<AssetOverviewResDto> result = [];
ApiResult<List<AssetOverviewResDto>> result = new ApiResult<List<AssetOverviewResDto>>() { Code = 200, Msg = "接口调用成功" };
DateTime start = DateTime.Now;
DateTime end = DateTime.Now;
@ -128,12 +128,12 @@ namespace ThirdPartyServices.DomainService.PuTianSuYuan
};
resDtos.Add(assetAlarmRes);
result = resDtos;
return result;
result.Data = resDtos;
}
catch (Exception ex)
{
_logger.LogWarning(ex, "GetAssetDashboardEchart接口出错");
return ApiResult<List<AssetOverviewResDto>>.IsFail($"GetAssetDashboardEchart接口出错{ex.Message}");
}
return result;
}
@ -143,9 +143,9 @@ namespace ThirdPartyServices.DomainService.PuTianSuYuan
/// </summary>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task<List<AssetTypeResDto>> GetAssetTypeEchart(SecSituationQueryDto dto)
public async Task<ApiResult<List<AssetTypeResDto>>> GetAssetTypeEchart(SecSituationQueryDto dto)
{
List<AssetTypeResDto> result = [];
ApiResult<List<AssetTypeResDto>> result = new ApiResult<List<AssetTypeResDto>>() { Code = 200, Msg = "接口调用成功" };
DateTime start = DateTime.Now;
DateTime end = DateTime.Now;
@ -184,11 +184,12 @@ namespace ThirdPartyServices.DomainService.PuTianSuYuan
});
}
}
result = assetTypes;
result.Data = assetTypes;
}
catch (Exception ex)
{
_logger.LogWarning(ex, "GetAssetTypeEchart接口出错");
return ApiResult<List<AssetTypeResDto>>.IsFail($"GetAssetTypeEchart接口出错{ex.Message}");
}
return result;
}

@ -1,30 +1,30 @@
using Common.Shared.Application.SafetyFirePro.ResponseDto;
using Common.Shared.Application.BaseModels;
using Common.Shared.Application.SafetyFirePro.RequestDto;
using Common.Shared.Application.SafetyFirePro.ResponseDto;
using System.Text.Json;
namespace ThirdPartyServices.DomainService.ShenZhouShengAn
{
public interface ISunPalaceBoardSafetyService
{
//Task<ApiResult<List<SecurityHiddenDangerHighRiskAreaResDto>>> GetHiddenDangerTrend(SecSituationQueryDto dto);
//Task<ApiResult<List<IdCardAlarmResDto>>> GetIdCardAlarmEchart();
Task<DangerRiskAreaResDto> GetProductionRiskEchart();
Task<ApiResult<DangerRiskAreaResDto>> GetProductionRiskEchart();
/// <summary>
/// 获得四色图图层列表
/// </summary>
/// <param name="ubpid">用户单位标记码</param>
/// <returns></returns>
Task<FloorResDto> GetListFloor();
Task<ApiResult<FloorResDto>> GetListFloor();
/// <summary>
/// 获得四色图区域列表
/// </summary>
/// <param name="floorId">图层id</param>
/// <returns></returns>
Task<RootReqDto> GetRiskMapInfo(int floorId);
Task<ApiResult<RootReqDto>> GetRiskMapInfo(int floorId);
Task<ApiResult<DangerInfoRootResDto>> GetDangerInfos(string? regionId, string? pRegionId);
//Task<ApiResult<AlarmInfoResultPageModelV02>> GetUnAlarmInfoList(AlarmEventEchartQueryDto dto);
Task<ApiResult<LedgerDto>> GetLedger(WorkTaskQueryParamsDto dto);
}
}

@ -1,4 +1,6 @@
using Common.Shared.Application.SafetyFirePro.ResponseDto;
using Common.Shared.Application.BaseModels;
using Common.Shared.Application.SafetyFirePro.RequestDto;
using Common.Shared.Application.SafetyFirePro.ResponseDto;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using MongoDB.Bson.IO;
@ -27,9 +29,9 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
/// <param name="ubpid">用户单位标记码</param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task<FloorResDto> GetListFloor()
public async Task<ApiResult<FloorResDto>> GetListFloor()
{
var result = new FloorResDto();
ApiResult<FloorResDto> result = new ApiResult<FloorResDto>() { Code = 200, Msg = "接口调用成功", Data = null };
try
{
@ -38,7 +40,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (string.IsNullOrWhiteSpace(token))
{
_logger.LogWarning("GetListFloor接口获取token失败");
return result;
return ApiResult<FloorResDto>.IsFail("GetListFloor接口获取token失败");
}
//获取用户配置
@ -46,7 +48,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (loginUsers.Code == "Error")
{
_logger.LogWarning("GetListFloor接口获取用户配置失败");
return result;
return ApiResult<FloorResDto>.IsFail("GetListFloor接口获取用户配置失败");
}
//生产风险识别
@ -55,11 +57,15 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
"https://zrh.szdunan.cn/v1/api/riskFourcoloringMap/getlistFloor",
token, loginUsers.Data.Ubpid, HttpMethod.Post);
result = new FloorResDto { Data = riskResult.Data };
if (riskResult.Data != null)
{
result.Data = new FloorResDto { Data = riskResult.Data };
}
}
catch (Exception ex)
{
_logger.LogWarning(ex, "GetListFloor接口出错");
return ApiResult<FloorResDto>.IsFail($"GetListFloor接口出错{ex.Message}");
}
return result;
@ -70,13 +76,9 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
public async Task<DangerRiskAreaResDto> GetProductionRiskEchart()
public async Task<ApiResult<DangerRiskAreaResDto>> GetProductionRiskEchart()
{
var result = new DangerRiskAreaResDto()
{
DangerInfos = new List<DangerInfo>(),
ProductionRiskStats = new List<ProductionRiskStatsResDto>()
};
ApiResult<DangerRiskAreaResDto> result = new() { Code = 200, Msg = "接口调用成功", Data = new DangerRiskAreaResDto() { DangerInfos = [], ProductionRiskStats = [] } };
try
{
//获取token
@ -84,7 +86,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (string.IsNullOrWhiteSpace(token))
{
_logger.LogWarning("GetProductionRiskEchart接口获取token失败");
return result;
return ApiResult<DangerRiskAreaResDto>.IsFail("GetProductionRiskEchart接口获取token失败");
}
//获取用户配置
@ -92,7 +94,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (loginUsers.Code == "Error")
{
_logger.LogWarning("GetProductionRiskEchart接口获取用户配置失败");
return result;
return ApiResult<DangerRiskAreaResDto>.IsFail("GetProductionRiskEchart接口获取用户配置失败");
}
//获取单位信息
@ -100,8 +102,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (branchs.Code == "Error")
{
_logger.LogWarning("GetProductionRiskEchart接口获取单位信息失败");
return result;
return ApiResult<DangerRiskAreaResDto>.IsFail("GetProductionRiskEchart接口获取单位信息失败");
}
//生产风险识别
@ -115,7 +116,8 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
Uid = loginUsers.Data.Uid
}, HttpMethod.Post);
result.ProductionRiskStats = riskResult.Data.ProductionRiskStats;
if (riskResult.Code != "Error" || riskResult.Data != null)
result.Data.ProductionRiskStats = riskResult.Data.ProductionRiskStats;
//获取隐患信息
string[] dangerStatus = ["0", "1", "2",]; //0-待核查,1-待整改,2-待验收
@ -173,11 +175,74 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
dangerInfo.Status = "3"; //待排查
dangerInfoList.Add(dangerInfo);
result.DangerInfos = dangerInfoList;
result.Data.DangerInfos = dangerInfoList;
}
catch (Exception ex)
{
_logger.LogWarning(ex, "GetProductionRiskEchart接口出错");
return ApiResult<DangerRiskAreaResDto>.IsFail($"GetProductionRiskEchart接口出错{ex.Message}");
}
return result;
}
/// <summary>
/// 获取指定区域ID的隐患数据
/// </summary>
/// <param name="regionId">返回本区域隐患(不包含下属子区域隐患)</param>
/// <param name="pRegionId">返回本区域及下属子区域隐患</param>
/// <returns></returns>
public async Task<ApiResult<DangerInfoRootResDto>> GetDangerInfos(string? regionId, string? pRegionId)
{
ApiResult<DangerInfoRootResDto> result = new() { Code = 200, Msg = "接口调用成功", Data = new() };
try
{
//获取token
var token = await _tokenProviderService.GetTokenAsync(_configuration["ThirdParty:SzdunanCode"]!);
if (string.IsNullOrWhiteSpace(token))
{
_logger.LogWarning("GetDangerInfos接口获取token失败");
return ApiResult<DangerInfoRootResDto>.IsFail("GetDangerInfos接口获取token失败");
}
//获取用户配置
HttpClientResult<LoginUsersConfiguration> loginUsers = await _tokenProviderService.GetUserConfiguration(token);
if (loginUsers.Code == "Error")
{
_logger.LogWarning("GetDangerInfos接口获取用户配置失败");
return ApiResult<DangerInfoRootResDto>.IsFail("GetDangerInfos接口获取用户配置失败");
}
//获取单位信息
HttpClientResult<BranchResDto> branchs = await _tokenProviderService.GetBranchPermissions(token, loginUsers.Data.Uid);
if (branchs.Code == "Error")
{
_logger.LogWarning("GetDangerInfos接口获取单位信息失败");
return ApiResult<DangerInfoRootResDto>.IsFail("GetDangerInfos接口获取单位信息失败");
}
var query = new DangerInfoQueryDto { Ubpid = loginUsers.Data.Ubpid, Status = "0" };
if (pRegionId != null && pRegionId.Length > 0)
{
query.P_region_id = long.Parse(pRegionId);
}
if (regionId != null && regionId.Length > 0)
{
query.Region_id = long.Parse(regionId);
}
var jsonResult = await _tokenProviderService.SendJsonAsync<DangerInfoQueryDto>("https://zrh.szdunan.cn/v1/api/danger/ledger/dangerInfo/new", token, query, HttpMethod.Post);
var root = JsonSerializer.Deserialize<HttpClientResult<DangerInfoRootResDto>>(jsonResult);
if (root != null)
{
result.Data = root.Data;
}
}
catch (Exception ex)
{
_logger.LogWarning(ex, "GetDangerInfos接口出错");
return ApiResult<DangerInfoRootResDto>.IsFail($"GetDangerInfos接口出错{ex.Message}");
}
return result;
}
@ -187,9 +252,9 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
/// </summary>
/// <param name="floorId"></param>
/// <returns></returns>
public async Task<RootReqDto> GetRiskMapInfo(int floorId)
public async Task<ApiResult<RootReqDto>> GetRiskMapInfo(int floorId)
{
var result = new RootReqDto();
ApiResult<RootReqDto> result = new ApiResult<RootReqDto>() { Code = 200, Msg = "接口调用成功", Data = null };
try
{
@ -198,7 +263,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (string.IsNullOrWhiteSpace(token))
{
_logger.LogWarning("GetRiskMapInfo接口获取token失败");
return result;
return ApiResult<RootReqDto>.IsFail("GetRiskMapInfo接口获取token失败");
}
//获取用户配置
@ -206,24 +271,93 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (loginUsers.Code == "Error")
{
_logger.LogWarning("GetRiskMapInfo接口获取用户配置失败");
return result;
return ApiResult<RootReqDto>.IsFail("GetRiskMapInfo接口获取用户配置失败");
}
//生产风险识别
HttpClientResult<RootReqDto> riskResult = await _tokenProviderService
.SendAndParseAsync<RiskFourcoMapReqDto, HttpClientResult<RootReqDto>>(
"https://zrh.szdunan.cn/v1/api/riskFourcoloringMap/getRiskFourColoringMapInfo",
token, new RiskFourcoMapReqDto
{
Floor = floorId,
Ubpid = loginUsers.Data.Ubpid
}, HttpMethod.Post);
result = riskResult.Data;
HttpClientResult<object> riskResult = await _tokenProviderService
.SendAndParseAsync<RiskFourcoMapReqDto, HttpClientResult<object>>(
"https://zrh.szdunan.cn/v1/api/riskFourcoloringMap/getRiskFourColoringMapInfo",
token, new RiskFourcoMapReqDto
{
Floor = floorId,
Ubpid = loginUsers.Data.Ubpid
}, HttpMethod.Post);
if (riskResult != null && riskResult.Data != null && riskResult.Data.ToString()!.Length > 10)
{
RootReqDto httpClientResult = JsonSerializer.Deserialize<RootReqDto>(riskResult.Data.ToString()!)!;
if (httpClientResult != null)
{
result.Data = httpClientResult;
}
}
}
catch (Exception ex)
{
_logger.LogWarning(ex, $"GetRiskMapInfo接口出错");
return ApiResult<RootReqDto>.IsFail($"GetRiskMapInfo接口出错{ex.Message}");
}
return result;
}
/// <summary>
/// 获得危险作业(施工)数据
/// </summary>
/// <param name="dto"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public async Task<ApiResult<LedgerDto>> GetLedger(WorkTaskQueryParamsDto dto)
{
ApiResult<LedgerDto> result = new ApiResult<LedgerDto>() { Code = 200, Msg = "接口调用成功", Data = null };
try
{
//获取token
var token = await _tokenProviderService.GetTokenAsync(_configuration["ThirdParty:SzdunanCode"]!);
if (string.IsNullOrWhiteSpace(token))
{
_logger.LogWarning("GetProductionRiskEchart接口获取token失败");
return ApiResult<LedgerDto>.IsFail("GetProductionRiskEchart接口获取token失败");
}
//获取用户配置
HttpClientResult<LoginUsersConfiguration> loginUsers = await _tokenProviderService.GetUserConfiguration(token);
if (loginUsers.Code == "Error")
{
_logger.LogWarning("GetProductionRiskEchart接口获取用户配置失败");
return ApiResult<LedgerDto>.IsFail("GetProductionRiskEchart接口获取用户配置失败");
}
//获取单位信息
HttpClientResult<BranchResDto> branchs = await _tokenProviderService.GetBranchPermissions(token, loginUsers.Data.Uid);
if (branchs.Code == "Error")
{
_logger.LogWarning("GetProductionRiskEchart接口获取单位信息失败");
return ApiResult<LedgerDto>.IsFail("GetProductionRiskEchart接口获取单位信息失败");
}
dto.Ubpid = loginUsers.Data.Ubpid.ToString();
HttpClientResult<object> riskResult = await _tokenProviderService
.SendAndParseAsync<WorkTaskQueryParamsDto, HttpClientResult<object>>(
"https://zrh.szdunan.cn/v1/api/ticket/safe/ledger",
token, dto, HttpMethod.Post);
if (riskResult != null && riskResult.Data != null && riskResult.Data.ToString()!.Length > 10)
{
LedgerDto httpClientResult = JsonSerializer.Deserialize<LedgerDto>(riskResult.Data.ToString()!)!;
if (httpClientResult != null)
{
result.Data = httpClientResult;
}
}
}
catch (Exception ex)
{
_logger.LogWarning(ex, "GetRiskMapInfo接口出错");
return ApiResult<LedgerDto>.IsFail($"GetRiskMapInfo接口出错{ex.Message}");
}
return result;

@ -6,10 +6,6 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="PuCe\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="6.0.3" />
</ItemGroup>

Loading…
Cancel
Save