Add monitoring metrics, numeric sorting, report-time display, vehicle number labels, and map layout fixes. Include accumulated mileage, hydrogen, OneOS authentication, open platform, ingestion, deployment, and UI updates. Exclude temporary files, generated reports, and credentials. Validate frontend 632 tests and production build, API packages, vehicle-map tests, and release installer tests. Gateway suite has one pre-existing date-sensitive identity throttling test failure reproduced on the parent commit.
558 lines
18 KiB
Go
558 lines
18 KiB
Go
package openplatform
|
|
|
|
import (
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
StatusNormal = "NORMAL"
|
|
StatusNoData = "NO_DATA"
|
|
StatusDataAnomaly = "DATA_ANOMALY"
|
|
)
|
|
|
|
type QueryRequest struct {
|
|
PlateNumbers []string `json:"plateNumbers"`
|
|
Date string `json:"date"`
|
|
ProtocolPriority ProtocolPriority `json:"protocolPriority,omitempty"`
|
|
}
|
|
|
|
type MileageRangeRequest struct {
|
|
StartDate string `json:"startDate"`
|
|
EndDate string `json:"endDate"`
|
|
PlateNumbers []string `json:"plateNumbers"`
|
|
ProtocolPriority ProtocolPriority `json:"protocolPriority,omitempty"`
|
|
Cursor string `json:"cursor"`
|
|
PageSize int `json:"pageSize"`
|
|
}
|
|
|
|
type ProtocolPriority struct {
|
|
Values []string
|
|
Present bool
|
|
}
|
|
|
|
func (p *ProtocolPriority) UnmarshalJSON(data []byte) error {
|
|
p.Present = true
|
|
if string(data) == "null" {
|
|
p.Values = []string{}
|
|
return nil
|
|
}
|
|
var values []string
|
|
if err := json.Unmarshal(data, &values); err != nil {
|
|
return err
|
|
}
|
|
p.Values = values
|
|
return nil
|
|
}
|
|
|
|
type HydrogenResult struct {
|
|
VIN string `json:"vin"`
|
|
StatisticsStartTime *string `json:"statisticsStartTime"`
|
|
StatisticsEndTime *string `json:"statisticsEndTime"`
|
|
UpdatedAt *string `json:"updatedAt"`
|
|
PlateNumber string `json:"plateNumber"`
|
|
Date string `json:"date"`
|
|
HydrogenConsumptionKg *float64 `json:"hydrogenConsumptionKg"`
|
|
CalculationPhase string `json:"calculationPhase,omitempty"`
|
|
AlgorithmVersion string `json:"algorithmVersion,omitempty"`
|
|
QualityStatus string `json:"qualityStatus,omitempty"`
|
|
QualityReason string `json:"qualityReason,omitempty"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type MileageResult struct {
|
|
StatisticsStartTime *string `json:"statisticsStartTime"`
|
|
StatisticsEndTime *string `json:"statisticsEndTime"`
|
|
VIN string `json:"vin"`
|
|
PlateNumber string `json:"plateNumber"`
|
|
Date string `json:"date"`
|
|
DailyMileageKm *float64 `json:"dailyMileageKm"`
|
|
TotalMileageKm *float64 `json:"totalMileageKm"`
|
|
DataTime *string `json:"dataTime"`
|
|
UpdatedAt *string `json:"updatedAt"`
|
|
SourceProtocol *string `json:"sourceProtocol"`
|
|
DataQuality *string `json:"dataQuality,omitempty"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type MileageRangeResult struct {
|
|
VIN string `json:"vin"`
|
|
PlateNumber string `json:"plateNumber"`
|
|
Date string `json:"date"`
|
|
DailyMileageKm *float64 `json:"dailyMileageKm"`
|
|
TotalMileageKm *float64 `json:"totalMileageKm"`
|
|
DataTime *string `json:"dataTime"`
|
|
UpdatedAt *string `json:"updatedAt"`
|
|
SourceProtocol *string `json:"sourceProtocol"`
|
|
DataQuality *string `json:"dataQuality,omitempty"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type TotalMileageQueryRequest struct {
|
|
VIN string `json:"vin"`
|
|
Time string `json:"time"`
|
|
Protocol string `json:"protocol,omitempty"`
|
|
}
|
|
|
|
type TotalMileageResult struct {
|
|
VIN string `json:"vin"`
|
|
QueryTime string `json:"queryTime"`
|
|
TotalMileageKm *float64 `json:"totalMileageKm"`
|
|
Protocol string `json:"protocol,omitempty"`
|
|
ProtocolInput string `json:"protocolInput,omitempty"`
|
|
MileageMeaning string `json:"mileageMeaning,omitempty"`
|
|
RecordTime string `json:"recordTime,omitempty"`
|
|
TimeDifferenceSeconds *int64 `json:"timeDifferenceSeconds,omitempty"`
|
|
SelectionPolicy string `json:"selectionPolicy"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type TotalMileagePoint struct {
|
|
VIN string
|
|
Protocol string
|
|
ObservedAt time.Time
|
|
TotalMileageKm float64
|
|
}
|
|
|
|
// StationaryVehicleQueryRequest verifies whether an authorized vehicle stayed
|
|
// at a refuelling-site coordinate during a supplied time window. Coordinates
|
|
// may be supplied in WGS84 or GCJ02 (Amap) longitude/latitude.
|
|
type StationaryVehicleQueryRequest struct {
|
|
StartTime string `json:"startTime"`
|
|
EndTime string `json:"endTime"`
|
|
Longitude float64 `json:"longitude"`
|
|
Latitude float64 `json:"latitude"`
|
|
CoordinateSystem string `json:"coordinateSystem,omitempty"`
|
|
RadiusMeters *float64 `json:"radiusMeters,omitempty"`
|
|
PlateNumbers []string `json:"plateNumbers,omitempty"`
|
|
}
|
|
|
|
type StationaryVehicleResult struct {
|
|
VIN string `json:"vin"`
|
|
PlateNumber string `json:"plateNumber"`
|
|
StayStartTime string `json:"stayStartTime"`
|
|
StayEndTime string `json:"stayEndTime"`
|
|
StayDurationSeconds int64 `json:"stayDurationSeconds"`
|
|
StayDurationMinutes float64 `json:"stayDurationMinutes"`
|
|
MatchScore float64 `json:"matchScore"`
|
|
AverageDistanceM float64 `json:"averageDistanceMeters"`
|
|
MaxDistanceM float64 `json:"maxDistanceMeters"`
|
|
AverageSpeedKmh float64 `json:"averageSpeedKmh"`
|
|
MaxSpeedKmh float64 `json:"maxSpeedKmh"`
|
|
MatchedSamples int `json:"matchedSamples"`
|
|
SourceProtocols []string `json:"sourceProtocols"`
|
|
}
|
|
|
|
type StationaryLocationPoint struct {
|
|
VIN string
|
|
Protocol string
|
|
ObservedAt time.Time
|
|
Longitude float64
|
|
Latitude float64
|
|
SpeedKmh float64
|
|
}
|
|
|
|
type RealtimeVehicleRequest struct {
|
|
PlateNumbers []string `json:"plateNumbers,omitempty"`
|
|
}
|
|
|
|
type RealtimeVehiclePoint struct {
|
|
LiveHydrogen RealtimeHydrogenData
|
|
LocationObservedAt time.Time
|
|
LocationEventID string
|
|
LocationReceivedAt time.Time
|
|
GPSFixStatus string
|
|
CoordinateSystem string
|
|
VIN string
|
|
Protocol string
|
|
Longitude float64
|
|
Latitude float64
|
|
SpeedKmh float64
|
|
SOCPercent *float64
|
|
TotalMileageKm float64
|
|
TotalMileageAvailable *bool
|
|
ObservedAt time.Time
|
|
Online bool
|
|
ActiveToday bool
|
|
}
|
|
|
|
type RealtimeVehicleResult struct {
|
|
RealtimeHydrogenData
|
|
GPSFixStatus string `json:"gpsFixStatus"`
|
|
LocationRecordTime *string `json:"locationRecordTime"`
|
|
CoordinateSystem string `json:"coordinateSystem"`
|
|
VIN string `json:"vin"`
|
|
PlateNumber string `json:"plateNumber"`
|
|
// Protocol is the single, canonical source protocol for this realtime record.
|
|
// It is normalized to GB32960, MQTT, or JT808.
|
|
Protocol string `json:"protocol,omitempty"`
|
|
Longitude *float64 `json:"longitude"`
|
|
Latitude *float64 `json:"latitude"`
|
|
SpeedKmh *float64 `json:"speedKmh"`
|
|
SOCPercent *float64 `json:"socPercent,omitempty"`
|
|
TotalMileageKm *float64 `json:"totalMileageKm"`
|
|
RecordTime string `json:"recordTime,omitempty"`
|
|
TimeDifferenceSeconds *int64 `json:"timeDifferenceSeconds,omitempty"`
|
|
Online bool `json:"online"`
|
|
ActiveToday bool `json:"activeToday"`
|
|
MotionStatus string `json:"motionStatus"`
|
|
LocationAvailable bool `json:"locationAvailable"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type HydrogenStationRequest struct {
|
|
Province string `json:"province,omitempty"`
|
|
City string `json:"city,omitempty"`
|
|
CooperateOnly *bool `json:"cooperateOnly,omitempty"`
|
|
}
|
|
|
|
type HydrogenStation struct {
|
|
ID string `json:"id"`
|
|
Name string `json:"name"`
|
|
ShortName string `json:"shortName,omitempty"`
|
|
Address string `json:"address,omitempty"`
|
|
Longitude float64 `json:"longitude"`
|
|
Latitude float64 `json:"latitude"`
|
|
Province string `json:"province,omitempty"`
|
|
City string `json:"city,omitempty"`
|
|
District string `json:"district,omitempty"`
|
|
Cooperative bool `json:"cooperative"`
|
|
ContactPerson string `json:"contactPerson,omitempty"`
|
|
ContactPhone string `json:"contactPhone,omitempty"`
|
|
UnitPrice float64 `json:"unitPrice,omitempty"`
|
|
MonthlyHydrogenKg float64 `json:"monthlyHydrogenKg"`
|
|
TotalHydrogenKg float64 `json:"totalHydrogenKg"`
|
|
}
|
|
|
|
type ExternalResponse struct {
|
|
Code string `json:"code"`
|
|
Message string `json:"message"`
|
|
Data any `json:"data,omitempty"`
|
|
TraceID string `json:"traceId"`
|
|
}
|
|
|
|
type MileageRangeResponse struct {
|
|
Code string `json:"code"`
|
|
Message string `json:"message"`
|
|
Data []MileageRangeResult `json:"data"`
|
|
SnapshotID string `json:"snapshotId"`
|
|
NextCursor *string `json:"nextCursor"`
|
|
TraceID string `json:"traceId"`
|
|
}
|
|
|
|
type App struct {
|
|
ID uint64 `json:"id"`
|
|
Name string `json:"name"`
|
|
AppKeyPrefix string `json:"appKeyPrefix"`
|
|
Status string `json:"status"`
|
|
ValidFrom time.Time `json:"validFrom"`
|
|
ValidTo *time.Time `json:"validTo,omitempty"`
|
|
CreatedBy string `json:"createdBy"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
type AppCreated struct {
|
|
App
|
|
AppKey string `json:"appKey"`
|
|
}
|
|
|
|
type AppInput struct {
|
|
Name string `json:"name"`
|
|
Status string `json:"status"`
|
|
ValidFrom string `json:"validFrom"`
|
|
ValidTo string `json:"validTo"`
|
|
}
|
|
|
|
type VehicleGrantInput struct {
|
|
VIN string `json:"vin"`
|
|
ValidFrom string `json:"validFrom"`
|
|
ValidTo string `json:"validTo"`
|
|
}
|
|
|
|
type VehicleGrantRequest struct {
|
|
Vehicles []VehicleGrantInput `json:"vehicles"`
|
|
}
|
|
|
|
type VehicleGrant struct {
|
|
VIN string `json:"vin"`
|
|
Plate string `json:"plate"`
|
|
ValidFrom time.Time `json:"validFrom"`
|
|
ValidTo *time.Time `json:"validTo,omitempty"`
|
|
GrantedBy string `json:"grantedBy"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
type VehicleCatalogItem struct {
|
|
VIN string `json:"vin"`
|
|
Plate string `json:"plate"`
|
|
OEM string `json:"oem"`
|
|
Status string `json:"status"`
|
|
Source string `json:"source"`
|
|
}
|
|
|
|
type AuthorizedVehicle struct {
|
|
VIN string
|
|
Plate string
|
|
}
|
|
|
|
type AppCredential struct {
|
|
ID uint64
|
|
Name string
|
|
}
|
|
|
|
type DailyHydrogen struct {
|
|
EvidenceJSON string
|
|
UpdatedAt string
|
|
VIN string
|
|
Date string
|
|
ConsumptionKg float64
|
|
SampleCount int
|
|
QualityStatus string
|
|
QualityReason string
|
|
CalculationPhase string
|
|
AlgorithmVersion string
|
|
}
|
|
|
|
type DailyMileage struct {
|
|
// PlatformMileage confirms this source matches the selected, quality-passed daily projection.
|
|
PlatformMileage bool
|
|
SourceKey string
|
|
DataQuality string
|
|
StatisticsStartTime string
|
|
VIN string
|
|
Date string
|
|
Protocol string
|
|
MileageKm float64
|
|
TotalMileageKm float64
|
|
DataTime string
|
|
UpdatedAt string
|
|
}
|
|
|
|
type MileageSnapshot struct {
|
|
ID string
|
|
AppID uint64
|
|
RequestHash []byte
|
|
StartDate string
|
|
EndDate string
|
|
VehicleCount int
|
|
ExpiresAt time.Time
|
|
Vehicles []AuthorizedVehicle
|
|
}
|
|
|
|
type HydrogenObservation struct {
|
|
VIN string
|
|
Source string
|
|
EventID string
|
|
ObservedAt time.Time
|
|
MassKg float64
|
|
TankCapacityLiter float64
|
|
PressureMPa float64
|
|
TemperatureC float64
|
|
NoiseKg float64
|
|
RefuelThresholdKg float64
|
|
FuelCellActive bool
|
|
FuelCellStateKnown bool
|
|
FuelCellVoltageV float64
|
|
FuelCellCurrentA float64
|
|
FuelCellPowerKnown bool
|
|
SOCPercent float64
|
|
SOCKnown bool
|
|
MileageKm float64
|
|
MileageKnown bool
|
|
VehicleState int
|
|
VehicleStateKnown bool
|
|
ChargeState int
|
|
ChargeStateKnown bool
|
|
RunningMode int
|
|
RunningModeKnown bool
|
|
BoundaryEligible bool
|
|
BoundaryReason string
|
|
RefuelBoundary bool
|
|
RefuelAmountKg float64
|
|
PressureInvalid bool
|
|
}
|
|
|
|
type HydrogenCalculationParameters struct {
|
|
BatteryCapacityKWh float64 `json:"batteryCapacityKWh"`
|
|
HydrogenEnergyKWhKg float64 `json:"hydrogenEnergyKWhPerKg"`
|
|
PowerOnDelaySeconds int `json:"powerOnDelaySeconds"`
|
|
PowerOffLeadSeconds int `json:"powerOffLeadSeconds"`
|
|
RefuelRiseMPa float64 `json:"refuelRiseMpa"`
|
|
RefuelSustainSeconds int `json:"refuelSustainSeconds"`
|
|
PureElectricDropMPA float64 `json:"pureElectricDropMpa"`
|
|
PureElectricWindowSeconds int `json:"pureElectricWindowSeconds"`
|
|
InitialChargeCycleKnown bool `json:"initialChargeCycleKnown,omitempty"`
|
|
InitialMixedLocked bool `json:"initialMixedLocked,omitempty"`
|
|
AlgorithmVersion string `json:"algorithmVersion"`
|
|
}
|
|
|
|
type HydrogenIntervalEvidence struct {
|
|
Index int `json:"index"`
|
|
Type string `json:"type"`
|
|
StartTime string `json:"startTime"`
|
|
EndTime string `json:"endTime"`
|
|
StartEventID string `json:"startEventId"`
|
|
EndEventID string `json:"endEventId"`
|
|
Source string `json:"source"`
|
|
StartPressureMPa float64 `json:"startPressureMpa"`
|
|
EndPressureMPa float64 `json:"endPressureMpa"`
|
|
StartTemperatureC float64 `json:"startTemperatureC"`
|
|
EndTemperatureC float64 `json:"endTemperatureC"`
|
|
StartMassKg float64 `json:"startMassKg"`
|
|
EndMassKg float64 `json:"endMassKg"`
|
|
RawHydrogenConsumptionKg float64 `json:"rawHydrogenConsumptionKg"`
|
|
StartSOCPercent *float64 `json:"startSocPercent,omitempty"`
|
|
EndSOCPercent *float64 `json:"endSocPercent,omitempty"`
|
|
BatterySOCDeltaPct *float64 `json:"batterySocDeltaPct,omitempty"`
|
|
BatteryEnergyChangeKWh *float64 `json:"batteryEnergyChangeKWh,omitempty"`
|
|
ElectricEquivalentKg *float64 `json:"electricEquivalentHydrogenKg,omitempty"`
|
|
CorrectedConsumptionKg *float64 `json:"correctedHydrogenConsumptionKg,omitempty"`
|
|
BatteryDischargeKWh *float64 `json:"batteryDischargeKWh,omitempty"`
|
|
BatteryEquivalentKg *float64 `json:"batteryEquivalentKg,omitempty"`
|
|
SOCBalancedConsumptionKg *float64 `json:"socBalancedConsumptionKg,omitempty"`
|
|
StartMileageKm *float64 `json:"startMileageKm,omitempty"`
|
|
EndMileageKm *float64 `json:"endMileageKm,omitempty"`
|
|
MileageKm *float64 `json:"mileageKm,omitempty"`
|
|
ConsumptionKgPer100Km *float64 `json:"consumptionKgPer100Km,omitempty"`
|
|
SampleCount int `json:"sampleCount"`
|
|
QualityStatus string `json:"qualityStatus"`
|
|
QualityReason string `json:"qualityReason"`
|
|
}
|
|
|
|
type HydrogenRateObservation struct {
|
|
VIN string
|
|
Source string
|
|
ObservedAt time.Time
|
|
Rate float64
|
|
MileageKm float64
|
|
}
|
|
|
|
type HydrogenRateDailyStat struct {
|
|
VIN string
|
|
Source string
|
|
Date string
|
|
ConsumptionKg float64
|
|
SampleCount int
|
|
QualityStatus string
|
|
QualityReason string
|
|
}
|
|
|
|
type HydrogenDailyStat struct {
|
|
VIN string
|
|
Source string
|
|
Date string
|
|
ConsumptionKg float64
|
|
FirstMassKg float64
|
|
LastMassKg float64
|
|
CycleMinimumMassKg float64
|
|
SampleCount int
|
|
RefuelCount int
|
|
RefuelAmountKg float64
|
|
AbnormalDropCount int
|
|
SuspectedLeakCount int
|
|
SuspectedLeakMaxPressureDropMPa float64
|
|
EligibleIntervalCount int
|
|
QualifiedSegmentCount int
|
|
ChargeCount int
|
|
ChargeEnergyKWh float64
|
|
InvalidSegmentCount int
|
|
BatterySOCDeltaPct *float64
|
|
BatteryEnergyChangeKWh *float64
|
|
ElectricEquivalentKg *float64
|
|
CorrectedConsumptionKg *float64
|
|
BatteryDischargeKWh *float64
|
|
BatteryEquivalentKg *float64
|
|
SOCBalancedConsumptionKg *float64
|
|
MixedMileageKm float64
|
|
PureElectricMileageKm float64
|
|
ConsumptionKgPer100Km *float64
|
|
SOCBalancedKgPer100Km *float64
|
|
CalculationParameters HydrogenCalculationParameters
|
|
Intervals []HydrogenIntervalEvidence
|
|
HydrogenIntervals []HydrogenIntervalEvidence
|
|
FirstObservation HydrogenObservation
|
|
LastObservation HydrogenObservation
|
|
QualityStatus string
|
|
QualityReason string
|
|
}
|
|
|
|
type PortalUser struct {
|
|
ID uint64 `json:"id"`
|
|
Username string `json:"username"`
|
|
DisplayName string `json:"displayName"`
|
|
Status string `json:"status"`
|
|
ValidFrom time.Time `json:"validFrom"`
|
|
ValidTo *time.Time `json:"validTo,omitempty"`
|
|
LastLoginAt *time.Time `json:"lastLoginAt,omitempty"`
|
|
CreatedBy string `json:"createdBy"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
type PortalUserInput struct {
|
|
Username string `json:"username"`
|
|
DisplayName string `json:"displayName"`
|
|
Password string `json:"password"`
|
|
Status string `json:"status"`
|
|
ValidFrom string `json:"validFrom"`
|
|
ValidTo string `json:"validTo"`
|
|
}
|
|
|
|
type PortalUserAppInput struct {
|
|
AppID uint64 `json:"appId"`
|
|
Role string `json:"role"`
|
|
}
|
|
|
|
type PortalUserAppRequest struct {
|
|
Apps []PortalUserAppInput `json:"apps"`
|
|
}
|
|
|
|
type PortalUserApp struct {
|
|
AppID uint64 `json:"appId"`
|
|
AppName string `json:"appName"`
|
|
AppKeyPrefix string `json:"appKeyPrefix"`
|
|
AppStatus string `json:"appStatus"`
|
|
Role string `json:"role"`
|
|
ValidFrom time.Time `json:"validFrom"`
|
|
ValidTo *time.Time `json:"validTo,omitempty"`
|
|
}
|
|
|
|
type PortalSession struct {
|
|
UserID uint64 `json:"userId"`
|
|
Username string `json:"username"`
|
|
DisplayName string `json:"displayName"`
|
|
UserType string `json:"userType"`
|
|
ExpiresAt time.Time `json:"expiresAt"`
|
|
}
|
|
|
|
type PortalLoginResponse struct {
|
|
AccessToken string `json:"accessToken"`
|
|
ExpiresAt time.Time `json:"expiresAt"`
|
|
Session PortalSession `json:"session"`
|
|
}
|
|
|
|
type PortalLoginRequest struct {
|
|
Username string `json:"username"`
|
|
Password string `json:"password"`
|
|
}
|
|
|
|
type PortalAuditItem struct {
|
|
TraceID string `json:"traceId"`
|
|
Endpoint string `json:"endpoint"`
|
|
Result string `json:"result"`
|
|
VehicleCount int `json:"vehicleCount"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
}
|
|
|
|
type DataProduct struct {
|
|
Code string `json:"code"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
Version string `json:"version"`
|
|
Status string `json:"status"`
|
|
Method string `json:"method"`
|
|
Path string `json:"path"`
|
|
Unit string `json:"unit"`
|
|
}
|