Browse Source

Merge branch 'ETA_1.9.4' into debug

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

+ 46 - 16
services/data/chart_info.go

@@ -3893,10 +3893,10 @@ func SeasonChartData(dataList []*data_manage.ChartEdbInfoMapping, seasonExtraCon
 								// 全年截取一部分
 								newDate = dateTime.AddDate(time.Now().Year()-dateTime.Year(), 0, 0)
 
-								if newDate.Before(startDate.AddDate(0,0,1)) && newDate.After(endDate) {
+								if newDate.Before(startDate.AddDate(0, 0, 1)) && newDate.After(endDate) {
 									continue
 								}
-								if newDate.After(startDate.AddDate(0,0,-1)) {
+								if newDate.After(startDate.AddDate(0, 0, -1)) {
 									// 减一年
 									newDate = newDate.AddDate(-1, 0, 0)
 								}
@@ -3921,26 +3921,50 @@ func SeasonChartData(dataList []*data_manage.ChartEdbInfoMapping, seasonExtraCon
 							} else {
 								// 如果跨年且大于等于一年
 								// double后截取
-								newDate = dateTime.AddDate(time.Now().Year()-dateTime.Year(), 0, 0)
-
-								// 处理上下限列表
-								if value, ok := maxValueMap[newDate]; ok {
-									if value < handleDataMap[date] {
+								newDate = dateTime.AddDate(time.Now().Year()-dateTime.Year() - 1, 0, 0)
+								if newDate.After(startDate) {
+									// 处理上下限列表
+									if value, ok := maxValueMap[newDate]; ok {
+										if value < handleDataMap[date] {
+											maxValueMap[newDate] = handleDataMap[date]
+										}
+									} else {
 										maxValueMap[newDate] = handleDataMap[date]
 									}
-								} else {
-									maxValueMap[newDate] = handleDataMap[date]
+
+									if value, ok := minValueMap[newDate]; ok {
+										if value > handleDataMap[date] {
+											minValueMap[newDate] = handleDataMap[date]
+										}
+									} else {
+										minValueMap[newDate] = handleDataMap[date]
+									}
+
+									dataTimeMap[newDate] = newDate
 								}
 
-								if value, ok := minValueMap[newDate]; ok {
-									if value > handleDataMap[date] {
+								newDate = dateTime.AddDate(time.Now().Year()-dateTime.Year(), 0, 0)
+								if newDate.Before(endDate) {
+									// 处理上下限列表
+									if value, ok := maxValueMap[newDate]; ok {
+										if value < handleDataMap[date] {
+											maxValueMap[newDate] = handleDataMap[date]
+										}
+									} else {
+										maxValueMap[newDate] = handleDataMap[date]
+									}
+
+									if value, ok := minValueMap[newDate]; ok {
+										if value > handleDataMap[date] {
+											minValueMap[newDate] = handleDataMap[date]
+										}
+									} else {
 										minValueMap[newDate] = handleDataMap[date]
 									}
-								} else {
-									minValueMap[newDate] = handleDataMap[date]
+
+									dataTimeMap[newDate] = newDate
 								}
 
-								dataTimeMap[newDate] = newDate
 
 							}
 						} else {
@@ -4020,8 +4044,14 @@ func SeasonChartData(dataList []*data_manage.ChartEdbInfoMapping, seasonExtraCon
 				}
 				//if seasonConfig.JumpYear == 1 {
 				//	if startDate.After(endDate) {
-				//		maxMinItem.DataTime = v.Format(utils.FormatDate)
-				//		maxMinItem.DataTimestamp = v.UnixNano() / 1e6
+				//		// 跨年且不到一年,修改年份
+				//		if v.After(endDate) {
+				//			maxMinItem.DataTime = v.AddDate(-1, 0, 0).Format(utils.FormatDate)
+				//			maxMinItem.DataTimestamp = v.AddDate(-1, 0, 0).UnixNano() / 1e6
+				//		} else {
+				//			maxMinItem.DataTime = v.Format(utils.FormatDate)
+				//			maxMinItem.DataTimestamp = v.UnixNano() / 1e6
+				//		}
 				//
 				//		maxMinDataList = append(maxMinDataList, maxMinItem)
 				//	}