processor_factory.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // Package fenwei
  2. // @Author gmy 2024/8/20 14:50:00
  3. package fenwei
  4. const (
  5. fenWeiUrl = "https://www.sxcoal.com/api/coalresource-adhoc/queryV1/data"
  6. fenWeiByUrl = "https://www.sxcoal.com/api/coalresource-adhoc/queryV1/byData"
  7. )
  8. type ProcessorFactory struct{}
  9. func (f *ProcessorFactory) CreateProcessor(module string) DataProcessor {
  10. switch module {
  11. case "动力煤供应量":
  12. return &ThermalCoalSupplyProcessor{
  13. BaseProcessor{URL: fenWeiUrl},
  14. }
  15. case "炼焦精煤供应量":
  16. return &CokingCleanCoalSupplyProcessor{
  17. BaseProcessor{URL: fenWeiUrl},
  18. }
  19. case "原煤分省分煤种产量":
  20. return &RawCoalProvinceProductionProcessor{
  21. BaseProcessor{URL: fenWeiUrl},
  22. }
  23. case "国有重点煤矿原煤产量":
  24. return &StateOwnedKeyCoalMineRawCoalProductionProcessor{
  25. BaseProcessor{URL: fenWeiUrl},
  26. }
  27. case "炼焦烟煤分煤种产量":
  28. return &CokingBituminousCoalProductionProcessor{
  29. BaseProcessor{URL: fenWeiUrl},
  30. }
  31. case "动力煤库存-全社会":
  32. return &ThermalCoalInventorySocietyProcessor{
  33. BaseProcessor{URL: fenWeiUrl},
  34. }
  35. case "动力煤库存-生产企业":
  36. return &ThermalCoalInventoryProductionProcessor{
  37. BaseProcessor{URL: fenWeiUrl},
  38. }
  39. case "动力煤库存-六大电厂":
  40. return &ThermalCoalInventorySixPowerPlantProcessor{
  41. BaseProcessor{URL: fenWeiUrl},
  42. }
  43. case "炼焦煤库存-全社会":
  44. return &CokingCoalInventorySocietyProcessor{
  45. BaseProcessor{URL: fenWeiUrl},
  46. }
  47. case "炼焦煤库存-生产企业":
  48. return &CokingCoalInventoryProductionProcessor{
  49. BaseProcessor{URL: fenWeiUrl},
  50. }
  51. case "炼焦煤库存-下游企业":
  52. return &CokingCoalInventoryDownstreamProcessor{
  53. BaseProcessor{URL: fenWeiUrl},
  54. }
  55. case "全国煤矿库存":
  56. return &NationalCoalMineInventoryProcessor{
  57. BaseProcessor{URL: fenWeiUrl},
  58. }
  59. case "国有重点煤矿库存":
  60. return &StateOwnedKeyCoalMineInventoryProcessor{
  61. BaseProcessor{URL: fenWeiUrl},
  62. }
  63. case "焦炭库存":
  64. return &CokeInventoryProcessor{
  65. BaseProcessor{URL: fenWeiUrl},
  66. }
  67. case "港口数据-库存-北方港口":
  68. return &PortDataInventoryNorthernPortProcessor{
  69. BaseProcessor{URL: fenWeiByUrl},
  70. }
  71. case "港口数据-库存-江内港口":
  72. return &PortDataInventoryInlandPortProcessor{
  73. BaseProcessor{URL: fenWeiByUrl},
  74. }
  75. case "港口数据-调度-北方港口":
  76. return &PortDataDispatchNorthernPortProcessor{
  77. BaseProcessor{URL: fenWeiByUrl},
  78. }
  79. case "港口数据-运量":
  80. return &PortDataThroughputProcessor{
  81. BaseProcessor{URL: fenWeiByUrl},
  82. }
  83. case "大秦线日运量":
  84. return &DaqinLineDailyThroughputProcessor{
  85. BaseProcessor{URL: fenWeiUrl},
  86. }
  87. case "动力煤港口价格":
  88. return &ThermalCoalPortPriceProcessor{
  89. BaseProcessor{URL: fenWeiUrl},
  90. }
  91. case "动力煤消费量":
  92. return &ThermalCoalConsumptionProcessor{
  93. BaseProcessor{URL: fenWeiUrl},
  94. }
  95. case "炼焦精煤消费量":
  96. return &CokingCleanCoalConsumptionProcessor{
  97. BaseProcessor{URL: fenWeiUrl},
  98. }
  99. default:
  100. return nil
  101. }
  102. }