Browse Source

兼容年度值

xyxie 6 months ago
parent
commit
2d0d621d1c

+ 20 - 0
controllers/data_manage/predict_edb_info.go

@@ -868,6 +868,26 @@ func (this *PredictEdbInfoController) Detail() {
 			if len(tmpPredictEdbConfCalculateMappingDetail) <= 0 {
 				tmpPredictEdbConfCalculateMappingDetail = make([]*data_manage.PredictEdbConfCalculateMappingDetail, 0)
 			}
+			if v.RuleType == 16 {
+				if !strings.Contains(v.Value, "YearList") {
+					// 解析json串,加入YearList字段重新生成json字符串
+					var tmpValue *data.AnnualValueInversionConf
+					err = json.Unmarshal([]byte(v.Value), &tmpValue)
+					if err != nil {
+						br.Msg = "获取失败"
+						br.ErrMsg = "获取预测指标配置与关联指标信息失败,Err:" + err.Error()
+						return
+					}
+					tmpValue.YearList = append(tmpValue.YearList, tmpValue.Year)
+					tmpValueByte, err := json.Marshal(tmpValue)
+					if err != nil {
+						br.Msg = "获取失败"
+						br.ErrMsg = "获取预测指标配置与关联指标信息失败,Err:" + err.Error()
+						return
+					}
+					v.Value = string(tmpValueByte)
+				}
+			}
 			tmp := data_manage.PredictEdbConfDetail{
 				ConfigId:         v.ConfigId,
 				PredictEdbInfoId: v.PredictEdbInfoId,

+ 4 - 3
services/data/predict_edb_info_rule.go

@@ -1525,9 +1525,10 @@ func GetChartPredictEdbInfoDataListByRuleNAnnualAverage(edbInfoId int, configVal
 
 // AnnualValueInversionConf 年度值倒推规则
 type AnnualValueInversionConf struct {
-	Value float64 `description:"年度值"`
-	Type  int     `description:"分配方式,1:均值法;2:同比法"`
-	Year  int     `description:"同比年份"`
+	Value    float64 `description:"年度值"`
+	Type     int     `description:"分配方式,1:均值法;2:同比法"`
+	Year     int     `description:"同比年份"`
+	YearList []int   `description:"指定年份列表"`
 }
 
 // GetChartPredictEdbInfoDataListByRuleAnnualValueInversion 根据 年度值倒推 规则获取预测数据

+ 0 - 1
utils/constants.go

@@ -174,7 +174,6 @@ const (
 	DATA_SOURCE_BUSINESS                             = 84       // 来源于自有数据
 	DATA_SOURCE_SCI99                                = 85       // 卓创资讯 -> 85
 	DATA_SOURCE_SCI_HQ                               = 88       // 卓创红期->88
-	DATA_SOURCE_PREDICT_STATIC                       = 94       // 静态指标 -> 94
 )
 
 // 数据刷新频率