From 884144826f3014a375af4572480c20b6567823b3 Mon Sep 17 00:00:00 2001 From: LiuXin Date: Tue, 9 Sep 2025 09:55:44 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common.Shared.Application/Common.Shared.Application.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj index f84fd67..4ffb4a2 100644 --- a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj +++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj @@ -7,7 +7,7 @@ Common.Shared.Application - 2.1.0 + 2.2.0 zrh-lx zrh-lx 包含所有公共使用的 DTO、契约、接口模型等,供微服务之间共享使用 From 0a514c21e04f35dfeca438f49d77b7c210824bfc Mon Sep 17 00:00:00 2001 From: LiuXin Date: Wed, 10 Sep 2025 15:46:20 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common.Shared.Application.csproj | 2 +- .../SunPlaceBoardWorkOrderReqDto.cs | 69 +++++ .../ResponseDto/SunPalaceBoardResDto.cs | 198 +++++++++++- .../SunPlaceBoardWorkOrderResDto.cs | 290 ++++++++++++++++++ .../PuCe/SunPlaceBoardWorkOrderController.cs | 46 +++ .../SunPalaceBoardSafetyController.cs | 13 + .../ThirdPartyServices.API.csproj | 4 - .../ThirdPartyServices.API/appsettings.json | 2 +- .../RequestDto/ThirdPartyProviderQueryDto.cs | 4 + .../ResponseDto/ThirdPartyProviderResDto.cs | 66 ++++ .../PuCe/ISunPlaceBoardWorkOrderService.cs | 12 + .../PuCe/SunPlaceBoardWorkOrderService.cs | 109 +++++++ .../ISunPalaceBoardSafetyService.cs | 2 + .../SunPalaceBoardSafetyService.cs | 91 +++++- .../ThirdPartyServices.DomainService.csproj | 4 - 15 files changed, 889 insertions(+), 23 deletions(-) create mode 100644 WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs create mode 100644 WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPlaceBoardWorkOrderResDto.cs create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuCe/SunPlaceBoardWorkOrderController.cs create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/ISunPlaceBoardWorkOrderService.cs create mode 100644 WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj index 4ffb4a2..dfee2cc 100644 --- a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj +++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj @@ -7,7 +7,7 @@ Common.Shared.Application - 2.2.0 + 2.4.0 zrh-lx zrh-lx 包含所有公共使用的 DTO、契约、接口模型等,供微服务之间共享使用 diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs new file mode 100644 index 0000000..efabd52 --- /dev/null +++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs @@ -0,0 +1,69 @@ +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 +{ + /// + /// 工单查询参数实体类 + /// + public class WorkOrderParamsDto + { + /// + /// 页码 + /// + /// 1 + public int PageIndex { get; set; } = 1; + + /// + /// 每页大小 + /// + /// 20 + public int PageSize { get; set; } = 20; + + /// + /// 紧急程度 + /// + /// 5 + /// 5表示一般 + public int? BxGrade { get; set; } + + /// + /// 工单状态 + /// + public int? Status { get; set; } + + /// + /// 工单类别 + /// + /// 11 + /// 11表示总务-配电 + public int? BxCategoryCode { get; set; } + + /// + /// 派单方式 + /// + /// 3 + /// 3表示班组派单 + public int? DeviceType { get; set; } + + /// + /// 工单id + /// + /// 5 + public int? OrderId { get; set; } + + /// + /// 报警设备编号 + /// + public string? DeviceCode { get; set; } + + /// + /// 报修科室 + /// + public string? BxDeptCode { get; set; } + } +} \ No newline at end of file diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPalaceBoardResDto.cs b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPalaceBoardResDto.cs index 7aca665..e156c57 100644 --- a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPalaceBoardResDto.cs +++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPalaceBoardResDto.cs @@ -423,7 +423,8 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto /// 色块名称坐标位置 /// [JsonPropertyName("textPoint")] - public List TextPoint { get; set; } // 有时是数字,有时是字符串 + [JsonConverter(typeof(FlexiblePointConverter))] + public PointDto TextPoint { get; set; } /// /// 色块图像各顶点经纬度 @@ -484,6 +485,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 { /// @@ -574,6 +581,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 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 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>> { public override List> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) @@ -635,7 +811,25 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto public override void Write(Utf8JsonWriter writer, List> value, JsonSerializerOptions options) => JsonSerializer.Serialize(writer, value, options); + } + + public sealed class FlexiblePointConverter : JsonConverter + { + public override PointDto Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var doc = JsonDocument.ParseValue(ref reader); + var root = doc.RootElement; + + if (root.ValueKind == JsonValueKind.Object) + return new PointDto { X = root.GetProperty("x").GetDouble(), Y = root.GetProperty("y").GetDouble() }; + + if (root.ValueKind == JsonValueKind.Array && root.GetArrayLength() >= 2) + return new PointDto { X = root[0].GetDouble(), Y = root[1].GetDouble() }; + + return default; + } - #endregion 太阳宫看板-隐患数据 + public override void Write(Utf8JsonWriter writer, PointDto value, JsonSerializerOptions options) + => writer.WriteStartObject(); // 如需写回再实现 } } \ No newline at end of file diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPlaceBoardWorkOrderResDto.cs b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPlaceBoardWorkOrderResDto.cs new file mode 100644 index 0000000..1ab3ff2 --- /dev/null +++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPlaceBoardWorkOrderResDto.cs @@ -0,0 +1,290 @@ +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.ResponseDto +{ + /// + /// 工单信息实体类 + /// + public class WorkOrderInfoDto + { + /// + /// 工单id + /// + /// 29 + [JsonPropertyName("orderId")] + public int? OrderId { get; set; } + + /// + /// 工单编码 + /// + /// "GJ3559496" + [JsonPropertyName("orderCode")] + public string? OrderCode { get; set; } + + /// + /// 工单创建时间 + /// + [JsonPropertyName("createTime")] + public string? CreateTime { get; set; } + + /// + /// 报修人 + /// + /// "牙科门诊" + [JsonPropertyName("bxUserName")] + public string? BxUserName { get; set; } + + /// + /// 报修人电话 + /// + /// "18871153411" + [JsonPropertyName("bxUserPhone")] + public string? BxUserPhone { get; set; } + + /// + /// 来电号码 + /// + /// "18871153411" + [JsonPropertyName("bxCallPhone")] + public string? BxCallPhone { get; set; } + + /// + /// 报修时间 + /// + /// "2024-01-04 13:08:58" + [JsonPropertyName("bxTime")] + public string? BxTime { get; set; } + + /// + /// 报修区域 + /// + /// 608 + [JsonPropertyName("bxDeptCode")] + public int? BxDeptCode { get; set; } + + /// + /// 报修区域名称 + /// + /// "门诊楼" + [JsonPropertyName("bxDeptName")] + public string? BxDeptName { get; set; } + + /// + /// 详细位置 + /// + /// "门诊2楼202室" + [JsonPropertyName("bxAddress")] + public string? BxAddress { get; set; } + + /// + /// 工单类别 + /// + /// "11" + [JsonPropertyName("bxCategoryCode")] + public string? BxCategoryCode { get; set; } + + /// + /// 报修紧急程度 + /// + /// "1" + [JsonPropertyName("bxGrade")] + public string? BxGrade { get; set; } + + /// + /// 派单方式 + /// + /// "3" + [JsonPropertyName("deviceType")] + public string? DeviceType { get; set; } + + /// + /// 报修内容 + /// + /// "门把手坏了" + [JsonPropertyName("bxContent")] + public string? BxContent { get; set; } + + /// + /// 报修视频 + /// + /// null + [JsonPropertyName("bxMp4")] + public string? BxMp4 { get; set; } + + /// + /// 工单状态 + /// + /// "11" + [JsonPropertyName("status")] + public string? Status { get; set; } + + /// + /// 工单处理内容 + /// + /// "维修完成" + [JsonPropertyName("handleContent")] + public string? HandleContent { get; set; } + + /// + /// 工单处理图片 + /// + /// "http://4tjerijg.png" + [JsonPropertyName("handleImg")] + public string? HandleImg { get; set; } + + /// + /// 工单处理时间 + /// + /// "2024-01-04 15:24:20" + [JsonPropertyName("handleTime")] + public string? HandleTime { get; set; } + + /// + /// 派单时间 + /// + /// null + [JsonPropertyName("deviceTime")] + public string? DeviceTime { get; set; } + + /// + /// 接单时间 + /// + /// null + [JsonPropertyName("acceptTime")] + public string? AcceptTime { get; set; } + + /// + /// 接单班组 + /// + /// 6 + [JsonPropertyName("acceptGroupCode")] + public int? AcceptGroupCode { get; set; } + + /// + /// 接单班组名称 + /// + /// "门诊已处理" + [JsonPropertyName("acceptGroupName")] + public string? AcceptGroupName { get; set; } + + /// + /// 接单人 + /// + /// 125 + [JsonPropertyName("acceptUserCode")] + public long? AcceptUserCode { get; set; } + + /// + /// 接单人姓名 + /// + [JsonPropertyName("acceptUserName")] + public string? AcceptUserName { get; set; } + + /// + /// 评价时间 + /// + /// "2024-01-04 13:15:50" + [JsonPropertyName("assessTime")] + public string? AssessTime { get; set; } + + /// + /// 效率评分 + /// + /// null + [JsonPropertyName("assessScoreXl")] + public int? AssessScoreXl { get; set; } + + /// + /// 服务评分 + /// + /// 2 + [JsonPropertyName("assessScoreFw")] + public int? AssessScoreFw { get; set; } + + /// + /// 质量评分 + /// + /// null + [JsonPropertyName("assessScoreZl")] + public int? AssessScoreZl { get; set; } + + /// + /// 评价内容 + /// + /// "维修优秀" + [JsonPropertyName("assessContent")] + public string? AssessContent { get; set; } + + /// + /// 备注 + /// + /// "测试报修" + [JsonPropertyName("remark")] + public string? Remark { get; set; } + } + + /// + /// 工单时间轴实体类 + /// + public class WorkOrderTimelineDto + { + /// + /// 工单id + /// + [JsonPropertyName("orderId")] + public long? OrderId { get; set; } + + /// + /// 时间轴id + /// + [JsonPropertyName("timelineId")] + public long? TimelineId { get; set; } + + /// + /// 节点类型 + /// + [JsonPropertyName("nodeType")] + public string? NodeType { get; set; } + + /// + /// 节点描述 + /// + [JsonPropertyName("nodeDesc")] + public string? NodeDesc { get; set; } + + /// + /// 处理图片路径 + /// + [JsonPropertyName("nodeImg")] + public string? NodeImg { get; set; } + + /// + /// 处理视频路径 + /// + [JsonPropertyName("nodeMp4")] + public string? NodeMp4 { get; set; } + + /// + /// 工单状态 + /// + [JsonPropertyName("status")] + public string? Status { get; set; } + + /// + /// 创建人 + /// + [JsonPropertyName("createBy")] + public long? CreateBy { get; set; } + + /// + /// 创建时间 + /// + [JsonPropertyName("createTime")] + public DateTime? CreateTime { get; set; } + } +} \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuCe/SunPlaceBoardWorkOrderController.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuCe/SunPlaceBoardWorkOrderController.cs new file mode 100644 index 0000000..318f932 --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuCe/SunPlaceBoardWorkOrderController.cs @@ -0,0 +1,46 @@ +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 +{ + /// + /// 智慧建筑太阳宫看板-工单模块-普策公司接口 + /// + [Route("api/[controller]/[action]")] + [ApiController] + public class SunPlaceBoardWorkOrderController : ControllerBase + { + private readonly ILogger _logger; + private readonly ISunPlaceBoardWorkOrderService _workOrderService; + + public SunPlaceBoardWorkOrderController(ILogger logger, ISunPlaceBoardWorkOrderService workOrderService) + { + _logger = logger; + _workOrderService = workOrderService; + } + + /// + /// 工单列表查询接口 + /// + /// + /// + [HttpPost("orderList")] + public async Task> GetRepairOrderList(WorkOrderParamsDto dto) + { + return await _workOrderService.GetRepairOrderList(dto); + } + + /// + /// 工单时间轴 + /// + /// + /// + [HttpGet("orderline")] + public async Task> GetTimelineListByOrderId(string orderId) + { + return await _workOrderService.GetTimelineListByOrderId(orderId); + } + } +} \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs index d499ef8..a4b0fb2 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs @@ -1,4 +1,5 @@ using Common.Shared.Application.SafetyFirePro.ResponseDto; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Text.Json; using ThirdPartyServices.DomainService.ShenZhouShengAn; @@ -32,6 +33,18 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn return await _secSituationService.GetProductionRiskEchart(); } + /// + /// 获取指定区域ID的隐患数据 + /// + /// 返回本区域隐患(不包含下属子区域隐患) + /// 返回本区域及下属子区域隐患 + /// + [HttpGet("new/dangerInfo")] + public async Task GetDangerInfoEchart(string? regionId, string? pRegionId) + { + return await _secSituationService.GetDangerInfos(regionId, pRegionId); + } + /// ///获得四色图图层列表 /// diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.csproj b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.csproj index 7ad1732..73e36ab 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.csproj +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/ThirdPartyServices.API.csproj @@ -7,10 +7,6 @@ True - - - - diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/appsettings.json b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/appsettings.json index d8ef202..b9f2e36 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/appsettings.json +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/appsettings.json @@ -5,7 +5,7 @@ "Microsoft.AspNetCore": "Warning" } }, - //太阳宫大屏的第三方配置 + ///太阳宫大屏的第三方配置 "ThirdParty": { "AssetWeb": { "ServiceUrl": "http://123.56.129.171:8280/services/AssetWeb.asmx", diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/RequestDto/ThirdPartyProviderQueryDto.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/RequestDto/ThirdPartyProviderQueryDto.cs index f3db3ef..58c6182 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/RequestDto/ThirdPartyProviderQueryDto.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/RequestDto/ThirdPartyProviderQueryDto.cs @@ -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; } } /// diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/ResponseDto/ThirdPartyProviderResDto.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/ResponseDto/ThirdPartyProviderResDto.cs index 0a1da98..006897e 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/ResponseDto/ThirdPartyProviderResDto.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/ResponseDto/ThirdPartyProviderResDto.cs @@ -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 : JsonConverter> + { + public override HttpClientResult Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + { + throw new JsonException(); + } + + var result = new HttpClientResult(); + 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(ref reader, options); + break; + + default: + // 忽略未知属性 + reader.Skip(); + break; + } + } + } + + throw new JsonException("Unexpected end of JSON."); + } + + public override void Write(Utf8JsonWriter writer, HttpClientResult 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(); + } + } } \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/ISunPlaceBoardWorkOrderService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/ISunPlaceBoardWorkOrderService.cs new file mode 100644 index 0000000..2f72783 --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/ISunPlaceBoardWorkOrderService.cs @@ -0,0 +1,12 @@ +using Common.Shared.Application.SafetyFirePro.RequestDto; +using Common.Shared.Application.SafetyFirePro.ResponseDto; + +namespace ThirdPartyServices.DomainService.PuCe +{ + public interface ISunPlaceBoardWorkOrderService + { + Task> GetRepairOrderList(WorkOrderParamsDto dto); + + Task> GetTimelineListByOrderId(string orderId); + } +} \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs new file mode 100644 index 0000000..6f398f8 --- /dev/null +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs @@ -0,0 +1,109 @@ +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 _logger; + + public SunPlaceBoardWorkOrderService(ILogger logger) + { + _logger = logger; + } + + /// + /// 开发测试的时候,忽略证书 + /// + private static readonly HttpClient _http = new HttpClient(new HttpClientHandler + { + ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator + }); + + /// + /// 工单列表查询接口 + /// + /// + /// + /// + public async Task> GetRepairOrderList(WorkOrderParamsDto dto) + { + List result = new(); + + 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}"); + } + + var httppReult = JsonSerializer.Deserialize>>(body); + if (httppReult != null && httppReult.Code == "200") + { + result = httppReult.Data; + } + else + { + _logger.LogWarning($"工单列表查询接口请求失败,{body}"); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "工单列表查询接口请求失败"); + } + return result; + } + + /// + /// 工单时间轴 + /// + /// + /// + public async Task> GetTimelineListByOrderId(string orderId) + { + List result = new(); + + 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}"); + } + + var httppReult = JsonSerializer.Deserialize>>(body); + if (httppReult != null && httppReult.Code == "200") + { + result = httppReult.Data; + } + else + { + _logger.LogWarning($"工单时间轴接口请求失败,{body}"); + } + } + catch (Exception ex) + { + _logger.LogError(ex, "工单时间轴接口请求失败"); + } + return result; + } + } +} \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs index aec2996..442190c 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs @@ -25,6 +25,8 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn /// Task GetRiskMapInfo(int floorId); + Task GetDangerInfos(string? regionId, string? pRegionId); + //Task> GetUnAlarmInfoList(AlarmEventEchartQueryDto dto); } } \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs index 8222437..7578a01 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs @@ -182,6 +182,68 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn return result; } + /// + /// 获取指定区域ID的隐患数据 + /// + /// 返回本区域隐患(不包含下属子区域隐患) + /// 返回本区域及下属子区域隐患 + /// + public async Task GetDangerInfos(string? regionId, string? pRegionId) + { + DangerInfoRootResDto result = new(); + try + { + //获取token + var token = await _tokenProviderService.GetTokenAsync(_configuration["ThirdParty:SzdunanCode"]!); + if (string.IsNullOrWhiteSpace(token)) + { + _logger.LogWarning("GetDangerInfos接口获取token失败"); + return result; + } + + //获取用户配置 + HttpClientResult loginUsers = await _tokenProviderService.GetUserConfiguration(token); + if (loginUsers.Code == "Error") + { + _logger.LogWarning("GetDangerInfos接口获取用户配置失败"); + return result; + } + + //获取单位信息 + HttpClientResult branchs = await _tokenProviderService.GetBranchPermissions(token, loginUsers.Data.Uid); + if (branchs.Code == "Error") + { + _logger.LogWarning("GetDangerInfos接口获取单位信息失败"); + + return result; + } + 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("https://zrh.szdunan.cn/v1/api/danger/ledger/dangerInfo/new", token, query, HttpMethod.Post); + + var root = JsonSerializer.Deserialize>(jsonResult); + if (root != null) + { + result = root.Data; + } + } + catch (Exception ex) + { + _logger.LogWarning(ex, "GetDangerInfos接口出错"); + } + return result; + } + /// /// 获得四色图区域列表 /// @@ -210,20 +272,27 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn } //生产风险识别 - HttpClientResult riskResult = await _tokenProviderService - .SendAndParseAsync>( - "https://zrh.szdunan.cn/v1/api/riskFourcoloringMap/getRiskFourColoringMapInfo", - token, new RiskFourcoMapReqDto - { - Floor = floorId, - Ubpid = loginUsers.Data.Ubpid - }, HttpMethod.Post); - - result = riskResult.Data; + HttpClientResult riskResult = await _tokenProviderService + .SendAndParseAsync>( + "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(riskResult.Data.ToString()!)!; + if (httpClientResult != null) + { + result = httpClientResult; + } + } } catch (Exception ex) { - _logger.LogWarning(ex, "GetRiskMapInfo接口出错"); + _logger.LogWarning(ex, $"GetRiskMapInfo接口出错"); } return result; diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ThirdPartyServices.DomainService.csproj b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ThirdPartyServices.DomainService.csproj index b28cd62..6f65087 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ThirdPartyServices.DomainService.csproj +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ThirdPartyServices.DomainService.csproj @@ -6,10 +6,6 @@ enable - - - - From 3fde17e668faffa770263bd2be24afb1f37a69d1 Mon Sep 17 00:00:00 2001 From: LiuXin Date: Wed, 10 Sep 2025 17:20:36 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SunPlaceBoardWorkOrderReqDto.cs | 52 +++++++++++++ .../ResponseDto/SunPalaceBoardResDto.cs | 76 ++++++++++++++++--- .../SunPalaceBoardSafetyController.cs | 14 +++- .../ISunPalaceBoardSafetyService.cs | 9 +-- .../SunPalaceBoardSafetyService.cs | 65 +++++++++++++++- 5 files changed, 199 insertions(+), 17 deletions(-) diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs index efabd52..53a2a0c 100644 --- a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs +++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs @@ -66,4 +66,56 @@ namespace Common.Shared.Application.SafetyFirePro.RequestDto /// public string? BxDeptCode { get; set; } } + + /// + /// 作业任务查询参数实体类 + /// + public class WorkTaskQueryParamsDto + { + /// + /// 页数 + /// + /// 1 + /// 必填项 + [JsonPropertyName("page")] + public int? Page { get; set; } + + /// + /// 每页数据数量 + /// + /// 10 + /// 不传则默认为10 + [JsonPropertyName("page_size")] + public int? PageSize { get; set; } + + /// + /// 作业状态 + /// + /// 3 + /// 1:待审批, 2:待作业前检查, 3:作业中, 4:抽作业前检查, 6:作业结束, 7:延期结束, 8:超时结束, 11:审批不通过, 12:作业中止, 13:强行结束 + [JsonPropertyName("status")] + public string? Status { get; set; } + + /// + /// 作业单位部门id + /// + /// 8888 + [JsonPropertyName("branch_id")] + public int? BranchId { get; set; } + + /// + /// 作业活动所在区域id + /// + /// 8888 + [JsonPropertyName("region_id")] + public int? RegionId { get; set; } + + /// + /// ubpid参数 + /// + /// "ubpid" + /// 必填项 + [JsonPropertyName("ubpid")] + public string Ubpid { get; set; } + } } \ No newline at end of file diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPalaceBoardResDto.cs b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPalaceBoardResDto.cs index e156c57..7b2dba2 100644 --- a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPalaceBoardResDto.cs +++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPalaceBoardResDto.cs @@ -433,11 +433,14 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto [JsonConverter(typeof(FlexibleCenterConverter))] public List> 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; } /// /// 色块id @@ -815,21 +818,76 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto public sealed class FlexiblePointConverter : JsonConverter { - public override PointDto Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + 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) - return new PointDto { X = root.GetProperty("x").GetDouble(), Y = root.GetProperty("y").GetDouble() }; + { + // 兼容属性缺失的异常场景(避免崩溃,返回默认值) + 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) - return new PointDto { X = root[0].GetDouble(), Y = root[1].GetDouble() }; + { + 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(); // 如需写回再实现 + 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 + /// + /// 兼容「数字类型」和「字符串类型」的JsonElement,解析为double + /// 例:116.079126 → 116.079126;"116.079126" → 116.079126 + /// + 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 } } \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs index a4b0fb2..cf266cd 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs @@ -1,4 +1,5 @@ -using Common.Shared.Application.SafetyFirePro.ResponseDto; +using Common.Shared.Application.SafetyFirePro.RequestDto; +using Common.Shared.Application.SafetyFirePro.ResponseDto; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Text.Json; @@ -65,5 +66,16 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn { return await _secSituationService.GetRiskMapInfo(floorId); } + + /// + /// 获得危险作业(施工)数据 + /// + /// + /// + [HttpPost("ledger")] + public async Task GetLedger(WorkTaskQueryParamsDto dto) + { + return await _secSituationService.GetLedger(dto); + } } } \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs index 442190c..c352527 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs @@ -1,14 +1,11 @@ -using Common.Shared.Application.SafetyFirePro.ResponseDto; +using Common.Shared.Application.SafetyFirePro.RequestDto; +using Common.Shared.Application.SafetyFirePro.ResponseDto; using System.Text.Json; namespace ThirdPartyServices.DomainService.ShenZhouShengAn { public interface ISunPalaceBoardSafetyService { - //Task>> GetHiddenDangerTrend(SecSituationQueryDto dto); - - //Task>> GetIdCardAlarmEchart(); - Task GetProductionRiskEchart(); /// @@ -27,6 +24,6 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn Task GetDangerInfos(string? regionId, string? pRegionId); - //Task> GetUnAlarmInfoList(AlarmEventEchartQueryDto dto); + Task GetLedger(WorkTaskQueryParamsDto dto); } } \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs index 7578a01..bb95aa4 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs @@ -1,4 +1,5 @@ -using Common.Shared.Application.SafetyFirePro.ResponseDto; +using Common.Shared.Application.SafetyFirePro.RequestDto; +using Common.Shared.Application.SafetyFirePro.ResponseDto; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using MongoDB.Bson.IO; @@ -297,5 +298,67 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn return result; } + + /// + /// 获得危险作业(施工)数据 + /// + /// + /// + /// + public async Task GetLedger(WorkTaskQueryParamsDto dto) + { + var result = new RootReqDto(); + + try + { + //获取token + var token = await _tokenProviderService.GetTokenAsync(_configuration["ThirdParty:SzdunanCode"]!); + if (string.IsNullOrWhiteSpace(token)) + { + _logger.LogWarning("GetProductionRiskEchart接口获取token失败"); + return result; + } + + //获取用户配置 + HttpClientResult loginUsers = await _tokenProviderService.GetUserConfiguration(token); + if (loginUsers.Code == "Error") + { + _logger.LogWarning("GetProductionRiskEchart接口获取用户配置失败"); + return result; + } + + //获取单位信息 + HttpClientResult branchs = await _tokenProviderService.GetBranchPermissions(token, loginUsers.Data.Uid); + if (branchs.Code == "Error") + { + _logger.LogWarning("GetProductionRiskEchart接口获取单位信息失败"); + + return result; + } + + dto.Ubpid = loginUsers.Data.Ubpid.ToString(); + dto.BranchId = branchs.Data.BranchPermissionIds[0]; + + HttpClientResult riskResult = await _tokenProviderService + .SendAndParseAsync>( + "https://zrh.szdunan.cn/v1/api/ticket/safe/ledger", + token, dto, HttpMethod.Post); + + if (riskResult != null && riskResult.Data != null && riskResult.Data.ToString()!.Length > 10) + { + RootReqDto httpClientResult = JsonSerializer.Deserialize(riskResult.Data.ToString()!)!; + if (httpClientResult != null) + { + result = httpClientResult; + } + } + } + catch (Exception ex) + { + _logger.LogWarning(ex, $"GetRiskMapInfo接口出错"); + } + + return result; + } } } \ No newline at end of file From 7575ab17b75258507585243a0bcf74eee969f960 Mon Sep 17 00:00:00 2001 From: LiuXin Date: Thu, 11 Sep 2025 11:31:37 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common.Shared.Application.csproj | 2 +- .../SunPlaceBoardWorkOrderReqDto.cs | 7 - .../SunPlaceBoardWorkOrderResDto.cs | 478 +++++++++++++++++- .../PuCe/SunPlaceBoardWorkOrderController.cs | 7 +- .../SunPalaceBoardFacilityController.cs | 7 +- .../SunPalaceBoardSafetyController.cs | 13 +- .../PuCe/ISunPlaceBoardWorkOrderService.cs | 7 +- .../PuCe/SunPlaceBoardWorkOrderService.cs | 22 +- .../ISunPalaceBoardFacilityService.cs | 7 +- .../SunPalaceBoardFacilityService.cs | 15 +- .../ISunPalaceBoardSafetyService.cs | 13 +- .../SunPalaceBoardSafetyService.cs | 82 +-- 12 files changed, 557 insertions(+), 103 deletions(-) diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj index dfee2cc..98fd64e 100644 --- a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj +++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/Common.Shared.Application.csproj @@ -7,7 +7,7 @@ Common.Shared.Application - 2.4.0 + 2.5.0 zrh-lx zrh-lx 包含所有公共使用的 DTO、契约、接口模型等,供微服务之间共享使用 diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs index 53a2a0c..44f7432 100644 --- a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs +++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs @@ -96,13 +96,6 @@ namespace Common.Shared.Application.SafetyFirePro.RequestDto [JsonPropertyName("status")] public string? Status { get; set; } - /// - /// 作业单位部门id - /// - /// 8888 - [JsonPropertyName("branch_id")] - public int? BranchId { get; set; } - /// /// 作业活动所在区域id /// diff --git a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPlaceBoardWorkOrderResDto.cs b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPlaceBoardWorkOrderResDto.cs index 1ab3ff2..319f0a1 100644 --- a/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPlaceBoardWorkOrderResDto.cs +++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/ResponseDto/SunPlaceBoardWorkOrderResDto.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.Json; using System.Text.Json.Serialization; using System.Threading.Tasks; @@ -231,14 +232,11 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto /// /// 工单时间轴实体类 /// + /// + /// 工单时间轴节点实体(data数组元素) + /// public class WorkOrderTimelineDto { - /// - /// 工单id - /// - [JsonPropertyName("orderId")] - public long? OrderId { get; set; } - /// /// 时间轴id /// @@ -246,45 +244,491 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto public long? TimelineId { get; set; } /// - /// 节点类型 + /// 节点类型(示例:"办结工单"、"登记派发工单") /// [JsonPropertyName("nodeType")] public string? NodeType { get; set; } /// - /// 节点描述 + /// 节点描述(示例:"办结工单,单号:2350"、"保洁") /// [JsonPropertyName("nodeDesc")] public string? NodeDesc { get; set; } /// - /// 处理图片路径 + /// 节点详情(示例:"【管理员】办结工单,单号:2350") + /// + [JsonPropertyName("nodeDetail")] + public string? NodeDetail { get; set; } + + /// + /// 处理图片路径(可为null,无图片时返回null) /// [JsonPropertyName("nodeImg")] public string? NodeImg { get; set; } /// - /// 处理视频路径 + /// 处理视频路径(可为null,无视频时返回null) /// [JsonPropertyName("nodeMp4")] public string? NodeMp4 { get; set; } /// - /// 工单状态 + /// 创建人ID + /// + [JsonPropertyName("createBy")] + public long? CreateBy { get; set; } + + /// + /// 创建时间(JSON格式:"yyyy-MM-dd HH:mm:ss") + /// + [JsonPropertyName("createTime")] + [JsonConverter(typeof(FixedPatternDateTimeConverter))] + public DateTime? CreateTime { get; set; } + + /// + /// 工单状态(示例:"11"表示办结,"1"表示已派发) /// [JsonPropertyName("status")] public string? Status { get; set; } /// - /// 创建人 + /// 工单id /// - [JsonPropertyName("createBy")] - public long? CreateBy { get; set; } + [JsonPropertyName("orderId")] + public long? OrderId { get; set; } /// - /// 创建时间 + /// 操作人员姓名(示例:"管理员") /// - [JsonPropertyName("createTime")] - public DateTime? CreateTime { get; set; } + [JsonPropertyName("operaterName")] + public string? OperaterName { get; set; } + + /// + /// 节点颜色(示例:"#909399"、"#E6A23C",用于前端显示) + /// + [JsonPropertyName("nodeColor")] + public string? NodeColor { get; set; } + + /// + /// 效率评分(可为null,无评分时返回null) + /// + [JsonPropertyName("assessScoreXl")] + public decimal? AssessScoreXl { get; set; } + + /// + /// 服务评分(可为null,无评分时返回null) + /// + [JsonPropertyName("assessScoreFw")] + public decimal? AssessScoreFw { get; set; } + + /// + /// 质量评分(可为null,无评分时返回null) + /// + [JsonPropertyName("assessScoreZl")] + public decimal? AssessScoreZl { get; set; } + + /// + /// 评价内容(可为null,无评价时返回null) + /// + [JsonPropertyName("assessContent")] + public string? AssessContent { get; set; } + } + + #region 危险施工作业响应体 + + public class LedgerDto + { + /// + /// 当前页码 + /// + [JsonPropertyName("current_page")] + public int CurrentPage { get; set; } + + /// + /// 符合查询条件的数据总数 + /// + [JsonPropertyName("total")] + public int Total { get; set; } + + /// + /// 作业票列表 + /// + [JsonPropertyName("data")] + public List Data { get; set; } + } + + public class WorkTicket + { + /// + /// 作业详细地点 + /// + [JsonPropertyName("address")] + public string Address { get; set; } + + /// + /// 作业票申请信息 + /// + [JsonPropertyName("applicant_info")] + public ApplicantInfo ApplicantInfo { get; set; } + + /// + /// 作业票审批过程信息 + /// + [JsonPropertyName("approval_tasks")] + public List ApprovalTasks { get; set; } + + /// + /// 作业活动部门信息 + /// + [JsonPropertyName("branch")] + public Branch Branch { get; set; } + + /// + /// 作业活动内容 + /// + [JsonPropertyName("content")] + public string Content { get; set; } + + /// + /// 作业教育人信息 + /// + [JsonPropertyName("education_info")] + public EducationInfo EducationInfo { get; set; } + + /// + /// 计划结束时间 + /// + [JsonPropertyName("end_at")] + public string EndAt { get; set; } + + /// + /// 实际结束时间 + /// + [JsonPropertyName("finish_time")] + public string FinishTime { get; set; } + + /// + /// 作业ID + /// + [JsonPropertyName("id")] + public int Id { get; set; } + + /// + /// 作业名称 + /// + [JsonPropertyName("name")] + public string Name { get; set; } + + /// + /// 作业编号 + /// + [JsonPropertyName("number")] + public string Number { get; set; } + + /// + /// 作业人员信息 + /// + [JsonPropertyName("operators")] + public List Operators { get; set; } + + /// + /// 作业负责人信息 + /// + [JsonPropertyName("principal_info")] + public PrincipalInfo PrincipalInfo { get; set; } + + /// + /// 实际开始作业时间 + /// + [JsonPropertyName("real_start_at")] + public string RealStartAt { get; set; } + + /// + /// 作业地点id + /// + [JsonPropertyName("region_id")] + public int RegionId { get; set; } + + /// + /// 作业地点信息 + /// + [JsonPropertyName("region")] + public Region Region { get; set; } + + /// + /// 作业检查信息 + /// + [JsonPropertyName("Supervises")] + public List Supervises { get; set; } + + /// + /// 作业计划开始时间 + /// + [JsonPropertyName("start_at")] + public string StartAt { get; set; } + + /// + /// 作业状态 + /// 1待审批,2待作业前检查,3作业中,4抽作业前检查,6作业结束, + /// 7延期结束,8超时结束,11审批不通过,12作业中止,13强行结束 + /// + [JsonPropertyName("status")] + public int Status { get; set; } + + /// + /// 作业类型 + /// 1动火,2高处,3受限空间,4临时用电,5盲板抽堵, + /// 6断路,7动土吊装,8吊装,9爆破 + /// + [JsonPropertyName("type")] + public int Type { get; set; } + } + + public class ApplicantInfo + { + /// + /// 申请ID + /// + [JsonPropertyName("id")] + public int Id { get; set; } + + /// + /// 申请人id + /// + [JsonPropertyName("uid")] + public int Uid { get; set; } + + /// + /// 申请人姓名 + /// + [JsonPropertyName("name")] + public string Name { get; set; } + } + + public class ApprovalTask + { + /// + /// 审批ID + /// + [JsonPropertyName("id")] + public int Id { get; set; } + + /// + /// 审批意见 + /// + [JsonPropertyName("infos")] + public string Infos { get; set; } + + /// + /// 审批状态 0待审批,1同意,2不同意 + /// + [JsonPropertyName("status")] + public int Status { get; set; } + + /// + /// 审批人信息 + /// + [JsonPropertyName("user")] + public ApprovalUser User { get; set; } + } + + public class ApprovalUser + { + /// + /// 审批人附加信息 + /// + [JsonPropertyName("extras")] + public Extras Extras { get; set; } + + /// + /// 审批人所在部门 + /// + [JsonPropertyName("branch")] + public List Branch { get; set; } + } + + public class Extras + { + /// + /// 审批人姓名 + /// + [JsonPropertyName("name")] + public string Name { get; set; } + } + + public class UserBranchWrapper + { + [JsonPropertyName("Branch")] + public Branch Branch { get; set; } + } + + public class Branch + { + /// + /// 部门ID + /// + [JsonPropertyName("id")] + public int Id { get; set; } + + /// + /// 部门名称 + /// + [JsonPropertyName("name")] + public string Name { get; set; } + } + + public class EducationInfo + { + /// + /// 作业教育人姓名 + /// + [JsonPropertyName("name")] + public string Name { get; set; } + } + + public class Operator + { + /// + /// 作业人信息 + /// + [JsonPropertyName("user_info")] + public UserInfo UserInfo { get; set; } + } + + public class PrincipalInfo + { + /// + /// 作业负责人姓名 + /// + [JsonPropertyName("name")] + public string Name { get; set; } + } + + public class Region + { + /// + /// 作业地点名称 + /// + [JsonPropertyName("name")] + public string Name { get; set; } + } + + public class Supervise + { + /// + /// 作业检查时间 + /// + [JsonPropertyName("check_at")] + public string CheckAt { get; set; } + + /// + /// 检查情况说明 + /// + [JsonPropertyName("infos")] + public string Infos { get; set; } + + /// + /// 安全措施及检查情况 + /// + [JsonPropertyName("measure_check_content")] + public List MeasureCheckContent { get; set; } + + /// + /// 气温 + /// + [JsonPropertyName("temperature")] + public string Temperature { get; set; } + + /// + /// 检查人信息 + /// + [JsonPropertyName("user_info")] + public UserInfo UserInfo { get; set; } + + /// + /// 天气情况 + /// + [JsonPropertyName("weather")] + public string Weather { get; set; } + + /// + /// 风力等级 + /// + [JsonPropertyName("wind")] + public string Wind { get; set; } + } + + public class MeasureCheckContent + { + /// + /// 安全措施内容 + /// + [JsonPropertyName("infos")] + public string Infos { get; set; } + + /// + /// 检查结果,1符合,0不符合 + /// + [JsonPropertyName("radio")] + public int Radio { get; set; } + } + + public class UserInfo + { + /// + /// 姓名 + /// + [JsonPropertyName("name")] + public string Name { get; set; } + } + + #endregion 危险施工作业响应体 + + public sealed class FixedPatternDateTimeConverter : JsonConverter + { + 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(); + } } } \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuCe/SunPlaceBoardWorkOrderController.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuCe/SunPlaceBoardWorkOrderController.cs index 318f932..9f3e7ea 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuCe/SunPlaceBoardWorkOrderController.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuCe/SunPlaceBoardWorkOrderController.cs @@ -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.PuCe; @@ -27,7 +28,7 @@ namespace ThirdPartyServices.API.Controllers.PuCe /// /// [HttpPost("orderList")] - public async Task> GetRepairOrderList(WorkOrderParamsDto dto) + public async Task>> GetRepairOrderList(WorkOrderParamsDto dto) { return await _workOrderService.GetRepairOrderList(dto); } @@ -38,7 +39,7 @@ namespace ThirdPartyServices.API.Controllers.PuCe /// /// [HttpGet("orderline")] - public async Task> GetTimelineListByOrderId(string orderId) + public async Task>> GetTimelineListByOrderId(string orderId) { return await _workOrderService.GetTimelineListByOrderId(orderId); } diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuTianSuYuan/SunPalaceBoardFacilityController.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuTianSuYuan/SunPalaceBoardFacilityController.cs index cdede40..3eec545 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuTianSuYuan/SunPalaceBoardFacilityController.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/PuTianSuYuan/SunPalaceBoardFacilityController.cs @@ -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 /// /// [HttpPost("assetList")] - public async Task> GetAssetDashboardEchart(SecSituationQueryDto dto) + public async Task>> GetAssetDashboardEchart(SecSituationQueryDto dto) { return await _sunPalaceBoardFacilityService.GetAssetDashboardEchart(dto); } @@ -38,7 +39,7 @@ namespace ThirdPartyServices.API.Controllers.PuTianSuYuan /// /// [HttpPost("assetType")] - public async Task> GetAssetTypeEchart(SecSituationQueryDto dto) + public async Task>> GetAssetTypeEchart(SecSituationQueryDto dto) { return await _sunPalaceBoardFacilityService.GetAssetTypeEchart(dto); } diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs index cf266cd..ac9f84e 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs @@ -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.Authorization; using Microsoft.AspNetCore.Mvc; @@ -29,7 +30,7 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn /// /// [HttpGet("productionRisk")] - public async Task GetProductionRiskEchart() + public async Task> GetProductionRiskEchart() { return await _secSituationService.GetProductionRiskEchart(); } @@ -41,7 +42,7 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn /// 返回本区域及下属子区域隐患 /// [HttpGet("new/dangerInfo")] - public async Task GetDangerInfoEchart(string? regionId, string? pRegionId) + public async Task> GetDangerInfoEchart(string? regionId, string? pRegionId) { return await _secSituationService.GetDangerInfos(regionId, pRegionId); } @@ -51,7 +52,7 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn /// /// [HttpGet("listFloor")] - public async Task GetListFloor() + public async Task> GetListFloor() { return await _secSituationService.GetListFloor(); } @@ -62,7 +63,7 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn /// 图层id /// [HttpGet("getRiskMapInfo")] - public async Task GetRiskMapInfo(int floorId) + public async Task> GetRiskMapInfo(int floorId) { return await _secSituationService.GetRiskMapInfo(floorId); } @@ -73,7 +74,7 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn /// /// [HttpPost("ledger")] - public async Task GetLedger(WorkTaskQueryParamsDto dto) + public async Task> GetLedger(WorkTaskQueryParamsDto dto) { return await _secSituationService.GetLedger(dto); } diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/ISunPlaceBoardWorkOrderService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/ISunPlaceBoardWorkOrderService.cs index 2f72783..4c8174c 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/ISunPlaceBoardWorkOrderService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/ISunPlaceBoardWorkOrderService.cs @@ -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.PuCe { public interface ISunPlaceBoardWorkOrderService { - Task> GetRepairOrderList(WorkOrderParamsDto dto); + Task>> GetRepairOrderList(WorkOrderParamsDto dto); - Task> GetTimelineListByOrderId(string orderId); + Task>> GetTimelineListByOrderId(string orderId); } } \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs index 6f398f8..78dd0cb 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs @@ -1,6 +1,8 @@ -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.Extensions.Logging; + using System.Net.Http.Json; using System.Text.Json; using ThirdPartyServices.Application.ShenZhouShengAn.ResponseDto; @@ -30,9 +32,9 @@ namespace ThirdPartyServices.DomainService.PuCe /// /// /// - public async Task> GetRepairOrderList(WorkOrderParamsDto dto) + public async Task>> GetRepairOrderList(WorkOrderParamsDto dto) { - List result = new(); + ApiResult> result = new ApiResult>() { Code = 200, Msg = "接口调用成功" }; var url = "https://zrh.hservices.online/prod-api/yzs/order/getRepairOrderList"; @@ -48,21 +50,24 @@ namespace ThirdPartyServices.DomainService.PuCe if (!resp.IsSuccessStatusCode) { _logger.LogWarning($"工单列表查询接口请求失败,{body}"); + return ApiResult>.IsFail($"工单列表查询接口请求失败,{body}"); } var httppReult = JsonSerializer.Deserialize>>(body); if (httppReult != null && httppReult.Code == "200") { - result = httppReult.Data; + result.Data = httppReult.Data; } else { _logger.LogWarning($"工单列表查询接口请求失败,{body}"); + return ApiResult>.IsFail($"工单列表查询接口请求失败,{body}"); } } catch (Exception ex) { _logger.LogError(ex, "工单列表查询接口请求失败"); + return ApiResult>.IsFail($"工单列表查询接口请求失败{ex.Message}"); } return result; } @@ -72,9 +77,9 @@ namespace ThirdPartyServices.DomainService.PuCe /// /// /// - public async Task> GetTimelineListByOrderId(string orderId) + public async Task>> GetTimelineListByOrderId(string orderId) { - List result = new(); + ApiResult> result = new ApiResult>() { Code = 200, Msg = "调用接口成功" }; var url = $"https://zrh.hservices.online/prod-api/yzs/timeline/getTimelineListByOrderId?orderId={orderId}"; @@ -87,21 +92,24 @@ namespace ThirdPartyServices.DomainService.PuCe if (!resp.IsSuccessStatusCode) { _logger.LogWarning($"工单时间轴接口请求失败,{body}"); + return ApiResult>.IsFail($"工单时间轴接口请求失败,{body}"); } var httppReult = JsonSerializer.Deserialize>>(body); if (httppReult != null && httppReult.Code == "200") { - result = httppReult.Data; + result.Data = httppReult.Data; } else { _logger.LogWarning($"工单时间轴接口请求失败,{body}"); + return ApiResult>.IsFail($"工单时间轴接口请求失败,{body}"); } } catch (Exception ex) { _logger.LogError(ex, "工单时间轴接口请求失败"); + return ApiResult>.IsFail($"工单时间轴接口请求失败{ex.Message}"); } return result; } diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuTianSuYuan/ISunPalaceBoardFacilityService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuTianSuYuan/ISunPalaceBoardFacilityService.cs index 7529172..fb8e185 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuTianSuYuan/ISunPalaceBoardFacilityService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuTianSuYuan/ISunPalaceBoardFacilityService.cs @@ -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> GetAssetDashboardEchart(SecSituationQueryDto dto); + Task>> GetAssetDashboardEchart(SecSituationQueryDto dto); - Task> GetAssetTypeEchart(SecSituationQueryDto dto); + Task>> GetAssetTypeEchart(SecSituationQueryDto dto); } } \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuTianSuYuan/SunPalaceBoardFacilityService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuTianSuYuan/SunPalaceBoardFacilityService.cs index 749f00a..8d8e0cd 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuTianSuYuan/SunPalaceBoardFacilityService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuTianSuYuan/SunPalaceBoardFacilityService.cs @@ -17,9 +17,9 @@ namespace ThirdPartyServices.DomainService.PuTianSuYuan _assetWebService = assetWebService; } - public async Task> GetAssetDashboardEchart(SecSituationQueryDto dto) + public async Task>> GetAssetDashboardEchart(SecSituationQueryDto dto) { - List result = []; + ApiResult> result = new ApiResult>() { 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>.IsFail($"GetAssetDashboardEchart接口出错{ex.Message}"); } return result; } @@ -143,9 +143,9 @@ namespace ThirdPartyServices.DomainService.PuTianSuYuan /// /// /// - public async Task> GetAssetTypeEchart(SecSituationQueryDto dto) + public async Task>> GetAssetTypeEchart(SecSituationQueryDto dto) { - List result = []; + ApiResult> result = new ApiResult>() { 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>.IsFail($"GetAssetTypeEchart接口出错{ex.Message}"); } return result; } diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs index c352527..9500c8d 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs @@ -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 System.Text.Json; @@ -6,24 +7,24 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn { public interface ISunPalaceBoardSafetyService { - Task GetProductionRiskEchart(); + Task> GetProductionRiskEchart(); /// /// 获得四色图图层列表 /// /// 用户单位标记码 /// - Task GetListFloor(); + Task> GetListFloor(); /// /// 获得四色图区域列表 /// /// 图层id /// - Task GetRiskMapInfo(int floorId); + Task> GetRiskMapInfo(int floorId); - Task GetDangerInfos(string? regionId, string? pRegionId); + Task> GetDangerInfos(string? regionId, string? pRegionId); - Task GetLedger(WorkTaskQueryParamsDto dto); + Task> GetLedger(WorkTaskQueryParamsDto dto); } } \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs index bb95aa4..3a8af5c 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs @@ -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.Extensions.Configuration; using Microsoft.Extensions.Logging; @@ -28,9 +29,9 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn /// 用户单位标记码 /// /// - public async Task GetListFloor() + public async Task> GetListFloor() { - var result = new FloorResDto(); + ApiResult result = new ApiResult() { Code = 200, Msg = "接口调用成功", Data = null }; try { @@ -39,7 +40,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (string.IsNullOrWhiteSpace(token)) { _logger.LogWarning("GetListFloor接口获取token失败"); - return result; + return ApiResult.IsFail("GetListFloor接口获取token失败"); } //获取用户配置 @@ -47,7 +48,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (loginUsers.Code == "Error") { _logger.LogWarning("GetListFloor接口获取用户配置失败"); - return result; + return ApiResult.IsFail("GetListFloor接口获取用户配置失败"); } //生产风险识别 @@ -56,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.IsFail($"GetListFloor接口出错{ex.Message}"); } return result; @@ -71,13 +76,9 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn /// /// /// - public async Task GetProductionRiskEchart() + public async Task> GetProductionRiskEchart() { - var result = new DangerRiskAreaResDto() - { - DangerInfos = new List(), - ProductionRiskStats = new List() - }; + ApiResult result = new() { Code = 200, Msg = "接口调用成功", Data = new DangerRiskAreaResDto() { DangerInfos = [], ProductionRiskStats = [] } }; try { //获取token @@ -85,7 +86,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (string.IsNullOrWhiteSpace(token)) { _logger.LogWarning("GetProductionRiskEchart接口获取token失败"); - return result; + return ApiResult.IsFail("GetProductionRiskEchart接口获取token失败"); } //获取用户配置 @@ -93,7 +94,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (loginUsers.Code == "Error") { _logger.LogWarning("GetProductionRiskEchart接口获取用户配置失败"); - return result; + return ApiResult.IsFail("GetProductionRiskEchart接口获取用户配置失败"); } //获取单位信息 @@ -101,8 +102,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (branchs.Code == "Error") { _logger.LogWarning("GetProductionRiskEchart接口获取单位信息失败"); - - return result; + return ApiResult.IsFail("GetProductionRiskEchart接口获取单位信息失败"); } //生产风险识别 @@ -116,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-待验收 @@ -174,11 +175,12 @@ 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.IsFail($"GetProductionRiskEchart接口出错{ex.Message}"); } return result; } @@ -189,9 +191,9 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn /// 返回本区域隐患(不包含下属子区域隐患) /// 返回本区域及下属子区域隐患 /// - public async Task GetDangerInfos(string? regionId, string? pRegionId) + public async Task> GetDangerInfos(string? regionId, string? pRegionId) { - DangerInfoRootResDto result = new(); + ApiResult result = new() { Code = 200, Msg = "接口调用成功", Data = new() }; try { //获取token @@ -199,7 +201,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (string.IsNullOrWhiteSpace(token)) { _logger.LogWarning("GetDangerInfos接口获取token失败"); - return result; + return ApiResult.IsFail("GetDangerInfos接口获取token失败"); } //获取用户配置 @@ -207,7 +209,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (loginUsers.Code == "Error") { _logger.LogWarning("GetDangerInfos接口获取用户配置失败"); - return result; + return ApiResult.IsFail("GetDangerInfos接口获取用户配置失败"); } //获取单位信息 @@ -215,8 +217,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (branchs.Code == "Error") { _logger.LogWarning("GetDangerInfos接口获取单位信息失败"); - - return result; + return ApiResult.IsFail("GetDangerInfos接口获取单位信息失败"); } var query = new DangerInfoQueryDto { Ubpid = loginUsers.Data.Ubpid, Status = "0" }; @@ -235,12 +236,13 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn var root = JsonSerializer.Deserialize>(jsonResult); if (root != null) { - result = root.Data; + result.Data = root.Data; } } catch (Exception ex) { _logger.LogWarning(ex, "GetDangerInfos接口出错"); + return ApiResult.IsFail($"GetDangerInfos接口出错{ex.Message}"); } return result; } @@ -250,9 +252,9 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn /// /// /// - public async Task GetRiskMapInfo(int floorId) + public async Task> GetRiskMapInfo(int floorId) { - var result = new RootReqDto(); + ApiResult result = new ApiResult() { Code = 200, Msg = "接口调用成功", Data = null }; try { @@ -261,7 +263,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (string.IsNullOrWhiteSpace(token)) { _logger.LogWarning("GetRiskMapInfo接口获取token失败"); - return result; + return ApiResult.IsFail("GetRiskMapInfo接口获取token失败"); } //获取用户配置 @@ -269,7 +271,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (loginUsers.Code == "Error") { _logger.LogWarning("GetRiskMapInfo接口获取用户配置失败"); - return result; + return ApiResult.IsFail("GetRiskMapInfo接口获取用户配置失败"); } //生产风险识别 @@ -287,13 +289,14 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn RootReqDto httpClientResult = JsonSerializer.Deserialize(riskResult.Data.ToString()!)!; if (httpClientResult != null) { - result = httpClientResult; + result.Data = httpClientResult; } } } catch (Exception ex) { _logger.LogWarning(ex, $"GetRiskMapInfo接口出错"); + return ApiResult.IsFail($"GetRiskMapInfo接口出错{ex.Message}"); } return result; @@ -305,9 +308,9 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn /// /// /// - public async Task GetLedger(WorkTaskQueryParamsDto dto) + public async Task> GetLedger(WorkTaskQueryParamsDto dto) { - var result = new RootReqDto(); + ApiResult result = new ApiResult() { Code = 200, Msg = "接口调用成功", Data = null }; try { @@ -316,7 +319,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (string.IsNullOrWhiteSpace(token)) { _logger.LogWarning("GetProductionRiskEchart接口获取token失败"); - return result; + return ApiResult.IsFail("GetProductionRiskEchart接口获取token失败"); } //获取用户配置 @@ -324,7 +327,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (loginUsers.Code == "Error") { _logger.LogWarning("GetProductionRiskEchart接口获取用户配置失败"); - return result; + return ApiResult.IsFail("GetProductionRiskEchart接口获取用户配置失败"); } //获取单位信息 @@ -332,12 +335,10 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (branchs.Code == "Error") { _logger.LogWarning("GetProductionRiskEchart接口获取单位信息失败"); - - return result; + return ApiResult.IsFail("GetProductionRiskEchart接口获取单位信息失败"); } dto.Ubpid = loginUsers.Data.Ubpid.ToString(); - dto.BranchId = branchs.Data.BranchPermissionIds[0]; HttpClientResult riskResult = await _tokenProviderService .SendAndParseAsync>( @@ -346,16 +347,17 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn if (riskResult != null && riskResult.Data != null && riskResult.Data.ToString()!.Length > 10) { - RootReqDto httpClientResult = JsonSerializer.Deserialize(riskResult.Data.ToString()!)!; + LedgerDto httpClientResult = JsonSerializer.Deserialize(riskResult.Data.ToString()!)!; if (httpClientResult != null) { - result = httpClientResult; + result.Data = httpClientResult; } } } catch (Exception ex) { - _logger.LogWarning(ex, $"GetRiskMapInfo接口出错"); + _logger.LogWarning(ex, "GetRiskMapInfo接口出错"); + return ApiResult.IsFail($"GetRiskMapInfo接口出错{ex.Message}"); } return result;