From 7575ab17b75258507585243a0bcf74eee969f960 Mon Sep 17 00:00:00 2001 From: LiuXin Date: Thu, 11 Sep 2025 11:31:37 +0800 Subject: [PATCH] =?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;