jiayue_index.go 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. package data_manage
  2. import (
  3. "eta/eta_mobile/utils"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "time"
  6. )
  7. // DictIndex 嘉悦指标表
  8. type DictIndex struct {
  9. Id int `description:"主键"`
  10. Code string `description:"指标编码"`
  11. Name string `description:"指标名称"`
  12. Unit string `description:"单位"`
  13. Frequency string `description:"更新频率"`
  14. Description string `description:"描述"`
  15. TableName string `description:"指标数据存储库表"`
  16. SourceType string `description:"指标来源,如:wind:万德;manual:手工导入;formula:公式;webisite:网页爬取"`
  17. SourceCode string `description:"来源编码"`
  18. SourceDescription string `description:"来源说明"`
  19. Industry string `description:"品种板块"`
  20. Type string `description:"指标类型"`
  21. Commodity string `description:"商品名称"`
  22. SjbId int `description:"SJB_ID"`
  23. UserId int `description:"所属用户"`
  24. RowsCount int `description:"指标数据数量"`
  25. DateFirst time.Time `description:"指标开始时间"`
  26. DateLast time.Time `description:"指标最新时间"`
  27. TimeLastUpdate time.Time `description:"最新更新时间"`
  28. TimeLastRequest time.Time `description:"下次更新时间"`
  29. Priority int `description:"更新优先级"`
  30. Status int `description:"指标状态"`
  31. ShortName string `description:"指标简称"`
  32. UpdateDescription string `description:"更新说明"`
  33. ForecastFlag int `description:"预测标识"`
  34. ManualFlag int `description:"手动标识"`
  35. VariableFlag int `description:"有效标识"`
  36. MarketDataFlag int `description:"市场价标识"`
  37. CreateUser int `description:"创建用户"`
  38. CreateTime time.Time `description:"创建时间"`
  39. UpdateUser int `description:"更新用户"`
  40. UpdateTime time.Time `description:"更新时间"`
  41. }
  42. // BridgeJiaYueIndexParams 桥接服务-获取嘉悦指标入参
  43. type BridgeJiaYueIndexParams struct {
  44. IndexCode string `json:"index_code" form:"index_code" description:"指标编码"`
  45. SourceExtend string `json:"source_extend" form:"source_extend" description:"来源"`
  46. IndexCodeRequired int `json:"index_code_required" form:"index_code_required" description:"指标编码是否必填: 0-否; 1-是"`
  47. }
  48. // BridgeJiaYueIndexDataParams 桥接服务-获取嘉悦指标数据入参
  49. type BridgeJiaYueIndexDataParams struct {
  50. BridgeJiaYueIndexParams
  51. StartDate string `json:"start_date" form:"start_date" description:"开始日期"`
  52. EndDate string `json:"end_date" form:"end_date" description:"结束日期"`
  53. }
  54. // BridgeJiaYueResultIndexData 桥接服务-获取嘉悦指标数据响应体
  55. type BridgeJiaYueResultIndexData struct {
  56. Code int `json:"code" description:"状态码"`
  57. Msg string `json:"msg" description:"提示信息"`
  58. Data BridgeJiaYueIndexAndData `json:"data" description:"返回数据"`
  59. }
  60. // BridgeJiaYueIndexAndData 桥接服务-嘉悦指标和数据
  61. type BridgeJiaYueIndexAndData struct {
  62. Id int `description:"指标自增ID" json:"id"`
  63. IndexCode string `description:"指标编码" json:"index_code"`
  64. IndexName string `description:"指标名称" json:"index_name"`
  65. Unit string `description:"单位" json:"unit"`
  66. Frequency string `description:"频度" json:"frequency"`
  67. LastDate time.Time `description:"指标最新时间" json:"last_date"`
  68. LastUpdateTime time.Time `description:"最新更新时间" json:"last_update_time"`
  69. Status int `description:"指标状态" json:"status"`
  70. IndexData []BridgeJiaYueIndexData `description:"指标数据" json:"index_data"`
  71. }
  72. // BridgeJiaYueIndexData 桥接服务-嘉悦指标数据
  73. type BridgeJiaYueIndexData struct {
  74. Val float64 `json:"val"`
  75. DataTime time.Time `json:"data_time"`
  76. UpdateTime time.Time `json:"update_time"`
  77. }
  78. // BridgeJiaYueResultFrequencyList 桥接服务-频度列表响应体
  79. type BridgeJiaYueResultFrequencyList struct {
  80. Code int `json:"code" description:"状态码"`
  81. Msg string `json:"msg" description:"提示信息"`
  82. Data []string `json:"data" description:"返回数据"`
  83. }
  84. // BridgeJiaYueResultIndexPageList 桥接服务-指标分页列表响应体
  85. type BridgeJiaYueResultIndexPageList struct {
  86. Code int `json:"code" description:"状态码"`
  87. Msg string `json:"msg" description:"提示信息"`
  88. Data BridgeJiaYuePageIndexResp `json:"data" description:"返回数据"`
  89. }
  90. // BridgeJiaYuePageIndexReq 桥接服务-指标分页列表请求体
  91. type BridgeJiaYuePageIndexReq struct {
  92. SourceExtend string `json:"source_extend" form:"source_extend" description:"来源"`
  93. Keyword string `json:"keyword" form:"keyword" description:"关键词"`
  94. Frequency string `json:"frequency" form:"frequency" description:"频度"`
  95. PageIndex int `json:"page_index" form:"page_index" description:"当前页码"`
  96. PageSize int `json:"page_size" form:"page_size" description:"每页数据量"`
  97. SortField int `json:"sort_field" form:"sort_field" description:"排序字段: 1-指标开始时间; 2-指标最新时间; 3-更新时间"`
  98. SortRule int `json:"sort_rule" form:"sort_rule" description:"排序方式: 1-正序; 2-倒序"`
  99. }
  100. // BridgeJiaYuePageIndexResp 桥接服务-指标分页列表响应体
  101. type BridgeJiaYuePageIndexResp struct {
  102. Total int `description:"数据总量"`
  103. List []DictIndex `description:"列表数据"`
  104. }
  105. // JiaYueIndexPageListResp 指标分页列表响应体
  106. type JiaYueIndexPageListResp struct {
  107. List []*DictIndexItem
  108. Paging *paging.PagingItem `description:"分页数据"`
  109. }
  110. // DictIndexItem 指标信息
  111. type DictIndexItem struct {
  112. Id int `description:"主键"`
  113. Code string `description:"指标编码"`
  114. Name string `description:"指标名称"`
  115. Unit string `description:"单位"`
  116. Frequency string `description:"频度"`
  117. DateFirst string `description:"指标开始时间"`
  118. DateLast string `description:"指标最新时间"`
  119. TimeLastUpdate string `description:"最新更新时间"`
  120. }
  121. // FormatDictIndex2Item 格式化数据宝指标信息
  122. func FormatDictIndex2Item(origin DictIndex) (item *DictIndexItem) {
  123. item = new(DictIndexItem)
  124. item.Id = origin.Id
  125. item.Code = origin.SourceCode
  126. item.Name = origin.Name
  127. item.Unit = origin.Unit
  128. item.Frequency = origin.Frequency
  129. item.DateFirst = utils.TimeTransferString(utils.FormatDate, origin.DateFirst)
  130. item.DateLast = utils.TimeTransferString(utils.FormatDate, origin.DateLast)
  131. item.TimeLastUpdate = utils.TimeTransferString(utils.FormatDateTime, origin.TimeLastUpdate)
  132. return
  133. }