edb_info_calculate.go 20 KB

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