123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243 |
- package ruizide
- import (
- "eta/eta_data_analysis/models"
- "fmt"
- )
- type ReportProcessor interface {
- Process(string, string, int, []string) ([]models.BaseFromRzdData, error)
- }
- func GetProcessor(tableName string, sheetName string) (ReportProcessor, error) {
- if tableName == "Oil_Demand_Signals_Weekly_Report" {
- switch sheetName {
- case "Road Index":
- return &RoadIndexProcessor{}, nil
- case "Road Active Fleet":
- return &RoadActiveFleetProcessor{}, nil
- case "Aviation Index":
- return &AviationIndexProcessor{}, nil
- case "Aviation Active Fleet":
- return &AviationActiveFleetProcessor{}, nil
- case "Demand - Gasoline":
- return &DemandGasolineProcessor{}, nil
- case "Demand - Diesel":
- return &DemandDieselProcessor{}, nil
- case "Demand - Jet Fuel":
- return &DemandJetFuelProcessor{}, nil
- case "Demand - Maritime Bunker":
- return &DemandMaritimeBunkerProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Supply_Revision_Analysis" {
- switch sheetName {
- case "Chart1":
- return &SupplyRevisionAnalysisChartOneProcessor{}, nil
- case "Chart2":
- return &SupplyRevisionAnalysisChartTwoProcessor{}, nil
- case "Chart3":
- return &SupplyRevisionAnalysisChartThreeProcessor{}, nil
- case "Chart4":
- return &SupplyRevisionAnalysisChartFourProcessor{}, nil
- case "Chart5":
- return &SupplyRevisionAnalysisChartFiveProcessor{}, nil
- case "Chart6":
- return &SupplyRevisionAnalysisChartSixProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Supply_Analysis" {
- switch sheetName {
- case "Chart1":
- return &OilSupplyAnalysisChartOneProcessor{}, nil
- case "Chart2":
- return &OilSupplyAnalysisChartTwoProcessor{}, nil
- case "Chart3":
- return &OilSupplyAnalysisChartThreeProcessor{}, nil
- case "Chart4":
- return &OilSupplyAnalysisChartFourProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Demand_Analysis_Continent" {
- switch sheetName {
- case "Chart1":
- return &OilDemandAnalysisContinentProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Demand_Analysis_Region" {
- switch sheetName {
- case "Chart1":
- return &OilDemandAnalysisRegionProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Demand_Analysis_Country" {
- switch sheetName {
- case "Chart1":
- return &OilDemandAnalysisCountryProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Demand_Analysis_Product_Category" {
- switch sheetName {
- case "Chart1":
- return &OilDemandAnalysisProductCategoryProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Demand_Analysis_Product_Detail" {
- switch sheetName {
- case "Chart1":
- return &OilDemandAnalysisProductDetailProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Demand_Analysis_Sector_Category" {
- switch sheetName {
- case "Chart1":
- return &OilDemandAnalysisSectorCategoryProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Demand_Analysis_Sector_Detail" {
- switch sheetName {
- case "Chart1":
- return &OilDemandAnalysisSectorDetailProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Demand_Analysis_Scenario" {
- switch sheetName {
- case "Chart1":
- return &OilDemandAnalysisScenarioProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Upstream_Supply_Oil_Quality_Api" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &UpstreamSupplyOilQualityApiProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Upstream_Supply_Oil_Quality_Sulphur" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &OilMarketCubeUpstreamSupplyOilQualitySulphurProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Upstream_Supply_Capacity_Capacity" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &OilMarketCubeUpstreamSupplyCapacityCapacityProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Upstream_Supply_Production" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &OilMarketCubeUpstreamSupplyProductionProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Upstream_Supply_Production_Wo_Seasonality" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &UpstreamSupplyProductionWoSeasonalityProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Upstream_Supply_OPEC_Policy_Reference_Production" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &UpstreamSupplyOPECPolicyReferenceProductionProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Upstream_Supply_OPEC_Policy_Target_Production" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &UpstreamSupplyOPECPolicyTargetProductionProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Upstream_Supply_OPEC_Policy_Target_Cut" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &UpstreamSupplyOPECPolicyTargetCutProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Upstream_Supply_OPEC_Policy_Actual_Cut" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &UpstreamSupplyOPECPolicyActualCutProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Upstream_Supply_OPEC_Policy_Compliance" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &UpstreamSupplyOPECPolicyComplianceProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Upstream_Supply_OPEC_Policy_Production_Subject_To_Cut" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &UpstreamSupplyOPECPolicyProductionSubjectToCutProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Products_Demand_Products_Demand_Mean" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &ProductsDemandProductsDemandMeanProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Products_Demand_Products_Demand+Sigma" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &ProductsDemandProductsDemandAddSigmaProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Products_Demand_Products_Demand-Sigma" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &ProductsDemandProductsDemandSubSigmaProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Balances_Total_Liquids_Balances" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &BalancesTotalLiquidsBalancesProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Geography_Latitude" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &GeographyLatitudeProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- } else if tableName == "Oil_Market_Cube_Geography_Longitude" {
- switch sheetName {
- case "ExportCubeBrowser 1":
- return &GeographyLongitudeProcessor{}, nil
- default:
- return nil, fmt.Errorf("unknown sheetName: %s", sheetName)
- }
- }
- // 可以添加更多的逻辑来处理其他产品和类别
- return nil, fmt.Errorf("no processor found for tableName %s and sheetName %s", tableName, sheetName)
- }
|