소스 검색

chore(api): 添加能耗分析相关接口

wangcong 1 개월 전
부모
커밋
1dd9ee6ec7
2개의 변경된 파일71개의 추가작업 그리고 0개의 파일을 삭제
  1. 16 0
      src/api/index.ts
  2. 55 0
      src/types/index.ts

+ 16 - 0
src/api/index.ts

@@ -28,6 +28,8 @@ import type {
   DevWorkRealTimeData,
   DictTypeData,
   DictTypeDataParams,
+  ElectricityStatisticsQuery,
+  ElectricityStatisticsResult,
   EquipmentDetailsItem,
   EquipmentInformationForm,
   EquipmentTypeItem,
@@ -685,6 +687,20 @@ export const orgGatewaySerialNumber = async (protocolList: ProtocolList) => {
   return data;
 };
 
+// 能耗分析
+
+export const getElectricityDataStatistics = async (params: ElectricityStatisticsQuery) => {
+  const data = await request<ElectricityStatisticsResult>(
+    apiBiz('/deviceElectricityDataChange/getElectricityDataStatistics'),
+    {
+      method: 'POST',
+      body: JSON.stringify(params),
+    },
+  );
+
+  return data;
+};
+
 // 平台标准协议参数
 
 export const getProtocolStandardParam = async (paramId: number) => {

+ 55 - 0
src/types/index.ts

@@ -1749,3 +1749,58 @@ export interface AlarmEventHistoryItem {
   type: number;
   errorMsg: string;
 }
+
+export interface EnergyCardItem {
+  value: string | number;
+  unit: string;
+  description: string;
+  icon: string;
+  bgColor: string;
+}
+
+export interface ElectricityStatisticsQuery {
+  deviceId?: number | string;
+  deviceGroupId: number;
+  deviceTypes?: number[];
+  startTime: string;
+  endTime: string;
+}
+
+export interface ElectricityDeviceValue {
+  deviceName: string;
+  deviceId: number;
+  time: string;
+  bill: number;
+  energy: number;
+  dailyUse: number;
+  ratio: number;
+}
+
+export interface ElectricityHisQueryVo {
+  deviceType: string;
+  deviceTypeName: string;
+  groupName?: string | null;
+  valueList: ElectricityDeviceValue[];
+}
+
+export interface ElectricityGroupQueryVo {
+  deviceType: string;
+  deviceTypeName: string;
+  groupName?: string | null;
+  valueList: ElectricityDeviceValue[];
+  totalRatio: number;
+  totalEnergy: number;
+  totalEnergyW: number;
+  totalBill: number;
+  totalBillW: number;
+  totalDailyUse: number;
+}
+
+export interface ElectricityStatisticsResult {
+  cumulativeEnergy: number;
+  cumulativeBill: number;
+  ringGrowth: number;
+  cumulativeDailyUse: number;
+  hisQueryVos: ElectricityHisQueryVo[];
+  groupQueryVos: ElectricityGroupQueryVo[];
+}