package model import "gorm.io/gorm" type Energy struct { gorm.Model } type EnergyTree struct { Data []struct { Id int `json:"id"` Name string `json:"name"` ParentId int `json:"parentId"` PackingCode string `json:"packing_code"` PackingBuildingId int `json:"packing_building_id"` BuildingName string `json:"building_name"` PackingSort int `json:"packing_sort"` PackingFormula int `json:"packing_formula"` PackingEnergyTypeCode string `json:"packing_energy_type_code"` EnergyType []interface{} `json:"energy_type"` Children []struct { Id int `json:"id"` Name string `json:"name"` ParentId int `json:"parentId"` PackingCode string `json:"packing_code"` PackingBuildingId int `json:"packing_building_id"` BuildingName string `json:"building_name"` PackingSort int `json:"packing_sort"` PackingFormula int `json:"packing_formula"` PackingEnergyTypeCode string `json:"packing_energy_type_code"` EnergyType []struct { EnergyTypeId int `json:"energy_type_id"` EnergyTypeCode string `json:"energy_type_code"` EnergyTypeName string `json:"energy_type_name"` EnergyTypeUnit string `json:"energy_type_unit"` EnergyTypeSystematic int `json:"energy_type_systematic"` EnergyTypeSort int `json:"energy_type_sort"` EnergyTypeCategoryTypeId int `json:"energy_type_category_type_id"` FieldKey string `json:"field_key"` EnergyTypeAlias string `json:"energy_type_alias"` EnergyTypeIcons string `json:"energy_type_icons"` } `json:"energy_type"` Children []struct { Id int `json:"id"` Name string `json:"name"` ParentId int `json:"parentId"` PackingCode string `json:"packing_code"` PackingBuildingId int `json:"packing_building_id"` BuildingName string `json:"building_name"` PackingSort int `json:"packing_sort"` PackingFormula int `json:"packing_formula"` PackingEnergyTypeCode string `json:"packing_energy_type_code"` EnergyType []struct { EnergyTypeId int `json:"energy_type_id"` EnergyTypeCode string `json:"energy_type_code"` EnergyTypeName string `json:"energy_type_name"` EnergyTypeUnit string `json:"energy_type_unit"` EnergyTypeSystematic int `json:"energy_type_systematic"` EnergyTypeSort int `json:"energy_type_sort"` EnergyTypeCategoryTypeId int `json:"energy_type_category_type_id"` FieldKey string `json:"field_key"` EnergyTypeAlias string `json:"energy_type_alias"` EnergyTypeIcons string `json:"energy_type_icons"` } `json:"energy_type"` Children []struct { Id int `json:"id"` Name string `json:"name"` ParentId int `json:"parentId"` PackingCode string `json:"packing_code"` PackingBuildingId int `json:"packing_building_id"` BuildingName string `json:"building_name"` PackingSort int `json:"packing_sort"` PackingFormula int `json:"packing_formula"` PackingEnergyTypeCode string `json:"packing_energy_type_code"` EnergyType []struct { EnergyTypeId int `json:"energy_type_id"` EnergyTypeCode string `json:"energy_type_code"` EnergyTypeName string `json:"energy_type_name"` EnergyTypeUnit string `json:"energy_type_unit"` EnergyTypeSystematic int `json:"energy_type_systematic"` EnergyTypeSort int `json:"energy_type_sort"` EnergyTypeCategoryTypeId int `json:"energy_type_category_type_id"` FieldKey string `json:"field_key"` EnergyTypeAlias string `json:"energy_type_alias"` EnergyTypeIcons string `json:"energy_type_icons"` } `json:"energy_type"` Children []interface{} `json:"children"` ValidAlert int `json:"valid_alert"` EnergyTypeCategoryTypeId int `json:"energy_type_category_type_id"` } `json:"children"` ValidAlert int `json:"valid_alert"` EnergyTypeCategoryTypeId int `json:"energy_type_category_type_id"` } `json:"children"` ValidAlert int `json:"valid_alert"` EnergyTypeCategoryTypeId int `json:"energy_type_category_type_id"` } `json:"children"` ValidAlert int `json:"valid_alert"` EnergyTypeCategoryTypeId int `json:"energy_type_category_type_id"` } `json:"data"` } type T struct { RespJson string `json:"resp_json"` } type Request struct { TimeType string `json:"time_type"` Nodes []int `json:"nodes"` StartTime string `json:"start_time"` EndTime string `json:"end_time"` } // EnergyTrend 能耗趋势结构体,用于表示某个建筑或组织在不同时间点的能源消耗趋势数据 type EnergyTrend struct { BuildId int `json:"build_id"` // 建筑ID,表示该能耗数据所属的建筑编号 EnergyType []struct { // 能源类型信息,描述该条记录涉及的能源类型 EnergyTypeAlias string `json:"energy_type_alias"` // 能源类型别名,用于显示名称 EnergyTypeIcons string `json:"energy_type_icons"` // 能源类型图标,用于前端展示 EnergyTypeUnit string `json:"energy_type_unit"` // 能源单位,如“千瓦时” FieldKey string `json:"field_key"` // 字段标识符,用于后端识别该能源类型 } `json:"energy_type"` // 能源类型数组,包含多个能源类型的详细信息 Id int `json:"id"` // 记录唯一标识,用于区分不同的能耗趋势记录 Index int `json:"index"` // 排序索引,用于排序展示多条记录 Json []struct { // 时间维度下的能耗数据集合 DeviceUsage []struct { // 设备使用情况,记录每个设备在该时间点的能耗数据 EPE float64 `json:"EPE"` // 实际能耗值(Electric Power Equivalent) EPEForecast float64 `json:"EPE_forecast,omitempty"` // 预测能耗值 Column int `json:"column"` // 列号,用于前端表格展示定位 DevicesName string `json:"devices_name"` // 设备名称 FormulaProportion int `json:"formula_proportion"` // 公式比例,参与计算总能耗的权重 MaxEPE float64 `json:"max_EPE"` // 最大实际能耗值 MaxEPEForecast float64 `json:"max_EPE_forecast,omitempty"` // 最大预测能耗值 MinEPE float64 `json:"min_EPE"` // 最小实际能耗值 MinEPEForecast float64 `json:"min_EPE_forecast,omitempty"` // 最小预测能耗值 } `json:"device_usage"` // 设备使用情况数组 Time string `json:"time"` // 时间点,表示当前记录的时间戳,格式如"2023-10-01" TotalUsage struct { // 总计能耗,表示该时间点所有设备的综合能耗 EPE float64 `json:"EPE"` // 实际总能耗值 EPEForecast float64 `json:"EPE_forecast"` // 预测总能耗值 MaxEPE float64 `json:"max_EPE"` // 最大实际总能耗值 MaxEPEForecast float64 `json:"max_EPE_forecast"` // 最大预测总能耗值 MinEPE float64 `json:"min_EPE"` // 最小实际总能耗值 MinEPEForecast float64 `json:"min_EPE_forecast"` // 最小预测总能耗值 } `json:"total_usage"` // 总计能耗数据 } `json:"json"` // 包含多个时间点的能耗数据集合 OrgId int `json:"org_id"` // 组织ID,表示该能耗数据所属的组织编号 PackingCode string `json:"packing_code"` // 打包代码,用于标识数据来源或分类规则 PackingName string `json:"packing_name"` // 打包名称,用于前端展示打包的名称 } // DayAndNightRequst 昼夜请求参数 type DayAndNightRequst struct { TimeType string `json:"time_type"` Node int `json:"node"` StartTime string `json:"start_time"` EndTime string `json:"end_time"` DayTime string `json:"dayTime"` NightTime string `json:"nightTime"` } // DayAndNightRespone 昼夜返回参数 type DayAndNightRespone struct { Data []struct { Time string `json:"time"` TotalUsage string `json:"total_usage"` DayUsage string `json:"day_usage"` } `json:"data"` } // CategoryStatistics 设备分类统计结构体 type CategoryStatistics struct { CategoryStatistics []struct { CategoryId int `json:"category_id"` CategoryName string `json:"category_name"` Total int `json:"total"` TypeStatistics []struct { DevicesTypeId int `json:"devices_type_id"` DevicesTypeName string `json:"devices_type_name"` Total int `json:"total"` OnLine int `json:"on_line"` OffLine int `json:"off_line"` } `json:"type_statistics"` CategorySort int `json:"category_sort"` OnLine int `json:"on_line"` OffLine int `json:"off_line"` } `json:"category_statistics"` } // DevicesJsonObject 设备数据结构体 type DevicesJsonObject struct { EPE float64 `json:"EPE"` DevUdid string `json:"dev_udid"` DisDevName string `json:"dis_dev_name"` } // TotalWater 总用水结构体 type TotalWater struct { DevUdid string `json:"dev_udid"` DisDevName string `json:"dis_dev_name"` TotalWater int `json:"total_water"` } // HisData 历史数据结构体 type HisData struct { Data []struct { DevicesId int `json:"devices_id"` DevicesUdid string `json:"devices_udid"` DevicesTypeId int `json:"devices_type_id"` DevicesName string `json:"devices_name"` DevicesReqInterval int `json:"devices_req_interval"` DevicesLastRequestTime string `json:"devices_last_request_time"` DevicesJsonObject string `json:"devices_json_object"` DevicesEnabled int `json:"devices_enabled"` DevicesCreated string `json:"devices_created"` DevicesSource string `json:"devices_source"` DevicesDescription string `json:"devices_description"` ExtendId int `json:"extend_id"` BaseId int `json:"base_id"` Longitude string `json:"longitude"` Latitude string `json:"latitude"` ExtendJson string `json:"extend_json"` Adcode string `json:"adcode"` McuFirmwareVer string `json:"mcu_firmware_ver"` WifiFirmwareVer string `json:"wifi_firmware_ver"` McuProgramCode string `json:"mcu_program_code"` UpdatePrior int `json:"update_prior"` LastUpdateQueueTime string `json:"last_update_queue_time"` LastUpdateValue int `json:"last_update_value"` UtcDeviation int `json:"utc_deviation"` ConsecutiveUpdateTimes int `json:"consecutive_update_times"` UpgradeOption int `json:"upgrade_option"` DevicesTypeCode string `json:"devices_type_code"` DevicesTypeName string `json:"devices_type_name"` DevicesTypeWiredWireless int `json:"devices_type_wired_wireless"` DevicesTypeCategoryId int `json:"devices_type_category_id"` DevicesTypeSort int `json:"devices_type_sort"` DevicesTypeCharging int `json:"devices_type_charging"` CategoryId int `json:"category_id"` CategoryClassification string `json:"category_classification"` CategoryName string `json:"category_name"` CategorySystematic int `json:"category_systematic"` CategorySort int `json:"category_sort"` GatewayId int `json:"gateway_id"` GatewayCode string `json:"gateway_code"` GatewayDescription string `json:"gateway_description"` GatewayOrgId int `json:"gateway_org_id"` GatewayStatus int `json:"gateway_status"` GatewayLastRequestTime string `json:"gateway_last_request_time"` DevicesGatewayId int `json:"devices_gateway_id"` RoomId int `json:"room_id"` RoomRegionId int `json:"room_region_id"` RoomName string `json:"room_name"` RoomUserId int `json:"room_user_id"` RoomCheckinDate string `json:"room_checkin_date"` RoomCheckoutDate string `json:"room_checkout_date"` RegionId int `json:"region_id"` RegionBuildingId int `json:"region_building_id"` RegionName string `json:"region_name"` RegionParentId int `json:"region_parent_id"` OnLine int `json:"on_line"` RealDeviceName string `json:"real_device_name"` DeviceDataStatus int `json:"device_data_status"` BuildingId int `json:"building_id"` BuildingName string `json:"building_name"` ProvinceId int `json:"province_id"` ProvinceName string `json:"province_name"` CityId int `json:"city_id"` CityName string `json:"city_name"` CountyId int `json:"county_id"` CountyName string `json:"county_name"` OfflineConsecutiveTimes int `json:"offline_consecutive_times"` OfflineInterval int `json:"offline_interval"` OfflineLastRequestTime string `json:"offline_last_request_time"` DataFrom string `json:"data_from"` OriginalMcuFirmwareVer string `json:"original_mcu_firmware_ver"` OriginalWifiFirmwareVer string `json:"original_wifi_firmware_ver"` Ip string `json:"ip"` LastRequestTimestampInSeconds string `json:"lastRequestTimestampInSeconds"` RoomType string `json:"room_type"` GatewayName string `json:"gateway_name"` LastFreqTimestamp string `json:"last_freq_timestamp"` UpgradeFreq bool `json:"upgrade_freq"` DeviceVer string `json:"device_ver"` LastUpdateSuccessTime string `json:"last_update_success_time"` DownloadPercent int `json:"download_percent"` FileDeviceVersion string `json:"file_device_version"` ProgramName string `json:"program_name"` GatewayType int `json:"gateway_type"` FullRegionName string `json:"full_region_name"` DevicesReplaceStatus int `json:"devices_replace_status"` DevicesReplaceApplyStatus int `json:"devices_replace_apply_status"` } `json:"data"` Count int `json:"count"` } func (m *Energy) TableName() string { return "energy" }