Pārlūkot izejas kodu

Merge branch 'feature/pool253_edb_relation' into debug

xyxie 6 mēneši atpakaļ
vecāks
revīzija
e07dd2dc0d

+ 8 - 0
controllers/data_manage/predict_edb_info.go

@@ -479,6 +479,10 @@ func (this *PredictEdbInfoController) Add() {
 	}
 	resp := respItem.Data
 
+	edbInfoIdArr := make([]int, 0)
+	edbInfoIdArr = append(edbInfoIdArr, sourceEdbInfoId)
+	// 添加指标引用记录
+	_ = data.SavePredictEdbInfoRelation(edbInfoIdArr, resp.EdbInfoId)
 	//添加es
 	data.AddOrEditEdbInfoToEs(resp.EdbInfoId)
 
@@ -681,6 +685,10 @@ func (this *PredictEdbInfoController) Edit() {
 	}
 	resp := respItem.Data
 
+	edbInfoIdArr := make([]int, 0)
+	edbInfoIdArr = append(edbInfoIdArr, req.SourceEdbInfoId)
+	// 添加指标引用记录
+	_ = data.SavePredictEdbInfoRelation(edbInfoIdArr, resp.EdbInfoId)
 	//修改es
 	data.AddOrEditEdbInfoToEs(resp.EdbInfoId)
 

+ 7 - 0
services/data/edb_info_relation.go

@@ -660,6 +660,13 @@ func SaveExcelEdbInfoRelation(excelInfoId, source int, addChildExcel bool) (err
 	return
 }
 
+// SavePredictEdbInfoRelation 添加/编辑预测指标引用关联记录
+func SavePredictEdbInfoRelation(edbInfoIds []int, edbInfoId int) (err error) {
+	//更新指标刷新状态为启用
+	err = saveEdbInfoRelation(edbInfoIds, edbInfoId, utils.EDB_RELATION_PREDIT_EDB, 0)
+	return
+}
+
 // GetCalculateEdbByFromEdbInfo 找到依赖于该基础指标的所有计算指标
 func GetCalculateEdbByFromEdbInfo(edbInfoIds []int, calculateEdbIds []int, hasFind map[int]struct{}) (newCalculateEdbIds []int, err error) {
 	if len(edbInfoIds) == 0 {

+ 5 - 4
utils/constants.go

@@ -461,10 +461,11 @@ const (
 
 // 指标引用对象
 const (
-	EDB_RELATION_CHART    = 1 // 图表
-	EDB_RELATION_SANDBOX  = 2 // ETA逻辑
-	EDB_RELATION_CALENDAR = 3 // 事件日历
-	EDB_RELATION_TABLE    = 4 // 表格
+	EDB_RELATION_CHART      = 1 // 图表
+	EDB_RELATION_SANDBOX    = 2 // ETA逻辑
+	EDB_RELATION_CALENDAR   = 3 // 事件日历
+	EDB_RELATION_TABLE      = 4 // 表格
+	EDB_RELATION_PREDIT_EDB = 5 // 预测指标
 )
 
 // 指标计算方式