Roc 2 anos atrás
pai
commit
44af49bac7
2 arquivos alterados com 10 adições e 6 exclusões
  1. 0 6
      controller/chart/chart_info.go
  2. 10 0
      services/chart/chart_info.go

+ 0 - 6
controller/chart/chart_info.go

@@ -104,12 +104,6 @@ func GetChartInfoDetail(c *gin.Context) {
 	case 6:
 		if startDate == "" && chartInfo.StartDate != "" {
 			startDate = chartInfo.StartDate
-		} else {
-			startDate = startDate + "-01"
-		}
-		//兼容日期数据为2022-09的错误
-		if strings.Count(startDate, "-") == 1 {
-			startDate = startDate + "-01"
 		}
 	case 7:
 		startDate = "2018-01-01"

+ 10 - 0
services/chart/chart_info.go

@@ -694,6 +694,11 @@ func BarChartData(mappingList []*chartEdbMappingModel.ChartEdbInfoMapping, edbDa
 		// 日期配置
 		barChartInfoDate := barChartInfoDateList[barChartInfoSort.DateIndex]
 		for edbInfoId, dataList := range edbDataListMap {
+			if len(dataList) <= 0 {
+				// 没有数据的指标id
+				notDataEdbIdList = append(notDataEdbIdList, edbInfoId)
+				continue
+			}
 			findDate := barChartInfoDate.Date
 			switch barChartInfoDate.Type {
 			case 1: //最新值
@@ -783,6 +788,11 @@ func BarChartData(mappingList []*chartEdbMappingModel.ChartEdbInfoMapping, edbDa
 		for _, edbInfoId := range edbIdList {
 			findDate := barChartInfoDate.Date     //需要的日期值
 			dataList := edbDataListMap[edbInfoId] //指标的所有数据值
+			if len(dataList) <= 0 {
+				// 没有数据的指标id
+				findDataList = append(findDataList, 0)
+				continue
+			}
 			switch barChartInfoDate.Type {
 			case 1: //最新值
 				dataList := edbDataListMap[edbInfoId]