Browse Source

Merge branch 'ETA_1.9.4' into debug

zwxi 8 months ago
parent
commit
95ea1a3759
1 changed files with 46 additions and 9 deletions
  1. 46 9
      services/data/chart_info.go

+ 46 - 9
services/data/chart_info.go

@@ -4128,7 +4128,13 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
 			quarterDataList := dataList.(data_manage.QuarterDataList)
 			for _, quarterData := range quarterDataList[len(quarterDataList)-1:] {
 				for _, vv := range quarterData.DataList {
-					averge += vv.Value
+					if markerLine.TimeIntervalType == 1 {
+						if vv.DataTime >= markerLine.StartDate.Date && vv.DataTime <= markerLine.EndDate.Date {
+							averge += vv.Value
+						}
+					} else {
+						averge += vv.Value
+					}
 				}
 				averge = averge / float64(len(quarterData.DataList))
 				value = fmt.Sprintf("%.2f", averge)
@@ -4136,13 +4142,18 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
 		} else {
 			dataList := dataList.([]*data_manage.EdbDataList)
 			for _, dataItem := range dataList {
-				averge += dataItem.Value
+				if markerLine.TimeIntervalType == 1 {
+					if dataItem.DataTime >= markerLine.StartDate.Date && dataItem.DataTime <= markerLine.EndDate.Date {
+						averge += dataItem.Value
+					}
+				} else {
+					averge += dataItem.Value
+				}
 			}
 			averge = averge / float64(len(dataList))
 
 			value = fmt.Sprintf("%.2f", averge)
 		}
-
 	} else if markerLine.Calculation == 2 {
 		// 区间均值加N倍标准差
 		averge := 0.0
@@ -4153,8 +4164,15 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
 			quarterDataList := dataList.(data_manage.QuarterDataList)
 			for _, quarterData := range quarterDataList[len(quarterDataList)-1:] {
 				for _, vv := range quarterData.DataList {
-					dataList = append(faloatList, vv.Value)
-					averge += vv.Value
+					if markerLine.TimeIntervalType == 1 {
+						if vv.DataTime >= markerLine.StartDate.Date && vv.DataTime <= markerLine.EndDate.Date {
+							dataList = append(faloatList, vv.Value)
+							averge += vv.Value
+						}
+					} else {
+						dataList = append(faloatList, vv.Value)
+						averge += vv.Value
+					}
 				}
 				averge = averge / float64(len(quarterData.DataList))
 				stdev := utils.CalculateStandardDeviation(faloatList)
@@ -4167,8 +4185,15 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
 			dataList := dataList.([]*data_manage.EdbDataList)
 			floatList := make([]float64, 0)
 			for _, dataItem := range dataList {
-				floatList = append(floatList, dataItem.Value)
-				averge += dataItem.Value
+				if markerLine.TimeIntervalType == 1 {
+					if dataItem.DataTime >= markerLine.StartDate.Date && dataItem.DataTime <= markerLine.EndDate.Date {
+						floatList = append(floatList, dataItem.Value)
+						averge += dataItem.Value
+					}
+				} else {
+					floatList = append(floatList, dataItem.Value)
+					averge += dataItem.Value
+				}
 			}
 			averge = averge / float64(len(dataList))
 
@@ -4186,7 +4211,13 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
 			quarterDataList := dataList.(data_manage.QuarterDataList)
 			for _, quarterData := range quarterDataList[len(quarterDataList)-1:] {
 				for _, vv := range quarterData.DataList {
-					faloatList = append(faloatList, vv.Value)
+					if markerLine.TimeIntervalType == 1 {
+						if vv.DataTime >= markerLine.StartDate.Date && vv.DataTime <= markerLine.EndDate.Date {
+							faloatList = append(faloatList, vv.Value)
+						}
+					} else {
+						faloatList = append(faloatList, vv.Value)
+					}
 				}
 
 				markerLineValue = PercentileAlgorithm(float64(markerLine.CalculationValue), faloatList)
@@ -4197,7 +4228,13 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
 			dataList := dataList.([]*data_manage.EdbDataList)
 			floatList := make([]float64, 0)
 			for _, dataItem := range dataList {
-				floatList = append(floatList, dataItem.Value)
+				if markerLine.TimeIntervalType == 1 {
+					if dataItem.DataTime >= markerLine.StartDate.Date && dataItem.DataTime <= markerLine.EndDate.Date {
+						floatList = append(floatList, dataItem.Value)
+					}
+				} else {
+					floatList = append(floatList, dataItem.Value)
+				}
 			}
 
 			markerLineValue = PercentileAlgorithm(float64(markerLine.CalculationValue), floatList)