edb_info_calculate.go 20 KB

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