|
@@ -527,7 +527,7 @@ func (c *EdbInfoController) SaveEdbRefreshStatus() {
|
|
|
//查询计算指标信息
|
|
|
calculateEdbIdList := make([]int, 0)
|
|
|
if isStop == 1 {
|
|
|
- edbInfoList := make([]*data_manage.EdbInfo, 0)
|
|
|
+ fromEdbIdList := make([]int, 0)
|
|
|
edbList, e := data_manage.GetEdbInfoByIdList(edbIdList)
|
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "获取失败"
|
|
@@ -535,29 +535,18 @@ func (c *EdbInfoController) SaveEdbRefreshStatus() {
|
|
|
return
|
|
|
}
|
|
|
for _, v := range edbList {
|
|
|
- if v.EdbInfoType == 0 && v.EdbType == 2 {
|
|
|
- edbInfoList = append(edbInfoList, v)
|
|
|
+ if v.EdbInfoType == 0 && v.EdbType == 1 {
|
|
|
+ fromEdbIdList = append(fromEdbIdList, v.EdbInfoId)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- calculateEdbMappingListMap, calculateEdbMappingIdsMap, e := data.GetEdbListByEdbInfoId(edbInfoList)
|
|
|
- if e != nil {
|
|
|
+ hasFind := make(map[int]struct{})
|
|
|
+ calculateEdbIdList, err = data.GetCalculateEdbByFromEdbInfo(fromEdbIdList, calculateEdbIdList, hasFind)
|
|
|
+ if err != nil {
|
|
|
br.Msg = "查询计算指标信息失败"
|
|
|
- br.ErrMsg = "查询计算指标信息失败, Err" + e.Error()
|
|
|
+ br.ErrMsg = "查询计算指标信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- for _, v := range edbInfoList {
|
|
|
- childEdbMappingIds, ok := calculateEdbMappingIdsMap[v.EdbInfoId]
|
|
|
- if ok {
|
|
|
- for _, childEdbMappingId := range childEdbMappingIds {
|
|
|
- childEdbMapping, ok2 := calculateEdbMappingListMap[childEdbMappingId]
|
|
|
- if !ok2 {
|
|
|
- continue
|
|
|
- }
|
|
|
- calculateEdbIdList = append(calculateEdbIdList, childEdbMapping.EdbInfoId)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
switch req.Source {
|
|
@@ -627,25 +616,13 @@ func (c *EdbInfoController) SaveEdbRefreshStatusSingle() {
|
|
|
}
|
|
|
|
|
|
if isStop == 1 && edbInfo.EdbInfoType == 0 && edbInfo.EdbType == 1 { //基础指标, 只有在停用的情况下才需要查询计算指标
|
|
|
- // 查询相关的计算指标
|
|
|
- // 查询间接引用的指标信息
|
|
|
- edbInfoList := make([]*data_manage.EdbInfo, 0)
|
|
|
- edbInfoList = append(edbInfoList, edbInfo)
|
|
|
- calculateEdbMappingListMap, calculateEdbMappingIdsMap, e := data.GetEdbListByEdbInfoId(edbInfoList)
|
|
|
- if e != nil {
|
|
|
- err = fmt.Errorf("查询计算指标信息失败,%s", e.Error())
|
|
|
+ hasFind := make(map[int]struct{})
|
|
|
+ calculateEdbIdList, err = data.GetCalculateEdbByFromEdbInfo([]int{edbInfo.EdbInfoId}, calculateEdbIdList, hasFind)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询计算指标信息失败"
|
|
|
+ br.ErrMsg = "查询计算指标信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- childEdbMappingIds, ok := calculateEdbMappingIdsMap[edbInfo.EdbInfoId]
|
|
|
- if ok {
|
|
|
- for _, childEdbMappingId := range childEdbMappingIds {
|
|
|
- childEdbMapping, ok2 := calculateEdbMappingListMap[childEdbMappingId]
|
|
|
- if !ok2 {
|
|
|
- continue
|
|
|
- }
|
|
|
- calculateEdbIdList = append(calculateEdbIdList, childEdbMapping.EdbInfoId)
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
switch edbInfo.Source {
|
|
@@ -706,7 +683,6 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
|
|
|
// todo 批量设置刷新状态修改
|
|
|
edbIdList := make([]int, 0)
|
|
|
edbCodeList := make([]string, 0)
|
|
|
- edbInfoList := make([]*data_manage.EdbInfo, 0)
|
|
|
// 指标id列表
|
|
|
if req.IsSelectAll {
|
|
|
// 如果是列表全选
|
|
@@ -749,12 +725,13 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
|
|
|
br.ErrMsg = "获取数据失败,Err:" + e.Error()
|
|
|
return
|
|
|
}
|
|
|
+ fromEdbIdList := make([]int, 0)
|
|
|
for _, v := range edbList {
|
|
|
if req.Source == utils.DATA_SOURCE_MYSTEEL_CHEMICAL {
|
|
|
edbCodeList = append(edbCodeList, v.EdbCode)
|
|
|
}
|
|
|
- if v.EdbInfoType == 0 && v.EdbType == 2 {
|
|
|
- edbInfoList = append(edbInfoList, v)
|
|
|
+ if v.EdbInfoType == 0 && v.EdbType == 1 {
|
|
|
+ fromEdbIdList = append(fromEdbIdList, v.EdbInfoId)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -767,24 +744,13 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
|
|
|
// 查询相关的计算指标
|
|
|
calculateEdbIdList := make([]int, 0)
|
|
|
if isStop == 1 {
|
|
|
- calculateEdbMappingListMap, calculateEdbMappingIdsMap, e := data.GetEdbListByEdbInfoId(edbInfoList)
|
|
|
- if e != nil {
|
|
|
+ hasFind := make(map[int]struct{})
|
|
|
+ calculateEdbIdList, err = data.GetCalculateEdbByFromEdbInfo(fromEdbIdList, calculateEdbIdList, hasFind)
|
|
|
+ if err != nil {
|
|
|
br.Msg = "查询计算指标信息失败"
|
|
|
- br.ErrMsg = "查询计算指标信息失败, Err" + e.Error()
|
|
|
+ br.ErrMsg = "查询计算指标信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- for _, v := range edbInfoList {
|
|
|
- childEdbMappingIds, ok := calculateEdbMappingIdsMap[v.EdbInfoId]
|
|
|
- if ok {
|
|
|
- for _, childEdbMappingId := range childEdbMappingIds {
|
|
|
- childEdbMapping, ok2 := calculateEdbMappingListMap[childEdbMappingId]
|
|
|
- if !ok2 {
|
|
|
- continue
|
|
|
- }
|
|
|
- calculateEdbIdList = append(calculateEdbIdList, childEdbMapping.EdbInfoId)
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
switch req.Source {
|
|
@@ -792,7 +758,6 @@ func (c *EdbInfoController) SaveRelationEdbRefreshStatus() {
|
|
|
err = data_manage.ModifyMysteelChemicalUpdateStatusByEdbInfoIds(edbIdList, isStop, edbCodeList, calculateEdbIdList)
|
|
|
default:
|
|
|
err = data_manage.EdbInfoUpdateStatusByEdbInfoId(edbIdList, isStop, calculateEdbIdList)
|
|
|
- return
|
|
|
}
|
|
|
if err != nil {
|
|
|
br.Msg = `保存失败`
|