Jelajahi Sumber

Merge branch 'hotfix/edb_calculate_0726' into debug

hsun 8 bulan lalu
induk
melakukan
759fe968e3
2 mengubah file dengan 11 tambahan dan 1 penghapusan
  1. 1 1
      models/base_from_calculate.go
  2. 10 0
      models/edb_info.go

+ 1 - 1
models/base_from_calculate.go

@@ -490,7 +490,7 @@ func refreshAllCalculate(to orm.TxOrmer, edbInfoIdArr []*EdbInfo, edbInfoTag map
 		}
 		// 有计算出来值,那么就从待删除指标中移除
 		delete(removeDateMap, sk)
-		saveValue := decimal.NewFromFloat(calVal).RoundCeil(4).String() //utils.SubFloatToString(calVal, 4)
+		saveValue := decimal.NewFromFloat(calVal).Round(4).String() //utils.SubFloatToString(calVal, 4)
 		if existVal, ok := dataMap[sk]; !ok {
 			dataTime, _ := time.ParseInLocation(utils.FormatDate, sk, time.Local)
 			timestamp := dataTime.UnixNano() / 1e6

+ 10 - 0
models/edb_info.go

@@ -1387,6 +1387,16 @@ func EdbInfoAdd(req *AddEdbInfoParams, serverUrl string, sysUserId int, sysUserR
 			err = errors.New("指标信息不全")
 			return
 		}
+
+		// 兼容数据
+		{
+			if req.Frequency == `` {
+				req.Frequency = tmpItem.Frequency
+			}
+			if req.Unit == `` {
+				req.Unit = tmpItem.Unit
+			}
+		}
 	}
 
 	edbInfo.EdbCode = req.EdbCode