This commit is contained in:
MickMake 2022-02-21 22:07:18 +11:00
parent dd0597c8a8
commit 55a2c00316
34 changed files with 2518 additions and 1160 deletions

106
.idea/workspace.xml generated
View File

@ -5,16 +5,34 @@
</component>
<component name="ChangeListManager">
<list default="true" id="7d634523-07a9-40e1-bec3-1dc036abc5e9" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/iSolarCloud/api/const.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmd/cmd_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/cmd_api.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/web.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/web.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AliSmsService/init.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AliSmsService/init.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/add.sh" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/cmd/commands.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/commands.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/cmd/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/cmd/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/interface_endpoint.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/interface_endpoint.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/struct_area.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_area.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/struct_areas.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_areas.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/api/struct_endpoints.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/api/struct_endpoints.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/communicationModuleDetail/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/communicationModuleDetail/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/communicationModuleDetail/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/communicationModuleDetail/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/findPsType/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/findPsType/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/findPsType/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/findPsType/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getHouseholdStoragePsReport/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getHouseholdStoragePsReport/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getHouseholdStoragePsReport/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getHouseholdStoragePsReport/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getPowerDevicePointNames/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getPowerDevicePointNames/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getPowerStatistics/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getPowerStatistics/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getPsDetailWithPsType/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getPsDetailWithPsType/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getPsList/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/getPsList/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/login/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/login/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/queryMutiPointDataList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/queryMutiPointDataList/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/queryMutiPointDataList/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/queryMutiPointDataList/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/queryUnitList/data.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/queryUnitList/data.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/queryUnitList/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/queryUnitList/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/AppService/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/MttvScreenService/init.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/MttvScreenService/init.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/PowerPointService/init.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/PowerPointService/init.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/WebAppService/init.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/WebAppService/init.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/WebIscmAppService/init.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/WebIscmAppService/init.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/WebAppService/init.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/WebAppService/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/WebAppService/showPSView/struct.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/WebAppService/showPSView/struct.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/iSolarCloud/sungro/sungro.go" beforeDir="false" afterPath="$PROJECT_DIR$/iSolarCloud/sungro/sungro.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
@ -44,6 +62,9 @@
<component name="GoLibraries">
<option name="indexEntireGoPath" value="false" />
</component>
<component name="MarkdownSettingsMigration">
<option name="stateVersion" value="1" />
</component>
<component name="ProjectId" id="23UwT9ct9l6DDEKBksfFJ4lGZAV" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
@ -55,12 +76,14 @@
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="go.format.on.save.advertiser.fired" value="true" />
<property name="go.formatter.settings.were.checked" value="true" />
<property name="go.import.settings.migrated" value="true" />
<property name="go.modules.go.list.on.any.changes.was.set" value="true" />
<property name="go.sdk.automatically.set" value="true" />
<property name="go.watchers.conflict.with.on.save.actions.check.performed" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="settings.editor.selected.configurable" value="go.sdk" />
<property name="settings.editor.selected.configurable" value="preferences.sourceCode.Go" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
@ -76,7 +99,7 @@
<module name="GoSungro" />
<working_directory value="$PROJECT_DIR$" />
<useCustomBuildTags value="true" />
<parameters value="api get WebAppService.showPSView '{&quot;ps_id&quot;:&quot;1129147&quot;}'" />
<parameters value="api --raw get communicationModuleDetail '{&quot;sn&quot;: &quot;B2192301528&quot;}'" />
<kind value="PACKAGE" />
<package value="GoSungro" />
<directory value="$PROJECT_DIR$" />
@ -141,37 +164,37 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go</url>
<line>36</line>
<line>35</line>
<option name="timeStamp" value="159" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go</url>
<line>32</line>
<line>31</line>
<option name="timeStamp" value="160" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go</url>
<line>28</line>
<line>27</line>
<option name="timeStamp" value="161" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go</url>
<line>24</line>
<line>23</line>
<option name="timeStamp" value="162" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go</url>
<line>51</line>
<line>50</line>
<option name="timeStamp" value="163" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go</url>
<line>55</line>
<line>54</line>
<option name="timeStamp" value="164" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go</url>
<line>40</line>
<line>39</line>
<option name="timeStamp" value="165" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -186,12 +209,12 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/sungro/AppService/struct.go</url>
<line>620</line>
<line>624</line>
<option name="timeStamp" value="236" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/sungro/AppService/login/struct.go</url>
<line>35</line>
<line>34</line>
<option name="timeStamp" value="332" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -201,7 +224,7 @@
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go</url>
<line>61</line>
<line>60</line>
<option name="timeStamp" value="388" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
@ -224,36 +247,61 @@
<line>219</line>
<option name="timeStamp" value="432" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_api.go</url>
<line>90</line>
<option name="timeStamp" value="469" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/sungro/AppService/getPowerDevicePointNames/struct.go</url>
<line>141</line>
<line>142</line>
<option name="timeStamp" value="488" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_api.go</url>
<line>132</line>
<line>144</line>
<option name="timeStamp" value="491" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_api.go</url>
<line>112</line>
<line>122</line>
<option name="timeStamp" value="496" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_api.go</url>
<line>106</line>
<line>110</line>
<option name="timeStamp" value="497" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_api.go</url>
<line>105</line>
<line>109</line>
<option name="timeStamp" value="498" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_areas.go</url>
<line>83</line>
<option name="timeStamp" value="501" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/api/struct_endpoint.go</url>
<line>79</line>
<option name="timeStamp" value="530" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/sungro/WebAppService/queryUserCurveTemplateData/data.go</url>
<line>82</line>
<option name="timeStamp" value="559" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/sungro/WebAppService/queryUserCurveTemplateData/data.go</url>
<line>69</line>
<option name="timeStamp" value="561" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/cmd/cmd_api.go</url>
<line>120</line>
<option name="timeStamp" value="566" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/iSolarCloud/sungro/AppService/getHouseholdStoragePsReport/data.go</url>
<line>376</line>
<option name="timeStamp" value="567" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
<watches-manager>

View File

