|
@@ -714,7 +714,7 @@ func DisableEdbRefresh(cont context.Context) (err error) {
|
|
|
pageNum := (int(totalCount) + 99) / pageSize // 使用整数除法,并添加一页以防有余数
|
|
|
stopRefreshIds := make([]int, 0)
|
|
|
stopRefreshMysteelCode := make([]string, 0)
|
|
|
- edbInfoList := make([]*data_manage.EdbInfo, 0)
|
|
|
+ fromEdbIdList := make([]int, 0)
|
|
|
for i := 0; i < pageNum; i++ {
|
|
|
start := i * pageSize
|
|
|
edbItems, e := data_manage.GetEdbInfoPageByCondition(condition, pars, start, pageSize)
|
|
@@ -726,11 +726,9 @@ func DisableEdbRefresh(cont context.Context) (err error) {
|
|
|
continue
|
|
|
}
|
|
|
edbInfoIds := make([]int, 0)
|
|
|
- edbInfoList = make([]*data_manage.EdbInfo, 0)
|
|
|
- edbInfoMap := make(map[int]*data_manage.EdbInfo, 0)
|
|
|
+ fromEdbIdList = make([]int, 0)
|
|
|
for _, item := range edbItems {
|
|
|
edbInfoIds = append(edbInfoIds, item.EdbInfoId)
|
|
|
- edbInfoMap[item.EdbInfoId] = item
|
|
|
}
|
|
|
// 查询指标库里这些指标 引用情况
|
|
|
relationList, e := data_manage.GetEdbInfoRelationByEdbInfoIds(edbInfoIds)
|
|
@@ -744,36 +742,24 @@ func DisableEdbRefresh(cont context.Context) (err error) {
|
|
|
}
|
|
|
for _, item := range edbItems {
|
|
|
if _, ok := edbMap[item.EdbInfoId]; !ok {
|
|
|
- edbInfo, ok1 := edbInfoMap[item.EdbInfoId]
|
|
|
- if ok1 {
|
|
|
- edbInfoList = append(edbInfoList, edbInfo)
|
|
|
- }
|
|
|
stopRefreshIds = append(stopRefreshIds, item.EdbInfoId)
|
|
|
if item.Source == utils.DATA_SOURCE_MYSTEEL_CHEMICAL {
|
|
|
stopRefreshMysteelCode = append(stopRefreshMysteelCode, item.EdbCode)
|
|
|
}
|
|
|
+ if item.EdbInfoType == 0 && item.EdbType == 1 {
|
|
|
+ fromEdbIdList = append(fromEdbIdList, item.EdbInfoId)
|
|
|
+ }
|
|
|
// 更新指标禁止刷新状态
|
|
|
if len(stopRefreshIds) > 100 {
|
|
|
// 查询相关的计算指标
|
|
|
calculateEdbIdList := make([]int, 0)
|
|
|
- if len(edbInfoList) > 0 {
|
|
|
- calculateEdbMappingListMap, calculateEdbMappingIdsMap, e1 := GetEdbListByEdbInfoId(edbInfoList)
|
|
|
- if e1 != nil {
|
|
|
- err = fmt.Errorf("查询计算指标信息失败, Err" + e1.Error())
|
|
|
+ if len(fromEdbIdList) > 0 {
|
|
|
+ hasFind := make(map[int]struct{})
|
|
|
+ calculateEdbIdList, err = GetCalculateEdbByFromEdbInfo(fromEdbIdList, calculateEdbIdList, hasFind)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("查询计算指标信息失败:%v", err)
|
|
|
return
|
|
|
}
|
|
|
- for _, v := range edbInfoList {
|
|
|
- childEdbMappingIds, ok2 := calculateEdbMappingIdsMap[v.EdbInfoId]
|
|
|
- if ok2 {
|
|
|
- for _, childEdbMappingId := range childEdbMappingIds {
|
|
|
- childEdbMapping, ok3 := calculateEdbMappingListMap[childEdbMappingId]
|
|
|
- if !ok3 {
|
|
|
- continue
|
|
|
- }
|
|
|
- calculateEdbIdList = append(calculateEdbIdList, childEdbMapping.EdbInfoId)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
err = data_manage.ModifyEdbUpdateStatus(stopRefreshIds, stopRefreshMysteelCode, calculateEdbIdList)
|
|
|
if err != nil {
|
|
@@ -791,24 +777,13 @@ func DisableEdbRefresh(cont context.Context) (err error) {
|
|
|
if len(stopRefreshIds) > 0 {
|
|
|
// 查询相关的计算指标
|
|
|
calculateEdbIdList := make([]int, 0)
|
|
|
- if len(edbInfoList) > 0 {
|
|
|
- calculateEdbMappingListMap, calculateEdbMappingIdsMap, e1 := GetEdbListByEdbInfoId(edbInfoList)
|
|
|
- if e1 != nil {
|
|
|
- err = fmt.Errorf("查询计算指标信息失败, Err" + e1.Error())
|
|
|
+ if len(fromEdbIdList) > 0 {
|
|
|
+ hasFind := make(map[int]struct{})
|
|
|
+ calculateEdbIdList, err = GetCalculateEdbByFromEdbInfo(fromEdbIdList, calculateEdbIdList, hasFind)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("查询计算指标信息失败:%v", err)
|
|
|
return
|
|
|
}
|
|
|
- for _, v := range edbInfoList {
|
|
|
- childEdbMappingIds, ok2 := calculateEdbMappingIdsMap[v.EdbInfoId]
|
|
|
- if ok2 {
|
|
|
- for _, childEdbMappingId := range childEdbMappingIds {
|
|
|
- childEdbMapping, ok3 := calculateEdbMappingListMap[childEdbMappingId]
|
|
|
- if !ok3 {
|
|
|
- continue
|
|
|
- }
|
|
|
- calculateEdbIdList = append(calculateEdbIdList, childEdbMapping.EdbInfoId)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
err = data_manage.ModifyEdbUpdateStatus(stopRefreshIds, stopRefreshMysteelCode, calculateEdbIdList)
|
|
|
if err != nil {
|