excel_info.go 12 KB

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