|
@@ -483,10 +483,23 @@ func AddPredictEdbInfo(sourceEdbInfoId, classifyId int, edbName, dataDateType st
|
|
|
|
|
|
predictEdbConfList = append(predictEdbConfList, tmpPredictEdbConf)
|
|
|
}
|
|
|
+ //calculateMappingList是映射关系,只需要记录一条,因此对list需要去重复
|
|
|
+ calculateMappingList = RemoveDuplicateCalculateMappingList(calculateMappingList)
|
|
|
err, errMsg = models.AddPredictEdb(edbInfo, calculateMappingList, predictEdbConfList, calculateRuleMap)
|
|
|
|
|
|
return
|
|
|
}
|
|
|
+func RemoveDuplicateCalculateMappingList(list []*models.EdbInfoCalculateMapping) (newList []*models.EdbInfoCalculateMapping) {
|
|
|
+ newList = make([]*models.EdbInfoCalculateMapping, 0)
|
|
|
+ tmpMap := make(map[int]bool)
|
|
|
+ for _, v := range list {
|
|
|
+ if _, ok := tmpMap[v.FromEdbInfoId]; !ok {
|
|
|
+ tmpMap[v.FromEdbInfoId] = true
|
|
|
+ newList = append(newList, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
|
|
|
// EditPredictEdbInfo 编辑预测指标
|
|
|
func EditPredictEdbInfo(edbInfoId, classifyId int, edbName, dataDateType string, endDateType int, ruleList []models.RuleConfig, minValue, maxValue float64, lang string) (edbInfo *models.EdbInfo, err error, errMsg string) {
|
|
@@ -956,7 +969,8 @@ func EditPredictEdbInfo(edbInfoId, classifyId int, edbName, dataDateType string,
|
|
|
|
|
|
predictEdbConfList = append(predictEdbConfList, tmpPredictEdbConf)
|
|
|
}
|
|
|
-
|
|
|
+ //编辑的时候也需要去重复calcuateMappingList
|
|
|
+ calculateMappingList = RemoveDuplicateCalculateMappingList(calculateMappingList)
|
|
|
err, errMsg = models.EditPredictEdb(edbInfo, updateEdbInfoCol, calculateMappingList, predictEdbConfList, calculateRuleMap)
|
|
|
|
|
|
return
|