chart_info_range_analysis.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. package models
  2. import (
  3. "time"
  4. )
  5. type ChartRangeAnalysisExtraConf struct {
  6. EdbInfoMode int `description:"指标模式 0: 单指标,1: 多指标"`
  7. DateRangeType int `description:"区间划分类型 0:智能划分,1:手工划分,2:跨年划分"`
  8. AutoDateConf ChartRangeAnalysisAutoDateConf `description:"智能划分时间区间配置"`
  9. ManualDateConf []ChartRangeAnalysisManualDateConf `description:"手工划分时间区间配置"`
  10. YearDateConf ChartRangeAnalysisYearDateConf `description:"跨年划分时间区间配置"`
  11. CalculateType int `description:"计算类型 0: 区间均值,1: 区间累计值,2:区间涨幅,3:区间年化增长率,4:区间最大值,5:区间最小值"`
  12. UnNormalDataDealType int `description:"异常值处理配置 0:不处理,1:剔除,2替换"`
  13. UnNormalDataConf ChartRangeAnalysisDeleteDataConf
  14. DataConvertType int `description:"数据转换类型 0不转, 1乘 2除 3对数"`
  15. DataConvertConf ChartRangeAnalysisDataConvertConf `description:"数据转换详情"`
  16. SeriesName string `description:"指标系列名称"`
  17. EdbInfoType int `description:"指标类型:0普通指标,1预测指标"`
  18. MultipleGraphConfigId int `description:"配置ID"`
  19. }
  20. type ChartRangeAnalysisAutoDateChangeConf struct {
  21. BaseDateType int `description:"基准日期类型:0指标日期,1系统日期"`
  22. MoveForward int `description:"前移的期数"`
  23. DateChange []*EdbDataDateChangeConf
  24. }
  25. type EdbDataDateChangeConf struct {
  26. Year int
  27. Month int
  28. Day int
  29. Frequency string `description:"频度变换"`
  30. FrequencyDay string `description:"频度的固定日期"`
  31. ChangeType int `description:"日期变换类型1日期位移,2指定频率"`
  32. }
  33. type ChartRangeAnalysisDeleteDataConf struct {
  34. Formula string `description:"比较符号:=、>、<、>=、<="`
  35. Value float64 `description:"比较的值"`
  36. ReplaceValue float64 `description:"替换的值"`
  37. }
  38. type ChartRangeAnalysisDataConvertConf struct {
  39. Value float64 `description:"数据转换值"`
  40. Unit string `description:"数据转换单位"`
  41. EnUnit string `description:"数据转换单位"`
  42. }
  43. type ChartRangeAnalysisManualDateConf struct { //手工划分
  44. StartDate string `description:"开始日期"`
  45. EndDate string `description:"结束日期"`
  46. }
  47. type ChartRangeAnalysisAutoDateConf struct { //智能划分
  48. IsAutoStartDate int `description:"起始日期是否是动态设置:0固定,1动态"`
  49. StartDate string `description:"固定模式下的起始日期"`
  50. EndDate string `description:"固定模式下的截止日期"`
  51. IsAutoEndDate int `description:"截止日期是否是动态设置:0固定,1动态"`
  52. StartDateConf ChartRangeAnalysisAutoDateChangeConf `description:"动态起始日期配置"`
  53. EndDateConf ChartRangeAnalysisAutoDateChangeConf `description:"动态截止日期配置"`
  54. }
  55. type ChartRangeAnalysisYearDateConf struct {
  56. StartDay string `description:"开始日"`
  57. EndDay string `description:"结束日"`
  58. }
  59. type ChartRangeAnalysisManualDateConfList []ChartRangeAnalysisManualDateConf
  60. func (a ChartRangeAnalysisManualDateConfList) Len() int { return len(a) }
  61. func (a ChartRangeAnalysisManualDateConfList) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
  62. func (a ChartRangeAnalysisManualDateConfList) Less(i, j int) bool {
  63. return a[i].StartDate < a[j].StartDate
  64. }
  65. type ChartRangeAnalysisDataResp struct { //图表详情返回值
  66. *ChartRangeAnalysisExtraConf
  67. SeriesId int `description:"指标系列ID"`
  68. ConfigEdbNum int `description:"生成的指标数"`
  69. }
  70. type ChartRangeAnalysisDateDataItem struct {
  71. StartDate time.Time
  72. EndDate time.Time
  73. DataList []*EdbDataList
  74. }
  75. // ChartRangeAnalysisConfigEdbResp 指标列表
  76. type ChartRangeAnalysisConfigEdbResp struct {
  77. EdbInfoList []*ChartRangeAnalysisConfigEdbItem `description:"指标列表"`
  78. }
  79. type ChartRangeAnalysisConfigEdbItem struct {
  80. EdbInfoId int `description:"指标id"`
  81. EdbName string `description:"指标名称"`
  82. EdbNameEn string `description:"指标名称"`
  83. Frequency string `description:"频度"`
  84. Unit string `description:"单位"`
  85. UnitEn string `description:"单位"`
  86. ClassifyId int `description:"分类id"`
  87. FromEdbInfoId int `description:"计算来源指标id"`
  88. EdbTypeInfo int `description:"指标类型,0普通指标,1预测指标"`
  89. }
  90. type SortEdbDataList []*EdbDataList
  91. func (m SortEdbDataList) Len() int {
  92. return len(m)
  93. }
  94. func (m SortEdbDataList) Less(i, j int) bool {
  95. return m[i].DataTime > m[j].DataTime
  96. }
  97. func (m SortEdbDataList) Swap(i, j int) {
  98. m[i], m[j] = m[j], m[i]
  99. }