edb_info_calculate.go 20 KB

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