|
@@ -1140,7 +1140,7 @@ func AddStaticPredictEdbInfo(sourceEdbInfoId, classifyId int, edbName, frequency
|
|
|
//EdbInfoId: 0,
|
|
|
EdbInfoType: sourceEdbInfo.EdbInfoType,
|
|
|
SourceName: sourceEdbInfo.SourceName,
|
|
|
- Source: utils.DATA_SOURCE_PREDICT_STATIC,
|
|
|
+ Source: sourceEdbInfo.Source,
|
|
|
EdbCode: edbCode,
|
|
|
EdbName: edbName,
|
|
|
EdbNameSource: edbName,
|
|
@@ -1158,7 +1158,7 @@ func AddStaticPredictEdbInfo(sourceEdbInfoId, classifyId int, edbName, frequency
|
|
|
MaxValue: sourceEdbInfo.MaxValue,
|
|
|
EndValue: sourceEdbInfo.EndValue,
|
|
|
CalculateFormula: sourceEdbInfo.CalculateFormula,
|
|
|
- EdbType: 2,
|
|
|
+ EdbType: sourceEdbInfo.EdbType,
|
|
|
//Sort: sourceEdbInfo.,
|
|
|
LatestDate: sourceEdbInfo.LatestDate,
|
|
|
LatestValue: sourceEdbInfo.LatestValue,
|
|
@@ -1197,8 +1197,37 @@ func AddStaticPredictEdbInfo(sourceEdbInfoId, classifyId int, edbName, frequency
|
|
|
}
|
|
|
fromEdbMap[sourceEdbInfoId] = sourceEdbInfoId
|
|
|
calculateMappingList = append(calculateMappingList, calculateMappingItem)
|
|
|
+ newPredictEdbConfList := make([]*models.PredictEdbConf, 0)
|
|
|
+ //查询原先的预测指标配置项
|
|
|
+ if sourceEdbInfo.EdbType == 1 {
|
|
|
+ // 查找该预测指标配置
|
|
|
+ predictEdbConfList, tmpErr := models.GetPredictEdbConfListById(sourceEdbInfo.EdbInfoId)
|
|
|
+ if tmpErr != nil && tmpErr.Error() != utils.ErrNoRow() {
|
|
|
+ errMsg = "获取预测指标配置信息失败"
|
|
|
+ err = errors.New("获取预测指标配置信息失败,Err:" + tmpErr.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(predictEdbConfList) > 0 {
|
|
|
+ // 遍历
|
|
|
+ for _, v := range predictEdbConfList {
|
|
|
+ tmpPredictEdbConf := &models.PredictEdbConf{
|
|
|
+ PredictEdbInfoId: 0,
|
|
|
+ SourceEdbInfoId: sourceEdbInfoId,
|
|
|
+ RuleType: v.RuleType,
|
|
|
+ FixedValue: v.FixedValue,
|
|
|
+ Value: v.Value,
|
|
|
+ EmptyType: v.EmptyType,
|
|
|
+ MaxEmptyType: v.MaxEmptyType,
|
|
|
+ EndDate: v.EndDate,
|
|
|
+ ModifyTime: time.Now(),
|
|
|
+ CreateTime: time.Now(),
|
|
|
+ }
|
|
|
+ newPredictEdbConfList = append(newPredictEdbConfList, tmpPredictEdbConf)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- err, errMsg = models.AddPredictStaticEdb(edbInfo, sourceEdbInfo, calculateMappingList)
|
|
|
+ err, errMsg = models.AddPredictStaticEdb(edbInfo, sourceEdbInfo, calculateMappingList, newPredictEdbConfList)
|
|
|
|
|
|
return
|
|
|
}
|