edb_info_calculate.go 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. package data_manage
  2. import (
  3. "fmt"
  4. "strings"
  5. "time"
  6. "github.com/beego/beego/v2/client/orm"
  7. "github.com/rdlucklib/rdluck_tools/paging"
  8. )
  9. type EdbInfoCalculateSaveReq struct {
  10. EdbName string `description:"指标名称"`
  11. Frequency string `description:"频率"`
  12. Unit string `description:"单位"`
  13. ClassifyId int `description:"分类id"`
  14. CalculateFormula string `description:"计算公式"`
  15. Calendar string `description:"公历/农历"`
  16. EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
  17. MaxEmptyType int `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
  18. Extra string `description:"指标的额外配置"`
  19. EdbInfoIdArr []EdbInfoFromTag `description:"指标信息"`
  20. }
  21. // EdbInfoFromTag 计算指标的关联指标
  22. type EdbInfoFromTag struct {
  23. EdbInfoId int `description:"指标id"`
  24. FromTag string `description:"指标对应标签"`
  25. MoveValue int `description:"移动的值"`
  26. }
  27. type EdbInfoCalculate struct {
  28. EdbInfoCalculateId int `orm:"column(edb_info_calculate_id);pk"`
  29. EdbInfoId int `description:"指标id"`
  30. EdbCode string `description:"指标编码"`
  31. FromEdbInfoId int `description:"计算指标id"`
  32. FromEdbCode string `description:"计算指标编码"`
  33. FromEdbName string `description:"计算指标名称"`
  34. FromSource int `description:"计算指标来源"`
  35. FromSourceName string `description:"计算指标来源名称"`
  36. FromTag string `description:"来源指标标签"`
  37. Sort int `description:"计算指标名称排序"`
  38. CreateTime time.Time `description:"创建时间"`
  39. ModifyTime time.Time `description:"修改时间"`
  40. }
  41. func AddEdbInfoCalculateMulti(items []*EdbInfoCalculate) (err error) {
  42. o := orm.NewOrmUsingDB("data")
  43. _, err = o.InsertMulti(1, items)
  44. return
  45. }
  46. type FromEdbInfoData struct {
  47. EdbInfoId int `description:"指标id"`
  48. EdbName string `description:"指标名称"`
  49. DataList []*EdbInfoSearchData
  50. }
  51. type EdbInfoCalculateDetail struct {
  52. EdbInfoCalculateId int `orm:"column(edb_info_calculate_id);pk"`
  53. EdbInfoId int `description:"指标id"`
  54. EdbCode string `description:"指标编码"`
  55. FromEdbInfoId int `description:"计算指标id"`
  56. FromEdbCode string `description:"计算指标编码"`
  57. FromEdbName string `description:"计算指标名称"`
  58. FromEdbNameEn string `description:"计算指标名称"`
  59. FromSource int `description:"计算指标来源"`
  60. FromSourceName string `description:"计算指标来源名称"`
  61. FromTag string `description:"来源指标标签"`
  62. MoveValue int `description:"移动的值,小于0是提前,0是不变,大于0是滞后"`
  63. Sort int `description:"计算指标名称排序"`
  64. CreateTime time.Time `description:"创建时间"`
  65. ModifyTime time.Time `description:"修改时间"`
  66. StartDate string `description:"开始日期"`
  67. EndDate string `description:"结束日期"`
  68. LatestDate string `description:"实际的结束日期"`
  69. LatestValue float64 `description:"最近实际数据的值"`
  70. EndValue float64 `description:"结束日期的值(可能是插入值)"`
  71. EdbType int `description:"指标类型:1:基础指标,2:计算指标"`
  72. Frequency string `description:"频率"`
  73. Unit string `description:"单位"`
  74. ClassifyId int `description:"分类id"`
  75. }
  76. func GetEdbInfoCalculateDetail(edbInfoId, source int) (list []*EdbInfoCalculateDetail, err error) {
  77. o := orm.NewOrmUsingDB("data")
  78. //calculateTableName := GetEdbInfoCalculateTableName(source)
  79. //sql := ` SELECT a.*,b.start_date,b.end_date,b.edb_type FROM %s AS a
  80. // INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
  81. // WHERE a.edb_info_id=? ORDER BY sort ASC `
  82. //
  83. //sql = fmt.Sprintf(sql, calculateTableName)
  84. sql := ` SELECT a.edb_info_calculate_mapping_id,a.edb_info_id,a.source,a.source_name,a.edb_code,a.from_edb_info_id,a.from_edb_code,a.from_source,a.from_source_name,a.sort,a.create_time,a.modify_time,a.from_tag,a.move_value,b.edb_name as from_edb_name,b.edb_name_en as from_edb_name_en,b.start_date,b.end_date,b.latest_date,b.latest_value,b.edb_type, b.frequency, b.unit, b.classify_id FROM edb_info_calculate_mapping AS a
  85. INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
  86. WHERE a.edb_info_id=? ORDER BY sort ASC `
  87. _, err = o.Raw(sql, edbInfoId).QueryRows(&list)
  88. return
  89. }
  90. type CalculateDetailResp struct {
  91. EdbInfoDetail *EdbInfoFullClassify
  92. CalculateList []*EdbInfoCalculateDetail
  93. }
  94. type EdbInfoCalculateEditReq struct {
  95. EdbInfoId int `description:"指标id"`
  96. EdbName string `description:"指标名称"`
  97. Frequency string `description:"频率"`
  98. Unit string `description:"单位"`
  99. ClassifyId int `description:"分类id"`
  100. CalculateFormula string `description:"计算公式"`
  101. EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
  102. MaxEmptyType int `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
  103. Extra string `description:"指标的额外配置"`
  104. EdbInfoIdArr []EdbInfoFromTag `description:"指标信息"`
  105. }
  106. func GetCalculateEdbInfo(edbInfoId int) (from_edb_info_id string, err error) {
  107. o := orm.NewOrmUsingDB("data")
  108. sql := ` SELECT GROUP_CONCAT(from_edb_info_id ORDER BY sort ASC SEPARATOR ',') AS from_edb_info_id
  109. FROM edb_info_calculate_mapping
  110. WHERE edb_info_id=?
  111. GROUP BY edb_info_id
  112. `
  113. err = o.Raw(sql, edbInfoId).QueryRow(&from_edb_info_id)
  114. return
  115. }
  116. func DeleteCalculateEdbInfo(edbInfoId int) (err error) {
  117. o := orm.NewOrmUsingDB("data")
  118. to, err := o.Begin()
  119. if err != nil {
  120. return
  121. }
  122. defer func() {
  123. if err != nil {
  124. _ = to.Rollback()
  125. } else {
  126. _ = to.Commit()
  127. }
  128. }()
  129. sql := `DELETE FROM edb_data_calculate WHERE edb_info_id=?`
  130. _, err = to.Raw(sql, edbInfoId).Exec()
  131. if err != nil {
  132. return
  133. }
  134. sql = `DELETE FROM edb_info_calculate_mapping WHERE edb_info_id=?`
  135. _, err = to.Raw(sql, edbInfoId).Exec()
  136. return
  137. }
  138. func DeleteCalculateData(edbInfoId int) (err error) {
  139. o := orm.NewOrmUsingDB("data")
  140. sql := `DELETE FROM edb_data_calculate WHERE edb_info_id=?`
  141. _, err = o.Raw(sql, edbInfoId).Exec()
  142. return
  143. }
  144. type EdbInfoBase struct {
  145. EdbInfoId int `description:"指标id"`
  146. EdbName string `description:"指标名称"`
  147. EdbNameEn string `description:"英文指标名称"`
  148. Frequency string `description:"频度"`
  149. Unit string `description:"单位"`
  150. UnitEn string `description:"英文单位"`
  151. ClassifyId int `description:"分类id"`
  152. HaveOperaAuth bool `description:"是否有数据权限,默认:false"`
  153. }
  154. type CalculateEdbInfoItem struct {
  155. EdbInfoId int `description:"指标id"`
  156. EdbName string `description:"指标名称"`
  157. Frequency string `description:"频度"`
  158. Unit string `description:"单位"`
  159. ClassifyId int `description:"分类id"`
  160. CalculateId string `description:"当前请求时,单个计算的唯一标识"`
  161. FromEdbInfoId int `description:"计算来源指标id"`
  162. }
  163. type EdbInfoCalculateBatchSaveMultiReq struct {
  164. List []CalculateEdbInfoItem
  165. Formula string `description:"N值/移动天数"`
  166. FromEdbInfoId int `description:"计算来源指标id"`
  167. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:变频"`
  168. CalculateFormula string `description:"计算公式"`
  169. EdbInfoIdArr []EdbInfoFromTag `description:"指标信息"`
  170. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  171. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  172. Extra string `description:"指标的额外配置"`
  173. Calendar string `description:"公历/农历"`
  174. }
  175. type EdbInfoCalculateBatchSaveReq struct {
  176. EdbInfoId int `description:"指标id"`
  177. EdbName string `description:"指标名称"`
  178. Frequency string `description:"频度"`
  179. Unit string `description:"单位"`
  180. ClassifyId int `description:"分类id"`
  181. Formula string `description:"N值/移动天数"`
  182. FromEdbInfoId int `description:"计算来源指标id"`
  183. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:变频"`
  184. CalculateFormula string `description:"计算公式"`
  185. EdbInfoIdArr []EdbInfoFromTag `description:"指标信息"`
  186. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  187. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  188. Extra string `description:"指标的额外配置"`
  189. Calendar string `description:"公历/农历"`
  190. }
  191. type EdbInfoCalculateBatchEditReq struct {
  192. EdbName string `description:"指标名称"`
  193. Frequency string `description:"频度"`
  194. Unit string `description:"单位"`
  195. ClassifyId int `description:"分类id"`
  196. Formula string `description:"N值"`
  197. EdbInfoId int `description:"编辑指标id"`
  198. FromEdbInfoId int `description:"计算来源指标id"`
  199. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:变频"`
  200. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  201. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  202. Calendar string `description:"公历/农历"`
  203. Extra string `description:"指标的额外配置"`
  204. EdbInfoIdArr []EdbInfoFromTag
  205. }
  206. // EdbInfoCalculateBatchSaveReqByEdbLib edb指标库的请求逻辑
  207. type EdbInfoCalculateBatchSaveReqByEdbLib struct {
  208. AdminId int `description:"添加人id"`
  209. AdminName string `description:"添加人名称"`
  210. EdbInfoId int `description:"指标id"`
  211. EdbName string `description:"指标名称"`
  212. Frequency string `description:"频度"`
  213. Unit string `description:"单位"`
  214. ClassifyId int `description:"分类id"`
  215. Formula string `description:"N值/移动天数"`
  216. FromEdbInfoId int `description:"计算来源指标id"`
  217. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:变频"`
  218. CalculateFormula string `description:"计算公式"`
  219. EdbInfoIdArr []EdbInfoFromTag `description:"指标信息"`
  220. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  221. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  222. Calendar string `description:"公历/农历"`
  223. Data interface{} `description:"数据列"`
  224. EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
  225. MaxEmptyType int `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
  226. Extra string `description:"指标的额外配置"`
  227. }
  228. // EdbInfoCalculateBatchEditReqByEdbLib 编辑计算指标的请求参数
  229. type EdbInfoCalculateBatchEditReqByEdbLib struct {
  230. EdbName string `description:"指标名称"`
  231. Frequency string `description:"频度"`
  232. Unit string `description:"单位"`
  233. ClassifyId int `description:"分类id"`
  234. AdminId int `description:"操作人id"`
  235. AdminName string `description:"操作人姓名"`
  236. Formula string `description:"N值"`
  237. EdbInfoId int `description:"编辑指标id"`
  238. FromEdbInfoId int `description:"计算来源指标id"`
  239. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:变频"`
  240. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  241. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  242. Calendar string `description:"公历/农历"`
  243. EdbInfoIdArr []EdbInfoFromTag
  244. Data interface{} `description:"数据列"`
  245. Extra string `description:"指标的额外配置"`
  246. }
  247. func GetEdbInfoCalculateMap(edbInfoId, source int) (list []*EdbInfo, err error) {
  248. o := orm.NewOrmUsingDB("data")
  249. //calculateTableName := GetEdbInfoCalculateTableName(source)
  250. //sql := ` SELECT b.* FROM %s AS a
  251. // INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
  252. // WHERE a.edb_info_id=? ORDER BY sort ASC `
  253. //sql = fmt.Sprintf(sql, calculateTableName)
  254. sql := ` SELECT b.* FROM edb_info_calculate_mapping AS a
  255. INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
  256. WHERE a.edb_info_id=? ORDER BY sort ASC `
  257. _, err = o.Raw(sql, edbInfoId).QueryRows(&list)
  258. return
  259. }
  260. type CalculateItems struct {
  261. EdbInfoId int
  262. DataMap map[string]float64
  263. }
  264. func CheckFormula(formula string) map[string]string {
  265. mathFormula := []string{"MAX", "MIN", "ABS", "ACOS", "ASIN", "CEIL", "MOD", "POW", "ROUND", "SIGN", "SIN", "TAN", "LOG10", "LOG2", "LOG", "LN"}
  266. str := strings.ToUpper(formula)
  267. for _, v := range mathFormula {
  268. str = strings.Replace(str, v, "", -1)
  269. }
  270. str = strings.Replace(str, "(", "", -1)
  271. str = strings.Replace(str, ")", "", -1)
  272. byteMap := make(map[string]string)
  273. for i := 0; i < len(str); i++ {
  274. byteInt := str[i]
  275. if byteInt >= 65 && byteInt <= 90 {
  276. byteStr := string(byteInt)
  277. if _, ok := byteMap[byteStr]; !ok {
  278. byteMap[byteStr] = byteStr
  279. }
  280. }
  281. }
  282. return byteMap
  283. }
  284. func ReplaceFormula(edbInfoIdArr []*EdbInfo, valArr map[int]float64, formulaMap map[string]string, formulaStr string, edbInfoIdBytes []string) string {
  285. funMap := GetFormulaMap()
  286. for k, v := range funMap {
  287. formulaStr = strings.Replace(formulaStr, k, v, -1)
  288. }
  289. replaceCount := 0
  290. for dk, dv := range edbInfoIdArr {
  291. if dk == 0 {
  292. dKey := edbInfoIdBytes[dk]
  293. if _, ok := formulaMap[dKey]; ok { //公式中存在
  294. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  295. dvStr := fmt.Sprintf("%v", val)
  296. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  297. replaceCount++
  298. }
  299. }
  300. }
  301. if dk == 1 {
  302. dKey := edbInfoIdBytes[dk]
  303. if _, ok := formulaMap[dKey]; ok { //公式中存在
  304. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  305. dvStr := fmt.Sprintf("%v", val)
  306. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  307. replaceCount++
  308. }
  309. }
  310. }
  311. if dk == 2 {
  312. dKey := edbInfoIdBytes[dk]
  313. if _, ok := formulaMap[dKey]; ok { //公式中存在
  314. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  315. dvStr := fmt.Sprintf("%v", val)
  316. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  317. replaceCount++
  318. }
  319. }
  320. }
  321. if dk == 3 {
  322. dKey := edbInfoIdBytes[dk]
  323. if _, ok := formulaMap[dKey]; ok { //公式中存在
  324. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  325. dvStr := fmt.Sprintf("%v", val)
  326. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  327. replaceCount++
  328. }
  329. }
  330. }
  331. if dk == 4 {
  332. dKey := edbInfoIdBytes[dk]
  333. if _, ok := formulaMap[dKey]; ok { //公式中存在
  334. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  335. dvStr := fmt.Sprintf("%v", val)
  336. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  337. replaceCount++
  338. }
  339. }
  340. }
  341. if dk == 5 {
  342. dKey := edbInfoIdBytes[dk]
  343. if _, ok := formulaMap[dKey]; ok { //公式中存在
  344. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  345. dvStr := fmt.Sprintf("%v", val)
  346. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  347. replaceCount++
  348. }
  349. }
  350. }
  351. if dk == 6 {
  352. dKey := edbInfoIdBytes[dk]
  353. if _, ok := formulaMap[dKey]; ok { //公式中存在
  354. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  355. dvStr := fmt.Sprintf("%v", val)
  356. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  357. replaceCount++
  358. }
  359. }
  360. }
  361. if dk == 7 {
  362. dKey := edbInfoIdBytes[dk]
  363. if _, ok := formulaMap[dKey]; ok { //公式中存在
  364. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  365. dvStr := fmt.Sprintf("%v", val)
  366. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  367. replaceCount++
  368. }
  369. }
  370. }
  371. if dk == 8 {
  372. dKey := edbInfoIdBytes[dk]
  373. if _, ok := formulaMap[dKey]; ok { //公式中存在
  374. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  375. dvStr := fmt.Sprintf("%v", val)
  376. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  377. replaceCount++
  378. }
  379. }
  380. }
  381. }
  382. for k, v := range funMap {
  383. formulaStr = strings.Replace(formulaStr, v, k, -1)
  384. }
  385. if replaceCount == len(formulaMap) {
  386. return formulaStr
  387. } else {
  388. return ""
  389. }
  390. }
  391. func GetFormulaMap() map[string]string {
  392. funMap := make(map[string]string)
  393. funMap["MAX"] = "[@@]"
  394. funMap["MIN"] = "[@!]"
  395. funMap["ABS"] = "[@#]"
  396. funMap["CEIL"] = "[@$]"
  397. funMap["COS"] = "[@%]"
  398. funMap["FLOOR"] = "[@^]"
  399. funMap["MOD"] = "[@&]"
  400. funMap["POW"] = "[@*]"
  401. funMap["ROUND"] = "[@(]"
  402. return funMap
  403. }
  404. // SaveAdjustEdbInfoReq 保存数据调整请求参数(请求指标服务)
  405. type SaveAdjustEdbInfoReq struct {
  406. AdminId int `description:"添加人id"`
  407. AdminName string `description:"添加人名称"`
  408. EdbInfoId int `description:"指标id"`
  409. FromEdbInfoId int `description:"来源指标id"`
  410. EdbName string `description:"指标名称"`
  411. Frequency string `description:"频度"`
  412. Unit string `description:"单位"`
  413. ClassifyId int `description:"分类id"`
  414. DataList []SaveAdjustEdbDataReq `description:"指标对应的数据值"`
  415. }
  416. // SaveAdjustEdbDataReq 保存数据调整请求的数据的参数
  417. type SaveAdjustEdbDataReq struct {
  418. Date string `description:"数据日期"`
  419. Value float64 `description:"数据值"`
  420. }
  421. // BatchEdbInfoCalculateBatchSaveReq 批量添加 计算指标
  422. type BatchEdbInfoCalculateBatchSaveReq struct {
  423. AdminId int `description:"添加人id"`
  424. AdminName string `description:"添加人名称"`
  425. EdbList []*CalculateEdbInfoItem //需要批量计算的指标列表
  426. Formula string `description:"N值/移动天数"`
  427. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:升频"`
  428. CalculateFormula string `description:"计算公式"`
  429. EdbInfoIdArr []EdbInfoFromTag `description:"关联指标列表"`
  430. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  431. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  432. Calendar string `description:"公历/农历"`
  433. Data interface{} `description:"数据"`
  434. EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
  435. MaxEmptyType int `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
  436. Extra string `description:"指标的额外配置"`
  437. }
  438. // BatchEdbInfoCalculateBatchSaveResp 批量添加 计算指标 返回数据
  439. type BatchEdbInfoCalculateBatchSaveResp struct {
  440. Fail []BatchEdbInfoCalculateBatchSaveFailResp `description:"添加失败的指标"`
  441. Success []BatchEdbInfoCalculateBatchSaveSuccessResp `description:"添加成功的指标"`
  442. }
  443. // BatchEdbInfoCalculateBatchSaveFailResp 添加失败的指标信息
  444. type BatchEdbInfoCalculateBatchSaveFailResp struct {
  445. CalculateId string `description:"当前请求时,单个计算的唯一标识"`
  446. Msg string `description:"用户提示信息"`
  447. ErrMsg string `description:"错误信息,内部查看"`
  448. }
  449. // BatchEdbInfoCalculateBatchSaveSuccessResp 添加成功的指标信息
  450. type BatchEdbInfoCalculateBatchSaveSuccessResp struct {
  451. ClassifyId int `description:"分类id"`
  452. CalculateId string `description:"当前请求时,单个计算的唯一标识"`
  453. EdbInfoId int `description:"指标ID"`
  454. UniqueCode string `description:"指标唯一编码"`
  455. }
  456. // CalculateMultiSearchReq 批量计算模块下的指标搜索
  457. type CalculateMultiChoiceReq struct {
  458. ClassifyIds string `description:"分类ID, 用英文逗号拼接"`
  459. Frequency string `description:"频度"`
  460. SysUserIds string `description:"创建人ID,用英文逗号拼接"`
  461. Keyword string `description:"关键字"`
  462. SelectAll bool `description:"是否全选"`
  463. EdbInfoIds string `description:"指标Id, 用英文逗号拼接"`
  464. }
  465. type CalculateMultiChoiceResp struct {
  466. SearchItem []EdbInfoBase `description:"查询结果"`
  467. }
  468. type CalculateMultiEdbSearchResp struct {
  469. SearchItem []CalculateMultiEdbSearchItem `description:"查询结果"`
  470. Paging *paging.PagingItem
  471. }
  472. type CalculateMultiEdbSearchItem struct {
  473. EdbInfoId int `description:"指标id"`
  474. EdbName string `description:"指标名称"`
  475. EdbNameEn string `description:"英文指标名称"`
  476. Frequency string `description:"频度"`
  477. Unit string `description:"单位"`
  478. UnitEn string `description:"英文单位"`
  479. ClassifyId int `description:"分类id"`
  480. SysUserId int
  481. SysUserRealName string
  482. EndValue float64 `description:"数据的最新值(预测日期的最新值)"`
  483. EndDate string `description:"终止日期"`
  484. HaveOperaAuth bool `description:"是否有数据权限,默认:false"`
  485. }