From a9367913d18d06325d0d856e754eb60a3afeb045 Mon Sep 17 00:00:00 2001 From: LiuXin Date: Wed, 17 Sep 2025 11:43:19 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common.Shared.Application.csproj | 2 +- .../SunPlaceBoardWorkOrderReqDto.cs | 5 - .../SunPlaceBoardWorkOrderResDto.cs | 184 ++++++++---------- .../SunPalaceBoardSafetyService.cs | 80 ++++---- 4 files changed, 120 insertions(+), 151 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 16882fb..a35dcaa 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.9.0 + 3.0.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 c429653..e9a1787 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 @@ -110,11 +110,6 @@ namespace Common.Shared.Application.SafetyFirePro.RequestDto /// 必填项 [JsonPropertyName("ubpid")] public string? Ubpid { get; set; } - - /// - /// 当为1的时候是统计,其他的时候查询列表 - /// - public int? Type { get; set; } } /// 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 14e11c0..078b8fa 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 @@ -688,7 +688,7 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto #region 隐患详情数据 /// - /// 隐患数据主对象 + /// 隐患详情根实体(仅包含指定的顶级字段) /// public class HazardDataDto { @@ -696,7 +696,7 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto /// 隐患核查结果信息列表 /// [JsonPropertyName("check")] - public List? CheckResults { get; set; } + public List? CheckResults { get; set; } /// /// 隐患描述 @@ -708,37 +708,37 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto /// 隐患相关风险点信息(如果有) /// [JsonPropertyName("equipment")] - public HazardEquipment? Equipment { get; set; } + public HazardEquipmentItem? Equipment { get; set; } /// /// 风险等级信息 /// [JsonPropertyName("risk")] - public RiskLevelInfo? Risk { get; set; } + public RiskLevelItem? Risk { get; set; } /// /// 风险点责任人信息列表 /// [JsonPropertyName("users")] - public List? ResponsiblePersons { get; set; } + public List? ResponsiblePersons { get; set; } /// /// 隐患整改及验收信息列表 /// [JsonPropertyName("rectifications")] - public List? Rectifications { get; set; } + public List? Rectifications { get; set; } /// /// 隐患发生区域 /// [JsonPropertyName("region")] - public RegionInfo? Region { get; set; } + public RegionSimpleItem? Region { get; set; } /// /// 隐患上报情况 /// [JsonPropertyName("register")] - public HazardRegister? Register { get; set; } + public HazardRegisterItem? Register { get; set; } /// /// 隐患状态,0待核查,1待整改,2待验收,3治理完毕,4不是隐患 @@ -748,21 +748,21 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto } /// - /// 隐患核查结果信息 + /// 隐患核查结果单项信息 /// - public class HazardCheckResult + public class HazardCheckItem { /// - /// 隐患一级分类信息 + /// 隐患一级分类信息(仅含名称) /// [JsonPropertyName("cate")] - public CategoryInfo? Category { get; set; } + public CategorySimpleItem? Category { get; set; } /// - /// 隐患二级分类信息 + /// 隐患二级分类信息(仅含名称) /// [JsonPropertyName("cate_sub")] - public CategoryInfo? SubCategory { get; set; } + public CategorySimpleItem? SubCategory { get; set; } /// /// 核查情况说明 @@ -774,7 +774,7 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto /// 核查时间 /// [JsonPropertyName("report_time")] - public DateTime ReportTime { get; set; } + public string ReportTime { get; set; } = string.Empty; // 用string避免日期格式问题,需转换可改为DateTime? /// /// 核查结果,0待核查,1是隐患,2不是隐患,3提交上级部门核查 @@ -786,43 +786,43 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto /// 核查人信息 /// [JsonPropertyName("user")] - public CheckUserInfo? User { get; set; } + public CheckUserItem? User { get; set; } } /// - /// 核查人信息 + /// 核查人信息(仅含部门和姓名) /// - public class CheckUserInfo + public class CheckUserItem { /// - /// 核查人部门信息列表 + /// 核查人部门信息列表(仅含部门名称) /// [JsonPropertyName("branch")] - public List? Departments { get; set; } + public List? Departments { get; set; } /// - /// 核查人额外信息 + /// 核查人额外信息(仅含姓名) /// [JsonPropertyName("extras")] - public UserExtras? Extras { get; set; } + public UserNameItem? Extras { get; set; } } /// - /// 部门信息 + /// 部门信息包装(仅含部门详情) /// - public class DepartmentInfo + public class DepartmentWrapperItem { /// - /// 部门详情 + /// 部门详情(仅含名称) /// [JsonPropertyName("branch")] - public DepartmentDetail? Branch { get; set; } + public DepartmentSimpleItem? Branch { get; set; } } /// - /// 部门详情 + /// 部门简化信息(仅含名称) /// - public class DepartmentDetail + public class DepartmentSimpleItem { /// /// 部门名称 @@ -832,9 +832,9 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto } /// - /// 用户额外信息 + /// 用户姓名信息(仅含姓名) /// - public class UserExtras + public class UserNameItem { /// /// 姓名 @@ -844,15 +844,15 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto } /// - /// 隐患相关风险点信息 + /// 隐患相关风险点信息(仅含指定字段) /// - public class HazardEquipment + public class HazardEquipmentItem { /// - /// 责任部门 + /// 责任部门(仅含名称) /// [JsonPropertyName("branch")] - public DepartmentDetail? Branch { get; set; } + public DepartmentSimpleItem? Branch { get; set; } /// /// 风险点名称 @@ -861,16 +861,16 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto public string Name { get; set; } = string.Empty; /// - /// 所在区域 + /// 所在区域(仅含名称) /// [JsonPropertyName("region")] - public RegionInfo? Region { get; set; } + public RegionSimpleItem? Region { get; set; } } /// - /// 区域信息 + /// 区域简化信息(仅含名称) /// - public class RegionInfo + public class RegionSimpleItem { /// /// 区域名称 @@ -880,15 +880,15 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto } /// - /// 风险等级信息 + /// 风险等级信息(仅含指定字段) /// - public class RiskLevelInfo + public class RiskLevelItem { /// - /// 责任部门信息 + /// 责任部门信息(仅含管控层级) /// [JsonPropertyName("branch")] - public RiskBranchInfo? Branch { get; set; } + public RiskBranchItem? Branch { get; set; } /// /// 风险等级ID @@ -904,21 +904,21 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto } /// - /// 风险点责任部门信息 + /// 风险点责任部门信息(仅含管控层级) /// - public class RiskBranchInfo + public class RiskBranchItem { /// - /// 风险点管控层级 + /// 风险点管控层级(仅含名称) /// [JsonPropertyName("branch_level")] - public LevelInfo? BranchLevel { get; set; } + public LevelSimpleItem? BranchLevel { get; set; } } /// - /// 层级信息 + /// 层级简化信息(仅含名称) /// - public class LevelInfo + public class LevelSimpleItem { /// /// 层级名称(如岗位级) @@ -928,45 +928,33 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto } /// - /// 风险点责任人信息 + /// 风险点责任人信息(仅含姓名) /// - public class ResponsiblePerson + public class ResponsiblePersonItem { /// - /// 责任人详情 + /// 责任人详情(仅含姓名) /// [JsonPropertyName("users")] - public PersonDetail? Users { get; set; } + public UserNameItem? Users { get; set; } } /// - /// 人员详情 + /// 隐患整改及验收信息(仅含指定字段) /// - public class PersonDetail + public class RectificationItem { /// - /// 姓名 - /// - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; - } - - /// - /// 隐患整改及验收信息 - /// - public class RectificationInfo - { - /// - /// 整改责任部门 + /// 整改责任部门(仅含名称) /// [JsonPropertyName("branch")] - public DepartmentDetail? Branch { get; set; } + public DepartmentSimpleItem? Branch { get; set; } /// /// 本次整改验收信息 /// [JsonPropertyName("check")] - public RectificationCheck? Check { get; set; } + public RectificationCheckItem? Check { get; set; } /// /// 整改人所选验收人姓名 @@ -975,16 +963,16 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto public string CheckUser { get; set; } = string.Empty; /// - /// 隐患整改图片列表 + /// 隐患整改图片列表(仅含名称和路径) /// [JsonPropertyName("file")] - public List? Files { get; set; } + public List? Files { get; set; } /// /// 整改完成时间 /// [JsonPropertyName("finish_time")] - public DateTime FinishTime { get; set; } + public string FinishTime { get; set; } = string.Empty; // 用string避免日期格式问题 /// /// 整改投入资金(元) @@ -1006,21 +994,21 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto } /// - /// 整改验收信息 + /// 整改验收信息(仅含指定字段) /// - public class RectificationCheck + public class RectificationCheckItem { /// /// 整改验收时间 /// [JsonPropertyName("cend_time")] - public DateTime CheckEndTime { get; set; } + public string CheckEndTime { get; set; } = string.Empty; // 用string避免日期格式问题 /// - /// 验收图片或文件列表 + /// 验收图片或文件列表(仅含名称和路径) /// [JsonPropertyName("file")] - public List? Files { get; set; } + public List? Files { get; set; } /// /// 验收意见 @@ -1032,7 +1020,7 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto /// 验收结果,1通过,2不通过 /// [JsonPropertyName("status")] - public string Status { get; set; } = string.Empty; + public string Status { get; set; } = string.Empty; // 按你标注的"验收结果"设为string,可根据实际JSON改为int? /// /// 验收人姓名 @@ -1042,9 +1030,9 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto } /// - /// 文件信息 + /// 文件简化信息(仅含名称和路径) /// - public class FileInfo + public class FileSimpleItem { /// /// 文件名称 @@ -1060,21 +1048,21 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto } /// - /// 隐患上报情况 + /// 隐患上报情况(仅含指定字段) /// - public class HazardRegister + public class HazardRegisterItem { /// - /// 隐患一级分类信息 + /// 隐患一级分类信息(仅含名称) /// [JsonPropertyName("cate")] - public CategoryInfo? Category { get; set; } + public CategorySimpleItem? Category { get; set; } /// - /// 隐患二级分类信息 + /// 隐患二级分类信息(仅含名称) /// [JsonPropertyName("cate_sub")] - public CategoryInfo? SubCategory { get; set; } + public CategorySimpleItem? SubCategory { get; set; } /// /// 所选核查人姓名 @@ -1083,10 +1071,10 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto public string CheckUser { get; set; } = string.Empty; /// - /// 隐患图片列表 + /// 隐患图片列表(仅含名称和路径) /// [JsonPropertyName("file")] - public List? Files { get; set; } + public List? Files { get; set; } /// /// 隐患情况描述 @@ -1095,16 +1083,16 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto public string Infos { get; set; } = string.Empty; /// - /// 隐患上报人信息 + /// 隐患上报人信息(仅含姓名) /// [JsonPropertyName("user")] - public ReporterInfo? User { get; set; } + public UserNameItem? User { get; set; } } /// - /// 分类信息 + /// 分类简化信息(仅含名称) /// - public class CategoryInfo + public class CategorySimpleItem { /// /// 分类名称 @@ -1113,18 +1101,6 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto public string Name { get; set; } = string.Empty; } - /// - /// 上报人信息 - /// - public class ReporterInfo - { - /// - /// 姓名 - /// - [JsonPropertyName("name")] - public string Name { get; set; } = string.Empty; - } - #endregion 隐患详情数据 #region 危害辨识度数据 diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs index 18893a7..cf43c97 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs @@ -540,65 +540,63 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn dto.Ubpid = loginUsers.Data.Ubpid.ToString(); List data = []; - if (dto.Type == 1) + + //查询未开始,status=1、2 + int[] statusNot = [1, 2, 3, 4, 6, 7, 8, 11, 12, 13]; + + for (int i = 0; i < statusNot.Length; i++) { - //查询未开始,status=1、2 - int[] statusNot = [1, 2, 3, 4, 6, 7, 8, 11, 12, 13]; + dto.Status = statusNot[i].ToString(); + dto.Page = 1; + dto.PageSize = 1; + HttpClientResult riskResult = await _tokenProviderService + .SendAndParseAsync>( + "https://zrh.szdunan.cn/v1/api/ticket/safe/ledger", + token, dto, HttpMethod.Post); - for (int i = 0; i < statusNot.Length; i++) + if (riskResult != null && riskResult.Data != null && riskResult.Data.ToString()!.Length > 10) { - dto.Status = statusNot[i].ToString(); - dto.Page = 1; - dto.PageSize = 1; - 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) + LedgerDto httpClientResult = JsonSerializer.Deserialize(riskResult.Data.ToString()!)!; + if (httpClientResult != null) { - LedgerDto httpClientResult = JsonSerializer.Deserialize(riskResult.Data.ToString()!)!; - if (httpClientResult != null) + if (statusNot[i] == 3) { - if (statusNot[i] == 3) + int c = 0; + //统计状态为3但是实际结束时间大于计划结束时间的 + if (httpClientResult.Data != null && httpClientResult.Data.Count > 0) { - int c = 0; - //统计状态为3但是实际结束时间大于计划结束时间的 - if (httpClientResult.Data != null && httpClientResult.Data.Count > 0) + for (int j = 0; j < httpClientResult.Data.Count; j++) { - for (int j = 0; j < httpClientResult.Data.Count; j++) + if (httpClientResult.Data[j].EndAt != "" && httpClientResult.Data[j].FinishTime != "") { - if (httpClientResult.Data[j].EndAt != "" && httpClientResult.Data[j].FinishTime != "") + if (Convert.ToDateTime(httpClientResult.Data[j].EndAt) < Convert.ToDateTime(httpClientResult.Data[j].FinishTime)) { - if (Convert.ToDateTime(httpClientResult.Data[j].EndAt) < Convert.ToDateTime(httpClientResult.Data[j].FinishTime)) - { - c++; - } + c++; } } } - StatisticsInfoDto statisticsInfoDto = new() - { - Name = statusNot[i].ToString() + "已超时", - Total = httpClientResult.Total, - }; - data.Add(statisticsInfoDto); } - else + StatisticsInfoDto statisticsInfoDto = new() { - StatisticsInfoDto statisticsInfoDto = new() - { - Name = statusNot[i].ToString(), - Total = httpClientResult.Total, - }; - data.Add(statisticsInfoDto); - } + Name = statusNot[i].ToString() + "已超时", + Total = httpClientResult.Total, + }; + data.Add(statisticsInfoDto); + } + else + { + StatisticsInfoDto statisticsInfoDto = new() + { + Name = statusNot[i].ToString(), + Total = httpClientResult.Total, + }; + data.Add(statisticsInfoDto); } } } - - result.Data = MergeStatistics(data); } + + result.Data = MergeStatistics(data); } catch (Exception ex) { -- 2.36.2 From e55123806223f67e5ede74c1520e17a0cc9a4eb5 Mon Sep 17 00:00:00 2001 From: LiuXin Date: Wed, 17 Sep 2025 15:43:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?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 | 16 +++++ .../SunPalaceBoardSafetyController.cs | 11 +++ .../RequestDto/ThirdPartyProviderQueryDto.cs | 13 +++- .../ResponseDto/ThirdPartyProviderResDto.cs | 30 +++++++++ .../ISunPalaceBoardSafetyService.cs | 2 + .../SunPalaceBoardSafetyService.cs | 67 +++++++++++++++++++ 6 files changed, 137 insertions(+), 2 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 e9a1787..e0d27f4 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 @@ -157,4 +157,20 @@ namespace Common.Shared.Application.SafetyFirePro.RequestDto /// public string Name { get; set; } } + + /// + /// 获得本月隐患数据 + /// + public class DangerHomeResDto + { + /// + /// 统计 + /// + public int Total { get; set; } + + /// + /// + /// + public string Name { get; set; } + } } \ 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 b445c40..7259f6c 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs @@ -122,5 +122,16 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn { return await _secSituationService.GetStatistics(dto); } + + /// + /// 获得本月隐患数据 + /// + /// + /// + [HttpGet] + public async Task>> GetDangerHome() + { + return await _secSituationService.GetDangerHome(); + } } } \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/RequestDto/ThirdPartyProviderQueryDto.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/RequestDto/ThirdPartyProviderQueryDto.cs index 112f89f..498ea69 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/RequestDto/ThirdPartyProviderQueryDto.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/RequestDto/ThirdPartyProviderQueryDto.cs @@ -80,7 +80,6 @@ namespace ThirdPartyServices.Application.ShenZhouShengAn.RequestDto public int Ubpid { get; set; } } - /// /// 危害辨识项目数据请求参数 /// @@ -91,5 +90,15 @@ namespace ThirdPartyServices.Application.ShenZhouShengAn.RequestDto public int Uid { get; set; } } - + /// + /// 包含ubpid参数的请求实体类 + /// + public class Params + { + /// + /// 机构ID(必填) + /// + [JsonPropertyName("ubpid")] + public int Ubpid { get; set; } + } } \ No newline at end of file diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/ResponseDto/ThirdPartyProviderResDto.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/ResponseDto/ThirdPartyProviderResDto.cs index 006897e..545ad09 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/ResponseDto/ThirdPartyProviderResDto.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/ResponseDto/ThirdPartyProviderResDto.cs @@ -40,6 +40,36 @@ namespace ThirdPartyServices.Application.ShenZhouShengAn.ResponseDto public T Data { get; set; } } + /// + /// 原始JSON反序列化的根实体类 + /// + public class DangerStatsRootResDto + { + /// + /// 风险等级数量统计(暂不使用) + /// + [JsonPropertyName("dangerLevelCount")] + public List? DangerLevelCount { get; set; } + + /// + /// 隐患状态数量统计(按顺序对应:待核查、待整改、待验收、整改完毕) + /// + [JsonPropertyName("dangerStatusCount")] + public List? DangerStatusCount { get; set; } + + /// + /// 当前总数(暂不使用) + /// + [JsonPropertyName("nowTotal")] + public int NowTotal { get; set; } + + /// + /// 比率(暂不使用) + /// + [JsonPropertyName("rRate")] + public string RRate { get; set; } = string.Empty; + } + public class HttpClientResultConverter : JsonConverter> { public override HttpClientResult Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs index 1db1643..c222557 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs @@ -41,5 +41,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn ); Task>> GetStatistics(WorkTaskQueryParamsDto dto); + + Task>> GetDangerHome(); } } \ 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 cf43c97..c603db1 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs @@ -650,5 +650,72 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn new() { Name = "已超时", Total = timeoutTotal } ]; } + + public async Task>> GetDangerHome() + { + ApiResult> result = new ApiResult>() { Code = 200, Msg = "接口调用成功", Data = null }; + + try + { + //获取token + var token = await _tokenProviderService.GetTokenAsync(_configuration["ThirdParty:SzdunanCode"]!); + if (string.IsNullOrWhiteSpace(token)) + { + _logger.LogWarning("GetRegionRootInfo接口获取token失败"); + return ApiResult>.IsFail("GetRegionRootInfo接口获取token失败"); + } + + //获取用户配置 + HttpClientResult loginUsers = await _tokenProviderService.GetUserConfiguration(token); + if (loginUsers.Code == "Error") + { + _logger.LogWarning("GetRegionRootInfo接口获取用户配置失败"); + return ApiResult>.IsFail("GetRegionRootInfo接口获取用户配置失败"); + } + Params dto = new(); + dto.Ubpid = loginUsers.Data.Ubpid; + + HttpClientResult riskResult = await _tokenProviderService + .SendAndParseAsync>( + "https://zrh.szdunan.cn/v1/api/home/danger", + token, dto, HttpMethod.Get); + + if (riskResult != null && riskResult.Data != null && riskResult.Data.ToString()!.Length > 10) + { + DangerStatsRootResDto httpClientResult = JsonSerializer.Deserialize(riskResult.Data.ToString()!)!; + if (httpClientResult != null) + { + // 定义固定的状态名称(顺序必须与dangerStatusCount数组一致) + var statusNames = new List + { + "待核查隐患数", + "待整改隐患数", + "待验收隐患数", + "整改完毕隐患数" + }; + + // 构建结果集合(处理数组长度不匹配的情况) + var resultItem = new List(); + for (int i = 0; i < statusNames.Count; i++) + { + resultItem.Add(new DangerHomeResDto + { + Name = statusNames[i], + Total = httpClientResult?.DangerStatusCount?.ElementAtOrDefault(i) ?? 0 + }); + } + + result.Data = resultItem; + } + } + } + catch (Exception ex) + { + _logger.LogWarning(ex, "GetRegionRootInfo接口出错"); + return ApiResult>.IsFail($"GetRegionRootInfo接口出错{ex.Message}"); + } + + return result; + } } } \ No newline at end of file -- 2.36.2