edb_info_calculate.go 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. package data_manage
  2. import (
  3. "fmt"
  4. "github.com/beego/beego/v2/client/orm"
  5. "github.com/rdlucklib/rdluck_tools/paging"
  6. "strings"
  7. "time"
  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. EdbInfoType int `description:"指标类型: 0-普通指标; 1-预测指标"`
  154. }
  155. type CalculateEdbInfoItem struct {
  156. EdbInfoId int `description:"指标id"`
  157. EdbName string `description:"指标名称"`
  158. Frequency string `description:"频度"`
  159. Unit string `description:"单位"`
  160. ClassifyId int `description:"分类id"`
  161. CalculateId string `description:"当前请求时,单个计算的唯一标识"`
  162. FromEdbInfoId int `description:"计算来源指标id"`
  163. }
  164. type EdbInfoCalculateBatchSaveMultiReq struct {
  165. List []CalculateEdbInfoItem
  166. Formula string `description:"N值/移动天数"`
  167. FromEdbInfoId int `description:"计算来源指标id"`
  168. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:变频"`
  169. CalculateFormula string `description:"计算公式"`
  170. EdbInfoIdArr []EdbInfoFromTag `description:"指标信息"`
  171. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  172. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  173. Extra string `description:"指标的额外配置"`
  174. Calendar string `description:"公历/农历"`
  175. }
  176. type EdbInfoCalculateBatchSaveReq struct {
  177. EdbInfoId int `description:"指标id"`
  178. EdbName string `description:"指标名称"`
  179. Frequency string `description:"频度"`
  180. Unit string `description:"单位"`
  181. ClassifyId int `description:"分类id"`
  182. Formula string `description:"N值/移动天数"`
  183. FromEdbInfoId int `description:"计算来源指标id"`
  184. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:变频"`
  185. CalculateFormula string `description:"计算公式"`
  186. EdbInfoIdArr []EdbInfoFromTag `description:"指标信息"`
  187. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  188. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  189. Extra string `description:"指标的额外配置"`
  190. Calendar string `description:"公历/农历"`
  191. EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
  192. }
  193. type EdbInfoCalculateBatchEditReq struct {
  194. EdbName string `description:"指标名称"`
  195. Frequency string `description:"频度"`
  196. Unit string `description:"单位"`
  197. ClassifyId int `description:"分类id"`
  198. Formula string `description:"N值"`
  199. EdbInfoId int `description:"编辑指标id"`
  200. FromEdbInfoId int `description:"计算来源指标id"`
  201. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:变频"`
  202. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  203. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  204. Calendar string `description:"公历/农历"`
  205. Extra string `description:"指标的额外配置"`
  206. EdbInfoIdArr []EdbInfoFromTag
  207. EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
  208. }
  209. // EdbInfoCalculateBatchSaveReqByEdbLib edb指标库的请求逻辑
  210. type EdbInfoCalculateBatchSaveReqByEdbLib struct {
  211. AdminId int `description:"添加人id"`
  212. AdminName string `description:"添加人名称"`
  213. EdbInfoId int `description:"指标id"`
  214. EdbName string `description:"指标名称"`
  215. Frequency string `description:"频度"`
  216. Unit string `description:"单位"`
  217. ClassifyId int `description:"分类id"`
  218. Formula string `description:"N值/移动天数"`
  219. FromEdbInfoId int `description:"计算来源指标id"`
  220. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:变频"`
  221. CalculateFormula string `description:"计算公式"`
  222. EdbInfoIdArr []EdbInfoFromTag `description:"指标信息"`
  223. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  224. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  225. Calendar string `description:"公历/农历"`
  226. Data interface{} `description:"数据列"`
  227. EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
  228. MaxEmptyType int `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
  229. Extra string `description:"指标的额外配置"`
  230. }
  231. // EdbInfoCalculateBatchEditReqByEdbLib 编辑计算指标的请求参数
  232. type EdbInfoCalculateBatchEditReqByEdbLib struct {
  233. EdbName string `description:"指标名称"`
  234. Frequency string `description:"频度"`
  235. Unit string `description:"单位"`
  236. ClassifyId int `description:"分类id"`
  237. Formula string `description:"N值"`
  238. EdbInfoId int `description:"编辑指标id"`
  239. FromEdbInfoId int `description:"计算来源指标id"`
  240. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:变频"`
  241. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  242. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  243. Calendar string `description:"公历/农历"`
  244. EdbInfoIdArr []EdbInfoFromTag
  245. Data interface{} `description:"数据列"`
  246. Extra string `description:"指标的额外配置"`
  247. EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
  248. }
  249. func GetEdbInfoCalculateMap(edbInfoId, source int) (list []*EdbInfo, err error) {
  250. o := orm.NewOrmUsingDB("data")
  251. //calculateTableName := GetEdbInfoCalculateTableName(source)
  252. //sql := ` SELECT b.* FROM %s AS a
  253. // INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
  254. // WHERE a.edb_info_id=? ORDER BY sort ASC `
  255. //sql = fmt.Sprintf(sql, calculateTableName)
  256. sql := ` SELECT b.* FROM edb_info_calculate_mapping AS a
  257. INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
  258. WHERE a.edb_info_id=? ORDER BY sort ASC `
  259. _, err = o.Raw(sql, edbInfoId).QueryRows(&list)
  260. return
  261. }
  262. type CalculateItems struct {
  263. EdbInfoId int
  264. DataMap map[string]float64
  265. }
  266. func CheckFormula(formula string) map[string]string {
  267. mathFormula := []string{"MAX", "MIN", "ABS", "ACOS", "ASIN", "CEIL", "MOD", "POW", "ROUND", "SIGN", "SIN", "TAN", "LOG10", "LOG2", "LOG", "LN"}
  268. str := strings.ToUpper(formula)
  269. for _, v := range mathFormula {
  270. str = strings.Replace(str, v, "", -1)
  271. }
  272. str = strings.Replace(str, "(", "", -1)
  273. str = strings.Replace(str, ")", "", -1)
  274. byteMap := make(map[string]string)
  275. for i := 0; i < len(str); i++ {
  276. byteInt := str[i]
  277. if byteInt >= 65 && byteInt <= 90 {
  278. byteStr := string(byteInt)
  279. if _, ok := byteMap[byteStr]; !ok {
  280. byteMap[byteStr] = byteStr
  281. }
  282. }
  283. }
  284. return byteMap
  285. }
  286. func ReplaceFormula(edbInfoIdArr []*EdbInfo, valArr map[int]float64, formulaMap map[string]string, formulaStr string, edbInfoIdBytes []string) string {
  287. funMap := GetFormulaMap()
  288. for k, v := range funMap {
  289. formulaStr = strings.Replace(formulaStr, k, v, -1)
  290. }
  291. replaceCount := 0
  292. for dk, dv := range edbInfoIdArr {
  293. if dk == 0 {
  294. dKey := edbInfoIdBytes[dk]
  295. if _, ok := formulaMap[dKey]; ok { //公式中存在
  296. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  297. dvStr := fmt.Sprintf("%v", val)
  298. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  299. replaceCount++
  300. }
  301. }
  302. }
  303. if dk == 1 {
  304. dKey := edbInfoIdBytes[dk]
  305. if _, ok := formulaMap[dKey]; ok { //公式中存在
  306. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  307. dvStr := fmt.Sprintf("%v", val)
  308. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  309. replaceCount++
  310. }
  311. }
  312. }
  313. if dk == 2 {
  314. dKey := edbInfoIdBytes[dk]
  315. if _, ok := formulaMap[dKey]; ok { //公式中存在
  316. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  317. dvStr := fmt.Sprintf("%v", val)
  318. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  319. replaceCount++
  320. }
  321. }
  322. }
  323. if dk == 3 {
  324. dKey := edbInfoIdBytes[dk]
  325. if _, ok := formulaMap[dKey]; ok { //公式中存在
  326. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  327. dvStr := fmt.Sprintf("%v", val)
  328. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  329. replaceCount++
  330. }
  331. }
  332. }
  333. if dk == 4 {
  334. dKey := edbInfoIdBytes[dk]
  335. if _, ok := formulaMap[dKey]; ok { //公式中存在
  336. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  337. dvStr := fmt.Sprintf("%v", val)
  338. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  339. replaceCount++
  340. }
  341. }
  342. }
  343. if dk == 5 {
  344. dKey := edbInfoIdBytes[dk]
  345. if _, ok := formulaMap[dKey]; ok { //公式中存在
  346. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  347. dvStr := fmt.Sprintf("%v", val)
  348. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  349. replaceCount++
  350. }
  351. }
  352. }
  353. if dk == 6 {
  354. dKey := edbInfoIdBytes[dk]
  355. if _, ok := formulaMap[dKey]; ok { //公式中存在
  356. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  357. dvStr := fmt.Sprintf("%v", val)
  358. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  359. replaceCount++
  360. }
  361. }
  362. }
  363. if dk == 7 {
  364. dKey := edbInfoIdBytes[dk]
  365. if _, ok := formulaMap[dKey]; ok { //公式中存在
  366. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  367. dvStr := fmt.Sprintf("%v", val)
  368. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  369. replaceCount++
  370. }
  371. }
  372. }
  373. if dk == 8 {
  374. dKey := edbInfoIdBytes[dk]
  375. if _, ok := formulaMap[dKey]; ok { //公式中存在
  376. if val, valOk := valArr[dv.EdbInfoId]; valOk { //值存在
  377. dvStr := fmt.Sprintf("%v", val)
  378. formulaStr = strings.Replace(formulaStr, dKey, dvStr, -1)
  379. replaceCount++
  380. }
  381. }
  382. }
  383. }
  384. for k, v := range funMap {
  385. formulaStr = strings.Replace(formulaStr, v, k, -1)
  386. }
  387. if replaceCount == len(formulaMap) {
  388. return formulaStr
  389. } else {
  390. return ""
  391. }
  392. }
  393. func GetFormulaMap() map[string]string {
  394. funMap := make(map[string]string)
  395. funMap["MAX"] = "[@@]"
  396. funMap["MIN"] = "[@!]"
  397. funMap["ABS"] = "[@#]"
  398. funMap["CEIL"] = "[@$]"
  399. funMap["COS"] = "[@%]"
  400. funMap["FLOOR"] = "[@^]"
  401. funMap["MOD"] = "[@&]"
  402. funMap["POW"] = "[@*]"
  403. funMap["ROUND"] = "[@(]"
  404. return funMap
  405. }
  406. // SaveAdjustEdbInfoReq 保存数据调整请求参数(请求指标服务)
  407. type SaveAdjustEdbInfoReq struct {
  408. AdminId int `description:"添加人id"`
  409. AdminName string `description:"添加人名称"`
  410. EdbInfoId int `description:"指标id"`
  411. FromEdbInfoId int `description:"来源指标id"`
  412. EdbName string `description:"指标名称"`
  413. Frequency string `description:"频度"`
  414. Unit string `description:"单位"`
  415. ClassifyId int `description:"分类id"`
  416. DataList []SaveAdjustEdbDataReq `description:"指标对应的数据值"`
  417. }
  418. // SaveAdjustEdbDataReq 保存数据调整请求的数据的参数
  419. type SaveAdjustEdbDataReq struct {
  420. Date string `description:"数据日期"`
  421. Value float64 `description:"数据值"`
  422. }
  423. // BatchEdbInfoCalculateBatchSaveReq 批量添加 计算指标
  424. type BatchEdbInfoCalculateBatchSaveReq struct {
  425. AdminId int `description:"添加人id"`
  426. AdminName string `description:"添加人名称"`
  427. EdbList []*CalculateEdbInfoItem //需要批量计算的指标列表
  428. Formula string `description:"N值/移动天数"`
  429. Source int `description:"来源:1:同花顺,2:wind,3:彭博,4:指标运算,5:累计值转月,6:同比值,7:同差值,8:N数值移动平均计算,12:环比值,13:环差值,14:升频"`
  430. CalculateFormula string `description:"计算公式"`
  431. EdbInfoIdArr []EdbInfoFromTag `description:"关联指标列表"`
  432. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  433. MoveFrequency string `description:"移动频度:天/周/月/季/年"`
  434. Calendar string `description:"公历/农历"`
  435. Data interface{} `description:"数据"`
  436. EmptyType int `description:"空值处理类型(0查找前后35天,1不计算,2前值填充,3后值填充,4等于0)"`
  437. MaxEmptyType int `description:"MAX、MIN公式空值处理类型(1、等于0;2、跳过空值)"`
  438. Extra string `description:"指标的额外配置"`
  439. }
  440. // BatchEdbInfoCalculateBatchSaveResp 批量添加 计算指标 返回数据
  441. type BatchEdbInfoCalculateBatchSaveResp struct {
  442. Fail []BatchEdbInfoCalculateBatchSaveFailResp `description:"添加失败的指标"`
  443. Success []BatchEdbInfoCalculateBatchSaveSuccessResp `description:"添加成功的指标"`
  444. }
  445. // BatchEdbInfoCalculateBatchSaveFailResp 添加失败的指标信息
  446. type BatchEdbInfoCalculateBatchSaveFailResp struct {
  447. CalculateId string `description:"当前请求时,单个计算的唯一标识"`
  448. Msg string `description:"用户提示信息"`
  449. ErrMsg string `description:"错误信息,内部查看"`
  450. }
  451. // BatchEdbInfoCalculateBatchSaveSuccessResp 添加成功的指标信息
  452. type BatchEdbInfoCalculateBatchSaveSuccessResp struct {
  453. ClassifyId int `description:"分类id"`
  454. CalculateId string `description:"当前请求时,单个计算的唯一标识"`
  455. EdbInfoId int `description:"指标ID"`
  456. UniqueCode string `description:"指标唯一编码"`
  457. }
  458. // CalculateMultiSearchReq 批量计算模块下的指标搜索
  459. type CalculateMultiChoiceReq struct {
  460. ClassifyIds string `description:"分类ID, 用英文逗号拼接"`
  461. Frequency string `description:"频度"`
  462. SysUserIds string `description:"创建人ID,用英文逗号拼接"`
  463. Keyword string `description:"关键字"`
  464. SelectAll bool `description:"是否全选"`
  465. EdbInfoIds string `description:"指标Id, 用英文逗号拼接"`
  466. }
  467. type CalculateMultiChoiceResp struct {
  468. SearchItem []EdbInfoBase `description:"查询结果"`
  469. }
  470. type CalculateMultiEdbSearchResp struct {
  471. SearchItem []CalculateMultiEdbSearchItem `description:"查询结果"`
  472. Paging *paging.PagingItem
  473. }
  474. type CalculateMultiEdbSearchItem struct {
  475. EdbInfoId int `description:"指标id"`
  476. EdbName string `description:"指标名称"`
  477. EdbNameEn string `description:"英文指标名称"`
  478. Frequency string `description:"频度"`
  479. Unit string `description:"单位"`
  480. UnitEn string `description:"英文单位"`
  481. ClassifyId int `description:"分类id"`
  482. SysUserId int
  483. SysUserRealName string
  484. EndValue float64 `description:"数据的最新值(预测日期的最新值)"`
  485. EndDate string `description:"终止日期"`
  486. HaveOperaAuth bool `description:"是否有数据权限,默认:false"`
  487. EdbInfoType int `description:"指标类型: 0-普通指标; 1-预测指标"`
  488. }
  489. // BaseStepCalculateReq 指标库-基础分步骤计算请求
  490. type BaseStepCalculateReq struct {
  491. DataList []*EdbInfoSearchData
  492. Calculates []FactorEdbSeriesCalculatePars
  493. }