@ -8,9 +8,8 @@ import (
"github.com/spf13/cobra"
)
// ******************************************************************************** //
var cmdApi = &cobra.Command {
var cmdApi = &cobra.Command{
Use: "api",
Aliases: []string{},
Short: fmt.Sprintf("Interact with the SunGro api."),
@ -19,9 +18,10 @@ var cmdApi = &cobra.Command {
DisableFlagParsing: false,
DisableFlagsInUseLine: false,
// PreRunE: Cmd.ProcessArgs,
Run: cmdApiFunc,
Args: cobra.MinimumNArgs(1),
Run: cmdApiFunc,
Args: cobra.MinimumNArgs(1),
}
//goland:noinspection GoUnusedParameter
func cmdApiFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
@ -32,9 +32,8 @@ func cmdApiFunc(cmd *cobra.Command, args []string) {
}
}
// ******************************************************************************** //
var cmdApiList = &cobra.Command {
var cmdApiList = &cobra.Command{
Use: "ls",
Aliases: []string{"list"},
Short: fmt.Sprintf("List iSolarCloud api endpoints/areas"),
@ -46,31 +45,31 @@ var cmdApiList = &cobra.Command {
Run: cmdApiListFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdApiListFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
switch {
case len(args) == 0:
fmt.Println("Unknown sub-command.")
_ = cmd.Help()
case len(args) == 0:
fmt.Println("Unknown sub-command.")
_ = cmd.Help()
case args[0] == "endpoints":
Cmd.Error = SunGro.ListEndpoints("")
case args[0] == "endpoints":
Cmd.Error = SunGro.ListEndpoints("")
case args[0] == "areas":
SunGro.ListAreas()
case args[0] == "areas":
SunGro.ListAreas()
default:
Cmd.Error = SunGro.ListEndpoints(args[0])
default:
Cmd.Error = SunGro.ListEndpoints(args[0])
}
}
}
// ******************************************************************************** //
var cmdApiGet = &cobra.Command {
Use: "get",
//Aliases: []string{""},
var cmdApiGet = &cobra.Command{
Use: "get",
// Aliases: []string{""},
Short: fmt.Sprintf("Get details from iSolarCloud"),
Long: fmt.Sprintf("Get details from iSolarCloud"),
Example: PrintExamples("api get", "<endpoint> [area]"),
@ -80,6 +79,7 @@ var cmdApiGet = &cobra.Command {
Run: cmdApiGetFunc,
Args: cobra.MinimumNArgs(1),
}
//goland:noinspection GoUnusedParameter
func cmdApiGetFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
@ -89,6 +89,10 @@ func cmdApiGetFunc(cmd *cobra.Command, args []string) {
// }
ep := SunGro.GetEndpoint(args[0])
if SunGro.Error != nil {
Cmd.Error = SunGro.Error
break
}
if ep.IsError() {
Cmd.Error = ep.GetError()
break
@ -105,19 +109,26 @@ func cmdApiGetFunc(cmd *cobra.Command, args []string) {
ep = ep.Call()
if ep.IsError() {
if Cmd.ApiGetRaw {
fmt.Printf("\n%v\n", ep.GetData(true))
}
fmt.Println(ep.Help())
Cmd.Error = ep.GetError()
break
}
fmt.Printf("%v", ep.GetData())
if Cmd.ApiGetRaw {
fmt.Printf("\n%v\n", ep.GetData(true))
} else {
fmt.Printf("\n%v\n", ep.GetData(false))
}
}
}
// ******************************************************************************** //
var cmdApiLogin = &cobra.Command {
Use: "login",
//Aliases: []string{""},
var cmdApiLogin = &cobra.Command{
Use: "login",
// Aliases: []string{""},
Short: fmt.Sprintf("Login to iSolarCloud"),
Long: fmt.Sprintf("Login to iSolarCloud"),
Example: PrintExamples("api login", ""),
@ -127,10 +138,11 @@ var cmdApiLogin = &cobra.Command {
Run: cmdApiLoginFunc,
Args: cobra.MinimumNArgs(0),
}
//goland:noinspection GoUnusedParameter
func cmdApiLoginFunc(cmd *cobra.Command, args []string) {
for range Only.Once {
Cmd.Error = SunGro.Login(login.SunGroAuth {
Cmd.Error = SunGro.Login(login.SunGroAuth{
AppKey: Cmd.ApiAppKey,
UserAccount: Cmd.ApiUsername,
UserPassword: Cmd.ApiPassword,
@ -152,7 +164,7 @@ func cmdApiLoginFunc(cmd *cobra.Command, args []string) {
}
// ******************************************************************************** //
var cmdApiPut = &cobra.Command {
var cmdApiPut = &cobra.Command{
Use: "put",
Aliases: []string{"write"},
Short: fmt.Sprintf("Put details onto iSolarCloud"),
@ -164,6 +176,7 @@ var cmdApiPut = &cobra.Command {
Run: cmdApiPutFunc,
Args: cobra.RangeArgs(0, 1),
}
//goland:noinspection GoUnusedParameter
func cmdApiPutFunc(cmd *cobra.Command, args []string) {
for range Only.Once {

View File

@ -13,13 +13,11 @@ import (
"strings"
)
var SunGro *sungro.SunGro
var Git *mmGit.Git
var Cmd CommandArgs
var rootViper *viper.Viper
func init() {
for range Only.Once {
rootViper = viper.New()
@ -80,13 +78,13 @@ func init() {
rootViper.SetDefault(flagGitDiffCmd, "tkdiff")
rootCmd.PersistentFlags().StringVar(&Cmd.ConfigFile, flagConfigFile, Cmd.ConfigFile, fmt.Sprintf("%s: config file.", DefaultBinaryName))
//_ = rootCmd.PersistentFlags().MarkHidden(flagConfigFile)
// _ = rootCmd.PersistentFlags().MarkHidden(flagConfigFile)
rootCmd.PersistentFlags().BoolVarP(&Cmd.Debug, flagDebug, "", false, fmt.Sprintf("%s: Debug mode.", DefaultBinaryName))
rootViper.SetDefault(flagDebug, false)
rootCmd.PersistentFlags().BoolVarP(&Cmd.Quiet, flagQuiet, "q", false, fmt.Sprintf("%s: Silence all messages.", DefaultBinaryName))
rootViper.SetDefault(flagQuiet, false)
//cobra.OnInitialize(initConfig)
// cobra.OnInitialize(initConfig)
cobra.EnableCommandSorting = false
rootCmd.PersistentFlags().SortFlags = false
rootCmd.Flags().SortFlags = false
@ -125,11 +123,13 @@ func InitCommands() error {
cmdCron.AddCommand(cmdCronRun, cmdCronAdd, cmdCronRemove, cmdCronList)
cmdApi.AddCommand(cmdApiList, cmdApiLogin, cmdApiPut, cmdApiGet)
cmdApi.PersistentFlags().BoolVarP(&Cmd.ApiGetRaw, flagApiGetRaw, "", false, fmt.Sprintf("SunGro: api raw data, (not parsed nor evaluated)."))
rootViper.SetDefault(flagApiGetRaw, false)
//foo := rootCmd.HelpTemplate()
//foo := rootCmd.UsageTemplate()
//foo := rootCmd.VersionTemplate()
//fmt.Println(foo)
// foo := rootCmd.HelpTemplate()
// foo := rootCmd.UsageTemplate()
// foo := rootCmd.VersionTemplate()
// fmt.Println(foo)
rootCmd.SetHelpTemplate(DefaultHelpTemplate)
rootCmd.SetUsageTemplate(DefaultUsageTemplate)
@ -150,7 +150,7 @@ func initConfig(cmd *cobra.Command) error {
rootViper = viper.New()
rootViper.AddConfigPath(Cmd.ConfigDir)
rootViper.SetConfigFile(Cmd.ConfigFile)
//rootViper.SetConfigName("config")
// rootViper.SetConfigName("config")
// If a config file is found, read it in.
err = openConfig()
@ -225,7 +225,7 @@ func openConfig() error {
break
}
//err = viper.Unmarshal(Cmd)
// err = viper.Unmarshal(Cmd)
}
return err
@ -345,9 +345,9 @@ func fillArray(count int, args []string) []string {
var ret []string
for range Only.Once {
//
//if len(args) == 0 {
// if len(args) == 0 {
// break
//}
// }
ret = make([]string, count)
for i, e := range args {
ret[i] = e

View File

@ -14,7 +14,6 @@ import (
"time"
)
//goland:noinspection SpellCheckingInspection
const (
DefaultBinaryName = "GoSungro"
@ -22,16 +21,17 @@ const (
defaultConfigFile = "config.json"
defaultTokenFile = "AuthToken.json"
flagConfigFile = "config"
flagDebug = "debug"
flagQuiet = "quiet"
flagConfigFile = "config"
flagDebug = "debug"
flagQuiet = "quiet"
flagApiUrl = "host"
flagApiTimeout = "timeout"
flagApiUsername = "user"
flagApiPassword = "password"
flagApiUrl = "host"
flagApiTimeout = "timeout"
flagApiUsername = "user"
flagApiPassword = "password"
flagApiAppKey = "appkey"
flagApiLastLogin = "token-expiry"
flagApiGetRaw = "raw"
flagGoogleSheet = "google-sheet"
flagGoogleSheetUpdate = "update"
@ -53,25 +53,25 @@ const (
var DefaultAreas = []string{"all"}
type CommandArgs struct {
ConfigDir string
ConfigFile string
WriteConfig bool
Quiet bool
Debug bool
OutputType string
OutputFile string
Quiet bool
Debug bool
OutputType string
OutputFile string
// iSolarCloud api
ApiTimeout time.Duration
ApiUrl string
ApiUsername string
ApiPassword string
ApiAppKey string
ApiLastLogin string
ApiToken string
ApiTokenFile string
ApiTimeout time.Duration
ApiUrl string
ApiUsername string
ApiPassword string
ApiAppKey string
ApiLastLogin string
ApiToken string
ApiTokenFile string
ApiGetRaw bool
// Google sheets
GoogleSheet string
@ -92,7 +92,6 @@ type CommandArgs struct {
Error error
}
func (ca *CommandArgs) IsValid() error {
for range Only.Once {
if !ca.Valid {
@ -119,7 +118,7 @@ func (ca *CommandArgs) ProcessArgs(cmd *cobra.Command, args []string) error {
break
}
Cmd.Error = SunGro.Login(login.SunGroAuth {
Cmd.Error = SunGro.Login(login.SunGroAuth{
AppKey: ca.ApiAppKey,
UserAccount: ca.ApiUsername,
UserPassword: ca.ApiPassword,
@ -144,10 +143,10 @@ func (ca *CommandArgs) ProcessArgs(cmd *cobra.Command, args []string) error {
// SunGro.OutputType = iSolarCloud.TypeGoogle
// }
//Git.Error = Cmd.GitSet()
//if Cmd.Error != nil {
// Git.Error = Cmd.GitSet()
// if Cmd.Error != nil {
// break
//}
// }
ca.Valid = true
}
@ -167,10 +166,10 @@ func (ca *CommandArgs) GitSet() error {
break
}
//Cmd.Error = Git.SetAuth(ca.GitUsername, ca.GitPassword)
//if Cmd.Error != nil {
// Cmd.Error = Git.SetAuth(ca.GitUsername, ca.GitPassword)
// if Cmd.Error != nil {
// break
//}
// }
Cmd.Error = Git.SetKeyFile(ca.GitKeyFile)
if Cmd.Error != nil {
@ -262,7 +261,7 @@ func (ca *CommandArgs) GitSave(entities ...string) error {
}
fmt.Printf("Saving %d entities from the SunGro to Git...\n", len(entities))
//SunGro.OutputType = iSolarCloud.StringTypeJson
// SunGro.OutputType = iSolarCloud.StringTypeJson
// SunGro.OutputType = iSolarCloud.TypeJson
for _, entity := range entities {
@ -271,8 +270,8 @@ func (ca *CommandArgs) GitSave(entities ...string) error {
// SunGro.OutputString = ""
switch entity {
case "domain":
SunGro.Error = SunGro.Init()
case "domain":
SunGro.Error = SunGro.Init()
}
if SunGro.Error != nil {
break
@ -291,7 +290,6 @@ func (ca *CommandArgs) GitSave(entities ...string) error {
return Cmd.Error
}
func (ca *CommandArgs) GoogleUpdate(entities ...string) error {
for range Only.Once {
@ -304,11 +302,11 @@ func (ca *CommandArgs) GoogleUpdate(entities ...string) error {
for _, entity := range entities {
switch entity {
case "domain":
ca.Error = SunGro.Init()
if ca.Error != nil {
break
}
case "domain":
ca.Error = SunGro.Init()
if ca.Error != nil {
break
}
}
// sheet := google.Sheet {
@ -329,7 +327,7 @@ func (ca *CommandArgs) GoogleUpdate(entities ...string) error {
return ca.Error
}
//func (ca *CommandArgs) UpdateGoogleSheet(name string, data [][]interface{}) error {
// func (ca *CommandArgs) UpdateGoogleSheet(name string, data [][]interface{}) error {
//
// for range Only.Once {
// sheet := google.Sheet{
@ -347,4 +345,4 @@ func (ca *CommandArgs) GoogleUpdate(entities ...string) error {
// }
//
// return p.Error
//}
// }

3
iSolarCloud/api/const.go Normal file
View File

@ -0,0 +1,3 @@
package api
const NullEndPoint = "nullEndPoint"

View File

@ -1,6 +1,5 @@
package api
type EndPoint interface {
GetArea() AreaName
GetName() EndPointName
@ -8,21 +7,21 @@ type EndPoint interface {
Help() string
Call() EndPoint
GetData() Json
GetData(bool) Json
String() string
SetError(string, ...interface{}) EndPoint
GetError() error
IsError() bool
MarshalJSON() ([]byte, error)
SetRequest(ref interface{}) EndPoint // EndPointStruct
SetRequest(ref interface{}) EndPoint // EndPointStruct
SetRequestByJson(j Json) EndPoint
RequestRef() interface{}
GetRequestJson() Json
IsRequestValid() error
RequestString() string
SetResponse([]byte) EndPoint // EndPointStruct
SetResponse([]byte) EndPoint // EndPointStruct
ResponseRef() interface{}
GetResponseJson() Json
IsResponseValid() error

View File

@ -0,0 +1,25 @@
package nullEndPoint
import (
"GoSungro/iSolarCloud/api/apiReflect"
"fmt"
)
const Url = ""
const Name = "nullEndPoint"
type RequestData struct {
// DeviceType string `json:"device_type" required:"true"`
}
func (rd RequestData) IsValid() error {
return apiReflect.VerifyOptionsRequired(rd)
}
func (rd RequestData) Help() string {
ret := fmt.Sprintf("")
return ret
}
type ResultData struct {
}

View File

@ -0,0 +1,218 @@
package nullEndPoint
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Response Response
}
type Request struct {
api.RequestCommon
RequestData
}
type Response struct {
api.ResponseCommon
ResultData ResultData `json:"result_data"`
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
Url: api.SetUrl(Url),
Request: Request{},
Response: Response{},
Error: nil,
},
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
func (e EndPoint) Init(apiRoot *api.Web) *EndPoint {
ret := Init(apiRoot)
return &ret
}
func (e EndPoint) GetRequest() Request {
return e.Request
}
func (e EndPoint) GetResponse() Response {
return e.Response
}
func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
func (e EndPoint) Help() string {
ret := apiReflect.HelpOptions(e.Request.RequestData)
ret += fmt.Sprintf("JSON request:\t%s\n", e.GetRequestJson())
ret += e.Request.Help()
return ret
}
func (e EndPoint) GetArea() api.AreaName {
return e.Area
}
func (e EndPoint) GetName() api.EndPointName {
return e.Name
}
func (e EndPoint) GetUrl() api.EndPointUrl {
return e.Url
}
func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {
e.EndPointStruct.Error = errors.New(fmt.Sprintf(format, a...))
return e
}
func (e EndPoint) GetError() error {
return e.EndPointStruct.Error
}
func (e EndPoint) IsError() bool {
if e.Error != nil {
return true
}
return false
}
func (e EndPoint) SetRequest(ref interface{}) api.EndPoint {
for range Only.Once {
if apiReflect.GetPkgType(ref) == "api.RequestCommon" {
e.Request.RequestCommon = ref.(api.RequestCommon)
break
}
if apiReflect.GetType(ref) == "RequestData" {
e.Request.RequestData = ref.(RequestData)
e.Error = e.IsRequestValid()
break
}
e.Error = apiReflect.DoPkgTypesMatch(e.Request, ref)
if e.Error != nil {
break
}
e.Request = ref.(Request)
}
return e
}
func (e EndPoint) SetRequestByJson(j api.Json) api.EndPoint {
for range Only.Once {
e.Error = json.Unmarshal([]byte(j), &e.Request.RequestData)
if e.Error != nil {
break
}
e.Error = e.IsRequestValid()
if e.Error != nil {
break
}
}
return e
}
func (e EndPoint) RequestRef() interface{} {
return e.Request
}
func (e EndPoint) GetRequestJson() api.Json {
return api.GetAsJson(e.Request.RequestData)
}
func (e EndPoint) IsRequestValid() error {
for range Only.Once {
req := e.GetRequest()
// req := e.Request.RequestCommon
e.Error = req.RequestCommon.IsValid()
if e.Error != nil {
break
}
e.Error = req.RequestData.IsValid()
if e.Error != nil {
break
}
}
return e.Error
}
func (e EndPoint) SetResponse(ref []byte) api.EndPoint {
for range Only.Once {
// r := e.GetResponse()
// e.Error = json.Unmarshal(ref, &r)
e.Error = json.Unmarshal(ref, &e.Response)
if e.Error != nil {
break
}
// e.ResponseCommon = r
}
return e
}
func (e EndPoint) GetResponseJson() api.Json {
return api.GetAsPrettyJson(e.Response)
}
func (e EndPoint) ResponseRef() interface{} {
return e.Response
}
func (e EndPoint) IsResponseValid() error {
for range Only.Once {
// resp := e.GetResponse()
// e.Error = resp.ResponseCommon.IsValid()
e.Error = e.Response.ResponseCommon.IsValid()
if e.Error != nil {
break
}
}
return e.Error
}
func (e EndPoint) String() string {
return api.GetEndPointString(e)
}
func (e EndPoint) RequestString() string {
return api.GetRequestString(e.Request)
}
func (e EndPoint) ResponseString() string {
return api.GetRequestString(e.Response)
}
func (e EndPoint) MarshalJSON() ([]byte, error) {
return api.MarshalJSON(e)
}

View File

@ -6,15 +6,13 @@ import (
"fmt"
)
type AreaStruct struct {
ApiRoot interface{} // *web.Web
ApiRoot interface{} // *web.Web
Name AreaName
EndPoints TypeEndPoints
Error error
}
func (as AreaStruct) Exists(name EndPointName) error {
var err error
for range Only.Once {
@ -38,19 +36,8 @@ func (as *AreaStruct) GetEndPoint(name EndPointName) EndPoint {
func (as AreaStruct) ListEndpoints() {
for range Only.Once {
fmt.Printf("Listing all endpoints from area '%s':\n", as.Name)
as.EndPoints.ListEndpoints()
// table := tablewriter.NewWriter(os.Stdout)
// table.SetHeader([]string{"Area", "EndPoint", "Url"})
// table.SetBorder(true)
// for _, endpoint := range as.SortEndPoints() {
// table.Append([]string{
// string(as.Name),
// string(as.EndPoints[endpoint].GetName()),
// as.EndPoints[endpoint].GetUrl().String(),
// })
// }
// table.Render()
// as.EndPoints.ListEndpoints()
fmt.Printf("%v", as.EndPoints)
}
}

View File

@ -9,12 +9,10 @@ import (
"sort"
)
type Areas map[AreaName]AreaStruct // TypeEndPoints // Map of EndPoints by area name.
type AreaName string
type AreaNames []AreaName
func (an *Areas) Exists(area string) bool {
var ok bool
_, ok = (*an)[AreaName(area)]
@ -40,8 +38,8 @@ func (an *Areas) EndpointExists(area AreaName, name EndPointName) error {
func (an *Areas) SortAreas() AreaNames {
keys := make([]string, 0, len(*an))
for k := range *an {
keys = append(keys, string(k))
for _, k := range *an {
keys = append(keys, string(k.Name))
}
sort.Strings(keys)
ret := make(AreaNames, 0, len(keys))
@ -51,6 +49,16 @@ func (an *Areas) SortAreas() AreaNames {
return ret
}
func (an *Areas) GetArea(area AreaName) *Area {
var ret *Area
for range Only.Once {
if _, ok := (*an)[area]; !ok {
break
}
}
return ret
}
func (an *Areas) GetEndPoint(area AreaName, name EndPointName) EndPoint {
var ret EndPoint
for range Only.Once {
@ -62,10 +70,10 @@ func (an *Areas) GetEndPoint(area AreaName, name EndPointName) EndPoint {
ret.SetError("empty endpoint name")
break
}
if _, ok := (*an)[area]; !ok {
break
}
ret = (*an)[area].EndPoints[name]
}
return ret

View File

@ -4,9 +4,9 @@ import (
"GoSungro/Only"
"encoding/json"
"errors"
"fmt"
)
type EndPointName string
type EndPointStruct struct {
@ -20,7 +20,6 @@ type EndPointStruct struct {
Error error `json:"-"`
}
func (p *EndPointStruct) GetArea() AreaName {
return p.Area
}
@ -75,6 +74,32 @@ func (p *EndPointStruct) IsValid() error {
return err
}
func (p EndPointStruct) String() string {
var ret string
for range Only.Once {
if p.Name == NullEndPoint {
break
}
ret += fmt.Sprintf("Area:\t%s\nEndPoint:\t%s\nUrl:\t%s\n",
p.Area,
p.Name,
p.Url,
)
foo := p.GetRequest()
ret += fmt.Sprintf("Request JSON:\t%s\n",
foo,
)
foo = p.GetResponse()
ret += fmt.Sprintf("Response JSON:\t%s\n",
foo,
)
}
return ret
}
// func (p EndPointStruct) MarshalJSON() ([]byte, error) {
// return json.Marshal(&struct {
// Area string `json:"area"`

View File

@ -2,18 +2,16 @@ package api
import (
"GoSungro/Only"
"bytes"
"errors"
"fmt"
"github.com/olekukonko/tablewriter"
"os"
"sort"
)
// type TypeEndPoints map[EndPointName]EndPointStruct // Map of EndPoints by endpoint name.
type TypeEndPoints map[EndPointName]EndPoint // Map of EndPoints by endpoint name.
type TypeEndPoints map[EndPointName]EndPoint // Map of EndPoints by endpoint name.
func (ps TypeEndPoints) Exists(name EndPointName) error {
var err error
@ -27,33 +25,70 @@ func (ps TypeEndPoints) Exists(name EndPointName) error {
return err
}
func (ps *TypeEndPoints) SortEndPoints() []EndPointName {
keys := make([]string, 0, len(*ps))
for k := range *ps {
keys = append(keys, string(k))
}
sort.Strings(keys)
func (ps TypeEndPoints) String() string {
var ret string
for range Only.Once {
s := ps.SortEndPoints()
if len(s) == 0 {
break
}
ret := make([]EndPointName, 0, len(*ps))
for k := range keys {
keys = append(keys, string(k))
buf := new(bytes.Buffer)
table := tablewriter.NewWriter(buf)
table.SetHeader([]string{"EndPoint", "Url"})
table.SetBorder(true)
for _, endpoint := range s {
if ps[endpoint].GetName() == NullEndPoint {
continue
}
u := ps[endpoint].GetUrl().String()
table.Append([]string{
string(endpoint),
u,
})
}
table.Render()
ret += fmt.Sprintf("# Implemented endpoints\n")
ret += buf.String()
buf = new(bytes.Buffer)
table = tablewriter.NewWriter(buf)
table.SetHeader([]string{"EndPoint", "Url"})
table.SetBorder(true)
for _, endpoint := range s {
if ps[endpoint].GetName() != NullEndPoint {
continue
}
table.Append([]string{
string(endpoint),
"",
})
}
table.Render()
ret += fmt.Sprintf("# Non-implemented endpoints\n")
ret += buf.String()
}
return ret
}
func (ps TypeEndPoints) ListEndpoints() {
// func (ps TypeEndPoints) ListEndpoints() {
// fmt.Printf("%v", ps)
// }
func (ps *TypeEndPoints) SortEndPoints() []EndPointName {
ret := make([]EndPointName, 0, len(*ps))
for range Only.Once {
table := tablewriter.NewWriter(os.Stdout)
table.SetHeader([]string{"EndPoint", "Url"})
table.SetBorder(true)
for _, endpoint := range ps.SortEndPoints() {
table.Append([]string{
string(ps[endpoint].GetName()),
ps[endpoint].GetUrl().String(),
})
keys := make([]string, 0, len(*ps))
for k, _ := range *ps {
keys = append(keys, string(k))
}
sort.Strings(keys)
for _, k := range keys {
ret = append(ret, EndPointName(k))
}
table.Render()
}
return ret
}
func (ps *TypeEndPoints) CountEndpoints() int {
@ -62,6 +97,5 @@ func (ps *TypeEndPoints) CountEndpoints() int {
func (ps *TypeEndPoints) GetEndPoint(name EndPointName) EndPoint {
ret, _ := (*ps)[name]
fmt.Printf("ok:%v\tref:%v\n")
return ret
}

View File

@ -5,12 +5,10 @@ import (
"fmt"
)
const Url = ""
const Url = "/v1/devService/communicationModuleDetail"
type RequestData struct {
// DeviceType string `json:"device_type" required:"true"`
Sn string `json:"sn" required:"true"`
}
func (rd RequestData) IsValid() error {
@ -22,6 +20,7 @@ func (rd RequestData) Help() string {
return ret
}
type ResultData struct {
CardFlowInfoList []interface{} `json:"cardFlowInfoList"`
SetMealInfoList []interface{} `json:"setMealInfoList"`
}

View File

@ -9,12 +9,11 @@ import (
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Request Request
Response Response
}
@ -29,8 +28,8 @@ type Response struct {
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
@ -42,7 +41,6 @@ func Init(apiRoot *api.Web) EndPoint {
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
@ -63,7 +61,6 @@ func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
@ -90,8 +87,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {

View File

@ -5,10 +5,8 @@ import (
"fmt"
)
const Url = "/v1/powerStationService/findPsType"
type RequestData struct {
PsId string `json:"ps_id" required:"true"`
}
@ -22,10 +20,7 @@ func (rd RequestData) Help() string {
return ret
}
type ResultData []Data
type Data struct {
type ResultData []struct {
PsType int64 `json:"ps_type"`
SysScheme int64 `json:"sys_scheme"`
}
}

View File

@ -9,12 +9,11 @@ import (
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Request Request
Response Response
}
@ -29,8 +28,8 @@ type Response struct {
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
@ -42,7 +41,6 @@ func Init(apiRoot *api.Web) EndPoint {
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
@ -63,7 +61,6 @@ func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
@ -90,8 +87,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {

View File

@ -1,16 +1,19 @@
package getHouseholdStoragePsReport
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api/apiReflect"
"encoding/json"
"fmt"
"strings"
)
const Url = ""
const Url = "/v1/powerStationService/getHouseholdStoragePsReport"
type RequestData struct {
// DeviceType string `json:"device_type" required:"true"`
DateID string `json:"date_id" required:"true"`
DateType string `json:"date_type" required:"true"`
PsID string `json:"ps_id" required:"true"`
}
func (rd RequestData) IsValid() error {
@ -18,10 +21,387 @@ func (rd RequestData) IsValid() error {
}
func (rd RequestData) Help() string {
ret := fmt.Sprintf("")
ret := fmt.Sprintln("ps_id: Can be fetched from getPsList.")
ret += fmt.Sprintln("date_type: Day = 1")
ret += fmt.Sprintln("\tdate_id: Format YYYYmmdd")
ret += fmt.Sprintln("date_type: Month = 2")
ret += fmt.Sprintln("\tdate_id: Format YYYYmm")
ret += fmt.Sprintln("date_type: Year = 3")
ret += fmt.Sprintln("\tdate_id: Format YYYY")
return ret
}
type ResultData struct {
ConnectType string `json:"connect_type"`
HasAmmeter int64 `json:"has_ammeter"`
IsHaveEsInverter int64 `json:"is_have_es_inverter"`
IsTransformSystem string `json:"is_transform_system"`
DayData *DayData `json:"day_data"`
MonthData *MonthData `json:"month_data"`
YearData *YearData `json:"year_data"`
TotalData *TotalData `json:"total_data"`
}
type DayData struct {
JthdMap KeyValue `json:"jthd_map"`
JthdMapVirgin KeyValue `json:"jthd_map_virgin"`
JtydMap KeyValue `json:"jtyd_map"`
JtydMapVirgin KeyValue `json:"jtyd_map_virgin"`
P83072Map KeyValue `json:"p83072_map"`
P83072MapVirgin KeyValue `json:"p83072_map_virgin"`
P83077Map KeyValue `json:"p83077_map"`
P83077MapVirgin KeyValue `json:"p83077_map_virgin"`
P83088Map KeyValue `json:"p83088_map"`
P83088MapVirgin KeyValue `json:"p83088_map_virgin"`
P83089Map KeyValue `json:"p83089_map"`
P83089MapVirgin KeyValue `json:"p83089_map_virgin"`
P83097Map KeyValue `json:"p83097_map"`
P83097MapVirgin KeyValue `json:"p83097_map_virgin"`
P83102Map KeyValue `json:"p83102_map"`
P83102MapVirgin KeyValue `json:"p83102_map_virgin"`
P83118Map KeyValue `json:"p83118_map"`
P83118MapVirgin KeyValue `json:"p83118_map_virgin"`
P83119Map KeyValue `json:"p83119_map"`
P83119MapVirgin KeyValue `json:"p83119_map_virgin"`
P83120Map KeyValue `json:"p83120_map"`
P83120MapVirgin KeyValue `json:"p83120_map_virgin"`
P83121 string `json:"p83121"`
P83122 string `json:"p83122"`
PointData15List []struct {
P83076 string `json:"p83076"`
P83076Unit string `json:"p83076_unit"`
P83080 string `json:"p83080"`
P83080Unit string `json:"p83080_unit"`
P83086 string `json:"p83086"`
P83086Unit string `json:"p83086_unit"`
P83087 string `json:"p83087"`
P83087Unit string `json:"p83087_unit"`
P83096 string `json:"p83096"`
P83096Unit string `json:"p83096_unit"`
P83101 string `json:"p83101"`
P83101Unit string `json:"p83101_unit"`
P83106 string `json:"p83106"`
P83106Unit string `json:"p83106_unit"`
P83128 string `json:"p83128"`
P83128Unit string `json:"p83128_unit"`
TimeStamp string `json:"time_stamp"`
Zfzy string `json:"zfzy"`
ZfzyUnit string `json:"zfzy_unit"`
} `json:"point_data_15_list"`
ZfzyMap KeyValue `json:"zfzy_map"`
ZfzyMapVirgin KeyValue `json:"zfzy_map_virgin"`
ZjzzMap KeyValue `json:"zjzz_map"`
ZjzzMapVirgin KeyValue `json:"zjzz_map_virgin"`
}
type MonthData struct {
JthdMap KeyValue `json:"jthd_map"`
JthdMapVirgin KeyValue `json:"jthd_map_virgin"`
JtydMap KeyValue `json:"jtyd_map"`
JtydMapVirgin KeyValue `json:"jtyd_map_virgin"`
MonthDataDayList []struct {
DateID int64 `json:"date_id"`
Jthd string `json:"jthd"`
JthdUnit string `json:"jthd_unit"`
Jtyd string `json:"jtyd"`
JtydUnit string `json:"jtyd_unit"`
P83022 string `json:"p83022"`
P83072 string `json:"p83072"`
P83072Unit string `json:"p83072_unit"`
P83077 string `json:"p83077"`
P83077Unit string `json:"p83077_unit"`
P83088 string `json:"p83088"`
P83088Unit string `json:"p83088_unit"`
P83089 string `json:"p83089"`
P83089Unit string `json:"p83089_unit"`
P83097 string `json:"p83097"`
P83097Unit string `json:"p83097_unit"`
P83102 string `json:"p83102"`
P83102Unit string `json:"p83102_unit"`
P83118 string `json:"p83118"`
P83118Unit string `json:"p83118_unit"`
P83119 string `json:"p83119"`
P83119Unit string `json:"p83119_unit"`
P83120 string `json:"p83120"`
P83121 string `json:"p83121"`
P83122 string `json:"p83122"`
PsID interface{} `json:"ps_id"`
SelfConsumptionYield string `json:"self_consumption_yield"`
SelfConsumptionYieldUnit string `json:"self_consumption_yield_unit"`
TimeStamp string `json:"time_stamp"`
} `json:"month_data_day_list"`
P83073Map KeyValue `json:"p83073_map"`
P83073MapVirgin KeyValue `json:"p83073_map_virgin"`
P83078Map KeyValue `json:"p83078_map"`
P83078MapVirgin KeyValue `json:"p83078_map_virgin"`
P83088Map KeyValue `json:"p83088_map"`
P83088MapVirgin KeyValue `json:"p83088_map_virgin"`
P83091Map KeyValue `json:"p83091_map"`
P83091MapVirgin KeyValue `json:"p83091_map_virgin"`
P83097Map KeyValue `json:"p83097_map"`
P83097MapVirgin KeyValue `json:"p83097_map_virgin"`
P83103Map KeyValue `json:"p83103_map"`
P83103MapVirgin KeyValue `json:"p83103_map_virgin"`
P83118Map KeyValue `json:"p83118_map"`
P83118MapVirgin KeyValue `json:"p83118_map_virgin"`
P83119Map KeyValue `json:"p83119_map"`
P83119MapVirgin KeyValue `json:"p83119_map_virgin"`
P83120Map KeyValue `json:"p83120_map"`
P83120MapVirgin KeyValue `json:"p83120_map_virgin"`
P83121 string `json:"p83121"`
P83122 string `json:"p83122"`
ZfzyMap KeyValue `json:"zfzy_map"`
ZfzyMapVirgin KeyValue `json:"zfzy_map_virgin"`
ZjzzMap KeyValue `json:"zjzz_map"`
ZjzzMapVirgin KeyValue `json:"zjzz_map_virgin"`
}
type YearData struct {
JthdMap KeyValue `json:"jthd_map"`
JthdMapVirgin KeyValue `json:"jthd_map_virgin"`
JtydMap KeyValue `json:"jtyd_map"`
JtydMapVirgin KeyValue `json:"jtyd_map_virgin"`
P83074Map KeyValue `json:"p83074_map"`
P83074MapVirgin KeyValue `json:"p83074_map_virgin"`
P83079Map KeyValue `json:"p83079_map"`
P83079MapVirgin KeyValue `json:"p83079_map_virgin"`
P83088Map KeyValue `json:"p83088_map"`
P83088MapVirgin KeyValue `json:"p83088_map_virgin"`
P83093Map KeyValue `json:"p83093_map"`
P83093MapVirgin KeyValue `json:"p83093_map_virgin"`
P83097Map KeyValue `json:"p83097_map"`
P83097MapVirgin KeyValue `json:"p83097_map_virgin"`
P83104Map KeyValue `json:"p83104_map"`
P83104MapVirgin KeyValue `json:"p83104_map_virgin"`
P83118Map KeyValue `json:"p83118_map"`
P83118MapVirgin KeyValue `json:"p83118_map_virgin"`
P83119Map KeyValue `json:"p83119_map"`
P83119MapVirgin KeyValue `json:"p83119_map_virgin"`
P83120Map KeyValue `json:"p83120_map"`
P83120MapVirgin KeyValue `json:"p83120_map_virgin"`
P83121 string `json:"p83121"`
P83122 string `json:"p83122"`
YearDataMonthList []struct {
DateID int64 `json:"date_id"`
Jthd string `json:"jthd"`
JthdUnit string `json:"jthd_unit"`
Jtyd string `json:"jtyd"`
JtydUnit string `json:"jtyd_unit"`
P83037 string `json:"p83037"`
P83073 string `json:"p83073"`
P83073Unit string `json:"p83073_unit"`
P83078 string `json:"p83078"`
P83078Unit string `json:"p83078_unit"`
P83088 string `json:"p83088"`
P83088Unit string `json:"p83088_unit"`
P83091 string `json:"p83091"`
P83091Unit string `json:"p83091_unit"`
P83098 string `json:"p83098"`
P83098Unit string `json:"p83098_unit"`
P83103 string `json:"p83103"`
P83103Unit string `json:"p83103_unit"`
P83118 string `json:"p83118"`
P83118Unit string `json:"p83118_unit"`
P83119 string `json:"p83119"`
P83119Unit string `json:"p83119_unit"`
P83120 string `json:"p83120"`
P83121 string `json:"p83121"`
P83122 string `json:"p83122"`
PsID int64 `json:"ps_id"`
SelfConsumptionYield string `json:"self_consumption_yield"`
SelfConsumptionYieldUnit string `json:"self_consumption_yield_unit"`
TimeStamp string `json:"time_stamp"`
} `json:"year_data_month_list"`
ZfzyMap KeyValue `json:"zfzy_map"`
ZfzyMapVirgin KeyValue `json:"zfzy_map_virgin"`
ZjzzMap KeyValue `json:"zjzz_map"`
ZjzzMapVirgin KeyValue `json:"zjzz_map_virgin"`
}
type TotalData struct {
JthdMap struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"jthd_map"`
JthdMapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"jthd_map_virgin"`
JtydMap struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"jtyd_map"`
JtydMapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"jtyd_map_virgin"`
P83075Map struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83075_map"`
P83075MapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83075_map_virgin"`
P83094Map struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83094_map"`
P83094MapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83094_map_virgin"`
P83095Map struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83095_map"`
P83095MapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83095_map_virgin"`
P83105Map struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83105_map"`
P83105MapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83105_map_virgin"`
P83107Map struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83107_map"`
P83107MapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83107_map_virgin"`
P83123Map struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83123_map"`
P83123MapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83123_map_virgin"`
P83124Map struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83124_map"`
P83124MapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83124_map_virgin"`
P83125 string `json:"p83125"`
P83126 string `json:"p83126"`
P83127Map struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83127_map"`
P83127MapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"p83127_map_virgin"`
TotalDataYearList []struct {
DateID int64 `json:"date_id"`
Jthd string `json:"jthd"`
JthdUnit string `json:"jthd_unit"`
Jtyd string `json:"jtyd"`
JtydUnit string `json:"jtyd_unit"`
P83038 int64 `json:"p83038"`
P83074 string `json:"p83074"`
P83074Unit string `json:"p83074_unit"`
P83079 string `json:"p83079"`
P83079Unit string `json:"p83079_unit"`
P83088 string `json:"p83088"`
P83088Unit string `json:"p83088_unit"`
P83093 string `json:"p83093"`
P83093Unit string `json:"p83093_unit"`
P83099 string `json:"p83099"`
P83099Unit string `json:"p83099_unit"`
P83104 string `json:"p83104"`
P83104Unit string `json:"p83104_unit"`
P83118 string `json:"p83118"`
P83118Unit string `json:"p83118_unit"`
P83119 string `json:"p83119"`
P83119Unit string `json:"p83119_unit"`
P83120 int64 `json:"p83120"`
P83121 string `json:"p83121"`
P83122 string `json:"p83122"`
PsID int64 `json:"ps_id"`
SelfConsumptionYield string `json:"self_consumption_yield"`
SelfConsumptionYieldUnit string `json:"self_consumption_yield_unit"`
TimeStamp string `json:"time_stamp"`
} `json:"total_data_year_list"`
ZfzyMap struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"zfzy_map"`
ZfzyMapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"zfzy_map_virgin"`
ZjzzMap struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"zjzz_map"`
ZjzzMapVirgin struct {
Unit string `json:"unit"`
Value string `json:"value"`
} `json:"zjzz_map_virgin"`
}
type KeyValue struct {
Unit string `json:"unit"`
Value string `json:"value"`
}
type DecodeResultData ResultData
func (p *ResultData) UnmarshalJSON(data []byte) error {
var err error
for range Only.Once {
if len(data) == 0 {
break
}
var pd DecodeResultData
// Store ResultData
_ = json.Unmarshal(data, &pd)
p.ConnectType = pd.ConnectType
p.HasAmmeter = pd.HasAmmeter
p.IsHaveEsInverter = pd.IsHaveEsInverter
p.IsTransformSystem = pd.IsTransformSystem
if strings.Contains(string(data), "day_data") {
// Store ResultData.DayData
err = json.Unmarshal(data, &pd.DayData)
p.DayData = pd.DayData
break
}
if strings.Contains(string(data), "month_data") {
// Store ResultData.MonthData
_ = json.Unmarshal(data, &pd.MonthData)
p.MonthData = pd.MonthData
break
}
if strings.Contains(string(data), "year_data") {
// Store ResultData.YearData
_ = json.Unmarshal(data, &pd.YearData)
p.YearData = pd.YearData
break
}
if strings.Contains(string(data), "total_data") {
// Store ResultData.TotalData
_ = json.Unmarshal(data, &pd.TotalData)
p.TotalData = pd.TotalData
break
}
}
return err
}

View File

@ -9,12 +9,11 @@ import (
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Request Request
Response Response
}
@ -29,8 +28,8 @@ type Response struct {
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
@ -42,7 +41,6 @@ func Init(apiRoot *api.Web) EndPoint {
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
@ -63,7 +61,6 @@ func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
@ -90,8 +87,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {

View File

@ -9,12 +9,11 @@ import (
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Request Request
Response Response
}
@ -29,8 +28,8 @@ type Response struct {
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
@ -42,7 +41,6 @@ func Init(apiRoot *api.Web) EndPoint {
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
@ -63,7 +61,6 @@ func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
@ -90,8 +87,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {

View File

@ -9,12 +9,11 @@ import (
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Request Request
Response Response
}
@ -29,8 +28,8 @@ type Response struct {
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
@ -42,7 +41,6 @@ func Init(apiRoot *api.Web) EndPoint {
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
@ -63,7 +61,6 @@ func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
@ -90,8 +87,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {

View File

@ -9,12 +9,11 @@ import (
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Request Request
Response Response
}
@ -29,8 +28,8 @@ type Response struct {
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
@ -42,7 +41,6 @@ func Init(apiRoot *api.Web) EndPoint {
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
@ -63,7 +61,6 @@ func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
@ -90,8 +87,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {

View File

@ -9,12 +9,11 @@ import (
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Request Request
Response Response
}
@ -29,8 +28,8 @@ type Response struct {
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
@ -42,7 +41,6 @@ func Init(apiRoot *api.Web) EndPoint {
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
@ -63,7 +61,6 @@ func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
@ -90,8 +87,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {

View File

@ -11,14 +11,13 @@ import (
"time"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Request Request
Response Response
Auth *SunGroAuth
Auth *SunGroAuth
}
type Request struct {
@ -32,8 +31,8 @@ type Response struct {
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
@ -42,7 +41,7 @@ func Init(apiRoot *api.Web) EndPoint {
Response: Response{},
Error: nil,
},
Auth: &SunGroAuth {
Auth: &SunGroAuth{
AppKey: "",
UserAccount: "",
UserPassword: "",
@ -55,7 +54,6 @@ func Init(apiRoot *api.Web) EndPoint {
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
@ -76,7 +74,6 @@ func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
@ -103,8 +100,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {

View File

@ -1,16 +1,22 @@
package queryMutiPointDataList
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api/apiReflect"
"encoding/json"
"fmt"
"strings"
)
const Url = ""
const Url = "/v1/powerStationService/psHourPointsValue"
type RequestData struct {
// DeviceType string `json:"device_type" required:"true"`
PsID string `json:"ps_id" required:"true"`
PsKey string `json:"ps_key" required:"true"`
Points string `json:"points" required:"true"`
MinuteInterval string `json:"minute_interval" required:"true"`
StartTimeStamp string `json:"start_time_stamp" required:"true"`
EndTimeStamp string `json:"end_time_stamp" required:"true"`
}
func (rd RequestData) IsValid() error {
@ -22,6 +28,58 @@ func (rd RequestData) Help() string {
return ret
}
type ResultData struct {
Points Points `json:"points"`
}
type Points map[string]Point
type Point struct {
List []string `json:"list"`
Unit string `json:"unit"`
}
type DecodeResultData ResultData
type DecodePoints map[string][]string
type DecodeUnit map[string]string
func (p *ResultData) UnmarshalJSON(data []byte) error {
var err error
for range Only.Once {
if len(data) == 0 {
break
}
p.Points = make(Points)
var du DecodeUnit
// Store DeviceData.Points
_ = json.Unmarshal(data, &du)
for i, k := range du {
if k == "" {
delete(du, i)
continue
}
}
var dp DecodePoints
// Store DeviceData.Points
_ = json.Unmarshal(data, &dp)
for i, k := range dp {
if k == nil {
delete(dp, i)
continue
}
i = strings.TrimSuffix(i, "List")
u := du[i+"_unit"]
p.Points[i] = Point{
List: k,
Unit: u,
}
}
}
return err
}

View File

@ -9,12 +9,11 @@ import (
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Request Request
Response Response
}
@ -29,8 +28,8 @@ type Response struct {
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
@ -42,7 +41,6 @@ func Init(apiRoot *api.Web) EndPoint {
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
@ -63,7 +61,6 @@ func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
@ -90,8 +87,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {

View File

@ -5,9 +5,7 @@ import (
"fmt"
)
const Url = ""
const Url = "/v1/userService/queryUnitList"
type RequestData struct {
// DeviceType string `json:"device_type" required:"true"`
@ -22,6 +20,10 @@ func (rd RequestData) Help() string {
return ret
}
type ResultData struct {
type ResultData []struct {
IsBasicUnit int64 `json:"is_basic_unit"`
TargetUnit string `json:"target_unit"`
UnitConverID int64 `json:"unit_conver_id"`
UnitName string `json:"unit_name"`
UnitType int64 `json:"unit_type"`
}

View File

@ -9,12 +9,11 @@ import (
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Request Request
Response Response
}
@ -29,8 +28,8 @@ type Response struct {
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
@ -42,7 +41,6 @@ func Init(apiRoot *api.Web) EndPoint {
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
@ -63,7 +61,6 @@ func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
@ -90,8 +87,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {

File diff suppressed because it is too large Load Diff

View File

@ -1,291 +0,0 @@
// API endpoints pulled from the sqlite database, (./assets/interface.db), contained within the Android app com.isolarcloud.manager
package WebAppService
import (
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/sungro/WebAppService/showPSView"
"fmt"
)
var endpoints = [][]string {
{"WebAppService","addMaterial","/v1/otherService/addMaterial"},
{"WebAppService","addOptTicketInfo","/v1/faultService/addOptTicketInfo"},
{"WebAppService","addSpareParts","/v1/otherService/addSpareParts"},
{"WebAppService","associateQueryFaultNames","/v1/faultService/associateQueryFaultNames"},
{"WebAppService","auditPsDeviceCheck","/v1/devService/auditPsDeviceCheck"},
{"WebAppService","calcOutputRankByDay","/v1/powerStationService/calcOutputRankByDay"},
{"WebAppService","changeReadStatus","/v1/reportService/changeReadStatus"},
{"WebAppService","checkMaterialName","/v1/otherService/checkMaterialName"},
{"WebAppService","confirmFault","/v1/faultService/confirmOrCloseFault"},
{"WebAppService","copeOperateTicket","/v1/faultService/copeOperateTicket"},
{"WebAppService","copySecondTypeTicket","/v1/faultService/copySecondTypeTicket"},
{"WebAppService","copyWorkTicket","/v1/faultService/copyWorkTicket"},
{"WebAppService","delOptTicketInfo","/v1/faultService/delOptTicketInfo"},
{"WebAppService","deleteDuty","/v1/otherService/deleteDuty"},
{"WebAppService","deleteDutyMid","/v1/otherService/deleteDutyMid"},
{"WebAppService","deleteMaterial","/v1/otherService/deleteMaterial"},
{"WebAppService","deleteOrSharedSelfReport","/v1/reportService/deleteOrSharedSelfReport"},
{"WebAppService","deleteSecondTypeTicket","/v1/faultService/deleteSecondTypeTicket"},
{"WebAppService","deleteSparePartsById","/v1/otherService/deleteSparePartsById"},
{"WebAppService","deleteWorkTicket","/v1/faultService/deleteWorkTicket"},
{"WebAppService","deviceFactoryList","/v1/devService/deviceFactoryList"},
{"WebAppService","dispartDataPageList","/v1/commonService/dispartDataPageList"},
{"WebAppService","executeTask","/v1/faultService/executeTask"},
{"WebAppService","findCurrentTask","/v1/faultService/findCurrentTask"},
{"WebAppService","findDeviceMessageByPskey","/v1/devService/findDeviceMessageByPskey"},
{"WebAppService","findFactoryMessage","/v1/devService/findFactoryMessage"},
{"WebAppService","findImgResources","/v1/faultService/findImgResources"},
{"WebAppService","findMateiralSubType","/v1/otherService/findMateiralSubType"},
{"WebAppService","findMaterialById","/v1/otherService/findMaterialById"},
{"WebAppService","findMyDealedCurrentTask","/v1/faultService/findMyDealedCurrentTask"},
{"WebAppService","findMyDealedImgResources","/v1/faultService/findMyDealedImgResources"},
{"WebAppService","findSeriesInverterData","/v1/devService/findSeriesInverterData"},
{"WebAppService","findWebRole","/v1/userService/findWebRole"},
{"WebAppService","getAllPsFaultCount","/v1/faultService/getAllPsFaultCount"},
{"WebAppService","getAllPsFaultCountByUserId","/v1/faultService/getAllPsFaultCountByUserId"},
{"WebAppService","getAllPsList","/v1/powerStationService/getAllPsList"},
{"WebAppService","getAllStore","/v1/otherService/getAllStore"},
{"WebAppService","getBaseDeviceInfo","/v1/devService/getBaseDeviceInfo"},
{"WebAppService","getBoxData","/v1/devService/getBoxData"},
{"WebAppService","getCBoxTree","/v1/devService/getCBoxTree"},
{"WebAppService","getCheckDevTypeList","/v1/devService/getCheckDevTypeList"},
{"WebAppService","getCheckUserList","/v1/userService/getCheckUserList"},
{"WebAppService","getChildOrg","/v1/otherService/getChildOrg"},
{"WebAppService","getCo","/v1/powerStationService/getCo"},
{"WebAppService","getCodeTreeMap","/v1/commonService/getCodeTreeMap"},
{"WebAppService","getDST","/v1/userService/getDST"},
{"WebAppService","getDataCounts","/v1/commonService/getDataCounts"},
{"WebAppService","getDataInfo","/v1/powerStationService/getDataInfo"},
{"WebAppService","getDevList","/v1/devService/getDevList"},
{"WebAppService","getDevName","/v1/devService/getDevName"},
{"WebAppService","getDevTypeList","/v1/devService/getDevTypeList"},
{"WebAppService","getDeviceDataList","/v1/reportService/getDeviceDataList"},
{"WebAppService","getDeviceFactory","/v1/devService/getDeviceFactory"},
{"WebAppService","getDeviceInfoForCheck","/v1/devService/getDeviceInfoForCheck"},
{"WebAppService","getDevicePointAttrs","/v1/devService/getDevicePointAttrs"},
{"WebAppService","getDeviceTreeChild","/v1/devService/getDeviceTreeChild"},
{"WebAppService","getDeviceUuid","/v1/devService/getDeviceUuid"},
{"WebAppService","getDutyInfoById","/v1/otherService/getDutyInfoById"},
{"WebAppService","getDutyOrgZtree","/v1/otherService/getDutyOrgZtree"},
{"WebAppService","getElecEffectList","/v1/faultService/getElecEffectList"},
{"WebAppService","getEnvironmentInfo","/v1/devService/getEnvironmentInfo"},
{"WebAppService","getFaultList","/v1/faultService/getFaultList"},
{"WebAppService","getFaultName","/v1/faultService/getFaultName"},
{"WebAppService","getFaultOrder","/v1/faultService/getFaultOrder"},
{"WebAppService","getFaultOrderByOrderId","/v1/faultService/getFaultOrderByOrderId"},
{"WebAppService","getFaultOrderList","/v1/faultService/getFaultOrderList"},
{"WebAppService","getFaultOrderStepList","/v1/faultService/getFaultOrderStepList"},
{"WebAppService","getHTRoleList","/v1/userService/getHTRoleList"},
{"WebAppService","getHistoryComments","/v1/faultService/getHistoryComments"},
{"WebAppService","getInfo","/v1/devService/getInfo"},
{"WebAppService","getInverteTableListCount","/v1/devService/getInverteTableListCount"},
{"WebAppService","getInverterDiscreteDistributioList","/v1/reportService/getInverterDiscreteDistributioList"},
{"WebAppService","getInverterDiscreteList","/v1/reportService/getInverterDiscreteList"},
{"WebAppService","getInverterFactoryList","/v1/reportService/getInverterFactoryList"},
{"WebAppService","getInverterInfo","/v1/devService/getInverterInfo"},
{"WebAppService","getLoadCurveList","/v1/reportService/getLoadCurveList"},
{"WebAppService","getMultiPowers","/v1/devService/getMultiPowers"},
{"WebAppService","getOndutyQuery","/v1/otherService/getOndutyQuery"},
{"WebAppService","getOperateTicketUserList","/v1/faultService/getOperateTicketUserList"},
{"WebAppService","getOptTicketsAttachments","/v1/faultService/getOptTicketsAttachments"},
{"WebAppService","getOrderCount","/v1/faultService/getOrderCount"},
{"WebAppService","getOrderData","/v1/faultService/getOrderData"},
{"WebAppService","getOrderDataSize","/v1/faultService/getOrderDataSize"},
{"WebAppService","getOrgPsEquipmentList","/v1/faultService/getOrgPsEquipmentList"},
{"WebAppService","getOrgPsPowerGenerationSummaryReport","/v1/reportService/getOrgPsPowerGenerationSummaryReport"},
{"WebAppService","getParentUidChain","/v1/devService/getParentUidChain"},
{"WebAppService","getPowerKwhkwpList","/v1/powerStationService/getPowerKwhkwpList"},
{"WebAppService","getPowerPrList","/v1/powerStationService/getPowerPrList"},
{"WebAppService","getPowerPredictionInfo","/v1/reportService/getPowerPredictionInfo"},
{"WebAppService","getPowerTrendDayData","/v1/powerStationService/getPowerTrendDayData"},
{"WebAppService","getPowerTrendMonthData","/v1/powerStationService/getPowerTrendMonthData"},
{"WebAppService","getPowerTrendYearData","/v1/powerStationService/getPowerTrendYearData"},
{"WebAppService","getPowerValue","/v1/reportService/getPowerValue"},
{"WebAppService","getPsBlock","/v1/devService/getPsBlock"},
{"WebAppService","getPsBlockData","/v1/devService/getPsBlockData"},
{"WebAppService","getPsBlockTree","/v1/devService/getPsBlockTree"},
{"WebAppService","getPsBoxListCount","/v1/devService/getPsBoxListCount"},
{"WebAppService","getPsCBoxDetail","/v1/devService/getPsCBoxDetail"},
{"WebAppService","getPsContact","/v1/powerStationService/getPsContact"},
{"WebAppService","getPsDataVal","/v1/devService/getPsDataVal"},
{"WebAppService","getPsDeviceCheckList","/v1/devService/getPsDeviceCheckList"},
{"WebAppService","getPsDeviceFaultList","/v1/faultService/getPsDeviceFaultList"},
{"WebAppService","getPsFaultList","/v1/faultService/getPsFaultList"},
{"WebAppService","getPsIdByUserId","/v1/powerStationService/getPsIdByUserId"},
{"WebAppService","getPsIdState","/v1/powerStationService/getPsIdState"},
{"WebAppService","getPsList","/v1/powerStationService/getPsListForWeb"},
{"WebAppService","getPsListForWorkTicket","/v1/faultService/getPsListForWorkTicket"},
{"WebAppService","getPsPictureMessage","/v1/powerStationService/getPsPictureMessage"},
{"WebAppService","getPsTicketSizeAndClockNum","/v1/faultService/getPsTicketSizeAndClockNum"},
{"WebAppService","getPsTree","/v1/devService/getPsTree"},
{"WebAppService","getPsTreeChild","/v1/devService/getPsTreeChild"},
{"WebAppService","getPsUserList","/v1/userService/getPsUserList"},
{"WebAppService","getPsValue","/v1/powerStationService/getPsValue"},
{"WebAppService","getPscSeriseData","/v1/devService/getPscSeriseData"},
{"WebAppService","getReportInfoByReportId","/v1/reportService/getReportInfoByReportId"},
{"WebAppService","getReportListByType","/v1/reportService/getReportListByType"},
{"WebAppService","getReportPsTree","/v1/reportService/getReportPsTree"},
{"WebAppService","getRoleList","/v1/userService/getRoleList"},
{"WebAppService","getSafeEffectList","/v1/faultService/getSafeEffectList"},
{"WebAppService","getSecondTypeTicketList","/v1/faultService/getSecondTypeTicketList"},
{"WebAppService","getSecondTypeTicketListForTicketDetail","/v1/faultService/getSecondTypeTicketListForTicketDetail"},
{"WebAppService","getSelfReportPoint","/v1/reportService/getSelfReportPoint"},
{"WebAppService","getSparePartsDetail","/v1/otherService/getSparePartsDetail"},
{"WebAppService","getStatementList","/v1/reportService/getStatementList"},
{"WebAppService","getStoreByStationId","/v1/otherService/getStoreByStationId"},
{"WebAppService","getSysUserList","/v1/userService/getSysUserList"},
{"WebAppService","getTableList","/v1/devService/getTableList"},
{"WebAppService","getUserList","/v1/userService/getUserList"},
{"WebAppService","getWeather","/v1/powerStationService/getWeather"},
{"WebAppService","getWorkTicketList","/v1/faultService/getWorkTicketList"},
{"WebAppService","getWorkTicketListForTicketDetail","/v1/faultService/getWorkTicketListForTicketDetail"},
{"WebAppService","getWorkTicketRunningCount","/v1/faultService/getWorkTicketRunningCount"},
{"WebAppService","getWorkTicketUserList","/v1/faultService/getWorkTicketUserList"},
{"WebAppService","getinverterType","/v1/devService/getinverterType"},
{"WebAppService","getreportPermissionByUser","/v1/reportService/getPsIdByUserId"},
{"WebAppService","handleValue","/v1/reportService/handleValue"},
{"WebAppService","modifyDeviceInfo","/v1/devService/modifyDeviceInfo"},
{"WebAppService","operaStoreSpareParts","/v1/otherService/operaStoreSpareParts"},
{"WebAppService","operateBillTransferToUser","/v1/faultService/operateBillTransferToUser"},
{"WebAppService","queryAllStockInventory","/v1/otherService/queryAllStockInventory"},
{"WebAppService","queryBatteryBoardsList","/v1/devService/queryBatteryBoardsList"},
{"WebAppService","queryBatteryBoardsPointsData","/v1/devService/queryBatteryBoardsPointsData"},
{"WebAppService","queryCodeByType","/v1/commonService/queryCodeByType"},
{"WebAppService","queryDeviceInfoList","/v1/devService/queryDeviceInfoList"},
{"WebAppService","queryElectricityCalendarData","/v1/reportService/queryElectricityCalendarData"},
{"WebAppService","queryFaultCodes","/v1/faultService/queryFaultCodes"},
{"WebAppService","queryFaultLevelAndType","/v1/faultService/queryFaultLevelAndType"},
{"WebAppService","queryFaultNames","/v1/faultService/queryFaultNames"},
{"WebAppService","queryMaterialType","/v1/otherService/queryMaterialType"},
{"WebAppService","queryNounAndKlgList","/v1/faultService/queryNounAndKlgList"},
{"WebAppService","queryNounList","/v1/faultService/queryNounList"},
{"WebAppService","queryOptTickctInfo","/v1/faultService/queryOptTickctInfo"},
{"WebAppService","queryOrgIdByUser","/v1/userService/queryOrgIdByUser"},
{"WebAppService","queryPsCountryList","/v1/commonService/queryPsCountryList"},
{"WebAppService","queryPsProvcnList","/v1/commonService/queryPsProvcnList"},
{"WebAppService","queryPsTypeByPsId","/v1/powerStationService/queryPsTypeByPsId"},
{"WebAppService","querySparePartsList","/v1/otherService/querySparePartsList"},
{"WebAppService","queryStoreList","/v1/otherService/queryStoreList"},
{"WebAppService","querySysTimezone","/v1/commonService/querySysTimezone"},
{"WebAppService","queryUnInventorySpareList","/v1/otherService/queryUnInventorySpareList"},
{"WebAppService","queryUserCurveTemplateData","/v1/devService/queryUserCurveTemplateData"},
{"WebAppService","renewOperation","/v1/devService/renewOperation"},
{"WebAppService","saveCustomReport","/v1/reportService/saveCustomReport"},
{"WebAppService","saveDutyInfo","/v1/otherService/saveDutyInfo"},
{"WebAppService","saveInventory","/v1/otherService/saveInventory"},
{"WebAppService","saveMaterial","/v1/devService/saveMaterial"},
{"WebAppService","saveSecondTypeTicket","/v1/faultService/saveSecondTypeTicket"},
{"WebAppService","saveSelfReportPoint","/v1/reportService/saveSelfReportPoint"},
{"WebAppService","saveWorkTicket","/v1/faultService/saveWorkTicket"},
{"WebAppService","secondTypeTicketFlowImplementStep","/v1/faultService/secondTypeTicketFlowImplementStep"},
{"WebAppService","secondTypeTicketFlowTransferStep","/v1/faultService/secondTypeTicketFlowTransferStep"},
{"WebAppService","secondTypeUpdateSign","/v1/faultService/secondTypeUpdateSign"},
{"WebAppService","selectPowerPageList","/v1/powerStationService/selectPowerPageList"},
{"WebAppService","showAnalyzefxDetail","/v1/reportService/showAnalyzefxDetail"},
{"WebAppService","showFxReport","/v1/reportService/showFxReport"},
{"WebAppService","showMaterNameList","/v1/otherService/showMaterNameList"},
{"WebAppService","showMaterSubTypeList","/v1/otherService/showMaterSubTypeList"},
{"WebAppService","showPSView","/v1/powerStationService/showPSView"},
{"WebAppService","showTjReport","/v1/reportService/showTjReport"},
{"WebAppService","templateLikesInfo","/v1/faultService/templateLikesInfo"},
{"WebAppService","updOptTicketInfo","/v1/faultService/updOptTicketInfo"},
{"WebAppService","updataWorkTicketAfterStartProcess","/v1/faultService/updataWorkTicketAfterStartProcess"},
{"WebAppService","updateBillTicketForTask","/v1/faultService/updateBillTicketForTask"},
{"WebAppService","updateDutyInfo","/v1/otherService/updateDutyInfo"},
{"WebAppService","updateKnowledgeBaseUseNumber","/v1/faultService/updateKnowledgeBaseUseNumber"},
{"WebAppService","updateMaterial","/v1/otherService/updateMaterial"},
{"WebAppService","updateSpareParts","/v1/otherService/updateSpareParts"},
{"WebAppService","updateStopReason","/v1/devService/updateStopReason"},
{"WebAppService","updateTemplate","/v1/faultService/updateKnowledgeBaseCitationCount"},
}
var _ api.Area = (*Area)(nil)
type Area api.AreaStruct
func init() {
// name := api.GetArea(Area{})
// fmt.Printf("Name: %s\n", name)
}
func Init(apiRoot *api.Web) Area {
area := Area {
ApiRoot: apiRoot,
Name: api.GetArea(Area{}),
EndPoints: api.TypeEndPoints {
api.GetName(showPSView.EndPoint{}): showPSView.Init(apiRoot),
},
}
return area
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
func GetAreaName() string {
return string(api.GetArea(Area{}))
}
func (a Area) GetEndPoint(name api.EndPointName) api.EndPoint {
var ret api.EndPoint
for _, e := range a.EndPoints {
// fmt.Printf("endpoint: %v\n", e)
if e.GetName() == name {
ret = e
break
}
}
return ret
}
// ****************************************
// Methods scoped by api.Area interface type
func (a Area) Init(apiRoot *api.Web) api.AreaStruct {
panic("implement me")
}
func (a Area) GetAreaName() api.AreaName {
return a.Name
}
func (a Area) GetEndPoints() api.TypeEndPoints {
for _, endpoint := range a.EndPoints {
fmt.Printf("endpoint: %v\n", endpoint)
}
return a.EndPoints
}
func (a Area) Call(name api.EndPointName) api.Json {
panic("implement me")
}
func (a Area) SetRequest(name api.EndPointName, ref interface{}) error {
panic("implement me")
}
func (a Area) GetRequest(name api.EndPointName) api.Json {
panic("implement me")
}
func (a Area) GetResponse(name api.EndPointName) api.Json {
panic("implement me")
}
func (a Area) GetData(name api.EndPointName) api.Json {
panic("implement me")
}
func (a Area) IsValid(name api.EndPointName) error {
panic("implement me")
}
func (a Area) GetError(name api.EndPointName) error {
panic("implement me")
}

View File

@ -0,0 +1,143 @@
package queryUserCurveTemplateData
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api/apiReflect"
"encoding/json"
"fmt"
)
const Url = "/v1/devService/queryUserCurveTemplateData"
// {"template_id":"","date_type":"","start_time":"","end_time":""}
type RequestData struct {
TemplateID string `json:"template_id" required:"true"`
DateType string `json:"date_type" required:"true"`
StartTime string `json:"start_time" required:"true"`
EndTime string `json:"end_time" required:"true"`
}
func (rd RequestData) IsValid() error {
return apiReflect.VerifyOptionsRequired(rd)
}
func (rd RequestData) Help() string {
ret := fmt.Sprintln("template_id: Use AppService.getTemplateList for ids.")
ret += fmt.Sprintln("date_type: Day = 1")
ret += fmt.Sprintln("\tstart_time: Format YYYYmmddHHMM00")
ret += fmt.Sprintln("\tend_time: Format YYYYmmddHHMM00")
ret += fmt.Sprintln("date_type: Month = 2")
ret += fmt.Sprintln("\tstart_time: Format YYYYmm")
ret += fmt.Sprintln("\tend_time: Format YYYYmm")
ret += fmt.Sprintln("date_type: Year = 3")
ret += fmt.Sprintln("\tstart_time: Format YYYY")
ret += fmt.Sprintln("\tend_time: Format YYYY")
return ret
}
// ResultData -> PointsData -> []Devices -> []Points
type ResultData struct {
CreateTime string `json:"create_time"`
Cycle string `json:"cycle"`
DateType string `json:"date_type"`
EndTime string `json:"end_time"`
OpenTime string `json:"open_time"`
PointsData PointsData `json:"points_data"`
StartTime string `json:"start_time"`
TemplateID string `json:"template_id"`
TemplateName string `json:"template_name"`
UpdateTime string `json:"update_time"`
}
type PointsData struct {
Devices Devices `json:"devices"`
Order string `json:"order"`
}
type DecodePointsData PointsData
func (p *PointsData) UnmarshalJSON(data []byte) error {
var err error
for range Only.Once {
if len(data) == 0 {
break
}
var pd DecodePointsData
// Store PointsData.Order
err = json.Unmarshal(data, &pd)
p.Order = pd.Order
// Store PointsData.Devices
_ = json.Unmarshal(data, &pd.Devices)
for i, k := range pd.Devices {
if k.DeviceName == "" {
delete(pd.Devices, i)
}
// fmt.Printf("%v - %v - %v\n", k.DeviceName, k.DeviceUUID, k.DeviceType)
}
p.Devices = pd.Devices
}
return err
}
type Devices map[string]DeviceData
type DeviceData struct {
DeviceName string `json:"device_name"`
DeviceType int64 `json:"device_type"`
DeviceUUID int64 `json:"device_uuid"`
Points Points `json:"points"`
}
type DecodeDeviceData DeviceData
func (p *DeviceData) UnmarshalJSON(data []byte) error {
var err error
for range Only.Once {
if len(data) == 0 {
break
}
var dd DecodeDeviceData
// Store DeviceData extras
_ = json.Unmarshal(data, &dd)
p.DeviceName = dd.DeviceName
p.DeviceType = dd.DeviceType
p.DeviceUUID = dd.DeviceUUID
// Store DeviceData.Points
_ = json.Unmarshal(data, &dd.Points)
for i, k := range dd.Points {
if k.PointID == "" {
delete(dd.Points, i)
continue
}
}
p.Points = dd.Points
}
return err
}
type Points map[string]Point
type Point struct {
Color string `json:"color"`
DataList []struct {
TimeStamp string `json:"time_stamp"`
Value string `json:"value"`
} `json:"data_list"`
DetailID string `json:"detail_id"`
PointID string `json:"point_id"`
PointName string `json:"point_name"`
PsID string `json:"ps_id"`
PsKey string `json:"ps_key"`
PsName string `json:"ps_name"`
Statistics string `json:"statistics"`
Style string `json:"style"`
Unit string `json:"unit"`
}

View File

@ -0,0 +1,222 @@
package queryUserCurveTemplateData
import (
"GoSungro/Only"
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/api/apiReflect"
"encoding/json"
"errors"
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Response Response
}
type Request struct {
api.RequestCommon
RequestData
}
type Response struct {
api.ResponseCommon
ResultData ResultData `json:"result_data"`
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
Url: api.SetUrl(Url),
Request: Request{},
Response: Response{},
Error: nil,
},
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
func (e EndPoint) Init(apiRoot *api.Web) *EndPoint {
ret := Init(apiRoot)
return &ret
}
func (e EndPoint) GetRequest() Request {
return e.Request
}
func (e EndPoint) GetResponse() Response {
return e.Response
}
func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
func (e EndPoint) Help() string {
ret := apiReflect.HelpOptions(e.Request.RequestData)
ret += fmt.Sprintf("JSON request:\t%s\n", e.GetRequestJson())
ret += e.Request.Help()
return ret
}
func (e EndPoint) GetArea() api.AreaName {
return e.Area
}
func (e EndPoint) GetName() api.EndPointName {
return e.Name
}
func (e EndPoint) GetUrl() api.EndPointUrl {
return e.Url
}
func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {
e.EndPointStruct.Error = errors.New(fmt.Sprintf(format, a...))
return e
}
func (e EndPoint) GetError() error {
return e.EndPointStruct.Error
}
func (e EndPoint) IsError() bool {
if e.Error != nil {
return true
}
return false
}
func (e EndPoint) SetRequest(ref interface{}) api.EndPoint {
for range Only.Once {
if apiReflect.GetPkgType(ref) == "api.RequestCommon" {
e.Request.RequestCommon = ref.(api.RequestCommon)
break
}
if apiReflect.GetType(ref) == "RequestData" {
e.Request.RequestData = ref.(RequestData)
e.Error = e.IsRequestValid()
break
}
e.Error = apiReflect.DoPkgTypesMatch(e.Request, ref)
if e.Error != nil {
break
}
e.Request = ref.(Request)
}
return e
}
func (e EndPoint) SetRequestByJson(j api.Json) api.EndPoint {
for range Only.Once {
e.Error = json.Unmarshal([]byte(j), &e.Request.RequestData)
if e.Error != nil {
break
}
e.Error = e.IsRequestValid()
if e.Error != nil {
break
}
}
return e
}
func (e EndPoint) RequestRef() interface{} {
return e.Request
}
func (e EndPoint) GetRequestJson() api.Json {
return api.GetAsJson(e.Request.RequestData)
}
func (e EndPoint) IsRequestValid() error {
for range Only.Once {
req := e.GetRequest()
// req := e.Request.RequestCommon
e.Error = req.RequestCommon.IsValid()
if e.Error != nil {
break
}
e.Error = req.RequestData.IsValid()
if e.Error != nil {
break
}
}
return e.Error
}
func (e EndPoint) SetResponse(ref []byte) api.EndPoint {
for range Only.Once {
// r := e.GetResponse()
// e.Error = json.Unmarshal(ref, &r)
e.Error = json.Unmarshal(ref, &e.Response)
if e.Error != nil {
break
}
// e.ResponseCommon = r
}
return e
}
func (e EndPoint) GetResponseJson() api.Json {
return api.GetAsPrettyJson(e.Response)
}
func (e EndPoint) ResponseRef() interface{} {
return e.Response
}
func (e EndPoint) IsResponseValid() error {
for range Only.Once {
// resp := e.GetResponse()
// e.Error = resp.ResponseCommon.IsValid()
e.Error = e.Response.ResponseCommon.IsValid()
if e.Error != nil {
break
}
}
return e.Error
}
func (e EndPoint) String() string {
return api.GetEndPointString(e)
}
func (e EndPoint) RequestString() string {
return api.GetRequestString(e.Request)
}
func (e EndPoint) ResponseString() string {
return api.GetRequestString(e.Response)
}
func (e EndPoint) MarshalJSON() ([]byte, error) {
return api.MarshalJSON(e)
}

View File

@ -9,12 +9,11 @@ import (
"fmt"
)
var _ api.EndPoint = (*EndPoint)(nil)
type EndPoint struct {
api.EndPointStruct
Request Request
Request Request
Response Response
}
@ -29,8 +28,8 @@ type Response struct {
}
func Init(apiRoot *api.Web) EndPoint {
return EndPoint {
EndPointStruct: api.EndPointStruct {
return EndPoint{
EndPointStruct: api.EndPointStruct{
ApiRoot: apiRoot,
Area: api.GetArea(EndPoint{}),
Name: api.GetName(EndPoint{}),
@ -42,7 +41,6 @@ func Init(apiRoot *api.Web) EndPoint {
}
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
@ -63,7 +61,6 @@ func Assert(e api.EndPoint) EndPoint {
return e.(EndPoint)
}
// ****************************************
// Methods defined by api.EndPoint interface type
@ -90,8 +87,12 @@ func (e EndPoint) Call() api.EndPoint {
return e.ApiRoot.Get(e)
}
func (e EndPoint) GetData() api.Json {
return api.GetAsPrettyJson(e.Response.ResultData)
func (e EndPoint) GetData(raw bool) api.Json {
if raw {
return api.Json(e.ApiRoot.Body)
} else {
return api.GetAsPrettyJson(e.Response.ResultData)
}
}
func (e EndPoint) SetError(format string, a ...interface{}) api.EndPoint {

View File

@ -0,0 +1,475 @@
// API endpoints pulled from the sqlite database, (./assets/interface.db), contained within the Android app com.isolarcloud.manager
package WebAppService
import (
"GoSungro/iSolarCloud/api"
"GoSungro/iSolarCloud/sungro/WebAppService/queryUserCurveTemplateData"
"GoSungro/iSolarCloud/sungro/WebAppService/showPSView"
"fmt"
)
var _ api.Area = (*Area)(nil)
// var endpoints = [][]string{
// {"WebAppService", "addMaterial", "/v1/otherService/addMaterial"},
// {"WebAppService", "addOptTicketInfo", "/v1/faultService/addOptTicketInfo"},
// {"WebAppService", "addSpareParts", "/v1/otherService/addSpareParts"},
// {"WebAppService", "associateQueryFaultNames", "/v1/faultService/associateQueryFaultNames"},
// {"WebAppService", "auditPsDeviceCheck", "/v1/devService/auditPsDeviceCheck"},
// {"WebAppService", "calcOutputRankByDay", "/v1/powerStationService/calcOutputRankByDay"},
// {"WebAppService", "changeReadStatus", "/v1/reportService/changeReadStatus"},
// {"WebAppService", "checkMaterialName", "/v1/otherService/checkMaterialName"},
// {"WebAppService", "confirmFault", "/v1/faultService/confirmOrCloseFault"},
// {"WebAppService", "copeOperateTicket", "/v1/faultService/copeOperateTicket"},
// {"WebAppService", "copySecondTypeTicket", "/v1/faultService/copySecondTypeTicket"},
// {"WebAppService", "copyWorkTicket", "/v1/faultService/copyWorkTicket"},
// {"WebAppService", "delOptTicketInfo", "/v1/faultService/delOptTicketInfo"},
// {"WebAppService", "deleteDuty", "/v1/otherService/deleteDuty"},
// {"WebAppService", "deleteDutyMid", "/v1/otherService/deleteDutyMid"},
// {"WebAppService", "deleteMaterial", "/v1/otherService/deleteMaterial"},
// {"WebAppService", "deleteOrSharedSelfReport", "/v1/reportService/deleteOrSharedSelfReport"},
// {"WebAppService", "deleteSecondTypeTicket", "/v1/faultService/deleteSecondTypeTicket"},
// {"WebAppService", "deleteSparePartsById", "/v1/otherService/deleteSparePartsById"},
// {"WebAppService", "deleteWorkTicket", "/v1/faultService/deleteWorkTicket"},
// {"WebAppService", "deviceFactoryList", "/v1/devService/deviceFactoryList"},
// {"WebAppService", "dispartDataPageList", "/v1/commonService/dispartDataPageList"},
// {"WebAppService", "executeTask", "/v1/faultService/executeTask"},
// {"WebAppService", "findCurrentTask", "/v1/faultService/findCurrentTask"},
// {"WebAppService", "findDeviceMessageByPskey", "/v1/devService/findDeviceMessageByPskey"},
// {"WebAppService", "findFactoryMessage", "/v1/devService/findFactoryMessage"},
// {"WebAppService", "findImgResources", "/v1/faultService/findImgResources"},
// {"WebAppService", "findMateiralSubType", "/v1/otherService/findMateiralSubType"},
// {"WebAppService", "findMaterialById", "/v1/otherService/findMaterialById"},
// {"WebAppService", "findMyDealedCurrentTask", "/v1/faultService/findMyDealedCurrentTask"},
// {"WebAppService", "findMyDealedImgResources", "/v1/faultService/findMyDealedImgResources"},
// {"WebAppService", "findSeriesInverterData", "/v1/devService/findSeriesInverterData"},
// {"WebAppService", "findWebRole", "/v1/userService/findWebRole"},
// {"WebAppService", "getAllPsFaultCount", "/v1/faultService/getAllPsFaultCount"},
// {"WebAppService", "getAllPsFaultCountByUserId", "/v1/faultService/getAllPsFaultCountByUserId"},
// {"WebAppService", "getAllPsList", "/v1/powerStationService/getAllPsList"},
// {"WebAppService", "getAllStore", "/v1/otherService/getAllStore"},
// {"WebAppService", "getBaseDeviceInfo", "/v1/devService/getBaseDeviceInfo"},
// {"WebAppService", "getBoxData", "/v1/devService/getBoxData"},
// {"WebAppService", "getCBoxTree", "/v1/devService/getCBoxTree"},
// {"WebAppService", "getCheckDevTypeList", "/v1/devService/getCheckDevTypeList"},
// {"WebAppService", "getCheckUserList", "/v1/userService/getCheckUserList"},
// {"WebAppService", "getChildOrg", "/v1/otherService/getChildOrg"},
// {"WebAppService", "getCo", "/v1/powerStationService/getCo"},
// {"WebAppService", "getCodeTreeMap", "/v1/commonService/getCodeTreeMap"},
// {"WebAppService", "getDST", "/v1/userService/getDST"},
// {"WebAppService", "getDataCounts", "/v1/commonService/getDataCounts"},
// {"WebAppService", "getDataInfo", "/v1/powerStationService/getDataInfo"},
// {"WebAppService", "getDevList", "/v1/devService/getDevList"},
// {"WebAppService", "getDevName", "/v1/devService/getDevName"},
// {"WebAppService", "getDevTypeList", "/v1/devService/getDevTypeList"},
// {"WebAppService", "getDeviceDataList", "/v1/reportService/getDeviceDataList"},
// {"WebAppService", "getDeviceFactory", "/v1/devService/getDeviceFactory"},
// {"WebAppService", "getDeviceInfoForCheck", "/v1/devService/getDeviceInfoForCheck"},
// {"WebAppService", "getDevicePointAttrs", "/v1/devService/getDevicePointAttrs"},
// {"WebAppService", "getDeviceTreeChild", "/v1/devService/getDeviceTreeChild"},
// {"WebAppService", "getDeviceUuid", "/v1/devService/getDeviceUuid"},
// {"WebAppService", "getDutyInfoById", "/v1/otherService/getDutyInfoById"},
// {"WebAppService", "getDutyOrgZtree", "/v1/otherService/getDutyOrgZtree"},
// {"WebAppService", "getElecEffectList", "/v1/faultService/getElecEffectList"},
// {"WebAppService", "getEnvironmentInfo", "/v1/devService/getEnvironmentInfo"},
// {"WebAppService", "getFaultList", "/v1/faultService/getFaultList"},
// {"WebAppService", "getFaultName", "/v1/faultService/getFaultName"},
// {"WebAppService", "getFaultOrder", "/v1/faultService/getFaultOrder"},
// {"WebAppService", "getFaultOrderByOrderId", "/v1/faultService/getFaultOrderByOrderId"},
// {"WebAppService", "getFaultOrderList", "/v1/faultService/getFaultOrderList"},
// {"WebAppService", "getFaultOrderStepList", "/v1/faultService/getFaultOrderStepList"},
// {"WebAppService", "getHTRoleList", "/v1/userService/getHTRoleList"},
// {"WebAppService", "getHistoryComments", "/v1/faultService/getHistoryComments"},
// {"WebAppService", "getInfo", "/v1/devService/getInfo"},
// {"WebAppService", "getInverteTableListCount", "/v1/devService/getInverteTableListCount"},
// {"WebAppService", "getInverterDiscreteDistributioList", "/v1/reportService/getInverterDiscreteDistributioList"},
// {"WebAppService", "getInverterDiscreteList", "/v1/reportService/getInverterDiscreteList"},
// {"WebAppService", "getInverterFactoryList", "/v1/reportService/getInverterFactoryList"},
// {"WebAppService", "getInverterInfo", "/v1/devService/getInverterInfo"},
// {"WebAppService", "getLoadCurveList", "/v1/reportService/getLoadCurveList"},
// {"WebAppService", "getMultiPowers", "/v1/devService/getMultiPowers"},
// {"WebAppService", "getOndutyQuery", "/v1/otherService/getOndutyQuery"},
// {"WebAppService", "getOperateTicketUserList", "/v1/faultService/getOperateTicketUserList"},
// {"WebAppService", "getOptTicketsAttachments", "/v1/faultService/getOptTicketsAttachments"},
// {"WebAppService", "getOrderCount", "/v1/faultService/getOrderCount"},
// {"WebAppService", "getOrderData", "/v1/faultService/getOrderData"},
// {"WebAppService", "getOrderDataSize", "/v1/faultService/getOrderDataSize"},
// {"WebAppService", "getOrgPsEquipmentList", "/v1/faultService/getOrgPsEquipmentList"},
// {"WebAppService", "getOrgPsPowerGenerationSummaryReport", "/v1/reportService/getOrgPsPowerGenerationSummaryReport"},
// {"WebAppService", "getParentUidChain", "/v1/devService/getParentUidChain"},
// {"WebAppService", "getPowerKwhkwpList", "/v1/powerStationService/getPowerKwhkwpList"},
// {"WebAppService", "getPowerPrList", "/v1/powerStationService/getPowerPrList"},
// {"WebAppService", "getPowerPredictionInfo", "/v1/reportService/getPowerPredictionInfo"},
// {"WebAppService", "getPowerTrendDayData", "/v1/powerStationService/getPowerTrendDayData"},
// {"WebAppService", "getPowerTrendMonthData", "/v1/powerStationService/getPowerTrendMonthData"},
// {"WebAppService", "getPowerTrendYearData", "/v1/powerStationService/getPowerTrendYearData"},
// {"WebAppService", "getPowerValue", "/v1/reportService/getPowerValue"},
// {"WebAppService", "getPsBlock", "/v1/devService/getPsBlock"},
// {"WebAppService", "getPsBlockData", "/v1/devService/getPsBlockData"},
// {"WebAppService", "getPsBlockTree", "/v1/devService/getPsBlockTree"},
// {"WebAppService", "getPsBoxListCount", "/v1/devService/getPsBoxListCount"},
// {"WebAppService", "getPsCBoxDetail", "/v1/devService/getPsCBoxDetail"},
// {"WebAppService", "getPsContact", "/v1/powerStationService/getPsContact"},
// {"WebAppService", "getPsDataVal", "/v1/devService/getPsDataVal"},
// {"WebAppService", "getPsDeviceCheckList", "/v1/devService/getPsDeviceCheckList"},
// {"WebAppService", "getPsDeviceFaultList", "/v1/faultService/getPsDeviceFaultList"},
// {"WebAppService", "getPsFaultList", "/v1/faultService/getPsFaultList"},
// {"WebAppService", "getPsIdByUserId", "/v1/powerStationService/getPsIdByUserId"},
// {"WebAppService", "getPsIdState", "/v1/powerStationService/getPsIdState"},
// {"WebAppService", "getPsList", "/v1/powerStationService/getPsListForWeb"},
// {"WebAppService", "getPsListForWorkTicket", "/v1/faultService/getPsListForWorkTicket"},
// {"WebAppService", "getPsPictureMessage", "/v1/powerStationService/getPsPictureMessage"},
// {"WebAppService", "getPsTicketSizeAndClockNum", "/v1/faultService/getPsTicketSizeAndClockNum"},
// {"WebAppService", "getPsTree", "/v1/devService/getPsTree"},
// {"WebAppService", "getPsTreeChild", "/v1/devService/getPsTreeChild"},
// {"WebAppService", "getPsUserList", "/v1/userService/getPsUserList"},
// {"WebAppService", "getPsValue", "/v1/powerStationService/getPsValue"},
// {"WebAppService", "getPscSeriseData", "/v1/devService/getPscSeriseData"},
// {"WebAppService", "getReportInfoByReportId", "/v1/reportService/getReportInfoByReportId"},
// {"WebAppService", "getReportListByType", "/v1/reportService/getReportListByType"},
// {"WebAppService", "getReportPsTree", "/v1/reportService/getReportPsTree"},
// {"WebAppService", "getRoleList", "/v1/userService/getRoleList"},
// {"WebAppService", "getSafeEffectList", "/v1/faultService/getSafeEffectList"},
// {"WebAppService", "getSecondTypeTicketList", "/v1/faultService/getSecondTypeTicketList"},
// {"WebAppService", "getSecondTypeTicketListForTicketDetail", "/v1/faultService/getSecondTypeTicketListForTicketDetail"},
// {"WebAppService", "getSelfReportPoint", "/v1/reportService/getSelfReportPoint"},
// {"WebAppService", "getSparePartsDetail", "/v1/otherService/getSparePartsDetail"},
// {"WebAppService", "getStatementList", "/v1/reportService/getStatementList"},
// {"WebAppService", "getStoreByStationId", "/v1/otherService/getStoreByStationId"},
// {"WebAppService", "getSysUserList", "/v1/userService/getSysUserList"},
// {"WebAppService", "getTableList", "/v1/devService/getTableList"},
// {"WebAppService", "getUserList", "/v1/userService/getUserList"},
// {"WebAppService", "getWeather", "/v1/powerStationService/getWeather"},
// {"WebAppService", "getWorkTicketList", "/v1/faultService/getWorkTicketList"},
// {"WebAppService", "getWorkTicketListForTicketDetail", "/v1/faultService/getWorkTicketListForTicketDetail"},
// {"WebAppService", "getWorkTicketRunningCount", "/v1/faultService/getWorkTicketRunningCount"},
// {"WebAppService", "getWorkTicketUserList", "/v1/faultService/getWorkTicketUserList"},
// {"WebAppService", "getinverterType", "/v1/devService/getinverterType"},
// {"WebAppService", "getreportPermissionByUser", "/v1/reportService/getPsIdByUserId"},
// {"WebAppService", "handleValue", "/v1/reportService/handleValue"},
// {"WebAppService", "modifyDeviceInfo", "/v1/devService/modifyDeviceInfo"},
// {"WebAppService", "operaStoreSpareParts", "/v1/otherService/operaStoreSpareParts"},
// {"WebAppService", "operateBillTransferToUser", "/v1/faultService/operateBillTransferToUser"},
// {"WebAppService", "queryAllStockInventory", "/v1/otherService/queryAllStockInventory"},
// {"WebAppService", "queryBatteryBoardsList", "/v1/devService/queryBatteryBoardsList"},
// {"WebAppService", "queryBatteryBoardsPointsData", "/v1/devService/queryBatteryBoardsPointsData"},
// {"WebAppService", "queryCodeByType", "/v1/commonService/queryCodeByType"},
// {"WebAppService", "queryDeviceInfoList", "/v1/devService/queryDeviceInfoList"},
// {"WebAppService", "queryElectricityCalendarData", "/v1/reportService/queryElectricityCalendarData"},
// {"WebAppService", "queryFaultCodes", "/v1/faultService/queryFaultCodes"},
// {"WebAppService", "queryFaultLevelAndType", "/v1/faultService/queryFaultLevelAndType"},
// {"WebAppService", "queryFaultNames", "/v1/faultService/queryFaultNames"},
// {"WebAppService", "queryMaterialType", "/v1/otherService/queryMaterialType"},
// {"WebAppService", "queryNounAndKlgList", "/v1/faultService/queryNounAndKlgList"},
// {"WebAppService", "queryNounList", "/v1/faultService/queryNounList"},
// {"WebAppService", "queryOptTickctInfo", "/v1/faultService/queryOptTickctInfo"},
// {"WebAppService", "queryOrgIdByUser", "/v1/userService/queryOrgIdByUser"},
// {"WebAppService", "queryPsCountryList", "/v1/commonService/queryPsCountryList"},
// {"WebAppService", "queryPsProvcnList", "/v1/commonService/queryPsProvcnList"},
// {"WebAppService", "queryPsTypeByPsId", "/v1/powerStationService/queryPsTypeByPsId"},
// {"WebAppService", "querySparePartsList", "/v1/otherService/querySparePartsList"},
// {"WebAppService", "queryStoreList", "/v1/otherService/queryStoreList"},
// {"WebAppService", "querySysTimezone", "/v1/commonService/querySysTimezone"},
// {"WebAppService", "queryUnInventorySpareList", "/v1/otherService/queryUnInventorySpareList"},
// {"WebAppService", "queryUserCurveTemplateData", "/v1/devService/queryUserCurveTemplateData"},
// {"WebAppService", "renewOperation", "/v1/devService/renewOperation"},
// {"WebAppService", "saveCustomReport", "/v1/reportService/saveCustomReport"},
// {"WebAppService", "saveDutyInfo", "/v1/otherService/saveDutyInfo"},
// {"WebAppService", "saveInventory", "/v1/otherService/saveInventory"},
// {"WebAppService", "saveMaterial", "/v1/devService/saveMaterial"},
// {"WebAppService", "saveSecondTypeTicket", "/v1/faultService/saveSecondTypeTicket"},
// {"WebAppService", "saveSelfReportPoint", "/v1/reportService/saveSelfReportPoint"},
// {"WebAppService", "saveWorkTicket", "/v1/faultService/saveWorkTicket"},
// {"WebAppService", "secondTypeTicketFlowImplementStep", "/v1/faultService/secondTypeTicketFlowImplementStep"},
// {"WebAppService", "secondTypeTicketFlowTransferStep", "/v1/faultService/secondTypeTicketFlowTransferStep"},
// {"WebAppService", "secondTypeUpdateSign", "/v1/faultService/secondTypeUpdateSign"},
// {"WebAppService", "selectPowerPageList", "/v1/powerStationService/selectPowerPageList"},
// {"WebAppService", "showAnalyzefxDetail", "/v1/reportService/showAnalyzefxDetail"},
// {"WebAppService", "showFxReport", "/v1/reportService/showFxReport"},
// {"WebAppService", "showMaterNameList", "/v1/otherService/showMaterNameList"},
// {"WebAppService", "showMaterSubTypeList", "/v1/otherService/showMaterSubTypeList"},
// {"WebAppService", "showPSView", "/v1/powerStationService/showPSView"},
// {"WebAppService", "showTjReport", "/v1/reportService/showTjReport"},
// {"WebAppService", "templateLikesInfo", "/v1/faultService/templateLikesInfo"},
// {"WebAppService", "updOptTicketInfo", "/v1/faultService/updOptTicketInfo"},
// {"WebAppService", "updataWorkTicketAfterStartProcess", "/v1/faultService/updataWorkTicketAfterStartProcess"},
// {"WebAppService", "updateBillTicketForTask", "/v1/faultService/updateBillTicketForTask"},
// {"WebAppService", "updateDutyInfo", "/v1/otherService/updateDutyInfo"},
// {"WebAppService", "updateKnowledgeBaseUseNumber", "/v1/faultService/updateKnowledgeBaseUseNumber"},
// {"WebAppService", "updateMaterial", "/v1/otherService/updateMaterial"},
// {"WebAppService", "updateSpareParts", "/v1/otherService/updateSpareParts"},
// {"WebAppService", "updateStopReason", "/v1/devService/updateStopReason"},
// {"WebAppService", "updateTemplate", "/v1/faultService/updateKnowledgeBaseCitationCount"},
// }
type Area api.AreaStruct
func init() {
// name := api.GetArea(Area{})
// fmt.Printf("Name: %s\n", name)
}
func Init(apiRoot *api.Web) Area {
area := Area{
ApiRoot: apiRoot,
Name: api.GetArea(Area{}),
EndPoints: api.TypeEndPoints{
// api.GetName(addMaterial.EndPoint{}): addMaterial.Init(apiRoot), // /v1/otherService/addMaterial}
// api.GetName(addOptTicketInfo.EndPoint{}): addOptTicketInfo.Init(apiRoot), // /v1/faultService/addOptTicketInfo}
// api.GetName(addSpareParts.EndPoint{}): addSpareParts.Init(apiRoot), // /v1/otherService/addSpareParts}
// api.GetName(associateQueryFaultNames.EndPoint{}): associateQueryFaultNames.Init(apiRoot), // /v1/faultService/associateQueryFaultNames}
// api.GetName(auditPsDeviceCheck.EndPoint{}): auditPsDeviceCheck.Init(apiRoot), // /v1/devService/auditPsDeviceCheck}
// api.GetName(calcOutputRankByDay.EndPoint{}): calcOutputRankByDay.Init(apiRoot), // /v1/powerStationService/calcOutputRankByDay}
// api.GetName(changeReadStatus.EndPoint{}): changeReadStatus.Init(apiRoot), // /v1/reportService/changeReadStatus}
// api.GetName(checkMaterialName.EndPoint{}): checkMaterialName.Init(apiRoot), // /v1/otherService/checkMaterialName}
// api.GetName(confirmFault.EndPoint{}): confirmFault.Init(apiRoot), // /v1/faultService/confirmOrCloseFault}
// api.GetName(copeOperateTicket.EndPoint{}): copeOperateTicket.Init(apiRoot), // /v1/faultService/copeOperateTicket}
// api.GetName(copySecondTypeTicket.EndPoint{}): copySecondTypeTicket.Init(apiRoot), // /v1/faultService/copySecondTypeTicket}
// api.GetName(copyWorkTicket.EndPoint{}): copyWorkTicket.Init(apiRoot), // /v1/faultService/copyWorkTicket}
// api.GetName(delOptTicketInfo.EndPoint{}): delOptTicketInfo.Init(apiRoot), // /v1/faultService/delOptTicketInfo}
// api.GetName(deleteDuty.EndPoint{}): deleteDuty.Init(apiRoot), // /v1/otherService/deleteDuty}
// api.GetName(deleteDutyMid.EndPoint{}): deleteDutyMid.Init(apiRoot), // /v1/otherService/deleteDutyMid}
// api.GetName(deleteMaterial.EndPoint{}): deleteMaterial.Init(apiRoot), // /v1/otherService/deleteMaterial}
// api.GetName(deleteOrSharedSelfReport.EndPoint{}): deleteOrSharedSelfReport.Init(apiRoot), // /v1/reportService/deleteOrSharedSelfReport}
// api.GetName(deleteSecondTypeTicket.EndPoint{}): deleteSecondTypeTicket.Init(apiRoot), // /v1/faultService/deleteSecondTypeTicket}
// api.GetName(deleteSparePartsById.EndPoint{}): deleteSparePartsById.Init(apiRoot), // /v1/otherService/deleteSparePartsById}
// api.GetName(deleteWorkTicket.EndPoint{}): deleteWorkTicket.Init(apiRoot), // /v1/faultService/deleteWorkTicket}
// api.GetName(deviceFactoryList.EndPoint{}): deviceFactoryList.Init(apiRoot), // /v1/devService/deviceFactoryList}
// api.GetName(dispartDataPageList.EndPoint{}): dispartDataPageList.Init(apiRoot), // /v1/commonService/dispartDataPageList}
// api.GetName(executeTask.EndPoint{}): executeTask.Init(apiRoot), // /v1/faultService/executeTask}
// api.GetName(findCurrentTask.EndPoint{}): findCurrentTask.Init(apiRoot), // /v1/faultService/findCurrentTask}
// api.GetName(findDeviceMessageByPskey.EndPoint{}): findDeviceMessageByPskey.Init(apiRoot), // /v1/devService/findDeviceMessageByPskey}
// api.GetName(findFactoryMessage.EndPoint{}): findFactoryMessage.Init(apiRoot), // /v1/devService/findFactoryMessage}
// api.GetName(findImgResources.EndPoint{}): findImgResources.Init(apiRoot), // /v1/faultService/findImgResources}
// api.GetName(findMateiralSubType.EndPoint{}): findMateiralSubType.Init(apiRoot), // /v1/otherService/findMateiralSubType}
// api.GetName(findMaterialById.EndPoint{}): findMaterialById.Init(apiRoot), // /v1/otherService/findMaterialById}
// api.GetName(findMyDealedCurrentTask.EndPoint{}): findMyDealedCurrentTask.Init(apiRoot), // /v1/faultService/findMyDealedCurrentTask}
// api.GetName(findMyDealedImgResources.EndPoint{}): findMyDealedImgResources.Init(apiRoot), // /v1/faultService/findMyDealedImgResources}
// api.GetName(findSeriesInverterData.EndPoint{}): findSeriesInverterData.Init(apiRoot), // /v1/devService/findSeriesInverterData}
// api.GetName(findWebRole.EndPoint{}): findWebRole.Init(apiRoot), // /v1/userService/findWebRole}
// api.GetName(getAllPsFaultCount.EndPoint{}): getAllPsFaultCount.Init(apiRoot), // /v1/faultService/getAllPsFaultCount}
// api.GetName(getAllPsFaultCountByUserId.EndPoint{}): getAllPsFaultCountByUserId.Init(apiRoot), // /v1/faultService/getAllPsFaultCountByUserId}
// api.GetName(getAllPsList.EndPoint{}): getAllPsList.Init(apiRoot), // /v1/powerStationService/getAllPsList}
// api.GetName(getAllStore.EndPoint{}): getAllStore.Init(apiRoot), // /v1/otherService/getAllStore}
// api.GetName(getBaseDeviceInfo.EndPoint{}): getBaseDeviceInfo.Init(apiRoot), // /v1/devService/getBaseDeviceInfo}
// api.GetName(getBoxData.EndPoint{}): getBoxData.Init(apiRoot), // /v1/devService/getBoxData}
// api.GetName(getCBoxTree.EndPoint{}): getCBoxTree.Init(apiRoot), // /v1/devService/getCBoxTree}
// api.GetName(getCheckDevTypeList.EndPoint{}): getCheckDevTypeList.Init(apiRoot), // /v1/devService/getCheckDevTypeList}
// api.GetName(getCheckUserList.EndPoint{}): getCheckUserList.Init(apiRoot), // /v1/userService/getCheckUserList}
// api.GetName(getChildOrg.EndPoint{}): getChildOrg.Init(apiRoot), // /v1/otherService/getChildOrg}
// api.GetName(getCo.EndPoint{}): getCo.Init(apiRoot), // /v1/powerStationService/getCo}
// api.GetName(getCodeTreeMap.EndPoint{}): getCodeTreeMap.Init(apiRoot), // /v1/commonService/getCodeTreeMap}
// api.GetName(getDST.EndPoint{}): getDST.Init(apiRoot), // /v1/userService/getDST}
// api.GetName(getDataCounts.EndPoint{}): getDataCounts.Init(apiRoot), // /v1/commonService/getDataCounts}
// api.GetName(getDataInfo.EndPoint{}): getDataInfo.Init(apiRoot), // /v1/powerStationService/getDataInfo}
// api.GetName(getDevList.EndPoint{}): getDevList.Init(apiRoot), // /v1/devService/getDevList}
// api.GetName(getDevName.EndPoint{}): getDevName.Init(apiRoot), // /v1/devService/getDevName}
// api.GetName(getDevTypeList.EndPoint{}): getDevTypeList.Init(apiRoot), // /v1/devService/getDevTypeList}
// api.GetName(getDeviceDataList.EndPoint{}): getDeviceDataList.Init(apiRoot), // /v1/reportService/getDeviceDataList}
// api.GetName(getDeviceFactory.EndPoint{}): getDeviceFactory.Init(apiRoot), // /v1/devService/getDeviceFactory}
// api.GetName(getDeviceInfoForCheck.EndPoint{}): getDeviceInfoForCheck.Init(apiRoot), // /v1/devService/getDeviceInfoForCheck}
// api.GetName(getDevicePointAttrs.EndPoint{}): getDevicePointAttrs.Init(apiRoot), // /v1/devService/getDevicePointAttrs}
// api.GetName(getDeviceTreeChild.EndPoint{}): getDeviceTreeChild.Init(apiRoot), // /v1/devService/getDeviceTreeChild}
// api.GetName(getDeviceUuid.EndPoint{}): getDeviceUuid.Init(apiRoot), // /v1/devService/getDeviceUuid}
// api.GetName(getDutyInfoById.EndPoint{}): getDutyInfoById.Init(apiRoot), // /v1/otherService/getDutyInfoById}
// api.GetName(getDutyOrgZtree.EndPoint{}): getDutyOrgZtree.Init(apiRoot), // /v1/otherService/getDutyOrgZtree}
// api.GetName(getElecEffectList.EndPoint{}): getElecEffectList.Init(apiRoot), // /v1/faultService/getElecEffectList}
// api.GetName(getEnvironmentInfo.EndPoint{}): getEnvironmentInfo.Init(apiRoot), // /v1/devService/getEnvironmentInfo}
// api.GetName(getFaultList.EndPoint{}): getFaultList.Init(apiRoot), // /v1/faultService/getFaultList}
// api.GetName(getFaultName.EndPoint{}): getFaultName.Init(apiRoot), // /v1/faultService/getFaultName}
// api.GetName(getFaultOrder.EndPoint{}): getFaultOrder.Init(apiRoot), // /v1/faultService/getFaultOrder}
// api.GetName(getFaultOrderByOrderId.EndPoint{}): getFaultOrderByOrderId.Init(apiRoot), // /v1/faultService/getFaultOrderByOrderId}
// api.GetName(getFaultOrderList.EndPoint{}): getFaultOrderList.Init(apiRoot), // /v1/faultService/getFaultOrderList}
// api.GetName(getFaultOrderStepList.EndPoint{}): getFaultOrderStepList.Init(apiRoot), // /v1/faultService/getFaultOrderStepList}
// api.GetName(getHTRoleList.EndPoint{}): getHTRoleList.Init(apiRoot), // /v1/userService/getHTRoleList}
// api.GetName(getHistoryComments.EndPoint{}): getHistoryComments.Init(apiRoot), // /v1/faultService/getHistoryComments}
// api.GetName(getInfo.EndPoint{}): getInfo.Init(apiRoot), // /v1/devService/getInfo}
// api.GetName(getInverteTableListCount.EndPoint{}): getInverteTableListCount.Init(apiRoot), // /v1/devService/getInverteTableListCount}
// api.GetName(getInverterDiscreteDistributioList.EndPoint{}): getInverterDiscreteDistributioList.Init(apiRoot), // /v1/reportService/getInverterDiscreteDistributioList}
// api.GetName(getInverterDiscreteList.EndPoint{}): getInverterDiscreteList.Init(apiRoot), // /v1/reportService/getInverterDiscreteList}
// api.GetName(getInverterFactoryList.EndPoint{}): getInverterFactoryList.Init(apiRoot), // /v1/reportService/getInverterFactoryList}
// api.GetName(getInverterInfo.EndPoint{}): getInverterInfo.Init(apiRoot), // /v1/devService/getInverterInfo}
// api.GetName(getLoadCurveList.EndPoint{}): getLoadCurveList.Init(apiRoot), // /v1/reportService/getLoadCurveList}
// api.GetName(getMultiPowers.EndPoint{}): getMultiPowers.Init(apiRoot), // /v1/devService/getMultiPowers}
// api.GetName(getOndutyQuery.EndPoint{}): getOndutyQuery.Init(apiRoot), // /v1/otherService/getOndutyQuery}
// api.GetName(getOperateTicketUserList.EndPoint{}): getOperateTicketUserList.Init(apiRoot), // /v1/faultService/getOperateTicketUserList}
// api.GetName(getOptTicketsAttachments.EndPoint{}): getOptTicketsAttachments.Init(apiRoot), // /v1/faultService/getOptTicketsAttachments}
// api.GetName(getOrderCount.EndPoint{}): getOrderCount.Init(apiRoot), // /v1/faultService/getOrderCount}
// api.GetName(getOrderData.EndPoint{}): getOrderData.Init(apiRoot), // /v1/faultService/getOrderData}
// api.GetName(getOrderDataSize.EndPoint{}): getOrderDataSize.Init(apiRoot), // /v1/faultService/getOrderDataSize}
// api.GetName(getOrgPsEquipmentList.EndPoint{}): getOrgPsEquipmentList.Init(apiRoot), // /v1/faultService/getOrgPsEquipmentList}
// api.GetName(getOrgPsPowerGenerationSummaryReport.EndPoint{}): getOrgPsPowerGenerationSummaryReport.Init(apiRoot), // /v1/reportService/getOrgPsPowerGenerationSummaryReport}
// api.GetName(getParentUidChain.EndPoint{}): getParentUidChain.Init(apiRoot), // /v1/devService/getParentUidChain}
// api.GetName(getPowerKwhkwpList.EndPoint{}): getPowerKwhkwpList.Init(apiRoot), // /v1/powerStationService/getPowerKwhkwpList}
// api.GetName(getPowerPrList.EndPoint{}): getPowerPrList.Init(apiRoot), // /v1/powerStationService/getPowerPrList}
// api.GetName(getPowerPredictionInfo.EndPoint{}): getPowerPredictionInfo.Init(apiRoot), // /v1/reportService/getPowerPredictionInfo}
// api.GetName(getPowerTrendDayData.EndPoint{}): getPowerTrendDayData.Init(apiRoot), // /v1/powerStationService/getPowerTrendDayData}
// api.GetName(getPowerTrendMonthData.EndPoint{}): getPowerTrendMonthData.Init(apiRoot), // /v1/powerStationService/getPowerTrendMonthData}
// api.GetName(getPowerTrendYearData.EndPoint{}): getPowerTrendYearData.Init(apiRoot), // /v1/powerStationService/getPowerTrendYearData}
// api.GetName(getPowerValue.EndPoint{}): getPowerValue.Init(apiRoot), // /v1/reportService/getPowerValue}
// api.GetName(getPsBlock.EndPoint{}): getPsBlock.Init(apiRoot), // /v1/devService/getPsBlock}
// api.GetName(getPsBlockData.EndPoint{}): getPsBlockData.Init(apiRoot), // /v1/devService/getPsBlockData}
// api.GetName(getPsBlockTree.EndPoint{}): getPsBlockTree.Init(apiRoot), // /v1/devService/getPsBlockTree}
// api.GetName(getPsBoxListCount.EndPoint{}): getPsBoxListCount.Init(apiRoot), // /v1/devService/getPsBoxListCount}
// api.GetName(getPsCBoxDetail.EndPoint{}): getPsCBoxDetail.Init(apiRoot), // /v1/devService/getPsCBoxDetail}
// api.GetName(getPsContact.EndPoint{}): getPsContact.Init(apiRoot), // /v1/powerStationService/getPsContact}
// api.GetName(getPsDataVal.EndPoint{}): getPsDataVal.Init(apiRoot), // /v1/devService/getPsDataVal}
// api.GetName(getPsDeviceCheckList.EndPoint{}): getPsDeviceCheckList.Init(apiRoot), // /v1/devService/getPsDeviceCheckList}
// api.GetName(getPsDeviceFaultList.EndPoint{}): getPsDeviceFaultList.Init(apiRoot), // /v1/faultService/getPsDeviceFaultList}
// api.GetName(getPsFaultList.EndPoint{}): getPsFaultList.Init(apiRoot), // /v1/faultService/getPsFaultList}
// api.GetName(getPsIdByUserId.EndPoint{}): getPsIdByUserId.Init(apiRoot), // /v1/powerStationService/getPsIdByUserId}
// api.GetName(getPsIdState.EndPoint{}): getPsIdState.Init(apiRoot), // /v1/powerStationService/getPsIdState}
// api.GetName(getPsList.EndPoint{}): getPsList.Init(apiRoot), // /v1/powerStationService/getPsListForWeb}
// api.GetName(getPsListForWorkTicket.EndPoint{}): getPsListForWorkTicket.Init(apiRoot), // /v1/faultService/getPsListForWorkTicket}
// api.GetName(getPsPictureMessage.EndPoint{}): getPsPictureMessage.Init(apiRoot), // /v1/powerStationService/getPsPictureMessage}
// api.GetName(getPsTicketSizeAndClockNum.EndPoint{}): getPsTicketSizeAndClockNum.Init(apiRoot), // /v1/faultService/getPsTicketSizeAndClockNum}
// api.GetName(getPsTree.EndPoint{}): getPsTree.Init(apiRoot), // /v1/devService/getPsTree}
// api.GetName(getPsTreeChild.EndPoint{}): getPsTreeChild.Init(apiRoot), // /v1/devService/getPsTreeChild}
// api.GetName(getPsUserList.EndPoint{}): getPsUserList.Init(apiRoot), // /v1/userService/getPsUserList}
// api.GetName(getPsValue.EndPoint{}): getPsValue.Init(apiRoot), // /v1/powerStationService/getPsValue}
// api.GetName(getPscSeriseData.EndPoint{}): getPscSeriseData.Init(apiRoot), // /v1/devService/getPscSeriseData}
// api.GetName(getReportInfoByReportId.EndPoint{}): getReportInfoByReportId.Init(apiRoot), // /v1/reportService/getReportInfoByReportId}
// api.GetName(getReportListByType.EndPoint{}): getReportListByType.Init(apiRoot), // /v1/reportService/getReportListByType}
// api.GetName(getReportPsTree.EndPoint{}): getReportPsTree.Init(apiRoot), // /v1/reportService/getReportPsTree}
// api.GetName(getRoleList.EndPoint{}): getRoleList.Init(apiRoot), // /v1/userService/getRoleList}
// api.GetName(getSafeEffectList.EndPoint{}): getSafeEffectList.Init(apiRoot), // /v1/faultService/getSafeEffectList}
// api.GetName(getSecondTypeTicketList.EndPoint{}): getSecondTypeTicketList.Init(apiRoot), // /v1/faultService/getSecondTypeTicketList}
// api.GetName(getSecondTypeTicketListForTicketDetail.EndPoint{}): getSecondTypeTicketListForTicketDetail.Init(apiRoot), // /v1/faultService/getSecondTypeTicketListForTicketDetail}
// api.GetName(getSelfReportPoint.EndPoint{}): getSelfReportPoint.Init(apiRoot), // /v1/reportService/getSelfReportPoint}
// api.GetName(getSparePartsDetail.EndPoint{}): getSparePartsDetail.Init(apiRoot), // /v1/otherService/getSparePartsDetail}
// api.GetName(getStatementList.EndPoint{}): getStatementList.Init(apiRoot), // /v1/reportService/getStatementList}
// api.GetName(getStoreByStationId.EndPoint{}): getStoreByStationId.Init(apiRoot), // /v1/otherService/getStoreByStationId}
// api.GetName(getSysUserList.EndPoint{}): getSysUserList.Init(apiRoot), // /v1/userService/getSysUserList}
// api.GetName(getTableList.EndPoint{}): getTableList.Init(apiRoot), // /v1/devService/getTableList}
// api.GetName(getUserList.EndPoint{}): getUserList.Init(apiRoot), // /v1/userService/getUserList}
// api.GetName(getWeather.EndPoint{}): getWeather.Init(apiRoot), // /v1/powerStationService/getWeather}
// api.GetName(getWorkTicketList.EndPoint{}): getWorkTicketList.Init(apiRoot), // /v1/faultService/getWorkTicketList}
// api.GetName(getWorkTicketListForTicketDetail.EndPoint{}): getWorkTicketListForTicketDetail.Init(apiRoot), // /v1/faultService/getWorkTicketListForTicketDetail}
// api.GetName(getWorkTicketRunningCount.EndPoint{}): getWorkTicketRunningCount.Init(apiRoot), // /v1/faultService/getWorkTicketRunningCount}
// api.GetName(getWorkTicketUserList.EndPoint{}): getWorkTicketUserList.Init(apiRoot), // /v1/faultService/getWorkTicketUserList}
// api.GetName(getinverterType.EndPoint{}): getinverterType.Init(apiRoot), // /v1/devService/getinverterType}
// api.GetName(getreportPermissionByUser.EndPoint{}): getreportPermissionByUser.Init(apiRoot), // /v1/reportService/getPsIdByUserId}
// api.GetName(handleValue.EndPoint{}): handleValue.Init(apiRoot), // /v1/reportService/handleValue}
// api.GetName(modifyDeviceInfo.EndPoint{}): modifyDeviceInfo.Init(apiRoot), // /v1/devService/modifyDeviceInfo}
// api.GetName(operaStoreSpareParts.EndPoint{}): operaStoreSpareParts.Init(apiRoot), // /v1/otherService/operaStoreSpareParts}
// api.GetName(operateBillTransferToUser.EndPoint{}): operateBillTransferToUser.Init(apiRoot), // /v1/faultService/operateBillTransferToUser}
// api.GetName(queryAllStockInventory.EndPoint{}): queryAllStockInventory.Init(apiRoot), // /v1/otherService/queryAllStockInventory}
// api.GetName(queryBatteryBoardsList.EndPoint{}): queryBatteryBoardsList.Init(apiRoot), // /v1/devService/queryBatteryBoardsList}
// api.GetName(queryBatteryBoardsPointsData.EndPoint{}): queryBatteryBoardsPointsData.Init(apiRoot), // /v1/devService/queryBatteryBoardsPointsData}
// api.GetName(queryCodeByType.EndPoint{}): queryCodeByType.Init(apiRoot), // /v1/commonService/queryCodeByType}
// api.GetName(queryDeviceInfoList.EndPoint{}): queryDeviceInfoList.Init(apiRoot), // /v1/devService/queryDeviceInfoList}
// api.GetName(queryElectricityCalendarData.EndPoint{}): queryElectricityCalendarData.Init(apiRoot), // /v1/reportService/queryElectricityCalendarData}
// api.GetName(queryFaultCodes.EndPoint{}): queryFaultCodes.Init(apiRoot), // /v1/faultService/queryFaultCodes}
// api.GetName(queryFaultLevelAndType.EndPoint{}): queryFaultLevelAndType.Init(apiRoot), // /v1/faultService/queryFaultLevelAndType}
// api.GetName(queryFaultNames.EndPoint{}): queryFaultNames.Init(apiRoot), // /v1/faultService/queryFaultNames}
// api.GetName(queryMaterialType.EndPoint{}): queryMaterialType.Init(apiRoot), // /v1/otherService/queryMaterialType}
// api.GetName(queryNounAndKlgList.EndPoint{}): queryNounAndKlgList.Init(apiRoot), // /v1/faultService/queryNounAndKlgList}
// api.GetName(queryNounList.EndPoint{}): queryNounList.Init(apiRoot), // /v1/faultService/queryNounList}
// api.GetName(queryOptTickctInfo.EndPoint{}): queryOptTickctInfo.Init(apiRoot), // /v1/faultService/queryOptTickctInfo}
// api.GetName(queryOrgIdByUser.EndPoint{}): queryOrgIdByUser.Init(apiRoot), // /v1/userService/queryOrgIdByUser}
// api.GetName(queryPsCountryList.EndPoint{}): queryPsCountryList.Init(apiRoot), // /v1/commonService/queryPsCountryList}
// api.GetName(queryPsProvcnList.EndPoint{}): queryPsProvcnList.Init(apiRoot), // /v1/commonService/queryPsProvcnList}
// api.GetName(queryPsTypeByPsId.EndPoint{}): queryPsTypeByPsId.Init(apiRoot), // /v1/powerStationService/queryPsTypeByPsId}
// api.GetName(querySparePartsList.EndPoint{}): querySparePartsList.Init(apiRoot), // /v1/otherService/querySparePartsList}
// api.GetName(queryStoreList.EndPoint{}): queryStoreList.Init(apiRoot), // /v1/otherService/queryStoreList}
// api.GetName(querySysTimezone.EndPoint{}): querySysTimezone.Init(apiRoot), // /v1/commonService/querySysTimezone}
// api.GetName(queryUnInventorySpareList.EndPoint{}): queryUnInventorySpareList.Init(apiRoot), // /v1/otherService/queryUnInventorySpareList}
api.GetName(queryUserCurveTemplateData.EndPoint{}): queryUserCurveTemplateData.Init(apiRoot),
// api.GetName(renewOperation.EndPoint{}): renewOperation.Init(apiRoot), // /v1/devService/renewOperation}
// api.GetName(saveCustomReport.EndPoint{}): saveCustomReport.Init(apiRoot), // /v1/reportService/saveCustomReport}
// api.GetName(saveDutyInfo.EndPoint{}): saveDutyInfo.Init(apiRoot), // /v1/otherService/saveDutyInfo}
// api.GetName(saveInventory.EndPoint{}): saveInventory.Init(apiRoot), // /v1/otherService/saveInventory}
// api.GetName(saveMaterial.EndPoint{}): saveMaterial.Init(apiRoot), // /v1/devService/saveMaterial}
// api.GetName(saveSecondTypeTicket.EndPoint{}): saveSecondTypeTicket.Init(apiRoot), // /v1/faultService/saveSecondTypeTicket}
// api.GetName(saveSelfReportPoint.EndPoint{}): saveSelfReportPoint.Init(apiRoot), // /v1/reportService/saveSelfReportPoint}
// api.GetName(saveWorkTicket.EndPoint{}): saveWorkTicket.Init(apiRoot), // /v1/faultService/saveWorkTicket}
// api.GetName(secondTypeTicketFlowImplementStep.EndPoint{}): secondTypeTicketFlowImplementStep.Init(apiRoot), // /v1/faultService/secondTypeTicketFlowImplementStep}
// api.GetName(secondTypeTicketFlowTransferStep.EndPoint{}): secondTypeTicketFlowTransferStep.Init(apiRoot), // /v1/faultService/secondTypeTicketFlowTransferStep}
// api.GetName(secondTypeUpdateSign.EndPoint{}): secondTypeUpdateSign.Init(apiRoot), // /v1/faultService/secondTypeUpdateSign}
// api.GetName(selectPowerPageList.EndPoint{}): selectPowerPageList.Init(apiRoot), // /v1/powerStationService/selectPowerPageList}
// api.GetName(showAnalyzefxDetail.EndPoint{}): showAnalyzefxDetail.Init(apiRoot), // /v1/reportService/showAnalyzefxDetail}
// api.GetName(showFxReport.EndPoint{}): showFxReport.Init(apiRoot), // /v1/reportService/showFxReport}
// api.GetName(showMaterNameList.EndPoint{}): showMaterNameList.Init(apiRoot), // /v1/otherService/showMaterNameList}
// api.GetName(showMaterSubTypeList.EndPoint{}): showMaterSubTypeList.Init(apiRoot), // /v1/otherService/showMaterSubTypeList}
api.GetName(showPSView.EndPoint{}): showPSView.Init(apiRoot),
// api.GetName(showTjReport.EndPoint{}): showTjReport.Init(apiRoot), // /v1/reportService/showTjReport}
// api.GetName(templateLikesInfo.EndPoint{}): templateLikesInfo.Init(apiRoot), // /v1/faultService/templateLikesInfo}
// api.GetName(updOptTicketInfo.EndPoint{}): updOptTicketInfo.Init(apiRoot), // /v1/faultService/updOptTicketInfo}
// api.GetName(updataWorkTicketAfterStartProcess.EndPoint{}): updataWorkTicketAfterStartProcess.Init(apiRoot), // /v1/faultService/updataWorkTicketAfterStartProcess}
// api.GetName(updateBillTicketForTask.EndPoint{}): updateBillTicketForTask.Init(apiRoot), // /v1/faultService/updateBillTicketForTask}
// api.GetName(updateDutyInfo.EndPoint{}): updateDutyInfo.Init(apiRoot), // /v1/otherService/updateDutyInfo}
// api.GetName(updateKnowledgeBaseUseNumber.EndPoint{}): updateKnowledgeBaseUseNumber.Init(apiRoot), // /v1/faultService/updateKnowledgeBaseUseNumber}
// api.GetName(updateMaterial.EndPoint{}): updateMaterial.Init(apiRoot), // /v1/otherService/updateMaterial}
// api.GetName(updateSpareParts.EndPoint{}): updateSpareParts.Init(apiRoot), // /v1/otherService/updateSpareParts}
// api.GetName(updateStopReason.EndPoint{}): updateStopReason.Init(apiRoot), // /v1/devService/updateStopReason}
// api.GetName(updateTemplate.EndPoint{}): updateTemplate.Init(apiRoot), // /v1/faultService/updateKnowledgeBaseCitationCount}
},
}
return area
}
// ****************************************
// Methods not scoped by api.EndPoint interface type
func GetAreaName() string {
return string(api.GetArea(Area{}))
}
func (a Area) GetEndPoint(name api.EndPointName) api.EndPoint {
var ret api.EndPoint
for _, e := range a.EndPoints {
if e.GetName() == name {
ret = e
break
}
}
return ret
}
// ****************************************
// Methods scoped by api.Area interface type
func (a Area) Init(apiRoot *api.Web) api.AreaStruct {
panic("implement me")
}
func (a Area) GetAreaName() api.AreaName {
return a.Name
}
func (a Area) GetEndPoints() api.TypeEndPoints {
for _, endpoint := range a.EndPoints {
fmt.Printf("endpoint: %v\n", endpoint)
}
return a.EndPoints
}
func (a Area) Call(name api.EndPointName) api.Json {
panic("implement me")
}
func (a Area) SetRequest(name api.EndPointName, ref interface{}) error {
panic("implement me")
}
func (a Area) GetRequest(name api.EndPointName) api.Json {
panic("implement me")
}
func (a Area) GetResponse(name api.EndPointName) api.Json {
panic("implement me")
}
func (a Area) GetData(name api.EndPointName) api.Json {
panic("implement me")
}
func (a Area) IsValid(name api.EndPointName) error {
panic("implement me")
}
func (a Area) GetError(name api.EndPointName) error {
panic("implement me")
}

View File

@ -13,7 +13,6 @@ import (
"strings"
)
func (sg *SunGro) Init() error {
for range Only.Once {
sg.Areas = make(api.Areas)
@ -42,6 +41,10 @@ func (sg *SunGro) GetEndpoint(ae string) api.EndPoint {
}
ep = sg.Areas.GetEndPoint(api.AreaName(area), api.EndPointName(endpoint))
if ep == nil {
sg.Error = errors.New("EndPoint not found")
break
}
if sg.Auth.Token() != "" {
ep = ep.SetRequest(api.RequestCommon{
Appkey: sg.GetAppKey(), // sg.Auth.RequestCommon.Appkey
@ -63,19 +66,19 @@ func (sg *SunGro) SplitEndPoint(ae string) (string, string) {
for range Only.Once {
s := strings.Split(ae, ".")
switch len(s) {
case 0:
sg.Error = errors.New("empty endpoint")
case 0:
sg.Error = errors.New("empty endpoint")
case 1:
area = "AppService"
endpoint = s[0]
case 1:
area = "AppService"
endpoint = s[0]
case 2:
area = s[0]
endpoint = s[1]
case 2:
area = s[0]
endpoint = s[1]
default:
sg.Error = errors.New("too many delimeters defined, (only one '.' allowed)")
default:
sg.Error = errors.New("too many delimeters defined, (only one '.' allowed)")
}
}