mixed_table.go 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. package request
  2. const (
  3. DateDT = iota + 1 //日期
  4. EdbDT // 2 指标类型
  5. CustomTextDT // 3 自定义文本
  6. InsertDataDT // 4 插值(插入指标值,表格上,自动判断日期和指标的交集位置,插入值)
  7. PopInsertDataDT // 5 弹框插值(在表格上选择日期,然后空白单元格选择弹框并选择指标,插入该指标与该日期的值)
  8. FormulateCalculateDataDT // 6 公式计算(A+B这种)
  9. InsertEdbCalculateDataDT // 7 插入指标系统计算公式生成的值
  10. DateCalculateDataDT // 8 日期计算
  11. )
  12. const (
  13. CustomDateT = iota //手动输入日期
  14. SystemDateT // 系统日期
  15. EdbDateDT // 导入指标日期(指标库的最新日期)
  16. )
  17. const (
  18. SystemCurrDateT = iota + 1 //系统当前日期
  19. SystemCalculateDateT // 系统日期计算后的日期
  20. SystemFrequencyDateT // 导入系统日期相关的指定频率(所在周/旬/月/季/半年/年的最后/最早一天)
  21. )
  22. type MixedTableReq struct {
  23. CellRelation string `description:"单元格关系"`
  24. Data [][]MixedTableCellDataReq `description:"混合表格单元格参数"`
  25. }
  26. type MixedTableCellDataReq struct {
  27. Uid string `description:"单元格唯一标识"`
  28. DataType int `description:"数据类型,1:日期,2:指标,3:自定义文本,4:插值"`
  29. DataTime string `description:"所属日期"`
  30. DataTimeType int `description:"日期类型:0:手动输入日期(固定日期);1:导入系统日期;;3:导入指标日期(指标库的最新日期);"`
  31. EdbInfoId int `description:"指标id"`
  32. ShowValue string `description:"展示值"`
  33. Value string `description:"实际值和配置"`
  34. Extra string `description:"额外参数"`
  35. ShowStyle string `description:"展示的样式配置"`
  36. ShowFormatValue interface{} `description:"样式处理后的值"`
  37. MerData *struct {
  38. Type string `json:"type"`
  39. Mer struct {
  40. SKey string `json:"sKey"`
  41. Rowspan int `json:"rowspan"`
  42. Colspan int `json:"colspan"`
  43. Row int `json:"row"`
  44. Col int `json:"col"`
  45. } `json:"mer"`
  46. } `json:"merData" description:"合并单元格"`
  47. }
  48. type CellRelationConf struct {
  49. CellRelation
  50. RelationDate CellRelation `json:"relation_date"`
  51. RelationEdb CellRelation `json:"relation_edb"`
  52. }
  53. type CellRelation struct {
  54. Type int `json:"type" description:"数据类型,跟MixedTableCellDataReq的DataType保持一致"`
  55. Key string `json:"key" description:"单元格的唯一标识"`
  56. }
  57. type SystemDateConf struct {
  58. Source int `description:"类型,1:导入系统日期;2:导入系统日期计算后的日期;3:导入系统日期相关的指定频率"`
  59. CalculateNum int `description:"计算频度的数量"`
  60. CalculateFrequency string `description:"计算频度"`
  61. Frequency string `description:"指定频度"`
  62. Day string `description:"指定日期"`
  63. }
  64. type EdbDateConf struct {
  65. EdbInfoId int `description:"指标id"`
  66. EdbDateChangeConf
  67. }
  68. type EdbDateChangeConf struct {
  69. MoveForward int `description:"前移的期数"`
  70. DateChange []*EdbDateConfDateChange
  71. }
  72. type EdbDateConfDateChange struct {
  73. Year int
  74. Month int
  75. Day int
  76. Frequency string `description:"频度变换"`
  77. FrequencyDay string `description:"频度的固定日期"`
  78. ChangeType int `description:"日期变换类型1日期位移,2指定频率"`
  79. }
  80. type MixedDateCalculateReq struct {
  81. Formula string `description:"计算公式"`
  82. DateList []MixDateCalculateTagReq `description:"表格中的单元格"`
  83. }
  84. type MixDateCalculateConf struct {
  85. Formula string `description:"计算公式"`
  86. RelationCellList []MixDateCalculateTag `description:"表格中的单元格"`
  87. }
  88. type MixDateCalculateTag struct {
  89. Uid string `description:"单元格唯一值"`
  90. Tag string `description:"单元格对应标签"`
  91. }
  92. type MixDateCalculateTagReq struct {
  93. Date string `description:"日期"`
  94. Tag string `description:"指标对应标签"`
  95. }
  96. type MixCellShowStyle struct {
  97. Pn int `description:"小数点位数增加或减少,正数表述增加,负数表示减少" json:"pn"`
  98. Nt string `description:"变换类型:number 小数点位数改变,percent百分比," json:"nt"`
  99. GlObj interface{} `description:"公式对象:1:数值,2:百分比,3:文本" json:"glObj"`
  100. Decimal *int `description:"小数点位数" json:"decimal"`
  101. Last string `description:"起始操作:nt|decimal" json:"last"`
  102. Color string `description:"颜色值,#RRG" json:"color"`
  103. BackgroundColor string `description:"背景颜色值,#RRG" json:"background-color"`
  104. }
  105. type DateDataBeforeAfterReq struct {
  106. EdbInfoId int
  107. Date string
  108. Num int
  109. MoveForward int `description:"前移的期数"`
  110. DateChange []*EdbDateConfDateChange
  111. }
  112. type CalculateConf struct {
  113. EdbInfoId int `description:"指标id"`
  114. DataTime string `description:"所属日期,这个日期有传递的话,那么就取上下两期+自己的数据;没有传就默认最近5期的数据"`
  115. Frequency string `description:"需要转换的频度"`
  116. Formula interface{} `description:"计算公式,默认是string,实际上还需要转成其他样式"`
  117. Calendar string `description:"公历/农历"`
  118. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  119. MoveFrequency string `description:"移动频度"`
  120. Source int `description:"1:累计值转月;2:累计值转季;3:同比值;4:同差值;5:N数值移动平均数计算;6:环比值;7:环差值;8:升频;9:降频;10:时间移位;11:超季节性;12:年化;13:累计值;14:累计值年初至今;15:指数修匀;16:日均值"`
  121. EdbDateChangeConf
  122. }
  123. type BaseCalculateConf struct {
  124. Formula string `description:"计算公式,默认是string,实际上还需要转成其他样式"`
  125. RelationEdbInfoList []RelationCell `description:"关联单元格(计算公式中关联的单元格,用于计算的时候去匹配)"`
  126. }
  127. type RelationCell struct {
  128. Tag string `description:"指标标签"`
  129. Row string `description:"第几行"`
  130. Key string `json:"key" description:"单元格的唯一标识"`
  131. }