Skip to content

Commit

Permalink
v1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
MickMake committed Feb 22, 2022
1 parent 3f646bc commit 934668c
Show file tree
Hide file tree
Showing 7 changed files with 320 additions and 1,334 deletions.
1,009 changes: 4 additions & 1,005 deletions .idea/workspace.xml

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions iSolarCloud/api/struct_endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ func (ps TypeEndPoints) String() string {
table := tablewriter.NewWriter(buf)
table.SetHeader([]string{"EndPoint", "Url"})
table.SetBorder(true)
for _, endpoint := range ep {
u := endpoint.GetUrl().String()
for _, endpoint := range ep.SortEndPoints() {
u := ep[endpoint].GetUrl().String()
table.Append([]string{
string(endpoint.GetName()),
string(ep[endpoint].GetName()),
u,
})
}
Expand All @@ -53,10 +53,10 @@ func (ps TypeEndPoints) String() string {
table := tablewriter.NewWriter(buf)
table.SetHeader([]string{"EndPoint", "Url"})
table.SetBorder(true)
for _, endpoint := range dp {
u := endpoint.GetUrl().String()
for _, endpoint := range dp.SortEndPoints() {
u := dp[endpoint].GetUrl().String()
table.Append([]string{
string(endpoint.GetName()),
string(dp[endpoint].GetName()),
u,
})
}
Expand Down Expand Up @@ -91,9 +91,9 @@ func (ps *TypeEndPoints) SortEndPoints() []EndPointName {
return ret
}

//func (ps *TypeEndPoints) CountEndpoints() int {
// func (ps *TypeEndPoints) CountEndpoints() int {
// return len(*ps)
//}
// }

func (ps *TypeEndPoints) GetEnabled() TypeEndPoints {
ret := make(TypeEndPoints)
Expand Down
59 changes: 21 additions & 38 deletions iSolarCloud/sungro/AppService/getAreaList/data.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package getAreaList

import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"fmt"
)
Expand All @@ -22,55 +23,37 @@ func (rd RequestData) Help() string {

type ResultData struct {
PageList []struct {
FaultStationCount int64 `json:"fault_station_count"`
IsHaveEsPs string `json:"is_have_es_ps"`
IsLeaf int64 `json:"is_leaf"`
OrgID int64 `json:"org_id"`
OrgName string `json:"org_name"`
P83048 struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83048"`
P83049 struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83049"`
P83050 struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83050"`
P83051 struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83051"`
PlanMonth string `json:"plan_month"`
StationCount int64 `json:"station_count"`
TodayEnergy struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"today_energy"`
TotalEnergy struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"total_energy"`
FaultStationCount int64 `json:"fault_station_count"`
IsHaveEsPs string `json:"is_have_es_ps"`
IsLeaf int64 `json:"is_leaf"`
OrgID int64 `json:"org_id"`
OrgName string `json:"org_name"`
P83048 api.UnitValue `json:"p83048"`
P83049 api.UnitValue `json:"p83049"`
P83050 api.UnitValue `json:"p83050"`
P83051 api.UnitValue `json:"p83051"`
PlanMonth string `json:"plan_month"`
StationCount int64 `json:"station_count"`
TodayEnergy api.UnitValue `json:"today_energy"`
TotalEnergy api.UnitValue `json:"total_energy"`
} `json:"pageList"`
RowCount string `json:"rowCount"`
}

func (e *ResultData) IsValid() error {
var err error
//switch {
//case e.Dummy == "":
// switch {
// case e.Dummy == "":
// break
//default:
// default:
// err = errors.New(fmt.Sprintf("unknown error '%s'", e.Dummy))
//}
// }
return err
}

//type DecodeResultData ResultData
// type DecodeResultData ResultData
//
//func (e *ResultData) UnmarshalJSON(data []byte) error {
// func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
Expand All @@ -85,4 +68,4 @@ func (e *ResultData) IsValid() error {
// }
//
// return err
//}
// }
44 changes: 30 additions & 14 deletions iSolarCloud/sungro/AppService/getKpiInfo/data.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package getKpiInfo

import (
"GoSungrow/iSolarCloud/api"
"GoSungrow/iSolarCloud/api/apiReflect"
"errors"
"fmt"
)

const Url = "/v1/powerStationService/getKpiInfo"
const Disabled = true
const Disabled = false

type RequestData struct {
// DeviceType string `json:"device_type" required:"true"`
}

func (rd RequestData) IsValid() error {
Expand All @@ -22,25 +21,42 @@ func (rd RequestData) Help() string {
return ret
}


type ResultData struct {
Dummy string `json:"dummy"`
ActualEnergy []string `json:"actual_energy"`
ActualEnergyUnit string `json:"actual_energy_unit"`
ChargeTotalEnergy string `json:"charge_total_energy"`
ChargeTotalEnergyUnit string `json:"charge_total_energy_unit"`
DisChargeTotalEnergy string `json:"dis_charge_total_energy"`
DisChargeTotalEnergyUnit string `json:"dis_charge_total_energy_unit"`
MonthEnergy api.UnitValue `json:"month_energy"`
OrgName string `json:"org_name"`
P83024 float64 `json:"p83024"`
PercentPlanMonth string `json:"percent_plan_month"`
PercentPlanYear string `json:"percent_plan_year"`
PlanEnergy []string `json:"plan_energy"`
PlanEnergyUnit string `json:"plan_energy_unit"`
PsCount int64 `json:"ps_count"`
TodayEnergy api.UnitValue `json:"today_energy"`
TotalCapcity api.UnitValue `json:"total_capcity"`
TotalDesignCapacity api.UnitValue `json:"total_design_capacity"`
TotalEnergy api.UnitValue `json:"total_energy"`
YearEnergy api.UnitValue `json:"year_energy"`
}

func (e *ResultData) IsValid() error {
var err error
switch {
case e.Dummy == "":
break
default:
err = errors.New(fmt.Sprintf("unknown error '%s'", e.Dummy))
}
// switch {
// case e.Dummy == "":
// break
// default:
// err = errors.New(fmt.Sprintf("unknown error '%s'", e.Dummy))
// }
return err
}

//type DecodeResultData ResultData
// type DecodeResultData ResultData
//
//func (e *ResultData) UnmarshalJSON(data []byte) error {
// func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
Expand All @@ -55,4 +71,4 @@ func (e *ResultData) IsValid() error {
// }
//
// return err
//}
// }
25 changes: 11 additions & 14 deletions iSolarCloud/sungro/AppService/getMapInfo/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ package getMapInfo

import (
"GoSungrow/iSolarCloud/api/apiReflect"
"errors"
"fmt"
)

const Url = "/v1/powerStationService/getMapInfo"
const Disabled = true
const Disabled = false

type RequestData struct {
// DeviceType string `json:"device_type" required:"true"`
}

func (rd RequestData) IsValid() error {
Expand All @@ -22,25 +20,24 @@ func (rd RequestData) Help() string {
return ret
}


type ResultData struct {
Dummy string `json:"dummy"`
// Dummy string `json:"dummy"`
}

func (e *ResultData) IsValid() error {
var err error
switch {
case e.Dummy == "":
break
default:
err = errors.New(fmt.Sprintf("unknown error '%s'", e.Dummy))
}
// switch {
// case e.Dummy == "":
// break
// default:
// err = errors.New(fmt.Sprintf("unknown error '%s'", e.Dummy))
// }
return err
}

//type DecodeResultData ResultData
// type DecodeResultData ResultData
//
//func (e *ResultData) UnmarshalJSON(data []byte) error {
// func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
Expand All @@ -55,4 +52,4 @@ func (e *ResultData) IsValid() error {
// }
//
// return err
//}
// }
97 changes: 42 additions & 55 deletions iSolarCloud/sungro/AppService/getPsReport/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,60 +26,41 @@ func (rd RequestData) Help() string {

type ResultData struct {
PsDateRangeTotalData struct {
Co2Reduce float64 `json:"co2_reduce"`
Co2ReduceMap struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"co2_reduce_map"`
Co2ReduceOriginalUnit string `json:"co2_reduce_original_unit"`
PowerQuantityTotal float64 `json:"power_quantity_total"`
PowerQuantityTotalMap struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"power_quantity_total_map"`
PowerQuantityTotalOriginalUnit string `json:"power_quantity_total_original_unit"`
ProfitList []struct {
IncomeUnitID int64 `json:"income_unit_id"`
IncomeUnitName string `json:"income_unit_name"`
TotalProfit float64 `json:"total_profit"`
} `json:"profit_list"`
TotalProfit float64 `json:"total_profit"`
Co2Reduce float64 `json:"co2_reduce"`
Co2ReduceMap api.UnitValue `json:"co2_reduce_map"`
Co2ReduceOriginalUnit string `json:"co2_reduce_original_unit"`
PowerQuantityTotal float64 `json:"power_quantity_total"`
PowerQuantityTotalMap api.UnitValue `json:"power_quantity_total_map"`
PowerQuantityTotalOriginalUnit string `json:"power_quantity_total_original_unit"`
ProfitList ProfitList `json:"profit_list"`
TotalProfit float64 `json:"total_profit"`
} `json:"ps_date_range_total_data"`
PsTotalData struct {
Co2Reduce float64 `json:"co2_reduce"`
Co2ReduceMap struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"co2_reduce_map"`
Co2ReduceOriginalUnit string `json:"co2_reduce_original_unit"`
MinDateID int64 `json:"min_date_id"`
PowerQuantityTotal float64 `json:"power_quantity_total"`
PowerQuantityTotalMap struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"power_quantity_total_map"`
PowerQuantityTotalOriginalUnit string `json:"power_quantity_total_original_unit"`
ProfitList []struct {
IncomeUnitID int64 `json:"income_unit_id"`
IncomeUnitName string `json:"income_unit_name"`
TotalProfit float64 `json:"total_profit"`
} `json:"profit_list"`
TotalProfit float64 `json:"total_profit"`
Co2Reduce float64 `json:"co2_reduce"`
Co2ReduceMap api.UnitValue `json:"co2_reduce_map"`
Co2ReduceOriginalUnit string `json:"co2_reduce_original_unit"`
MinDateID int64 `json:"min_date_id"`
PowerQuantityTotal float64 `json:"power_quantity_total"`
PowerQuantityTotalMap api.UnitValue `json:"power_quantity_total_map"`
PowerQuantityTotalOriginalUnit string `json:"power_quantity_total_original_unit"`
ProfitList ProfitList `json:"profit_list"`
TotalProfit float64 `json:"total_profit"`
} `json:"ps_total_data"`
ReportListData struct {
Co2ReduceUnit string `json:"co2_reduce_unit"`
PageList []struct {
Co2Reduce float64 `json:"co2_reduce"`
IncomeUnitName string `json:"income_unit_name"`
PowerQuantityTotal float64 `json:"power_quantity_total"`
PsID int64 `json:"ps_id"`
PsInstalledPower float64 `json:"ps_installed_power"`
PsName string `json:"ps_name"`
PsTotalCo2Reduce float64 `json:"ps_total_co2_reduce"`
PsTotalPower float64 `json:"ps_total_power"`
PsType int64 `json:"ps_type"`
ShareType string `json:"share_type"`
TotalProfit float64 `json:"total_profit"`
Co2Reduce float64 `json:"co2_reduce"`
IncomeUnitName string `json:"income_unit_name"`
PowerQuantityTotal float64 `json:"power_quantity_total"`
PsID int64 `json:"ps_id"`
PsInstalledPower float64 `json:"ps_installed_power"`
PsName string `json:"ps_name"`
PsTotalCo2Reduce float64 `json:"ps_total_co2_reduce"`
PsTotalPower float64 `json:"ps_total_power"`
PsType int64 `json:"ps_type"`
ShareType string `json:"share_type"`
ProfitList ProfitList `json:"profit_list"`
TotalProfit float64 `json:"total_profit"`
} `json:"pageList"`
PowerQuantityTotalUnit string `json:"power_quantity_total_unit"`
PsInstalledPowerUnit string `json:"ps_installed_power_unit"`
Expand All @@ -89,20 +70,26 @@ type ResultData struct {
} `json:"report_list_data"`
}

type ProfitList []struct {
IncomeUnitID int64 `json:"income_unit_id"`
IncomeUnitName string `json:"income_unit_name"`
TotalProfit float64 `json:"total_profit"`
}

func (e *ResultData) IsValid() error {
var err error
//switch {
//case e.Dummy == "":
// switch {
// case e.Dummy == "":
// break
//default:
// default:
// err = errors.New(fmt.Sprintf("unknown error '%s'", e.Dummy))
//}
// }
return err
}

//type DecodeResultData ResultData
// type DecodeResultData ResultData
//
//func (e *ResultData) UnmarshalJSON(data []byte) error {
// func (e *ResultData) UnmarshalJSON(data []byte) error {
// var err error
//
// for range Only.Once {
Expand All @@ -117,4 +104,4 @@ func (e *ResultData) IsValid() error {
// }
//
// return err
//}
// }
Loading

0 comments on commit 934668c

Please sign in to comment.