From 3b2efcd689310df13cb573f5f93da5d8054adb6c Mon Sep 17 00:00:00 2001 From: LiuXin Date: Tue, 16 Sep 2025 11:48:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Manage.AppHost.AppHost/AppHost.cs | 1 - .../Manage.AppHost.AppHost.csproj | 2 +- .../Common.Shared.Application.csproj | 2 +- .../ResponseDto/SunPalaceBoardResDto.cs | 6 +- .../SunPlaceBoardWorkOrderResDto.cs | 519 ++++++++++++++++++ .../SunPalaceBoardSafetyController.cs | 43 +- .../RequestDto/ThirdPartyProviderQueryDto.cs | 39 ++ .../PuCe/SunPlaceBoardWorkOrderService.cs | 2 +- .../ISunPalaceBoardSafetyService.cs | 17 +- .../SunPalaceBoardSafetyService.cs | 166 +++++- 10 files changed, 771 insertions(+), 26 deletions(-) diff --git a/WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/AppHost.cs b/WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/AppHost.cs index 6290bda..c4be25f 100644 --- a/WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/AppHost.cs +++ b/WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/AppHost.cs @@ -11,7 +11,6 @@ builder.AddProject("webfrontend") .WithReference(videoapi) .WithReference(alarmapi) .WithReference(thirdpartyapi) - .WithExternalHttpEndpoints() .WithHttpHealthCheck("/health") .WithReference(apiService) diff --git a/WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/Manage.AppHost.AppHost.csproj b/WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/Manage.AppHost.AppHost.csproj index 8498e6c..958941e 100644 --- a/WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/Manage.AppHost.AppHost.csproj +++ b/WeiCloud.Fusion/AspireApp/Manage.AppHost.AppHost/Manage.AppHost.AppHost.csproj @@ -7,7 +7,7 @@ net8.0 enable enable - 3cf59eab-e561-4b70-8cf1-44e4e9958796 + 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 98fd64e..09fb475 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.5.0 + 2.6.0 zrh-lx zrh-lx 包含所有公共使用的 DTO、契约、接口模型等,供微服务之间共享使用 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 7b2dba2..11d23e8 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 @@ -618,7 +618,7 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto public string PrevPageUrl { get; set; } [JsonPropertyName("to")] - public int To { get; set; } + public int? To { get; set; } [JsonPropertyName("total")] public int Total { get; set; } @@ -872,6 +872,7 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto } #region 私有辅助方法:统一处理JsonElement(数字/字符串)转double + /// /// 兼容「数字类型」和「字符串类型」的JsonElement,解析为double /// 例:116.079126 → 116.079126;"116.079126" → 116.079126 @@ -888,6 +889,7 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto _ => (result = 0, false).Item2 }; } - #endregion + + #endregion 私有辅助方法:统一处理JsonElement(数字/字符串)转double } } \ 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 index 319f0a1..14e11c0 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 @@ -685,6 +685,525 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto #endregion 危险施工作业响应体 + #region 隐患详情数据 + + /// + /// 隐患数据主对象 + /// + public class HazardDataDto + { + /// + /// 隐患核查结果信息列表 + /// + [JsonPropertyName("check")] + public List? CheckResults { get; set; } + + /// + /// 隐患描述 + /// + [JsonPropertyName("describe")] + public string Description { get; set; } = string.Empty; + + /// + /// 隐患相关风险点信息(如果有) + /// + [JsonPropertyName("equipment")] + public HazardEquipment? Equipment { get; set; } + + /// + /// 风险等级信息 + /// + [JsonPropertyName("risk")] + public RiskLevelInfo? Risk { get; set; } + + /// + /// 风险点责任人信息列表 + /// + [JsonPropertyName("users")] + public List? ResponsiblePersons { get; set; } + + /// + /// 隐患整改及验收信息列表 + /// + [JsonPropertyName("rectifications")] + public List? Rectifications { get; set; } + + /// + /// 隐患发生区域 + /// + [JsonPropertyName("region")] + public RegionInfo? Region { get; set; } + + /// + /// 隐患上报情况 + /// + [JsonPropertyName("register")] + public HazardRegister? Register { get; set; } + + /// + /// 隐患状态,0待核查,1待整改,2待验收,3治理完毕,4不是隐患 + /// + [JsonPropertyName("status")] + public int Status { get; set; } + } + + /// + /// 隐患核查结果信息 + /// + public class HazardCheckResult + { + /// + /// 隐患一级分类信息 + /// + [JsonPropertyName("cate")] + public CategoryInfo? Category { get; set; } + + /// + /// 隐患二级分类信息 + /// + [JsonPropertyName("cate_sub")] + public CategoryInfo? SubCategory { get; set; } + + /// + /// 核查情况说明 + /// + [JsonPropertyName("remark")] + public string Remark { get; set; } = string.Empty; + + /// + /// 核查时间 + /// + [JsonPropertyName("report_time")] + public DateTime ReportTime { get; set; } + + /// + /// 核查结果,0待核查,1是隐患,2不是隐患,3提交上级部门核查 + /// + [JsonPropertyName("status")] + public int Status { get; set; } + + /// + /// 核查人信息 + /// + [JsonPropertyName("user")] + public CheckUserInfo? User { get; set; } + } + + /// + /// 核查人信息 + /// + public class CheckUserInfo + { + /// + /// 核查人部门信息列表 + /// + [JsonPropertyName("branch")] + public List? Departments { get; set; } + + /// + /// 核查人额外信息 + /// + [JsonPropertyName("extras")] + public UserExtras? Extras { get; set; } + } + + /// + /// 部门信息 + /// + public class DepartmentInfo + { + /// + /// 部门详情 + /// + [JsonPropertyName("branch")] + public DepartmentDetail? Branch { get; set; } + } + + /// + /// 部门详情 + /// + public class DepartmentDetail + { + /// + /// 部门名称 + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + } + + /// + /// 用户额外信息 + /// + public class UserExtras + { + /// + /// 姓名 + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + } + + /// + /// 隐患相关风险点信息 + /// + public class HazardEquipment + { + /// + /// 责任部门 + /// + [JsonPropertyName("branch")] + public DepartmentDetail? Branch { get; set; } + + /// + /// 风险点名称 + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// + /// 所在区域 + /// + [JsonPropertyName("region")] + public RegionInfo? Region { get; set; } + } + + /// + /// 区域信息 + /// + public class RegionInfo + { + /// + /// 区域名称 + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + } + + /// + /// 风险等级信息 + /// + public class RiskLevelInfo + { + /// + /// 责任部门信息 + /// + [JsonPropertyName("branch")] + public RiskBranchInfo? Branch { get; set; } + + /// + /// 风险等级ID + /// + [JsonPropertyName("id")] + public int Id { get; set; } + + /// + /// 风险等级名称 + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + } + + /// + /// 风险点责任部门信息 + /// + public class RiskBranchInfo + { + /// + /// 风险点管控层级 + /// + [JsonPropertyName("branch_level")] + public LevelInfo? BranchLevel { get; set; } + } + + /// + /// 层级信息 + /// + public class LevelInfo + { + /// + /// 层级名称(如岗位级) + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + } + + /// + /// 风险点责任人信息 + /// + public class ResponsiblePerson + { + /// + /// 责任人详情 + /// + [JsonPropertyName("users")] + public PersonDetail? Users { get; set; } + } + + /// + /// 人员详情 + /// + public class PersonDetail + { + /// + /// 姓名 + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + } + + /// + /// 隐患整改及验收信息 + /// + public class RectificationInfo + { + /// + /// 整改责任部门 + /// + [JsonPropertyName("branch")] + public DepartmentDetail? Branch { get; set; } + + /// + /// 本次整改验收信息 + /// + [JsonPropertyName("check")] + public RectificationCheck? Check { get; set; } + + /// + /// 整改人所选验收人姓名 + /// + [JsonPropertyName("check_user")] + public string CheckUser { get; set; } = string.Empty; + + /// + /// 隐患整改图片列表 + /// + [JsonPropertyName("file")] + public List? Files { get; set; } + + /// + /// 整改完成时间 + /// + [JsonPropertyName("finish_time")] + public DateTime FinishTime { get; set; } + + /// + /// 整改投入资金(元) + /// + [JsonPropertyName("funds")] + public string Funds { get; set; } = string.Empty; + + /// + /// 整改措施 + /// + [JsonPropertyName("measures_desc")] + public string MeasuresDescription { get; set; } = string.Empty; + + /// + /// 整改情况 + /// + [JsonPropertyName("infos")] + public string Infos { get; set; } = string.Empty; + } + + /// + /// 整改验收信息 + /// + public class RectificationCheck + { + /// + /// 整改验收时间 + /// + [JsonPropertyName("cend_time")] + public DateTime CheckEndTime { get; set; } + + /// + /// 验收图片或文件列表 + /// + [JsonPropertyName("file")] + public List? Files { get; set; } + + /// + /// 验收意见 + /// + [JsonPropertyName("remark")] + public string Remark { get; set; } = string.Empty; + + /// + /// 验收结果,1通过,2不通过 + /// + [JsonPropertyName("status")] + public string Status { get; set; } = string.Empty; + + /// + /// 验收人姓名 + /// + [JsonPropertyName("check_user")] + public string CheckUser { get; set; } = string.Empty; + } + + /// + /// 文件信息 + /// + public class FileInfo + { + /// + /// 文件名称 + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// + /// 文件路径 + /// + [JsonPropertyName("paths")] + public string Path { get; set; } = string.Empty; + } + + /// + /// 隐患上报情况 + /// + public class HazardRegister + { + /// + /// 隐患一级分类信息 + /// + [JsonPropertyName("cate")] + public CategoryInfo? Category { get; set; } + + /// + /// 隐患二级分类信息 + /// + [JsonPropertyName("cate_sub")] + public CategoryInfo? SubCategory { get; set; } + + /// + /// 所选核查人姓名 + /// + [JsonPropertyName("check_user")] + public string CheckUser { get; set; } = string.Empty; + + /// + /// 隐患图片列表 + /// + [JsonPropertyName("file")] + public List? Files { get; set; } + + /// + /// 隐患情况描述 + /// + [JsonPropertyName("infos")] + public string Infos { get; set; } = string.Empty; + + /// + /// 隐患上报人信息 + /// + [JsonPropertyName("user")] + public ReporterInfo? User { get; set; } + } + + /// + /// 分类信息 + /// + public class CategoryInfo + { + /// + /// 分类名称 + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + } + + /// + /// 上报人信息 + /// + public class ReporterInfo + { + /// + /// 姓名 + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + } + + #endregion 隐患详情数据 + + #region 危害辨识度数据 + + public class InjureResDto + { + /// + /// 危害ID + /// + [JsonPropertyName("id")] + public int Id { get; set; } + + /// + /// 危害名称 + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// + /// 危害说明 + /// + [JsonPropertyName("intro")] + public string Introduction { get; set; } = string.Empty; + } + + #endregion 危害辨识度数据 + + #region 楼层数据 + + /// + /// 区域结构及权限ID集合的根实体 + /// + public class RegionStructureRootDto + { + /// + /// 在region_id生效时,其所有子孙节点的ID集合 + /// + [JsonPropertyName("branch_permissions_ids")] + public List? BranchPermissionsIds { get; set; } + + /// + /// 区域树形结构列表 + /// + [JsonPropertyName("list")] + public List? Regions { get; set; } + } + + /// + /// 区域节点信息,包含区域的基本信息及子区域 + /// + public class RegionNode + { + /// + /// 区域ID + /// + [JsonPropertyName("id")] + public int Id { get; set; } + + /// + /// 区域名称 + /// + [JsonPropertyName("name")] + public string Name { get; set; } = string.Empty; + + /// + /// 父级区域ID + /// + [JsonPropertyName("parent_id")] + public int ParentId { get; set; } + + /// + /// 下一级子区域节点列表(递归结构) + /// + [JsonPropertyName("children")] + public List? Children { get; set; } + } + + #endregion 楼层数据 + public sealed class FixedPatternDateTimeConverter : JsonConverter { private const string Pattern = "yyyy-MM-dd HH:mm:ss"; diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs index ac9f84e..5b9ccce 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.API/Controllers/ShenZhouShengAn/SunPalaceBoardSafetyController.cs @@ -4,6 +4,7 @@ using Common.Shared.Application.SafetyFirePro.ResponseDto; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Text.Json; +using ThirdPartyServices.Application.ShenZhouShengAn.RequestDto; using ThirdPartyServices.DomainService.ShenZhouShengAn; namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn @@ -38,13 +39,12 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn /// /// 获取指定区域ID的隐患数据 /// - /// 返回本区域隐患(不包含下属子区域隐患) - /// 返回本区域及下属子区域隐患 + /// - [HttpGet("new/dangerInfo")] - public async Task> GetDangerInfoEchart(string? regionId, string? pRegionId) + [HttpPost("new/dangerInfo")] + public async Task> GetDangerInfoEchart(DangerInfoQueryDto dto) { - return await _secSituationService.GetDangerInfos(regionId, pRegionId); + return await _secSituationService.GetDangerInfos(dto); } /// @@ -78,5 +78,38 @@ namespace ThirdPartyServices.API.Controllers.ShenZhouShengAn { return await _secSituationService.GetLedger(dto); } + + /// + /// 14、获得隐患详情数据 + /// + /// + /// + [HttpPost("GetDangerDetail")] + public async Task> GetDangerDetail(DangerDetailReqDto dto) + { + return await _secSituationService.GetDangerDetail(dto); + } + + /// + /// 11、获得危害辨识项目数据 + /// + /// + /// + [HttpGet("injure")] + public async Task> GetInjureInfo() + { + return await _secSituationService.GetInjureInfo(); + } + + /// + /// 得区域(空间)列表树数据 + /// + /// + /// + [HttpPost("rootiinfo")] + public async Task> GetRegionRootInfo(RegionRootInfoReqDto dto) + { + return await _secSituationService.GetRegionRootInfo(dto); + } } } \ 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 58c6182..4c1b175 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/RequestDto/ThirdPartyProviderQueryDto.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.Application/ShenZhouShengAn/RequestDto/ThirdPartyProviderQueryDto.cs @@ -79,4 +79,43 @@ namespace ThirdPartyServices.Application.ShenZhouShengAn.RequestDto public int Ubpid { get; set; } } + + /// + /// 隐患详情请求参数 + /// + public class DangerDetailReqDto + { + /// + /// 隐患id + /// + public int Id { get; set; } + } + + /// + /// 危害辨识项目数据请求参数 + /// + public class InjureReqDto + { + public int Ubpid { get; set; } + + public int Uid { get; set; } + } + + /// + /// 区域(空间)列表树数据 + /// + public class RegionRootInfoReqDto + { + /// + /// 传0则返回当前单位所有数据,传其他数字,如is_switch_branch=1,则逐级返回该id之上的父节点和之下的所有子孙节点数据 + /// + public int? region_id { get; set; } + + /// + /// 0忽略region_id参数,1启用region_id参数 + /// + public int Is_switch_branch { get; set; } = 0; + + public int? Ubpid { get; set; } + } } \ 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 78dd0cb..5787422 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs @@ -34,7 +34,7 @@ namespace ThirdPartyServices.DomainService.PuCe /// public async Task>> GetRepairOrderList(WorkOrderParamsDto dto) { - ApiResult> result = new ApiResult>() { Code = 200, Msg = "接口调用成功" }; + ApiResult> result = new() { Code = 200, Msg = "接口调用成功" }; var url = "https://zrh.hservices.online/prod-api/yzs/order/getRepairOrderList"; diff --git a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs index 9500c8d..12ed028 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs @@ -1,7 +1,8 @@ using Common.Shared.Application.BaseModels; using Common.Shared.Application.SafetyFirePro.RequestDto; using Common.Shared.Application.SafetyFirePro.ResponseDto; -using System.Text.Json; +using MongoDB.Driver.Core.Misc; +using ThirdPartyServices.Application.ShenZhouShengAn.RequestDto; namespace ThirdPartyServices.DomainService.ShenZhouShengAn { @@ -23,8 +24,20 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn /// Task> GetRiskMapInfo(int floorId); - Task> GetDangerInfos(string? regionId, string? pRegionId); + Task> GetDangerInfos(DangerInfoQueryDto dto); Task> GetLedger(WorkTaskQueryParamsDto dto); + + Task> GetDangerDetail(DangerDetailReqDto dto); + + /// + /// 11、获得危害辨识项目数据 + /// + /// + /// + Task> GetInjureInfo(); + + Task> GetRegionRootInfo(RegionRootInfoReqDto 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 3a8af5c..670f661 100644 --- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs +++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs @@ -191,7 +191,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn /// 返回本区域隐患(不包含下属子区域隐患) /// 返回本区域及下属子区域隐患 /// - public async Task> GetDangerInfos(string? regionId, string? pRegionId) + public async Task> GetDangerInfos(DangerInfoQueryDto dto) { ApiResult result = new() { Code = 200, Msg = "接口调用成功", Data = new() }; try @@ -219,19 +219,10 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn _logger.LogWarning("GetDangerInfos接口获取单位信息失败"); return ApiResult.IsFail("GetDangerInfos接口获取单位信息失败"); } - var query = new DangerInfoQueryDto { Ubpid = loginUsers.Data.Ubpid, Status = "0" }; + dto.Ubpid = loginUsers.Data.Ubpid; + // dto.Branch_id = branchs.Data.BranchPermissionIds[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 jsonResult = await _tokenProviderService.SendJsonAsync("https://zrh.szdunan.cn/v1/api/danger/ledger/dangerInfo/new", token, dto, HttpMethod.Post); var root = JsonSerializer.Deserialize>(jsonResult); if (root != null) @@ -362,5 +353,154 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn return result; } + + /// + /// 获取隐患详情 + /// + /// + /// + /// + public async Task> GetDangerDetail(DangerDetailReqDto dto) + { + 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("GetDangerDetail接口获取token失败"); + return ApiResult.IsFail("GetDangerDetail接口获取token失败"); + } + + HttpClientResult riskResult = await _tokenProviderService + .SendAndParseAsync>( + "https://zrh.szdunan.cn/v1/api/danger/rectification/check/detail", + token, dto, HttpMethod.Post); + + if (riskResult != null && riskResult.Data != null && riskResult.Data.ToString()!.Length > 10) + { + HazardDataDto httpClientResult = JsonSerializer.Deserialize(riskResult.Data.ToString()!)!; + if (httpClientResult != null) + { + result.Data = httpClientResult; + } + } + } + catch (Exception ex) + { + _logger.LogWarning(ex, "GetDangerDetail接口出错"); + return ApiResult.IsFail($"GetDangerDetail接口出错{ex.Message}"); + } + + return result; + } + + /// + /// 11、获得危害辨识项目数据 + /// + /// + /// + public async Task> GetInjureInfo() + { + 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("GetInjureInfo接口获取token失败"); + return ApiResult.IsFail("GetInjureInfo接口获取token失败"); + } + + //获取用户配置 + HttpClientResult loginUsers = await _tokenProviderService.GetUserConfiguration(token); + if (loginUsers.Code == "Error") + { + _logger.LogWarning("GetInjureInfo接口获取用户配置失败"); + return ApiResult.IsFail("GetInjureInfo接口获取用户配置失败"); + } + InjureReqDto dto = new() + { + Ubpid = loginUsers.Data.Ubpid, + Uid = loginUsers.Data.Uid + }; + + HttpClientResult riskResult = await _tokenProviderService + .SendAndParseAsync>( + "https://zrh.szdunan.cn/v1/api/danger/rectification/check/detail", + token, dto, HttpMethod.Post); + + if (riskResult != null && riskResult.Data != null && riskResult.Data.ToString()!.Length > 10) + { + InjureResDto httpClientResult = JsonSerializer.Deserialize(riskResult.Data.ToString()!)!; + if (httpClientResult != null) + { + result.Data = httpClientResult; + } + } + } + catch (Exception ex) + { + _logger.LogWarning(ex, "GetInjureInfo接口出错"); + return ApiResult.IsFail($"GetInjureInfo接口出错{ex.Message}"); + } + + return result; + } + + /// + /// 得区域(空间)列表树数据 + /// + /// + /// + public async Task> GetRegionRootInfo(RegionRootInfoReqDto dto) + { + 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接口获取用户配置失败"); + } + dto.Ubpid = loginUsers.Data.Ubpid; + + HttpClientResult riskResult = await _tokenProviderService + .SendAndParseAsync>( + "https://zrh.szdunan.cn/v1/api/danger/rectification/check/detail", + token, dto, HttpMethod.Post); + + if (riskResult != null && riskResult.Data != null && riskResult.Data.ToString()!.Length > 10) + { + RegionStructureRootDto httpClientResult = JsonSerializer.Deserialize(riskResult.Data.ToString()!)!; + if (httpClientResult != null) + { + result.Data = httpClientResult; + } + } + } + catch (Exception ex) + { + _logger.LogWarning(ex, "GetRegionRootInfo接口出错"); + return ApiResult.IsFail($"GetRegionRootInfo接口出错{ex.Message}"); + } + + return result; + } } } \ No newline at end of file