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..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.1.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
new file mode 100644
index 0000000..44f7432
--- /dev/null
+++ b/WeiCloud.Fusion/Common.SharedService/Common.Shared.Application/SafetyFirePro/RequestDto/SunPlaceBoardWorkOrderReqDto.cs
@@ -0,0 +1,114 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.Json.Serialization;
+using System.Threading.Tasks;
+
+namespace Common.Shared.Application.SafetyFirePro.RequestDto
+{
+ ///
+ /// 工单查询参数实体类
+ ///
+ 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; }
+ }
+
+ ///
+ /// 作业任务查询参数实体类
+ ///
+ 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("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 7aca665..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
@@ -423,7 +423,8 @@ namespace Common.Shared.Application.SafetyFirePro.ResponseDto
/// 色块名称坐标位置
///
[JsonPropertyName("textPoint")]
- public List
-
-
-
-
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..4c8174c
--- /dev/null
+++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/ISunPlaceBoardWorkOrderService.cs
@@ -0,0 +1,13 @@
+using Common.Shared.Application.BaseModels;
+using Common.Shared.Application.SafetyFirePro.RequestDto;
+using Common.Shared.Application.SafetyFirePro.ResponseDto;
+
+namespace ThirdPartyServices.DomainService.PuCe
+{
+ public interface ISunPlaceBoardWorkOrderService
+ {
+ Task>> 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..78dd0cb
--- /dev/null
+++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/PuCe/SunPlaceBoardWorkOrderService.cs
@@ -0,0 +1,117 @@
+using Common.Shared.Application.BaseModels;
+using Common.Shared.Application.SafetyFirePro.RequestDto;
+using Common.Shared.Application.SafetyFirePro.ResponseDto;
+using Microsoft.Extensions.Logging;
+
+using System.Net.Http.Json;
+using System.Text.Json;
+using ThirdPartyServices.Application.ShenZhouShengAn.ResponseDto;
+
+namespace ThirdPartyServices.DomainService.PuCe
+{
+ public class SunPlaceBoardWorkOrderService : ISunPlaceBoardWorkOrderService
+ {
+ private readonly ILogger _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)
+ {
+ ApiResult> result = new ApiResult>() { Code = 200, Msg = "接口调用成功" };
+
+ var url = "https://zrh.hservices.online/prod-api/yzs/order/getRepairOrderList";
+
+ try
+ {
+ using var req = new HttpRequestMessage(HttpMethod.Get, url)
+ {
+ Content = JsonContent.Create(dto)
+ };
+ using var resp = await _http.SendAsync(req);
+ var body = await resp.Content.ReadAsStringAsync();
+
+ if (!resp.IsSuccessStatusCode)
+ {
+ _logger.LogWarning($"工单列表查询接口请求失败,{body}");
+ return ApiResult>.IsFail($"工单列表查询接口请求失败,{body}");
+ }
+
+ var httppReult = JsonSerializer.Deserialize>>(body);
+ if (httppReult != null && httppReult.Code == "200")
+ {
+ 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;
+ }
+
+ ///
+ /// 工单时间轴
+ ///
+ ///
+ ///
+ public async Task>> GetTimelineListByOrderId(string orderId)
+ {
+ ApiResult> result = new ApiResult>() { Code = 200, Msg = "调用接口成功" };
+
+ var url = $"https://zrh.hservices.online/prod-api/yzs/timeline/getTimelineListByOrderId?orderId={orderId}";
+
+ try
+ {
+ using var req = new HttpRequestMessage(HttpMethod.Get, url);
+ using var resp = await _http.SendAsync(req);
+ var body = await resp.Content.ReadAsStringAsync();
+
+ if (!resp.IsSuccessStatusCode)
+ {
+ _logger.LogWarning($"工单时间轴接口请求失败,{body}");
+ return ApiResult>.IsFail($"工单时间轴接口请求失败,{body}");
+ }
+
+ var httppReult = JsonSerializer.Deserialize>>(body);
+ if (httppReult != null && httppReult.Code == "200")
+ {
+ 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;
+ }
+ }
+}
\ No newline at end of file
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 aec2996..9500c8d 100644
--- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs
+++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/ISunPalaceBoardSafetyService.cs
@@ -1,30 +1,30 @@
-using Common.Shared.Application.SafetyFirePro.ResponseDto;
+using Common.Shared.Application.BaseModels;
+using Common.Shared.Application.SafetyFirePro.RequestDto;
+using Common.Shared.Application.SafetyFirePro.ResponseDto;
using System.Text.Json;
namespace ThirdPartyServices.DomainService.ShenZhouShengAn
{
public interface ISunPalaceBoardSafetyService
{
- //Task>> GetHiddenDangerTrend(SecSituationQueryDto dto);
-
- //Task>> GetIdCardAlarmEchart();
-
- Task GetProductionRiskEchart();
+ Task> GetProductionRiskEchart();
///
/// 获得四色图图层列表
///
/// 用户单位标记码
///
- Task GetListFloor();
+ Task> GetListFloor();
///
/// 获得四色图区域列表
///
/// 图层id
///
- Task GetRiskMapInfo(int floorId);
+ Task> GetRiskMapInfo(int floorId);
+
+ 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 8222437..3a8af5c 100644
--- a/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs
+++ b/WeiCloud.Fusion/ThirdPartyServices/ThirdPartyServices.DomainService/ShenZhouShengAn/SunPalaceBoardSafetyService.cs
@@ -1,4 +1,6 @@
-using Common.Shared.Application.SafetyFirePro.ResponseDto;
+using Common.Shared.Application.BaseModels;
+using Common.Shared.Application.SafetyFirePro.RequestDto;
+using Common.Shared.Application.SafetyFirePro.ResponseDto;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using MongoDB.Bson.IO;
@@ -27,9 +29,9 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
/// 用户单位标记码
///
///
- public async Task GetListFloor()
+ public async Task> GetListFloor()
{
- var result = new FloorResDto();
+ ApiResult result = new ApiResult() { Code = 200, Msg = "接口调用成功", Data = null };
try
{
@@ -38,7 +40,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (string.IsNullOrWhiteSpace(token))
{
_logger.LogWarning("GetListFloor接口获取token失败");
- return result;
+ return ApiResult.IsFail("GetListFloor接口获取token失败");
}
//获取用户配置
@@ -46,7 +48,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (loginUsers.Code == "Error")
{
_logger.LogWarning("GetListFloor接口获取用户配置失败");
- return result;
+ return ApiResult.IsFail("GetListFloor接口获取用户配置失败");
}
//生产风险识别
@@ -55,11 +57,15 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
"https://zrh.szdunan.cn/v1/api/riskFourcoloringMap/getlistFloor",
token, loginUsers.Data.Ubpid, HttpMethod.Post);
- result = new FloorResDto { Data = riskResult.Data };
+ if (riskResult.Data != null)
+ {
+ result.Data = new FloorResDto { Data = riskResult.Data };
+ }
}
catch (Exception ex)
{
_logger.LogWarning(ex, "GetListFloor接口出错");
+ return ApiResult.IsFail($"GetListFloor接口出错{ex.Message}");
}
return result;
@@ -70,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
@@ -84,7 +86,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (string.IsNullOrWhiteSpace(token))
{
_logger.LogWarning("GetProductionRiskEchart接口获取token失败");
- return result;
+ return ApiResult.IsFail("GetProductionRiskEchart接口获取token失败");
}
//获取用户配置
@@ -92,7 +94,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (loginUsers.Code == "Error")
{
_logger.LogWarning("GetProductionRiskEchart接口获取用户配置失败");
- return result;
+ return ApiResult.IsFail("GetProductionRiskEchart接口获取用户配置失败");
}
//获取单位信息
@@ -100,8 +102,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (branchs.Code == "Error")
{
_logger.LogWarning("GetProductionRiskEchart接口获取单位信息失败");
-
- return result;
+ return ApiResult.IsFail("GetProductionRiskEchart接口获取单位信息失败");
}
//生产风险识别
@@ -115,7 +116,8 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
Uid = loginUsers.Data.Uid
}, HttpMethod.Post);
- result.ProductionRiskStats = riskResult.Data.ProductionRiskStats;
+ if (riskResult.Code != "Error" || riskResult.Data != null)
+ result.Data.ProductionRiskStats = riskResult.Data.ProductionRiskStats;
//获取隐患信息
string[] dangerStatus = ["0", "1", "2",]; //0-待核查,1-待整改,2-待验收
@@ -173,11 +175,74 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
dangerInfo.Status = "3"; //待排查
dangerInfoList.Add(dangerInfo);
- result.DangerInfos = dangerInfoList;
+ result.Data.DangerInfos = dangerInfoList;
}
catch (Exception ex)
{
_logger.LogWarning(ex, "GetProductionRiskEchart接口出错");
+ return ApiResult.IsFail($"GetProductionRiskEchart接口出错{ex.Message}");
+ }
+ return result;
+ }
+
+ ///
+ /// 获取指定区域ID的隐患数据
+ ///
+ /// 返回本区域隐患(不包含下属子区域隐患)
+ /// 返回本区域及下属子区域隐患
+ ///
+ public async Task> GetDangerInfos(string? regionId, string? pRegionId)
+ {
+ ApiResult result = new() { Code = 200, Msg = "接口调用成功", Data = new() };
+ try
+ {
+ //获取token
+ var token = await _tokenProviderService.GetTokenAsync(_configuration["ThirdParty:SzdunanCode"]!);
+ if (string.IsNullOrWhiteSpace(token))
+ {
+ _logger.LogWarning("GetDangerInfos接口获取token失败");
+ return ApiResult.IsFail("GetDangerInfos接口获取token失败");
+ }
+
+ //获取用户配置
+ HttpClientResult loginUsers = await _tokenProviderService.GetUserConfiguration(token);
+ if (loginUsers.Code == "Error")
+ {
+ _logger.LogWarning("GetDangerInfos接口获取用户配置失败");
+ return ApiResult.IsFail("GetDangerInfos接口获取用户配置失败");
+ }
+
+ //获取单位信息
+ HttpClientResult branchs = await _tokenProviderService.GetBranchPermissions(token, loginUsers.Data.Uid);
+ if (branchs.Code == "Error")
+ {
+ _logger.LogWarning("GetDangerInfos接口获取单位信息失败");
+ return ApiResult.IsFail("GetDangerInfos接口获取单位信息失败");
+ }
+ var query = new DangerInfoQueryDto { Ubpid = loginUsers.Data.Ubpid, Status = "0" };
+
+ if (pRegionId != null && pRegionId.Length > 0)
+ {
+ query.P_region_id = long.Parse(pRegionId);
+ }
+
+ if (regionId != null && regionId.Length > 0)
+ {
+ query.Region_id = long.Parse(regionId);
+ }
+
+ var jsonResult = await _tokenProviderService.SendJsonAsync("https://zrh.szdunan.cn/v1/api/danger/ledger/dangerInfo/new", token, query, HttpMethod.Post);
+
+ var root = JsonSerializer.Deserialize>(jsonResult);
+ if (root != null)
+ {
+ result.Data = root.Data;
+ }
+ }
+ catch (Exception ex)
+ {
+ _logger.LogWarning(ex, "GetDangerInfos接口出错");
+ return ApiResult.IsFail($"GetDangerInfos接口出错{ex.Message}");
}
return result;
}
@@ -187,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
{
@@ -198,7 +263,7 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (string.IsNullOrWhiteSpace(token))
{
_logger.LogWarning("GetRiskMapInfo接口获取token失败");
- return result;
+ return ApiResult.IsFail("GetRiskMapInfo接口获取token失败");
}
//获取用户配置
@@ -206,24 +271,93 @@ namespace ThirdPartyServices.DomainService.ShenZhouShengAn
if (loginUsers.Code == "Error")
{
_logger.LogWarning("GetRiskMapInfo接口获取用户配置失败");
- return result;
+ return ApiResult.IsFail("GetRiskMapInfo接口获取用户配置失败");
}
//生产风险识别
- 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