edb_info_updates.go 5.7 KB

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