excel_info.go 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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. }
  100. type DecimalConfig struct {
  101. Row string `description:"行上的索引, 目前仅保存指标的日期"`
  102. Col int `description:"列上的索引, 目前仅保存edbInfoId"`
  103. Decimal int `description:"小数位数, 从左至右,从上到下的顺序"`
  104. }
  105. // EdbInfoData 自定义表格的数据
  106. type EdbInfoData struct {
  107. EdbInfoId int `description:"指标ID"`
  108. Tag string `description:"标签"`
  109. EdbName string `description:"指标名称"`
  110. EdbNameEn string `description:"英文指标名称"`
  111. EdbAliasName string `description:"指标别名"`
  112. Frequency string `description:"频度"`
  113. Unit string `description:"单位"`
  114. UnitEn string `description:"英文单位"`
  115. Decimal int `description:"小数位数"`
  116. ClassifyId int `description:"所属分类" json:"-"`
  117. IsJoinPermission int `description:"是否加入权限管控,0:不加入;1:加入;默认:0" json:"-"`
  118. HaveOperaAuth bool `description:"是否有数据权限,默认:false"`
  119. Data []ManualDataReq `description:"单元格数据列表"`
  120. }
  121. type EdbInfoDataTemp struct {
  122. EdbInfoId int `description:"指标ID"`
  123. Tag string `description:"标签"`
  124. EdbName string `description:"指标名称"`
  125. EdbNameEn string `description:"英文指标名称"`
  126. EdbAliasName string `description:"指标别名"`
  127. Frequency string `description:"频度"`
  128. Unit string `description:"单位"`
  129. UnitEn string `description:"英文单位"`
  130. Decimal *int `description:"小数位数"`
  131. ClassifyId int `description:"所属分类" json:"-"`
  132. IsJoinPermission int `description:"是否加入权限管控,0:不加入;1:加入;默认:0" json:"-"`
  133. HaveOperaAuth bool `description:"是否有数据权限,默认:false"`
  134. Data []ManualDataReq `description:"单元格数据列表"`
  135. }
  136. func (e *EdbInfoData) UnmarshalJSON(data []byte) error {
  137. var alias EdbInfoDataTemp
  138. if err := json.Unmarshal(data, &alias); err != nil {
  139. return err
  140. }
  141. if alias.Decimal != nil {
  142. e.Decimal = *alias.Decimal
  143. } else {
  144. e.Decimal = -1
  145. }
  146. e.EdbInfoId = alias.EdbInfoId
  147. e.Tag = alias.Tag
  148. e.EdbName = alias.EdbName
  149. e.EdbNameEn = alias.EdbNameEn
  150. e.EdbAliasName = alias.EdbAliasName
  151. e.Frequency = alias.Frequency
  152. e.Unit = alias.Unit
  153. e.UnitEn = alias.UnitEn
  154. e.ClassifyId = alias.ClassifyId
  155. e.IsJoinPermission = alias.IsJoinPermission
  156. e.HaveOperaAuth = alias.HaveOperaAuth
  157. e.Data = alias.Data
  158. return nil
  159. }
  160. // ManualDataReq 自定义表格的单元格数据
  161. type ManualDataReq struct {
  162. DataType int `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算,5:预测值"`
  163. DataTime string `description:"所属日期"`
  164. DataTimeType int `description:"日期类型,1:实际日期;2:未来日期"`
  165. ShowValue string `description:"展示值"`
  166. Value string `description:"实际值(计算公式)"`
  167. Decimal int `description:"小数位数"`
  168. RelationEdbInfoList []RelationEdbInfo `description:"关联指标(计算公式中关联的指标,用于计算的时候去匹配)"`
  169. }
  170. type ManualDataTemp struct {
  171. DataType int `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算,5:预测值"`
  172. DataTime string `description:"所属日期"`
  173. DataTimeType int `description:"日期类型,1:实际日期;2:未来日期"`
  174. ShowValue string `description:"展示值"`
  175. Value string `description:"实际值(计算公式)"`
  176. Decimal *int `description:"小数位数"`
  177. RelationEdbInfoList []RelationEdbInfo `description:"关联指标(计算公式中关联的指标,用于计算的时候去匹配)"`
  178. }
  179. func (m *ManualDataReq) UnmarshalJSON(data []byte) error {
  180. var alias ManualDataTemp
  181. if err := json.Unmarshal(data, &alias); err != nil {
  182. return err
  183. }
  184. if alias.Decimal != nil {
  185. m.Decimal = *alias.Decimal
  186. } else {
  187. m.Decimal = -1
  188. }
  189. m.DataType = alias.DataType
  190. m.DataTime = alias.DataTime
  191. m.DataTimeType = alias.DataTimeType
  192. m.ShowValue = alias.ShowValue
  193. m.Value = alias.Value
  194. m.RelationEdbInfoList = alias.RelationEdbInfoList
  195. return nil
  196. }
  197. // RelationEdbInfo 自定义表格中单元格的关联指标
  198. type RelationEdbInfo struct {
  199. Tag string `description:"指标标签"`
  200. Row string `description:"第几行"`
  201. }
  202. // CopyExcelInfoReq 复制表格请求
  203. type CopyExcelInfoReq struct {
  204. ExcelInfoId int `description:"ETA表格ID"`
  205. ExcelName string `description:"表格名称"`
  206. ExcelClassifyId int `description:"分类id"`
  207. }
  208. // MarkEditExcel 标记编辑表格的请求数据
  209. type MarkEditExcel struct {
  210. ExcelInfoId int `description:"表格id"`
  211. Status int `description:"标记状态,1:编辑中,2:编辑完成"`
  212. }
  213. // RenameExcelInfoReq 表格重命名请求
  214. type RenameExcelInfoReq struct {
  215. ExcelInfoId int `description:"ETA表格ID"`
  216. ExcelName string `description:"表格名称"`
  217. }
  218. type SaveExcelInfoWorkerReq struct {
  219. ExcelInfoId int `description:"ETA表格ID"`
  220. SysUserIds string `description:"协作人ID 用英文逗号拼接"`
  221. }
  222. // ShareExcelInfoReq 分享表格请求
  223. type ShareExcelInfoReq struct {
  224. ExcelInfoId int `description:"表格ID"`
  225. ViewUserIds []int `description:"查看权限用户IDs"`
  226. EditUserIds []int `description:"编辑权限用户IDs"`
  227. }
  228. type ExcelRuleMappingReq struct {
  229. ExcelRuleMappingId int `description:"规则映射ID"`
  230. ExcelInfoId int `description:"ETA表格ID"`
  231. RuleType int `description:"规则类型:1-大于,2-小于,3-介于,4-等于,5-发生日期"`
  232. LeftValue string `description:"条件值"`
  233. LeftValueType int `description:"条件值的类型,1:数值,2:坐标"`
  234. RightValue string `description:"条件值, 用于介于的条件"`
  235. RightValueType int `description:"条件值的类型,1:数值,2:坐标"`
  236. FontColor string `description:"字体颜色"`
  237. BackgroundColor string `description:"背景颜色"`
  238. Remark string `description:"预设的单元格样式名称"`
  239. Scope string `description:"应用选区"`
  240. }
  241. type DeleteExcelRuleMappingReq struct {
  242. ExcelRuleMappingId int `description:"规则映射ID"`
  243. }