Browse Source

fix:数据精度问题

Roc 2 years ago
parent
commit
18f0783709
1 changed files with 3 additions and 2 deletions
  1. 3 2
      models/edb_data_calculate_bp.go

+ 3 - 2
models/edb_data_calculate_bp.go

@@ -584,7 +584,7 @@ func RefreshAllCalculateBp(edbInfoId, source int, fromEdbInfo *EdbInfo, edbCode,
 
 			day := int(nowDate.Sub(firstExistDataTime).Hours() / float64(24))
 
-			//第步: 已经入库的数据处理
+			//第步: 已经入库的数据处理
 			for _, v := range existDataList {
 				existDataMap[v.DataTime] = v
 			}
@@ -596,7 +596,8 @@ func RefreshAllCalculateBp(edbInfoId, source int, fromEdbInfo *EdbInfo, edbCode,
 				if ok {
 					if tmpLastValue, ok := fromDataMap[tmpExistData.DataTime]; ok { //来源指标当天的数据
 						lastValue = tmpLastValue
-						lastValueStr = decimal.NewFromFloat(lastValue).String()
+						//lastValueStr = decimal.NewFromFloat(lastValue).String()
+						lastValueStr = fmt.Sprintf("%.4f", lastValue)
 					}
 					//如果对应的值不匹配
 					if tmpExistData.Value != lastValueStr {