Browse Source

Merge branch 'hotfix/custom_balance_table' of eta_server/eta_api into custom

xyxie 8 months ago
parent
commit
7d930cc7f5
2 changed files with 22 additions and 24 deletions
  1. 19 21
      services/data/chart_info_excel_balance.go
  2. 3 3
      services/data/excel/balance_table.go

+ 19 - 21
services/data/chart_info_excel_balance.go

@@ -89,18 +89,15 @@ func AddBalanceExcelChart(excelInfo *excelModel.ExcelInfo, req request.AddBalanc
 		var dataList []*excelModel.ExcelChartData
 		if excelInfo.BalanceType == 1 {
 			tmpList, ok := dataListMap[k]
-			if !ok {
-				errMsg = "查询图表数据失败!"
-				err = fmt.Errorf("查询图表数据失败!%s", err.Error())
-				return
-			}
-			for _, l := range tmpList {
-				tmp := &excelModel.ExcelChartData{
-					DataTime:      l.DataTime,
-					Value:         l.Value,
-					DataTimestamp: l.DataTimestamp,
+			if ok {
+				for _, l := range tmpList {
+					tmp := &excelModel.ExcelChartData{
+						DataTime:      l.DataTime,
+						Value:         l.Value,
+						DataTimestamp: l.DataTimestamp,
+					}
+					dataList = append(dataList, tmp)
 				}
-				dataList = append(dataList, tmp)
 			}
 		}
 
@@ -382,19 +379,20 @@ func EditBalanceExcelChart(excelInfo *excelModel.ExcelInfo, req request.AddBalan
 		var dataList []*excelModel.ExcelChartData
 		if excelInfo.BalanceType == 1 {
 			tmpList, ok := dataListMap[k]
-			if !ok {
-				errMsg = "查询图表数据失败!"
+			if ok {
+				/*errMsg = "查询图表数据失败!"
 				err = fmt.Errorf("查询图表数据失败!")
-				return
-			}
-			for _, l := range tmpList {
-				tmp := &excelModel.ExcelChartData{
-					DataTime:      l.DataTime,
-					Value:         l.Value,
-					DataTimestamp: l.DataTimestamp,
+				return*/
+				for _, l := range tmpList {
+					tmp := &excelModel.ExcelChartData{
+						DataTime:      l.DataTime,
+						Value:         l.Value,
+						DataTimestamp: l.DataTimestamp,
+					}
+					dataList = append(dataList, tmp)
 				}
-				dataList = append(dataList, tmp)
 			}
+
 		}
 
 		// 处理日期列表和值列表

+ 3 - 3
services/data/excel/balance_table.go

@@ -208,7 +208,7 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 					err = errors.New(errMsg)
 					return
 				}
-				dateList = append(dateList, currCell.Value)
+				dateList = append(dateList, currCell.ShowValue)
 				//dateList[i] = currCell.ShowValue
 				i++
 			}
@@ -268,7 +268,7 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 					err = errors.New(errMsg)
 					return
 				}
-				dataList = append(dataList, currCell.Value)
+				dataList = append(dataList, currCell.ShowValue)
 				//dataList[i] = currCell.ShowValue
 				i++
 			}
@@ -304,7 +304,7 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excelModel.ExcelChartEdb, newMi
 					err = errors.New(errMsg)
 					return
 				}
-				dataList = append(dataList, currCell.Value)
+				dataList = append(dataList, currCell.ShowValue)
 				//dataList[i] = currCell.ShowValue
 				i++
 			}