excel_info.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. package request
  2. import "encoding/json"
  3. // MoveExcelInfoReq 移动excel表格请求
  4. type MoveExcelInfoReq struct {
  5. ExcelClassifyId int `description:"excel表格分类id"`
  6. ExcelInfoId int `description:"excel表格ID"`
  7. PrevExcelInfoId int `description:"上一个excel表格ID"`
  8. NextExcelInfoId int `description:"下一个excel表格ID"`
  9. }
  10. // DeleteExcelInfoReq 删除表格请求
  11. type DeleteExcelInfoReq struct {
  12. ExcelInfoId int `description:"表格ID"`
  13. }
  14. // AddExcelInfoReq 新增表格请求
  15. type AddExcelInfoReq struct {
  16. ExcelInfoId int `description:"表格ID"`
  17. ExcelName string `description:"表格名称"`
  18. Source int `description:"表格来源,1:excel插件的表格,2:自定义表格,5平衡表,默认:1"`
  19. ExcelType int `description:"表格类型,1:指标列,2:日期列,默认:1"`
  20. ExcelImage string `description:"表格截图"`
  21. ExcelClassifyId int `description:"分类id"`
  22. Content string `description:"Excel表格内容"`
  23. TableData interface{} `description:"自定义表格的数据内容"`
  24. ParentId int `description:"表格的父级id"`
  25. SourcesFrom string `description:"图表来源"`
  26. }
  27. // EditExcelInfoReq 编辑表格请求
  28. type EditExcelInfoReq struct {
  29. ExcelInfoId int `description:"ETA表格ID"`
  30. ExcelType int `description:"表格类型,1:指标列,2:日期列,默认:1"`
  31. ExcelName string `description:"表格名称"`
  32. ExcelImage string `description:"表格截图"`
  33. ExcelClassifyId int `description:"分类id"`
  34. Content string `description:"Excel表格内容"`
  35. TableData interface{} `description:"自定义表格的数据内容"`
  36. SourcesFrom string `description:"图表来源"`
  37. }
  38. // SetExcelInfoImageReq 设置excel表格图片请求
  39. type SetExcelInfoImageReq struct {
  40. ExcelInfoId int `description:"表格ID"`
  41. ImageUrl string `description:"表格图片地址"`
  42. }
  43. // AddExcelDraftReq 新增表格草稿请求
  44. type AddExcelDraftReq struct {
  45. ExcelInfoId int `description:"ETA表格ID"`
  46. ExcelName string `description:"表格名称"`
  47. ExcelClassifyId int `description:"分类id"`
  48. Content string `description:"Excel表格内容"`
  49. }
  50. // CalculateReq 公式计算
  51. type CalculateReq struct {
  52. CalculateFormula string `description:"计算公式"`
  53. TagMap map[string]float64 `description:"标签与值的关系"`
  54. }
  55. // GetOtherEdbDateDataReq 获取其他指标的指定日期的数据
  56. type GetOtherEdbDateDataReq struct {
  57. EdbInfoId int `description:"指标id"`
  58. SortType string `description:"如何排序,是正序还是倒序,枚举值:asc 正序,desc 倒序,不传默认倒序"`
  59. DateList []string `description:"日期列表,从小到大"`
  60. DateDecimal map[string]int `description:"日期行的小数位数映射"`
  61. }
  62. type GetBatchEdbDateDataReq struct {
  63. EdbInfoId []int `description:"指标id"`
  64. Num int `description:"默认期数"`
  65. Decimal []int `description:"指标上的小数位数"`
  66. SortType string `description:"如何排序,是正序还是倒序,枚举值:asc 正序,desc 倒序,不传默认倒序"`
  67. DateList []string `description:"日期列表,从小到大"`
  68. }
  69. // GetFutureDateDataReq 获取未来日期的数据
  70. type GetFutureDateDataReq struct {
  71. EdbInfoIdList []int `description:"指标id列表,从左至右,从上到下的顺序"`
  72. DateType int `description:"日期类型,1:期数,2:截止日期"`
  73. Num int `description:"需要添加的期数"`
  74. Decimal []int `description:"小数位数, 从左至右,从上到下的顺序"`
  75. StartDate string `description:"开始日期"`
  76. EndDate string `description:"结束日期"`
  77. }
  78. // GetHistoryDateDataReq 获取历史日期的数据
  79. type GetHistoryDateDataReq struct {
  80. EdbInfoIdList []int `description:"指标id列表,从左至右,从上到下的顺序"`
  81. Num int `description:"需要添加的期数"`
  82. Decimal []int `description:"小数位数, 从左至右,从上到下的顺序"`
  83. EndDate string `description:"结束日期"`
  84. }
  85. // TableSaveReq 表格保存
  86. type TableSaveReq struct {
  87. ExcelName string `description:"表格名称"`
  88. ExcelImage string `description:"表格截图"`
  89. ExcelClassifyId int `description:"分类id"`
  90. TableData interface{} `description:"表格数据"`
  91. }
  92. // TableDataReq 自定义表格请求参数
  93. type TableDataReq struct {
  94. EdbInfoIdList []int `description:"指标id列表,从左至右,从上到下的顺序"`
  95. Sort int `description:"日期排序,1:倒序,2:正序"`
  96. Data []EdbInfoData `description:"数据列表"`
  97. TextRowData [][]ManualDataReq `description:"文本列表"`
  98. DecimalConfig []DecimalConfig `description:"小数位数配置"`
  99. DateSize interface{} `description:"日期列的大小"`
  100. }
  101. type DecimalConfig struct {
  102. Row string `description:"行上的索引, 目前仅保存指标的日期"`
  103. Col int `description:"列上的索引, 目前仅保存edbInfoId"`
  104. Decimal int `description:"小数位数, 从左至右,从上到下的顺序"`
  105. }
  106. // EdbInfoData 自定义表格的数据
  107. type EdbInfoData struct {
  108. EdbInfoId int `description:"指标ID"`
  109. Tag string `description:"标签"`
  110. EdbName string `description:"指标名称"`
  111. EdbNameEn string `description:"英文指标名称"`
  112. EdbAliasName string `description:"指标别名"`
  113. Frequency string `description:"频度"`
  114. Unit string `description:"单位"`
  115. UnitEn string `description:"英文单位"`
  116. Decimal int `description:"小数位数"`
  117. ClassifyId int `description:"所属分类" json:"-"`
  118. IsJoinPermission int `description:"是否加入权限管控,0:不加入;1:加入;默认:0" json:"-"`
  119. HaveOperaAuth bool `description:"是否有数据权限,默认:false"`
  120. Data []ManualDataReq `description:"单元格数据列表"`
  121. }
  122. type EdbInfoDataTemp struct {
  123. EdbInfoId int `description:"指标ID"`
  124. Tag string `description:"标签"`
  125. EdbName string `description:"指标名称"`
  126. EdbNameEn string `description:"英文指标名称"`
  127. EdbAliasName string `description:"指标别名"`
  128. Frequency string `description:"频度"`
  129. Unit string `description:"单位"`
  130. UnitEn string `description:"英文单位"`
  131. Decimal *int `description:"小数位数"`
  132. ClassifyId int `description:"所属分类" json:"-"`
  133. IsJoinPermission int `description:"是否加入权限管控,0:不加入;1:加入;默认:0" json:"-"`
  134. HaveOperaAuth bool `description:"是否有数据权限,默认:false"`
  135. Data []ManualDataReq `description:"单元格数据列表"`
  136. }
  137. func (e *EdbInfoData) UnmarshalJSON(data []byte) error {
  138. var alias EdbInfoDataTemp
  139. if err := json.Unmarshal(data, &alias); err != nil {
  140. return err
  141. }
  142. if alias.Decimal != nil {
  143. e.Decimal = *alias.Decimal
  144. } else {
  145. e.Decimal = -1
  146. }
  147. e.EdbInfoId = alias.EdbInfoId
  148. e.Tag = alias.Tag
  149. e.EdbName = alias.EdbName
  150. e.EdbNameEn = alias.EdbNameEn
  151. e.EdbAliasName = alias.EdbAliasName
  152. e.Frequency = alias.Frequency
  153. e.Unit = alias.Unit
  154. e.UnitEn = alias.UnitEn
  155. e.ClassifyId = alias.ClassifyId
  156. e.IsJoinPermission = alias.IsJoinPermission
  157. e.HaveOperaAuth = alias.HaveOperaAuth
  158. e.Data = alias.Data
  159. return nil
  160. }
  161. // ManualDataReq 自定义表格的单元格数据
  162. type ManualDataReq struct {
  163. DataType int `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算,5:预测值"`
  164. DataTime string `description:"所属日期"`
  165. DataTimeType int `description:"日期类型,1:实际日期;2:未来日期"`
  166. ShowValue string `description:"展示值"`
  167. Value string `description:"实际值(计算公式)"`
  168. Decimal int `description:"小数位数"`
  169. RelationEdbInfoList []RelationEdbInfo `description:"关联指标(计算公式中关联的指标,用于计算的时候去匹配)"`
  170. }
  171. type ManualDataTemp struct {
  172. DataType int `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算,5:预测值"`
  173. DataTime string `description:"所属日期"`
  174. DataTimeType int `description:"日期类型,1:实际日期;2:未来日期"`
  175. ShowValue string `description:"展示值"`
  176. Value string `description:"实际值(计算公式)"`
  177. Decimal *int `description:"小数位数"`
  178. RelationEdbInfoList []RelationEdbInfo `description:"关联指标(计算公式中关联的指标,用于计算的时候去匹配)"`
  179. }
  180. func (m *ManualDataReq) UnmarshalJSON(data []byte) error {
  181. var alias ManualDataTemp
  182. if err := json.Unmarshal(data, &alias); err != nil {
  183. return err
  184. }
  185. if alias.Decimal != nil {
  186. m.Decimal = *alias.Decimal
  187. } else {
  188. m.Decimal = -1
  189. }
  190. m.DataType = alias.DataType
  191. m.DataTime = alias.DataTime
  192. m.DataTimeType = alias.DataTimeType
  193. m.ShowValue = alias.ShowValue
  194. m.Value = alias.Value
  195. m.RelationEdbInfoList = alias.RelationEdbInfoList
  196. return nil
  197. }
  198. // RelationEdbInfo 自定义表格中单元格的关联指标
  199. type RelationEdbInfo struct {
  200. Tag string `description:"指标标签"`
  201. Row string `description:"第几行"`
  202. }
  203. // CopyExcelInfoReq 复制表格请求
  204. type CopyExcelInfoReq struct {
  205. ExcelInfoId int `description:"ETA表格ID"`
  206. ExcelName string `description:"表格名称"`
  207. ExcelClassifyId int `description:"分类id"`
  208. }
  209. // MarkEditExcel 标记编辑表格的请求数据
  210. type MarkEditExcel struct {
  211. ExcelInfoId int `description:"表格id"`
  212. Status int `description:"标记状态,1:编辑中,2:编辑完成"`
  213. }
  214. // RenameExcelInfoReq 表格重命名请求
  215. type RenameExcelInfoReq struct {
  216. ExcelInfoId int `description:"ETA表格ID"`
  217. ExcelName string `description:"表格名称"`
  218. }
  219. type SaveExcelInfoWorkerReq struct {
  220. ExcelInfoId int `description:"ETA表格ID"`
  221. SysUserIds string `description:"协作人ID 用英文逗号拼接"`
  222. }
  223. // ShareExcelInfoReq 分享表格请求
  224. type ShareExcelInfoReq struct {
  225. ExcelInfoId int `description:"表格ID"`
  226. ViewUserIds []int `description:"查看权限用户IDs"`
  227. EditUserIds []int `description:"编辑权限用户IDs"`
  228. }
  229. type ExcelRuleMappingReq struct {
  230. ExcelRuleMappingId int `description:"规则映射ID"`
  231. ExcelInfoId int `description:"ETA表格ID"`
  232. RuleType int `description:"规则类型:1-大于,2-小于,3-介于,4-等于,5-发生日期"`
  233. LeftValue string `description:"条件值"`
  234. LeftValueType int `description:"条件值的类型,1:数值,2:坐标"`
  235. RightValue string `description:"条件值, 用于介于的条件"`
  236. RightValueType int `description:"条件值的类型,1:数值,2:坐标"`
  237. FontColor string `description:"字体颜色"`
  238. BackgroundColor string `description:"背景颜色"`
  239. Remark string `description:"预设的单元格样式名称"`
  240. Scope string `description:"应用选区"`
  241. }
  242. type DeleteExcelRuleMappingReq struct {
  243. ExcelRuleMappingId int `description:"规则映射ID"`
  244. }