edb_info_updates.go 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. package data_manage
  2. import (
  3. "eta_gn/eta_api/global"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. )
  6. type UpdatesStatisticalItem struct {
  7. Total int
  8. Source int
  9. EdbType int `description:"指标类型:1:基础指标,2:计算指标"`
  10. }
  11. func GetUpdatesStatistical(condition string, pars []interface{}) (list []*UpdatesStatisticalItem, err error) {
  12. sql := ` SELECT COUNT(1) AS total,source,edb_type FROM edb_info
  13. WHERE 1=1 `
  14. sql += condition
  15. sql += ` GROUP BY source `
  16. err = global.DmSQL["data"].Raw(sql, pars).Scan(&list).Error
  17. return
  18. }
  19. type UpdatesStatisticalResp struct {
  20. ThsUpdate int `description:"同花顺已更新"`
  21. ThsNotUpdate int `description:"同花顺未更新"`
  22. WindUpdate int `description:"wind已更新"`
  23. WindNotUpdate int `description:"wind未更新"`
  24. PbUpdate int `description:"彭博已更新"`
  25. PbNotUpdate int `description:"彭博未更新"`
  26. PbFinanceUpdate int `description:"彭博财务已更新"`
  27. PbFinanceNotUpdate int `description:"彭博财务未更新"`
  28. LzUpdate int `description:"隆众已更新"`
  29. LzNotUpdate int `description:"隆众未更新"`
  30. SmmUpdate int `description:"Smm已更新"`
  31. SmmNotUpdate int `description:"Smm未更新"`
  32. MysteelUpdate int `description:"钢联已更新"`
  33. MysteelNotUpdate int `description:"钢联未更新"`
  34. ZzUpdate int `description:"郑商所已更新"`
  35. ZzNotUpdate int `description:"郑商所未更新"`
  36. DlUpdate int `description:"大商所已更新"`
  37. DlNotUpdate int `description:"大商所未更新"`
  38. ShUpdate int `description:"上期所已更新"`
  39. ShNotUpdate int `description:"上期所未更新"`
  40. CffexUpdate int `description:"中金所已更新"`
  41. CffexNotUpdate int `description:"中金所未更新"`
  42. ShfeUpdate int `description:"上期能源已更新"`
  43. ShfeNotUpdate int `description:"上期能源未更新"`
  44. GieUpdate int `description:"欧洲天然气已更新"`
  45. GieNotUpdate int `description:"欧洲天然气未更新"`
  46. CalculateUpdate int `description:"计算指标已更新"`
  47. CalculateNotUpdate int `description:"计算指标未更新"`
  48. ManualUpdate int `description:"手工指标已更新"`
  49. ManualNotUpdate int `description:"手工指标未更新"`
  50. LtUpdate int `description:"路透已更新"`
  51. LtNotUpdate int `description:"路透未更新"`
  52. CoalUpdate int `description:"煤炭网已更新"`
  53. CoalNotUpdate int `description:"煤炭网未更新"`
  54. GoogleTravelUpdate int `description:"谷歌出行已更新"`
  55. GoogleTravelNotUpdate int `description:"谷歌出行未更新"`
  56. EiaSteoUpdate int `description:"eia steo报告已更新"`
  57. EiaSteoNotUpdate int `description:"eia steo报告未更新"`
  58. UNUpdate int `description:"UN报告已更新"`
  59. UNNotUpdate int `description:"UN报告未更新"`
  60. SciUpdate int `description:"卓创数据已更新"`
  61. SciNotUpdate int `description:"卓创数据未更新"`
  62. BaiinfoUpdate int `description:"百川盈孚数据已更新"`
  63. BaiinfoNotUpdate int `description:"百川盈孚数据未更新"`
  64. NationalStatisticsUpdate int `description:"国家统计局数据已更新"`
  65. NationalStatisticsNotUpdate int `description:"国家统计局数据未更新"`
  66. FubaoUpdate int `description:"富宝已更新"`
  67. FubaoNotUpdate int `description:"富宝未更新"`
  68. }
  69. /*
  70. DATA_SOURCE_THS = iota + 1 //同花顺
  71. DATA_SOURCE_WIND //wind
  72. DATA_SOURCE_PB //彭博
  73. DATA_SOURCE_CALCULATE //指标运算
  74. DATA_SOURCE_CALCULATE_LJZZY //累计值转月
  75. DATA_SOURCE_CALCULATE_TBZ //同比值
  76. DATA_SOURCE_CALCULATE_TCZ //同差值
  77. DATA_SOURCE_CALCULATE_NSZYDPJJS //N数值移动平均计算
  78. DATA_SOURCE_MANUAL //手工指标
  79. DATA_SOURCE_LZ //隆众
  80. DATA_SOURCE_YS //有色
  81. DATA_SOURCE_CALCULATE_HBZ //环比值->12
  82. DATA_SOURCE_CALCULATE_HCZ //环差值->13
  83. DATA_SOURCE_CALCULATE_BP //变频->14
  84. DATA_SOURCE_GL //钢联->15
  85. */
  86. func GetUpdatesList(condition string, pars []interface{}, startSize, pageSize int) (list []*EdbInfoView, err error) {
  87. sql := ` SELECT * FROM edb_info
  88. WHERE 1=1 `
  89. sql += condition
  90. sql += ` LIMIT ?,? `
  91. err = global.DmSQL["data"].Raw(sql, pars, startSize, pageSize).Scan(&list).Error
  92. return
  93. }
  94. // GetAllUpdatesList 获取所有待更新的指标
  95. func GetAllUpdatesList() (list []*EdbInfoView, err error) {
  96. o := global.DmSQL["data"]
  97. sql := ` SELECT * FROM edb_info
  98. WHERE 1=1 AND is_update=? AND no_update=? AND edb_info_type = ? ORDER BY edb_type ASC `
  99. err = o.Raw(sql, 1, 0, 0).Scan(&list).Error
  100. return
  101. }
  102. func GetUpdatesListTotal(condition string, pars []interface{}) (count int, err error) {
  103. o := global.DmSQL["data"]
  104. sql := ` SELECT COUNT(1) AS count FROM edb_info
  105. WHERE 1=1 `
  106. sql += condition
  107. err = o.Raw(sql, pars).Scan(&count).Error
  108. return
  109. }
  110. type UpdatesListResp struct {
  111. List []*EdbInfoView
  112. Total int
  113. Paging *paging.PagingItem
  114. }