Browse Source

合并冲突

kobe6258 3 days ago
parent
commit
7a2ca71c6c
1 changed files with 7 additions and 8 deletions
  1. 7 8
      services/data/predict_edb_info_rule.go

+ 7 - 8
services/data/predict_edb_info_rule.go

@@ -1537,7 +1537,7 @@ type AnnualValueInversionConf struct {
 	YearList []int   `description:"指定年份列表"`
 }
 
-func getReplaceValue(replaceValueMap map[string]float64, days, dayStepForward int,dayStepBack int, currentDate time.Time) (replaceValue decimal.Decimal, success bool) {
+func getReplaceValue(replaceValueMap map[string]float64, days, dayStepForward int, dayStepBack int, currentDate time.Time) (replaceValue decimal.Decimal, success bool) {
 	nextDateDay := currentDate
 	backDateDay := currentDate
 	for i := 0; i <= days; i++ {
@@ -1548,7 +1548,7 @@ func getReplaceValue(replaceValueMap map[string]float64, days, dayStepForward in
 			return
 		}
 		backDateDayStr := backDateDay.Format(utils.FormatDate)
-		if backValue,ok:=replaceValueMap[backDateDayStr]; ok { //上一年同期->下一个月找到
+		if backValue, ok := replaceValueMap[backDateDayStr]; ok { //上一年同期->下一个月找到
 			replaceValue = decimal.NewFromFloat(backValue)
 			success = true
 			return
@@ -1594,7 +1594,6 @@ func GetChartPredictEdbInfoDataListByRuleDynamicYOYComparisonOrDifference(ruleTy
 		return
 	}
 	if len(dynamicYOYComparisonIndexDataList) <= 0 {
-		//err = errors.New(fmt.Sprintf("选择%s指标没有预测数据", yoyType))
 		return
 	} else {
 		for _, v := range dynamicYOYComparisonIndexDataList {
@@ -1610,7 +1609,7 @@ func GetChartPredictEdbInfoDataListByRuleDynamicYOYComparisonOrDifference(ruleTy
 			baseDynamicDataList[preDateStr] = decimal.NewFromFloat(preValue)
 			predictDayList = append(predictDayList, date)
 		} else {
-			if replaceValue, replaceOk := getReplaceValue(existMap, 35, 1,-1, preDate); !replaceOk {
+			if replaceValue, replaceOk := getReplaceValue(existMap, 35, 1, -1, preDate); !replaceOk {
 				continue
 			} else {
 				baseDynamicDataList[preDateStr] = replaceValue
@@ -1625,10 +1624,10 @@ func GetChartPredictEdbInfoDataListByRuleDynamicYOYComparisonOrDifference(ruleTy
 		var calculateValue decimal.Decimal
 		var dateStr = currentDate.Format(utils.FormatDate)
 		preDate := currentDate.AddDate(-1, 0, 0)
-		var preDateStr=preDate.Format(utils.FormatDate)
-		_, dynamicVal := DynamicCalculateDataList[dateStr];
-		_, baseVal := baseDynamicDataList[preDateStr];
-		if dynamicVal && baseVal{
+		preDateStr := preDate.Format(utils.FormatDate)
+		_, dynamicVal := DynamicCalculateDataList[dateStr]
+		_, baseVal := baseDynamicDataList[preDateStr]
+		if dynamicVal && baseVal {
 			switch ruleType {
 			case 17:
 				calculateValue = baseDynamicDataList[preDateStr].Mul(DynamicCalculateDataList[dateStr].Add(decimal.NewFromInt(1)))