|
@@ -17,7 +17,7 @@ import (
|
|
|
)
|
|
|
|
|
|
// EdbInfoRefreshAllFromBaseV2 全部刷新指标(切换到edb_lib服务)
|
|
|
-func EdbInfoRefreshAllFromBaseV2(edbInfoId int, refreshAll bool) (err error, isAsync bool) {
|
|
|
+func EdbInfoRefreshAllFromBaseV2(edbInfoId int, refreshAll, isRefreshTop bool) (err error, isAsync bool) {
|
|
|
var errmsg string
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
@@ -27,7 +27,7 @@ func EdbInfoRefreshAllFromBaseV2(edbInfoId int, refreshAll bool) (err error, isA
|
|
|
}
|
|
|
}()
|
|
|
|
|
|
- err, isAsync = EdbInfoRefreshAllFromBaseV3([]int{edbInfoId}, refreshAll, false)
|
|
|
+ err, isAsync = EdbInfoRefreshAllFromBaseV3([]int{edbInfoId}, refreshAll, false, isRefreshTop)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -74,9 +74,10 @@ func EdbInfoRefreshAllFromBaseV3Bak(edbInfoIdList []int, refreshAll, isSync bool
|
|
|
// @param edbInfoIdList []int
|
|
|
// @param refreshAll bool
|
|
|
// @param isSync bool 是否同步执行
|
|
|
+// @param isRefreshTop bool 是否刷新上面的指标
|
|
|
// @return err error
|
|
|
// @return isAsync bool 是否异步刷新
|
|
|
-func EdbInfoRefreshAllFromBaseV3(edbInfoIdList []int, refreshAll, isSync bool) (err error, isAsync bool) {
|
|
|
+func EdbInfoRefreshAllFromBaseV3(edbInfoIdList []int, refreshAll, isSync, isRefreshTop bool) (err error, isAsync bool) {
|
|
|
var errmsg string
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
@@ -85,8 +86,18 @@ func EdbInfoRefreshAllFromBaseV3(edbInfoIdList []int, refreshAll, isSync bool) (
|
|
|
}
|
|
|
}()
|
|
|
|
|
|
- // 获取需要刷新的指标列表
|
|
|
- newBaseEdbInfoArr, newBasePredictEdbInfoArr, newCalculateMap, newPredictCalculateMap, calculateArr, predictCalculateArr := getEdbInfoIdList(edbInfoIdList)
|
|
|
+ var newBaseEdbInfoArr, newBasePredictEdbInfoArr []*data_manage.EdbInfo
|
|
|
+ var newCalculateMap, newPredictCalculateMap map[int]*data_manage.EdbInfo
|
|
|
+ var calculateArr, predictCalculateArr []int
|
|
|
+
|
|
|
+ // 获取关联指标
|
|
|
+ if isRefreshTop {
|
|
|
+ // 获取所有关联的指标,上下所有的指标
|
|
|
+ newBaseEdbInfoArr, newBasePredictEdbInfoArr, newCalculateMap, newPredictCalculateMap, calculateArr, predictCalculateArr, err, errmsg = getRefreshEdbInfoListByIds(edbInfoIdList)
|
|
|
+ } else {
|
|
|
+ // 获取溯源的指标
|
|
|
+ newBaseEdbInfoArr, newBasePredictEdbInfoArr, newCalculateMap, newPredictCalculateMap, calculateArr, predictCalculateArr = getEdbInfoIdList(edbInfoIdList)
|
|
|
+ }
|
|
|
|
|
|
// 需要刷新的指标数量
|
|
|
totalEdbInfo := len(newBaseEdbInfoArr) + len(calculateArr) + len(predictCalculateArr)
|
|
@@ -114,6 +125,7 @@ func EdbInfoRefreshAllFromBaseV3(edbInfoIdList []int, refreshAll, isSync bool) (
|
|
|
// @return predictCalculateArr []int
|
|
|
func getEdbInfoIdList(edbInfoIdList []int) (newBaseEdbInfoArr, newBasePredictEdbInfoArr []*data_manage.EdbInfo, newCalculateMap, newPredictCalculateMap map[int]*data_manage.EdbInfo, calculateArr, predictCalculateArr []int) {
|
|
|
traceEdbInfoList, err := TraceEdbInfoByEdbInfoIdList(edbInfoIdList)
|
|
|
+
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -1182,7 +1194,7 @@ func RefreshManualData(edbCode string) {
|
|
|
return
|
|
|
}
|
|
|
// 刷新指标库
|
|
|
- err, _ = EdbInfoRefreshAllFromBaseV2(edbInfo.EdbInfoId, true)
|
|
|
+ err, _ = EdbInfoRefreshAllFromBaseV2(edbInfo.EdbInfoId, true, true)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -2841,7 +2853,7 @@ func EdbInfoReplace(oldEdbInfo, newEdbInfo *data_manage.EdbInfo, sysAdminId int,
|
|
|
}
|
|
|
|
|
|
// 更新所有的关联指标
|
|
|
- err, _ = EdbInfoRefreshAllFromBaseV3(relationEdbInfoIdList, true, true)
|
|
|
+ err, _ = EdbInfoRefreshAllFromBaseV3(relationEdbInfoIdList, true, true, true)
|
|
|
return
|
|
|
}
|
|
|
|