|
@@ -3345,6 +3345,10 @@ func SeasonChartData(dataList []*data_manage.ChartEdbInfoMapping, seasonExtraCon
|
|
|
if dateTime.Year() == time.Now().Year() {
|
|
|
continue
|
|
|
}
|
|
|
+ // 不包含2月29号
|
|
|
+ if dateTime.Month() == 2 && dateTime.Day() == 29 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
newDate := dateTime.AddDate(time.Now().Year()-dateTime.Year(), 0, 0)
|
|
|
// 处理上下限列表
|
|
|
if value, ok := maxValueMap[newDate]; ok {
|
|
@@ -3377,6 +3381,10 @@ func SeasonChartData(dataList []*data_manage.ChartEdbInfoMapping, seasonExtraCon
|
|
|
if dateTime.Year() == time.Now().Year() {
|
|
|
continue
|
|
|
}
|
|
|
+ // 不包含2月29号
|
|
|
+ if dateTime.Month() == 2 && dateTime.Day() == 29 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
newDate := dateTime.AddDate(time.Now().Year()-dateTime.Year(), 0, 0)
|
|
|
|
|
|
if value, ok := maxValueMap[newDate]; ok {
|
|
@@ -3860,7 +3868,7 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
|
|
|
faloatList = append(faloatList, vv.Value)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ sort.Float64s(faloatList)
|
|
|
markerLineValue = PercentileAlgorithm(markerLine.CalculationValue, faloatList)
|
|
|
value = fmt.Sprintf("%.2f", markerLineValue)
|
|
|
}
|
|
@@ -3904,10 +3912,120 @@ func MarkerLineCalculate(markerLine data_manage.MarkersLine, dataList interface{
|
|
|
floatList = append(floatList, dataItem.Value)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ sort.Float64s(floatList)
|
|
|
markerLineValue = PercentileAlgorithm(markerLine.CalculationValue, floatList)
|
|
|
value = fmt.Sprintf("%.2f", markerLineValue)
|
|
|
}
|
|
|
+ } else if markerLine.Calculation == 4 {
|
|
|
+ // 数值分位
|
|
|
+ markerLineValue := 0.0
|
|
|
+ maxValue := 0.0
|
|
|
+ minValue := 0.0
|
|
|
+ if chartInfo.ChartType == 2 && markerLine.EdbType == 0 {
|
|
|
+ //季节性图结构体不一样
|
|
|
+ quarterDataList := dataList.(data_manage.QuarterDataList)
|
|
|
+ for _, quarterData := range quarterDataList[len(quarterDataList)-1:] {
|
|
|
+ for _, vv := range quarterData.DataList {
|
|
|
+ if markerLine.TimeIntervalType == 1 {
|
|
|
+ startDate := markerLine.StartDate.Date
|
|
|
+ endDate := time.Now().Format(utils.FormatDate)
|
|
|
+ if markerLine.StartDate.TimeType == 2 {
|
|
|
+ // 动态
|
|
|
+ if markerLine.StartDate.Conf.BaseDate == 1 {
|
|
|
+ // 指标最新日期
|
|
|
+ startDate = quarterData.DataList[len(quarterData.DataList)-1].DataTime
|
|
|
+ } else {
|
|
|
+ // 系统日期
|
|
|
+ startDate = time.Now().Format(utils.FormatDate)
|
|
|
+ }
|
|
|
+ startDate, err = HandleDateChange(startDate, markerLine.StartDate.Conf)
|
|
|
+ }
|
|
|
+ if markerLine.EndDate.TimeType == 1 {
|
|
|
+ // 固定
|
|
|
+ endDate = markerLine.EndDate.Date
|
|
|
+ } else if markerLine.EndDate.TimeType == 2 {
|
|
|
+ // 动态
|
|
|
+ if markerLine.StartDate.Conf.BaseDate == 1 {
|
|
|
+ // 指标最新日期
|
|
|
+ endDate = quarterData.DataList[len(quarterData.DataList)-1].DataTime
|
|
|
+ } else {
|
|
|
+ // 系统日期
|
|
|
+ endDate = time.Now().Format(utils.FormatDate)
|
|
|
+ }
|
|
|
+ endDate, err = HandleDateChange(endDate, markerLine.StartDate.Conf)
|
|
|
+ }
|
|
|
+ if vv.DataTime >= startDate && vv.DataTime <= endDate {
|
|
|
+ if maxValue < vv.Value {
|
|
|
+ maxValue = vv.Value
|
|
|
+ }
|
|
|
+ if minValue > vv.Value {
|
|
|
+ minValue = vv.Value
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if maxValue < vv.Value {
|
|
|
+ maxValue = vv.Value
|
|
|
+ }
|
|
|
+ if minValue > vv.Value {
|
|
|
+ minValue = vv.Value
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ markerLineValue = CalculatePercentile(markerLine.CalculationValue, minValue, maxValue)
|
|
|
+ value = fmt.Sprintf("%.2f", markerLineValue)
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ dataList := dataList.([]*data_manage.EdbDataList)
|
|
|
+ for _, dataItem := range dataList {
|
|
|
+ if markerLine.TimeIntervalType == 1 {
|
|
|
+ startDate := markerLine.StartDate.Date
|
|
|
+ endDate := time.Now().Format(utils.FormatDate)
|
|
|
+ if markerLine.StartDate.TimeType == 2 {
|
|
|
+ // 动态
|
|
|
+ if markerLine.StartDate.Conf.BaseDate == 1 {
|
|
|
+ // 指标最新日期
|
|
|
+ startDate = dataList[len(dataList)-1].DataTime
|
|
|
+ } else {
|
|
|
+ // 系统日期
|
|
|
+ startDate = time.Now().Format(utils.FormatDate)
|
|
|
+ }
|
|
|
+ startDate, err = HandleDateChange(startDate, markerLine.StartDate.Conf)
|
|
|
+ }
|
|
|
+ if markerLine.EndDate.TimeType == 1 {
|
|
|
+ // 固定
|
|
|
+ endDate = markerLine.EndDate.Date
|
|
|
+ } else if markerLine.EndDate.TimeType == 2 {
|
|
|
+ // 动态
|
|
|
+ if markerLine.StartDate.Conf.BaseDate == 1 {
|
|
|
+ // 指标最新日期
|
|
|
+ endDate = dataList[len(dataList)-1].DataTime
|
|
|
+ } else {
|
|
|
+ // 系统日期
|
|
|
+ endDate = time.Now().Format(utils.FormatDate)
|
|
|
+ }
|
|
|
+ endDate, err = HandleDateChange(endDate, markerLine.StartDate.Conf)
|
|
|
+ }
|
|
|
+ if dataItem.DataTime >= startDate && dataItem.DataTime <= endDate {
|
|
|
+ if maxValue < dataItem.Value {
|
|
|
+ maxValue = dataItem.Value
|
|
|
+ }
|
|
|
+ if minValue > dataItem.Value {
|
|
|
+ minValue = dataItem.Value
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if maxValue < dataItem.Value {
|
|
|
+ maxValue = dataItem.Value
|
|
|
+ }
|
|
|
+ if minValue > dataItem.Value {
|
|
|
+ minValue = dataItem.Value
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ markerLineValue = CalculatePercentile(markerLine.CalculationValue, minValue, maxValue)
|
|
|
+ value = fmt.Sprintf("%.2f", markerLineValue)
|
|
|
+ }
|
|
|
}
|
|
|
return
|
|
|
}
|
|
@@ -4073,4 +4191,9 @@ func handleSystemAppointDateT2(currDate time.Time, appointDay, frequency string)
|
|
|
}
|
|
|
|
|
|
return
|
|
|
+}
|
|
|
+
|
|
|
+// CalculatePercentile 计算数值分位
|
|
|
+func CalculatePercentile(x float64, min float64, max float64) float64 {
|
|
|
+ return (x / 100) * (max - min) + min
|
|
|
}
|